commit 78428a99f0da102af6c7b5ee9500c4a3e2e35981 Author: jmarkin Date: Sat Sep 6 13:48:36 2025 +0300 init diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..6ea6480 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +watch_file nix/* +use flake . -Lv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a8b6a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +result +.direnv +.luarc.json diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..6090f42 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aa7e722 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +tests-data: tests/data/bigdata.json tests/data/bigdata.yml + +tests/data/bigdata.json: + +mkdir -p tests/data + +curl -L --progress-bar -o $@ \ + "https://raw.githubusercontent.com/miloyip/nativejson-benchmark/master/data/canada.json" + +tests/data/bigdata.yml: + +mkdir -p tests/data + +base64 /dev/urandom | head --bytes $$(( 5*1024*1024 )) > $@ diff --git a/README.md b/README.md new file mode 100644 index 0000000..760bdae --- /dev/null +++ b/README.md @@ -0,0 +1,332 @@ + +
+
+ + kickstart-nix.nvim + + + + + + + + + + + + + + +

❄️

+

+ + A dead simple Nix flake template repository
+ for Neovim +
+

+ +[![Neovim][neovim-shield]][neovim-url] +[![Nix][nix-shield]][nix-url] +[![Lua][lua-shield]][lua-url] + +[![GPL2 License][license-shield]][license-url] +[![Issues][issues-shield]][issues-url] +
+ + +![](https://github.com/nix-community/kickstart-nix.nvim/assets/12857160/84faa268-82de-4401-acf3-efddc26dd58a) + +## :grey_question: Why kickstart-nix.nvim + +If Nix and Neovim have one thing in common, +it's that many new users don't know where to get started. +Most Nix-based Neovim setups assume deep expertise in both realms, +abstracting away Neovim's core functionalities +as well as the Nix internals used to build a Neovim config. +Frameworks and module-based DSLs are opinionated and difficult to diverge from +with one's own modifications. + +`kickstart-nix.nvim` is different: +It's geared for users of all levels, +making the migration of Neovim configurations to Nix straightforward. +This project aims to be as simple as possible, while allowing +for maximum flexibility. + +> [!NOTE] +> +> Similar to [`kickstart.nvim`](https://github.com/nvim-lua/kickstart.nvim), +> this repository is meant to be used by **you** to begin your +> **Nix**/Neovim journey; remove the things you don't use and add what you miss. + +## :milky_way: Philosophy + +- KISS principle with sane defaults. +- Manage plugins + external dependencies using Nix + (managing plugins shouldn't be the responsibility of a plugin). +- Configuration entirely in Lua[^1] (Vimscript is also possible). + This makes it easy to migrate from non-nix dotfiles. +- Use Neovim's built-in loading mechanisms. See: + - [`:h initialization`](https://neovim.io/doc/user/starting.html#initialization) + - [`:h runtimepath`](https://neovim.io/doc/user/options.html#'runtimepath') + - [`:h packadd`](https://neovim.io/doc/user/repeat.html#%3Apackadd) +- Use Neovim's built-in LSP client, with Nix managing language servers. + +[^1]: The absence of a Nix module DSL for Neovim configuration is deliberate. + If you were to copy the `nvim` directory to `$XDG_CONFIG_HOME`, + and install the plugins, it would work out of the box. + +## :star2: Features + +- Use either nixpkgs or flake inputs as plugin sources. +- Usable on any device with Neovim and Nix installed. +- Create multiple derivations with different sets of plugins, + and simple regex filters to exclude config files. +- Uses Nix to generate a `.luarc.json` in the devShell's `shellHook`. + This sets up lua-language-server to recognize all plugins + and the Neovim API. + +## :bicyclist: Test drive + +If you have Nix installed (with [flakes](https://wiki.nixos.org/wiki/Flakes) enabled), +you can test drive this by running: + +```console +nix run "github:nix-community/kickstart-nix.nvim" +``` + +## :books: Usage + +1. Click on [Use this template](https://github.com/nix-community/kickstart-nix.nvim/generate) +to start a repo based on this template. **Do _not_ fork it**. +1. Add/remove plugins to/from the [Neovim overlay](./nix/neovim-overlay.nix). +1. Add/remove plugin configs to/from the `nvim/plugin` directory. +1. Modify as you wish (you will probably want to add a color theme, ...). + See: [Design](#robot-design). +1. You can create more than one package using the `mkNeovim` function by + - Passing different plugin lists. + - Adding `ignoreConfigRegexes` (e.g. `= [ "^ftplugin/.*.lua" ]`). + +> [!TIP] +> +> The nix and lua files contain comments explaining +> what everything does in detail. + +## :zap: Installation + +### :snowflake: NixOS (with flakes) + +1. Add your flake to you NixOS flake inputs. +1. Add the overlay provided by this flake. + +```nix +nixpkgs.overlays = [ + # replace with the name you chose + .overlays.default +]; +``` + +You can then add the overlay's output(s) to the `systemPackages`: + +```nix +environment.systemPackages = with pkgs; [ + nvim-pkg # The default package added by the overlay +]; +``` + +> [!IMPORTANT] +> +> This flake uses `nixpkgs.wrapNeovimUnstable`, which has an +> unstable signature. If you set `nixpkgs.follows = "nixpkgs";` +> when importing this into your flake.nix, it may break. +> Especially if your nixpkgs input pins a different branch. + +### :penguin: Non-NixOS + +With Nix installed (flakes enabled), from the repo root: + +```console +nix profile install .#nvim +``` + +## :robot: Design + +Directory structure: + +```sh +── flake.nix +── nvim # Neovim configs (lua), equivalent to ~/.config/nvim +── nix # Nix configs +``` + +### :open_file_folder: Neovim configs + +- Set options in `init.lua`. +- Source autocommands, user commands, keymaps, + and configure plugins in individual files within the `plugin` directory. +- Filetype-specific scripts (e.g. start LSP clients) in the `ftplugin` directory. +- Library modules in the `lua/user` directory. + +Directory structure: + +```sh +── nvim + ├── ftplugin # Sourced when opening a file type + │ └── .lua + ├── init.lua # Always sourced + ├── lua # Shared library modules + │ └── user + │ └── .lua + ├── plugin # Automatically sourced at startup + │ ├── autocommands.lua + │ ├── commands.lua + │ ├── keymaps.lua + │ ├── plugins.lua # Plugins that require a `setup` call + │ └── .lua # Plugin configurations + └── after # Empty in this template + ├── plugin # Sourced at the very end of startup (rarely needed) + └── ftplugin # Sourced when opening a filetype, after sourcing ftplugin scripts +``` + +> [!IMPORTANT] +> +> - Configuration variables (e.g. `vim.g.`) should go in `nvim/init.lua` +> or a module that is `require`d in `init.lua`. +> - Configurations for plugins that require explicit initialization +> (e.g. via a call to a `setup()` function) should go in `nvim/plugin/.lua` +> or `nvim/plugin/plugins.lua`. +> - See [Initialization order](#initialization-order) for details. + +### :open_file_folder: Nix + +You can declare Neovim derivations in `nix/neovim-overlay.nix`. + +There are two ways to add plugins: + +- The traditional way, using `nixpkgs` as the source. +- By adding plugins as flake inputs (if you like living on the bleeding-edge). + Plugins added as flake inputs must be built manually. + +Directory structure: + +```sh +── flake.nix +── nix + ├── mkNeovim.nix # Function for creating the Neovim derivation + └── neovim-overlay.nix # Overlay that adds Neovim derivation +``` + +### :mag: Initialization order + +This derivation creates an `init.lua` as follows: + +1. Add `nvim/lua` to the `runtimepath`. +1. Add the content of `nvim/init.lua`. +1. Add `nvim/*` to the `runtimepath`. +1. Add `nvim/after` to the `runtimepath`. + +This means that modules in `nvim/lua` can be `require`d in `init.lua` and `nvim/*/*.lua`. + +Modules in `nvim/plugin/` are sourced automatically, as if they were plugins. +Because they are added to the runtime path at the end of the resulting `init.lua`, +Neovim sources them _after_ loading plugins. + +## :electric_plug: Pre-configured plugins + +This configuration comes with [a few plugins pre-configured](./nix/neovim-overlay.nix). + +You can add or remove plugins by + +- Adding/Removing them in the [Nix list](./nix/neovim-overlay.nix). +- Adding/Removing the config in `nvim/plugin/.lua`. + +## :anchor: Syncing updates + +If you have used this template and would like to fetch updates +that were added later... + +Add this template as a remote: + +```console +git remote add upstream git@github.com:nix-community/kickstart-nix.nvim.git +``` + +Fetch and merge changes: + +```console +git fetch upstream +git merge upstream/main --allow-unrelated-histories +``` + +## :pencil: Editing your config + +When your neovim setup is a nix derivation, editing your config +demands a different workflow than you are used to without nix. +A quick and easy way to test your changes: + +- Perform modifications and stage any new files[^2]. +- Run `nix run /path/to/neovim/#nvim` + or `nix run /path/to/neovim/#nvim -- ` + +[^2]: When adding new files, nix flakes won't pick them up unless they + have been committed or staged. + +This requires a rebuild of the `nvim` derivation, but has the advantage +that if anything breaks, it's only broken during your test run. + +When developing locally you might want to have a faster feedback loop. +Normally the whole Neovim configuration is copied into the store and +the wrapper which nix generates for the derivation calls `nvim` +with `-u /nix/store/path/to/generated-init.lua`. +We can deactivate this behavior with `wrapRc = false`, so that the +config is loaded from `$XDG_CONFIG_HOME/$NVIM_APPNAME`[^3], where +`$NVIM_APPNAME` defaults to `nvim` if the `appName` attribute is not set +in the `mkNeovim` function. + +The Flake exposes a dev shell with a `nvim-dev` package. The lua configuration in `./nvim` +is automatically symlinked to `~/.config/nvim-dev`. + +After activating the shell with `nix develop` or [nix-direnv](https://github.com/nix-community/nix-direnv) +you can run Neovim with `nvim-dev` to automatically reload your lua configuration. All Nix changes still require a rebuild. + + +[^3]: Assuming Linux. Refer to `:h initialization` for Darwin. + + +## :link: Alternative / similar projects + +- [`kickstart.nvim`](https://github.com/nvim-lua/kickstart.nvim): + Single-file Neovim configuration template with a similar philosophy to this project. + Does not use Nix to manage plugins. +- [`neovim-flake`](https://github.com/jordanisaacs/neovim-flake): + Configured using a Nix module DSL. +- [`NixVim`](https://github.com/nix-community/nixvim): + A module system for Neovim, with a focus on plugin configs. +- [`nixCats-nvim`](https://github.com/BirdeeHub/nixCats-nvim): + A project that organises plugins into categories. + It also separates lua and nix configuration. +- [`lz.n`](https://github.com/nvim-neorocks/lz.n): + A plugin-manager agnostic Lua library for lazy-loading plugins. + Can be used with Nix. + +> [!NOTE] +> +> When comparing with projects in the "non-Nix world", this +> repository would be more comparable to `kickstart.nvim` (hence the name), +> while the philosophies of `neovim-flake` and `NixVim` are more in line with +> a Neovim distribution like [`LunarVim`](https://www.lunarvim.org/) +> or [`LazyVim`](https://www.lazyvim.org/) +> (though they are far more minimal by default). + + +[neovim-shield]: https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white +[neovim-url]: https://neovim.io/ +[nix-shield]: https://img.shields.io/badge/nix-0175C2?style=for-the-badge&logo=NixOS&logoColor=white +[nix-url]: https://nixos.org/ +[lua-shield]: https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white +[lua-url]: https://www.lua.org/ +[license-shield]: https://img.shields.io/github/license/nix-community/kickstart-nix.nvim.svg?style=for-the-badge +[license-url]: https://github.com/nix-community/kickstart-nix.nvim/blob/master/LICENSE +[issues-shield]: https://img.shields.io/github/issues/nix-community/kickstart-nix.nvim.svg?style=for-the-badge +[issues-url]: https://github.com/nix-community/kickstart-nix.nvim/issues +[license-shield]: https://img.shields.io/github/license/nix-community/kickstart-nix.nvim.svg?style=for-the-badge +[license-url]: https://github.com/nix-community/kickstart-nix.nvim/blob/master/LICENSE diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bf294a0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,312 @@ +{ + "nodes": { + "cmp-diag-codes": { + "flake": false, + "locked": { + "lastModified": 1684773141, + "narHash": "sha256-dqT0Z950n76vdisegSMv/ODBq5fYt1ITtaJdvdc0nCQ=", + "owner": "JMarkin", + "repo": "cmp-diag-codes", + "rev": "9842c4dc17848d23a413a823c2ef362c91dc81fd", + "type": "github" + }, + "original": { + "owner": "JMarkin", + "repo": "cmp-diag-codes", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gen-luarc": { + "inputs": { + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "luvit-meta": "luvit-meta", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1755304025, + "narHash": "sha256-xVKfjFwc0zMbLMjLTiHz+0llggkjs93SmHkhaa9S3M4=", + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "rev": "1865b0ebb753ae5324d7381b1fa8c98c04ec7509", + "type": "github" + }, + "original": { + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "gen-luarc", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "gen-luarc", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hlargs-nvim": { + "flake": false, + "locked": { + "lastModified": 1750096091, + "narHash": "sha256-PEYo4tcawKgqATbKw46BIus+D0afP6Q0YSrlJ0WHAA4=", + "owner": "m-demare", + "repo": "hlargs.nvim", + "rev": "ce8d705866dae44513ff48613d5e37e4da524d70", + "type": "github" + }, + "original": { + "owner": "m-demare", + "repo": "hlargs.nvim", + "type": "github" + } + }, + "luvit-meta": { + "flake": false, + "locked": { + "lastModified": 1705776742, + "narHash": "sha256-zAAptV/oLuLAAsa2zSB/6fxlElk4+jNZd/cPr9oxFig=", + "owner": "Bilal2453", + "repo": "luvit-meta", + "rev": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60", + "type": "github" + }, + "original": { + "owner": "Bilal2453", + "repo": "luvit-meta", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718714799, + "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1756542300, + "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nvim-yati": { + "flake": false, + "locked": { + "lastModified": 1718009720, + "narHash": "sha256-hsSGj/bKY0FxZi1BlJxa/U2zvJzOwrFSz1W/MUtPunU=", + "owner": "yioneko", + "repo": "nvim-yati", + "rev": "df3dc06076c6fe20a1dcd8643e712af5c252d042", + "type": "github" + }, + "original": { + "owner": "yioneko", + "repo": "nvim-yati", + "type": "github" + } + }, + "root": { + "inputs": { + "cmp-diag-codes": "cmp-diag-codes", + "flake-utils": "flake-utils", + "gen-luarc": "gen-luarc", + "hlargs-nvim": "hlargs-nvim", + "nixpkgs": "nixpkgs_2", + "nvim-yati": "nvim-yati", + "rust-overlay": "rust-overlay", + "yaml-nvim": "yaml-nvim" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757125853, + "narHash": "sha256-noKkYHKpT5lpvNSYrlH56d8cedthZfs010Uv6vTqLT4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "8b70793a6be183536a5d562056dac10b7b36820d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "yaml-nvim": { + "flake": false, + "locked": { + "lastModified": 1757087818, + "narHash": "sha256-UaJmX1gZ7ull6uu6OGJfiCFI5BV37FvoXPrSkxqSJ04=", + "owner": "cuducos", + "repo": "yaml.nvim", + "rev": "c6c7bac834c3f48e1afdb78a7a1d23996a2f89d9", + "type": "github" + }, + "original": { + "owner": "cuducos", + "repo": "yaml.nvim", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ea9682f --- /dev/null +++ b/flake.nix @@ -0,0 +1,93 @@ +{ + description = "Neovim derivation"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Add bleeding-edge plugins here. + # They can be updated with `nix flake update` (make sure to commit the generated flake.lock) + hlargs-nvim = { + url = "github:m-demare/hlargs.nvim"; + flake = false; + }; + nvim-yati = { + url = "github:yioneko/nvim-yati"; + flake = false; + }; + yaml-nvim = { + url = "github:cuducos/yaml.nvim"; + flake = false; + }; + + cmp-diag-codes = { + url = "github:JMarkin/cmp-diag-codes"; + flake = false; + }; + }; + + outputs = + inputs @ { self + , nixpkgs + , flake-utils + , rust-overlay + , ... + }: + let + systems = builtins.attrNames nixpkgs.legacyPackages; + + # This is where the Neovim derivation is built. + neovim-overlay = import ./nix/neovim-overlay.nix { inherit inputs; }; + in + flake-utils.lib.eachSystem systems + (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + (import rust-overlay) + # Import the overlay, so that the final Neovim derivation(s) can be accessed via pkgs. + neovim-overlay + # This adds a function can be used to generate a .luarc.json + # containing the Neovim API all plugins in the workspace directory. + # The generated file can be symlinked in the devShell's shellHook. + inputs.gen-luarc.overlays.default + ]; + }; + shell = pkgs.mkShell { + name = "nvim-devShell"; + buildInputs = with pkgs; [ + # Tools for Lua and Nix development, useful for editing files in this repo + lua-language-server + nixd + stylua + luajitPackages.luacheck + nvim-dev + ]; + shellHook = '' + # symlink the .luarc.json generated in the overlay + ln -fs ${pkgs.nvim-luarc-json} .luarc.json + # allow quick iteration of lua configs + ln -Tfns $PWD/nvim ~/.config/nvim-dev + ''; + }; + in + { + packages = rec { + default = nvim; + nvim = pkgs.nvim-pkg; + }; + devShells = { + default = shell; + }; + }) + // { + # You can add this overlay to your NixOS configuration + overlays.default = neovim-overlay; + }; +} diff --git a/nix/autocomplete.nix b/nix/autocomplete.nix new file mode 100644 index 0000000..994a3d4 --- /dev/null +++ b/nix/autocomplete.nix @@ -0,0 +1,71 @@ +{ inputs, pkgs, mkNvimPlugin, lib, ... }: +let + + version = "2025-08-28"; + + src = pkgs.fetchFromGitHub { + owner = "Saghen"; + repo = "blink.pairs"; + rev = "3cf0b660caf266992d6c62eb1f6049c483b35409"; + hash = "sha256-pE5HxryAfpMLRSRddr9kqhpI9hTnHZL/qgtHU53gt6k="; + }; + + + rustPlatform = pkgs.makeRustPlatform { + cargo = pkgs.rust-bin.nightly."2025-04-12".minimal; + rustc = pkgs.rust-bin.nightly."2025-04-12".minimal; + }; + + blink-pairs-lib = rustPlatform.buildRustPackage { + pname = "blink-pairs"; + inherit version src; + + cargoHash = "sha256-Cn9zRsQkBwaKbBD/JEpFMBOF6CBZTDx7fQa6Aoic4YU="; + + doCheck = false; + nativeBuildInputs = [ + pkgs.pkg-config + ]; + }; + blink-pairs = pkgs.vimUtils.buildVimPlugin { + pname = "blink.pairs"; + inherit version src; + + preInstall = + let + ext = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; + in + '' + mkdir -p target/release + ln -s ${blink-pairs-lib}/lib/libblink_pairs${ext} target/release/ + ''; + + passthru = { + updateScript = pkgs.nix-update-script { + attrPath = "vimPlugins.blink-pairs.blink-pairs-lib"; + }; + + # needed for the update script + inherit blink-pairs-lib; + }; + + meta = { + description = "Rainbow highlighting and intelligent auto-pairs for Neovim"; + homepage = "https://github.com/Saghen/blink.pairs"; + changelog = "https://github.com/Saghen/blink.pairs/blob/${src.tag}/CHANGELOG.md"; + license = lib.licenses.mit; + }; + }; +in +with pkgs.vimPlugins; [ + blink-cmp + blink-pairs + friendly-snippets + lazydev-nvim + neogen + colorful-menu-nvim + blink-compat + cmp-nvim-tags + (mkNvimPlugin inputs.cmp-diag-codes "cmp-diag-codes") + +] diff --git a/nix/lang/default.nix b/nix/lang/default.nix new file mode 100644 index 0000000..1ae571c --- /dev/null +++ b/nix/lang/default.nix @@ -0,0 +1,19 @@ +{ pkgs, mkNvimPlugin, inputs, ... }: +let + callPackage = (file: pkgs.callPackage file { + inherit inputs pkgs mkNvimPlugin; + }); + unsorted = callPackage ./unsorted.nix; + go = callPackage ./go.nix; + lua = callPackage ./lua.nix; + rust = callPackage ./rust.nix; + nix = callPackage ./nix.nix; + sql = callPackage ./sql.nix; + python = callPackage ./python.nix; + + langs = [ unsorted go lua rust nix sql python ]; +in +{ + plugins = builtins.concatMap (x: x.plugins) langs; + packages = builtins.concatMap (x: x.packages) langs; +} diff --git a/nix/lang/go.nix b/nix/lang/go.nix new file mode 100644 index 0000000..d614be1 --- /dev/null +++ b/nix/lang/go.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +{ + + packages = with pkgs; [ + go + golangci-lint + gopls + gotools + + # gofumpt + # golines + # gomodifytags + # iferr + # impl + # ginkgo + # mockgen + # govulncheck + + ]; + + plugins = [ ]; +} diff --git a/nix/lang/lua.nix b/nix/lang/lua.nix new file mode 100644 index 0000000..9d0f97a --- /dev/null +++ b/nix/lang/lua.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +{ + + packages = with pkgs; [ + lua-language-server + stylua + ]; + + plugins = with pkgs.vimPlugins;[ + { + plugin = lazydev-nvim; + optional = true; + type = "lua"; + config = /*lua*/'' + require('lze').load { + 'lazydev-nvim', + ft= { "lua" } + } + ''; + } + ]; +} diff --git a/nix/lang/nix.nix b/nix/lang/nix.nix new file mode 100644 index 0000000..afd2d7e --- /dev/null +++ b/nix/lang/nix.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + + packages = with pkgs; [ + nixd + nixpkgs-fmt + ]; + + plugins = []; +} diff --git a/nix/lang/python.nix b/nix/lang/python.nix new file mode 100644 index 0000000..ea0312f --- /dev/null +++ b/nix/lang/python.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + packages = with pkgs; [ + python313Packages.ipython + + ruff + ty + ]; + + plugins = []; + +} diff --git a/nix/lang/rust.nix b/nix/lang/rust.nix new file mode 100644 index 0000000..81179ce --- /dev/null +++ b/nix/lang/rust.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + + packages = with pkgs; [ + rust-analyzer + cargo + + graphviz + ]; + + + plugins = with pkgs.vimPlugins;[ + { + plugin = rustaceanvim; + optional = false; + } + ]; + +} diff --git a/nix/lang/sql.nix b/nix/lang/sql.nix new file mode 100644 index 0000000..30d379c --- /dev/null +++ b/nix/lang/sql.nix @@ -0,0 +1,64 @@ +{ pkgs, ... }: +{ + + packages = with pkgs; [ + sqlfluff + postgresql + ]; + + plugins = with pkgs.vimPlugins;[ + { + plugin = vim-dadbod; + optional = true; + type = "lua"; + config = /*lua*/'' + require("lze").load { + "vim-dadbod", + on_plugin = "vim-dadbod-ui", + ft= { "sql", "mssql", "plsql" } + } + ''; + } + { + plugin = vim-dadbod-completion; + optional = true; + type = "lua"; + config = /*lua*/'' + require('lze').load { + 'vim-dadbod', + on_plugin = "vim-dadbod-ui", + ft= { "sql", "mssql", "plsql" } + } + ''; + } + { + plugin = vim-dadbod-ui; + optional = true; + type = "lua"; + config = /*lua*/'' + require('lze').load { + 'vim-dadbod-ui', + cmd = { "DBUI", "DBUIToggle" }, + before = function(event) + vim.g.db_ui_execute_on_save = 0 + vim.g.db_ui_win_position = "right" + vim.g.db_ui_show_database_icon = 1 + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_env_variable_url = "DATABASE_URL" + vim.g.db_ui_use_nvim_notify = true + vim.g.db_ui_auto_execute_table_helpers = 1 + + autocmd("FileType", { + pattern = { "dbui" }, + callback = function() + vim.keymap.set("n", "", "(DBUI_SelectLine)", { buffer = event.buffer, silent = true }) + end, + }) + end, + } + ''; + } + + ]; + +} diff --git a/nix/lang/unsorted.nix b/nix/lang/unsorted.nix new file mode 100644 index 0000000..657c2dc --- /dev/null +++ b/nix/lang/unsorted.nix @@ -0,0 +1,93 @@ +{ inputs, mkNvimPlugin, pkgs, ... }: +let + + yaml-nvim = (mkNvimPlugin inputs.yaml-nvim "yaml.nvim"); +in +{ + packages = with pkgs; [ + bash-language-server + yaml-language-server + # systemd-language-server + # nginx-language-server + docker-language-server + + vacuum-go + taplo + + vscode-langservers-extracted + + biome + + ]; + + plugins = with pkgs.vimPlugins; [ + { + plugin = nvim-lint; + type = "lua"; + optional = true; + config = /*lua*/'' + require("lze").load { + "nvim-lint", + after = function() + require("lint").linters_by_ft = vim.g.linter_by_ft + require("lint").linters.sqlfluff.args = { + "lint", + "--format=json", + "--dialect=postgres", + } + end + } + ''; + } + { + plugin = conform-nvim; + type = "lua"; + optional = true; + config = /*lua*/'' + require("lze").load { + "conform.nvim", + cmd = { "ConformInfo" }, + after = function() + require("conform").setup({ + formatters_by_ft = vim.g.formatters_by_ft, + default_format_opts = { + lsp_format = "fallback", + }, + -- Customize formatters + formatters = { + sqlfluff = { + prepend_args = { "--dialect", "postgres" }, + }, + }, + }) + end + } + ''; + } + + { + plugin = SchemaStore-nvim; + type = "lua"; + optional = true; + config = /*lua*/'' + require("lze").load { + "schemastore.nvim", + } + ''; + } + { + plugin = yaml-nvim; + type = "lua"; + optional = true; + config = /*lua*/'' + require("lze").load { + "yaml.nvim", + ft = {"yaml"} + } + ''; + } + + + ]; +} + diff --git a/nix/mkNeovim.nix b/nix/mkNeovim.nix new file mode 100644 index 0000000..956fab9 --- /dev/null +++ b/nix/mkNeovim.nix @@ -0,0 +1,233 @@ +# Function for creating a Neovim derivation +{ lib +, stdenv +, sqlite +, git +, neovim-unwrapped +, # Set by the overlay to ensure we use a compatible version of `wrapNeovimUnstable` + wrapNeovimUnstable +, neovimUtils +, +}: +with lib; +{ + # NVIM_APPNAME - Defaults to 'nvim' if not set. + # If set to something else, this will also rename the binary. + appName ? null +, plugins ? [ ] +, # List of plugins + # List of dev plugins (will be bootstrapped) - useful for plugin developers + # { name = ; url = ; } + devPlugins ? [ ] +, # Regexes for config files to ignore, relative to the nvim directory. + # e.g. [ "^plugin/neogit.lua" "^ftplugin/.*.lua" ] + ignoreConfigRegexes ? [ ] +, extraPackages ? [ ] +, # Extra runtime dependencies (e.g. ripgrep, ...) + # The below arguments can typically be left as their defaults + # Additional lua packages (not plugins), e.g. from luarocks.org. + # e.g. p: [p.jsregexp] + extraLuaPackages ? p: [ ] +, # Additional python 3 packages + extraPython3Packages ? p: [ ] +, # Build Neovim with Python 3 support? + withPython3 ? true +, # Build Neovim with Ruby support? + withRuby ? false +, # Build Neovim with NodeJS support? + withNodeJs ? false +, # Add sqlite? This is a dependency for some plugins + withSqlite ? false +, # You probably don't want to create vi or vim aliases + # if the appName is something different than "nvim" + # Add a "vi" binary to the build output as an alias? + viAlias ? appName == null || appName == "nvim" +, # Add a "vim" binary to the build output as an alias? + vimAlias ? appName == null || appName == "nvim" +, wrapRc ? true +, +}: +let + # This is the structure of a plugin definition. + # Each plugin in the `plugins` argument list can also be defined as this attrset + defaultPlugin = { + plugin = null; # e.g. nvim-lspconfig + config = null; # plugin config + # If `optional` is set to `false`, the plugin is installed in the 'start' packpath + # set to `true`, it is installed in the 'opt' packpath, and can be lazy loaded with + # ':packadd! {plugin-name} + optional = true; + runtime = { }; + type = "lua"; + }; + + externalPackages = extraPackages ++ (optionals withSqlite [ sqlite ]); + + # Map all plugins to an attrset { plugin = ; config = ; optional = ; ... } + normalizedPlugins = map + (x: + defaultPlugin + // ( + if x ? plugin + then x + else { plugin = x; optional = true; type = "lua"; } + )) + plugins; + + # This nixpkgs util function creates an attrset + # that pkgs.wrapNeovimUnstable uses to configure the Neovim build. + neovimConfig = neovimUtils.makeNeovimConfig { + inherit extraPython3Packages withPython3 withRuby withNodeJs viAlias vimAlias; + plugins = normalizedPlugins; + }; + + # This uses the ignoreConfigRegexes list to filter + # the nvim directory + nvimRtpSrc = + let + src = ../nvim; + in + lib.cleanSourceWith { + inherit src; + name = "nvim-rtp-src"; + filter = path: tyoe: + let + srcPrefix = toString src + "/"; + relPath = lib.removePrefix srcPrefix (toString path); + in + lib.all (regex: builtins.match regex relPath == null) ignoreConfigRegexes; + }; + + # Split runtimepath into 3 directories: + # - lua, to be prepended to the rtp at the beginning of init.lua + # - nvim, containing plugin, ftplugin, ... subdirectories + # - after, to be sourced last in the startup initialization + # See also: https://neovim.io/doc/user/starting.html + nvimRtp = stdenv.mkDerivation { + name = "nvim-rtp"; + src = nvimRtpSrc; + + buildPhase = '' + mkdir -p $out/nvim + mkdir -p $out/lua + rm init.lua + ''; + + installPhase = '' + cp -r lua $out/lua + rm -r lua + # Copy nvim/after only if it exists + if [ -d "after" ]; then + cp -r after $out/after + rm -r after + fi + # Copy rest of nvim/ subdirectories only if they exist + if [ ! -z "$(ls -A)" ]; then + cp -r -- * $out/nvim + fi + ''; + }; + + # The final init.lua content that we pass to the Neovim wrapper. + # It wraps the user init.lua, prepends the lua lib directory to the RTP + # and prepends the nvim and after directory to the RTP + # It also adds logic for bootstrapping dev plugins (for plugin developers) + initLua = + '' + -- prepend lua directory + vim.opt.rtp:prepend('${nvimRtp}/lua') + '' + # Wrap init.lua + + (builtins.readFile ../nvim/init.lua) + # Bootstrap/load dev plugins + + optionalString (devPlugins != [ ]) ( + '' + local dev_pack_path = vim.fn.stdpath('data') .. '/site/pack/dev' + local dev_plugins_dir = dev_pack_path .. '/opt' + local dev_plugin_path + '' + + strings.concatMapStringsSep + "\n" + (plugin: '' + dev_plugin_path = dev_plugins_dir .. '/${plugin.name}' + if vim.fn.empty(vim.fn.glob(dev_plugin_path)) > 0 then + vim.notify('Bootstrapping dev plugin ${plugin.name} ...', vim.log.levels.INFO) + vim.cmd('!${git}/bin/git clone ${plugin.url} ' .. dev_plugin_path) + end + vim.cmd('packadd! ${plugin.name}') + '') + devPlugins + ) + # Prepend nvim and after directories to the runtimepath + # NOTE: This is done after init.lua, + # because of a bug in Neovim that can cause filetype plugins + # to be sourced prematurely, see https://github.com/neovim/neovim/issues/19008 + # We prepend to ensure that user ftplugins are sourced before builtin ftplugins. + + '' + vim.opt.rtp:prepend('${nvimRtp}/nvim') + vim.opt.rtp:prepend('${nvimRtp}/after') + ''; + + # Add arguments to the Neovim wrapper script + extraMakeWrapperArgs = + let + sqliteLibExt = stdenv.hostPlatform.extensions.sharedLibrary; + sqliteLibPath = "${sqlite.out}/lib/libsqlite3${sqliteLibExt}"; + in + builtins.concatStringsSep " " ( + # Set the NVIM_APPNAME environment variable + (optional (appName != "nvim" && appName != null && appName != "") + ''--set NVIM_APPNAME "${appName}"'') + # Add external packages to the PATH + ++ (optional (externalPackages != [ ]) + ''--prefix PATH : "${makeBinPath externalPackages}"'') + # Set the LIBSQLITE_CLIB_PATH if sqlite is enabled + ++ (optional withSqlite + ''--set LIBSQLITE_CLIB_PATH "${sqliteLibPath}"'') + # Set the LIBSQLITE environment variable if sqlite is enabled + ++ (optional withSqlite + ''--set LIBSQLITE "${sqliteLibPath}"'') + ); + + luaPackages = neovim-unwrapped.lua.pkgs; + resolvedExtraLuaPackages = extraLuaPackages luaPackages; + + # Native Lua libraries + extraMakeWrapperLuaCArgs = + optionalString (resolvedExtraLuaPackages != [ ]) + ''--suffix LUA_CPATH ";" "${concatMapStringsSep ";" luaPackages.getLuaCPath resolvedExtraLuaPackages}"''; + + # Lua libraries + extraMakeWrapperLuaArgs = + optionalString (resolvedExtraLuaPackages != [ ]) + ''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"''; + + # wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation. + neovim-wrapped = wrapNeovimUnstable neovim-unwrapped (neovimConfig + // { + luaRcContent = initLua; + wrapperArgs = + escapeShellArgs neovimConfig.wrapperArgs + + " " + + extraMakeWrapperArgs + + " " + + extraMakeWrapperLuaCArgs + + " " + + extraMakeWrapperLuaArgs; + wrapRc = wrapRc; + }); + + isCustomAppName = appName != null && appName != "nvim"; +in +neovim-wrapped.overrideAttrs (oa: { + buildPhase = + oa.buildPhase + # If a custom NVIM_APPNAME has been set, rename the `nvim` binary + + lib.optionalString isCustomAppName '' + mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName} + ''; + meta.mainProgram = + if isCustomAppName + then appName + else oa.meta.mainProgram; +}) diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix new file mode 100644 index 0000000..29512d8 --- /dev/null +++ b/nix/neovim-overlay.nix @@ -0,0 +1,113 @@ +# This overlay, when applied to nixpkgs, adds the final neovim derivation to nixpkgs. +{ inputs }: final: prev: +with final.pkgs.lib; let + pkgs = final; + lib = final.pkgs.lib; + + # Use this to create a plugin from a flake input + mkNvimPlugin = src: pname: + pkgs.vimUtils.buildVimPlugin { + inherit pname src; + version = src.lastModifiedDate; + }; + + # Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable, + # otherwise it could have an incompatible signature when applying this overlay. + pkgs-locked = inputs.nixpkgs.legacyPackages.${pkgs.system}; + + # This is the helper function that builds the Neovim derivation. + mkNeovim = pkgs.callPackage ./mkNeovim.nix { + inherit (pkgs-locked) wrapNeovimUnstable neovimUtils; + }; + + callPackage = (file: pkgs.callPackage file { + inherit inputs pkgs mkNvimPlugin lib; + }); + + langs = callPackage ./lang; + + # A plugin can either be a package or an attrset, such as + # { plugin = ; # the package, e.g. pkgs.vimPlugins.nvim-cmp + # config = ; # String; a config that will be loaded with the plugin + # # Boolean; Whether to automatically load the plugin as a 'start' plugin, + # # or as an 'opt' plugin, that can be loaded with `:packadd!` + # optional = ; # Default: false + # ... + # } + all-plugins = with pkgs.vimPlugins; [ + { + plugin = lze; + optional = false; + } + { + plugin = snacks-nvim; + optional = false; + } + ] + ++ langs.plugins + ++ (callPackage ./treesitter.nix) + ++ (callPackage ./autocomplete.nix) + + ++ [ + diffview-nvim + gitsigns-nvim + vim-fugitive + + which-key-nvim + better-escape-nvim + plenary-nvim + + { + plugin = mini-icons; + optional = false; + type = "lua"; + config = /*lua*/'' + require("mini.icons").setup() + MiniIcons.mock_nvim_web_devicons() + ''; + } + { plugin = oil-nvim; optional = false; } + + + ]; + + extraPackages = langs.packages; +in +{ + # This is the neovim derivation + # returned by the overlay + nvim-pkg = mkNeovim { + plugins = all-plugins; + inherit extraPackages; + }; + + # This is meant to be used within a devshell. + # Instead of loading the lua Neovim configuration from + # the Nix store, it is loaded from $XDG_CONFIG_HOME/nvim-dev + nvim-dev = mkNeovim { + plugins = all-plugins; + inherit extraPackages; + appName = "nvim-dev"; + wrapRc = false; + }; + + # This can be symlinked in the devShell's shellHook + nvim-luarc-json = final.mk-luarc-json { + plugins = all-plugins; + }; + + # You can add as many derivations as you like. + # Use `ignoreConfigRegexes` to filter out config + # files you would not like to include. + # + # For example: + # + # nvim-pkg-no-telescope = mkNeovim { + # plugins = []; + # ignoreConfigRegexes = [ + # "^plugin/telescope.lua" + # "^ftplugin/.*.lua" + # ]; + # inherit extraPackages; + # }; +} diff --git a/nix/treesitter.nix b/nix/treesitter.nix new file mode 100644 index 0000000..8a37439 --- /dev/null +++ b/nix/treesitter.nix @@ -0,0 +1,109 @@ +{ inputs, pkgs, mkNvimPlugin, ... }: +let + # nvim-treesitter = pkgs.vimPlugins.nvim-treesitter.withAllGrammars; + nvim-treesitter = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ + # languages + p.rust + p.c + p.cpp + p.cuda + p.python + p.typescript + p.javascript + p.fish + p.lua + p.html + p.htmldjango + p.css + p.bash + p.vue + p.scss + p.sql + p.markdown + p.json + p.json5 + p.jsonc + p.graphql + p.commonlisp + p.latex + p.glsl + p.nix + p.go + p.gotmpl + p.helm + p.gomod + p.gosum + # conf files + p.ssh_config + p.jsdoc + p.yaml + p.toml + p.proto + p.http + p.hurl + p.make + p.cmake + p.dockerfile + p.ini + p.vim + p.vimdoc + p.passwd + p.requirements + p.hcl + p.xml + p.nginx + p.tmux + p.udev + # tools + p.markdown_inline + p.jq + p.regex + p.query + p.comment + p.rst + + # git + p.gitcommit + p.git_rebase + p.gitignore + p.git_config + p.gitattributes + + ]); + nvim-yati = (mkNvimPlugin inputs.nvim-yati "nvim-yati").overrideAttrs + { + dependencies = [ nvim-treesitter ]; + }; + hlargs-nvim = (mkNvimPlugin inputs.hlargs-nvim "hlargs-nvim").overrideAttrs + { + dependencies = [ nvim-treesitter ]; + }; +in +[ + + nvim-treesitter + pkgs.vimPlugins.nvim-treesitter-context + { + plugin = nvim-yati; + type = "lua"; + optional = true; + config = /*lua*/'' + require('lze').load { + 'nvim-yati', + on_plugin = 'nvim-treesitter', + } + ''; + } + { + plugin = hlargs-nvim; + type = "lua"; + optional = true; + config = /*lua*/'' + require('lze').load { + 'hlargs.nvim', + on_plugin = 'nvim-treesitter', + } + ''; + } + +] diff --git a/nvim-nix.svg b/nvim-nix.svg new file mode 100644 index 0000000..882567a --- /dev/null +++ b/nvim-nix.svg @@ -0,0 +1,317 @@ + + + + neovim-mark@2x + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + neovim-mark@2x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nvim/after/ftplugin/dockerfile.vim b/nvim/after/ftplugin/dockerfile.vim new file mode 100644 index 0000000..58da62c --- /dev/null +++ b/nvim/after/ftplugin/dockerfile.vim @@ -0,0 +1,4 @@ +setl expandtab +setl shiftwidth=2 +setl softtabstop=2 +setl tabstop=2 diff --git a/nvim/after/ftplugin/jinja.lua b/nvim/after/ftplugin/jinja.lua new file mode 100644 index 0000000..c5a5b42 --- /dev/null +++ b/nvim/after/ftplugin/jinja.lua @@ -0,0 +1 @@ +vim.bo.syntax = "htmldjango" diff --git a/nvim/after/ftplugin/json.vim b/nvim/after/ftplugin/json.vim new file mode 100644 index 0000000..61f52d8 --- /dev/null +++ b/nvim/after/ftplugin/json.vim @@ -0,0 +1,7 @@ +setl autoindent +setl conceallevel=0 +setl expandtab +setl formatoptions=tcq2l +setl shiftwidth=2 +setl softtabstop=2 +setl tabstop=2 diff --git a/nvim/after/ftplugin/python.lua b/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..2aafda9 --- /dev/null +++ b/nvim/after/ftplugin/python.lua @@ -0,0 +1 @@ +vim.b.indentkeys = "0{,0},0),0],0#,!^F,o,O,e" diff --git a/nvim/after/ftplugin/snippets.lua b/nvim/after/ftplugin/snippets.lua new file mode 100644 index 0000000..a5eb93d --- /dev/null +++ b/nvim/after/ftplugin/snippets.lua @@ -0,0 +1,2 @@ +vim.bo.syntax = "snippets" +vim.bo.omnifunc = "syntaxcomplete#Complete" diff --git a/nvim/after/queries/gitcommit/injections.scm b/nvim/after/queries/gitcommit/injections.scm new file mode 100644 index 0000000..d944d6c --- /dev/null +++ b/nvim/after/queries/gitcommit/injections.scm @@ -0,0 +1,8 @@ +; extends + +((subject) @injection.content + (#set! injection.language "markdown_inline")) + +((message_line) @injection.content + (#set! injection.language "markdown") + (#set! injection.combined)) diff --git a/nvim/after/queries/html/injections.scm b/nvim/after/queries/html/injections.scm new file mode 100644 index 0000000..c4e7a04 --- /dev/null +++ b/nvim/after/queries/html/injections.scm @@ -0,0 +1,23 @@ +;extends + + +; python + +(element + (start_tag + (attribute + (quoted_attribute_value + ((attribute_value) @_idd (#eq? @_idd "python"))))) + ((text) @injection.content (#set! injection.language "python"))) + + +; lua + +(element + (start_tag + (attribute + (quoted_attribute_value + ((attribute_value) @_idd (#eq? @_idd "lua"))))) + ((text) @injection.content (#set! injection.language "lua"))) + + diff --git a/nvim/after/queries/lua/highlights.scm b/nvim/after/queries/lua/highlights.scm new file mode 100644 index 0000000..b2c2ff3 --- /dev/null +++ b/nvim/after/queries/lua/highlights.scm @@ -0,0 +1,6 @@ +; extends + +((identifier) @variable.builtin + (#any-of? @variable.builtin "vim" "bit") + (#set! "priority" 128)) + diff --git a/nvim/after/queries/lua/matchup.scm b/nvim/after/queries/lua/matchup.scm new file mode 100644 index 0000000..2296293 --- /dev/null +++ b/nvim/after/queries/lua/matchup.scm @@ -0,0 +1,41 @@ +; inherits: quote + +; Don't use `return` statements for function matching in Lua. +; Allow `for` and `while` keywords to be jumpable. +(for_statement + [ + "for" + "do" + ] @open.loop + "end" @close.loop) @scope.loop + +(while_statement + [ + "while" + "do" + ] @open.loop + "end" @close.loop) @scope.loop + +(break_statement) @mid.loop.1 + +(if_statement + "if" @open.if + "end" @close.if) @scope.if + +(else_statement + "else" @mid.if.1) + +(elseif_statement + "elseif" @mid.if.2) + +(function_declaration + "function" @open.function + "end" @close.function) @scope.function + +(function_definition + "function" @open.function + "end" @close.function) @scope.function + +(do_statement + "do" @open.block + "end" @close.block) @scope.block diff --git a/nvim/after/queries/python/injections.scm b/nvim/after/queries/python/injections.scm new file mode 100644 index 0000000..8412c66 --- /dev/null +++ b/nvim/after/queries/python/injections.scm @@ -0,0 +1,98 @@ +;extends + +; sql +( + call + function: (attribute attribute: (identifier) @id (#match? @id "execute|read_sql|text|fetch|prepare|fetchrow")) + arguments: (argument_list + (string (string_content) @injection.content (#set! injection.language "sql")) + ) +) + +; ( +; call +; function: (attribute attribute: (identifier) @id (#match? @id "execute|read_sql|text")) +; arguments: (argument_list +; ( +; concatenated_string +; (string (string_content) @injection.content (#set! injection.language "sql")) +; ) +; ) +; ) + +( + call + function: ((identifier) @id (#match? @id "text")) + arguments: (argument_list + (string (string_content) @injection.content (#set! injection.language "sql")) + ) +) +( + call + function: ((identifier) @id (#match? @id "text")) + arguments: (argument_list + ( + concatenated_string + (string (string_content) @injection.content (#set! injection.language "sql")) + ) + ) +) + +(assignment + ((identifier) @_varx (#match? @_varx ".*sql$")) + (string + (string_content) @injection.content (#set! injection.language "sql"))) + +;lua +(assignment + ((identifier) @_varx (#match? @_varx ".*lua$")) + (string + (string_content) @injection.content (#set! injection.language "lua"))) + + +; rst +( + function_definition + (block + (expression_statement + (string + (string_content) @injection.content (#set! injection.language "rst")))) +) + +; js +( +assignment + ((identifier) @_varx (#match? @_varx ".*js$")) + (string + (string_content) @injection.content (#set! injection.language "javascript")) +) + +; css +(assignment + ((identifier) @_varx (#match? @_varx ".*html$")) + (string + (string_content) @injection.content (#set! injection.language "html"))) + +; css +(assignment + ((identifier) @_varx (#match? @_varx ".*css$")) + (string + (string_content) @injection.content (#set! injection.language "css"))) + +(call + function: (attribute + attribute: (identifier) @_idd (#eq? @_idd "style")) + arguments: (argument_list + (string (string_content) @injection.content (#set! injection.language "css")))) + +; json +(call + function: (attribute + attribute: (identifier) @_idd (#eq? @_idd "loads")) + arguments: (argument_list + (string (string_content) @injection.content (#set! injection.language "json") ) ) ) + +(assignment + ((identifier) @_varx (#match? @_varx ".*json$")) + (string + (string_content) @injection.content (#set! injection.language "json"))) diff --git a/nvim/colors/ex-bamboo-light.lua b/nvim/colors/ex-bamboo-light.lua new file mode 100644 index 0000000..78139b5 --- /dev/null +++ b/nvim/colors/ex-bamboo-light.lua @@ -0,0 +1,376 @@ +-- This file is generated by ex-colors. The credit goes to the authors and contributors of the original colorscheme bamboo-light. +vim.api.nvim_set_var("colors_name", "ex-bamboo-light") +vim.api.nvim_set_var("terminal_color_0", "#fff8f0") +vim.api.nvim_set_var("terminal_color_1", "#c72a3c") +vim.api.nvim_set_var("terminal_color_2", "#27850b") +vim.api.nvim_set_var("terminal_color_3", "#a77b00") +vim.api.nvim_set_var("terminal_color_4", "#1745d5") +vim.api.nvim_set_var("terminal_color_5", "#8a4adf") +vim.api.nvim_set_var("terminal_color_6", "#188a9e") +vim.api.nvim_set_var("terminal_color_7", "#3a4238") +vim.api.nvim_set_var("terminal_color_8", "#a1a7a0") +vim.api.nvim_set_var("terminal_color_9", "#c72a3c") +vim.api.nvim_set_var("terminal_color_10", "#27850b") +vim.api.nvim_set_var("terminal_color_11", "#a77b00") +vim.api.nvim_set_var("terminal_color_12", "#1745d5") +vim.api.nvim_set_var("terminal_color_13", "#8a4adf") +vim.api.nvim_set_var("terminal_color_14", "#188a9e") +vim.api.nvim_set_var("terminal_color_15", "#3a4238") +vim.api.nvim_set_option_value("background", "light", {}) +vim.api.nvim_set_hl(0, "@attribute", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "@character.special", { link = "Special" }) +vim.api.nvim_set_hl(0, "@comment", { cterm = { italic = true }, fg = 7293957, italic = true }) +vim.api.nvim_set_hl(0, "@comment.error", { bg = 13052476, bold = true, cterm = { bold = true }, fg = 16775408 }) +vim.api.nvim_set_hl(0, "@comment.note", { bg = 1525205, bold = true, cterm = { bold = true }, fg = 16775408 }) +vim.api.nvim_set_hl(0, "@comment.warning", { bg = 14637350, bold = true, cterm = { bold = true }, fg = 16775408 }) +vim.api.nvim_set_hl(0, "@constant.builtin", { link = "Constant" }) +vim.api.nvim_set_hl(0, "@constant.macro", { link = "Macro" }) +vim.api.nvim_set_hl(0, "@constructor", { bold = true, cterm = { bold = true }, fg = 10976000 }) +vim.api.nvim_set_hl(0, "@diff.delta", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "@diff.minus", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "@diff.plus", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "@function.builtin", { bold = true, cterm = { bold = true }, fg = 14637350 }) +vim.api.nvim_set_hl(0, "@function.call", { link = "Function" }) +vim.api.nvim_set_hl(0, "@function.macro", { bold = true, cterm = { bold = true }, fg = 13111504 }) +vim.api.nvim_set_hl(0, "@function.method", { link = "Function" }) +vim.api.nvim_set_hl(0, "@function.method.call", { link = "Function" }) +vim.api.nvim_set_hl(0, "@keyword.conditional", { link = "Conditional" }) +vim.api.nvim_set_hl(0, "@keyword.conditional.ternary", { link = "Operator" }) +vim.api.nvim_set_hl(0, "@keyword.coroutine", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.debug", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.directive", { link = "PreProc" }) +vim.api.nvim_set_hl(0, "@keyword.directive.define", { bold = true, cterm = { bold = true }, fg = 9063135 }) +vim.api.nvim_set_hl(0, "@keyword.exception", { link = "Exception" }) +vim.api.nvim_set_hl(0, "@keyword.import", { link = "Include" }) +vim.api.nvim_set_hl(0, "@keyword.modifier", { cterm = { italic = true }, fg = 9063135, italic = true }) +vim.api.nvim_set_hl(0, "@keyword.operator", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.repeat", { link = "Repeat" }) +vim.api.nvim_set_hl(0, "@keyword.return", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.type", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@lsp.mod.readonly", { link = "@constant" }) +vim.api.nvim_set_hl(0, "@lsp.type.event", { link = "Label" }) +vim.api.nvim_set_hl(0, "@lsp.type.macro", { link = "Macro" }) +vim.api.nvim_set_hl(0, "@lsp.type.typeParameter", { link = "@type" }) +vim.api.nvim_set_hl(0, "@markup.heading", { link = "htmlTitle" }) +vim.api.nvim_set_hl(0, "@markup.heading.1", { link = "markdownH1" }) +vim.api.nvim_set_hl(0, "@markup.heading.2", { link = "markdownH2" }) +vim.api.nvim_set_hl(0, "@markup.heading.3", { link = "markdownH3" }) +vim.api.nvim_set_hl(0, "@markup.heading.4", { link = "markdownH4" }) +vim.api.nvim_set_hl(0, "@markup.heading.5", { link = "markdownH5" }) +vim.api.nvim_set_hl(0, "@markup.heading.6", { link = "markdownH6" }) +vim.api.nvim_set_hl(0, "@markup.italic", { link = "markdownItalic" }) +vim.api.nvim_set_hl(0, "@markup.link", { link = "Tag" }) +vim.api.nvim_set_hl(0, "@markup.link.label", { link = "markdownLinkText" }) +vim.api.nvim_set_hl(0, "@markup.link.url", { link = "markdownUrl" }) +vim.api.nvim_set_hl(0, "@markup.list", { link = "markdownListMarker" }) +vim.api.nvim_set_hl(0, "@markup.list.checked", { bold = true, cterm = { bold = true }, fg = 10976000 }) +vim.api.nvim_set_hl(0, "@markup.list.unchecked", { bold = true, cterm = { bold = true }, fg = 8619905 }) +vim.api.nvim_set_hl(0, "@markup.math", { fg = 1540095 }) +vim.api.nvim_set_hl(0, "@markup.quote", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "@markup.raw", { link = "markdownCode" }) +vim.api.nvim_set_hl(0, "@markup.raw.block", { link = "markdownCodeBlock" }) +vim.api.nvim_set_hl(0, "@markup.strikethrough", { link = "markdownStrike" }) +vim.api.nvim_set_hl(0, "@markup.strong", { link = "markdownBold" }) +vim.api.nvim_set_hl(0, "@markup.underline", { link = "htmlUnderline" }) +vim.api.nvim_set_hl(0, "@module", { cterm = { italic = true }, fg = 1540095, italic = true }) +vim.api.nvim_set_hl(0, "@module.builtin", { link = "@variable.builtin" }) +vim.api.nvim_set_hl(0, "@property", { link = "@variable.member" }) +vim.api.nvim_set_hl(0, "@punctuation.bracket", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@punctuation.delimiter", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@string.documentation", { fg = 1926152 }) +vim.api.nvim_set_hl(0, "@string.escape", { fg = 12603472 }) +vim.api.nvim_set_hl(0, "@string.regexp", { link = "Constant" }) +vim.api.nvim_set_hl(0, "@string.special", { link = "Special" }) +vim.api.nvim_set_hl(0, "@string.special.path", { cterm = { underline = true }, fg = 1540095, underline = true }) +vim.api.nvim_set_hl(0, "@string.special.symbol", { link = "@variable.member" }) +vim.api.nvim_set_hl( + 0, + "@string.special.url", + { cterm = { italic = true, underline = true }, fg = 1608350, italic = true, underline = true } +) +vim.api.nvim_set_hl(0, "@tag", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "@tag.attribute", { link = "@variable.member" }) +vim.api.nvim_set_hl(0, "@tag.builtin", { link = "@tag" }) +vim.api.nvim_set_hl(0, "@tag.delimiter", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@type.builtin", { link = "Type" }) +vim.api.nvim_set_hl(0, "@type.definition", { link = "Type" }) +vim.api.nvim_set_hl(0, "@variable", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "@variable.builtin", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "@variable.member", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "@variable.parameter", { cterm = { italic = true }, fg = 12603472, italic = true }) +vim.api.nvim_set_hl(0, "@variable.parameter.builtin", { cterm = { italic = true }, fg = 13052476, italic = true }) +vim.api.nvim_set_hl(0, "Added", { ctermfg = 2, fg = 21795 }) +vim.api.nvim_set_hl(0, "BlinkCmpCursorLineMenuHack", { bg = 14342850 }) +vim.api.nvim_set_hl(0, "BlinkCmpDoc", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "FloatBorder" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocCursorLine", { link = "Visual" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocSeparator", { link = "NormalFloat" }) +vim.api.nvim_set_hl( + 0, + "BlinkCmpGhostText", + { bg = 16448224, cterm = { italic = true, nocombine = true }, fg = 8619905, italic = true, nocombine = true } +) +vim.api.nvim_set_hl(0, "BlinkCmpKind", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindArray", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindBoolean", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindClass", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCodeium", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindColor", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstant", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstructor", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCopilot", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindDefault", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnum", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnumMember", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEvent", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindField", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFile", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFolder", { fg = 1540095 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFunction", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindInterface", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKey", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKeyword", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindMethod", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindModule", { fg = 1540095 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNamespace", { fg = 1540095 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNull", { fg = 10594208 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNumber", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindObject", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindOperator", { fg = 7096224 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindPackage", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindProperty", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindReference", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindSnippet", { cterm = { italic = true }, fg = 13111504, italic = true }) +vim.api.nvim_set_hl(0, "BlinkCmpKindString", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindStruct", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTabNine", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindText", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTypeParameter", { fg = 12603472 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindUnit", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindValue", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindVariable", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabel", { fg = 3818040 }) +vim.api.nvim_set_hl( + 0, + "BlinkCmpLabelDeprecated", + { cterm = { strikethrough = true }, fg = 8619905, strikethrough = true } +) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { link = "Comment" }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelMatch", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "BlinkCmpMenu", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "FloatBorder" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { link = "PmenuSel" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarGutter", { link = "PmenuSbar" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { link = "PmenuThumb" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelp", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpActiveParameter", { link = "LspSignatureActiveParameter" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpBorder", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSource", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "Changed", { ctermfg = 6, fg = 29555 }) +vim.api.nvim_set_hl(0, "ColorColumn", { bg = 13819319 }) +vim.api.nvim_set_hl(0, "Comment", { cterm = { italic = true }, fg = 8619905, italic = true }) +vim.api.nvim_set_hl(0, "Conceal", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "Conditional", { cterm = { italic = true }, fg = 9063135, italic = true }) +vim.api.nvim_set_hl(0, "Constant", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "CurSearch", { bg = 14637350, fg = 16448224 }) +vim.api.nvim_set_hl(0, "Cursor", { cterm = { reverse = true }, reverse = true }) +vim.api.nvim_set_hl(0, "CursorColumn", { link = "CursorLine" }) +vim.api.nvim_set_hl(0, "CursorLine", { bg = 15395536 }) +vim.api.nvim_set_hl(0, "CursorLineNr", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "Debug", { fg = 14637350 }) +vim.api.nvim_set_hl(0, "Delimiter", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "DiagnosticDeprecated", { link = "Strike" }) +vim.api.nvim_set_hl(0, "DiagnosticError", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "DiagnosticHint", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "DiagnosticInfo", { fg = 1608350 }) +vim.api.nvim_set_hl(0, "DiagnosticOk", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { cterm = { undercurl = true }, sp = 13052476, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { cterm = { undercurl = true }, sp = 9063135, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { cterm = { undercurl = true }, sp = 1525205, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineOk", { cterm = { undercurl = true }, sp = 2589963, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { cterm = { undercurl = true }, sp = 10976000, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { bg = 15852750, fg = 10428976 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { bg = 15525851, fg = 7224242 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { bg = 14937302, fg = 1273470 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { bg = 15657930, fg = 8806912 }) +vim.api.nvim_set_hl(0, "DiagnosticWarn", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "DiffAdd", { bg = 12641195 }) +vim.api.nvim_set_hl(0, "DiffChange", { bg = 13819115 }) +vim.api.nvim_set_hl(0, "DiffDelete", { bg = 16363445 }) +vim.api.nvim_set_hl(0, "DiffText", { bg = 12766427 }) +vim.api.nvim_set_hl(0, "Directory", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = 16448224 }) +vim.api.nvim_set_hl(0, "Error", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "ErrorMsg", { bold = true, cterm = { bold = true }, fg = 13052476 }) +vim.api.nvim_set_hl(0, "Exception", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "Float", { link = "Constant" }) +vim.api.nvim_set_hl(0, "FloatBorder", { bg = 14408644, fg = 9063135 }) +vim.api.nvim_set_hl(0, "FloatFooter", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "FloatTitle", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "FoldColumn", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "Folded", { bg = 15395536, fg = 3818040 }) +vim.api.nvim_set_hl(0, "Function", { bold = true, cterm = { bold = true }, fg = 1525205 }) +vim.api.nvim_set_hl(0, "GitSignsAdd", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "GitSignsAddCul", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsAddLn", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { link = "GitSignsAddInline" }) +vim.api.nvim_set_hl(0, "GitSignsAddNr", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "GitSignsAddPreview", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsChange", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "GitSignsChangeCul", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLn", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { link = "GitSignsChangeInline" }) +vim.api.nvim_set_hl(0, "GitSignsChangeNr", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "GitSignsChangedelete", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteCul", { link = "GitSignsChangeCul" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteLn", { link = "GitSignsChangeLn" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteNr", { link = "GitSignsChangeNr" }) +vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { link = "NonText" }) +vim.api.nvim_set_hl(0, "GitSignsDelete", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "GitSignsDeleteCul", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { link = "GitSignsDeleteInline" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteNr", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "GitSignsDeletePreview", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLn", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLnInLine", { link = "GitSignsDeleteLnInline" }) +vim.api.nvim_set_hl(0, "GitSignsStagedAdd", { fg = 1262085 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddCul", { fg = 1262085 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddLn", { fg = 1262085 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddNr", { fg = 1262085 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChange", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeCul", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeLn", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeNr", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedelete", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteCul", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteLn", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteNr", { fg = 729706 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDelete", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteCul", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteNr", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdelete", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteCul", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteLn", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteNr", { fg = 6493470 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntracked", { fg = 5455104 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedCul", { fg = 1262085 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedLn", { fg = 5455104 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedNr", { fg = 5455104 }) +vim.api.nvim_set_hl(0, "GitSignsTopdelete", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteCul", { link = "GitSignsDeleteCul" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteLn", { link = "GitSignsDeleteLn" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteNr", { link = "GitSignsDeleteNr" }) +vim.api.nvim_set_hl(0, "GitSignsUntracked", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedCul", { link = "GitSignsAddCul" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedLn", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedNr", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "GitSignsVirtLnum", { link = "GitSignsDeleteVirtLn" }) +vim.api.nvim_set_hl(0, "Identifier", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "Keyword", { bold = true, cterm = { bold = true }, fg = 9063135 }) +vim.api.nvim_set_hl(0, "Label", { bold = true, cterm = { bold = true }, fg = 13052476 }) +vim.api.nvim_set_hl(0, "LineNr", { fg = 10594208 }) +vim.api.nvim_set_hl(0, "LspCodeLens", { link = "Comment" }) +vim.api.nvim_set_hl(0, "LspCodeLensSeparator", { fg = 10594208 }) +vim.api.nvim_set_hl(0, "LspInlayHint", { fg = 10594208 }) +vim.api.nvim_set_hl(0, "LspReferenceRead", { bg = 15000780 }) +vim.api.nvim_set_hl(0, "LspReferenceText", { bg = 15000780 }) +vim.api.nvim_set_hl(0, "LspReferenceWrite", { bg = 15000780 }) +vim.api.nvim_set_hl(0, "Macro", { fg = 13111504 }) +vim.api.nvim_set_hl(0, "MatchParen", { bg = 10594208, bold = true, cterm = { bold = true }, fg = 14637350 }) +vim.api.nvim_set_hl(0, "MiniStatuslineDevinfo", { bg = 15000780, fg = 3818040 }) +vim.api.nvim_set_hl(0, "MiniStatuslineFileinfo", { bg = 15000780, fg = 3818040 }) +vim.api.nvim_set_hl(0, "MiniStatuslineFilename", { bg = 15395536, fg = 10594208 }) +vim.api.nvim_set_hl(0, "MiniStatuslineInactive", { bg = 16448224, fg = 10594208 }) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeCommand", + { bg = 10976000, bold = true, cterm = { bold = true }, fg = 16448224 } +) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeInsert", + { bg = 1525205, bold = true, cterm = { bold = true }, fg = 16448224 } +) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeNormal", + { bg = 2589963, bold = true, cterm = { bold = true }, fg = 16448224 } +) +vim.api.nvim_set_hl(0, "MiniStatuslineModeOther", { bg = 1608350, bold = true, cterm = { bold = true }, fg = 16448224 }) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeReplace", + { bg = 13052476, bold = true, cterm = { bold = true }, fg = 16448224 } +) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeVisual", + { bg = 9063135, bold = true, cterm = { bold = true }, fg = 16448224 } +) +vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, cterm = { bold = true }, fg = 1206391 }) +vim.api.nvim_set_hl(0, "MoreMsg", { bold = true, cterm = { bold = true }, fg = 1525205 }) +vim.api.nvim_set_hl(0, "NonText", { fg = 10594208 }) +vim.api.nvim_set_hl(0, "Normal", { bg = 16448224, fg = 3818040 }) +vim.api.nvim_set_hl(0, "NormalFloat", { bg = 14408644, fg = 3818040 }) +vim.api.nvim_set_hl(0, "NormalNC", { bg = 14408644, fg = 8619905 }) +vim.api.nvim_set_hl(0, "Operator", { fg = 7096224 }) +vim.api.nvim_set_hl(0, "Pmenu", { bg = 15395536, fg = 3818040 }) +vim.api.nvim_set_hl(0, "PmenuSbar", { bg = 15395536 }) +vim.api.nvim_set_hl(0, "PmenuSel", { bg = 14342850 }) +vim.api.nvim_set_hl(0, "PmenuThumb", { bg = 10594208 }) +vim.api.nvim_set_hl(0, "PreProc", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "Question", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "QuickFixLine", { cterm = { underline = true }, fg = 1525205, underline = true }) +vim.api.nvim_set_hl(0, "RainbowDelimiterBlue", { fg = 1127584 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterCyan", { fg = 1206391 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterGreen", { fg = 1926152 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterOrange", { fg = 10961693 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterRed", { fg = 9773101 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterViolet", { fg = 6830247 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterYellow", { fg = 8215552 }) +vim.api.nvim_set_hl(0, "Removed", { ctermfg = 1, fg = 5832712 }) +vim.api.nvim_set_hl(0, "Repeat", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "Search", { bg = 7293957, fg = 16448224 }) +vim.api.nvim_set_hl(0, "SignColumn", { fg = 3818040 }) +vim.api.nvim_set_hl(0, "Special", { fg = 13052476 }) +vim.api.nvim_set_hl(0, "SpecialComment", { link = "Comment" }) +vim.api.nvim_set_hl(0, "SpecialKey", { link = "NonText" }) +vim.api.nvim_set_hl(0, "SpellBad", { cterm = { undercurl = true }, sp = 13052476, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellCap", { cterm = { undercurl = true }, sp = 10976000, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellLocal", { cterm = { undercurl = true }, sp = 1525205, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellRare", { cterm = { undercurl = true }, sp = 9063135, undercurl = true }) +vim.api.nvim_set_hl(0, "Statement", { fg = 9063135 }) +vim.api.nvim_set_hl(0, "StatusLine", { bg = 15000780, fg = 3818040 }) +vim.api.nvim_set_hl(0, "StatusLineNC", { bg = 15395536, fg = 10594208 }) +vim.api.nvim_set_hl(0, "StorageClass", { cterm = { italic = true }, fg = 10976000, italic = true }) +vim.api.nvim_set_hl(0, "String", { fg = 2589963 }) +vim.api.nvim_set_hl(0, "Substitute", { bg = 2589963, fg = 16448224 }) +vim.api.nvim_set_hl(0, "TabLine", { bg = 15395536, fg = 3818040 }) +vim.api.nvim_set_hl(0, "TabLineFill", { bg = 15395536, fg = 10594208 }) +vim.api.nvim_set_hl(0, "TabLineSel", { bg = 3818040, fg = 16448224 }) +vim.api.nvim_set_hl(0, "Tag", { fg = 1525205 }) +vim.api.nvim_set_hl(0, "Title", { bold = true, cterm = { bold = true }, fg = 1608350 }) +vim.api.nvim_set_hl(0, "Todo", { bg = 9063135, bold = true, cterm = { bold = true }, fg = 16775408 }) +vim.api.nvim_set_hl(0, "Type", { fg = 10976000 }) +vim.api.nvim_set_hl(0, "Visual", { bg = 14342850 }) +vim.api.nvim_set_hl(0, "VisualNOS", { bg = 15000780, cterm = { underline = true }, underline = true }) +vim.api.nvim_set_hl(0, "WarningMsg", { bold = true, cterm = { bold = true }, fg = 10976000 }) +vim.api.nvim_set_hl(0, "WildMenu", { bg = 1525205, fg = 16448224 }) +vim.api.nvim_set_hl(0, "WinBar", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "WinBarNC", { link = "WinBar" }) +vim.api.nvim_set_hl(0, "WinSeparator", { fg = 14342850 }) +vim.api.nvim_set_hl(0, "diffChanged", { link = "PreProc" }) +vim.api.nvim_set_hl(0, "diffNewFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "diffOldFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "htmlH1", { bold = true, cterm = { bold = true }, fg = 9773101 }) +vim.api.nvim_set_hl(0, "htmlH2", { bold = true, cterm = { bold = true }, fg = 10961693 }) +vim.api.nvim_set_hl(0, "htmlH3", { bold = true, cterm = { bold = true }, fg = 8215552 }) +vim.api.nvim_set_hl(0, "htmlH4", { bold = true, cterm = { bold = true }, fg = 1926152 }) +vim.api.nvim_set_hl(0, "htmlH5", { bold = true, cterm = { bold = true }, fg = 1206391 }) +vim.api.nvim_set_hl(0, "htmlH6", { bold = true, cterm = { bold = true }, fg = 1127584 }) +vim.api.nvim_set_hl(0, "lCursor", { link = "Cursor" }) diff --git a/nvim/colors/ex-bamboo.lua b/nvim/colors/ex-bamboo.lua new file mode 100644 index 0000000..9d64a62 --- /dev/null +++ b/nvim/colors/ex-bamboo.lua @@ -0,0 +1,364 @@ +-- This file is generated by ex-colors. The credit goes to the authors and contributors of the original colorscheme bamboo. +vim.api.nvim_set_var("colors_name", "ex-bamboo") +vim.api.nvim_set_var("terminal_color_0", "#111210") +vim.api.nvim_set_var("terminal_color_1", "#e75a7c") +vim.api.nvim_set_var("terminal_color_2", "#8fb573") +vim.api.nvim_set_var("terminal_color_3", "#dbb651") +vim.api.nvim_set_var("terminal_color_4", "#57a5e5") +vim.api.nvim_set_var("terminal_color_5", "#aaaaff") +vim.api.nvim_set_var("terminal_color_6", "#70c2be") +vim.api.nvim_set_var("terminal_color_7", "#f1e9d2") +vim.api.nvim_set_var("terminal_color_8", "#5b5e5a") +vim.api.nvim_set_var("terminal_color_9", "#e75a7c") +vim.api.nvim_set_var("terminal_color_10", "#8fb573") +vim.api.nvim_set_var("terminal_color_11", "#dbb651") +vim.api.nvim_set_var("terminal_color_12", "#57a5e5") +vim.api.nvim_set_var("terminal_color_13", "#aaaaff") +vim.api.nvim_set_var("terminal_color_14", "#70c2be") +vim.api.nvim_set_var("terminal_color_15", "#f1e9d2") +vim.api.nvim_set_option_value("background", "dark", {}) +vim.api.nvim_set_hl(0, "@attribute", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "@character.special", { link = "Special" }) +vim.api.nvim_set_hl(0, "@comment", { cterm = { italic = true }, fg = 14862226, italic = true }) +vim.api.nvim_set_hl(0, "@comment.error", { bg = 15161980, bold = true, cterm = { bold = true }, fg = 1118736 }) +vim.api.nvim_set_hl(0, "@comment.note", { bg = 5744101, bold = true, cterm = { bold = true }, fg = 1118736 }) +vim.api.nvim_set_hl(0, "@comment.warning", { bg = 16750950, bold = true, cterm = { bold = true }, fg = 1118736 }) +vim.api.nvim_set_hl(0, "@constant.builtin", { link = "Constant" }) +vim.api.nvim_set_hl(0, "@constant.macro", { link = "Macro" }) +vim.api.nvim_set_hl(0, "@constructor", { bold = true, cterm = { bold = true }, fg = 14399057 }) +vim.api.nvim_set_hl(0, "@diff.delta", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "@diff.minus", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "@diff.plus", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "@function.builtin", { bold = true, cterm = { bold = true }, fg = 16750950 }) +vim.api.nvim_set_hl(0, "@function.call", { link = "Function" }) +vim.api.nvim_set_hl(0, "@function.macro", { bold = true, cterm = { bold = true }, fg = 14644223 }) +vim.api.nvim_set_hl(0, "@function.method", { link = "Function" }) +vim.api.nvim_set_hl(0, "@function.method.call", { link = "Function" }) +vim.api.nvim_set_hl(0, "@keyword.conditional", { link = "Conditional" }) +vim.api.nvim_set_hl(0, "@keyword.conditional.ternary", { link = "Operator" }) +vim.api.nvim_set_hl(0, "@keyword.coroutine", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.debug", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.directive", { link = "PreProc" }) +vim.api.nvim_set_hl(0, "@keyword.directive.define", { bold = true, cterm = { bold = true }, fg = 11184895 }) +vim.api.nvim_set_hl(0, "@keyword.exception", { link = "Exception" }) +vim.api.nvim_set_hl(0, "@keyword.import", { link = "Include" }) +vim.api.nvim_set_hl(0, "@keyword.modifier", { cterm = { italic = true }, fg = 11184895, italic = true }) +vim.api.nvim_set_hl(0, "@keyword.operator", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.repeat", { link = "Repeat" }) +vim.api.nvim_set_hl(0, "@keyword.return", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@keyword.type", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "@lsp.mod.readonly", { link = "@constant" }) +vim.api.nvim_set_hl(0, "@lsp.type.event", { link = "Label" }) +vim.api.nvim_set_hl(0, "@lsp.type.macro", { link = "Macro" }) +vim.api.nvim_set_hl(0, "@lsp.type.typeParameter", { link = "@type" }) +vim.api.nvim_set_hl(0, "@markup.heading", { link = "htmlTitle" }) +vim.api.nvim_set_hl(0, "@markup.heading.1", { link = "markdownH1" }) +vim.api.nvim_set_hl(0, "@markup.heading.2", { link = "markdownH2" }) +vim.api.nvim_set_hl(0, "@markup.heading.3", { link = "markdownH3" }) +vim.api.nvim_set_hl(0, "@markup.heading.4", { link = "markdownH4" }) +vim.api.nvim_set_hl(0, "@markup.heading.5", { link = "markdownH5" }) +vim.api.nvim_set_hl(0, "@markup.heading.6", { link = "markdownH6" }) +vim.api.nvim_set_hl(0, "@markup.italic", { link = "markdownItalic" }) +vim.api.nvim_set_hl(0, "@markup.link", { link = "Tag" }) +vim.api.nvim_set_hl(0, "@markup.link.label", { link = "markdownLinkText" }) +vim.api.nvim_set_hl(0, "@markup.link.url", { link = "markdownUrl" }) +vim.api.nvim_set_hl(0, "@markup.list", { link = "markdownListMarker" }) +vim.api.nvim_set_hl(0, "@markup.list.checked", { bold = true, cterm = { bold = true }, fg = 14399057 }) +vim.api.nvim_set_hl(0, "@markup.list.unchecked", { bold = true, cterm = { bold = true }, fg = 8619905 }) +vim.api.nvim_set_hl(0, "@markup.math", { fg = 9881583 }) +vim.api.nvim_set_hl(0, "@markup.quote", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "@markup.raw", { link = "markdownCode" }) +vim.api.nvim_set_hl(0, "@markup.raw.block", { link = "markdownCodeBlock" }) +vim.api.nvim_set_hl(0, "@markup.strikethrough", { link = "markdownStrike" }) +vim.api.nvim_set_hl(0, "@markup.strong", { link = "markdownBold" }) +vim.api.nvim_set_hl(0, "@markup.underline", { link = "htmlUnderline" }) +vim.api.nvim_set_hl(0, "@module", { cterm = { italic = true }, fg = 9881583, italic = true }) +vim.api.nvim_set_hl(0, "@module.builtin", { link = "@variable.builtin" }) +vim.api.nvim_set_hl(0, "@property", { link = "@variable.member" }) +vim.api.nvim_set_hl(0, "@punctuation.bracket", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@punctuation.delimiter", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@string.documentation", { fg = 11258006 }) +vim.api.nvim_set_hl(0, "@string.escape", { fg = 15761536 }) +vim.api.nvim_set_hl(0, "@string.regexp", { link = "Constant" }) +vim.api.nvim_set_hl(0, "@string.special", { link = "Special" }) +vim.api.nvim_set_hl(0, "@string.special.path", { cterm = { underline = true }, fg = 9881583, underline = true }) +vim.api.nvim_set_hl(0, "@string.special.symbol", { link = "@variable.member" }) +vim.api.nvim_set_hl( + 0, + "@string.special.url", + { cterm = { italic = true, underline = true }, fg = 7389886, italic = true, underline = true } +) +vim.api.nvim_set_hl(0, "@tag", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "@tag.attribute", { link = "@variable.member" }) +vim.api.nvim_set_hl(0, "@tag.builtin", { link = "@tag" }) +vim.api.nvim_set_hl(0, "@tag.delimiter", { link = "Delimiter" }) +vim.api.nvim_set_hl(0, "@type.builtin", { link = "Type" }) +vim.api.nvim_set_hl(0, "@type.definition", { link = "Type" }) +vim.api.nvim_set_hl(0, "@variable", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "@variable.builtin", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "@variable.member", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "@variable.parameter", { cterm = { italic = true }, fg = 15761536, italic = true }) +vim.api.nvim_set_hl(0, "@variable.parameter.builtin", { cterm = { italic = true }, fg = 15161980, italic = true }) +vim.api.nvim_set_hl(0, "BlinkCmpCursorLineMenuHack", { bg = 3816759 }) +vim.api.nvim_set_hl(0, "BlinkCmpDoc", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "FloatBorder" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocCursorLine", { link = "Visual" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocSeparator", { link = "NormalFloat" }) +vim.api.nvim_set_hl( + 0, + "BlinkCmpGhostText", + { bg = 2434595, cterm = { italic = true, nocombine = true }, fg = 8619905, italic = true, nocombine = true } +) +vim.api.nvim_set_hl(0, "BlinkCmpKind", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindArray", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindBoolean", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindClass", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCodeium", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindColor", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstant", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstructor", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCopilot", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindDefault", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnum", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnumMember", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEvent", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindField", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFile", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFolder", { fg = 9881583 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFunction", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindInterface", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKey", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKeyword", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindMethod", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindModule", { fg = 9881583 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNamespace", { fg = 9881583 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNull", { fg = 5987930 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindNumber", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindObject", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindOperator", { fg = 12960494 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindPackage", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindProperty", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindReference", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindSnippet", { cterm = { italic = true }, fg = 14644223, italic = true }) +vim.api.nvim_set_hl(0, "BlinkCmpKindString", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindStruct", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTabNine", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindText", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTypeParameter", { fg = 15761536 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindUnit", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindValue", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindVariable", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabel", { fg = 15854034 }) +vim.api.nvim_set_hl( + 0, + "BlinkCmpLabelDeprecated", + { cterm = { strikethrough = true }, fg = 8619905, strikethrough = true } +) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { link = "Comment" }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelMatch", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "BlinkCmpMenu", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "FloatBorder" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { link = "PmenuSel" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarGutter", { link = "PmenuSbar" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { link = "PmenuThumb" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelp", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpActiveParameter", { link = "LspSignatureActiveParameter" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpBorder", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSource", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "ColorColumn", { bg = 3883573 }) +vim.api.nvim_set_hl(0, "Comment", { cterm = { italic = true }, fg = 8619905, italic = true }) +vim.api.nvim_set_hl(0, "Conceal", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "Conditional", { cterm = { italic = true }, fg = 11184895, italic = true }) +vim.api.nvim_set_hl(0, "Constant", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "CurSearch", { bg = 16750950, fg = 2434595 }) +vim.api.nvim_set_hl(0, "Cursor", { cterm = { reverse = true }, reverse = true }) +vim.api.nvim_set_hl(0, "CursorColumn", { link = "CursorLine" }) +vim.api.nvim_set_hl(0, "CursorLine", { bg = 3092780 }) +vim.api.nvim_set_hl(0, "CursorLineNr", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "Debug", { fg = 16750950 }) +vim.api.nvim_set_hl(0, "Delimiter", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "DiagnosticDeprecated", { link = "Strike" }) +vim.api.nvim_set_hl(0, "DiagnosticError", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "DiagnosticHint", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "DiagnosticInfo", { fg = 7389886 }) +vim.api.nvim_set_hl(0, "DiagnosticOk", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { cterm = { undercurl = true }, sp = 15161980, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { cterm = { undercurl = true }, sp = 11184895, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { cterm = { undercurl = true }, sp = 5744101, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineOk", { cterm = { undercurl = true }, sp = 9418099, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { cterm = { undercurl = true }, sp = 14399057, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { bg = 3418409, fg = 12142691 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { bg = 3092532, fg = 8947916 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { bg = 2765359, fg = 5938072 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { bg = 3354918, fg = 11506241 }) +vim.api.nvim_set_hl(0, "DiagnosticWarn", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "DiffAdd", { bg = 4215579 }) +vim.api.nvim_set_hl(0, "DiffChange", { bg = 2767447 }) +vim.api.nvim_set_hl(0, "DiffDelete", { bg = 8994629 }) +vim.api.nvim_set_hl(0, "DiffText", { bg = 3820135 }) +vim.api.nvim_set_hl(0, "Directory", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = 2434595 }) +vim.api.nvim_set_hl(0, "Error", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "ErrorMsg", { bold = true, cterm = { bold = true }, fg = 15161980 }) +vim.api.nvim_set_hl(0, "Exception", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "Float", { link = "Constant" }) +vim.api.nvim_set_hl(0, "FloatBorder", { bg = 2105631, fg = 11184895 }) +vim.api.nvim_set_hl(0, "FloatFooter", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "FloatTitle", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "FoldColumn", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "Folded", { bg = 3092780, fg = 15854034 }) +vim.api.nvim_set_hl(0, "Function", { bold = true, cterm = { bold = true }, fg = 5744101 }) +vim.api.nvim_set_hl(0, "GitSignsAdd", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "GitSignsAddCul", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsAddLn", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { link = "GitSignsAddInline" }) +vim.api.nvim_set_hl(0, "GitSignsAddNr", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "GitSignsAddPreview", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsChange", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "GitSignsChangeCul", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLn", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { link = "GitSignsChangeInline" }) +vim.api.nvim_set_hl(0, "GitSignsChangeNr", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "GitSignsChangedelete", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteCul", { link = "GitSignsChangeCul" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteLn", { link = "GitSignsChangeLn" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteNr", { link = "GitSignsChangeNr" }) +vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { link = "NonText" }) +vim.api.nvim_set_hl(0, "GitSignsDelete", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "GitSignsDeleteCul", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { link = "GitSignsDeleteInline" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteNr", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "GitSignsDeletePreview", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLn", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLnInLine", { link = "GitSignsDeleteLnInline" }) +vim.api.nvim_set_hl(0, "GitSignsStagedAdd", { fg = 4676153 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddCul", { fg = 4676153 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddLn", { fg = 4676153 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddNr", { fg = 4676153 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChange", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeCul", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeLn", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeNr", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedelete", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteCul", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteLn", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteNr", { fg = 2839154 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDelete", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteCul", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteNr", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdelete", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteCul", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteLn", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteNr", { fg = 7548222 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntracked", { fg = 7166760 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedCul", { fg = 4676153 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedLn", { fg = 7166760 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedNr", { fg = 7166760 }) +vim.api.nvim_set_hl(0, "GitSignsTopdelete", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteCul", { link = "GitSignsDeleteCul" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteLn", { link = "GitSignsDeleteLn" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteNr", { link = "GitSignsDeleteNr" }) +vim.api.nvim_set_hl(0, "GitSignsUntracked", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedCul", { link = "GitSignsAddCul" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedLn", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedNr", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "GitSignsVirtLnum", { link = "GitSignsDeleteVirtLn" }) +vim.api.nvim_set_hl(0, "Identifier", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "Keyword", { bold = true, cterm = { bold = true }, fg = 11184895 }) +vim.api.nvim_set_hl(0, "Label", { bold = true, cterm = { bold = true }, fg = 15161980 }) +vim.api.nvim_set_hl(0, "LineNr", { fg = 5987930 }) +vim.api.nvim_set_hl(0, "LspCodeLens", { link = "Comment" }) +vim.api.nvim_set_hl(0, "LspCodeLensSeparator", { fg = 5987930 }) +vim.api.nvim_set_hl(0, "LspInlayHint", { fg = 5987930 }) +vim.api.nvim_set_hl(0, "LspReferenceRead", { bg = 3685173 }) +vim.api.nvim_set_hl(0, "LspReferenceText", { bg = 3685173 }) +vim.api.nvim_set_hl(0, "LspReferenceWrite", { bg = 3685173 }) +vim.api.nvim_set_hl(0, "Macro", { fg = 14644223 }) +vim.api.nvim_set_hl(0, "MatchParen", { bg = 5987930, bold = true, cterm = { bold = true }, fg = 16750950 }) +vim.api.nvim_set_hl(0, "MiniStatuslineDevinfo", { bg = 3685173, fg = 15854034 }) +vim.api.nvim_set_hl(0, "MiniStatuslineFileinfo", { bg = 3685173, fg = 15854034 }) +vim.api.nvim_set_hl(0, "MiniStatuslineFilename", { bg = 3092780, fg = 5987930 }) +vim.api.nvim_set_hl(0, "MiniStatuslineInactive", { bg = 2434595, fg = 5987930 }) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeCommand", + { bg = 14399057, bold = true, cterm = { bold = true }, fg = 2434595 } +) +vim.api.nvim_set_hl(0, "MiniStatuslineModeInsert", { bg = 5744101, bold = true, cterm = { bold = true }, fg = 2434595 }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeNormal", { bg = 9418099, bold = true, cterm = { bold = true }, fg = 2434595 }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeOther", { bg = 7389886, bold = true, cterm = { bold = true }, fg = 2434595 }) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeReplace", + { bg = 15161980, bold = true, cterm = { bold = true }, fg = 2434595 } +) +vim.api.nvim_set_hl( + 0, + "MiniStatuslineModeVisual", + { bg = 11184895, bold = true, cterm = { bold = true }, fg = 2434595 } +) +vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, cterm = { bold = true }, fg = 9753038 }) +vim.api.nvim_set_hl(0, "MoreMsg", { bold = true, cterm = { bold = true }, fg = 5744101 }) +vim.api.nvim_set_hl(0, "NonText", { fg = 5987930 }) +vim.api.nvim_set_hl(0, "Normal", { bg = 2434595, fg = 15854034 }) +vim.api.nvim_set_hl(0, "NormalFloat", { bg = 2105631, fg = 15854034 }) +vim.api.nvim_set_hl(0, "NormalNC", { bg = 2105631, fg = 8619905 }) +vim.api.nvim_set_hl(0, "Operator", { fg = 12960494 }) +vim.api.nvim_set_hl(0, "Pmenu", { bg = 3092780, fg = 15854034 }) +vim.api.nvim_set_hl(0, "PmenuSbar", { bg = 3092780 }) +vim.api.nvim_set_hl(0, "PmenuSel", { bg = 3816759 }) +vim.api.nvim_set_hl(0, "PmenuThumb", { bg = 5987930 }) +vim.api.nvim_set_hl(0, "PreProc", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "Question", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "QuickFixLine", { cterm = { underline = true }, fg = 5744101, underline = true }) +vim.api.nvim_set_hl(0, "RainbowDelimiterBlue", { fg = 8502508 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterCyan", { fg = 9753038 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterGreen", { fg = 11258006 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterOrange", { fg = 16757644 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterRed", { fg = 15565725 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterViolet", { fg = 12566527 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterYellow", { fg = 14993533 }) +vim.api.nvim_set_hl(0, "Repeat", { link = "Keyword" }) +vim.api.nvim_set_hl(0, "Search", { bg = 14862226, fg = 2434595 }) +vim.api.nvim_set_hl(0, "SignColumn", { fg = 15854034 }) +vim.api.nvim_set_hl(0, "Special", { fg = 15161980 }) +vim.api.nvim_set_hl(0, "SpecialComment", { link = "Comment" }) +vim.api.nvim_set_hl(0, "SpecialKey", { link = "NonText" }) +vim.api.nvim_set_hl(0, "SpellBad", { cterm = { undercurl = true }, sp = 15161980, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellCap", { cterm = { undercurl = true }, sp = 14399057, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellLocal", { cterm = { undercurl = true }, sp = 5744101, undercurl = true }) +vim.api.nvim_set_hl(0, "SpellRare", { cterm = { undercurl = true }, sp = 11184895, undercurl = true }) +vim.api.nvim_set_hl(0, "Statement", { fg = 11184895 }) +vim.api.nvim_set_hl(0, "StatusLine", { bg = 3685173, fg = 15854034 }) +vim.api.nvim_set_hl(0, "StatusLineNC", { bg = 3092780, fg = 5987930 }) +vim.api.nvim_set_hl(0, "StorageClass", { cterm = { italic = true }, fg = 14399057, italic = true }) +vim.api.nvim_set_hl(0, "String", { fg = 9418099 }) +vim.api.nvim_set_hl(0, "Substitute", { bg = 9418099, fg = 2434595 }) +vim.api.nvim_set_hl(0, "TabLine", { bg = 3092780, fg = 15854034 }) +vim.api.nvim_set_hl(0, "TabLineFill", { bg = 3092780, fg = 5987930 }) +vim.api.nvim_set_hl(0, "TabLineSel", { bg = 15854034, fg = 2434595 }) +vim.api.nvim_set_hl(0, "Tag", { fg = 5744101 }) +vim.api.nvim_set_hl(0, "Title", { bold = true, cterm = { bold = true }, fg = 7389886 }) +vim.api.nvim_set_hl(0, "Todo", { bg = 11184895, bold = true, cterm = { bold = true }, fg = 1118736 }) +vim.api.nvim_set_hl(0, "Type", { fg = 14399057 }) +vim.api.nvim_set_hl(0, "Visual", { bg = 3816759 }) +vim.api.nvim_set_hl(0, "VisualNOS", { bg = 3685173, cterm = { underline = true }, underline = true }) +vim.api.nvim_set_hl(0, "WarningMsg", { bold = true, cterm = { bold = true }, fg = 14399057 }) +vim.api.nvim_set_hl(0, "WildMenu", { bg = 5744101, fg = 2434595 }) +vim.api.nvim_set_hl(0, "WinBar", { fg = 8619905 }) +vim.api.nvim_set_hl(0, "WinBarNC", { link = "WinBar" }) +vim.api.nvim_set_hl(0, "WinSeparator", { fg = 3816759 }) +vim.api.nvim_set_hl(0, "diffNewFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "diffOldFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "htmlH1", { bold = true, cterm = { bold = true }, fg = 15565725 }) +vim.api.nvim_set_hl(0, "htmlH2", { bold = true, cterm = { bold = true }, fg = 16757644 }) +vim.api.nvim_set_hl(0, "htmlH3", { bold = true, cterm = { bold = true }, fg = 14993533 }) +vim.api.nvim_set_hl(0, "htmlH4", { bold = true, cterm = { bold = true }, fg = 11258006 }) +vim.api.nvim_set_hl(0, "htmlH5", { bold = true, cterm = { bold = true }, fg = 9753038 }) +vim.api.nvim_set_hl(0, "htmlH6", { bold = true, cterm = { bold = true }, fg = 8502508 }) +vim.api.nvim_set_hl(0, "lCursor", { link = "Cursor" }) diff --git a/nvim/colors/ex-bluloco.lua b/nvim/colors/ex-bluloco.lua new file mode 100644 index 0000000..0737f11 --- /dev/null +++ b/nvim/colors/ex-bluloco.lua @@ -0,0 +1,293 @@ +-- This file is generated by ex-colors. The credit goes to the authors and contributors of the original colorscheme bluloco. +vim.api.nvim_set_var("colors_name", "ex-bluloco") +vim.api.nvim_set_var("terminal_color_0", "#111210") +vim.api.nvim_set_var("terminal_color_1", "#e75a7c") +vim.api.nvim_set_var("terminal_color_2", "#8fb573") +vim.api.nvim_set_var("terminal_color_3", "#dbb651") +vim.api.nvim_set_var("terminal_color_4", "#57a5e5") +vim.api.nvim_set_var("terminal_color_5", "#aaaaff") +vim.api.nvim_set_var("terminal_color_6", "#70c2be") +vim.api.nvim_set_var("terminal_color_7", "#f1e9d2") +vim.api.nvim_set_var("terminal_color_8", "#5b5e5a") +vim.api.nvim_set_var("terminal_color_9", "#e75a7c") +vim.api.nvim_set_var("terminal_color_10", "#8fb573") +vim.api.nvim_set_var("terminal_color_11", "#dbb651") +vim.api.nvim_set_var("terminal_color_12", "#57a5e5") +vim.api.nvim_set_var("terminal_color_13", "#aaaaff") +vim.api.nvim_set_var("terminal_color_14", "#70c2be") +vim.api.nvim_set_var("terminal_color_15", "#f1e9d2") +vim.api.nvim_set_hl(0, "@attribute", { fg = 5287343 }) +vim.api.nvim_set_hl(0, "@comment", { fg = 6516099 }) +vim.api.nvim_set_hl(0, "@constant", { fg = 10519038 }) +vim.api.nvim_set_hl(0, "@constant.builtin", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "@constructor", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "@function", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "@function.builtin", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "@function.call", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "@function.method", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "@keyword", { link = "Statement" }) +vim.api.nvim_set_hl(0, "@keyword.modifier", { link = "Statement" }) +vim.api.nvim_set_hl(0, "@label", { fg = 5287343 }) +vim.api.nvim_set_hl(0, "@lsp.mod.readonly", { link = "@constant" }) +vim.api.nvim_set_hl(0, "@lsp.type.decorator", { link = "@label" }) +vim.api.nvim_set_hl(0, "@lsp.type.event", { link = "@variable.parameter" }) +vim.api.nvim_set_hl(0, "@lsp.type.macro", { link = "@label" }) +vim.api.nvim_set_hl(0, "@lsp.type.regexp", { link = "@string" }) +vim.api.nvim_set_hl(0, "@lsp.type.typeParameter", { link = "@type" }) +vim.api.nvim_set_hl(0, "@markup.heading", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "@markup.heading.1", { link = "RainbowRed" }) +vim.api.nvim_set_hl(0, "@markup.heading.2", { link = "RainbowYellow" }) +vim.api.nvim_set_hl(0, "@markup.heading.3", { link = "RainbowBlue" }) +vim.api.nvim_set_hl(0, "@markup.heading.4", { link = "RainbowOrange" }) +vim.api.nvim_set_hl(0, "@markup.heading.5", { link = "RainbowGreen" }) +vim.api.nvim_set_hl(0, "@markup.heading.6", { link = "RainbowViolet" }) +vim.api.nvim_set_hl(0, "@markup.link.url", { link = "@markup.url" }) +vim.api.nvim_set_hl(0, "@markup.list", { link = "@punctuation.special" }) +vim.api.nvim_set_hl(0, "@markup.raw", { link = "Property" }) +vim.api.nvim_set_hl(0, "@markup.strong", { link = "Bold" }) +vim.api.nvim_set_hl(0, "@markup.underline", { link = "Underlined" }) +vim.api.nvim_set_hl(0, "@module", { fg = 16745885 }) +vim.api.nvim_set_hl(0, "@number", { fg = 16743160 }) +vim.api.nvim_set_hl(0, "@operator", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "@property", { link = "Property" }) +vim.api.nvim_set_hl(0, "@punctuation.bracket", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "@punctuation.delimiter", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "@punctuation.special", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "@string.escape", { link = "Character" }) +vim.api.nvim_set_hl(0, "@string.special.symbol", { fg = 10519038 }) +vim.api.nvim_set_hl(0, "@string.special.url", { link = "@markup.url" }) +vim.api.nvim_set_hl(0, "@tag.attribute", { cterm = { italic = true }, fg = 16749931, italic = true }) +vim.api.nvim_set_hl(0, "@tag.builtin", { link = "Tag" }) +vim.api.nvim_set_hl(0, "@type.builtin", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "@variable", { link = "Identifier" }) +vim.api.nvim_set_hl(0, "@variable.builtin", { link = "Statement" }) +vim.api.nvim_set_hl(0, "@variable.member", { link = "Property" }) +vim.api.nvim_set_hl(0, "@variable.parameter", { fg = 9096687 }) +vim.api.nvim_set_hl(0, "Added", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "BlinkCmpCursorLineMenuHack", { bg = 2639473 }) +vim.api.nvim_set_hl(0, "BlinkCmpDoc", { bg = 2171692, fg = 11252415 }) +vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { bg = 2171692, fg = 8160474 }) +vim.api.nvim_set_hl(0, "BlinkCmpDocCursorLine", { link = "Visual" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocSeparator", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpGhostText", { link = "NonText" }) +vim.api.nvim_set_hl(0, "BlinkCmpKind", { link = "Special" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindClass", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCodeium", { fg = 9873954 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindColor", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstant", { fg = 10519038 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstructor", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindCopilot", { fg = 9873954 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnum", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnumMember", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEvent", { fg = 5287343 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindField", { fg = 13539464 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFile", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFolder", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFunction", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindInterface", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKeyword", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindMethod", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindModule", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindOperator", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindProperty", { fg = 13539464 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindReference", { fg = 11252415 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindSnippet", { fg = 5287343 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindStruct", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindSupermaven", { fg = 9873954 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTabNine", { fg = 9873954 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindText", { fg = 6516099 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTypeParameter", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindUnit", { fg = 16743160 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindValue", { fg = 11252415 }) +vim.api.nvim_set_hl(0, "BlinkCmpKindVariable", { fg = 11252415 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabel", { fg = 11252415 }) +vim.api.nvim_set_hl( + 0, + "BlinkCmpLabelDeprecated", + { cterm = { strikethrough = true }, fg = 11252415, strikethrough = true } +) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { fg = 16749931 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { fg = 16749931 }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelMatch", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "BlinkCmpMenu", { link = "Pmenu" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "Pmenu" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { link = "PmenuSel" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarGutter", { link = "PmenuSbar" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { link = "PmenuThumb" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelp", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpActiveParameter", { link = "LspSignatureActiveParameter" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpBorder", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSource", { fg = 16749931 }) +vim.api.nvim_set_hl(0, "Boolean", { cterm = { italic = true }, fg = 1094654, italic = true }) +vim.api.nvim_set_hl(0, "Changed", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "Character", { fg = 16749931 }) +vim.api.nvim_set_hl(0, "ColorColumn", { bg = 3357256 }) +vim.api.nvim_set_hl(0, "Comment", { cterm = { italic = true }, fg = 6516099, italic = true }) +vim.api.nvim_set_hl(0, "Constant", { fg = 10519038 }) +vim.api.nvim_set_hl(0, "CurSearch", { link = "Search" }) +vim.api.nvim_set_hl(0, "Cursor", { bg = 16763904, fg = 2632756 }) +vim.api.nvim_set_hl(0, "CursorColumn", { link = "CursorLine" }) +vim.api.nvim_set_hl(0, "CursorLine", { bg = 3686994 }) +vim.api.nvim_set_hl(0, "CursorLineNr", { fg = 6516099 }) +vim.api.nvim_set_hl(0, "DiagnosticError", { link = "Error" }) +vim.api.nvim_set_hl(0, "DiagnosticHint", { fg = 7832026 }) +vim.api.nvim_set_hl(0, "DiagnosticInfo", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { cterm = { undercurl = true }, sp = 16723519, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { cterm = { undercurl = true }, sp = 7832026, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { cterm = { undercurl = true }, sp = 3707647, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { cterm = { undercurl = true }, sp = 14318404, undercurl = true }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { bg = 4995140, fg = 16723519 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { bg = 3685975, fg = 7832026 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { bg = 3162458, fg = 3707647 }) +vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { bg = 4603713, fg = 14318404 }) +vim.api.nvim_set_hl(0, "DiagnosticWarn", { link = "WarningMsg" }) +vim.api.nvim_set_hl(0, "DiffAdd", { bg = 1071933 }) +vim.api.nvim_set_hl(0, "DiffChange", { bg = 1065307 }) +vim.api.nvim_set_hl(0, "DiffDelete", { bg = 5385780 }) +vim.api.nvim_set_hl(0, "DiffText", { bg = 1531266 }) +vim.api.nvim_set_hl(0, "Directory", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "Error", { link = "ErrorMsg" }) +vim.api.nvim_set_hl(0, "ErrorMsg", { fg = 16723519 }) +vim.api.nvim_set_hl(0, "FloatBorder", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "Folded", { bg = 3488581, fg = 3707647 }) +vim.api.nvim_set_hl(0, "Function", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "GitSignsAdd", { fg = 1539412 }) +vim.api.nvim_set_hl(0, "GitSignsAddCul", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsAddLn", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { link = "GitSignsAddInline" }) +vim.api.nvim_set_hl(0, "GitSignsAddNr", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddPreview", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsChange", { fg = 1863580 }) +vim.api.nvim_set_hl(0, "GitSignsChangeCul", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLn", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { link = "GitSignsChangeInline" }) +vim.api.nvim_set_hl(0, "GitSignsChangeNr", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedelete", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteCul", { link = "GitSignsChangeCul" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteLn", { link = "GitSignsChangeLn" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteNr", { link = "GitSignsChangeNr" }) +vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { link = "NonText" }) +vim.api.nvim_set_hl(0, "GitSignsDelete", { fg = 10636892 }) +vim.api.nvim_set_hl(0, "GitSignsDeleteCul", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { link = "GitSignsDeleteInline" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteNr", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeletePreview", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLn", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLnInLine", { link = "GitSignsDeleteLnInline" }) +vim.api.nvim_set_hl(0, "GitSignsStagedAdd", { bg = 1539412, fg = 2632756 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddCul", { link = "GitSignsStagedAdd" }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddLn", { bg = 1071933 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddNr", { link = "GitSignsStagedAdd" }) +vim.api.nvim_set_hl(0, "GitSignsStagedChange", { bg = 1863580, fg = 2632756 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeCul", { link = "GitSignsStagedChange" }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeLn", { bg = 1065307 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeNr", { link = "GitSignsStagedChange" }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedelete", { link = "GitSignsStagedDelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteCul", { link = "GitSignsStagedChangedelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteLn", { bg = 1065307 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteNr", { link = "GitSignsStagedChangedelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedDelete", { bg = 10636892, fg = 2632756 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteCul", { link = "GitSignsStagedDelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteNr", { link = "GitSignsStagedDelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdelete", { link = "GitSignsStagedDelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteCul", { link = "GitSignsStagedTopdelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteNr", { link = "GitSignsStagedTopdelete" }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntracked", { link = "GitSignsStagedAdd" }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedCul", { link = "GitSignsStagedUntracked" }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedLn", { bg = 1071933 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedNr", { link = "GitSignsStagedUntracked" }) +vim.api.nvim_set_hl(0, "GitSignsTopdelete", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteCul", { link = "GitSignsDeleteCul" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteLn", { link = "GitSignsDeleteLn" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteNr", { link = "GitSignsDeleteNr" }) +vim.api.nvim_set_hl(0, "GitSignsUntracked", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedCul", { link = "GitSignsUntracked" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedLn", { link = "GitSignsAddLn" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedNr", { link = "GitSignsUntracked" }) +vim.api.nvim_set_hl(0, "GitSignsVirtLnum", { link = "GitSignsDeleteVirtLn" }) +vim.api.nvim_set_hl(0, "Identifier", { fg = 11252415 }) +vim.api.nvim_set_hl(0, "Ignore", { fg = 2632756 }) +vim.api.nvim_set_hl(0, "IncSearch", { bg = 14923789, fg = 2632756 }) +vim.api.nvim_set_hl(0, "LineNr", { fg = 6516099 }) +vim.api.nvim_set_hl(0, "LspCodeLens", { link = "WarningMsg" }) +vim.api.nvim_set_hl(0, "LspCodeLensSeparator", { link = "Boolean" }) +vim.api.nvim_set_hl(0, "LspInlayHint", { bg = 2896186, fg = 5726064 }) +vim.api.nvim_set_hl(0, "MatchParen", { bg = 8160474, fg = 2632756 }) +vim.api.nvim_set_hl(0, "MiniStatuslineDevinfo", { link = "StatusLine" }) +vim.api.nvim_set_hl(0, "MiniStatuslineFileinfo", { link = "StatusLine" }) +vim.api.nvim_set_hl(0, "MiniStatuslineFilename", { link = "StatusLineNC" }) +vim.api.nvim_set_hl(0, "MiniStatuslineInactive", { link = "StatusLineNC" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeCommand", { link = "DiffText" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeInsert", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeNormal", { link = "Cursor" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeOther", { link = "IncSearch" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeReplace", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeVisual", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "ModeMsg", { link = "Normal" }) +vim.api.nvim_set_hl(0, "MoreMsg", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "MsgArea", { link = "Normal" }) +vim.api.nvim_set_hl(0, "NonText", { fg = 6252924 }) +vim.api.nvim_set_hl(0, "Normal", { bg = 2632756, fg = 11252415 }) +vim.api.nvim_set_hl(0, "NormalFloat", { bg = 2171692, blend = 5 }) +vim.api.nvim_set_hl(0, "NormalNC", { link = "Normal" }) +vim.api.nvim_set_hl(0, "Number", { fg = 16743160 }) +vim.api.nvim_set_hl(0, "Operator", { fg = 8160474 }) +vim.api.nvim_set_hl(0, "Pmenu", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "PmenuSbar", { bg = 3357256 }) +vim.api.nvim_set_hl(0, "PmenuSel", { bg = 2639473 }) +vim.api.nvim_set_hl(0, "PmenuThumb", { bg = 8160474 }) +vim.api.nvim_set_hl(0, "PreProc", { fg = 1094654 }) +vim.api.nvim_set_hl(0, "Question", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "QuickFixLine", { bg = 3707647, fg = 16777215 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterBlue", { fg = 4367615 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterCyan", { fg = 2680299 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterGreen", { fg = 9565490 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterOrange", { fg = 16752676 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterRed", { fg = 16737894 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterViolet", { fg = 16743167 }) +vim.api.nvim_set_hl(0, "RainbowDelimiterYellow", { fg = 16056186 }) +vim.api.nvim_set_hl(0, "Removed", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "Search", { bg = 1667142 }) +vim.api.nvim_set_hl(0, "SignColumn", { link = "Normal" }) +vim.api.nvim_set_hl(0, "Special", { link = "Character" }) +vim.api.nvim_set_hl(0, "SpecialKey", { fg = 16749931 }) +vim.api.nvim_set_hl(0, "Statement", { cterm = { italic = true }, fg = 1094654, italic = true }) +vim.api.nvim_set_hl(0, "StatusLine", { bg = 3950941 }) +vim.api.nvim_set_hl(0, "StatusLineNC", { bg = 3225151 }) +vim.api.nvim_set_hl(0, "String", { fg = 16370008 }) +vim.api.nvim_set_hl(0, "Substitute", { link = "IncSearch" }) +vim.api.nvim_set_hl(0, "TabLine", { bg = 2896186, fg = 6252924 }) +vim.api.nvim_set_hl(0, "TabLineFill", { bg = 2632756 }) +vim.api.nvim_set_hl(0, "TabLineSel", { bg = 3817291, cterm = { underline = true }, sp = 3707647, underline = true }) +vim.api.nvim_set_hl(0, "Tag", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "TermCursor", { link = "Cursor" }) +vim.api.nvim_set_hl(0, "Title", { fg = 3707647 }) +vim.api.nvim_set_hl(0, "Todo", { bg = 3707647, fg = 16777215 }) +vim.api.nvim_set_hl(0, "Type", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "Visual", { bg = 2639473 }) +vim.api.nvim_set_hl(0, "VisualNOS", { bg = 2639473 }) +vim.api.nvim_set_hl(0, "WarningMsg", { fg = 14318404 }) +vim.api.nvim_set_hl(0, "Whitespace", { fg = 3950941 }) +vim.api.nvim_set_hl(0, "WildMenu", { bg = 2639473 }) +vim.api.nvim_set_hl(0, "WinBar", { bold = true, cterm = { bold = true }, fg = 3707647 }) +vim.api.nvim_set_hl(0, "WinBarNC", { fg = 11252415 }) +vim.api.nvim_set_hl(0, "WinSeparator", { fg = 5926284 }) +vim.api.nvim_set_hl(0, "diffAdded", { fg = 4179564 }) +vim.api.nvim_set_hl(0, "diffChanged", { link = "PreProc" }) +vim.api.nvim_set_hl(0, "diffIndexLine", { fg = 9096687 }) +vim.api.nvim_set_hl(0, "diffLine", { fg = 16743160 }) +vim.api.nvim_set_hl(0, "diffNewFile", { fg = 10519038 }) +vim.api.nvim_set_hl(0, "diffOldFile", { fg = 13539464 }) +vim.api.nvim_set_hl(0, "diffRemoved", { fg = 16737922 }) +vim.api.nvim_set_hl(0, "diffSubname", { fg = 16370008 }) +vim.api.nvim_set_hl(0, "lCursor", { link = "Cursor" }) +vim.api.nvim_set_hl(0, "markdownH1", { link = "RainbowRed" }) +vim.api.nvim_set_hl(0, "markdownH2", { link = "RainbowYellow" }) +vim.api.nvim_set_hl(0, "markdownH3", { link = "RainbowBlue" }) +vim.api.nvim_set_hl(0, "markdownH4", { link = "RainbowOrange" }) +vim.api.nvim_set_hl(0, "markdownH5", { link = "RainbowGreen" }) +vim.api.nvim_set_hl(0, "markdownH6", { link = "RainbowViolet" }) diff --git a/nvim/colors/ex-pustota.lua b/nvim/colors/ex-pustota.lua new file mode 100644 index 0000000..0ffce98 --- /dev/null +++ b/nvim/colors/ex-pustota.lua @@ -0,0 +1,155 @@ +-- This file is generated by ex-colors. The credit goes to the authors and contributors of the original colorscheme pustota. +vim.api.nvim_set_var("colors_name", "ex-pustota") +vim.api.nvim_set_hl(0, "@constant", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@constant.builtin", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@function.call", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@function.macro", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@function.method.call", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@keyword.directive", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@module", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@module.builtin", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@punctuation.bracket", { link = "Bracket" }) +vim.api.nvim_set_hl(0, "@punctuation.delimiter", { link = "Bracket" }) +vim.api.nvim_set_hl(0, "@punctuation.special", { link = "Bracket" }) +vim.api.nvim_set_hl(0, "@string.escape", { link = "String" }) +vim.api.nvim_set_hl(0, "@type", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@type.definition", { link = "Type" }) +vim.api.nvim_set_hl(0, "@variable", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@variable.builtin", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@variable.member", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "@variable.parameter", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "BlinkCmpDoc", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocCursorLine", { link = "Visual" }) +vim.api.nvim_set_hl(0, "BlinkCmpDocSeparator", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpGhostText", { link = "NonText" }) +vim.api.nvim_set_hl(0, "BlinkCmpKind", { link = "PmenuKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindClass", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindColor", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstant", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindConstructor", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnum", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEnumMember", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindEvent", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindField", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFile", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFolder", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindFunction", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindInterface", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindKeyword", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindMethod", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindModule", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindOperator", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindProperty", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindReference", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindSnippet", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindStruct", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindText", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindTypeParameter", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindUnit", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindValue", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpKindVariable", { link = "BlinkCmpKind" }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDeprecated", { link = "PmenuExtra" }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { link = "PmenuExtra" }) +vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { link = "PmenuExtra" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenu", { link = "Pmenu" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "Pmenu" }) +vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { link = "PmenuSel" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarGutter", { link = "PmenuSbar" }) +vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { link = "PmenuThumb" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelp", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpActiveParameter", { link = "LspSignatureActiveParameter" }) +vim.api.nvim_set_hl(0, "BlinkCmpSignatureHelpBorder", { link = "NormalFloat" }) +vim.api.nvim_set_hl(0, "BlinkCmpSource", { link = "PmenuExtra" }) +vim.api.nvim_set_hl(0, "Character", { fg = 12769612 }) +vim.api.nvim_set_hl(0, "Comment", { cterm = { italic = true }, fg = 6449779, italic = true }) +vim.api.nvim_set_hl(0, "Conceal", { fg = 5198424 }) +vim.api.nvim_set_hl(0, "Conditional", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "Constant", { fg = 15119440 }) +vim.api.nvim_set_hl(0, "Cursor", { bg = 11776429, fg = 658964 }) +vim.api.nvim_set_hl(0, "Exception", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "Function", { fg = 16757844 }) +vim.api.nvim_set_hl(0, "GitSignsAdd", { link = "Added" }) +vim.api.nvim_set_hl(0, "GitSignsAddCul", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsAddLn", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { link = "GitSignsAddInline" }) +vim.api.nvim_set_hl(0, "GitSignsAddNr", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsAddPreview", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "GitSignsChange", { link = "Changed" }) +vim.api.nvim_set_hl(0, "GitSignsChangeCul", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLn", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { link = "GitSignsChangeInline" }) +vim.api.nvim_set_hl(0, "GitSignsChangeNr", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedelete", { link = "GitSignsChange" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteCul", { link = "GitSignsChangeCul" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteLn", { link = "GitSignsChangeLn" }) +vim.api.nvim_set_hl(0, "GitSignsChangedeleteNr", { link = "GitSignsChangeNr" }) +vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { link = "NonText" }) +vim.api.nvim_set_hl(0, "GitSignsDelete", { link = "Removed" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteCul", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteInline", { link = "TermCursor" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { link = "GitSignsDeleteInline" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteNr", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeletePreview", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLn", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "GitSignsDeleteVirtLnInLine", { link = "GitSignsDeleteLnInline" }) +vim.api.nvim_set_hl(0, "GitSignsStagedAdd", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddCul", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddLn", { bg = 21795, fg = 7829628 }) +vim.api.nvim_set_hl(0, "GitSignsStagedAddNr", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChange", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeCul", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeLn", { bg = 5198424, fg = 7829628 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangeNr", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedelete", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteCul", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteLn", { bg = 5198424, fg = 7829628 }) +vim.api.nvim_set_hl(0, "GitSignsStagedChangedeleteNr", { fg = 4619387 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDelete", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteCul", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedDeleteNr", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdelete", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteCul", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedTopdeleteNr", { fg = 8347740 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntracked", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedCul", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedLn", { bg = 21795, fg = 7829628 }) +vim.api.nvim_set_hl(0, "GitSignsStagedUntrackedNr", { fg = 5864288 }) +vim.api.nvim_set_hl(0, "GitSignsTopdelete", { link = "GitSignsDelete" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteCul", { link = "GitSignsDeleteCul" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteLn", { link = "GitSignsDeleteLn" }) +vim.api.nvim_set_hl(0, "GitSignsTopdeleteNr", { link = "GitSignsDeleteNr" }) +vim.api.nvim_set_hl(0, "GitSignsUntracked", { link = "GitSignsAdd" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedCul", { link = "GitSignsAddCul" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedLn", { link = "GitSignsAddLn" }) +vim.api.nvim_set_hl(0, "GitSignsUntrackedNr", { link = "GitSignsAddNr" }) +vim.api.nvim_set_hl(0, "GitSignsVirtLnum", { link = "GitSignsDeleteVirtLn" }) +vim.api.nvim_set_hl(0, "Keyword", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "Label", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "MiniStatuslineDevinfo", { link = "StatusLine" }) +vim.api.nvim_set_hl(0, "MiniStatuslineFileinfo", { link = "StatusLine" }) +vim.api.nvim_set_hl(0, "MiniStatuslineFilename", { link = "StatusLineNC" }) +vim.api.nvim_set_hl(0, "MiniStatuslineInactive", { link = "StatusLineNC" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeCommand", { link = "DiffText" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeInsert", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeNormal", { link = "Cursor" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeOther", { link = "IncSearch" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeReplace", { link = "DiffDelete" }) +vim.api.nvim_set_hl(0, "MiniStatuslineModeVisual", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "Normal", { bg = 658964, fg = 11776429 }) +vim.api.nvim_set_hl(0, "Operator", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "PreProc", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "Repeat", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "Special", { fg = 11776429 }) +vim.api.nvim_set_hl(0, "Statement", { fg = 16748352 }) +vim.api.nvim_set_hl(0, "String", { fg = 12769612 }) +vim.api.nvim_set_hl(0, "Type", { fg = 5882623 }) +vim.api.nvim_set_hl(0, "Visual", { bg = 1844785 }) +vim.api.nvim_set_hl(0, "diffAdded", { link = "Identifier" }) +vim.api.nvim_set_hl(0, "diffChanged", { link = "PreProc" }) +vim.api.nvim_set_hl(0, "diffNewFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "diffOldFile", { link = "DiffFile" }) +vim.api.nvim_set_hl(0, "diffRemoved", { link = "Special" }) +vim.api.nvim_set_hl(0, "lCursor", { bg = 11776429, fg = 658964 }) diff --git a/nvim/filetype.lua b/nvim/filetype.lua new file mode 100644 index 0000000..7b3b8aa --- /dev/null +++ b/nvim/filetype.lua @@ -0,0 +1,79 @@ +local function vim2ext(t, s, ft) + for k in string.gmatch(s, "%*%.(%w+),") do + t[k] = ft + end +end + +local lf = require("largefiles") + +local ext = { + dockerfile = "dockerfile", + automount = "systemd", + mount = "systemd", + path = "systemd", + service = "systemd", + socket = "systemd", + swap = "systemd", + target = "systemd", + timer = "systemd", + log = "log", + LOG = "log", + _log = "log", + _LOG = "log", + scpt = "applescript", + applescript = "applescript", + Caddyfile = "caddyfile", + csv = "csv", + tsv = "csv", + tab = "csv", + dat = "csv", + mako = "mako", + dbml = "dbml", + lalrpop = "lalrpop", + snippets = "snippets", + jinja = "jinja", + jinja2 = "jinja", + j2 = "jinja", + http = "http", + tmpl = "gotmpl", + gotmpl = "gotmpl", +} + +vim2ext(ext, "*.vert,*.tesc,*.tese,*.glsl,*.geom,*.frag,*.comp,*.rgen,*.rmiss,*.rchit,*.rahit,*.rint,*.rcall", "glsl") +vim2ext(ext, "*.vs,*.fs", "glsl") +vim2ext(ext, "*.graphql,*.graphqls,*.gql,*.prisma", "graphql") +vim2ext(ext, "*.gotmpl,helmfile*.yaml", "yaml.helm") + +vim.filetype.add({ + extension = ext, + pattern = { + ["openapi.*%.ya?ml"] = "yaml.openapi", + ["openapi.*%.json"] = "json.openapi", + ["*%.snip"] = "vim", + ["*%.nginx"] = "nginx", + [".*nginx.*%.conf"] = "nginx", + [".*nginx/.*/conf.*"] = "nginx", + [".*/nginx/.*%.conf"] = "nginx", + ["/srv/nginx/conf%.d/locations/.*"] = "nginx", + [".*/playbooks/*.y*"] = "yaml.ansible", + [".*compose.*.y*"] = "yaml.docker-compose", + ["Caddyfile.*"] = "caddyfile", + ["haproxy.*.c.*"] = "haproxy", + [".*/templates/.*.yaml"] = "yaml.helm", + [".*/templates/.*.tpl"] = "yaml.helm", + [".*/helm/.*.yaml"] = "yaml.helm", + [".*"] = { + function(path, buf) + lf.optimize_buffer(buf, path) + local t = lf.is_large_file(buf, false, path) + if t == lf.FILE_TYPE.LARGE_SIZE then + return "largefile.size" + end + if t == lf.FILE_TYPE.READ_ONLY then + return "largefile.readonly" + end + return nil + end, + }, + }, +}) diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..35e86f3 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,200 @@ +vim.loader.enable() + +table.unpack = table.unpack or unpack +if not vim.uv then + vim.uv = vim.loop +end + +local g = vim.g +local opt = vim.opt + +g.has_ui = #vim.api.nvim_list_uis() > 0 +g.modern_ui = (g.has_ui and vim.env.DISPLAY ~= nil) or string.format("%s", vim.env.TERM):find("256") +g.post_load_events = { "BufReadPost", "FileReadPost", "TermOpen" } +g.pre_load_events = { "BufReadPre", "FileReadPre", "BufNewFile", "TermOpen" } + +-- stylua: ignore start +g.snips_author = vim.env.AUTHOR or "Jury Markin" +g.snips_email = vim.env.EMAIL or "me@jmarkin.ru" +g.snips_github = vim.env.GITHUB or "https://github.com/JMarkin" + + +opt.cmdheight = 0 +-- opt.colorcolumn = '+1' +opt.cursorlineopt = 'both' +opt.cursorline = true +-- g.cursorhold_updatetime = 200 +g.default_winwidth = 20 +g.default_winheight = 1 +opt.winwidth = g.default_winwidth +opt.winheight = g.default_winheight +opt.winminwidth = 20 +opt.pumheight = 20 +opt.splitright = true +opt.splitbelow = true +opt.equalalways = false +opt.updatetime = 200 +opt.number = true +g.numbertoggle = true +opt.ruler = true +opt.scrolloff = 4 +opt.sidescrolloff = 8 +opt.sidescroll = 0 +opt.signcolumn = 'yes:1' +opt.swapfile = true +opt.undofile = true +opt.wrap = false +opt.linebreak = true +opt.breakindent = true +opt.scrollback = 2000 +opt.conceallevel = 0 +opt.autowriteall = true +opt.virtualedit = 'block' +opt.mouse = "vh" +opt.mousemoveevent = true +opt.mousefocus = false +g.mapleader = "\\" +opt.fileencoding = "utf-8" +opt.encoding = "utf-8" +opt.hidden = true +opt.showmatch = false +opt.hlsearch = true +opt.autochdir = false +opt.bs = "indent,eol,start" +g.editorconfig = true +opt.synmaxcol = 240 +opt.exrc = true +opt.laststatus = 3 + +opt.guifont = "JetBrainsMonoNL Nerd Font Mono:h13" +opt.guicursor = "a:block" +opt.background = "dark" + +if vim.fn.has('nvim-0.11') == 1 then +opt.completeopt = "menu,menuone,noselect,popup,noinsert,fuzzy" +else +opt.completeopt = "menu,menuone,noselect,popup,noinsert" +end +opt.cia = 'kind,abbr,menu' + +opt.tags = { "tags", ".git/tags" } + +opt.spell = false +opt.spelllang = { "en", "ru" } +g.spellfile_URL = "https://ftp.nluug.nl/vim/runtime/spell/" + +g.root_pattern = { + ".nvim.lua", + "flake.nix", + "Makefile", + ".git", + } +opt.list = true +opt.listchars = { + tab = '→ ', + trail = '·', + eol = '↲', + } +opt.fillchars = { + eob = ' ', + } + +opt.tabstop = 4 +opt.softtabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = true +opt.smartindent = true +opt.autoindent = true + +opt.ignorecase = true +opt.smartcase = true + +opt.termguicolors = true + +opt.textwidth = 80 + +opt.relativenumber = true +opt.sessionoptions = 'curdir,folds,globals,help,tabpages,terminal,winsize' +opt.viewoptions = 'folds,cursor' + +g.omni_sql_ignorecase = 1 + + + + +g.lsp_autostart = vim.env.LSP_AUTOSTART ~= nil + +opt.wildignore:append({ -- Ignore on file name completion. + ".DS_store", + "**/node_modules/**", + "**/.venv/**", +}) + +opt.lazyredraw = true + +-- stylua: ignore end +g.dbs = { + { name = "local", url = vim.env.DB_URL }, +} + +opt.shortmess:append({ W = false, I = true, c = true, C = true, A = false }) + +if g.modern_ui then + opt.listchars:append({ nbsp = "␣" }) + opt.fillchars:append({ + eob = " ", + diff = "╱", + }) + + -- vim.api.nvim_command('colorscheme ex-bamboo') +else + opt.termguicolors = false +end + +opt.backup = true +opt.backupdir:remove(".") + +-- netrw settings +-- stylua: ignore start +g.netrw_winsize = 30 +g.netrw_banner = 0 +g.netrw_cursor = 5 +g.netrw_keepdir = 1 +g.netrw_list_hide = "__pycache__," .. [[\(^\|\s\s\)\zs\.\S\+]] +g.netrw_liststyle = 0 +g.netrw_localcopydircmd = "cp -r" +g.netrw_localmkdir = "mkdir -p" +g.netrw_preview = 1 +g.netrw_alto = 1 +g.netrw_fastbrowse = 2 +g.netrw_sizestyle = "H" +g.netrw_sort_options = "i" +-- stylua: ignore end + +-- disable plugins shipped with neovim +-- g.loaded_2html_plugin = 1 +g.loaded_matchit = 1 +g.loaded_tutor_mode_plugin = 1 +g.loaded_vimball = 1 +g.loaded_vimballPlugin = 1 +g.loaded_python3_provider = 1 +g.loaded_ruby_provider = 1 +g.loaded_node_provider = 1 +g.loaded_perl_provider = 1 + +-- g.loaded_zip = 1 +-- g.loaded_zipPlugin = 1 +-- g.loaded_gzip = 1 +-- g.loaded_tar = 1 +-- g.loaded_tarPlugin = 1 +-- stylua: ignore end + +vim.g.rainbow_delimiters_highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", +} diff --git a/nvim/lsp/basedpyright.lua b/nvim/lsp/basedpyright.lua new file mode 100644 index 0000000..d5d6505 --- /dev/null +++ b/nvim/lsp/basedpyright.lua @@ -0,0 +1,63 @@ +local function set_python_path(path) + local clients = vim.lsp.get_clients({ + bufnr = vim.api.nvim_get_current_buf(), + name = "basedpyright", + }) + for _, client in ipairs(clients) do + if client.settings then + client.settings.python = vim.tbl_deep_extend("force", client.settings.python or {}, { pythonPath = path }) + else + client.config.settings = vim.tbl_deep_extend("force", client.config.settings, { python = { pythonPath = path } }) + end + client.notify("workspace/didChangeConfiguration", { settings = nil }) + end +end + +return { + cmd = { "basedpyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { + "pyproject.toml", + "setup.py", + "setup.cfg", + "requirements.txt", + "Pipfile", + "pyrightconfig.json", + ".git", + }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + typeCheckingMode = "off", + useLibraryCodeForTypes = true, + diagnosticMode = "openFilesOnly", + exclude = { + "node_modules", + "**/__pycache__", + "tests", + "build", + "dist", + ".*", + "**/.*", + }, + }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, "LspPyrightOrganizeImports", function() + client:exec_cmd({ + command = "basedpyright.organizeimports", + arguments = { vim.uri_from_bufnr(bufnr) }, + }) + end, { + desc = "Organize Imports", + }) + + vim.api.nvim_buf_create_user_command(0, "LspPyrightSetPythonPath", set_python_path, { + desc = "Reconfigure basedpyright with the provided python path", + nargs = 1, + complete = "file", + }) + end, +} diff --git a/nvim/lsp/clangd.lua b/nvim/lsp/clangd.lua new file mode 100644 index 0000000..4802c55 --- /dev/null +++ b/nvim/lsp/clangd.lua @@ -0,0 +1,3 @@ +return { + cmd = { "clangd", "--background-index=false", "--clang-tidy" }, +} diff --git a/nvim/lsp/docker_language_server.lua b/nvim/lsp/docker_language_server.lua new file mode 100644 index 0000000..d4ef269 --- /dev/null +++ b/nvim/lsp/docker_language_server.lua @@ -0,0 +1,10 @@ +return { + cmd = { "docker-language-server start", "--stdio" }, + filetypes = { "dockerfile", "yaml.docker-compose" }, + root_markers = { "Dockerfile", "docker-compose.yaml", "docker-compose.yml", "compose.yaml", "compose.yml" }, + settings = { + initializationOptions = { + telemetry = "off", + }, + }, +} diff --git a/nvim/lsp/gopls.lua b/nvim/lsp/gopls.lua new file mode 100644 index 0000000..a36e0a4 --- /dev/null +++ b/nvim/lsp/gopls.lua @@ -0,0 +1,37 @@ +return { + settings = { + gopls = { + gofumpt = false, + codelenses = { + gc_details = false, + generate = true, + regenerate_cgo = true, + run_govulncheck = true, + test = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + analyses = { + nilness = true, + unusedparams = true, + unusedwrite = true, + useany = true, + }, + usePlaceholders = true, + completeUnimported = true, + staticcheck = true, + directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, + semanticTokens = false, + }, + }, +} diff --git a/nvim/lsp/jsonls.lua b/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..98da93b --- /dev/null +++ b/nvim/lsp/jsonls.lua @@ -0,0 +1,8 @@ +return { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, +} diff --git a/nvim/lsp/lua_ls.lua b/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..6782c51 --- /dev/null +++ b/nvim/lsp/lua_ls.lua @@ -0,0 +1,38 @@ +return { + settings = { + Lua = { + telemetry = { + enable = false, + }, + hint = { + enable = true, + }, + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { + "vim", + }, + }, + completion = { + callSnippet = "Replace", + }, + workspace = { + checkThirdParty = false, + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIM/lazy")] = true, + [vim.fn.expand("$VIMRUNTIME")] = true, + [vim.fn.expand("~/.config/nvim/lua")] = true, + }, + }, + }, + }, + on_attach = function(client, buf) + if vim.bo[buf].filetype == "lua" and vim.api.nvim_buf_get_name(buf):find("_spec") then + vim.diagnostic.enable(false, { bufnr = buf }) + return + end + end, +} diff --git a/nvim/lsp/rust_analyzer.lua b/nvim/lsp/rust_analyzer.lua new file mode 100644 index 0000000..edce962 --- /dev/null +++ b/nvim/lsp/rust_analyzer.lua @@ -0,0 +1,38 @@ +return { + settings = { + checkOnSave = true, + completion = { + autoimport = { + enable = false, + }, + }, + procMacro = { + enable = true, + }, + files = { + excludeDirs = { + ".direnv", + "_build", + ".dart_tool", + ".flatpak-builder", + ".git", + ".gitlab", + ".gitlab-ci", + ".gradle", + ".idea", + ".next", + ".project", + ".scannerwork", + ".settings", + ".venv", + "archetype-resources", + "bin", + "hooks", + "node_modules", + "po", + "screenshots", + "target", + }, + }, + }, +} diff --git a/nvim/lsp/ty.lua b/nvim/lsp/ty.lua new file mode 100644 index 0000000..3793d7d --- /dev/null +++ b/nvim/lsp/ty.lua @@ -0,0 +1,5 @@ +return { + cmd = { "ty", "server" }, + filetypes = { "python" }, + root_dir = vim.fs.root(0, { ".git/", "pyproject.toml" }), +} diff --git a/nvim/lsp/yamlls.lua b/nvim/lsp/yamlls.lua new file mode 100644 index 0000000..2d9b455 --- /dev/null +++ b/nvim/lsp/yamlls.lua @@ -0,0 +1,16 @@ +return { + filetypes = { "yaml", "yaml.openapi", "yaml.helm", "yaml.ansible" }, + settings = { + yaml = { + schemaStore = { + enable = false, + }, + schemas = require("schemastore").yaml.schemas(), + }, + redhat = { + telemetry = { + enabled = false, + }, + }, + }, +} diff --git a/nvim/lua/banner.lua b/nvim/lua/banner.lua new file mode 100644 index 0000000..af8f85c --- /dev/null +++ b/nvim/lua/banner.lua @@ -0,0 +1,462 @@ +local M = { + ["datetime"] = { + "Today's " .. os.date("%a %d %b"), + -- os.date " %m-%d-%Y  %H:%M:%S", + }, + ["threeskulls"] = { + [[⠀⠀⠀⠀⠀⣀⣀⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣀⣀⠀⠀⠀⠀⠀]], + [[⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀]], + [[⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀]], + [[⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣿⣿⣿⡆⠀⠀⠀⢸⣿⣿⠿⠿⢿⣿⣿⣿⣿⡿⠿⠿⣿⣿⡇⠀⠀⠀⣾⣿⣿⡿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆]], + [[⢿⣿⠿⠿⠿⠿⣿⣿⣿⡏⠀⠀⠀⢹⣿⡇⠀⠀⠀⢸⣿⢱⣶⣴⣶⢹⣿⣿⡏⣶⣦⣶⡎⣿⡇⠀⠀⠀⢿⣿⠁⠀⠀⠈⣿⣿⣿⡿⠟⣋⣽⣿⣿⠇]], + [[⠘⣿⣧⣄⣀⣴⣿⣿⣿⣷⣄⣀⣠⣾⣟⠀⠀⠀⠀⠈⣿⣦⣙⣛⣡⣾⡿⢿⣷⣌⣛⣋⣴⣿⠁⠀⠀⠀⠘⣿⣦⣄⣀⣴⣿⣿⣿⣿⣶⣶⣤⣿⡟⠀]], + [[⠀⢿⣿⣿⣿⣿⣏⣼⣌⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣰⣆⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣏⣼⣌⣿⣿⣿⣿⣿⠏⠀]], + [[⠀⠀⠉⠉⢿⣿⣿⣿⣿⣿⣿⡏⠉⠁⠀⠀⠀⠀⠀⠀⠀⠉⠉⢹⣿⣿⣿⣿⣿⣿⡏⠉⠉⠀⠀⠀⠀⠀⠀⠀⠉⠉⣿⣿⣿⣿⣿⣿⣿⡏⠉⠁⠀⠀]], + [[⠀⠀⠀⠀⠈⠉⠁⠁⠁⠉⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠁⠉⠉⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠁⠁⠁⠉⠉⠀⠀⠀⠀⠀]], + }, + ["nvim1"] = { + [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], + [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], + }, + ["nvim2"] = { + [[ _/ _/ _/ _/ _/ ]], + [[ _/_/ _/ _/_/ _/_/ _/ _/ _/_/_/ _/_/ ]], + [[ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/]], + [[ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ ]], + [[_/ _/ _/_/_/ _/_/ _/ _/ _/ _/ _/ ]], + }, + ["nvim4"] = { + [[  ]], + [[ ████ ██████ █████ ██ ]], + [[ ███████████ █████  ]], + [[ █████████ ███████████████████ ███ ███████████ ]], + [[ █████████ ███ █████████████ █████ ██████████████ ]], + [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], + [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], + [[██████ █████████████████████ ████ █████ █████ ████ ██████]], + }, + ["nvim5"] = { + [[ ]], + [[ ██████ █████ █████ █████ ███ ]], + [[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]], + [[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]], + [[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]], + [[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]], + [[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]], + [[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]], + [[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]], + [[ ]], + }, +} + +M.nami = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢀⣀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢀⠠⠄⠀⠀⠈⠀⠀⠀⠀⠀⠀⠊⠨⠀⢄⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣄⠔⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿", + "⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠆⠂⠀⠀⠀⠀⠀⣠⣄⢰⡆⢷⡘⣷⡆⢦⠰⣄⢠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿", + "⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠂⠉⠀⠀⠀⠀⠀⣰⢃⣾⣿⣿⡌⢷⠸⣷⡘⣿⡌⢇⢻⡄⢿⣎⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⡠⠋⠀⠀⠀⠀⣠⡄⣼⢠⠃⣾⣿⣿⣿⣷⡘⡆⢻⣷⡌⢿⡌⠀⢿⡘⣿⡆⠿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿", + "⠀⠀⠀⠀⠀⠀⡠⠊⠀⠀⠀⠀⣠⢀⣿⢠⡇⡎⣼⣿⣿⣿⣿⣿⣷⡔⠘⣿⣿⣦⠻⡌⠈⢷⡘⣷⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿", + "⡇⠀⠀⠀⢀⠈⠁⠀⠀⠀⠀⣸⣿⢸⡏⠸⠐⢰⣿⣿⣿⣿⣿⣿⣿⣿⣦⣘⣿⣿⣷⣄⠀⠀⢳⡘⡆⠈⣿⠰⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹", + "⣇⠀⠀⡠⠂⠀⠀⠀⠀⢠⢁⣿⣿⢸⡇⡆⢀⠿⠿⠿⠛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣂⡀⠀⢳⠠⠀⣿⡀⡆⠀⠀⠀⠀⠀⠀⠀⠀⣼", + "⣿⠀⠀⠀⠀⠀⠀⠀⢀⠎⣼⡟⠠⢸⡇⠀⣰⣶⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⢋⣵⣿⣿⣷⣦⠀⠁⠀⣿⡇⠇⠀⠀⠀⠀⠀⠀⠀⣰⣿", + "⣿⠁⠀⠀⠀⠀⠀⠀⠌⣼⠟⢀⠀⠀⡇⡆⣿⡿⠋⠉⠉⠡⢿⣿⣿⣿⣿⣿⠃⣾⡿⠋⠉⠠⠍⠡⠵⡀⣿⡇⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿", + "⠃⠀⠀⠀⠀⠀⠀⢀⠚⡣⢠⢊⠀⡄⠀⠗⣠⠘⠁⢀⣀⣈⣹⣿⣿⣿⣿⣿⢸⣿⠎⣀⣤⣤⡀⢁⣶⡇⣿⡇⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⡿⢡⡀⢡⢇⠀⣷⡀⡾⠁⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠿⣿⣿⣿⣿⣿⣿⣿⠀⣿⠁⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⡇⢸⢨⠂⡸⠀⢹⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢃⣴⣿⣿⣿⣿⣿⣿⡇⢠⡏⠀⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠁⠘⣆⠃⠱⡀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡷⠿⠿⠿⢿⣿⣿⣿⣿⠀⡼⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠠⡹⣄⡃⠉⢄⠘⣿⣿⣿⣿⣿⣿⣆⠠⢤⣤⣴⠶⠶⠒⠛⢀⣿⣿⣿⣿⠇⣸⠃⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣧⡀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢍⣑⠒⠄⠘⢿⣿⣿⣿⣿⣿⣷⣄⠠⢤⣤⣤⠀⣠⣿⣿⣿⡿⠋⢠⠃⢠⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣦⣀⡀⠀⠀⠀⠀⠀⠀⠐⠨⢅⡚⡀⢤⠙⠻⢿⣿⣿⣿⣿⣿⡶⠤⠤⢊⣿⣿⡿⠛⠁⢀⠂⠀⠲⣌⠳⣦⣈⠛⢿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣍⡈⠀⠀⠀⠈⠉⠛⠛⠿⠿⣿⣿⠿⠟⠋⠀⠀⡠⠁⡀⡄⣷⣌⢳⣌⠻⣿⣦⣄⡉⠫⠯⠉⠍", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⣋⣥⠖⠂⠀⠀⢦⣀⠀⠠⠁⠀⠀⠀⠀⠀⠀⠀⣰⠄⢐⠳⡐⠘⠿⠢⠙⢷⠙⣿⣿⣿⣦⡙⢧⣴", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣫⣴⡿⠋⣱⣿⠃⡇⠀⠈⣿⣧⣤⣤⡀⠀⠀⠀⣄⠆⡼⠋⣼⣿⣷⣤⣴⣿⣿⡗⠀⢇⠙⢿⣿⣿⣿⡆⢻", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⣴⣿⢏⠄⣴⣿⡟⡘⠐⡀⣄⢸⣿⣿⣿⣿⣿⡶⠀⢃⡾⠱⢀⣿⣿⣿⣿⣿⣿⠏⣴⡄⡌⣆⠈⢿⣿⣿⣿⠈", + "⣿⣿⣿⣿⣿⣿⣿⣿⠃⣾⣿⢣⠎⣼⣿⡿⠀⠀⠐⠰⠿⢸⣿⣿⣿⡿⢋⣶⣿⣶⣤⣴⣿⡿⠛⠛⠋⠉⠁⠨⣽⣇⠰⢸⡄⠘⣿⣿⡿⠀", + "⣿⣿⣿⣿⣿⣿⣿⠃⣼⣿⠃⠎⣼⣿⠟⢀⡾⢠⣴⠿⠃⢸⣿⣿⣿⡀⠻⣿⣿⣿⡿⠟⠉⣠⣶⣶⣾⣷⣶⣄⡀⠙⠀⡘⡇⡇⣿⡿⣡⢱", + "⣿⣿⣿⣿⣿⣿⡏⢰⣿⣿⠀⢸⣿⠏⣴⣿⣷⡆⠁⠀⠀⣿⣿⣿⡿⢃⣼⣿⡿⠋⠄⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠌⢀⠀⡿⢡⡟⣿", + "⣿⣿⣿⣿⣿⡿⢁⢸⣿⣿⡆⢈⢻⠸⢛⣉⣩⠂⠀⠀⣴⣿⣿⣿⡦⢸⡿⡋⠈⠌⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠉⢸⡇⣿⢹⣿", + "⣿⣿⣿⣿⣿⢱⢃⡄⢻⣿⣿⠈⡆⠃⢾⣿⡏⠀⠀⣼⣿⣿⠟⣫⡴⢋⠀⡃⠈⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠄⣿⡅⣿⠸⣿", +} + +M.luffy = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⢟⣛⣛⣛⣉⣉⣉⣙⣛⣛⣛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢋⣥⣶⡿⠟⠅⡿⠿⠿⠾⠿⠿⠍⠛⠋⢿⣶⣦⣍⡻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠡⠾⢟⣋⣀⣠⣤⣴⣶⣶⣶⣾⣿⣷⣶⣶⣶⣬⣁⣉⣙⠻⠦⣉⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢟⣡⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣿⣿⣿⣿⣶⣦⣀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢛⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠛⢉⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⣡⡾⠟⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠁⠀⠀⠀⠀⠀⠴⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⣤⡞⡣⢐⣾⣿⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⢠⣦⠀⠀⠀⠀⡀⠀⠀⠀⠉⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢟⢳⡌⠻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢋⣴⠟⡡⢪⢜⡯⣿⣿⢉⡭⢛⠟⠋⠀⠀⠀⣠⣾⠀⣿⣿⣆⠀⠀⠀⢱⣄⠀⠀⠀⠀⠀⠙⠿⣿⢿⡛⢿⡛⣿⢷⡘⡦⣦⢹⣦⠘⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⡿⢡⣾⢋⣼⣼⡵⣡⣪⠟⢁⣤⠒⠁⠀⠀⠀⢀⣼⣿⣿⠀⣿⣿⣿⣦⠀⠀⠈⣿⣧⡀⠀⠀⠀⠀⠀⠈⠳⢝⢂⠋⢻⡁⡐⡐⣙⣦⡍⣷⡈⢿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⡟⢀⣿⣿⣿⣿⣿⡟⣱⠟⣠⣿⠁⠀⠀⠀⡄⢀⣾⣿⣿⣿⡄⣿⣿⣿⣿⣷⣄⠀⢹⣿⣿⡄⠀⢠⠀⠀⠀⠀⠀⠀⠁⠡⢴⣴⣾⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⡿⢠⣿⣿⣿⣿⣿⣿⠖⣧⣎⣾⠁⠀⠀⢀⡜⠠⠟⠛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠈⠛⣻⣭⣄⠀⣧⠀⠀⠀⠹⣷⠳⡄⠘⠟⢻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿", + "⣿⣿⣿⣿⣿⡿⢠⡟⡸⠻⠛⠹⣿⡟⠸⣿⣿⠁⠀⠀⠀⣼⢃⣾⣿⣿⣿⣷⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣦⢹⡆⠀⠀⠀⠹⠓⠸⡄⠜⠇⠆⠉⣿⣿⣿⣿⣿⠈⣿⣿⣿", + "⣿⣿⣿⣿⡿⠀⡿⢀⠁⠃⠇⡆⢻⢰⢰⡆⢁⡀⠀⠀⣰⣿⣿⣿⡿⠿⢿⣿⣿⣿⣿⣧⠹⣿⣿⣿⣿⣿⡿⠟⠛⠙⠛⢿⣿⠀⠀⠀⠀⠀⢄⠰⣴⣸⡘⣴⡌⣿⣧⣿⣿⠀⣿⣿⣿", + "⣿⣿⣿⣿⠀⢸⠀⡇⡎⡆⡆⡇⡈⡈⠚⣠⣿⣿⠀⠀⣿⣿⡿⠃⣠⣤⣤⡀⢙⣿⣿⣟⠀⢻⣿⣿⣿⣿⢠⣶⣿⣷⣄⠘⣿⡆⠃⠀⢹⣿⣾⣧⡈⠁⠃⢸⢸⣷⡍⡿⣿⠀⣿⣿⣿", + "⣿⣿⣿⣿⡀⢸⠀⡇⡇⡇⡇⣇⠁⣶⣾⣿⣿⣿⡆⢰⣿⣿⠃⣼⣿⣿⣿⣿⣿⣿⣿⣿⢀⡞⢿⣿⣿⣿⣏⠛⠟⠻⠟⠛⠛⢿⣼⢠⣼⣿⣿⣿⣧⠀⠆⠘⠌⡏⠇⣇⣿⠆⣿⣿⣿", + "⣿⣿⣿⣿⡇⢸⡆⡇⡇⠁⡡⢸⠁⣹⣿⣿⣿⣿⣿⠘⠟⠉⠙⣻⣿⣿⣿⡿⠿⠿⠟⣛⣛⣛⣛⣛⣛⣛⣛⣛⠷⠼⠿⣶⣶⣀⠉⢰⣿⣿⣿⣿⡟⠀⡼⠠⠠⠠⡠⡸⢿⢠⣿⣿⣿", + "⣿⣿⣿⣿⣷⠘⣧⢹⠘⠀⣁⣡⡁⣿⣿⣿⣿⣿⣿⡆⢴⣶⠻⠟⡋⢩⣵⣶⣶⣿⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣿⣷⣄⣬⠙⣿⠂⢍⢿⣿⣿⣿⠏⣸⡷⠠⢁⠁⠁⢠⠁⣾⣿⣿⣿", + "⣿⣿⣿⣿⣿⠀⢿⢠⠡⠁⡹⢠⡄⢸⣿⣿⣿⣿⣿⣏⠘⣿⡆⢼⣿⣿⣿⡿⠟⠉⠉⠀⠀⠀⠀⠀⠀⠀⠉⠉⠙⠿⠿⡿⢠⣿⢠⣆⠼⠛⠉⣡⣈⠓⢰⣠⠋⠔⣱⢋⣼⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣧⠘⢄⢢⠁⡑⢦⡙⢸⣿⣿⣿⣿⡿⣿⡁⢹⣷⡘⠿⠟⠁⠀⢠⣂⣴⣿⣿⣶⣶⣾⣿⣦⣄⣀⠀⠀⠉⣡⣿⠃⠞⣁⣀⣴⣶⣎⠛⣷⣄⢱⣠⡾⢋⣾⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣶⡈⢾⣦⣹⣾⣷⡈⠻⣿⣿⣿⣿⣿⠟⡂⢿⣿⣆⡀⢰⡾⠿⠿⠿⣛⣛⣛⣛⣛⣛⣛⡻⠿⡧⢀⡴⠿⠿⠈⣾⣿⣿⣿⣿⣿⢣⢸⡏⠈⢋⣴⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠿⣿⣏⡱⠄⠻⣿⣷⢿⠽⣷⠙⠆⢻⣿⣷⣆⣀⠲⠿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣃⣴⡞⢰⣶⠦⢐⣠⣿⣿⣿⣿⠏⠀⠈⣴⠀⣤⠙⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣬⡑⠿⡿⢷⣌⠻⣍⣶⠞⠗⡆⠀⠉⠻⠿⢿⣷⣶⣦⣭⣭⣭⣭⣭⣶⣶⣾⣟⠉⠰⢻⣿⣷⣿⣿⣿⡿⢿⣿⡂⠆⠀⢿⣦⠹⣃⣉⢿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡮⠭⠉⠗⣈⡑⠀⠈⠁⠄⢀⣠⡀⡐⠈⠉⠙⠛⠿⠿⠿⠟⠛⡉⠉⡀⠂⠀⠘⠿⠿⠿⢛⣥⣶⣦⣉⣙⢳⡿⢆⣹⠃⣿⣿⡄⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣋⣩⣴⣾⣶⣿⣿⣿⣾⣿⣿⣦⣀⡈⠀⣿⣷⣄⠀⠀⠀⢀⡆⠀⠀⡆⣰⢱⡠⢀⣉⣁⣤⣾⣿⣿⣿⣿⣿⣿⣮⡳⠿⣀⣀⠿⢛⣡⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⣁⣊⣙⣋⣍⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣙⠻⣿⣷⣤⣀⣿⠃⡄⡠⡇⠃⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣵⣦⣩⣶⣦⡶⠞⢉⠈⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⠟⣡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣮⣙⠻⣿⣿⡆⢓⣥⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⠈⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⠟⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠓⣨⣥⣶⣿⣿⣿⣿⡿⠋⠀⢠⣿⣿⣿⣿⣿⡿⢿⡿⢿⠿⣿⣿⣿⣿⣿⣿⣿⣷⠸⣿⣿⣿", + "⣿⣿⣿⣿⠃⣼⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠛⠋⠛⠛⠿⡏⠳⢿⣦⢇⢹⠇⣸⣿⣿⣿⣿⠟⢛⣛⠁⠀⣴⣶⣿⣿⣿⠟⣡⠂⢀⣡⣞⡻⠿⣿⣿⣿⣿⣿⣩⠛⣿⠀⣿⣿⣿", + "⣿⣿⣿⣿⡆⣿⡙⢿⡙⣟⠋⠃⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠃⠊⠦⣠⣾⣿⣿⡟⠀⢀⣿⣿⣿⣿⠟⠫⠍⠛⠁⠒⠀⠀⠊⠥⠴⠅⠒⠁⢤⡴⢟⠋⣁⠙⠥⠔⢰⣿⣿⣿", + "⣿⣿⣿⣿⣇⠻⡙⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣷⣶⣿⡟⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠛⠋⡀⣼⣿⣿⣿", + "⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠋⠿⡘⣿⠸⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⢿⣿⣿", + "⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⢠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣄⣀⠀⠀⠀⣀⣠⣤⣄⡀⠀⣠⣤⣤⣴⣦⣤⣶⣶⣶⣤⣤⣤⣤⣤⣤⡄⢠⣴⡦⠀⠀⠀⠀⠀⠀⠈⢻⣿", + "⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠘⣿⣿⣇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣿⣿⣿⣿⣿⣿⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢣⣾⡟⣀⣠⣤⣤⣤⣀⡀⠀⠈⢿", + "⣿⣿⡏⠀⠀⣠⣴⣾⣿⣿⣷⣌⢻⣿⢸⡏⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠘⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣸⡟⣰⣿⣿⣿⣿⣿⣿⣿⣿⣶⡌", + "⣿⡏⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⡎⢿⣾⡇⣼⣿⣿⡿⠿⠟⠛⠛⠛⠋⠉⠙⠛⠀⠛⠛⠛⠛⠛⠛⠸⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠻⠿⣿⠇⣿⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧", + "⡟⢱⣿⡿⠿⠿⠿⠿⠿⠿⣿⣿⣷⠸⠈⠐⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠉⠈⠛⠻⢿⣿⣿⣿⡿⠿⠿⠿", +} + +M.zoro = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣿⣿⣿⣿⣿⣿⡿⠟⠉⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠈⠼⢛⣩⣀⣨⣥⣶⣏⣀⠹⣿⣿⣿⡿⠟⢉⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢸⣿⠟⠁⠼⣋⣴⣾⣾⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣤⣬⣀⠀⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⣡⡆⠘⣡⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣖⣀⢠⣍⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠸⡟⠀⣠⣿⣯⣾⣿⣿⣿⣿⣿⣿⡿⡿⢋⣴⣿⡿⢿⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣤⡈⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢰⣧⢀⣾⣿⣿⣿⣿⣿⣿⣿⣶⢐⠏⡜⢰⠟⣿⠟⡴⢋⣴⡿⢛⣽⣿⣿⣿⣿⣿⠛⣩⣿⣿⣿⣿⣿⣏⠐⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⢂⣿⣿⣿⣿⢿⡿⢸⣿⡿⢿⡟⡋⡿⢿⡿⢡⠆⣯⣼⣱⡟⠋⢀⣥⡾⠿⢿⣿⡟⣋⡾⢋⣽⣿⣿⣿⣿⣿⣧⡈⠻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⣾⣿⣿⣿⣿⡎⣰⡼⣿⣿⡌⢰⡇⠁⢸⠀⠛⢐⡉⣹⣿⡏⢀⡿⢁⠀⣴⣿⣿⠋⡩⢐⣽⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⢸⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⣘⠈⣻⡟⣿⡟⢹⡿⢁⠙⠀⠿⣿⠇⠘⢡⠇⡄⢂⣾⠟⠸⢟⣫⡖⢈⡴⢃⣈⣿⡷⢐⣣⠖⣘⡽⣛⣿⣿⣛⠟⣛⣻⣿⣿⣿⠦⠙⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⣿⢡⠸⢣⠸⡇⣾⠀⣷⢠⡏⣤⢴⠟⢛⣡⣌⡉⠈⠛⠦⡉⣬⣭⣴⣶⣶⣤⣭⣭⣙⣛⠻⢟⣻⣯⣿⠟⢛⠟⣋⣿⣿⡦⠄⢛⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠘⣿⠿⣇⠃⠸⣦⣇⠹⡦⠥⠿⠃⣈⡂⠨⣄⠙⣿⣿⣷⣮⣥⣦⡈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡘⢯⡭⢀⣼⠟⣚⣿⡿⣿⣄⠀⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢉⡛⠀⢿⣄⡀⢀⡑⠆⣉⣴⣶⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⡇⠀⣤⣶⠾⠿⢟⣑⣊⠽⣿⣷⣌⠻⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⡌⣿⣿⣧⠹⡇⢠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡙⢿⣿⣿⣿⠘⣷⡐⠾⣭⣍⣉⡴⢊⣭⣄⠲⢾⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠠⣸⣿⡇⠣⡁⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣯⢻⣿⣿⣿⣿⣿⣿⡿⢿⣿⡈⠻⣿⣿⡇⢻⠭⢅⠨⢛⣛⣷⣿⣿⡇⢸⣿⣿⣿⠿⠋", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡌⢿⡗⢤⣤⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢸⢸⣿⣿⡿⣿⣿⣿⣷⡜⣿⣷⣤⣽⣿⡇⢸⣪⡥⢚⣿⣾⣿⡿⢟⠁⠈⠛⠛⠁⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡍⢁⣤⣮⡀⢬⠘⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠘⣿⣿⣷⡌⣿⣿⣿⣷⠘⣿⣿⣿⣿⣷⣦⣍⠲⣿⣿⣿⡏⣴⢀⠉⢰⣦⡀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠻⣿⣿⣦⡀⢿⣇⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⢠⣿⣿⣿⡇⠈⣿⣿⣿⣇⠙⣛⣛⠻⢿⣿⣿⣧⠹⡿⠋⣸⢡⢸⡆⣾⣿⣿⣆⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡁⢈⣒⠲⠾⠈⠻⢸⠿⢛⣉⡙⢿⣿⣿⣿⣿⣿⣯⢻⣿⠞⣼⣿⣿⣿⣷⣾⣿⣿⡟⣡⠈⠿⠿⠿⢿⣿⣿⠿⠀⠴⠀⠇⠘⣾⡇⢿⣿⣿⣿⣦⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡦⠙⣥⡀⣿⣧⡴⠎⣁⡙⠿⣿⣿⣿⣿⣿⣿⣿⡈⣯⢰⠘⣿⡿⠿⠟⠛⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡇⡒⠀⠀⡄⡿⠁⢚⣿⣿⣿⣿⡇", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⢸⣧⢹⣯⣴⡿⠿⠿⠶⠬⠍⠙⠛⠛⠛⠿⠇⣿⠨⡑⠈⠀⠀⠀⢀⡤⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡇⠇⢰⡆⢰⠃⠀⢰⣿⣿⣿⣿⢃", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⡙⠌⠃⠀⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡇⠁⠀⠀⠁⠀⠀⢺⣿⣿⣿⡿⣸", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠘⠆⠀⠀⠀⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⠸⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⠁⠀⠀⠀⠀⠐⢦⡍⣹⣿⣿⣇⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢠⠢⡄⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⡀⢿⣿⣿⣿⣿⣷⣦⣤⡤⠄⢀⣂⣀⣙⡛⠿⣿⣿⣿⡀⠀⠀⢠⡘⣦⡱⣶⣿⣿⡟⣸⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣧⡄⠀⠈⢶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⡇⢸⣿⡿⢿⣿⡿⢛⣩⣶⣿⣿⣿⣿⣿⣿⣶⣌⢻⣿⡇⠀⠀⡆⠱⡌⣣⣿⣿⣿⣇⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⢸⣿⣿⡌⠂⠀⢻⣿⡿⢛⣫⣭⣭⣭⣭⣿⣓⣌⣛⣥⣬⣵⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡘⠁⡄⠀⡇⡆⠀⣽⣿⣿⣿⣍⠻⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠀⠀⠀⠀⢸⣿⣿⣄⣓⠀⠀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⡿⡿⠟⣿⡿⢿⣿⣿⣿⣿⣶⣤⣀⣁⣁⠸⢛⣿⣿⣿⠿⢓⣸", + "⣿⣿⣿⣿⣿⣿⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡗⠄⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠉⠉⠉⠉⠻⠙⢷⢀⢌⠂⠻⣌⠂⠢⠙⢟⡻⣿⣿⣿⠿⠋⠀⣾⣿⣿⣷⣦⡍⠹", + "⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⠀⣼⣿⣿⣿⣿⣿⣿⡿⣿⡿⠁⠠⠤⠶⣒⣋⣥⣶⠷⢀⣤⠤⣌⣀⣉⠓⠀⠀⠀⠀⠀⡄⠀⠀⠈⢼⣿⣿⡿⠟⠋⠀⠀", + "⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⠏⣴⣿⣿⠋⢹⣏⠇⠻⠇⠟⣁⡐⠒⠛⠛⢛⣋⣩⣤⠶⠛⣡⣴⣿⣿⣿⠏⡀⡀⢸⠀⠀⠁⠀⠀⢐⣿⠟⠁⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⠛⢛⣋⣥⠞⡫⢐⠁⠂⡸⠃⠀⠂⠠⣾⣿⣍⠛⠛⣛⣛⣭⣭⣴⣶⣾⣿⣿⣿⡿⠃⠀⠃⠇⠈⠀⢀⠀⠰⢀⣾⡇⠀⠀⠀⠀⢀⣬⣶", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷⣦⣬⣀⣈⠀⠕⢚⣈⠀⢴⡾⠁⣦⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠟⠛⠉⠀⢠⠀⠀⠀⠀⢰⢸⠀⠀⣸⣿⣿⣶⣤⠀⢠⣾⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⢠⣿⣷⣄⠉⠉⢉⣉⡉⠁⠀⠀⠀⠀⢰⠀⠀⡄⠘⠀⠀⣦⠠⡈⠀⠀⣨⣿⣿⣿⡿⣡⣶⣶⣿⣿⡟", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡧⠀⠨⢿⣿⣗⠀⠀⣼⣿⣿⣿⣷⣦⣤⣠⡌⠀⣰⣠⣤⣺⣰⣿⣵⠃⠀⢨⣿⣿⣿⡿⢡⣿⣿⣿⣿⣿⣧", +} + +M.robin = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢛⣫⣭⣭⣭⣛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣋⣵⣾⣿⣿⡟⣰⣿⣿⣿⣶⣍⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⣵⣿⣿⣿⣿⣿⣿⢱⣿⣿⣿⣿⣿⣿⣿⣦⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⣿⣿⣿⣿⣿⣿⣿⠇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢣⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠀⣈⡛⠿⣿⣿⣿⣿⣿⡟⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⢹⣿⣿⣿⡿⠛⠿⠿⢿⡿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⡇⠀⠋⣐⣀⣍⡋⠔⣂⡙⢿⣿⢡⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⢿⣿⣿⢡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠆⢛⣫⡥⠖⡸⢈⣒⡒⠂⠃⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⠀⡷⢸⣿⣿⣿⣿⣶⣬⣙⢠⠥⢘⠻⢿⣿⣿⠿⠿⠿⣛⣛⣛⣛⣒⣒⣒⣒⣒⠢⠭⠭⢍⣉⣙⡛⠛⠛⠿⠿⠟⣋⡅⠙⣨⣴⣶⣷⣶⣿⣿⣷⣶⡌⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⠐⠄⣿⣿⣿⣿⣿⣿⣿⠿⠦⠌⠳⣌⠲⠦⣄⡈⠽⣿⣿⣿⣝⣛⣛⣛⣿⣭⣭⣭⣵⣶⣶⠶⠒⡊⠉⢀⡅⡇⠈⣁⣠⣤⣥⣬⣍⡛⣿⣿⣿⣿⣿⡀⠈⢀⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⡆⢧⢸⣿⣿⣿⣿⡟⣡⣾⣿⣷⡶⠆⠀⠱⣬⡛⠿⢶⣶⣭⣭⣙⣻⣿⠿⠿⣛⣛⣭⣥⣶⡾⢟⢰⡀⠉⠀⠀⠀⠐⢽⣿⣿⣿⣿⣷⠘⣿⣿⣿⣿⡇⡆⣾⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣧⢀⠘⣿⣿⣿⣿⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀⠁⠎⢤⣍⡛⠟⠻⣿⣿⣿⡿⣿⣿⠿⡃⡖⠐⠉⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⣿⠇⣿⣿⣿⡟⢰⠇⢿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⡆⠃⢻⣿⣿⡏⢸⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠇⠲⠦⠤⢠⡆⡴⠖⠛⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⢠⣿⣿⣿⡧⢐⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣷⡐⡌⣿⣿⣷⢸⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⡏⣼⣿⣿⣿⢃⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠂⠘⣿⣿⠈⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡿⢠⣿⣿⣿⠇⡀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠣⠹⣿⡆⢿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠇⣾⣿⣿⡟⠸⢡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⢃⠹⣷⠸⡏⠀⠀⠀⠀⠀⠀⠀⠀⡄⠐⠂⠀⠀⡀⠀⠀⠀⣀⢀⠀⠀⠀⡀⠐⠂⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢰⣿⣿⡟⡐⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠁⠹⡆⢇⠀⠀⠀⠀⠀⠀⠀⣄⣈⠀⠒⠀⣈⣡⣤⣾⡇⣿⢸⣿⣶⣤⣁⡀⠀⠐⠀⣀⣠⠀⠀⠀⠀⠀⠀⢀⣿⣿⠟⠈⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⠹⠘⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⢸⡿⠃⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠁⠀⠀⡀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣠⡆⢠⠀⠀⠀⠎⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⢰⣃⠀⢰⣀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⡗⠄⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⣿⡇⢸⡾⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣿⠀⡇⣿⠀⢸⣿⣿⣿⣿⣿⣿⡿⠿⠿⠶⠿⠿⠿⢿⣿⣿⣿⣿⣿⡿⠐⠋⠀⢹⠃⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠻⠀⠀⠋⠀⠀⠹⣿⣿⣿⣿⣷⣶⠿⠿⠿⠟⢻⣿⣶⣿⣿⣿⣿⠟⠁⠀⠀⠀⠈⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣷⣤⣤⣴⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⣠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⠿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠀⢀⠌⣼⠃⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⢀⣴⡏⢸⠿⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⡿⠃⢀⣠⣿⡟⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⡿⠟⠁⣴⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⡿⠋⡠⢠⣼⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣶⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣋⣡⣴⣿⢁⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⠏⠀⣰⣷⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⠇⣾⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣾⣿⣿⣿⣿⣿⠃⠀⣰⣿⡿⠀⠀⠀⠀⠀⠀⠀⢀⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠀⠀⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣟⣘⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⢀⢠⢠⣶⠆⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⠇⠀⣰⣿⣿⠇⠀⠀⠀⠀⠀⠀⠰⠿⢛⡀⠀⠀⠀⠀⠀⠀⠀⠈⣰⣶⣷⣶⣶⣦⣭⣙⠿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⠟⣫⣥⡶⠀⠀⣾⣿⣿⣿⠈⢸⡿⠀⠀⠀⠀⠀⢨⣍⣙⣛⡛⠿⢿⠏⠀⢰⣿⣿⣿⠀⠀⠀⠀⠀⠀⢠⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣷⣌⠻⣿⣿⣿⣿", + "⣿⣿⣿⣿⠟⣴⣿⣿⣿⠇⠀⣼⣿⣿⣿⡿⡀⡿⠁⠇⠀⠀⢸⠀⢸⣿⣿⣿⣿⣿⡆⠀⠀⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⣾⠟⠻⠿⠇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡙⣿⣿⣿", +} + +M.chopper = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⡿⢛⣩⣭⣉⠻⠿⣿⣿⣿⣿⣿⣿⣿⠿⠛⣉⠉⠁⠀⠀⢀⣤⣤⠀⠀⠀⠀⠀⠀⠉⠙⠻⢿⣿⣿⣿⡟⣡⣶⣿⣿⣆⠙⡛⢿⣿⣿⣿⣿⣿⣿", + "⣿⣿⡟⣰⣿⣿⣿⡟⣸⣦⢸⣿⣿⣿⠿⠋⠀⠠⠾⣛⣀⣠⣤⣀⣬⣉⣉⡀⠀⠀⣴⣦⡀⠀⠀⠀⠀⠈⠻⠏⣼⣿⣿⣿⠟⣥⣾⣿⠎⡿⠿⣿⣿⣿⣿", + "⣿⡟⢰⣿⣿⣿⠏⣴⡿⠋⣼⡿⠋⣡⠆⢀⣤⣾⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⣿⣶⣌⡉⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⢁⣾⣿⣿⢏⡜⢰⣷⡈⢻⣿⣿", + "⡟⢡⣿⣿⡿⠋⣼⡏⢂⣼⠟⠁⠀⣡⣶⣿⡿⢋⣩⣅⡀⠀⢀⣤⣶⣶⣦⡀⠈⠛⢿⣿⣦⠀⣠⣶⣦⠀⣸⣿⣿⡟⢱⣿⣿⡿⢣⣾⡇⢸⣿⡇⢢⠹⣿", + "⠇⣾⣿⡟⠁⣼⠞⠂⡾⠃⣠⠄⠰⠛⠉⡅⢄⠈⠉⣛⠛⠿⣿⣿⣿⠛⠉⠀⠀⠀⠀⠙⣿⣧⠈⠉⠁⠀⣿⣿⣿⠁⣿⣿⡿⢡⣿⣿⠇⣾⣿⡇⣼⢠⠘", + "⠀⣿⣿⠁⢰⠿⠀⣸⠇⠘⠋⡀⠀⠁⠀⠀⠀⠀⠀⠀⠈⠁⠒⠬⢉⠻⠶⡄⠀⠀⠀⠀⢸⣿⣧⠀⠀⠀⢿⣿⣿⣠⣿⣿⢃⣿⣿⣿⢸⣿⣿⠇⣿⢳⡆", + "⣇⢻⣿⠂⡀⠀⠁⠛⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⣄⠀⠀⠀⠀⣼⣿⣿⠀⢾⡇⢸⡿⣿⣿⣿⣿⠀⢿⡿⢃⣿⣿⡏⣸⡟⣸⠀", + "⣿⡌⢿⣶⣷⣈⣐⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠁⠠⠀⠺⣿⣿⡿⠀⠀⠀⠸⡿⢿⣿⣿⣿⣄⣠⣴⣿⣿⠟⣴⡟⣰⡟⢰", + "⣿⣷⣌⢻⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠂⠈⠛⢡⣾⣦⠀⠀⠩⠍⢚⣿⣿⣿⣿⣿⣿⣥⣾⠏⣴⡿⢡⣿", + "⣿⣿⣿⣧⡙⠻⠐⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⠆⠀⣴⣶⣶⡀⠀⠉⠉⠀⠀⠀⠈⢐⣄⣻⣿⣿⣿⣿⣿⣡⣾⡟⣡⣿⣿", + "⣿⣿⣿⣿⣿⣶⡈⠀⠀⠀⠀⠀⢀⣼⣿⡿⠋⣉⣉⣹⠟⠉⠙⠻⣿⣿⣿⢀⣠⣄⡈⠹⣿⣷⠀⠀⠀⣰⢂⠢⠠⠿⠿⠉⠃⢋⠛⠋⢹⠿⢋⣴⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⡦⠄⠀⢤⣤⡈⠻⠟⢀⣾⣿⣿⣿⣷⠠⣶⣿⣿⠿⣿⣿⣿⡿⠿⠄⣈⣡⣧⠀⠀⢻⡘⢿⣦⠑⠈⠀⠀⠀⠈⢠⣤⣾⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⣸⣿⣷⠘⠟⠛⢛⣿⣷⣌⠛⠁⠈⠛⢡⣾⣿⣿⣿⣥⣀⢀⡀⠉⣩⡀⠀⠀⣤⣤⣤⣀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⢉⠀⠀⠀⢠⣿⣿⣿⣇⡘⢰⣿⣿⣿⣿⡇⢠⣈⠁⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠹⣿⣿⣿⣿⡄⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⠀⠈⠗⣀⡘⠋⠋⠉⣉⣙⠒⢤⡙⠻⣿⡇⣾⣿⠂⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠈⢉⠹⠿⠃⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣦⡀⢰⣿⣇⣀⣽⠈⢿⡿⢿⣶⣌⡓⢶⣄⣙⠻⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠋⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣄⣙⣛⣫⡄⢧⠀⠀⠫⠉⠿⠿⠶⠌⠻⢿⣷⣤⡍⠛⠻⠿⠟⠫⢙⣀⠠⠤⠄⣀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡷⠘⣧⡀⠀⣤⠶⠤⠥⠄⣥⠄⠈⠿⠆⠤⢴⣦⣤⡀⠄⡀⠀⠀⠀⣿⡀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠘⠿⢂⠀⠀⢀⠀⠬⠅⠂⡀⢀⡀⠐⢒⡂⠉⠛⢶⣌⠢⡀⠀⢻⡧⠀⠀⠘⣛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⢀⣾⡆⠀⠀⠄⣿⣇⠀⣀⣸⣿⣶⠍⠠⢀⠀⠃⠈⢦⡙⢷⣤⣀⣉⡐⠷⠀⢀⡙⣇⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣅⠀⢠⡿⠁⠀⣰⡶⠀⢀⠻⣷⣄⡙⢿⣿⠀⠶⠾⢰⣄⠀⠀⠁⣼⣿⡿⠋⠁⢀⠀⠿⠇⣸⡄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣠⣾⡿⠁⠈⠀⠑⣂⣙⠻⠶⣬⣑⣀⠠⠿⠟⣛⡋⠀⠙⠋⠀⠀⡀⠐⢸⣛⣩⣤⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⣰⣿⣿⠃⠀⠀⠀⢰⣿⣿⣿⣶⠖⠈⠭⠍⣉⡙⠋⢹⣴⣢⠀⠈⠘⠁⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠻⣿⡟⠀⠀⠀⠀⢠⣽⣿⣿⡟⠀⠀⠀⠉⣼⣿⠗⠀⢿⣿⠀⡄⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠰⣿⣿⡄⠀⠀⠀⠈⠛⠛⠛⠀⠀⠀⠀⠀⣿⣿⠃⠰⠀⠉⠀⠔⠲⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + +M.sanji = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⣴⡿⢋⣶⣿⣿⣿⠟⣡⣾⠟⣩⣴⣾⣿⣿⠟⣡⣾⣿⣿⡇⠈⠉⠙⣿⣿⠻⣦⡙⣿⣿⣦⡹⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⣴⠟⣩⣴⣿⡿⣩⠟⣵⡿⢋⣴⣾⣿⣿⡿⠛⢁⣾⣿⠟⣹⣿⠇⠠⢶⣧⠘⢿⣷⡘⣷⡘⣿⣿⣷⡜⢿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠖⣋⢁⣼⣿⣿⠋⣼⣿⣿⡟⣡⣿⣿⣿⣿⢟⡡⢠⣿⡿⢁⣾⢹⣿⠀⢰⣦⡙⡁⠈⢿⣷⠹⣷⡸⣏⢿⣿⣎⢿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢣⣾⣿⣿⢃⣾⣿⣿⠏⣰⣿⣿⣿⡿⢃⡾⢣⣿⡟⢠⣿⡿⣸⡿⠀⣾⣿⣿⡄⠀⠈⢻⣧⢻⣧⢹⣆⢿⣿⡆⢿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢡⣿⠟⣽⠃⣾⣿⣿⡟⣸⣿⣿⣿⣿⢡⣿⢣⣾⠋⢠⣿⣿⠃⣿⠃⢰⣿⣿⣿⣿⡄⠀⢀⣿⡎⢿⣇⢻⡌⣿⣿⡘⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⣾⡟⣼⡏⣼⣿⣿⡟⣰⣿⣿⣿⣿⢁⣿⡏⣼⡿⢠⣿⣿⡿⢰⡏⠀⣾⣿⣿⣿⣿⣿⡄⠂⢹⣷⠸⣿⡌⣧⢸⣿⣇⢻⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⡏⣼⣿⢣⣿⢣⣿⣿⡟⢰⣿⣿⠇⣾⠇⣿⣿⢠⡿⢃⣿⣿⣿⠇⣿⠃⣰⣿⣿⣿⣿⣿⣿⣿⡌⠈⣿⡆⣿⣧⢻⡎⣿⣿⣆⢿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⢰⣿⡏⢸⣿⢸⣿⡟⠀⣾⣿⡏⣸⡟⣸⣿⡟⣸⠇⣼⣿⣿⡟⢸⠏⢠⣿⣿⠿⠿⣿⣿⣿⣿⣷⠀⢹⡇⢹⣿⠘⡇⢻⣿⣿⠘⢿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⡇⣾⣿⡇⣿⣿⢸⣿⠁⢠⣿⣿⢰⣿⢡⣿⣿⡇⡿⢸⣿⣿⣿⢁⡟⠀⡼⢋⣴⣿⣧⡙⣿⣿⣿⣿⣇⠈⡇⡸⣿⡆⣧⠈⣿⣿⠀⣆⢿⡇⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⠀⣿⣿⢸⣿⣿⢸⡟⠄⣼⣿⡏⣼⡇⣾⣿⣿⡇⠀⣿⣿⣿⠏⣾⠓⣰⡇⣿⡥⠶⠞⣠⣿⣿⣿⡿⢛⠀⡟⡄⣿⡇⣿⠀⣿⣿⢰⣿⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⠐⣿⣿⢸⣿⣿⢸⡅⢰⣿⣿⡇⣿⢇⣿⣿⣿⠃⠀⣿⣿⡏⣰⠁⢠⣿⣧⡙⢷⣶⣾⡿⠟⠋⣡⣶⣿⡆⠃⣧⣸⡇⠋⠀⢻⣿⢸⡿⢸⡗⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⡇⢿⣿⡘⣿⡟⡈⠁⡏⣿⡿⢸⣿⢸⣿⣿⢻⡄⢸⣿⡟⣰⡟⢁⣾⣿⣿⠿⠂⠀⡀⢀⣠⣬⣭⣙⠻⡇⢀⢸⣿⠇⢀⣽⢸⣿⢸⡇⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⡜⢿⡇⢻⠁⠠⢸⠀⣿⡇⢸⡇⢸⣿⡏⣿⡇⣼⡟⢠⡏⠀⢾⣿⣿⣁⣀⣀⣠⣴⠿⠟⠛⠛⠿⣷⠀⣄⢸⢿⢠⣤⡏⢻⡇⢸⠁⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣷⡜⡇⠀⣤⠀⣾⠀⣿⡿⢸⣇⢸⣿⠃⣿⣇⠹⠁⢸⠃⢠⠈⣿⣿⣿⣿⣿⣯⣀⣀⣤⣶⣦⣤⡀⠸⠟⠘⡇⠀⣾⣿⠈⢷⠈⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠁⢰⣿⣁⢿⡆⢿⣧⢸⡄⢸⣿⠀⢻⣿⠀⠀⠨⠀⡿⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠘⢠⠀⣿⣿⢠⡈⠀⠰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⡌⣿⣿⡈⡇⢸⣿⣼⡇⢸⠟⠀⢸⡏⠀⠀⠀⢸⣗⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⢸⠀⠹⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣥⣿⣇⢹⣿⣿⣷⠀⣿⣿⠃⠈⠀⠀⡸⠁⠀⡀⢀⠹⠇⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣾⠀⠈⠀⢀⡌⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠈⢡⠸⣿⡆⠸⠋⢀⡄⠀⠀⠁⣠⣾⣧⣸⣷⣄⡉⢟⣭⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠄⠀⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣰⣿⠀⠟⠀⠀⡀⢸⣿⣦⣴⣾⣿⣿⣿⣿⣿⣿⣽⣦⣉⣣⣵⣤⣖⣴⠶⠟⢛⣿⣿⣿⣿⠃⢀⠐⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣀⣴⣧⠀⠹⣿⣿⣿⣯⣭⡝⠛⠛⣛⣋⣭⣭⣭⣭⣭⣭⣭⣥⣶⣶⣾⣿⣿⣿⡿⠃⣰⡏⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣀⠀⠙⢿⡿⢋⠥⢊⣥⣾⣿⠿⠿⣿⡿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⡟⠁⡀⠹⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⢠⠖⣡⣶⣿⣿⣿⣿⣷⣶⡤⠠⣤⣶⣾⣿⣿⣿⣿⣿⡿⠋⡀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⣠⣶⣌⠻⢿⣿⣿⣿⠟⠿⠃⠀⣿⠟⢻⣿⣿⣿⡿⠋⢠⣾⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠟⠛⠃⢸⣿⣿⣷⣄⠙⠉⠛⠀⠈⠀⠀⠉⠀⠈⠋⠀⠋⣠⣴⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠁⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣦⣤⣀⣀⣀⣀⣀⣀⣤⣤⣤⣾⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⢰⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⡁⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⣾⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⣼⣷⣄⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⡡⢹⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠠⣾⣿⣿⣿⣷⣄⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⠁⣾⣿⡿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⣿⣿⣿⣿⣿⣿⣿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣿⣿⣿⣷⣌⡙⠿⣿⣿⣿⣿⣿⣿⠟⣡⣾⣿⡏⡸⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⣿⣿⣿⠿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣶⣌⣙⠛⢛⣉⣠⣾⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +} + +M.brook = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠒⠀⠺⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠉⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠋⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠋⠻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡿⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡻⣿⣿⣿⣿⣿⣿", + "⣿⣿⡿⠛⢻⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⢿⣿⣿⣿⣿", + "⣿⡟⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿", + "⣿⠷⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⣤⣴⣦⣷⣷⣷⣶⣶⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠨⠛⣿⣿⣿", + "⠟⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠻⣿⣿", + "⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⢿⣿⣿⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠋⢹", + "⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣷⣭⣵⣾⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣾", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⣾⣿⣿⣿⣿⣿⣿⣷⣜⢿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⣫⠵⠛⠉⠉⠛⣿⣿⣷⡿⡻⠿⠿⠿⢶⣝⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣹⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⠃⠀⠀⠀⠀⠀⢸⣿⣯⡞⠀⠀⠀⠀⠀⠹⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⣹", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣇⠀⠀⠀⠀⠀⢠⡿⣿⣿⡁⠀⠀⠀⠀⠀⢀⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⣿", + "⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠖⠦⠤⢶⣶⢏⣴⠏⠻⣷⣤⣤⠤⠀⠠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣻", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⠛⠟⢿⣿⣿⣿⣏⢀⠀⢸⣿⣿⣿⣿⠿⡳⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢦⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⣡⡝⣫⡝⣫⢝⣝⢟⡟⠛⠅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⠇⣿⡇⣿⢸⣿⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿", + "⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠄⣄⠀⠈⠀⠉⠀⠈⠁⡀⢤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿", + "⣶⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣰⢶⣾⣟⢵⡇⣿⠀⠀⠀⠀⠀⠀⢰⡇⣑⢕⡵⣯⣶⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣦⣴⣿⣿", + "⣿⣇⢀⠀⠀⠀⠀⠀⣀⣴⣾⣿⣿⣷⣗⣝⣽⣻⣥⣿⠀⠀⠀⠀⠀⠀⢸⢷⣕⢍⢔⣾⣿⣿⣿⣿⣶⣤⣄⡀⠀⠀⠀⠀⢠⣼⣿⣿⣿⣿", + "⣿⣿⣇⡀⠀⢀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣿⠀⠀⠀⠀⠀⠀⢸⢸⣵⣷⣿⣾⣿⣿⣿⣿⣿⣿⣿⠿⠓⠀⠀⠀⣴⣿⣿⣿⣿⣿", + "⣿⣿⣿⣇⣀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡟⠀⠀⠀⠀⠀⠀⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⣠⣠⣤⣶⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⠀⣴⠀⠀⠀⠉⠻⣿⣿⣿⣿⣿⡟⣸⠃⠀⠀⠀⠀⠀⠀⠸⡾⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣶⡀⠀⠀⠀⠈⠙⢿⣿⣿⢣⣿⠀⣿⣼⣶⣶⢰⣶⠀⣇⢿⣿⣿⣿⠟⠁⠀⠀⢠⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡶⠄⠀⠀⡠⣻⡯⢑⡙⢶⣤⣍⣤⣋⣬⣤⢔⣑⢿⣿⡟⠁⠀⠀⠠⠾⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡿⠟⠛⠉⠀⠀⣠⣴⣿⣿⣿⢻⡜⠿⣦⡙⢷⣦⣶⠖⡱⠟⣋⢼⣿⣿⣶⣄⡀⠀⠀⠀⠀⠉⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠈⠙⢿⣿⡇⠿⠿⣥⡌⠉⠀⠈⠀⠀⠀⣪⢱⣾⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿", + "⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣦⡷⣂⣤⢠⣦⣶⢰⣦⠙⢿⣿⣿⣿⡿⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿", + "⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⢋⣾⣿⣷⣿⢿⣿⡏⣿⣷⢪⡻⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿", + "⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⢟⣼⣟⣿⢸⡟⣿⢹⣿⢡⢻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿", + "⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⢫⣿⡟⣾⡏⢿⣿⣿⢸⣿⡏⣧⢳⡕⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿", + "⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⡿⣳⣿⡟⣼⣿⣧⣿⣿⣿⢸⣿⣧⣿⣿⣿⣎⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠠⠛⠛⣱⣿⡟⣼⣿⣿⣸⣿⣿⣿⢸⣿⣿⢿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡿⠹⠋⠈⠡⢹⣿⣿⡿⣸⣿⣿⠸⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⠁⠁⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + +M.jango = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠈⣿⣿⣶⣌⠻⡶⣬⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣰⣿⣿⣿⣿⣷⠀⢈⠻⣦⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢁⣼⣿⣿⣿⣿⣿⠃⣶⡀⠑⢜⢷⠘⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⣫⣿⣿⣶⣿⣷⣶⣬⣍⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⡿⢛⣵⣿⣿⡟⠁⣼⣿⣿⡀⠈⠂⠃⣿⣿⣿⣿⣿⣿⠟⢃⡴⢋⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣍⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢡⠾⠋⣁⣴⣿⣿⠟⣋⠀⢾⣿⣿⣿⣿⣄⠠⠀⣿⣿⣿⣿⣿⢋⣴⡿⣱⢿⣿⡿⠟⣛⣩⣭⣭⣍⣛⡛⠿⣿⢷⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣡⣴⣾⡿⠿⠟⢀⢇⠟⣻⢆⠙⠿⠿⣿⣿⣧⠀⣿⣿⣿⡿⢁⣾⡟⣰⠙⣮⢋⣴⣿⣿⣿⣿⣿⣿⣿⣿⡦⢡⣾⣿⡄⢻⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣰⣿⠿⠋⠁⠀⠀⢸⣎⣂⣀⠋⣼⡆⠀⠀⠀⠉⠛⢇⠹⣿⣿⢁⣾⡿⣰⣷⣠⣾⣌⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⡇⠘⣿⡈⢿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⠿⠛⣋⣭⣭⣬⣍⡛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢡⠟⠁⠀⠀⠀⠀⠀⠈⠻⣿⡷⠢⠟⠁⠀⠀⠀⠀⠀⠀⠀⠹⠇⣾⣿⢡⡟⢨⠟⣍⢻⡌⢿⣿⣿⣿⣿⣿⣿⣿⡇⣾⢀⣷⡙⠇⣸⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⠟⣉⡴⠞⡛⣛⡛⠛⠛⢻⣉⣑⣮⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⢸⣮⣒⡒⠀⣴⠠⠴⠒⠒⠂⠀⠀⠀⠀⠐⣿⡏⣼⣿⡞⠀⠘⠣⠹⡌⢿⣿⣿⣿⣿⣿⣿⠇⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿", + "⣿⣿⡥⢚⣥⣶⡟⣰⡿⠀⠌⢀⣶⣌⠻⣿⣿⣶⣍⡻⢿⣿⣿⣿⣿⣿⡿⠟⡋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠉⡛⢓⡡⠔⢀⣀⠄⠀⠄⠸⢿⣿⣇⢢⡜⠣⣭⣶⣶⣿⣿⣿⣷⣶⣦⣬⣉⡛⠻⢿⡿⠀⢰⣿⣿⣿⣿⠿⠟⣛⣿⡿⢻⣿", + "⣟⡥⠾⢿⣿⡟⣰⡿⠁⡐⠀⣼⣿⣿⣷⣌⢻⣿⣿⣿⣶⣍⡛⠛⣛⣥⣶⡟⠀⠀⡔⠡⣾⣿⣿⠆⠀⢈⠘⢿⣦⡍⢠⡅⢏⠀⢴⣿⣿⡆⠀⠨⢻⡄⣿⡀⢿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣿⣧⡰⣦⣤⣉⣉⣩⣥⣶⣶⣿⡿⢋⣵⣿⣯", + "⣿⣿⣿⣶⣶⣄⢻⠁⠰⠁⢰⣿⣿⣿⣿⣿⣧⡙⣿⡿⢛⣡⣴⣾⣿⣿⡿⠀⠀⠘⣧⡀⠀⠀⠀⠀⢀⠼⠘⣦⣈⡁⣨⡄⠈⠀⠀⠉⠉⠀⢀⡠⠸⣷⣿⣧⢸⣿⣿⣿⣿⣿⡎⠻⣿⣿⣿⣿⣏⢇⢈⢿⣿⣿⣿⣿⠿⢛⣩⣾⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣦⠠⠃⢠⣿⣿⣿⣿⣿⣿⡿⠓⠀⢾⣿⣿⣿⣿⣿⣿⠇⠀⠀⡐⠟⠀⢻⣶⠂⢹⣇⠀⡄⣝⣻⣂⠀⡀⡄⠀⣸⡟⠙⣿⠁⠑⢨⡉⢩⢻⡈⣿⣿⣿⣿⣿⣿⣦⠸⠛⣛⣛⣛⣂⡁⢐⣛⣋⣭⣐⢿⣿⣿⣿⣿⣿⢿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣦⠘⣾⣿⣿⣿⣿⠟⠋⠀⣠⣶⣎⠻⣿⣿⣿⣿⡿⠀⣠⠞⠁⠀⣐⡚⠛⠀⠈⣡⣼⡇⢬⣥⣖⢩⢧⣿⣦⣄⡁⠀⣈⣠⣴⣿⣿⢸⠀⡁⣿⣿⣿⡿⠟⢉⠄⢸⣿⣿⣿⣿⣿⡇⠀⠙⣿⣿⣿⣷⣬⡛⢿⣿⠇⣾⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣧⠘⣿⡿⠋⠁⢀⣴⣾⣿⣿⣿⠃⠀⢩⣝⣛⠃⡴⠃⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⠀⣦⣭⣍⢰⠂⢻⣿⣿⣿⣿⣿⣿⣿⣿⣏⣈⡀⡇⢻⠟⢉⣤⣾⠉⠀⣸⣿⣿⣿⣿⣿⠀⠀⠀⢹⣿⣿⣿⣿⣿⣶⠆⣼⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢹⠄⣨⣴⣿⣿⣿⣿⡿⠃⡀⢀⣿⣿⣿⠘⠁⢀⣾⣿⠿⠿⢿⣿⣿⣿⠿⢛⣳⣮⢉⡁⣴⡚⠘⠻⠿⣿⣿⠟⠉⠉⠻⣿⣿⢰⠋⢀⣴⣿⣿⠏⡀⠀⣿⣿⣿⣿⣿⣿⠀⠀⢸⢸⣿⣿⣿⣿⣿⠏⣼⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡂⢺⣿⣿⣿⣿⣿⡿⠁⡐⠀⠎⣿⣿⡇⠀⢠⣿⡿⠁⠀⠀⠀⡿⠋⢠⣶⣿⠏⠀⠙⠃⠀⢩⡃⣷⣄⠈⠙⣠⣦⠀⠀⠸⣿⣮⠄⠈⣿⣿⡏⠀⠀⢀⣿⣿⣿⣿⣿⣿⠀⠀⠈⢸⣿⣿⣿⣿⠋⣼⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡘⣿⣿⣿⣿⡿⠃⡰⠁⡼⢰⣿⣿⠁⢠⣿⣿⠁⠀⠀⠛⠊⠀⣰⣿⣿⠏⠀⠀⠀⠀⠀⠀⢿⣿⣿⣦⡀⠀⠉⠀⠀⢠⣿⠃⠀⠀⣿⣿⠇⠐⠀⢸⣿⣿⣯⣿⣿⡿⠀⠀⠀⠘⣿⣿⣿⢃⣾⣿⢟⡻⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠹⣿⣿⣿⠁⢰⠃⢰⠃⣿⣿⣿⠀⢸⣿⢻⣧⣀⡀⣀⣀⣼⣿⣟⣡⣄⠀⠀⠀⠀⠀⢀⣀⣙⣿⣿⣿⣦⣤⣤⣴⠟⠁⠀⡘⠀⡷⣿⠀⡄⠀⢸⣿⣿⣿⣿⣿⡇⠀⢸⠀⣶⣿⠟⢡⣾⣿⡏⢸⡆⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠹⣿⠇⢠⡏⢀⡏⣸⣿⣿⣿⢰⡇⣿⢖⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡦⠀⠀⠀⢴⣿⣿⣿⣿⣿⣿⣿⣿⠿⠃⠀⢀⡸⠁⠀⣿⡏⢀⠀⠀⣾⣿⣿⣿⣿⣿⡇⠀⠘⠀⢉⣡⣴⣿⣿⣿⠇⣸⡇⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣅⠉⠄⡾⠀⣼⢡⣿⣿⣿⡿⢸⣷⠡⠁⢜⣿⣿⣿⣿⣿⣿⣿⣿⣏⣀⣀⡠⠄⣠⣽⣿⣿⣿⣿⣿⠟⠁⠀⠀⣠⡾⠀⠀⠀⣿⠇⠘⡀⠀⣿⡿⠿⢛⣋⣡⣴⣶⣾⣿⣿⠀⠀⠻⣿⣿⠀⣿⠇⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠘⢧⣰⡇⣼⣿⣿⣿⡇⣸⣿⠀⢪⠢⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠀⠀⠀⣠⣾⠏⠀⠀⠀⠀⣿⠀⡄⠀⠂⠁⠀⠀⠀⠀⠈⠿⣿⣿⣿⣿⠀⠩⢦⠙⠏⠈⣿⢀⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠈⠻⣿⣿⣿⣿⣿⡇⣿⡥⠂⠁⡜⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⠀⠀⢀⣠⣾⠟⠁⠀⠀⠀⠀⠀⣇⡤⠃⠀⠀⠀⠀⠀⠀⠀⠀⢈⢸⣿⣿⡇⠀⡀⢣⠱⣄⣤⡇⣸⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠁⠀⠀⠈⠙⠿⣿⣿⡇⣿⣧⡀⣴⡄⠾⢛⣛⣫⣭⣭⠙⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣦⣤⣭⣋⣁⠀⠀⠀⠀⠀⠀⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠘⢿⣿⢀⢡⣿⠈⣷⣿⣿⢡⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠉⠀⠀⠀⠀⠀⠀⠀⠈⠻⡇⣿⡿⠋⠁⠲⠿⠛⢛⠩⠍⣁⡤⠤⠖⠒⠒⠒⠒⣀⣀⣐⣒⣈⠉⠭⣭⡙⠛⠁⣠⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠄⣾⠟⣰⣿⣿⠃⣾⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⠁⠻⠂⠀⡀⠦⠴⠞⣩⣥⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣬⣀⠄⠈⠀⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣣⣾⣿⣿⠏⣼⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣦⡄⠀⠀⠀⠀⠀⠀⠀⠐⠿⠁⢠⣄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⢈⡆⠀⠐⠖⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⢀⣿⣿⣿⠋⣼⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡹⣧⣕⠦⣍⣛⠿⠿⠿⠿⠿⠿⠿⠛⠯⠭⠿⣟⣛⡩⠅⠢⢂⣴⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣫⣴⣿⣿⡟⣁⣾⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣢⣴⣤⣤⠀⠀⠀⠀⠀⠀⠀⠈⢮⡛⢿⣶⣬⣭⣛⣛⣛⡻⠿⠿⠿⠿⠛⠛⠋⠭⠴⠾⠆⡪⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⠟⢁⣴⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢟⣫⣥⣬⡲⠦⢝⢿⣿⣿⣤⣤⠀⠀⠀⠀⠀⠀⠀⠉⠓⠎⠉⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠂⠀⠔⠚⢛⣛⣥⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + +M.jimbei = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠹⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢉⡄⢀⢀⠀⠆⠀⠀⠀⠀⢘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠃⠐⢶⣥⣤⣤⣴⠚⠅⢀⠀⡐⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠠⢰⠀⡐⠻⠿⡎⢉⠄⡲⠿⠐⣘⢇⠘⣿⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠠⢀⢾⣷⣄⠘⠛⣈⣰⡶⣠⢹⣶⣆⢠⠀⠀⠉⠉⠁⠐⠄⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠉⠀⠬⢌⣼⠐⡝⢟⣫⣭⣭⣟⣑⠣⢿⣿⣿⣆⢆⢃⠄⡀⠀⠀⠀⠀⠈⠻⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠋⠉⠀⠀⢁⣴⣾⡟⣨⣾⣿⣷⠾⣶⣿⣿⣿⣶⣍⣻⣍⢳⣶⣿⠿⠓⣀⣄⠀⠀⠀⠀⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢉⣤⠲⠄⢀⡀⢶⣌⠻⣿⣿⣿⣿⡏⠁⠀⠀⠉⢻⣿⣿⣿⣿⣿⡜⢛⣥⡶⠟⣩⣤⡶⠶⢀⡀⠀⠀⠙⣉⣬⡙⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢠⠟⣀⢆⠀⠀⠻⣦⣝⢻⣿⣿⣿⣿⣀⠀⠀⣀⠀⣴⣿⣿⣿⣿⣿⣿⣮⢫⣶⣿⢛⠡⠐⠊⠁⢀⡤⢖⣫⣭⣶⣮⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢁⠊⢌⣉⣑⡕⢄⠐⢾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠛⠉⠀⠀⣀⠴⠚⢁⣊⡭⠽⣒⣒⣶⣖⣀⡈⠻⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠋⡡⢐⣭⣶⣿⣿⣿⡿⠃⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⢀⢔⣪⣥⣶⣟⣋⣁⠶⢿⣿⣿⣿⣿⣿⣿⠀⢿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⠿⠛⠂⠰⠿⢿⣛⣛⣫⠭⡒⠈⣂⡠⡀⠀⠀⠙⢿⡿⣩⡆⣾⣿⡇⡎⡿⠿⠿⠛⠁⠀⠀⠀⠀⠀⡣⢉⠭⣍⣉⡉⠹⢿⣿⣕⠢⢍⣛⠿⢿⣿⠀⢾⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⠁⠖⣚⡭⠭⠭⣉⠉⠥⣶⣿⡇⠀⠈⠻⣮⡂⠀⠀⠀⠑⠽⣓⡪⠭⢞⡓⠚⠁⠀⠀⠀⢀⣀⣢⣴⡾⠊⠀⠙⠪⡙⢿⣿⣶⣬⣙⢷⠰⣮⣭⣥⣢⣥⡈⠻⣿⣿⣿⣿", + "⣿⣿⣿⣿⡿⠀⡙⠏⠐⢉⣡⠤⢒⣢⣤⣭⣤⣤⣤⣤⣬⣭⣤⣤⣶⠄⢤⣤⣬⣿⡄⠤⣤⣀⠀⡠⣂⣽⡿⠋⠁⢀⣠⡶⣋⣵⣜⢶⣌⢙⠻⢿⣿⣷⡘⢿⣿⣿⣿⣿⣆⠘⣿⣿⣿", + "⣿⣿⣿⠋⠀⢀⡶⢐⠀⢜⣥⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⡌⡙⠿⠿⢋⣴⣌⠻⣳⣬⡍⡁⠀⠠⣒⣛⠩⣾⣿⣿⣿⡄⢻⣷⣌⠲⣭⡛⢄⢻⣿⣿⣿⣿⣿⣆⠸⣿⣿", + "⣿⡟⠁⢀⣾⡋⣼⢡⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢱⠁⠸⠿⠿⢿⠱⠲⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣔⢌⠙⠟⣡⣧⠛⣿⣷⡈⢿⣶⣼⣿⣿⣿⣿⣿⣿⡆⢹⣿", + "⡏⠀⣰⣿⣿⢸⡇⠸⠿⠋⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⡌⢟⣛⣱⣿⣤⢠⢻⣿⣿⣿⣧⢻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠻⣮⣿⣿⣧⠘⣿⣿⡰⡙⢿⣿⣿⣿⣿⣿⣿⣿⠀⣿", + "⡇⢇⢿⣿⣿⡘⢛⡄⣿⣿⡆⠃⢹⣻⣿⣿⣿⣿⣿⡿⣸⣿⣿⣿⣿⣿⢻⢸⣜⣿⣿⣿⣛⢸⡜⣿⣿⣿⣿⣿⣿⣿⣿⣿⢈⣣⡹⣿⣿⣿⠎⡨⣴⣶⣿⣎⠻⣿⣿⣿⣿⣿⣿⡆⣸", + "⣷⣄⣈⡻⢿⣷⣌⢿⠈⣿⡷⣹⣿⣻⣿⠿⣿⣿⣿⣶⣿⣿⣿⣿⣿⡟⡌⠻⠿⢿⣿⣿⣿⢸⡇⣿⣿⣿⣿⣿⣿⣿⡿⣣⣾⣿⣷⣾⣿⠊⣾⠀⣿⣿⣿⣿⣷⣹⣿⣿⣿⣿⣿⣷⢸", + "⣿⣿⣿⣷⣶⣬⠙⠷⣌⢹⢇⣿⣿⣿⣿⣿⣶⣮⢹⣿⣿⣿⣿⣿⡿⢁⠀⣾⣶⣦⠀⢨⡭⣸⡇⠸⡛⢿⣿⣿⣛⣥⣾⣿⣿⣿⢏⡼⣡⣷⣌⣀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸", + "⣿⣿⣿⣿⣿⣿⣿⡶⠘⢼⣎⡻⢿⣿⣿⣿⡿⢣⣾⣿⣿⣿⣿⡿⢁⠂⣰⣿⣿⣿⡇⡘⡇⡿⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⢟⡵⢋⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢸", + "⣿⣿⣿⣿⣿⣿⣿⣷⡄⠜⢿⣿⣷⣶⣭⣥⣾⣿⣿⣿⣿⣿⠟⡵⢁⣼⣿⣿⣿⣿⡇⠡⠸⣱⣿⣿⣿⣿⣿⣿⣿⡿⠋⠱⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠿⠿⣿⠿⢁⣼", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⣀⢋⡙⠿⠿⠿⠿⠿⠿⠿⠟⢁⣴⣿⣿⣿⣿⣿⣿⣇⠠⠛⣛⣛⣛⣛⣛⢛⣋⣁⣴⣾⣷⣦⣉⣙⣛⣛⣛⡛⣛⣛⣛⣛⣋⣠⣶⣿⣷⣶⣶⣶⣿⣿", +} + +M.kinemon = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣴⠆⣶⣎⢻⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠭⣴⣶⣾⣿⣿⢈⢹⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢛⣭⣴⣶⣿⣿⣿⣿⣿⣿⣿⣧⠘⣀⣭⣥⢤⠢⡙", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣡⣾⣿⠋⣀⠉⠀⠉⠨⠛⠿⠿⢋⣴⣿⣿⢆⡈⢁⣳⠱", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢋⣾⡟⠻⣿⡇⣾⣷⣦⣀⣤⡖⢂⠄⠙⢿⣿⡇⠿⣿⢐⠂⠠", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢡⣿⣯⡙⠲⠬⠇⣿⣿⣿⣿⢋⣴⣿⠀⠑⢾⣿⡇⠀⣥⠐⣩⣴", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⣿⣷⣌⠑⢀⣴⣿⣿⣿⡟⣡⣿⣿⣿⣷⣄⢢⣽⣿⠀⣭⣾⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⣾⣿⣿⡏⡠⡭⠭⡭⠭⠉⡐⣿⣿⡟⣚⣛⣛⣂⢹⡿⢸⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣼⣿⣿⣿⠀⢄⠀⠀⠈⡐⠰⢧⢹⣿⢀⠙⠌⢻⣿⣿⢇⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢰⣿⣿⢻⠡⠁⠀⣡⣶⣿⡇⠀⠺⡆⠇⢀⢡⣤⣤⣿⠏⣼⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣱⣿⣿⡿⢃⠀⡀⠀⠸⣿⣿⡇⢐⢠⣿⣼⣿⣿⣿⡿⢋⣾⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢏⣼⣿⣿⠟⣴⠃⠁⠁⣀⠀⣿⣿⡇⣤⡙⢿⣿⣿⣿⠟⣱⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⣡⣾⣿⡿⠃⣊⠕⠀⠂⠀⠃⢸⣿⣿⢇⣿⣿⣿⣿⠟⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢁⠀⠀⠤⠙⠻⠛⠁⠈⠁⢭⣄⠠⠀⡀⠢⣿⢃⣾⣿⣿⡟⣡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠑⠀⠀⠀⡄⠀⢀⣼⠶⢤⠈⠀⣺⣿⡷⢡⣾⣿⣿⢋⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠘⠀⠀⠈⡀⡚⠰⠨⢰⣿⠛⣡⣿⣿⡿⢣⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⢥⣀⠨⢄⠘⠃⠀⠈⢟⡻⢡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠜⣰⠀⣿⣎⡋⠙⠉⠀⠠⠘⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠈⠀⠀⠀⣠⣾⣌⢳⣘⠻⡇⠀⠀⠃⠀⠀⡀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠐⠀⠀⠀⠀⠀⠀⣴⣾⣿⣿⣿⣦⣍⣥⣶⠀⠀⠀⠀⠀⢋⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⣀⡐⢶⠸⣿⣿⣿⣿⡿⢡⣿⣿⣿⡄⠀⠐⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠰⠀⠀⠀⠀⠀⢸⢿⣿⡶⢒⣀⣒⡢⠭⠑⠻⢿⣿⣿⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠁⠠⠀⠀⠀⠀⢸⠈⢻⠀⠻⣿⣿⣿⢡⣷⣶⡄⢍⡁⠠⠤⠄⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⢁⡄⠀⠀⢸⡷⡨⠑⣴⣶⣦⠄⣈⠻⠿⢛⡼⠋⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⣼⣿⡀⠀⠘⢸⣿⣤⣛⣛⠋⠘⢿⣷⠊⠋⠀⠀⠀⠀⠐⢀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⢠⣿⣿⣿⠆⢀⣸⡙⠿⢿⡟⣰⣿⡖⡷⠁⠀⠀⠀⠀⠀⠈⠈⢈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⡏⣼⣿⣿⣷⣿⣾⠁⣦⣍⣶⢁⣀⣤⣶⠃⠀⠀⢀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⢾⣿⣿⣿⣿⣿⣿⣾⣿⣿⡇⣾⣿⣿⣿⠀⣠⣀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢁⡀⠀⠈⠙⠛⠛⠿⠿⠿⠿⠿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣋⣴⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣝⣛⣛⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢛⣥⣾⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣭⣍⣛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⣴⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⣠⣤⣤⣀⠬⢙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣍⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⠟⣵⣿⣿⣿⣿⣿⣿⣿⡿⠟⣩⣴⣿⣿⣿⣿⣿⣿⣶⣦⣭⣭⣭⣛⣛⣛⣛⠻⠿⢿⣿⣿⢻⣿⡏⢹⣿⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⡟⣡⣾⣿⣿⣿⣿⣿⡿⠟⣩⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⠖⢠⠾⢿⣁⠜⢉⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⠿⢋⣾⣿⣿⣿⣿⣿⠟⣫⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢋⠔⠾⠎⣀⠇⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + +M.doom = { + [[================= =============== =============== ======== ========]], + [[\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //]], + [[||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||]], + [[|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||]], + [[||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||]], + [[|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||]], + [[||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||]], + [[|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||]], + [[||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||]], + [[|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||]], + [[|| `' || || `' || || `' || || | \ / | ||]], + [[|| .===' `===. .==='.`===. .===' /==. | \/ | ||]], + [[|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||]], + [[|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||]], + [[|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||]], + [[||.==' _-' `' | /==.||]], + [[==' _-' N E O V I M \/ `==]], + [[\ _-' `-_ /]], + [[ `'' ``' ]], +} + +M.pacman = { + [[ ██████ ]], + [[ ████▒▒▒▒▒▒████ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ]], + [[ ██▒▒▒▒▒▒ ▒▒▓▓▒▒▒▒▒▒ ▓▓▓▓ ]], + [[ ██▒▒▒▒▒▒ ▒▒▓▓▒▒▒▒▒▒ ▒▒▓▓ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ██ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ]], + [[ ██▒▒██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒██▒▒▒▒██ ]], + [[ ████ ██▒▒██ ██▒▒▒▒██ ██▒▒██ ]], + [[ ██ ██ ████ ████ ]], +} + +local keys = vim.tbl_keys(M) + +local function get_days() + local seconds = vim.uv.clock_gettime("realtime").sec + local day = math.ceil(seconds / (60 * 60 * 24)) + return day +end + +M.get_by_day = function() + local index = (get_days() % #keys) + 1 + return M[keys[index]] +end + +return M diff --git a/nvim/lua/funcs.lua b/nvim/lua/funcs.lua new file mode 100644 index 0000000..e9be0c5 --- /dev/null +++ b/nvim/lua/funcs.lua @@ -0,0 +1,225 @@ +local autocmd = vim.api.nvim_create_autocmd +local groupid = vim.api.nvim_create_augroup + +local M = {} + +M.get_size = function(path) + local ok, stats = pcall(function() + return vim.loop.fs_stat(path) + end) + if not (ok and stats) then + return + end + return math.floor(0.5 + (stats.size / (1024 * 1024))) +end + +M.is_text = function(path) + -- Determine if file is text. This is not 100% proof, but good enough. + -- Source: https://github.com/sharkdp/content_inspector + local ok, fd = pcall(function() + return vim.loop.fs_open(path, "r", 1) + end) + if not (ok and fd) then + return false + end + ---@diagnostic disable-next-line: redefined-local + local ok, bytes = pcall(function() + return vim.loop.fs_read(fd, 1024) + end) + if not (ok and bytes) then + return false + end + local is_text = bytes:find("\0") == nil + vim.loop.fs_close(fd) + return is_text +end + +-- copy from https://github.com/Bekaboo/nvim/blob/master/lua/core/autocmds.lua +---@param group string +---@vararg { [1]: string|string[], [2]: vim.api.keyset.create_autocmd } +---@return nil +M.augroup = function(group, ...) + local id = groupid(group, { clear = true }) + for _, a in ipairs({ ... }) do + a[2].group = id + autocmd(unpack(a)) + end +end + +M.pcall_notify = function(func) + local ok, out = pcall(func) + if not ok then + vim.notify_once(string.format("%s", out), vim.log.levels.DEBUG) + end + return out +end + +M.is_not_mini = function() + return vim.env.NVIM_MINI == nil +end + +M.doau = function(pattern, data) + vim.api.nvim_exec_autocmds("User", { + pattern = pattern, + data = data, + }) +end + +function M.maxline(path, break_after) + if break_after == nil then + break_after = vim.o.synmaxcol + 1 + end + local max = 0 + local fd = vim.uv.fs_open(path, "r", 1) + if not fd then + return max + end + local stat = vim.uv.fs_fstat(fd) + local data = vim.uv.fs_read(fd, stat.size, nil) + vim.uv.fs_close(fd) + if not data then + return max + end + + local lines = vim.split(data, "[\r]?\n") + + for _, line in pairs(lines) do + if max < #line then + max = #line + end + if max >= break_after then + return max + end + end + return max +end + +-- Returns the first element in the array that satisfies the provided testing function +M.ifind = function(tbl, func) + for index, item in ipairs(tbl) do + if func(item, index) then + return item + end + end + + return nil +end + +-- Function to merge two tables in Lua using Neovim. +function M.merge_tables(table1, table2) + local merged_table = table1 or {} -- Ensure a valid table, even if nil + for k, _ in pairs(table2) do + merged_table[k] = table2[k] + end + + -- Return the merged table. + return merged_table +end + +function M.debounce(ms, func) + local entry = { timer = nil, cancel = nil } + + entry.timer = vim.uv.new_timer() + entry.timer:start( + ms, + 0, + vim.schedule_wrap(function() + entry.cancel = func() + end) + ) + + return entry +end + +-- https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/utils/api.lua +local api = {} +local CTRL_V = vim.api.nvim_replace_termcodes("", true, true, true) +local CTRL_S = vim.api.nvim_replace_termcodes("", true, true, true) + +api.get_mode = function() + local mode = vim.api.nvim_get_mode().mode:sub(1, 1) + if mode == "i" then + return "i" -- insert + elseif mode == "v" or mode == "V" or mode == CTRL_V then + return "x" -- visual + elseif mode == "s" or mode == "S" or mode == CTRL_S then + return "s" -- select + elseif mode == "c" and vim.fn.getcmdtype() ~= "=" then + return "c" -- cmdline + end +end + +api.is_insert_mode = function() + return api.get_mode() == "i" +end + +---Check if cursor is in syntax group +---@param group string | []string +---@return boolean +M.in_syntax_group = function(group) + local row, col = unpack(vim.api.nvim_win_get_cursor(0)) + if not api.is_insert_mode() then + col = col + 1 + end + + for _, syn_id in ipairs(vim.fn.synstack(row, col)) do + syn_id = vim.fn.synIDtrans(syn_id) -- Resolve :highlight links + local g = vim.fn.synIDattr(syn_id, "name") + if type(group) == "string" and g == group then + return true + elseif type(group) == "table" and vim.tbl_contains(group, g) then + return true + end + end + + return false +end + +---Check if cursor is in treesitter capture +---@param capture string | []string +---@return boolean +M.in_treesitter_capture = function(capture) + local buf = vim.api.nvim_get_current_buf() + local row, col = unpack(vim.api.nvim_win_get_cursor(0)) + row = row - 1 + if vim.api.nvim_get_mode().mode == "i" then + col = col - 1 + end + + local get_captures_at_pos = -- See neovim/neovim#20331 + require("vim.treesitter").get_captures_at_pos -- for neovim >= 0.8 or require('vim.treesitter').get_captures_at_position -- for neovim < 0.8 + + local captures_at_cursor = vim.tbl_map(function(x) + return x.capture + end, get_captures_at_pos(buf, row, col)) + + if vim.tbl_isempty(captures_at_cursor) then + return false + elseif type(capture) == "string" and vim.tbl_contains(captures_at_cursor, capture) then + return true + elseif type(capture) == "table" then + for _, v in ipairs(capture) do + if vim.tbl_contains(captures_at_cursor, v) then + return true + end + end + end + + return false +end + +function M.shorten_path(path) + local sep = package.config:sub(1, 1) + local parts = {} + for part in path:gmatch("[^" .. sep .. "]+") do + table.insert(parts, part) + end + + for i = 1, #parts - 2 do + parts[i] = parts[i]:sub(1, 1) + end + + return table.concat(parts, "_") +end + +return M diff --git a/nvim/lua/largefiles.lua b/nvim/lua/largefiles.lua new file mode 100644 index 0000000..fb73ad1 --- /dev/null +++ b/nvim/lua/largefiles.lua @@ -0,0 +1,167 @@ +local doau = require("funcs").doau +local maxline = require("funcs").maxline +local ifind = require("funcs").ifind +local pcall_notify = require("funcs").pcall_notify + +local max_file_size = 2 +local max_file_size_readonly = 100 + +local ignore_ft = { + "help", + "man", + "lspinfo", + "trouble", + "null-ls-info", + "qf", + "notify", + "startuptime", + "checkhealth", + "netrw", + "neotest-output", + "neotest-output-panel", + "neotest-summary", + "vista_kind", + "sagaoutline", + "httpResult", +} + +local function get_buf_size(path) + local ok, stats = pcall(function() + return vim.uv.fs_stat(path) + end) + if not (ok and stats) then + return 0 + end + return math.floor(0.5 + (stats.size / (1024 * 1024))) +end + +local FILE_TYPE = { + NORMAL = 0, + LONG_LINE = 1, + LARGE_SIZE = 2, + READ_ONLY = 3, +} + +local function is_large_file(bufnr, as_bool, path) + local function wrap() + if not bufnr then + return false + end + local ok, large_buf = pcall(vim.api.nvim_buf_get_var, bufnr, "large_buf") + if not ok then + large_buf = nil + end + + if large_buf ~= nil then + return large_buf + end + + local _type = FILE_TYPE.NORMAL + vim.api.nvim_buf_set_var(bufnr, "large_buf", _type) + + if ifind(ignore_ft, function(item, _) + return vim.bo.ft == item + end) then + return _type + end + + bufnr = bufnr or vim.api.nvim_get_current_buf() + path = path or vim.api.nvim_buf_get_name(bufnr) + local size = get_buf_size(path) + + if size > max_file_size_readonly then + vim.notify("LARGE FILE SIZE: READONLY " .. size, vim.log.levels.INFO) + _type = FILE_TYPE.READ_ONLY + elseif size > max_file_size then + vim.notify("LARGE FILE SIZE " .. size, vim.log.levels.INFO) + _type = FILE_TYPE.LARGE_SIZE + else + local _m = maxline(path) + if _m > vim.o.synmaxcol then + vim.notify("LONG LINE " .. _m, vim.log.levels.INFO) + _type = FILE_TYPE.LONG_LINE + end + end + + if _type ~= FILE_TYPE.NORMAL then + vim.api.nvim_buf_set_var(bufnr, "large_buf", _type) + doau("LargeFile", {}) + end + + return _type + end + + local _t = wrap() + + if not as_bool then + return _t + end + + return _t ~= FILE_TYPE.NORMAL +end + +local function optimize_buffer(bufnr, path) + local status_ok, _ = pcall(vim.api.nvim_buf_get_var, bufnr, "large_buf") + + if status_ok then + return + end + + local _type = is_large_file(bufnr, false, path) + + if _type == FILE_TYPE.NORMAL then + return + end + + vim.opt_local.cursorline = false + vim.opt_local.linebreak = false + vim.opt_local.wrap = false + vim.opt_local.spell = false + vim.opt_local.hlsearch = false + vim.opt_local.incsearch = false + vim.opt_local.foldmethod = "manual" + vim.opt_local.foldenable = false + vim.opt_local.foldcolumn = "0" + vim.opt_local.swapfile = false + vim.opt_local.bufhidden = "unload" + + vim.opt_local.relativenumber = false + + vim.b.numbertoggle_disabled = 1 + vim.b.matchup_matchparen_fallback = 0 + vim.b.matchup_matchparen_enabled = 0 + + if _type == FILE_TYPE.LONG_LINE then + vim.opt_local.list = false + vim.opt_local.undolevels = -1 + vim.opt_local.undofile = false + end + + -- pcall_notify(function() + -- require("rainbow-delimiters").disable(bufnr) + -- end) + pcall_notify(function() + require("ufo").detach(bufnr) + end) + pcall_notify(function() + require("gitsigns.attach").detach(bufnr) + end) + + pcall_notify(function() + require("local-highlight").detach(bufnr) + end) + + -- pcall_notify(function() + -- require('smear_cursor').enabled = false + -- end) + + if _type == FILE_TYPE.READ_ONLY then + vim.opt_local.buftype = "nowrite" + end +end + +return { + is_large_file = is_large_file, + FILE_TYPE = FILE_TYPE, + optimize_buffer = optimize_buffer, +} diff --git a/nvim/lua/lsp/autocomplete.lua b/nvim/lua/lsp/autocomplete.lua new file mode 100644 index 0000000..a4daf30 --- /dev/null +++ b/nvim/lua/lsp/autocomplete.lua @@ -0,0 +1,197 @@ +-- https://github.com/deathbeam/myplugins.nvim/blob/main/lua/myplugins + +local group = vim.api.nvim_create_augroup("native-completion", { clear = true }) +local funcs = require("funcs") + +local config = { + -- entry_mapper = function(vim_item, client) + -- local entry = { + -- source = { + -- source = { + -- client = client, + -- } + -- } + -- } + -- entry.get_completion_item = function(self) + -- return { + -- label = vim_item.abbr, + -- abbr = vim_item.abbr, + -- kind = vim_item.kind, + -- menu = vim_item.menu, + -- icase = vim_item.icase, + -- dup = vim_item.dup, + -- empty = vim_item.empty, + -- detail = vim_item.menu, + -- } + -- end + -- local highlights_info = require("colorful-menu").cmp_highlights(entry) + -- vim.print(highlights_info) + -- if highlights_info ~= nil then + -- vim_item.abbr_hl_group = highlights_info.highlights + -- vim_item.abbr = highlights_info.text + -- end + -- return vim_item + -- end, + debounce_delay = 200, +} + +local function complete_changed(args) + local methods = vim.lsp.protocol.Methods + if not string.find(vim.o.completeopt, "popup") then + return + end + + if not vim.v.event or not vim.v.event.completed_item then + return + end + + local cur_item = vim.v.event.completed_item + local cur_info = vim.fn.complete_info() + local selected = cur_info.selected + + funcs.debounce(config.debounce_delay, function() + local completion_item = vim.tbl_get(cur_item or {}, "user_data", "nvim", "lsp", "completion_item") + if not completion_item then + return + end + + -- vim.print(methods.completionItem_resolve) + + local _, cancel = vim.lsp.buf_request( + args.buf, + methods.completionItem_resolve, + ---@param client vim.lsp.Client + function(client, buf) + if not client:supports_method(methods.completionItem_resolve, buf) then + return + end + return completion_item + end, + vim.schedule_wrap(function(err, item) + if err or not item then + return + end + + local docs = vim.tbl_get(item, "documentation", "value") + if not docs or #docs == 0 then + return + end + + local wininfo = vim.api.nvim__complete_set(selected, { info = docs }) + if not wininfo.winid or not wininfo.bufnr then + return + end + + vim.api.nvim_win_set_config(wininfo.winid, { + ---@diagnostic disable-next-line: assign-type-mismatch + border = vim.o.winborder, + focusable = false, + }) + + vim.treesitter.start(wininfo.bufnr, "markdown") + vim.wo[wininfo.winid].conceallevel = 3 + vim.wo[wininfo.winid].concealcursor = "niv" + end), + function() end + ) + + return cancel + end) +end + +local M = {} + +M.attach_completion = function(client, buf) + if not vim.lsp.completion or not vim.lsp.completion.enable then + return + end + + if not client:supports_method(vim.lsp.protocol.Methods.textDocument_completion, buf) then + return + end + + if client.name == "minuet" then + return + end + + vim.api.nvim_create_autocmd("CompleteChanged", { + group = group, + desc = "Auto show LSP documentation", + callback = complete_changed, + buffer = buf, + }) + + vim.lsp.completion.enable(true, client.id, buf, { + autotrigger = true, + convert = function(item) + local doc = item.documentation or {} + local info + if vim.bo.filetype == "c" then + info = ("%s%s\n \n%s"):format(item.detail or "", item.label, doc.value or "") + end + local entry = { + abbr = item.label, + kind = vim.lsp.protocol.CompletionItemKind[item.kind] or "Unknown", + menu = item.detail or "", + icase = 1, + dup = 0, + empty = 0, + info = info and info:gsub("\n+%s*\n$", "") or nil, + } + + if config.entry_mapper then + return config.entry_mapper(entry, client) + end + + return entry + end, + }) +end + +-- cmdcompletion +local function cmdcmp() + if vim.fn.has("nvim-0.11.0") == 0 then + return + end + + local term = vim.api.nvim_replace_termcodes("", true, true, true) + + vim.cmd([[set wildcharm=]]) + vim.opt.wildmenu = true + vim.opt.wildmode = "noselect:lastused,full" + + vim.keymap.set("c", "", "", { silent = true }) + vim.keymap.set("c", "", "", { silent = true }) + + vim.api.nvim_create_autocmd("CmdlineChanged", { + group = group, + desc = "Auto show command line completion", + pattern = ":", + callback = function() + local cmdline = vim.fn.getcmdline() + local curpos = vim.fn.getcmdpos() + local last_char = cmdline:sub(curpos - 1, curpos - 1) + + if + curpos == #cmdline + 1 + and vim.fn.pumvisible() == 0 + and last_char:match("[%w%/%:- ]") + and not cmdline:match("^%d+$") + then + vim.api.nvim_feedkeys(term, "ti", false) + vim.opt.eventignore:append("CmdlineChanged") + vim.schedule(function() + vim.fn.setcmdline(vim.fn.substitute(vim.fn.getcmdline(), "\\%x00", "", "g")) + vim.opt.eventignore:remove("CmdlineChanged") + end) + end + end, + }) +end + +-- vim.api.nvim_create_autocmd({ "CmdlineEnter" }, { +-- once = true, +-- callback = cmdcmp, +-- }) + +return M diff --git a/nvim/lua/lsp/init.lua b/nvim/lua/lsp/init.lua new file mode 100644 index 0000000..14abca0 --- /dev/null +++ b/nvim/lua/lsp/init.lua @@ -0,0 +1,87 @@ +-- +-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md + +local M = {} + +M.lsps = { + -- "nginx_language_server", + "nixd", + "lua_ls", + "rust_analyzer", + "bashls", + "vimls", + "html", + "cssls", + -- "jedi_language_server", + "ruff", + "ty", + "basedpyright", + "taplo", + "ts_ls", + "neocmake", + "docker_language_server", + "biome", + "jinja_lsp", + "golangci_lint_ls", + "gopls", + "vacuum", + "yamlls", + "jsonls", + "clangd", +} + +M.setup = function() + for _, lsp in ipairs(M.lsps) do + local cfg = vim.lsp.config[lsp] + if not cfg then + vim.print(string.format("%s not configured", lsp)) + goto continue + end + + local cmd = cfg.cmd + if cmd == nil then + vim.print(string.format("%s not configured: cmd nil", lsp)) + goto continue + end + + if type(cmd) == "function" then + vim.lsp.enable(lsp, vim.g.lsp_autostart) + goto continue + end + + if cmd ~= nil and vim.fn.executable(cmd[1]) == 1 then + vim.lsp.enable(lsp, vim.g.lsp_autostart) + end + + ::continue:: + end + + -- vim.lsp.handlers["workspace/diagnostic/refresh"] = function(_, _, ctx) + -- local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id) + -- local bufnr = vim.api.nvim_get_current_buf() + -- vim.diagnostic.reset(ns, bufnr) + -- return true + -- end + + vim.diagnostic.config({ + underline = true, + signs = true, + virtual_text = false, + virtual_lines = { current_line = true }, + float = true, + -- jump = { + -- float = true, + -- wrap = true, + -- }, + update_in_insert = false, + severity_sort = true, + }) + + vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + update_in_insert = false, + }) + + require("lsp.utils").setup_autocmds() +end + +return M diff --git a/nvim/lua/lsp/utils.lua b/nvim/lua/lsp/utils.lua new file mode 100644 index 0000000..d43599d --- /dev/null +++ b/nvim/lua/lsp/utils.lua @@ -0,0 +1,334 @@ +local is_large_file = require("largefiles").is_large_file +local methods = vim.lsp.protocol.Methods + +local opts_l = { silent = true, noremap = true } + +local M = {} + +M.keys = { + { + "sd", + function() + require("fzf-lua").lsp_definitions({ multiprocess = true }) + end, + { desc = "Search: Definitions", table.unpack(opts_l) }, + }, + { + "sS", + function() + require("fzf-lua").lsp_live_workspace_symbols({ multiprocess = true }) + end, + { desc = "Search: Symbols", table.unpack(opts_l) }, + }, + { + "grr", + function() + require("fzf-lua").lsp_references({ multiprocess = true, ignore_current_line = true }) + end, + { desc = "Search: references", table.unpack(opts_l) }, + }, + { + "gd", + vim.lsp.buf.definition, + { desc = "GoTo: definition", table.unpack(opts_l) }, + }, + { + "gD", + vim.lsp.buf.declaration, + { desc = "GoTo: declarations", table.unpack(opts_l) }, + }, + { + "K", + vim.lsp.buf.hover, + { silent = true, desc = "Lang: hover doc", table.unpack(opts_l) }, + }, + { + "grn", + vim.lsp.buf.rename, + { desc = "Lang: rename", table.unpack(opts_l) }, + }, + { + "gE", + vim.diagnostic.open_float, + { desc = "Lang: diagnistic", table.unpack(opts_l) }, + }, + { + "]d", + function() + vim.diagnostic.jump({ count = vim.v.count1 }) + end, + { desc = "Jump to the next diagnostic in the current buffer", table.unpack(opts_l) }, + }, + { + "[d", + function() + vim.diagnostic.jump({ count = -vim.v.count1 }) + end, + { desc = "Jump to the previous diagnostic in the current buffer", table.unpack(opts_l) }, + }, + { + "]e", + function() + vim.diagnostic.jump({ count = vim.v.count1, severity = vim.diagnostic.severity.ERROR }) + end, + { desc = "Jump to the next ERROR diagnostic in the current buffer", table.unpack(opts_l) }, + }, + { + "[e", + function() + vim.diagnostic.jump({ count = -vim.v.count1, severity = vim.diagnostic.severity.ERROR }) + end, + { desc = "Jump to the previous ERROR diagnostic in the current buffer", table.unpack(opts_l) }, + }, +} + +local inlay_hints_group = vim.api.nvim_create_augroup("toggle_inlay_hints", { clear = false }) + +local function toggle_inlay_hints(bufnr) + if bufnr == nil then + bufnr = vim.api.nvim_get_current_buf() + end + local enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }) + + if not enabled then + vim.api.nvim_create_autocmd("InsertEnter", { + group = inlay_hints_group, + desc = "Enable inlay hints", + buffer = bufnr, + callback = function() + vim.lsp.inlay_hint.enable(false, { bufnr = bufnr }) + end, + }) + vim.api.nvim_create_autocmd("InsertLeave", { + group = inlay_hints_group, + desc = "Disable inlay hints", + buffer = bufnr, + callback = function() + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + end, + }) + else + vim.api.nvim_clear_autocmds({ + buffer = bufnr, + group = inlay_hints_group, + }) + end + vim.lsp.inlay_hint.enable(not enabled, { bufnr = bufnr }) +end + +--- https://github.com/neovim/nvim-lspconfig/blob/f4619ab31fc4676001ea05ae8200846e6e7700c7/plugin/lspconfig.lua#L123 +--- Sets up LSP keymaps and autocommands for the given buffer. +---@param client vim.lsp.Client +---@param bufnr integer +function M.on_attach(client, bufnr) + if is_large_file(bufnr, true) then + vim.bo[bufnr].tagfunc = nil + return 0 + end + + if client:supports_method(methods.textDocument_inlayHint, bufnr) then + vim.keymap.set( + { "n" }, + "ti", + toggle_inlay_hints, + { buffer = bufnr, silent = true, desc = "Toggle Inlay hint", noremap = true } + ) + toggle_inlay_hints(bufnr) + end + + if client.name == "phoenix" or vim.b[bufnr].lsp_keymaps_set == 1 then + return 1 + end + + local prev_keymaps = {} + + for _, keymap in ipairs(M.keys) do + local name = keymap[1] + if #keymap == 3 then + table.insert(keymap, 1, "n") + end + + if type(keymap[2]) == "table" then + for _, mode in ipairs(keymap[2]) do + table.insert(prev_keymaps, vim.fn.maparg(name, mode, false, true)) + end + else + table.insert(prev_keymaps, vim.fn.maparg(name, keymap[2], false, true)) + end + + keymap[4].buffer = bufnr + + vim.keymap.set(table.unpack(keymap)) + end + + if client:supports_method(methods.textDocument_codeAction, bufnr) then + table.insert(prev_keymaps, vim.fn.maparg("gra", "n", false, true)) + table.insert(prev_keymaps, vim.fn.maparg("gra", "v", false, true)) + vim.keymap.set({ "n", "v" }, "gra", function() + require("fzf-lua").lsp_code_actions({ + winopts = { + relative = "cursor", + width = 0.6, + height = 0.6, + row = 1, + preview = { vertical = "up:70%" }, + }, + }) + end, { desc = "Code actions", silent = true }) + end + + vim.api.nvim_create_autocmd("LspDetach", { + buffer = bufnr, + callback = function() + for _, keymap in ipairs(prev_keymaps) do + pcall(vim.fn.mapset, keymap) + end + vim.b[bufnr].lsp_keymaps_set = 0 + end, + }) + + if not client:supports_method(methods.textDocument_hover, bufnr) then + client.server_capabilities.hoverProvider = false + end + + -- vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" + vim.b[bufnr].lsp_keymaps_set = 1 + return 1 +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() + +-- copy from blink.cmp +capabilities.textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + }, + completion = { + dynamicRegistration = false, + completionItem = { + snippetSupport = true, + commitCharactersSupport = false, -- todo: + documentationFormat = { "markdown", "plaintext" }, + deprecatedSupport = true, + preselectSupport = false, -- todo: + tagSupport = { valueSet = { 1 } }, -- deprecated + insertReplaceSupport = true, -- todo: + resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + "command", + "data", + }, + }, + insertTextModeSupport = { + -- todo: support adjustIndentation + valueSet = { 1 }, -- asIs + }, + labelDetailsSupport = true, + }, + contextSupport = true, + insertTextMode = 1, + completionList = { + itemDefaults = { + "commitCharacters", + "editRange", + "insertTextFormat", + "insertTextMode", + "data", + }, + }, + }, +} + +vim.lsp.config("*", { + capabilities = capabilities, + root_markers = vim.g.root_pattern, +}) + +local group = vim.api.nvim_create_augroup("my-lsp-config", { clear = true }) + +M.setup_autocmds = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = group, + desc = "attach lsp event", + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + + if not client then + return + end + if vim.b[args.buf].lsp_attached == nil then + vim.b[args.buf].lsp_attached = {} + elseif vim.b[args.buf].lsp_attached[client.id] ~= nil then + return + end + + client.server_capabilities.semanticTokensProvider = nil + + local attached = M.on_attach(client, args.buf) + if not attached then + local out = vim.lsp.buf_detach_client(args.buf, client.id) + if out then + vim.b[args.buf].lsp_attached[client.id] = nil + end + end + + vim.b[args.buf].lsp_attached[client.id] = 1 + + if not client:supports_method(vim.lsp.protocol.Methods.textDocument_completion, args.buf) then + return + end + + local chars = client.server_capabilities.completionProvider.triggerCharacters + if chars then + for i = string.byte("a"), string.byte("z") do + if not vim.list_contains(chars, string.char(i)) then + table.insert(chars, string.char(i)) + end + end + + for i = string.byte("A"), string.byte("Z") do + if not vim.list_contains(chars, string.char(i)) then + table.insert(chars, string.char(i)) + end + end + end + + -- require("lsp.autocomplete").attach_completion(client, args.buf) + end, + }) + + local timer = nil --[[uv_timer_t]] + local function reset_timer() + if timer then + timer:stop() + timer:close() + end + timer = nil + end + + vim.api.nvim_create_autocmd("LspDetach", { + group = group, + desc = "Auto stop client when no buffer atttached", + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_clients({ client_id = client_id })[1] + if not client or not vim.tbl_isempty(client.attached_buffers) then + return + end + reset_timer() + timer = assert(vim.loop.new_timer()) + timer:start(200, 0, function() + reset_timer() + vim.schedule(function() + vim.lsp.stop_client(client_id, true) + end) + end) + end, + }) +end + +return M diff --git a/nvim/lua/plugins/ai/avante/airun.lua b/nvim/lua/plugins/ai/avante/airun.lua new file mode 100644 index 0000000..1173ebd --- /dev/null +++ b/nvim/lua/plugins/ai/avante/airun.lua @@ -0,0 +1,53 @@ +local M = {} + +M.modify_config = function(cfg) + cfg.provider = "airun" + cfg.mode = "legacy" + cfg.auto_suggestions_provider = "airun_autocomplete" + cfg.providers.airun = { + __inherited_from = "openai", + endpoint = vim.g.airun_endpoint, + api_key_name = "AI_RUN_TOKEN", + model = vim.g.airun_model, + disable_tools = true, + allow_insecure = true, + extra = { + temperature = 0.7, + max_tokens = 512, + }, + } + cfg.providers.airun_autocomplete = { + __inherited_from = "openai", + endpoint = vim.g.airun_endpoint, + allow_insecure = true, + api_key_name = "AI_RUN_TOKEN", + model = vim.g.airun_autocomplete_model, + disable_tools = true, + } + cfg.rag_service.enabled = true + cfg.rag_service.llm = { + provider = "airun", + endpoint = vim.g.airun_endpoint, + allow_insecure = true, + api_key = "AI_RUN_TOKEN", + model = vim.g.airun_model, + extra = { + temperature = 0.7, + max_tokens = 512, + }, + } + cfg.rag_service.embed = { + provider = "airun", + endpoint = vim.g.airun_endpoint, + allow_insecure = true, + api_key = "AI_RUN_TOKEN", + model = vim.g.ai_run_embedded_model, + extra = { + embed_batch_size = 16, + }, + } + + return cfg +end + +return M diff --git a/nvim/lua/plugins/ai/avante/init.lua b/nvim/lua/plugins/ai/avante/init.lua new file mode 100644 index 0000000..c78cbac --- /dev/null +++ b/nvim/lua/plugins/ai/avante/init.lua @@ -0,0 +1,93 @@ +return { + "yetone/avante.nvim", + event = vim.g.post_load_events, + -- from nix + dev = true, + opts = { + mode = "agentic", + debug = false, + providers = {}, + web_search_engine = {}, + behaviour = { + auto_focus_sidebar = true, + auto_suggestions = false, + auto_suggestions_respect_ignore = false, + auto_set_highlight_group = true, + auto_set_keymaps = true, + auto_apply_diff_after_generation = false, + jump_result_buffer_on_finish = false, + support_paste_from_clipboard = true, + minimize_diff = true, + enable_token_counting = true, + use_cwd_as_project_root = true, + auto_focus_on_diff_view = true, + }, + hints = { enabled = true }, + + rag_service = { -- RAG Service configuration + enabled = false, + host_mount = os.getenv("HOME"), + runner = "nix", -- Runner for the RAG service (can use docker or nix) + docker_extra_args = "", + }, + + mappings = { + suggestion = { + accept = "", + next = "", + prev = "", + dismiss = "", + }, + diff = { + ours = "gH", + theirs = "gh", + all_theirs = "gA", + both = "gB", + cursor = "gc", + next = "]x", + prev = "[x", + }, + }, + + repo_map = { + ignore_patterns = { + "%.git", + "%.worktree", + "__pycache__", + "node_modules", + "target", + "build", + "dist", + "BUILD", + "ventor%.", + "%.min%.", + ".devenv", + }, -- ignore files matching these + negate_patterns = {}, -- negate ignore files matching these. + }, + + selector = { + provider = "fzf_lua", + }, + }, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + { + -- from nix + dev = true, + "Kaiser-Yang/blink-cmp-avante", + }, + + "ibhagwan/fzf-lua", -- for file_selector provider fzf + }, + + config = function(_, opts) + require("avante_lib").load() + opts = require("plugins.ai.avante.airun").modify_config(opts) + -- opts = require("plugins.ai.avante.ollama").modify_config(opts) + + require("avante").setup(opts) + end, +} diff --git a/nvim/lua/plugins/ai/avante/ollama.lua b/nvim/lua/plugins/ai/avante/ollama.lua new file mode 100644 index 0000000..bffeab1 --- /dev/null +++ b/nvim/lua/plugins/ai/avante/ollama.lua @@ -0,0 +1,35 @@ +local M = {} + +local model = "hf.co/mradermacher/Qwen2.5-CoderX-14B-v0.5-GGUF:Q8_0" + +M.modify_config = function(cfg) + cfg.provider = "ollama" + cfg.providers.ollama = { + endpoint = vim.g.ollama_url, + model = model, + disabled_tools = { "python" }, + extra_request_body = { + -- num_ctx = 1024 * 20, + temperature = 0.5, + }, + } + cfg.rag_service.llm = { + provider = "ollama", + endpoint = vim.g.ollama_url, + api_key = "", + model = "phi4-mini:latest", + extra = nil, + } + cfg.rag_service.embed = { + provider = "ollama", + endpoint = vim.g.ollama_url, + api_key = "", + model = "nomic-embed-text:latest", + extra = { + embed_batch_size = 10, + }, + } + return cfg +end + +return M diff --git a/nvim/lua/plugins/ai/codecompanion/adapters.lua b/nvim/lua/plugins/ai/codecompanion/adapters.lua new file mode 100644 index 0000000..2adb3f0 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/adapters.lua @@ -0,0 +1,99 @@ +local M = { + opts = { + allow_insecure = true, + show_defaults = false, + }, +} + +M.gemini = function() + return require("codecompanion.adapters").extend("gemini", { + env = { + api_key = "GEMINI_API_KEY", + }, + }) +end +M.airun = function() + return require("codecompanion.adapters").extend("openai_compatible", { + env = { + url = vim.g.airun_url, + api_key = "AI_RUN_TOKEN", -- optional: if your endpoint is authenticated + chat_url = "/v1/chat/completions", -- optional: default value, override if different + -- models_endpoint = "/v1/models", -- optional: attaches to the end of the URL to form the endpoint to retrieve models + }, + schema = { + model = { + default = vim.g.airun_model, + choices = function(self) + return {} + end, + }, + -- num_ctx = { + -- default = 131072, + -- }, + }, + }) +end + +local function ollama_params(model_name, model) + return function() + return require("codecompanion.adapters").extend("ollama", { + env = { + url = vim.g.ollama_url, + }, + headers = { + ["Content-Type"] = "application/json", + }, + parameters = { + sync = true, + keep_alive = "30m", + }, + name = model_name, + schema = { + model = { + default = model, + }, + num_ctx = { + default = 1024 * 32, -- 32768 + }, + temperature = { + default = 0.5, + }, + }, + }) + end +end + +local function ollama_modify(model_name, model, func) + local params_func = ollama_params(model_name, model) + + return function() + local params = params_func() + return func(params) + end +end + +M.ollama_deepseek = ollama_params("deepseek-r1", "deepseek-r1:14b-qwen-distill-q4_K_M") +M.ollama_deepcode = ollama_params("deepcode", "hf.co/lmstudio-community/DeepCoder-14B-Preview-GGUF:Q4_K_M") +M.ollama_gemma3 = ollama_params("gemma3", "hf.co/unsloth/gemma-3-12b-it-GGUF:Q4_K_M") +M.ollama_codegemma = ollama_params("codegemma", "codegemma:latest") + +M.ollama_phimini = ollama_params("phimini", "phi4-mini:latest") + +M.ollama_devstral = ollama_modify("devstral", "devstral:latest", function(params) + params.schema.temperature.default = 0.15 + return params +end) + +local function ollama_qwen(model_name, model) + return ollama_modify(model_name, model, function(params) + return params + end) +end + +M.ollama_qwencoder = ollama_qwen("qwen2.5", "hf.co/unsloth/Qwen2.5-Coder-7B-Instruct-128K-GGUF:Q4_K_M") +M.ollama_qwen = ollama_qwen("qwen3", "hf.co/unsloth/Qwen3-8B-128K-GGUF:Q6_K_XL") +M.ollama_qwenamall = ollama_qwen("qwen3-small", "qwen3:0.6b") +M.ollama_qwenlarge = ollama_qwen("qwen3-large", "qwen3:30b-a3b") + +M.default_adapter = M.airun +return M diff --git a/nvim/lua/plugins/ai/codecompanion/fidget-spinner.lua b/nvim/lua/plugins/ai/codecompanion/fidget-spinner.lua new file mode 100644 index 0000000..e0ba6f3 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/fidget-spinner.lua @@ -0,0 +1,106 @@ +-- lua/plugins/codecompanion/fidget-spinner.lua + +-- This module manages fidget spinner progress indicators for CodeCompanion requests. + +local M = {} + +-- Initializes the fidget spinner module by setting up autocommands. +function M:init() + local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {}) + + -- Autocommand to handle when a CodeCompanion request starts. + vim.api.nvim_create_autocmd({ "User" }, { + pattern = "CodeCompanionRequestStarted", + group = group, + callback = function(request) + if not request.data.strategy then + return + end + local handle = M:create_progress_handle(request) -- Create progress handle for the request + M:store_progress_handle(request.data.id, handle) -- Store the progress handle + end, + }) + + -- Autocommand to handle when a CodeCompanion request finishes. + vim.api.nvim_create_autocmd({ "User" }, { + pattern = "CodeCompanionRequestFinished", + group = group, + callback = function(request) + local handle, duration = M:pop_progress_handle(request.data.id) -- Pop the progress handle and get duration + if handle then + M:report_exit_status(handle, request, duration) -- Report the exit status of the request + handle:finish() -- Finish the progress handle + end + end, + }) +end + +-- Table to store progress handles, indexed by request ID. +M.handles = {} +-- Table to store start times of requests, indexed by request ID. +M.start_times = {} + +-- Stores a progress handle and the start time for a given request ID. +function M:store_progress_handle(id, handle) + M.handles[id] = handle -- Store handle with request ID + M.start_times[id] = vim.uv.hrtime() -- Record start time +end + +-- Pops (removes and returns) a progress handle and calculates the duration of the request. +function M:pop_progress_handle(id) + local handle = M.handles[id] -- Get handle from stored handles + local start_time = M.start_times[id] -- Get start time from stored start times + M.handles[id] = nil -- Remove handle after popping + M.start_times[id] = nil -- Remove start time after popping + + local duration = nil + if start_time then + local elapsed_ns = vim.uv.hrtime() - start_time + duration = string.format("%.2fs", elapsed_ns / 1e9) -- Calculate duration in seconds + end + + return handle, duration +end + +-- Creates a progress handle with a dynamic title based on the request strategy and adapter. +function M:create_progress_handle(request) + local progress = require("fidget.progress") + return progress.handle.create({ + title = " Requesting assistance (" .. request.data.strategy .. ")", -- Title includes strategy + message = "In progress...", + lsp_client = { + name = M:llm_role_title(request.data.adapter), -- LSP client name based on adapter + }, + }) +end + +-- Generates a formatted title for the LSP client based on the adapter information. +function M:llm_role_title(adapter) + local parts = {} + table.insert(parts, adapter.formatted_name) -- Insert formatted adapter name + if adapter.model and adapter.model ~= "" then + table.insert(parts, "(" .. adapter.model .. ")") -- Insert model name if available + end + return table.concat(parts, " ") -- Concatenate parts to create title +end + +-- Reports the exit status of a request to the progress handle, including duration if available. +function M:report_exit_status(handle, request, duration) + local message = "" + + if request.data.status == "success" then + message = "Completed" + elseif request.data.status == "error" then + message = " Error" + else + message = "󰜺 Cancelled" + end + + if duration then + message = message .. " (" .. duration .. ")" -- Append duration to message if available + end + + handle.message = message -- Update progress handle message +end + +return M diff --git a/nvim/lua/plugins/ai/codecompanion/init.lua b/nvim/lua/plugins/ai/codecompanion/init.lua new file mode 100644 index 0000000..e8f9d89 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/init.lua @@ -0,0 +1,232 @@ +local adapters = require("plugins.ai.codecompanion.adapters") + +return { + "olimorris/codecompanion.nvim", + -- from nix + dev = true, + cmd = { + "CodeCompanionChat", + "CodeCompanion", + "CodeCompanionCmd", + "CodeCompanionActions", + "CodeCompanionHistory", + }, + keys = { + { + "cc", + function() + require("codecompanion").toggle() + end, + desc = "Code Companion", + silent = true, + }, + { + "cc", + ":'<,'>CodeCompanionChat Add", + desc = "Code Companion Add", + silent = true, + mode = "x", + noremap = true, + }, + { + "", + function() + require("codecompanion").toggle() + end, + desc = "Code Companion", + silent = true, + }, + { + "", + ":'<,'>CodeCompanionChat Add", + desc = "Code Companion Add", + silent = true, + mode = "x", + noremap = true, + }, + { + "ci", + ":CodeCompanion", + desc = "Code Companion inline", + silent = true, + mode = "n", + noremap = true, + }, + { + "ci", + ":'<,'>CodeCompanion", + desc = "Code Companion inline", + silent = true, + mode = "x", + noremap = true, + }, + { + "ca", + ":'<,'>CodeCompanionActions", + desc = "Code Companion Actions", + silent = true, + mode = "x", + noremap = true, + }, + { + "ca", + ":CodeCompanionActions", + desc = "Code Companion Actions", + silent = true, + mode = "n", + noremap = true, + }, + { + "ch", + ":CodeCompanionHistory", + desc = "Code Companion Actions", + silent = true, + mode = "n", + noremap = true, + }, + }, + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "j-hui/fidget.nvim", + { + "ravitemer/codecompanion-history.nvim", + -- from nix + dev = true, + }, + { + "Davidyz/VectorCode", + -- lazy = true, + -- from nix + dev = true, + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + async_opts = { + notify = true, + }, + }, + init = function() + vim.api.nvim_create_autocmd("LspAttach", { + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + local cacher = require("vectorcode.config").get_cacher_backend() + require("vectorcode.cacher").utils.async_check("config", function() + cacher.register_buffer(bufnr, { + n_query = 10, + }) + end, nil) + end, + desc = "Register buffer for VectorCode", + }) + end, + config = function(_, opts) + require("vectorcode").setup(opts) + end, + }, + }, + init = function() + require("plugins.ai.codecompanion.fidget-spinner"):init() + end, + config = function() + local opts = { + adapters = adapters, + strategies = { + chat = { + adapter = "default_adapter", + keymaps = require("plugins.ai.codecompanion.keymaps"), + }, + inline = { + adapter = "default_adapter", + keymaps = { + accept_change = { + modes = { n = "gh" }, + description = "Accept the suggested change", + }, + reject_change = { + modes = { n = "gH" }, + description = "Reject the suggested change", + }, + }, + }, + agent = { adapter = "default_adapter" }, + }, + display = { + chat = { + -- window = { + -- layout = "float", + -- }, + icons = { + pinned_buffer = "📌 ", + watched_buffer = "👀 ", + }, + show_header_separator = true, + show_settings = true, + }, + }, + opts = { + -- system_prompt = require("plugins.ai.codecompanion.system_prompt"), + }, + prompt_library = require("plugins.ai.codecompanion.prompts"), + extensions = { + history = { + enabled = true, + opts = { + keymap = "sh", + save_chat_keymap = "sc", + auto_save = true, + expiration_days = 0, + picker = "fzf-lua", + auto_generate_title = false, + ---On exiting and entering neovim, loads the last chat on opening chat + continue_last_chat = false, + ---When chat is cleared with `gx` delete the chat from history + delete_on_clearing_chat = true, + ---Directory path to save the chats + dir_to_save = vim.fn.stdpath("data") .. "/codecompanion-history", + ---Enable detailed logging for history extension + enable_logging = false, + }, + }, + }, + } + + local ok, _ = pcall(require, "mchup") + if ok then + opts.extensions.mcphub = { + callback = "mcphub.extensions.codecompanion", + opts = { + make_vars = true, + make_slash_commands = true, + show_result_in_chat = true, + }, + } + end + + ok, _ = pcall(require, "vectorcode") + if ok then + opts.extensions.vectorcode = { + opts = { + tool_group = { + enabled = true, + extras = {}, + collapse = false, + }, + tool_opts = { + ls = {}, + vectorise = {}, + query = { + max_num = { chunk = -1, document = -1 }, + default_num = { chunk = 50, document = 10 }, + include_stderr = false, + use_lsp = true, + no_duplicate = true, + chunk_mode = false, + }, + }, + }, + } + end + + require("codecompanion").setup(opts) + end, +} diff --git a/nvim/lua/plugins/ai/codecompanion/keymaps.lua b/nvim/lua/plugins/ai/codecompanion/keymaps.lua new file mode 100644 index 0000000..7561f57 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/keymaps.lua @@ -0,0 +1,140 @@ +return { + options = { + modes = { + n = "?", + }, + callback = "keymaps.options", + description = "Options", + hide = true, + }, + completion = { + modes = { + i = "", + }, + index = 1, + callback = "keymaps.completion", + description = "Completion Menu", + }, + send = { + modes = { + n = { "", "" }, + i = "", + }, + index = 1, + callback = "keymaps.send", + description = "Send", + }, + regenerate = { + modes = { + n = "gr", + }, + index = 2, + callback = "keymaps.regenerate", + description = "Regenerate the last response", + }, + close = { + modes = { + n = "", + i = "", + }, + index = 3, + callback = "keymaps.stop", + description = "Stop Chat", + }, + stop = { + modes = { + n = "q", + }, + index = 4, + callback = "keymaps.stop", + description = "Stop Request", + }, + clear = { + modes = { + n = "gx", + }, + index = 5, + callback = "keymaps.clear", + description = "Clear Chat", + }, + codeblock = { + modes = { + n = "gc", + }, + index = 6, + callback = "keymaps.codeblock", + description = "Insert Codeblock", + }, + yank_code = { + modes = { + n = "gy", + }, + index = 7, + callback = "keymaps.yank_code", + description = "Yank Code", + }, + next_chat = { + modes = { + n = "}", + }, + index = 8, + callback = "keymaps.next_chat", + description = "Next Chat", + }, + previous_chat = { + modes = { + n = "{", + }, + index = 9, + callback = "keymaps.previous_chat", + description = "Previous Chat", + }, + next_header = { + modes = { + n = "]]", + }, + index = 10, + callback = "keymaps.next_header", + description = "Next Header", + }, + previous_header = { + modes = { + n = "[[", + }, + index = 11, + callback = "keymaps.previous_header", + description = "Previous Header", + }, + change_adapter = { + modes = { + n = "ga", + }, + index = 12, + callback = "keymaps.change_adapter", + description = "Change adapter", + }, + fold_code = { + modes = { + n = "za", + }, + index = 13, + callback = "keymaps.fold_code", + description = "Fold code", + }, + debug = { + modes = { + n = "gd", + }, + index = 14, + callback = "keymaps.debug", + description = "View debug info", + }, + system_prompt = { + modes = { + n = "gs", + }, + index = 15, + callback = "keymaps.toggle_system_prompt", + description = "Toggle the system prompt", + }, +} diff --git a/nvim/lua/plugins/ai/codecompanion/prompts/comments.lua b/nvim/lua/plugins/ai/codecompanion/prompts/comments.lua new file mode 100644 index 0000000..4c62064 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/prompts/comments.lua @@ -0,0 +1,50 @@ +local PROMPTS = { + ["Comments"] = { + strategy = "inline", + description = "Add comments to not simplify ", + opts = { + modes = { "v" }, + short_name = "comments", + auto_submit = true, + stop_context_insertion = true, + user_prompt = false, + }, + prompts = { + { + role = "system", + content = function(context) + return "I want you to act as a expert of " + .. context.filetype + .. "\n" + .. [[ +You must: +- Answer without ``` +- Avoid wrapping the whole response in triple backticks. +]] + end, + }, + { + role = "user", + content = function(context) + local text = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + + return "I have the following code:\n\n```" + .. context.filetype + .. "\n" + .. text + .. "\n```\n Please add short comments on not simply cases.\n" + end, + opts = { + contains_code = true, + }, + }, + }, + }, +} +PROMPTS["Comments Ru"] = vim.deepcopy(PROMPTS["Comments"]) +PROMPTS["Comments Ru"].opts.short_name = "comments_ru" +PROMPTS["Comments Ru"].prompts[2].content = function(context) + return PROMPTS["Comments"].prompts[2].content(context) .. "\n Ответь кратко на русском." +end + +return PROMPTS diff --git a/nvim/lua/plugins/ai/codecompanion/prompts/expert.lua b/nvim/lua/plugins/ai/codecompanion/prompts/expert.lua new file mode 100644 index 0000000..ed25811 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/prompts/expert.lua @@ -0,0 +1,37 @@ +local PROMPTS = { + ["Code Expert"] = { + strategy = "chat", + description = "Get some special advice from an LLM", + opts = { + modes = { "v" }, + mapping = "cE", + short_name = "expert", + auto_submit = true, + stop_context_insertion = true, + user_prompt = true, + }, + prompts = { + { + role = "system", + content = function(context) + return "I want you to act as a senior " + .. context.filetype + .. " developer. I will ask you specific questions and I want you to return concise explanations and codeblock examples." + end, + }, + { + role = "user", + content = function(context) + local text = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) + + return "I have the following code:\n\n```" .. context.filetype .. "\n" .. text .. "\n```\n\n" + end, + opts = { + contains_code = true, + }, + }, + }, + }, +} + +return PROMPTS diff --git a/nvim/lua/plugins/ai/codecompanion/prompts/init.lua b/nvim/lua/plugins/ai/codecompanion/prompts/init.lua new file mode 100644 index 0000000..541003b --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/prompts/init.lua @@ -0,0 +1,8 @@ +local funcs = require("funcs") + +local prompts = {} + +funcs.merge_tables(prompts, require("plugins.ai.codecompanion.prompts.comments")) +funcs.merge_tables(prompts, require("plugins.ai.codecompanion.prompts.expert")) + +return prompts diff --git a/nvim/lua/plugins/ai/codecompanion/system_prompt.lua b/nvim/lua/plugins/ai/codecompanion/system_prompt.lua new file mode 100644 index 0000000..53cd8ea --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/system_prompt.lua @@ -0,0 +1,185 @@ +return function(_) + local uname = vim.uv.os_uname() + local platform = string.format( + "sysname: %s, release: %s, machine: %s, version: %s", + uname.sysname, + uname.release, + uname.machine, + uname.version + ) + -- Note: parallel tool execution is not supported by codecompanion currently + return string.format( + [[ +You are an AI assistant plugged into user's code editor. Use the instructions below and the tools accessible to you for assisting the user. + +# Role, tone and style +You should follow the user's requirements carefully and to the letter. +You should be more humanly likeable, and less like a computer. While you can have your own opinion and thoughts, you must stay focused, without deviating from the task at hand or the user's original requirements. +You should be concise, precise, direct, and to the point. Output text to communicate with the user; all text you output is displayed to the user. All non-code responses should respect the natural language the user is currently speaking. +You should respond in Github-flavored Markdown for formatting. Headings should start from level 3 (###) onwards. +You should wrap paths/URLs in backticks like `/path/to/file`. And you should always provide absolute path, or related path based on the current directory. +You should wrap any code related word/term with backticks like `function_name`. + +IMPORTANT: You should NOT answer with unnecessary preamble or postamble, unless you're asked to. You should make every word meaningful. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. +IMPORTANT: You should avoid all meaningless or irrelevant words. Please skip all obvious conclusions, explanations, or disclaimers, and offer deep-minded insights instead. This is fatal important when you're concluding, summarizing, or explaining something. + +⚠️ VERY IMPORTANT: SAY YOU DO NOT KNOW IF YOU DO NOT KNOW. DO NOT BE OVER CONFIDENT, ALWAYS BE CAUTIOUS.⚠️ +⚠️ VERY IMPORTANT: DO EXACTLY WHAT THE USER ASKS YOU TO DO, NOTHING MORE, NOTHING LESS, UNLESS YOU ARE TOLD TO DO SOMETHING DIFFERENT.⚠️ + +# Proactiveness +You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between: +1. Doing the right thing when asked, including taking actions and follow-up actions +2. Not surprising the user with actions you take without asking. For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions. +3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did. + +# Following conventions +When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns. +- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language). +- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions. +- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic. +- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository. +- Consider cross-platform compatibility when suggesting solutions. Also consider performance where relevant. And maintainability is as fatal important. In all, please always follow the best practices of the programming language you're using, and write code like a senior developer. You may give advice about best practices to the user. + +# Doing tasks +When the user asks you to do a task, the following steps are recommended: +1. Use tools you have permission to to understand the tasks and the user's queries. You are encouraged to use tools to gather information. But don't use tools if you can answer directly with your knowledge. +2. Implement the solution using all tools you have permission to. +3. Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach. +4. Prefer fetching context with tools you have permission to instead of historic messages since historic messages may be outdated, such as codes may be formatted by the editor. + +NOTE: When you're reporting/concluding/summarizing/explaining something comes from the previous context, please using footnotes to refer to the references, such as the result of a tool invocation, or URLs, or files. You MUST give URLs if there're related URLs. Remember that you should output the list of footnotes before task execution. Examples: + +The function `foo`. is used to do something.[^1] +... +It is sunny today.[^2] + +[^1]: ``, around function `foo`. +[^2]: https://url-to-weather-forecast.com + +task execution if needed... + + +IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. + +**VERY IMPORTANT**: You MUST ensure that all your decisions and actions are based on the known context only. Do not make assumptions, do not bias, avoid hallucination. + +# Tool conventions +Before invoking tools, you should describe your purpose with: `I'm using **@** to ", for .` + +Short descriptions of tools: +- `files`: read or edit files. +- `cmd_runner`: run shell commands. +- `nvim_runner`: run neovim commands or lua scripts. You can invoke neovim api by this tool. + +IMPORTANT: In any situation, after an permission request, you MUST stop immediately and wait for approval. +IMPORTANT: In any situation, if user denies to execute a tool (that means they choose not to run the tool), you should ask for guidance instead of attempting another action. Do not try to execute over and over again. The user retains full control with an approval mechanism before execution. + +**FATAL IMPORTANT**: YOU MUST EXECUTE ONLY **ONCE** AND ONLY **ONE TOOL** IN **ONE TURN**. That means you should STOP IMMEDIATELY after sending a tool invocation. + +⚠️ **FATAL IMPORTANT**: ***YOU MUST USE TOOLS STEP BY STEP, ONE BY ONE. THE RESULT OF EACH TOOL INVOCATION IS IN THE USER'S RESPONSE NEXT TURN. DO NOT PROCEED WITHOUT USER'S RESPONSE.*** KEEP THIS IN YOUR MIND!!! ⚠️ + +## **Request Permissions to Tools** +Got the permission of a tool <==> User've told you how to invoke it. +Remember, you don't have any permission to tools by default. You cannot use tool without permission. You cannot get the permission of a tool by inferring how to invoke it implicitly from the context. + +If you need a tool but you don't have permission to, request for permission with following format: + +I need permission to use **@** to , for . + +**Once you got permission for a tool, please don't ask permission for it again.** + +## Tool usage policy +1. When doing file operations, prefer to use `files` tool in order to reduce context usage. +2. When doing complex work like math calculations, prefer to use tools. +3. When searching or listing files, you should respect .gitignore patterns. Files like `target`, `node_modules`, `dist` etc should not be included, based on the context and gitignore. + +# Tool usage general guidelines +To execute tools, you need to generate XML codeblocks mentioned below. +You should always try to save tokens for user while ensuring quality by minimizing the output of the tool, or you can combine multiple commands into one (which is recommended), such as `cd xxx && make`, or you can run actions sequentially (these actions must belong to the same tool) if the tool supports sequential execution. Running actions of a tool sequentially is considered to be one step/one tool invocation. + +This is only a general usage guideline, the tool specific usage/guideline/arguments will be detailed once you got the permission to use the tool. + +All tools share the same base XML structure: + +~~~~xml + + + + [action specific elements] + + + +~~~~ + + +IMPORTANT: You should use "~~~~" instead of backticks to wrap the XML codeblock, since inner backticks may break the codeblock. + +For example, if there is a tool called `example_tool` with an action called `example_action`, and the `example_action` has three elements: ``, `` and optional ``, the XML structure would be: + +~~~~xml + + + + %s + %s + + + +~~~~ + + +IMPORTANT: Some elements would need to wrap content in CDATA sections to protect special characters, while others do not need to be. Typically all string contents should be wrapped in CDATA sections, and numbers are not. + +If the tool doesn't have an action type(usually when there's only one action in the tool), then it could be: + +~~~~xml + + + + %s + + + +~~~~ + + +Some tools support sequential execution to execute multiple action in one XML codeblock: + +~~~~xml + + + + [action specific elements] + + + [action specific elements] + + + +~~~~ + + +IMPORTANT: Always return a XML markdown code block to run tools. Each operation should follow the XML schema exactly. XML must be valid. +IMPORTANT: Only tools with explicit sequential execution support are allowed to call multiple actions in one XML codeblock. + +# Environment Awareness +- Platform: %s, +- Shell: %s, +- Current date: %s +- Current time: %s, timezone: %s(%s) +- Current working directory(git repo: %s): %s, +]], + + "content1", + "", + "", + platform, + vim.o.shell, + os.date("%Y-%m-%d"), + os.date("%H:%M:%S"), + os.date("%Z"), + os.date("%z"), + vim.fn.isdirectory(".git") == 1, + vim.fn.getcwd() + ) +end diff --git a/nvim/lua/plugins/ai/codecompanion/utils/add_reference.lua b/nvim/lua/plugins/ai/codecompanion/utils/add_reference.lua new file mode 100644 index 0000000..bfa1f74 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/utils/add_reference.lua @@ -0,0 +1,131 @@ +local config = require("codecompanion.config") +local helpers = require("codecompanion.strategies.chat.helpers") + +local user_role = config.strategies.chat.roles.user +local api = vim.api + +---Add a reference to the chat buffer +---@param chat CodeCompanion.Chat +---@param ref CodeCompanion.Chat.Ref +---@param row integer +local function add(chat, ref, row) + local lines = {} + + table.insert(lines, string.format("> - %s", ref.id)) + + if vim.tbl_count(chat.refs) == 1 then + table.insert(lines, 1, "> Sharing:") + table.insert(lines, "") + end + + api.nvim_buf_set_lines(chat.bufnr, row, row, false, lines) +end + +---Parse the chat buffer to find where to add the references +---@param chat CodeCompanion.Chat +---@return table|nil +local function ts_parse_buffer(chat) + local query = vim.treesitter.query.get("markdown", "reference") + + local tree = chat.parser:parse({ chat.header_line - 1, -1 })[1] + local root = tree:root() + + -- Check if there are any references already in the chat buffer + local refs + for id, node in query:iter_captures(root, chat.bufnr, chat.header_line - 1, -1) do + if query.captures[id] == "refs" then + refs = node + end + end + + if refs and not vim.tbl_isempty(chat.refs) then + local start_row, _, end_row, _ = refs:range() + return { + capture = "refs", + start_row = start_row + 2, + end_row = end_row + 1, + } + end + + -- If not, check if there is a heading to add the references below + local role + local role_node + for id, node in query:iter_captures(root, chat.bufnr, chat.header_line - 1, -1) do + if query.captures[id] == "role" then + role = vim.treesitter.get_node_text(node, chat.bufnr) + role_node = node + end + end + + role = helpers.format_role(role) + + if role_node and role == user_role then + local start_row, _, end_row, _ = role_node:range() + return { + capture = "role", + start_row = start_row + 1, + end_row = end_row + 1, + } + end + + return nil +end + +---Add a reference to the chat buffer +---@param self CodeCompanion.Chat.References +---@param ref CodeCompanion.Chat.Ref +---@return nil +local function references_add(self, ref) + if not ref or not config.display.chat.show_references then + return self + end + + local existed = false + if ref then + if not ref.opts then + ref.opts = {} + end + -- Ensure both properties exist with defaults + ref.opts.pinned = ref.opts.pinned or false + ref.opts.watched = ref.opts.watched or false + -- if the reference is already existing, replace it. or insert it + for i, existing_ref in pairs(self.Chat.refs) do + if existing_ref.id == ref.id then + self.Chat.refs[i] = ref + existed = true + end + end + if not existed then + table.insert(self.Chat.refs, ref) + end + -- If it's a buffer reference and it's being watched, start watching + if ref.bufnr and ref.opts.watched then + self.Chat.watchers:watch(ref.bufnr) + end + end + + local parsed_buffer = ts_parse_buffer(self.Chat) + + if parsed_buffer and not existed then + -- If the reference block already exists, add to it + if parsed_buffer.capture == "refs" then + add(self.Chat, ref, parsed_buffer.end_row - 1) + -- If there are no references then add a new block below the heading + elseif parsed_buffer.capture == "role" then + add(self.Chat, ref, parsed_buffer.end_row + 1) + end + end +end + +---Add a reference to the chat buffer (Useful for user's adding custom Slash Commands) +---@param chat CodeCompanion.Chat +---@param data { role: string, content: string } +---@param source string +---@param id string +---@param opts? table Options for the message +return function(chat, data, source, id, opts) + opts = opts or { reference = id, visible = false } + + references_add(chat.references, { source = source, id = id }) + chat:add_message(data, opts) +end diff --git a/nvim/lua/plugins/ai/codecompanion/utils/change_adapter.lua b/nvim/lua/plugins/ai/codecompanion/utils/change_adapter.lua new file mode 100644 index 0000000..4c4871a --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/utils/change_adapter.lua @@ -0,0 +1,40 @@ +local config = require("codecompanion.config") +local util = require("codecompanion.utils") + +return function(chat, selected_adapter, selected_model) + local adapters = vim.deepcopy(config.adapters) + local current_adapter = chat.adapter.name + local current_model = vim.deepcopy(chat.adapter.schema.model.default) + + if current_adapter ~= selected_adapter then + chat.adapter = require("codecompanion.adapters").resolve(adapters[selected_adapter]) + util.fire("ChatAdapter", { + bufnr = chat.bufnr, + adapter = require("codecompanion.adapters").make_safe(chat.adapter), + }) + chat.ui.adapter = chat.adapter + chat:apply_settings() + end + + -- Update the system prompt + local system_prompt = config.opts.system_prompt + if type(system_prompt) == "function" then + if chat.messages[1] and chat.messages[1].role == "system" then + local opts = { + adapter = chat.adapter, + language = config.opts.language, + } + chat.messages[1].content = system_prompt(opts) + end + end + + if current_model ~= selected_model then + util.fire("ChatModel", { + bufnr = chat.bufnr, + model = selected_model, + }) + end + + chat:apply_model(selected_model) + chat:apply_settings() +end diff --git a/nvim/lua/plugins/ai/codecompanion/utils/restore_messages.lua b/nvim/lua/plugins/ai/codecompanion/utils/restore_messages.lua new file mode 100644 index 0000000..593ab46 --- /dev/null +++ b/nvim/lua/plugins/ai/codecompanion/utils/restore_messages.lua @@ -0,0 +1,120 @@ +local config = require("codecompanion.config") + +local has_been_reasoning = false +local api = vim.api + +---Add a message directly to the chat buffer. This will be visible to the user +---@param chat CodeCompanion.Chat +---@param data table +---@param opts? table +local function add_buf_message(chat, data, opts) + assert(type(data) == "table", "data must be a table") + if data.role == config.constants.SYSTEM_ROLE then + return + end + + local lines = {} + local bufnr = chat.bufnr + local new_response = false + + local function write(text) + for _, t in ipairs(vim.split(text, "\n", { plain = true, trimempty = false })) do + table.insert(lines, t) + end + end + + -- Add a new header to the chat buffer + local function new_role() + new_response = true + chat.last_role = data.role + table.insert(lines, "") + table.insert(lines, "") + chat.ui:set_header(lines, config.strategies.chat.roles[data.role]) + end + + -- Add data to the chat buffer + local function append_data() + if data.reasoning then + if not has_been_reasoning then + table.insert(lines, "### Reasoning") + table.insert(lines, "") + end + has_been_reasoning = true + write(data.reasoning) + end + if data.content then + if has_been_reasoning then + has_been_reasoning = false + table.insert(lines, "") + table.insert(lines, "") + table.insert(lines, "### Response") + table.insert(lines, "") + end + write(data.content) + end + end + + local function update_buffer() + chat.ui:unlock_buf() + local last_line, last_column, line_count = chat.ui:last() + if opts and opts.insert_at then + last_line = opts.insert_at + last_column = 0 + end + + local cursor_moved = api.nvim_win_get_cursor(0)[1] == line_count + api.nvim_buf_set_text(bufnr, last_line, last_column, last_line, last_column, lines) + + if new_response then + chat.ui:render_headers() + end + + if chat.last_role ~= config.constants.USER_ROLE then + chat.ui:lock_buf() + end + + if config.display.chat.auto_scroll then + if cursor_moved and chat.ui:is_active() then + chat.ui:follow() + elseif not chat.ui:is_active() then + chat.ui:follow() + end + end + end + + -- Handle a new role + if (data.role and data.role ~= chat.last_role) or (opts and opts.force_role) then + new_role() + end + + -- Append the output from the LLM + if data.content or data.reasoning then + append_data() + update_buffer() + end +end + +---Reset the chat buffer from messages +---@param chat CodeCompanion.Chat +---@param messages table[] +return function(chat, messages) + -- Clear current chat messages + chat.messages = {} + + -- Restore messages exactly as they were dumped + chat.messages = vim.deepcopy(messages) + -- cycle <- the cycle of latest message + chat.cycle = #messages > 0 and messages[#messages].cycle + 1 or 1 + + vim.api.nvim_buf_set_lines(chat.bufnr, 3, -1, false, {}) + + add_buf_message(chat, { role = config.constants.USER_ROLE, content = "" }) + + for _, message in ipairs(messages) do + add_buf_message(chat, message) + end + + add_buf_message(chat, { role = config.constants.USER_ROLE, content = "" }) + chat:set_range(-2) + chat.status = config.constants.SUCCESS_STATUS +end diff --git a/nvim/lua/plugins/ai/init.lua b/nvim/lua/plugins/ai/init.lua new file mode 100644 index 0000000..a38eb6a --- /dev/null +++ b/nvim/lua/plugins/ai/init.lua @@ -0,0 +1,5 @@ +return { + -- require("plugins.ai.codecompanion"), + require("plugins.ai.avante"), + require("plugins.ai.mchub"), +} diff --git a/nvim/lua/plugins/ai/mchub.lua b/nvim/lua/plugins/ai/mchub.lua new file mode 100644 index 0000000..a6cf4b5 --- /dev/null +++ b/nvim/lua/plugins/ai/mchub.lua @@ -0,0 +1,14 @@ +return { + { + "ravitemer/mcphub.nvim", + -- from nix + dev = true, + dependencies = { + "nvim-lua/plenary.nvim", -- Required for Job and HTTP requests + }, + cmd = "MCPHub", -- lazy load by default + config = function() + require("mcphub").setup() + end, + }, +} diff --git a/nvim/lua/plugins/autocomplete/ai.lua b/nvim/lua/plugins/autocomplete/ai.lua new file mode 100644 index 0000000..0b328ee --- /dev/null +++ b/nvim/lua/plugins/autocomplete/ai.lua @@ -0,0 +1,202 @@ +local vectorcode_cacher = nil +local has_vc = nil + +local vectorcacher = function() + if has_vc ~= nil then + return has_vc, vectorcode_cacher + end + + local vectorcode_config + has_vc, vectorcode_config = pcall(require, "vectorcode.config") + if has_vc then + vectorcode_cacher = vectorcode_config.get_cacher_backend() + end + + return has_vc, vectorcode_cacher +end + +-- roughly equate to 2000 tokens for LLM +local RAG_Context_Window_Size = 8000 + +local get_prompt = function(get_prompt_message, file_sep, fim_suf, fim_pref, fim_mid) + get_prompt_message = get_prompt_message or function() + return "" + end + return function(pref, suff) + local prompt_message = get_prompt_message() + + local h_vc, vc = vectorcacher() + if h_vc and vc then + for _, file in ipairs(vc.query_from_cache(0)) do + prompt_message = file_sep .. file.path .. "\n" .. file.document + end + end + + prompt_message = vim.fn.strcharpart(prompt_message, 0, RAG_Context_Window_Size) + local msg = prompt_message .. fim_suf .. suff .. fim_pref .. pref .. fim_mid + return msg + end +end + +local AiRun = { + api_key = "AI_RUN_TOKEN", + name = "AiRun", + stream = true, + end_point = vim.g.airun_endpoint, + model = vim.g.airun_model, + template = { + prompt = get_prompt(nil, "<[file-sep]>", "<[fim-suffix]>", "<[fim-prefix]>", "<[fim-middle]>"), + suffix = false, + }, + optional = { + stop = { + "<|endoftext|>", + "<|fim-prefix|>", + "<|fim-middle|>", + "<|fim-suffix|>", + "<|fim-pad|>", + "<|repo_name|>", + "<|file-sep|>", + }, + max_tokens = 300, + }, +} + +local QwenCoder = { + api_key = "TERM", + name = "OPENCODER", + stream = true, + end_point = vim.g.ollama_completions_endpoint, + model = "qwen2.5-coder:3b-instruct-q8_0", + template = { + prompt = get_prompt(nil, "<[file_sep]>", "<[fim_suffix]>", "<[fim_prefix]>", "<[fim_middle]>"), + suffix = false, + }, + optional = { + max_tokens = 300, + }, +} + +local attach = function(bufnr) + local lsps = vim.lsp.get_clients({ name = "minuet", bufnr = bufnr }) + + if #lsps and #lsps > 0 then + vim.notify("Minuet LSP already attached to current buffer", vim.log.levels.INFO) + return + end + + require("minuet.lsp").start_server({ buf = bufnr }) +end + +local detach = function(bufnr) + local lsps = vim.lsp.get_clients({ name = "minuet", bufnr = bufnr }) + + if #lsps == 0 then + vim.notify("Minuet LSP not attached to current buffer", vim.log.levels.INFO) + return + end + + for _, client in ipairs(lsps) do + vim.lsp.buf_detach_client(bufnr, client.id) + end + + vim.notify("Minuet LSP detached from current buffer", vim.log.levels.INFO) +end + +local enable_auto_trigger = function(bufnr) + local lsps = vim.lsp.get_clients({ name = "minuet", bufnr = bufnr }) + + if #lsps == 0 then + vim.b[bufnr].minuet_lsp_enable_auto_trigger = true + attach() + return + end + + for _, client in ipairs(lsps) do + vim.lsp.completion.enable(true, client.id, bufnr, { autotrigger = true }) + end + + vim.notify("Minuet LSP is enabled for auto triggering", vim.log.levels.INFO) +end + +local disable_auto_trigger = function(bufnr) + vim.b[bufnr].minuet_lsp_enable_auto_trigger = nil + local lsps = vim.lsp.get_clients({ name = "minuet", bufnr = bufnr }) + + if #lsps == 0 then + return + end + + for _, client in ipairs(lsps) do + vim.lsp.completion.enable(false, client.id, bufnr) + vim.notify("Minuet LSP is disabled for auto triggering", vim.log.levels.INFO) + end +end + +return { + { + "milanglacier/minuet-ai.nvim", + cmd = { "Minuet" }, + -- keys = { + -- { + -- "", + -- function() + -- local bufnr = vim.api.nvim_get_current_buf() + -- attach(bufnr) + -- enable_auto_trigger(bufnr) + -- vim.api.nvim_create_autocmd({ "InsertLeave", "BufLeave", "BufWinLeave" }, { + -- once = true, + -- callback = function() + -- if vim.b[bufnr].minuet_lsp_enable_auto_trigger then + -- disable_auto_trigger(bufnr) + -- detach(bufnr) + -- end + -- end, + -- }) + -- end, + -- mode = "i", + -- }, + -- }, + config = function() + -- This uses the async cache to accelerate the prompt construction. + -- There's also the require('vectorcode').query API, which provides + -- more up-to-date information, but at the cost of blocking the main UI. + require("minuet").setup({ + add_single_line_entry = true, + n_completions = 2, + -- I recommend you start with a small context window firstly, and gradually + -- increase it based on your local computing power. + context_window = 4096, + after_cursor_filter_length = 30, + debounce = 600, + -- notify = "debug", + provider = "openai_fim_compatible", + provider_options = { + openai_fim_compatible = AiRun, + -- openai_fim_compatible = QwenCoder, + }, + request_timeout = 10, + -- virtualtext = { + -- auto_trigger_ft = {}, + -- keymap = { + -- -- accept whole completion + -- accept = '', + -- -- accept one line + -- accept_line = '', + -- -- accept n lines (prompts for number) + -- -- e.g. "A-z 2 CR" will accept 2 lines + -- accept_n_lines = '', + -- -- Cycle to prev completion item, or manually invoke completion + -- prev = '', + -- -- Cycle to next completion item, or manually invoke completion + -- next = '', + -- dismiss = '', + -- }, + -- }, + -- lsp = { + -- enabled_ft = { "lua", "python" }, + -- }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/autocomplete/init.lua b/nvim/lua/plugins/autocomplete/init.lua new file mode 100644 index 0000000..c068823 --- /dev/null +++ b/nvim/lua/plugins/autocomplete/init.lua @@ -0,0 +1,4 @@ +return { + require("plugins.autocomplete.ai"), + require("plugins.autocomplete.blink"), +} diff --git a/nvim/lua/plugins/colorschema.lua.disabled b/nvim/lua/plugins/colorschema.lua.disabled new file mode 100644 index 0000000..0d3dc36 --- /dev/null +++ b/nvim/lua/plugins/colorschema.lua.disabled @@ -0,0 +1,80 @@ +if vim.g.modern_ui then + return { + { + "aileot/ex-colors.nvim", + lazy = true, + cmd = "ExColors", + ---@type ExColors.Config + config = function() + require("ex-colors").setup({ + required_syntaxes = { + "diff", -- "diffAdded", "diffRemoved", "diffChanged" + "html", + "markdown", + }, + included_patterns = require("ex-colors.presets").recommended.included_patterns + { + "BlinkCmp", + "GitSigns", + "RainbowDelimiter", + "MiniStatusline", + }, + }) + end, + }, + { + "ribru17/bamboo.nvim", + enabled = false, + lazy = false, + priority = math.huge, + config = function() + require("bamboo").setup({ + code_style = { + comments = { italic = true }, + conditionals = { italic = true }, + keywords = { bold = true }, + functions = { bold = true }, + namespaces = { italic = true }, + parameters = { italic = true }, + strings = {}, + variables = {}, + }, + dim_inactive = true, + -- style = "multiplex", + transparent = false, + lualine = { + transparent = true, -- lualine center bar transparency + }, + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = true, -- use background color for virtual text + }, + }) + require("bamboo").load() + vim.opt.background = "light" + vim.api.nvim_command("colorscheme bamboo-light") + end, + }, + { + "uloco/bluloco.nvim", + enabled = true, + lazy = false, + priority = math.huge, + dependencies = { "rktjmp/lush.nvim" }, + config = function() + require("bluloco").setup({ + style = "auto", -- "auto" | "dark" | "light" + transparent = false, + italics = true, + terminal = vim.fn.has("gui_running") == 1, -- bluoco colors are enabled in gui terminals per default. + guicursor = true, + rainbow_headings = true, -- if you want different colored headings for each heading level + }) + vim.api.nvim_command("colorscheme bluloco") + end, + }, + } +else + vim.api.nvim_command("colorscheme default") + return {} +end diff --git a/nvim/lua/plugins/comment.lua b/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..a1e1cc1 --- /dev/null +++ b/nvim/lua/plugins/comment.lua @@ -0,0 +1,61 @@ +local is_large_file = require("largefiles").is_large_file +vim.g.skip_ts_context_commentstring_module = true + +return { + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup({ + -- pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + ignore = function() + return is_large_file(vim.api.nvim_get_current_buf(), true) + end, + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = false, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = false, + }, + }) + end, + keys = { + + { + "gcc", + function() + local vvar = vim.api.nvim_get_vvar + return vvar("count") == 0 and "(comment_toggle_linewise_current)" + or "(comment_toggle_linewise_count)" + end, + expr = true, + desc = "Comment toggle current line", + }, + { + "gbc", + function() + local vvar = vim.api.nvim_get_vvar + return vvar("count") == 0 and "(comment_toggle_blockwise_current)" + or "(comment_toggle_blockwise_count)" + end, + expr = true, + desc = "Comment toggle current block", + }, + + { "gc", "(comment_toggle_linewise)", desc = "Comment toggle linewise" }, + { "gb", "(comment_toggle_blockwise)", desc = "Comment toggle linewise" }, + + { + "gc", + "(comment_toggle_linewise_visual)", + mode = { "x" }, + desc = "Comment toggle linewise (visual)", + }, + { + "gb", + "(comment_toggle_blockwise_visual)", + mode = { "x" }, + desc = "Comment toggle blockwise (visual)", + }, + }, + }, +} diff --git a/nvim/lua/plugins/dashboard.lua b/nvim/lua/plugins/dashboard.lua new file mode 100644 index 0000000..73ad3de --- /dev/null +++ b/nvim/lua/plugins/dashboard.lua @@ -0,0 +1,147 @@ +local M = { + neofetch = "", + version = "", + plugins = "", +} + +local function draw_footer(dashboard) + local footer = { + M.version, + M.plugins, + } + if type(M.neofetch) ~= "string" then + table.insert( + footer, + string.format("%s\t%s", M.neofetch[1]["result"]["prettyName"], M.neofetch[2]["result"]["release"]) + ) + local uptime = M.neofetch[3]["result"]["uptime"] / 1000 + local h = uptime / 3600 + local m = 60 - (math.ceil(h) - h) * 60 + local s = 60 - math.floor((math.ceil(m) - m) * 60) + m = math.floor(m) + h = math.floor(h) + table.insert(footer, string.format("uptime: %sh %sm %ss", h, m, s)) + end + dashboard.section.footer.val = footer + vim.cmd.AlphaRedraw() +end + +local function fetch(dashboard) + local neofetch = vim.fn.executable("fastfetch") + if neofetch == 0 then + return + end + local cmd = "fastfetch" + local args = { "--structure", "OS:Kernel:Uptime", "--format", "json" } + + local t = "" + local stdout = function(error, data) + if data then + t = t .. data + end + end + local on_exit = function(...) + if #t > 0 then + M.neofetch = vim.json.decode(t) + end + local timer = vim.uv.new_timer() + + timer:start( + 20, + 0, + vim.schedule_wrap(function() + draw_footer(dashboard) + end) + ) + end + vim.system({ cmd, table.unpack(args) }, { + text = true, + stdout = stdout, + }, on_exit) +end + +return { + "goolord/alpha-nvim", + cond = function() + -- nix 8.. + if #vim.v.argv > 8 then + return false + end + return not vim.env.YAZI_ID + end, + config = function() + local height = tonumber(vim.api.nvim_command_output("echo &lines")) or 0 + + local dashboard = require("alpha.themes.dashboard") + + dashboard.autostart = true + dashboard.config.layout[1].val = 1 + + dashboard.section.buttons.val = { + dashboard.button("n", " " .. " New file", ":ene startinsert "), + dashboard.button("f", " " .. " Find file", ":FzfLua files"), + dashboard.button("a", "󰊳 " .. " AI", function() + local buf = vim.api.nvim_get_current_buf() + vim.cmd([[:CodeCompanionChat]]) + vim.cmd("bd " .. tostring(buf)) + end), + dashboard.button("s", " " .. " Search", ":FzfLua grep_project"), + dashboard.button( + "r", + "󰄉 " .. " Recent files", + ":lua require('fzf-lua').oldfiles({ multiprocess = true, cwd_only=true })" + ), + dashboard.button("g", "󰄉 " .. " Diff", ":DiffviewOpen "), + dashboard.button("c", " " .. " Config", ":e .nvim.lua "), + dashboard.button("u", "󰊳 " .. " Update Plugins", ":Lazy update"), + dashboard.button("q", " " .. " Quit", ":qa"), + } + + -- set highlight + for _, button in ipairs(dashboard.section.buttons.val) do + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + end + dashboard.section.header.opts.hl = "AlphaHeader" + dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.section.footer.opts.hl = "AlphaFooter" + + if height > 40 then + local header = require("banner").get_by_day() + dashboard.section.header.val = header + fetch(dashboard) + else + dashboard.section.header.val = "" + end + + -- close Lazy and re-open when the dashboard is ready + local ft = vim.filetype.match({ buf = 0 }) + if ft == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "AlphaReady", + callback = function() + require("lazy").show() + end, + }) + end + + require("alpha").setup(dashboard.opts) + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + callback = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + M.version = string.format("󰥱 v%s", vim.version()) + M.plugins = "⚡Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" + + if height > 60 then + draw_footer(dashboard) + end + end, + }) + end, + dependencies = { + -- { "JMarkin/ascii.nvim", lazy = true }, + }, +} diff --git a/nvim/lua/plugins/db.lua b/nvim/lua/plugins/db.lua new file mode 100644 index 0000000..f2ca017 --- /dev/null +++ b/nvim/lua/plugins/db.lua @@ -0,0 +1,46 @@ +local is_not_mini = require("funcs").is_not_mini +local autocmd = vim.api.nvim_create_autocmd + +return { + { + "tpope/vim-dadbod", + -- from nix + dev = true, + lazy = true, + ft = { "sql", "mssql", "plsql" }, + }, + { + "kristijanhusak/vim-dadbod-completion", + -- from nix + dev = true, + lazy = true, + ft = { "sql", "mssql", "plsql" }, + }, + { + "kristijanhusak/vim-dadbod-ui", + -- from nix + dev = true, + cond = is_not_mini, + dependencies = { + "tpope/vim-dadbod", + "kristijanhusak/vim-dadbod-completion", + }, + init = function(event) + vim.g.db_ui_execute_on_save = 0 + vim.g.db_ui_win_position = "right" + vim.g.db_ui_show_database_icon = 1 + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_env_variable_url = "DATABASE_URL" + vim.g.db_ui_use_nvim_notify = true + vim.g.db_ui_auto_execute_table_helpers = 1 + + autocmd("FileType", { + pattern = { "dbui" }, + callback = function() + vim.keymap.set("n", "", "(DBUI_SelectLine)", { buffer = event.buffer, silent = true }) + end, + }) + end, + cmd = { "DBUI", "DBUIToggle" }, + }, +} diff --git a/nvim/lua/plugins/debug.lua b/nvim/lua/plugins/debug.lua new file mode 100644 index 0000000..5f3ac55 --- /dev/null +++ b/nvim/lua/plugins/debug.lua @@ -0,0 +1,288 @@ +local is_not_mini = require("funcs").is_not_mini + +local python_attach = function(options) + local dap = require("dap") + options = { + host = options.host or "0.0.0.0", + port = options.port or 5678, + remote_root = options.remote_root or "/app", + } + local host = options.host -- This should be configured for remote debugging if your SSH tunnel is setup. + -- You can even make nvim responsible for starting the debugpy server/adapter: + -- vim.fn.system({"${some_script_that_starts_debugpy_in_your_container}", ${script_args}}) + local pythonAttachAdapter = { + type = "server", + host = host, + port = options.port, + } + local pythonAttachConfig = { + type = "python", + request = "attach", + connect = { + port = options.port, + host = host, + }, + mode = "remote", + name = "Remote Attached Debugger", + cwd = vim.fn.getcwd(), + pathMappings = { + { + localRoot = vim.fn.getcwd(), -- Wherever your Python code lives locally. + remoteRoot = options.remote_root, -- Wherever your Python code lives in the container. + }, + }, + } + local session = dap.attach(pythonAttachAdapter, pythonAttachConfig) + if session == nil then + io.write("Error launching adapter") + end + require("dapui").open() +end + +vim.api.nvim_create_user_command("PythonRemoteAttach", function(opts) + python_attach({ remote_root = opts.fargs[1] or vim.fn.getcwd() }) +end, { + nargs = "*", + complete = "file_in_path", +}) + +return { + "rcarriga/nvim-dap-ui", + cond = is_not_mini, + lazy = true, + dependencies = { + { + "mfussenegger/nvim-dap", + }, + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + dependencies = "nvim-treesitter", + }, + "ofirgall/goto-breakpoints.nvim", + { + "LiadOz/nvim-dap-repl-highlights", + dependencies = "nvim-treesitter", + }, + "mfussenegger/nvim-dap-python", + "leoluz/nvim-dap-go", + }, + config = function() + local dap, dapui = require("dap"), require("dapui") + require("dap-python").setup(require("utils.python_venv").getPythonEnv()) + require("dap-go").setup() + + dapui.setup({ + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>", "za" }, + }, + controls = { + enabled = vim.fn.exists("+winbar") == 1, + element = "repl", + icons = { + pause = "", + play = "(F5)", + step_into = "(F11)", + step_over = "(F10)", + step_out = "(F12)", + step_back = "(F9)", + run_last = "(dl)", + terminate = "", + disconnect = "", + }, + }, + layouts = { + { + -- You can change the order of elements in the sidebar + elements = { + -- Provide IDs as strings or tables with "id" and "size" keys + { id = "breakpoints", size = 0.1 }, + { id = "watches", size = 0.1 }, + { + id = "scopes", + size = 0.45, -- Can be float or integer > 1 + }, + { id = "stacks", size = 0.25 }, + }, + size = 40, + position = "left", -- Can be "left" or "right" + }, + { + elements = { + "repl", + "console", + }, + size = 10, + position = "bottom", -- Can be "bottom" or "top" + }, + }, + }) + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + + require("nvim-dap-repl-highlights").setup() + end, + keys = { + { + "dc", + function() + require("dapui").close() + end, + desc = "Dap: UIClose", + }, + { + "do", + function() + require("dapui").open() + end, + desc = "Dap: UIOpen", + }, + { + "dd", + function() + require("dapui").toggle() + end, + desc = "Dap: UIToggle", + }, + { + "", + function() + require("dap").continue() + end, + desc = "Dap: continue", + }, + { + "", + function() + require("dap").step_over() + end, + desc = "Dap: step over", + }, + { + "", + function() + require("dap").step_into() + end, + desc = "Dap: step into", + }, + { + "", + function() + require("dap").step_out() + end, + desc = "Dap: step out", + }, + { + "", + function() + require("dap").step_back() + end, + desc = "Dap: step back", + }, + { + "db", + function() + require("dap").toggle_breakpoint() + end, + desc = "Dap: ToggleBreakpoint", + }, + { + "dB", + function() + require("dap").set_breakpoint() + end, + desc = "Dap: SetBreakpoint", + }, + { + "dr", + function() + require("dap").repl.open() + end, + desc = "Dap: Repl", + }, + { + "dl", + function() + require("dap").run_last() + end, + desc = "Dap: run last", + }, + { + "dh", + function() + require("dap.ui.widgets").hover() + end, + desc = "Dap: Hover", + mode = { "n", "v" }, + }, + { + "dp", + function() + require("dap.ui.widgets").preview() + end, + desc = "Dap: Preview", + mode = { "n", "v" }, + }, + { + "df", + function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.frames) + end, + desc = "Dap: Frames", + }, + { + "ds", + function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.scopes) + end, + desc = "Dap: Scopes", + }, + { + "de", + function(...) + require("dapui").float_element(...) + end, + desc = "Dap: UIFloatElement", + mode = "v", + }, + { + "dE", + function(...) + require("dapui").eval(...) + end, + desc = "Dap: Eval", + mode = "v", + }, + { + "]D", + function() + require("goto-breakpoints").next() + end, + desc = "Next breakkpoint", + }, + { + "[D", + function() + require("goto-breakpoints").prev() + end, + desc = "Prev breakkpoint", + }, + { + "]S", + function() + require("goto-breakpoints").stopped() + end, + }, + }, + cmd = { "PythonRemoteAttach" }, +} diff --git a/nvim/lua/plugins/dev.lua b/nvim/lua/plugins/dev.lua new file mode 100644 index 0000000..04d9c61 --- /dev/null +++ b/nvim/lua/plugins/dev.lua @@ -0,0 +1,31 @@ +-- for developments + +return { + { + "stevearc/profile.nvim", + cond = function() + return os.getenv("NVIM_PROFILE") + end, + lazy = true, + config = function() + vim.keymap.set("", "", function() + local prof = require("profile") + if prof.is_recording() then + prof.stop() + vim.ui.input( + { prompt = "Save profile to:", completion = "file", default = "profile.json.log" }, + function(filename) + if filename then + prof.export(filename) + vim.cmd([[profile stop]]) + vim.notify(string.format("Wrote %s", filename)) + end + end + ) + else + prof.start("*") + end + end) + end, + }, +} diff --git a/nvim/lua/plugins/diaglist.lua b/nvim/lua/plugins/diaglist.lua new file mode 100644 index 0000000..ff2e1f5 --- /dev/null +++ b/nvim/lua/plugins/diaglist.lua @@ -0,0 +1,24 @@ +return { + "JMarkin/diaglist.nvim", + -- dev = true, + -- enabled = false, + opts = { + debounce_ms = 130, + }, + keys = { + { + "E", + function() + require("diaglist").open_all_diagnostics() + end, + desc = "All Diagnostics", + }, + { + "e", + function() + require("diaglist").open_buffer_diagnostics() + end, + desc = "Buffer Diagnostics", + }, + }, +} diff --git a/nvim/lua/plugins/diffview.lua b/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..a09c863 --- /dev/null +++ b/nvim/lua/plugins/diffview.lua @@ -0,0 +1 @@ +return diff --git a/nvim/lua/plugins/easy_align.lua b/nvim/lua/plugins/easy_align.lua new file mode 100644 index 0000000..5646064 --- /dev/null +++ b/nvim/lua/plugins/easy_align.lua @@ -0,0 +1,19 @@ +return { + "junegunn/vim-easy-align", + keys = { + { "gl", "(EasyAlign)", mode = { "v", "x" }, noremap = false, desc = "EazyAlign" }, + { "gL", "(LiveEasyAlign)", mode = { "v", "x" }, noremap = false, desc = "EazyAlign Live" }, + }, + init = function() + vim.g.easy_align_delimiters = { + ["\\"] = { + pattern = [[\\\+]], + }, + ["/"] = { + pattern = [[//\+\|/\*\|\*/]], + delimiter_align = "c", + ignore_groups = "!Comment", + }, + } + end, +} diff --git a/nvim/lua/plugins/filemanager.lua b/nvim/lua/plugins/filemanager.lua new file mode 100644 index 0000000..d8e0a02 --- /dev/null +++ b/nvim/lua/plugins/filemanager.lua @@ -0,0 +1,110 @@ +vim.keymap.set("n", "f", "Oil", { noremap = true, desc = "Netrw: open" }) + +local detail = false + +-- Declare a global function to retrieve the current directory +function _G.get_oil_winbar() + local bufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid) + local dir = require("oil").get_current_dir(bufnr) + if dir then + return vim.fn.fnamemodify(dir, ":~") + else + -- If there is no current directory (e.g. over ssh), just show the buffer name + return vim.api.nvim_buf_get_name(0) + end +end + +vim.api.nvim_create_autocmd("User", { + pattern = "OilActionsPost", + callback = function(event) + if event.data.actions.type == "move" then + Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url) + end + end, +}) + +return { + { + "stevearc/oil.nvim", + ---@module 'oil' + ---@type oil.SetupOpts + opts = { + win_options = { + winbar = "%!v:lua.get_oil_winbar()", + }, + watch_for_changes = true, + use_default_keymaps = false, + keymaps = { + ["g?"] = { "actions.show_help", mode = "n" }, + ["q"] = { + desc = "close and restore prev buffer", + callback = function() + require("oil").close() + end, + }, + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true } }, + [""] = { "actions.select", opts = { horizontal = true } }, + [""] = { "actions.select", opts = { tab = true } }, + [""] = "actions.preview", + [""] = { "actions.close", mode = "n" }, + [""] = "actions.refresh", + ["-"] = { "actions.parent", mode = "n" }, + ["_"] = { "actions.open_cwd", mode = "n" }, + [""] = "actions.select", + [""] = { "actions.parent", mode = "n" }, + ["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" }, + ["s"] = { "actions.change_sort", mode = "n" }, + ["gh"] = { "actions.toggle_hidden", mode = "n" }, + ["gd"] = { + desc = "Toggle file detail view", + callback = function() + detail = not detail + if detail then + require("oil").set_columns({ "icon", "permissions", "size", "mtime" }) + else + require("oil").set_columns({ "icon" }) + end + end, + }, + }, + preview_win = { + -- A function that returns true to disable preview on a file e.g. to avoid lag + disable_preview = function(filename) + local funcs = require("funcs") + local path = filename + if not funcs.is_text(path) then + return true + end + + -- if file > 5 MB or not text -> not preview + local size = funcs.get_size(path) + if type(size) ~= "number" then + return true + end + + if size > 5 then + return true + end + + -- len + local len = funcs.maxline(path) + if type(len) ~= "number" then + return true + end + + if len > vim.o.synmaxcol then + return true + end + + return false + end, + -- Window-local options to use for preview window buffers + win_options = {}, + }, + }, + -- Optional dependencies + dependencies = { "echasnovski/mini.icons" }, + lazy = false, + }, +} diff --git a/nvim/lua/plugins/fzflua.lua b/nvim/lua/plugins/fzflua.lua new file mode 100644 index 0000000..f74aec1 --- /dev/null +++ b/nvim/lua/plugins/fzflua.lua @@ -0,0 +1,368 @@ +local autocmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup + +return { + "ibhagwan/fzf-lua", + cmd = "FzfLua", + lazy = true, + keys = { + { + "sq", + function() + require("fzf-lua").quickfix({ multiprocess = true }) + end, + desc = "Search: quickfix", + }, + { + "sr", + function() + require("fzf-lua").oldfiles({ + multiprocess = true, + cwd_only = true, + }) + end, + desc = "Search: old files", + }, + { + "sl", + function() + require("fzf-lua").loclist({ multiprocess = true }) + end, + desc = "Search: loclist", + }, + { + "ss", + function() + require("fzf-lua").resume({ multiprocess = true }) + end, + desc = "Search: previous", + }, + { + "sb", + function() + require("fzf-lua").buffers({ multiprocess = true, current_tab_only = true }) + end, + desc = "Search: buffers", + }, + { + "sf", + function() + require("fzf-lua").files({ multiprocess = true }) + end, + desc = "Search: find files", + }, + { + "sg", + function() + require("fzf-lua").grep_project({ multiprocess = true }) + end, + desc = "Search: project", + }, + { + "sg", + function() + require("fzf-lua").grep_visual({ multiprocess = true }) + end, + desc = "Search: project", + mode = "v", + }, + { + "grc", + function() + require("fzf-lua").grep_cword({ multiprocess = true }) + end, + desc = "Search: references", + }, + { + "grc", + function() + require("fzf-lua").grep_visual({ multiprocess = true }) + end, + desc = "Search: visual references", + mode = "v", + }, + { + "s/", + function() + require("fzf-lua").lgrep_curbuf({ multiprocess = true }) + end, + desc = "Search: current buffer", + }, + { + "st", + function() + require("fzf-lua").btags({ multiprocess = true, cwd = vim.uv.cwd() }) + end, + desc = "Search: tags current file", + }, + { + "sT", + function() + require("fzf-lua").tags({ multiprocess = true, cwd = vim.uv.cwd() }) + end, + desc = "Search: tags global", + }, + { + "sT", + function() + require("fzf-lua").tags_grep_visual({ multiprocess = true, cwd = vim.uv.cwd() }) + end, + desc = "Search: tags", + mode = "v", + }, + { + "sh", + function() + require("fzf-lua").help_tags({ multiprocess = true }) + end, + desc = "Search: helptags", + }, + { + "sc", + function() + require("fzf-lua").commands({ multiprocess = true }) + end, + desc = "Search: commands", + }, + { + "sk", + function() + require("fzf-lua").keymaps({ multiprocess = true }) + end, + desc = "Search: keymaps", + }, + { + "sch", + function() + require("fzf-lua").command_history({ multiprocess = true }) + end, + desc = "Search: command_history", + }, + { + "gt", + function() + require("fzf-lua").git_status({ multiprocess = true }) + end, + desc = "Search: git status", + }, + { + "gC", + function() + require("fzf-lua").git_commits({ multiprocess = true }) + end, + desc = "Search: git commits", + }, + { + "gc", + function() + require("fzf-lua").git_bcommits({ multiprocess = true }) + end, + desc = "Search: git commits", + }, + }, + config = function() + local actions = require("fzf-lua.actions") + require("fzf-lua").setup({ + -- fzf_bin = "sk", + async_or_timeout = 3000, + global_resume = false, + global_resume_query = false, + winopts = { + preview = { default = "builtin" }, + on_create = function() + vim.b.term_ignore = true + vim.keymap.set("t", "", "", { silent = true, buffer = true }) + vim.keymap.set("t", "", "", { silent = true, buffer = true }) + end, + }, + previewers = { + builtin = { + syntax = true, -- preview syntax highlight? + treesitter = { enabled = true, disabled = {} }, + }, + }, + keymap = { + builtin = { + [""] = "toggle-help", + [""] = "toggle-fullscreen", + [""] = "toggle-preview-wrap", + [""] = "toggle-preview", + [""] = "toggle-preview-ccw", + [""] = "toggle-preview-cw", + [""] = "preview-page-down", + [""] = "preview-page-up", + [""] = "preview-page-reset", + }, + fzf = { + ["ctrl-z"] = "abort", + ["ctrl-u"] = "unix-line-discard", + ["ctrl-f"] = "half-page-down", + ["ctrl-b"] = "half-page-up", + ["ctrl-a"] = "beginning-of-line", + ["alt-a"] = "toggle-all", + ["f3"] = "toggle-preview-wrap", + ["f4"] = "toggle-preview", + ["ctrl-d"] = "preview-page-down", + ["ctrl-e"] = "preview-page-up", + ["tab"] = "down", + ["shift-tab"] = "up", + ["ctrl-space"] = "toggle+down", + }, + }, + files = { + fd_opts = [[--color=never --hidden --type f --type l --exclude .git --strip-cwd-prefix ]], + -- fd_opts = [[--color=never --hidden --type f --type l --exclude .git ]], + actions = { + ["ctrl-g"] = { actions.toggle_ignore }, + ["tab"] = false, + ["enter"] = actions.file_edit_or_qf, + ["ctrl-s"] = actions.file_split, + ["ctrl-v"] = actions.file_vsplit, + ["ctrl-t"] = actions.file_tabedit, + ["alt-q"] = actions.file_sel_to_qf, + ["alt-Q"] = actions.file_sel_to_ll, + ["alt-i"] = actions.toggle_ignore, + ["alt-h"] = actions.toggle_hidden, + ["alt-f"] = actions.toggle_follow, + }, + }, + fzf_opts = { + ["--ansi"] = "", + -- ["--info"] = "inline", + -- ["--height"] = "100%", + -- ["--layout"] = "reverse", + -- ["--border"] = "none", + }, + lsp = { + code_actions = { + previewer = "codeaction_native", + preview_pager = [[delta --side-by-side --width=$COLUMNS --hunk-header-style="omit" --file-style="omit"]], + }, + }, + helptags = { + actions = { + -- Open help pages in a vertical split. + ["default"] = actions.help_vert, + }, + }, + oldfiles = { + include_current_session = true, + fzf_opts = { ["--tiebreak"] = "index" }, + }, + grep = { + rg_opts = "--multiline --column --line-number --no-heading --color=always --smart-case --max-columns=4096 -e", + }, + git = { + files = { + prompt = "GitFiles❯ ", + cmd = "git ls-files --exclude-standard", + multiprocess = true, -- run command in a separate process + -- force display the cwd header line regardles of your current working + -- directory can also be used to hide the header when not wanted + -- cwd_header = true + }, + status = { + prompt = "GitStatus❯ ", + cmd = "git -c color.status=false status -su", + previewer = "git_diff", + -- uncomment if you wish to use git-delta as pager + preview_pager = "delta --width=${FZF_PREVIEW_COLUMNS}", + actions = { + -- actions inherit from 'actions.files' and merge + ["right"] = { fn = actions.git_unstage, reload = true }, + ["left"] = { fn = actions.git_stage, reload = true }, + ["ctrl-x"] = { fn = actions.git_reset, reload = true }, + }, + -- If you wish to use a single stage|unstage toggle instead + -- using 'ctrl-s' modify the 'actions' table as shown below + -- actions = { + -- ["right"] = false, + -- ["left"] = false, + -- ["ctrl-x"] = { fn = actions.git_reset, reload = true }, + -- ["ctrl-s"] = { fn = actions.git_stage_unstage, reload = true }, + -- }, + }, + commits = { + prompt = "Commits❯ ", + cmd = "git log --color --pretty=format:'%C(yellow)%h%Creset %Cgreen(%><(12)%cr%><|(12))%Creset %s %C(blue)<%an>%Creset'", + preview = "git show --pretty='%Cred%H%n%Cblue%an <%ae>%n%C(yellow)%cD%n%Cgreen%s' --color {1}", + -- uncomment if you wish to use git-delta as pager + preview_pager = "delta --width=${FZF_PREVIEW_COLUMNS}", + actions = { + ["default"] = actions.git_checkout, + -- remove `exec_silent` or set to `false` to exit after yank + ["ctrl-y"] = { fn = actions.git_yank_commit, exec_silent = true }, + }, + }, + bcommits = { + prompt = "BCommits❯ ", + -- default preview shows a git diff vs the previous commit + -- if you prefer to see the entire commit you can use: + -- git show --color {1} --rotate-to= + -- {1} : commit SHA (fzf field index expression) + -- : filepath placement within the commands + cmd = "git log --color --pretty=format:'%C(yellow)%h%Creset %Cgreen(%><(12)%cr%><|(12))%Creset %s %C(blue)<%an>%Creset' ", + preview = "git diff --color {1}^! -- ", + -- uncomment if you wish to use git-delta as pager + preview_pager = "delta --width=${FZF_PREVIEW_COLUMNS}", + actions = { + ["default"] = actions.git_buf_edit, + ["ctrl-s"] = actions.git_buf_split, + ["ctrl-v"] = actions.git_buf_vsplit, + ["ctrl-t"] = actions.git_buf_tabedit, + ["ctrl-y"] = { fn = actions.git_yank_commit, exec_silent = true }, + }, + }, + branches = { + prompt = "Branches❯ ", + cmd = "git branch --all --color", + preview = "git log --graph --pretty=oneline --abbrev-commit --color {1}", + actions = { + ["default"] = actions.git_switch, + }, + }, + tags = { + prompt = "Tags> ", + cmd = "git for-each-ref --color --sort=-taggerdate --format " + .. "'%(color:yellow)%(refname:short)%(color:reset) " + .. "%(color:green)(%(taggerdate:relative))%(color:reset)" + .. " %(subject) %(color:blue)%(taggername)%(color:reset)' refs/tags", + preview = "git log --graph --color --pretty=format:'%C(yellow)%h%Creset " + .. "%Cgreen(%><(12)%cr%><|(12))%Creset %s %C(blue)<%an>%Creset' {1}", + fzf_opts = { ["--no-multi"] = "" }, + actions = { ["default"] = actions.git_checkout }, + }, + stash = { + prompt = "Stash> ", + cmd = "git --no-pager stash list", + preview = "git --no-pager stash show --patch --color {1}", + actions = { + ["default"] = actions.git_stash_apply, + ["ctrl-x"] = { fn = actions.git_stash_drop, reload = true }, + }, + fzf_opts = { + ["--no-multi"] = "", + ["--delimiter"] = "'[:]'", + }, + }, + }, + }) + require("fzf-lua").config.globals.fzf_opts["--border"] = nil + + local fzf = "FZF" + augroup(fzf, { clear = true }) + autocmd("VimResized", { + pattern = "*", + group = fzf, + command = 'lua require("fzf-lua").redraw()', + }) + + require("fzf-lua").register_ui_select() + end, + init = function() + vim.ui.select = function(...) + require("lazy").load({ plugins = { "fzf-lua" } }) + return vim.ui.select(...) + end + end, +} diff --git a/nvim/lua/plugins/git.lua b/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..a09c863 --- /dev/null +++ b/nvim/lua/plugins/git.lua @@ -0,0 +1 @@ +return diff --git a/nvim/lua/plugins/http.lua b/nvim/lua/plugins/http.lua new file mode 100644 index 0000000..efb7e52 --- /dev/null +++ b/nvim/lua/plugins/http.lua @@ -0,0 +1,44 @@ +return { + { + { + "mistweaverco/kulala.nvim", + -- from nix + dev = true, + keys = { + { "hr", desc = "Send request" }, + { "ha", desc = "Send all requests" }, + { "hb", desc = "Open scratchpad" }, + }, + ft = { "http", "rest" }, + opts = { + -- your configuration comes here + global_keymaps = { + ["Send request"] = { -- sets global mapping + "hr", + function() + require("kulala").run() + end, + mode = { "n", "v" }, -- optional mode, default is n + desc = "Send request", -- optional description, otherwise inferred from the key + }, + ["Send all requests"] = { + "ha", + function() + require("kulala").run_all() + end, + mode = { "n", "v" }, + ft = "http", -- sets mapping for *.http files only + }, + ["Replay the last request"] = { + "hl", + function() + require("kulala").replay() + end, + ft = { "http", "rest" }, -- sets mapping for specified file types + }, + ["Find request"] = false, -- set to false to disable + }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/joins.lua b/nvim/lua/plugins/joins.lua new file mode 100644 index 0000000..efc6031 --- /dev/null +++ b/nvim/lua/plugins/joins.lua @@ -0,0 +1,136 @@ +local function get_pos_lang(node) + local c = vim.api.nvim_win_get_cursor(0) + local range = { c[1] - 1, c[2], c[1] - 1, c[2] } + local buf = vim.api.nvim_get_current_buf() + local ok, parser = pcall(vim.treesitter.get_parser, buf, vim.treesitter.language.get_lang(vim.bo[buf].ft)) + if not ok then + return "" + end + local current_tree = parser:language_for_range(range) + return current_tree:lang() +end + +return { + { "echasnovski/mini.splitjoin", lazy = true }, + { + "Wansmer/treesj", + keys = { + { + "gS", + ":lua require('treesj').join()", + desc = "join lines", + silent = true, + }, + { + "gs", + ":lua require('treesj').split()", + desc = "split lines", + silent = true, + }, + { + "gm", + function() + local tsj_langs = require("treesj.langs")["presets"] + local lang = get_pos_lang() + if lang ~= "" and tsj_langs[lang] then + require("treesj").toggle() + else + require("mini.splitjoin").toggle() + end + end, + desc = "Toggle single/multiline by current position", + silent = true, + }, + { + "gM", + function() + require("treesj").toggle({ split = { recursive = true }, join = { recursive = true } }) + end, + desc = "Toggle single/multiline block of code", + }, + }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, -- if you install parsers with `nvim-treesitter` + config = function() + local langs = require("treesj.langs").presets + local lu = require("treesj.langs.utils") + + for _, nodes in pairs(langs) do + nodes.comment = { + both = { + fallback = function(_) + local res = require("mini.splitjoin").toggle() + if not res then + vim.cmd("normal! gww") + end + end, + }, + } + end + + local classnames = { + both = { + ---@param tsn TSNode + enable = function(tsn) + local parent = tsn:parent() + if not parent or parent:type() ~= "jsx_attribute" then + return false + end + + ---@diagnostic disable-next-line: param-type-mismatch (jsx_attribute with no children does not exist.) + local attr_name = vim.treesitter.get_node_text(parent:child(0), 0) + return attr_name == "className" + end, + }, + split = { + format_tree = function(tsj) + local str = tsj:child("string_fragment") + local words = vim.split(str:text(), " ") + tsj:remove_child("string_fragment") + for i, word in ipairs(words) do + tsj:create_child({ text = word }, i + 1) + end + end, + }, + } + + local parenthesized_expression = lu.set_preset_for_args() + + require("treesj").setup({ + max_join_length = 10000, + use_default_keymaps = false, + langs = { + tsx = { + ["string"] = classnames, + interface_declaration = { target_nodes = { "object_type" } }, + parenthesized_expression = parenthesized_expression, + jsx_expression = lu.set_default_preset(), + return_statement = { + target_nodes = { + ["jsx_element"] = "root_jsx_element", + "jsx_self_closing_element", + "parenthesized_expression", + }, + }, + -- Not realy name of node + root_jsx_element = lu.set_default_preset({ + split = { + format_tree = function(tsj) + -- TODO: checks if jsx_element is on one line + tsj:wrap({ left = "(", right = ")" }) + end, + }, + -- join = { + -- enable = false, + -- }, + }), + }, + javascript = { + ["string"] = classnames, + parenthesized_expression = parenthesized_expression, + jsx_expression = lu.set_default_preset(), + }, + }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/jumps.lua b/nvim/lua/plugins/jumps.lua new file mode 100644 index 0000000..d48625f --- /dev/null +++ b/nvim/lua/plugins/jumps.lua @@ -0,0 +1,170 @@ +return { + { + "jinh0/eyeliner.nvim", + keys = { "t", "f", "T", "F" }, + opts = { + highlight_on_key = true, + dim = true, + default_keymaps = false, + }, + }, + { + "mawkler/demicolon.nvim", + -- stylua: ignore start + keys = { + -- plugin + ";", ",", + -- t/T/f/F key mappings + -- "t", "f", "T", "F", + -- lezy load key mappings + "]", "[", + -- key mappings to jump to diganostics. See demicolon.keymaps.create_default_diagnostic_keymaps + "]d", "[d", + -- quickfix + -- "]q", "[q", "]", "[", + -- local list + -- "]l", "[l", "]", "]", + -- spell + "]s", "[s", + -- fold + "]z", "[z", + -- gitsign + "]c", "[c", + -- neotest + "]t", "[t", "]T", "[T", + -- textobject + "]f", "[f", "]a", "[a", "]m", "[m" + }, + -- stylua: ignore end + dependencies = { + "jinh0/eyeliner.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-treesitter/nvim-treesitter-textobjects", + }, + opts = { + -- Create default keymaps + keymaps = { + -- Create t/T/f/F key mappings + horizontal_motions = false, + -- Create ]d/[d, etc. key mappings to jump to diganostics. See demicolon.keymaps.create_default_diagnostic_keymaps + diagnostic_motions = false, + -- Create ; and , key mappings + repeat_motions = "stateful", + -- Create ]q/[q/]/[ and ]l/[l/]/[ quickfix and location list mappings + list_motions = false, + -- Create `]s`/`[s` key mappings for jumping to spelling mistakes + spell_motions = true, + -- Create `]z`/`[z` key mappings for jumping to folds + fold_motions = true, + }, + -- integrations = { + -- -- Integration with https://github.com/lewis6991/gitsigns.nvim + -- gitsigns = { + -- enabled = true, + -- keymaps = { + -- next = "]c", + -- prev = "[c", + -- }, + -- }, + -- -- Integration with https://github.com/nvim-neotest/neotest + -- neotest = { + -- enabled = true, + -- keymaps = { + -- test = { + -- next = "]t", + -- prev = "[t", + -- }, + -- failed_test = { + -- next = "]T", + -- prev = "[T", + -- }, + -- }, + -- }, + -- }, + }, + config = function(_, opts) + require("demicolon").setup(opts) + + local function eyeliner_jump(key) + local forward = vim.list_contains({ "t", "f" }, key) + return function() + require("eyeliner").highlight({ forward = forward }) + return require("demicolon.jump").horizontal_jump(key)() + end + end + + local nxo = { "n", "x", "o" } + local key_opts = { expr = true } + + vim.keymap.set(nxo, "f", eyeliner_jump("f"), key_opts) + vim.keymap.set(nxo, "F", eyeliner_jump("F"), key_opts) + vim.keymap.set(nxo, "t", eyeliner_jump("t"), key_opts) + vim.keymap.set(nxo, "T", eyeliner_jump("T"), key_opts) + end, + -- event = vim.g.post_load_events, + }, + { + "folke/flash.nvim", + enabled = true, + -- event = "VeryLazy", + ---@type Flash.Config + opts = { + modes = { + search = { + enabled = false, + }, + char = { + enabled = false, + }, + }, + label = { + rainbow = { + enabled = false, + }, + }, + exclude = { + "notify", + "cmp_menu", + "noice", + "flash_prompt", + function(win) + return require("largefiles").is_large_file(win.buf, true) + end, + }, + }, + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + { + "S", + mode = { "n", "o", "x" }, + function() + require("flash").treesitter() + end, + desc = "Flash Treesitter", + }, + { + "r", + mode = "o", + function() + require("flash").remote() + end, + desc = "Remote Flash", + }, + { + "R", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "Flash Treesitter Search", + }, + }, + }, +} diff --git a/nvim/lua/plugins/keyhelper.lua b/nvim/lua/plugins/keyhelper.lua new file mode 100644 index 0000000..a09c863 --- /dev/null +++ b/nvim/lua/plugins/keyhelper.lua @@ -0,0 +1 @@ +return diff --git a/nvim/lua/plugins/lang.lua b/nvim/lua/plugins/lang.lua new file mode 100644 index 0000000..e207819 --- /dev/null +++ b/nvim/lua/plugins/lang.lua @@ -0,0 +1,194 @@ +local fn = require("funcs") +local is_not_mini = require("funcs").is_not_mini + +return { + { + "mfussenegger/nvim-lint", + lazy = true, + enabled = true, + config = function() + require("lint").linters_by_ft = vim.g.linter_by_ft + require("lint").linters.sqlfluff.args = { + "lint", + "--format=json", + "--dialect=postgres", + } + end, + }, + { + "stevearc/conform.nvim", + cmd = { "ConformInfo" }, + config = function() + require("conform").setup({ + formatters_by_ft = vim.g.formatters_by_ft, + default_format_opts = { + lsp_format = "fallback", + }, + -- Customize formatters + formatters = { + sqlfluff = { + prepend_args = { "--dialect", "postgres" }, + }, + }, + }) + end, + }, + { + "folke/lazydev.nvim", + ft = "lua", + -- from nix + dev = true, + }, + { + "mrcjkb/rustaceanvim", + cond = is_not_mini, + lazy = false, + ft = { "rust" }, + -- from nix + dev = true, + }, + { + name = "clangd_extenstions", + url = "https://git.sr.ht/~p00f/clangd_extensions.nvim", + cond = is_not_mini, + lazy = true, + }, + { + url = "ray-x/go.nvim", + -- from nix + dev = true, + cond = is_not_mini, + opts = { + lsp_cfg = false, + diagnostic = false, + luasnip = false, + lsp_inlay_hints = { + enable = false, + }, + }, + config = function(_, opts) + require("go").setup(opts) + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + }, + { "b0o/schemastore.nvim", cond = is_not_mini, lazy = true }, + { + "ranelpadon/python-copy-reference.vim", + cond = is_not_mini, + ft = { "python" }, + init = function() + vim.g.python_remove_prefixes = { "src" } + end, + keys = { + { + "lcd", + ":PythonCopyReferenceDotted", + desc = "Copy as: Python Dotted", + }, + { + "lcp", + ":PythonCopyReferencePytest", + desc = "Copy as: Pytest", + }, + { + "lci", + ":PythonCopyReferenceImport", + desc = "Copy as: Python Import", + }, + }, + }, + { + "cuducos/yaml.nvim", + ft = { "yaml" }, -- optional + dependencies = { + "nvim-treesitter", + }, + }, + -- uncompiler + { + "p00f/godbolt.nvim", + config = function() + require("godbolt").setup() + end, + cmd = { "Godbolt", "GodboltCompiler" }, + }, + { + "nvimdev/phoenix.nvim", + enabled = false, + -- dev = true, + -- dir = "~/projects/phoenix.nvim", + init = function() + ---Default configuration values for Phoenix + ---@type PhoenixConfig + vim.g.phoenix = { + filetypes = { "*" }, + dict = { + capacity = 50000, -- Store up to 50k words + min_word_length = 2, -- Ignore single-letter words + word_pattern = "[^%s%.%_:%p%d]+", -- Word pattern + }, + -- snippet = vim.fn.stdpath("config") .. "/snippets", + } + end, + }, + { + "JMarkin/gentags.lua", + enabled = false, + -- dev = true, + -- dir = "~/projects/jmarkin/gentags.lua", + branch = "feat/neovim-0.10", + cond = vim.fn.executable("ctags") == 1, + event = "VeryLazy", + opts = { + autostart = true, + async = true, + args = { + "--extras=+r+q", + "--exclude=\\.*", + "--exclude=.mypy_cache", + "--exclude=.ruff_cache", + "--exclude=.pytest_cache", + "--exclude=dist", + "--exclude=target", + "--exclude=build", + "--exclude=.git", + "--exclude=node_modules*", + "--exclude=BUILD", + "--exclude=vendor*", + "--exclude=*.min.*", + "--exclude=__file__", + "--exclude=.devenv", + }, + }, + cmd = { + "GenCTags", + "GenTagsEnable", + "GenTagsDisable", + }, + }, + { + "chrisgrieser/nvim-scissors", + opts = { + snippetDir = vim.fn.stdpath("config") .. "/snippets", + jsonFormatter = "jq", + }, + keys = { + { + "Se", + function() + require("scissors").editSnippet() + end, + desc = "Snippet: Edit", + }, + { + "Sn", + function() + require("scissors").addNewSnippet() + end, + mode = { "n", "x", "v" }, + desc = "Snippet: New", + }, + }, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..46a4f80 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,17 @@ +local is_not_mini = require("funcs").is_not_mini + +return { + { + "neovim/nvim-lspconfig", + cond = is_not_mini, + event = vim.g.pre_load_events, + lazy = true, + }, + { + "j-hui/fidget.nvim", + event = "LspAttach", + opts = { + -- options + }, + }, +} diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..5b0469b --- /dev/null +++ b/nvim/lua/plugins/mini.lua @@ -0,0 +1,111 @@ +return { + { + "echasnovski/mini.icons", + event = "VeryLazy", + config = function() + require("mini.icons").setup() + MiniIcons.mock_nvim_web_devicons() + end, + }, + -- Fast and feature-rich surround actions. For text that includes + -- surrounding characters like brackets or quotes, this allows you + -- to select the text inside, change or modify the surrounding characters, + -- and more. + { + "echasnovski/mini.surround", + keys = function(_, keys) + -- Populate the keys based on the user's options + local plugin = require("lazy.core.config").spec.plugins["mini.surround"] + local opts = require("lazy.core.plugin").values(plugin, "opts", false) + -- stylua: ignore start + local mappings = { + { opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } }, + { opts.mappings.delete, desc = "Delete surrounding", mode = { "n" } }, + { opts.mappings.find, desc = "Find right surrounding" }, + { opts.mappings.find_left, desc = "Find left surrounding" }, + { opts.mappings.highlight, desc = "Highlight surrounding" }, + { opts.mappings.replace, desc = "Replace surrounding" }, + { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, + } + -- stylua: ignore end + mappings = vim.tbl_filter(function(m) + return m[1] and #m[1] > 0 + end, mappings) + return vim.list_extend(mappings, keys) + end, + opts = { + mappings = { + add = "gza", -- Add surrounding in Normal and Visual modes + delete = "gzd", -- Delete surrounding + find = "gzf", -- Find surrounding (to the right) + find_left = "gzF", -- Find surrounding to the left + highlight = "gzh", -- Highlight surrounding + replace = "gzr", -- Replace surrounding + update_n_lines = "gzn", -- Update `n_lines` + }, + }, + }, + { + "echasnovski/mini.ai", + event = "ModeChanged", + opts = { + -- Table with textobject id as fields, textobject specification as values. + -- Also use this to disable builtin textobjects. See |MiniAi.config|. + custom_textobjects = nil, + + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Main textobject prefixes + around = "a", + inside = "i", + + -- Next/last variants + around_next = "an", + inside_next = "in", + around_last = "al", + inside_last = "il", + + -- Move cursor to corresponding edge of `a` textobject + goto_left = "g[", + goto_right = "g]", + }, + + -- Number of lines within which textobject is searched + n_lines = 50, + + -- How to search for object (first inside current line, then inside + -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev', + -- 'cover_or_nearest', 'next', 'previous', 'nearest'. + search_method = "cover_or_next", + + -- Whether to disable showing non-error feedback + silent = false, + }, + }, + { + "echasnovski/mini.misc", + config = function() + local misc = require("mini.misc") + misc.setup() + misc.setup_auto_root(vim.g.root_pattern) + + local data = vim.fn.stdpath("data") + + vim.opt.shadafile = (function() + local cwd = require("funcs").shorten_path(vim.fn.getcwd()) + + local file = vim.fs.joinpath(data, "project_shada", cwd) + vim.fn.mkdir(vim.fs.dirname(file), "p") + + return file + end)() + + vim.opt.viewdir = data .. "/" .. "view" + + -- last position + misc.setup_restore_cursor({ + ignore_filetype = { "largefile", "gitcommit", "gitrebase", "svn", "hgcommit" }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/namu.lua b/nvim/lua/plugins/namu.lua new file mode 100644 index 0000000..317921c --- /dev/null +++ b/nvim/lua/plugins/namu.lua @@ -0,0 +1,30 @@ +return { + { + "bassamsdata/namu.nvim", + -- dev = true, + keys = { { "T", ":Namu ctags", desc = "Tagbar" } }, + cmd = { "Namu" }, + config = function() + require("namu").setup({ + -- Enable the modules you want + namu_symbols = { + enable = true, + options = { + row_position = "bottom10_right", + }, + }, + namu_ctags = { + enable = true, + options = { + row_position = "bottom10_right", + }, + }, + -- Optional: Enable other modules if needed + colorscheme = { + enable = false, + }, + ui_select = { enable = false }, -- vim.ui.select() wrapper + }) + end, + }, +} diff --git a/nvim/lua/plugins/neogen.lua b/nvim/lua/plugins/neogen.lua new file mode 100644 index 0000000..26aeb51 --- /dev/null +++ b/nvim/lua/plugins/neogen.lua @@ -0,0 +1,22 @@ +local is_not_mini = require("funcs").is_not_mini + +return { + "danymat/neogen", + cond = is_not_mini, + dependencies = "nvim-treesitter/nvim-treesitter", + config = function() + require("neogen").setup({ + enabled = true, + input_after_comment = true, + snippet_engine = "nvim", + }) + end, + cmd = "Neogen", + keys = { + { + "lD", + "Neogen", + desc = "Lang: generate docs", + }, + }, +} diff --git a/nvim/lua/plugins/pairs.lua b/nvim/lua/plugins/pairs.lua new file mode 100644 index 0000000..d0e37be --- /dev/null +++ b/nvim/lua/plugins/pairs.lua @@ -0,0 +1,25 @@ +return { + { + "saghen/blink.pairs", + enabled = true, + -- from nix + dev = true, + opts = { + mappings = { + -- you can call require("blink.pairs.mappings").enable() and require("blink.pairs.mappings").disable() to enable/disable mappings at runtime + enabled = true, + -- see the defaults: https://github.com/Saghen/blink.pairs/blob/main/lua/blink/pairs/config/mappings.lua#L10 + pairs = {}, + }, + highlights = { + enabled = true, + groups = vim.g.rainbow_delimiters_highlight, + matchparen = { + enabled = true, + group = "MatchParen", + }, + }, + debug = false, + }, + }, +} diff --git a/nvim/lua/plugins/quickfix.lua b/nvim/lua/plugins/quickfix.lua new file mode 100644 index 0000000..8edf5e4 --- /dev/null +++ b/nvim/lua/plugins/quickfix.lua @@ -0,0 +1,48 @@ +return { + { + "stevearc/quicker.nvim", + ft = "qf", + opts = { + keys = { + { + ">", + function() + require("quicker").expand({ before = 2, after = 2, add_to_existing = true }) + end, + desc = "Expand quickfix context", + }, + { + "<", + function() + require("quicker").collapse() + end, + desc = "Collapse quickfix context", + }, + }, + }, + keys = { + { + "Q", + function() + require("quicker").toggle() + end, + desc = "Toggle quickfix", + }, + { + "l", + function() + require("quicker").toggle({ loclist = true }) + end, + desc = "Toggle loclist", + }, + }, + }, + { + "kevinhwang91/nvim-bqf", + event = "VeryLazy", + opts = { + auto_enable = true, + auto_resize_height = true, + }, + }, +} diff --git a/nvim/lua/plugins/snackss.lua b/nvim/lua/plugins/snackss.lua new file mode 100644 index 0000000..6ba1774 --- /dev/null +++ b/nvim/lua/plugins/snackss.lua @@ -0,0 +1,77 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = false }, + dashboard = { enabled = false }, + explorer = { enabled = false }, + indent = { enabled = false }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 1000, + level = vim.log.levels.WARN, + }, + picker = { enabled = false }, + quickfile = { enabled = true }, + scope = { enabled = false }, + scroll = { enabled = false }, + statuscolumn = { + enabled = true, + folds = { + open = true, -- show open fold icons + git_hl = false, -- use Git Signs hl for fold icons + }, + refresh = 200, -- ms + }, + words = { enabled = false }, + styles = { + notification = { + wo = { wrap = true }, -- Wrap notifications + }, + }, + }, + keys = { + { + "bd", + desc = "Buffers: delete current", + function() + Snacks.bufdelete.delete() + end, + }, + { + "bc", + desc = "Buffers: delete other", + function() + Snacks.bufdelete.other() + end, + }, + { + "M", + desc = "Notifications", + function() + Snacks.notifier.show_history() + end, + }, + { + "N", + desc = "Neovim News", + function() + Snacks.win({ + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = "yes", + statuscolumn = " ", + conceallevel = 3, + }, + }) + end, + }, + }, +} diff --git a/nvim/lua/plugins/split_control.lua b/nvim/lua/plugins/split_control.lua new file mode 100644 index 0000000..4eb3540 --- /dev/null +++ b/nvim/lua/plugins/split_control.lua @@ -0,0 +1,25 @@ +return { + { + "mrjones2014/smart-splits.nvim", + event = "BufAdd", + opts = { + multiplexer_integration = "tmux", + }, + -- from nix + dev = true, + -- lazy = false, + keys = { + -- stylua: ignore start + { "", function(...) require("smart-splits").move_cursor_right(...) end, silent = true, desc = "right", mode = { "n", "t", "v" } }, + { "", function(...) require("smart-splits").move_cursor_down(...) end, silent = true, desc = "down", mode = { "n", "t", "v" }, }, + { "", function(...) require("smart-splits").move_cursor_up(...) end, silent = true, desc = "top", mode = { "n", "t", "v" }, }, + { "", function(...) require("smart-splits").move_cursor_left(...) end, silent = true, desc = "left", mode = { "n", "t", "v" }, }, + + { "", function(...) require("smart-splits").resize_right(...) end, silent = true, desc = "Resize right", mode = { "n", "t", "v" }, }, + { "", function(...) require("smart-splits").resize_down(...) end, silent = true, desc = "Resize down", mode = { "n", "t", "v" }, }, + { "", function(...) require("smart-splits").resize_up(...) end, silent = true, desc = "Resize up", mode = { "n", "t", "v" }, }, + { "", function(...) require("smart-splits").resize_left(...) end, silent = true, desc = "Resize left", mode = { "n", "t", "v" }, }, + -- stylua: ignore end + }, + }, +} diff --git a/nvim/lua/plugins/split_join.lua b/nvim/lua/plugins/split_join.lua new file mode 100644 index 0000000..2eaac03 --- /dev/null +++ b/nvim/lua/plugins/split_join.lua @@ -0,0 +1,126 @@ +local function get_pos_lang(node) + local c = vim.api.nvim_win_get_cursor(0) + local range = { c[1] - 1, c[2], c[1] - 1, c[2] } + local buf = vim.api.nvim_get_current_buf() + local ok, parser = pcall(vim.treesitter.get_parser, buf, vim.treesitter.language.get_lang(vim.bo[buf].ft)) + if not ok then + return "" + end + local current_tree = parser:language_for_range(range) + return current_tree:lang() +end + +return { + { "echasnovski/mini.splitjoin", lazy = true }, + { + "Wansmer/treesj", + keys = { + { "gj", ":lua require('treesj').join()", desc = "join lines", silent = true }, + { "gs", ":lua require('treesj').split()", desc = "split lines", silent = true }, + { + "gm", + function() + local tsj_langs = require("treesj.langs")["presets"] + local lang = get_pos_lang() + if lang ~= "" and tsj_langs[lang] then + require("treesj").toggle() + else + require("mini.splitjoin").toggle() + end + end, + desc = "Toggle single/multiline by current position", + silent = true, + }, + { + "gM", + function() + require("treesj").toggle({ split = { recursive = true }, join = { recursive = true } }) + end, + desc = "Toggle single/multiline block of code", + }, + }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, -- if you install parsers with `nvim-treesitter` + config = function() + local langs = require("treesj.langs").presets + local lu = require("treesj.langs.utils") + + for _, nodes in pairs(langs) do + nodes.comment = { + both = { + fallback = function(_) + local res = require("mini.splitjoin").toggle() + if not res then + vim.cmd("normal! gww") + end + end, + }, + } + end + + local classnames = { + both = { + ---@param tsn TSNode + enable = function(tsn) + local parent = tsn:parent() + if not parent or parent:type() ~= "jsx_attribute" then + return false + end + + ---@diagnostic disable-next-line: param-type-mismatch (jsx_attribute with no children does not exist.) + local attr_name = vim.treesitter.get_node_text(parent:child(0), 0) + return attr_name == "className" + end, + }, + split = { + format_tree = function(tsj) + local str = tsj:child("string_fragment") + local words = vim.split(str:text(), " ") + tsj:remove_child("string_fragment") + for i, word in ipairs(words) do + tsj:create_child({ text = word }, i + 1) + end + end, + }, + } + + local parenthesized_expression = lu.set_preset_for_args() + + require("treesj").setup({ + max_join_length = 10000, + use_default_keymaps = false, + langs = { + tsx = { + ["string"] = classnames, + interface_declaration = { target_nodes = { "object_type" } }, + parenthesized_expression = parenthesized_expression, + jsx_expression = lu.set_default_preset(), + return_statement = { + target_nodes = { + ["jsx_element"] = "root_jsx_element", + "jsx_self_closing_element", + "parenthesized_expression", + }, + }, + -- Not realy name of node + root_jsx_element = lu.set_default_preset({ + split = { + format_tree = function(tsj) + -- TODO: checks if jsx_element is on one line + tsj:wrap({ left = "(", right = ")" }) + end, + }, + -- join = { + -- enable = false, + -- }, + }), + }, + javascript = { + ["string"] = classnames, + parenthesized_expression = parenthesized_expression, + jsx_expression = lu.set_default_preset(), + }, + }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/statusline.lua b/nvim/lua/plugins/statusline.lua new file mode 100644 index 0000000..30716a8 --- /dev/null +++ b/nvim/lua/plugins/statusline.lua @@ -0,0 +1,21 @@ +return { + { + "nanozuki/tabby.nvim", + event = "TabNew", + config = function() + require("tabby").setup({ + option = { + lualine_theme = vim.g.lualine_theme or nil, + buf_name = { mode = "tail" }, + }, + }) + end, + }, + { + "echasnovski/mini.statusline", + event = vim.g.post_load_events, + config = function() + require("mini.statusline").setup() + end, + }, +} diff --git a/nvim/lua/plugins/syntax.lua b/nvim/lua/plugins/syntax.lua new file mode 100644 index 0000000..c1fc1b4 --- /dev/null +++ b/nvim/lua/plugins/syntax.lua @@ -0,0 +1,12 @@ +return { + { + "sheerun/vim-polyglot", + event = vim.g.pre_load_events, + init = function() + vim.cmd([[ + syntax on + ]]) + vim.g.polyglot_disabled = { "ftdetect", "autoindent" } + end, + }, +} diff --git a/nvim/lua/plugins/term.lua b/nvim/lua/plugins/term.lua new file mode 100644 index 0000000..71f09b9 --- /dev/null +++ b/nvim/lua/plugins/term.lua @@ -0,0 +1,15 @@ +return { + { + "willothy/flatten.nvim", + version = "0.5.1", + enabled = true, + config = true, + opts = { + window = { + open = "tab", + }, + }, + lazy = false, + priority = 1001, + }, +} diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..e983697 --- /dev/null +++ b/nvim/lua/plugins/ui.lua @@ -0,0 +1,153 @@ +return { + -- ui components + { "MunifTanjim/nui.nvim", lazy = true }, + { + "ibhagwan/smartyank.nvim", + enabled = true, + event = "ModeChanged", + opts = { + highlight = { + enabled = true, -- highlight yanked text + timeout = 100, + }, + }, + config = function(_, opts) + require("smartyank").setup(opts) + vim.api.nvim_create_autocmd("FocusGained", { + callback = function() + local loaded_content = vim.fn.getreg("+") + if loaded_content ~= "" then + vim.fn.setreg('"', loaded_content) + end + end, + }) + end, + }, + + { + "DanilaMihailov/beacon.nvim", + -- enabled = false, + cond = function() + return not vim.g.neovide + end, + opts = { + enabled = function() + local line_count = vim.api.nvim_buf_line_count(vim.api.nvim_get_current_buf()) + if line_count > 1000 then + return false + end + return true + end, --- (boolean | fun():boolean) check if enabled + speed = 2, --- integer speed at wich animation goes + width = 40, --- integer width of the beacon window + winblend = 70, --- integer starting transparency of beacon window :h winblend + fps = 60, --- integer how smooth the animation going to be + min_jump = 10, --- integer what is considered a jump. Number of lines + cursor_events = { "CursorMoved" }, -- table what events trigger check for cursor moves + window_events = { "WinEnter", "FocusGained" }, -- table what events trigger cursor highlight + highlight = { bg = "white", ctermbg = 15 }, -- vim.api.keyset.highlight table passed to vim.api.nvim_set_hl + }, + event = { "BufAdd" }, + }, + { + "tzachar/local-highlight.nvim", + lazy = true, + -- enabled = false, + opts = { + insert_mode = false, + file_types = {}, + hlgroup = "LocalHighlight", + }, + init = function() + local fn = require("funcs") + local lf = require("largefiles") + vim.api.nvim_set_hl(0, "LocalHighlight", { underline = true }) + + fn.augroup("local-highlight-attach", { + vim.g.post_load_events, + { + pattern = "*", + callback = function(data) + if not lf.is_large_file(data.buf, true) then + require("local-highlight").attach(data.buf) + end + end, + }, + }) + end, + }, + { + "lewis6991/whatthejump.nvim", + -- enabled = false, + keys = { "", "" }, + }, + { + "MeanderingProgrammer/render-markdown.nvim", + enabled = false, + ft = { "markdown", "codecompanion", "Avante" }, + opts = { + render_modes = true, + file_types = { "markdown", "Avante", "codecompanion", "rmd" }, + completions = { lsp = { enabled = true } }, + debounce = 200, + code = { + style = "language", + highlight = nil, + highlight_inline = nil, + }, + }, + }, + { + "ramilito/winbar.nvim", + event = "BufAdd", + opts = { + -- your configuration comes here, for example: + icons = true, + filetype_exclude = { + "vista", + "dbui", + "help", + "startify", + "dashboard", + "packer", + "neo-tree", + "neogitstatus", + "NvimTree", + "Trouble", + "alpha", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "TelescopePrompt", + "prompt", + "httpResult", + "rest_nvim_result", + "netrw", + "kulala_ui", + "AvanteInput", + "AvanteSelectedFiles", + "Avante", + "better_term", + "oil", + "DiffviewFiles", + }, + background_color = "DiagnosticHint", + diagnostics = true, + buf_modified = true, + dir_levels = 2, + -- buf_modified_symbol = "M", + -- or use an icon + buf_modified_symbol = "●", + dim_inactive = { + enabled = true, + highlight = "WinbarNC", + icons = true, -- whether to dim the icons + name = true, -- whether to dim the name + }, + exclude_if = function() + return vim.b.no_winbar == true + end, + }, + }, +} diff --git a/nvim/lua/plugins/unsorted.lua b/nvim/lua/plugins/unsorted.lua new file mode 100644 index 0000000..94e69af --- /dev/null +++ b/nvim/lua/plugins/unsorted.lua @@ -0,0 +1,33 @@ +return { + -- sudo + { + "lambdalisue/suda.vim", + cmd = { "SudaRead", "SudaWrite" }, + }, + { + "gbprod/stay-in-place.nvim", + opts = { + set_keymaps = true, + preserve_visual_selection = true, + }, + event = "ModeChanged", + }, + + { + "m4xshen/hardtime.nvim", + event = "VeryLazy", + enabled = false, + dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + opts = { + disabled_filetypes = { "qf", "netrw", "NvimTree", "lazy", "mason", "dashboard", "vista", "vista_kind", "oil" }, + disable_mouse = true, + restriction_mode = "hint", + disabled_keys = { + [""] = { "n" }, + [""] = { "n" }, + [""] = { "n" }, + [""] = { "n" }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/windows.lua b/nvim/lua/plugins/windows.lua new file mode 100644 index 0000000..507f4a9 --- /dev/null +++ b/nvim/lua/plugins/windows.lua @@ -0,0 +1,53 @@ +return { + { + "yorickpeterse/nvim-window", + keys = { + { + "w", + function() + require("nvim-window").pick() + end, + silent = true, + desc = "Windows: pick", + mode = { "n", "v" }, + }, + }, + }, + { + "ycdzj/win-mover.nvim", + keys = { + { + "m", + function(ev) + return require("win-mover").enter_move_mode(ev) + end, + desc = "Window: mover", + }, + }, + config = function() + local win_mover = require("win-mover") + win_mover.setup({ + ignore = { + enable = true, + filetypes = { "vista" }, + }, + move_mode = { + keymap = { + h = win_mover.ops.move_left, + j = win_mover.ops.move_down, + k = win_mover.ops.move_up, + l = win_mover.ops.move_right, + + H = win_mover.ops.move_far_left, + J = win_mover.ops.move_far_down, + K = win_mover.ops.move_far_up, + L = win_mover.ops.move_far_right, + + q = win_mover.ops.quit, + [""] = win_mover.ops.quit, + }, + }, + }) + end, + }, +} diff --git a/nvim/lua/terminal.lua b/nvim/lua/terminal.lua new file mode 100644 index 0000000..e0311ae --- /dev/null +++ b/nvim/lua/terminal.lua @@ -0,0 +1,109 @@ +local Terminal = {} + +Terminal.close_augroup = "close_augroup" + +Terminal.set_keymaps = function(winnr, bufnr) + local opts = { buffer = bufnr } + + vim.keymap.set("t", "", [[]], opts) + vim.keymap.set("t", "", [[h]], opts) + vim.keymap.set("t", "", [[j]], opts) + vim.keymap.set("t", "", [[k]], opts) + vim.keymap.set("t", "", [[l]], opts) + + vim.keymap.set("t", "", [[]], opts) + + vim.keymap.set({ "n" }, { "", "q", "q" }, function() + vim.api.nvim_win_close(winnr, true) + end, opts) + vim.keymap.set({ "t" }, { "" }, function() + vim.api.nvim_win_close(winnr, true) + end, opts) +end + +Terminal.configure = function() + local opts = { + swapfile = false, + buflisted = false, + relativenumber = false, + number = false, + readonly = true, + scl = "no", + statuscolumn = "", + cursorline = false, + cursorcolumn = false, + winfixbuf = false, + winfixheight = true, + winfixwidth = true, + } + for key, value in pairs(opts) do + vim.opt_local[key] = value + end +end + +local au_id = vim.api.nvim_create_augroup("terminal_nvim", { clear = true }) + +vim.api.nvim_create_autocmd({ "WinEnter", "BufWinEnter", "TermOpen" }, { + group = au_id, + callback = function(args) + if vim.startswith(vim.api.nvim_buf_get_name(args.buf), "term://") then + vim.cmd("startinsert!") + end + end, +}) + +local function close_tab_if_empty() + local tab = vim.api.nvim_get_current_tabpage() + local wins = vim.api.nvim_tabpage_list_wins(tab) + if #wins == 0 then + vim.cmd("tabclose") + else + vim.cmd("q") + end +end + +vim.api.nvim_create_autocmd({ "TermOpen" }, { + callback = function(params) + if vim.b[params.buf]["term_ignore"] == true then + return + end + Terminal.configure() + local winnr = vim.api.nvim_get_current_win() + Terminal.set_keymaps(winnr, params.buf) + + vim.api.nvim_create_autocmd({ "TermClose" }, { + callback = function() + vim.schedule(function() + vim.api.nvim_buf_delete(params.buf, { force = true }) + close_tab_if_empty() + end) + vim.cmd("let &stl = &stl") -- redrawstatus | redrawtabline + end, + group = au_id, + desc = "on_term_close", + buffer = params.buf, + }) + end, + group = au_id, + desc = "on_term_open", +}) + +Terminal.open = function(command, split_dir) + if command == "" or command == nil then + local shell = vim.o.shell + + command = shell + end + + if split_dir == "" or split_dir == nil then + split_dir = "tabnew" + end + + vim.cmd(split_dir .. " | redraw! | terminal " .. command) + + local bufnr = vim.api.nvim_get_current_buf() + + return bufnr +end + +return Terminal diff --git a/nvim/plugin/ai.lua b/nvim/plugin/ai.lua new file mode 100644 index 0000000..d9b28d4 --- /dev/null +++ b/nvim/plugin/ai.lua @@ -0,0 +1,20 @@ +if vim.g.did_load_ai_plugin then + return +end +vim.g.did_load_ai_plugin = true + +local g = vim.g + +g.ollama_host = vim.env.OLLAMA_HOST or "localhost" +g.ollama_port = vim.env.OLLAMA_PORT or "11434" +g.ollama_url = string.format("http://%s:%s", g.ollama_host, g.ollama_port) +g.ollama_generate_endpoint = string.format("%s/api/generate", g.ollama_url) +g.ollama_chat_endpoint = string.format("%s/api/chat", g.ollama_url) +g.ollama_completions_endpoint = string.format("%s/api/generate", g.ollama_url) + +g.airun_url = vim.env.AI_RUN_URL +g.airun_endpoint = string.format("%s/v1", g.airun_url) +g.airun_chat_endpoint = string.format("%s/v1/chat", g.airun_url) +g.airun_model = vim.env.AI_RUN_MODEL +g.airun_autocomplete_model = vim.env.AI_RUN_AUOTOCOMPLETE_MODEL +g.airun_embedded_model = vim.env.AI_RUN_EMBEDDED_MODEL diff --git a/nvim/plugin/autocommands.lua b/nvim/plugin/autocommands.lua new file mode 100644 index 0000000..68a07ba --- /dev/null +++ b/nvim/plugin/autocommands.lua @@ -0,0 +1,237 @@ +if vim.g.did_load_autocommands_plugin then + return +end +vim.g.did_load_autocommands_plugin = true + +local fn = require("funcs") + +-- Show cursor line only in active window. +-- https://github.com/folke/dot/blob/master/nvim/lua/config/autocmds.lua + +fn.augroup("cursoronlyactivate", { + { "InsertLeave", "WinEnter" }, + { + callback = function() + if vim.wo.previewwindow then + return + end + + if vim.w.auto_cursorline then + vim.wo.cursorline = true + vim.w.auto_cursorline = false + end + end, + }, +}, { + { "InsertEnter", "WinLeave" }, + { + callback = function() + if vim.wo.previewwindow then + return + end + + if vim.wo.cursorline then + vim.w.auto_cursorline = true + vim.wo.cursorline = false + end + end, + }, +}) + +-- fastsyntax +fn.augroup("fastsyntax", { + { "BufWinEnter", "Syntax" }, + { + pattern = "*", + command = "syn sync minlines=256 maxlines=256", + }, +}) + +fn.augroup("omnifuncsetter", { + { "FileType" }, + { + pattern = "*", + callback = function() + if vim.opt.omnifunc == "" then + vim.opt_local.omnifunc = "syntaxcomplete#Complete" + end + end, + }, +}) + +-- Persistent Folds +fn.augroup("auto_view", { + { "BufWinLeave", "BufWritePost", "WinLeave" }, + { + desc = "Save view with mkview for real files", + callback = function(args) + if vim.b[args.buf].view_activated then + vim.cmd.mkview({ mods = { emsg_silent = true } }) + end + end, + }, +}, { + "BufWinEnter", + { + desc = "Try to load file view if available and enable view saving for real files", + callback = function(args) + if not vim.b[args.buf].view_activated then + local filetype = vim.api.nvim_get_option_value("filetype", { buf = args.buf }) + local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf }) + local ignore_filetypes = { "gitcommit", "gitrebase", "svg", "hgcommit" } + if buftype == "" and filetype and filetype ~= "" and not vim.tbl_contains(ignore_filetypes, filetype) then + vim.b[args.buf].view_activated = true + vim.cmd.loadview({ mods = { emsg_silent = true } }) + end + end + end, + }, +}) + +-- Use 'q' to quit from common plugins +fn.augroup("quit", { + "FileType", + { + pattern = { + "help", + "man", + "lspinfo", + "trouble", + "null-ls-info", + "qf", + "notify", + "startuptime", + "checkhealth", + "neotest-output", + "neotest-output-panel", + "neotest-summary", + "vista_kind", + "sagaoutline", + "PlenaryTestPopup", + "dbout", + "gitsigns-blame", + "grug-far", + "spectre_panel", + "tsplayground", + }, + callback = function(event) + vim.opt_local.wrap = false + vim.bo[event.buf].buflisted = false + vim.schedule(function() + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end) + end, + }, +}) + +fn.augroup("spell", { + "FileType", + { + pattern = { "gitcommit", "markdown", "text" }, + callback = function() + vim.opt_local.spell = true + end, + }, +}) + +fn.augroup("tempfile", { + { "BufWritePre" }, + { + pattern = { "/tmp/*", "COMMIT_EDITMSG", "MERGE_MSG", "*.tmp", "*.bak" }, + command = "setlocal noundofile", + }, +}) + +-- largefiles + +-- nubmer toggles + +vim.defer_fn(function() + if vim.g.numbertoggle then + fn.augroup("NumberToggle", { + { "InsertLeave", "CmdlineLeave" }, + { + callback = function(event) + if vim.b.numbertoggle_disabled == 1 then + return + end + if + vim.bo[event.buf].buflisted + and vim.opt_local.number + and vim.api.nvim_get_mode().mode ~= "i" + and string.find(vim.fn.bufname(event.buf), "term://") == nil + then + vim.opt.relativenumber = true + end + end, + }, + }, { + { "InsertEnter", "CmdlineEnter" }, + { + callback = function(event) + if vim.b.numbertoggle_disabled == 1 then + return + end + if + vim.bo[event.buf].buflisted + and vim.opt_local.number + and string.find(vim.fn.bufname(event.buf), "term://") == nil + then + vim.opt.relativenumber = false + vim.cmd("redraw!") + end + end, + }, + }) + end +end, 100) + +fn.augroup("Format Options", { + "BufReadPost", + { + callback = function() + vim.opt_local.formatoptions = vim.opt_local.formatoptions + - "a" -- Auto formatting is BAD. + - "t" -- Don't auto format my code. I got linters for that. + + "c" -- In general, I like it when comments respect textwidth + + "q" -- Allow formatting comments w/ gq + - "o" -- O and o, don't continue comments + + "r" -- But do continue when pressing enter. + + "n" -- Indent past the formatlistpat, not underneath it. + - "2" -- I'm not in gradeschool anymore + + "j" -- Auto-remove comments if possible. + + "p" -- I want under stand shorts + end, + }, +}) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +fn.augroup("autocreatedir", { + { "BufWritePre" }, + { + callback = function(event) + if event.match:match("^%w%w+://") then + return + end + local file = vim.uv.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, + }, +}) + +-- Check if we need to reload the file when it changed +fn.augroup("checktime", { + { "BufEnter", "CursorHold", "CursorHoldI", "FocusGained", "TermLeave", "TermClose" }, + { + command = "if &buftype == '' && mode() != 'c' && getcmdwintype() == '' | checktime | endif", + pattern = { "*" }, + }, +}) + +if vim.env.TERM == "alacritty" then + vim.api.nvim_create_autocmd("ExitPre", { + once = true, + command = "set guicursor=a:ver90", + desc = "Set cursor back to beam when leaving Neovim.", + }) +end diff --git a/nvim/plugin/blink.lua b/nvim/plugin/blink.lua new file mode 100644 index 0000000..9313e70 --- /dev/null +++ b/nvim/plugin/blink.lua @@ -0,0 +1,195 @@ +if vim.g.did_load_blink_plugin then + return +end +vim.g.did_load_blink_plugin = true + +local funcs = require("funcs") +local lf = require("largefiles") + +require("lze").load({ + "friendly-snippets", + "neogen", + "colorful-menu.nvim", + + -- cmp compact + { + "blink.compat", + after = function() + require("blink.compat").setup({ impersonate_nvim_cmp = true }) + end, + }, + "cmp-diag-codes", + "cmp-nvim-tags", +}) + +require("lze").load({ + "blink.cmp", + event = { "InsertEnter", "CmdlineEnter" }, + after = function() + local blink = require("blink-cmp") + local opts = { + cmdline = { + enabled = true, + completion = { menu = { auto_show = false } }, + keymap = { + [""] = { "accept_and_enter", "fallback" }, + }, + }, + keymap = { + preset = "default", + [""] = { "hide" }, + [""] = { "show_documentation", "hide_documentation" }, + + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + [""] = {}, + + [""] = { + function() + blink.show({ providers = { "path" } }) + end, + }, + [""] = { + function() + blink.show({ providers = { "tags" } }) + end, + }, + [""] = { + function() + blink.show({ providers = { "lsp" } }) + end, + }, + }, + completion = { + keyword = { range = "full" }, + accept = { + dot_repeat = false, + }, + ghost_text = { + enabled = true, + }, + trigger = { + show_in_snippet = true, + show_on_keyword = true, + show_on_trigger_character = true, + show_on_insert_on_trigger_character = true, + show_on_accept_on_trigger_character = true, + }, + list = { + selection = { + preselect = false, + auto_insert = true, + }, + }, + }, + + sources = { + default = function(ctx) + if lf.is_large_file(vim.api.nvim_get_current_buf(), true) then + return { "tags", "omni" } + elseif funcs.in_treesitter_capture("comment") or funcs.in_syntax_group("Comment") then + return { "diag-codes", "buffer", "snippets", "lsp" } + end + return { "lsp", "buffer", "snippets" } + end, + per_filetype = { + sql = { "dadbod", "buffer", "snippets" }, + lua = { inherit_defaults = true, "lazydev" }, + codecompanion = { inherit_defaults = true, "codecompanion" }, + AvanteInput = { inherit_defaults = true, "avante" }, + }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, + tags = { + name = "tags", + module = "blink.compat.source", + score_offset = -2, + opts = { + exact_match = true, + current_buffer_only = false, + }, + }, + ["diag-codes"] = { + name = "diag-codes", + module = "blink.compat.source", + score_offset = 100, + opts = { + in_comment = false, + }, + }, + }, + }, + fuzzy = { + prebuilt_binaries = { + download = false, + }, + }, + } + opts.completion.menu = { + draw = { + -- We don't need label_description now because label and label_description are already + -- conbined together in label by colorful-menu.nvim. + columns = { { "kind_icon" }, { "label", gap = 1 }, { "source_name" } }, + components = { + label = { + width = { fill = true, max = 60 }, + text = function(ctx) + local highlights_info = require("colorful-menu").blink_highlights(ctx) + if highlights_info ~= nil then + return highlights_info.label + else + return ctx.label + end + end, + highlight = function(ctx) + local highlights = {} + local highlights_info = require("colorful-menu").blink_highlights(ctx) + if highlights_info ~= nil then + highlights = highlights_info.highlights + end + for _, idx in ipairs(ctx.label_matched_indices) do + table.insert(highlights, { idx, idx + 1, group = "BlinkCmpLabelMatch" }) + end + -- Do something else + return highlights + end, + }, + }, + }, + } + + local ok, _ = pcall(require, "minuet") + if ok then + opts.keymap[""] = require("minuet").make_blink_map() + + opts.sources.providers.minuet = { + name = "minuet", + module = "minuet.blink", + async = true, + -- Should match minuet.config.request_timeout * 1000, + -- since minuet.config.request_timeout is in seconds + timeout_ms = 3000, + score_offset = 50, -- Gives minuet higher priority among suggestions + } + end + + ok, _ = pcall(require, "blink-cmp-avante") + if ok then + opts.sources.providers.avante = { + module = "blink-cmp-avante", + name = "Avante", + opts = { + -- options for blink-cmp-avante + }, + } + end + + blink.setup(opts) + end, +}) diff --git a/nvim/plugin/commands.lua b/nvim/plugin/commands.lua new file mode 100644 index 0000000..b4c6271 --- /dev/null +++ b/nvim/plugin/commands.lua @@ -0,0 +1,82 @@ +if vim.g.did_load_commands_plugin then + return +end +vim.g.did_load_commands_plugin = true + +vim.api.nvim_create_user_command("Jaq", function(opts) + local bufnr = vim.api.nvim_get_current_buf() + local path = vim.api.nvim_buf_get_name(bufnr) + + if #opts.fargs > 0 then + path = path + end + + local fzflua = require("fzf-lua") + + local function jaq_fzf(jaq_query) + fzflua.fzf_exec(string.format("jaq -c '%s' %s", jaq_query, path), { + multiprocess = true, + prompt = string.format("%s > ", jaq_query), + fzf_opts = { + ["--preview"] = "echo -e {} | fixjson | bat --style numbers", + }, + actions = { + ---@diagnostic disable-next-line: unused-local + ["default"] = function(selected, _opts) + fzflua.grep_curbuf({ + multiprocess = true, + search = selected[1], + }) + end, + }, + fn_transform = function(x) + if x == "null" then + return + end + return x + end, + }) + end + + fzflua.fzf_live(string.format("jaq -c '' %s", path), { + multiprocess = true, + prompt = "jaq> ", + fzf_opts = { + ["--preview"] = "echo -e {} | fixjson | bat --style numbers", + }, + actions = { + ---@diagnostic disable-next-line: unused-local + ["default"] = function(_selected, _opts) + jaq_fzf(fzflua.get_last_query()) + end, + }, + fn_transform = function(x) + if x == "null" then + return + end + return x + end, + }) +end, { + nargs = "*", +}) + +vim.api.nvim_create_user_command("CDC", function(_) + vim.cmd([[lcd %:p:h]]) +end, {}) + +vim.api.nvim_create_user_command("UnicodeUndoEscape", function(_) + vim.cmd([[:%s/\\u\(\x\{4\}\)/\=nr2char('0x'.submatch(1),1)/g]]) +end, {}) + +vim.api.nvim_create_user_command("DevenvUP", function() + local term = require("terminal") + local bufnr = term.open("devenv up", nil) + vim.keymap.set("t", "", [[^]], { buffer = bufnr }) + vim.keymap.set("t", "", [[^]], { buffer = bufnr }) +end, {}) + +vim.api.nvim_create_user_command("DevenvTest", function() + local term = require("terminal") + term.open("devenv test", "vsplit") +end, {}) diff --git a/nvim/plugin/filemanager.lua b/nvim/plugin/filemanager.lua new file mode 100644 index 0000000..0abe26f --- /dev/null +++ b/nvim/plugin/filemanager.lua @@ -0,0 +1,107 @@ +if vim.g.did_load_filemanager_plugin then + return +end +vim.g.did_load_filemanager_plugin = true + +local oil = require("oil") +local funcs = require("funcs") + +vim.keymap.set("n", "f", "Oil", { noremap = true, desc = "Netrw: open" }) + +local detail = false + +-- Declare a global function to retrieve the current directory +function _G.get_oil_winbar() + local bufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid) + local dir = oil.get_current_dir(bufnr) + if dir then + return vim.fn.fnamemodify(dir, ":~") + else + -- If there is no current directory (e.g. over ssh), just show the buffer name + return vim.api.nvim_buf_get_name(0) + end +end + +vim.api.nvim_create_autocmd("User", { + pattern = "OilActionsPost", + callback = function(event) + if event.data.actions.type == "move" then + Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url) + end + end, +}) + +oil.setup({ + win_options = { + winbar = "%!v:lua.get_oil_winbar()", + }, + watch_for_changes = true, + use_default_keymaps = false, + keymaps = { + ["g?"] = { "actions.show_help", mode = "n" }, + ["q"] = { + desc = "close and restore prev buffer", + callback = function() + oil.close() + end, + }, + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true } }, + [""] = { "actions.select", opts = { horizontal = true } }, + [""] = { "actions.select", opts = { tab = true } }, + [""] = "actions.preview", + [""] = { "actions.close", mode = "n" }, + [""] = "actions.refresh", + ["-"] = { "actions.parent", mode = "n" }, + ["_"] = { "actions.open_cwd", mode = "n" }, + [""] = "actions.select", + [""] = { "actions.parent", mode = "n" }, + ["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" }, + ["s"] = { "actions.change_sort", mode = "n" }, + ["gh"] = { "actions.toggle_hidden", mode = "n" }, + ["gd"] = { + desc = "Toggle file detail view", + callback = function() + detail = not detail + if detail then + oil.set_columns({ "icon", "permissions", "size", "mtime" }) + else + oil.set_columns({ "icon" }) + end + end, + }, + }, + preview_win = { + -- A function that returns true to disable preview on a file e.g. to avoid lag + disable_preview = function(filename) + local path = filename + if not funcs.is_text(path) then + return true + end + + -- if file > 5 MB or not text -> not preview + local size = funcs.get_size(path) + if type(size) ~= "number" then + return true + end + + if size > 5 then + return true + end + + -- len + local len = funcs.maxline(path) + if type(len) ~= "number" then + return true + end + + if len > vim.o.synmaxcol then + return true + end + + return false + end, + -- Window-local options to use for preview window buffers + win_options = {}, + }, +}) diff --git a/nvim/plugin/fold.lua b/nvim/plugin/fold.lua new file mode 100644 index 0000000..8459335 --- /dev/null +++ b/nvim/plugin/fold.lua @@ -0,0 +1,129 @@ +if vim.g.did_load_fold_plugin then + return +end +vim.g.did_load_fold_plugin = true + +local fn = require("funcs") + +vim.o.foldenable = true +vim.o.foldlevel = 99 +-- vim.o.foldmethod = "marker" +vim.o.foldmethod = "expr" +vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.o.foldtext = "" +vim.opt.foldcolumn = "0" + +vim.opt.fillchars:append({ + fold = "·", + foldsep = " ", +}) + +if vim.g.modern_ui then + vim.opt.fillchars:append({ + foldopen = "", + foldclose = "", + }) +end + +local function setfold(_buf, func) + local win = vim.api.nvim_get_current_win() + func(win) +end + +local function undofoldexpr(buf) + setfold(buf, function() + vim.cmd([[setl foldmethod<]]) + vim.cmd([[setl foldexpr<]]) + end) +end + +local function undofoldmarker(buf) + setfold(buf, function() + vim.cmd([[setl foldmethod<]]) + vim.cmd([[setl foldexpr<]]) + end) +end + +vim.api.nvim_create_user_command("FoldDefault", function(opts) + local buf = vim.api.nvim_get_current_buf() + + if opts.bang then + undofoldmarker(buf) + return + end + + setfold(buf, function(_win) + vim.opt_local.foldmethod = "marker" + vim.opt_local.foldmarker = "{{{,}}}" + end) +end, { bang = true }) + +vim.api.nvim_create_user_command("FoldRegion", function(opts) + local buf = vim.api.nvim_get_current_buf() + + if opts.bang then + undofoldmarker(buf) + return + end + + setfold(buf, function(_win) + vim.opt_local.foldmethod = "marker" + vim.opt_local.foldmarker = "#region,#endregion" + end) +end, { bang = true }) + +vim.api.nvim_create_user_command("FoldTS", function(opts) + local buf = vim.api.nvim_get_current_buf() + + if opts.bang then + undofoldexpr(buf) + return + end + + setfold(buf, function(win) + vim.opt_local.foldmethod = "expr" + vim.opt_local.foldexpr = "v:lua.vim.treesitter.foldexpr()" + end) +end, { bang = true }) + +local function FoldLsp(buf, bang) + if bang then + undofoldexpr(buf) + return + end + + setfold(buf, function(win) + vim.opt_local.foldmethod = "expr" + vim.opt_local.foldexpr = "v:lua.vim.lsp.foldexpr()" + end) +end + +vim.api.nvim_create_user_command("FoldLsp", function(opts) + local buf = vim.api.nvim_get_current_buf() + FoldLsp(buf, opts.bang) +end, { bang = true }) + +fn.augroup("FoldByFt", { + + { "FileType" }, + { + pattern = "python", + callback = function(args) + setfold(args.buf, function(win) + vim.wo[win][0].foldmethod = "indent" + vim.wo[win][0].foldexpr = "" + end) + end, + }, +}, { + { "FileType" }, + { + pattern = { "vim" }, + callback = function(args) + setfold(args.buf, function(win) + vim.wo[win][0].foldmethod = "marker" + vim.wo[win][0].foldmarker = "{{{,}}}" + end) + end, + }, +}) diff --git a/nvim/plugin/format.lua b/nvim/plugin/format.lua new file mode 100644 index 0000000..07adfc2 --- /dev/null +++ b/nvim/plugin/format.lua @@ -0,0 +1,49 @@ +if vim.g.did_load_format_plugin then + return +end +vim.g.did_load_format_plugin = true + +local g = vim.g + +vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + +g.formatters_by_ft = { + lua = { "stylua" }, + python = { "ruff_format" }, + rust = { "rustfmt" }, + javascript = { "prettierd" }, + json = { "fixjson" }, + jinja = { "djlint" }, + htmldjango = { "djlint" }, + nix = { "nixpkgs_fmt" }, + go = { "gofmt" }, +} + +for _, lang in ipairs({ + "javascript", + "typescript", + "jsx", + "tsx", + "jsonc", +}) do + g.formatters_by_ft[lang] = { "biome" } +end +for _, lang in ipairs({ + "markdown", + "html", + "css", + "yaml", + "scss", + "vue", +}) do + g.formatters_by_ft[lang] = { "prettierd" } +end + +vim.keymap.set("", "gqb", function() + local buf = vim.api.nvim_get_current_buf() + if require("largefiles").is_large_file(buf, true) then + vim.notify_once("Large buf can't format", vim.log.levels.WARN) + return + end + require("conform").format({ async = true }) +end, { desc = "Format buffer" }) diff --git a/nvim/plugin/git.lua b/nvim/plugin/git.lua new file mode 100644 index 0000000..8c00ca6 --- /dev/null +++ b/nvim/plugin/git.lua @@ -0,0 +1,130 @@ +if vim.g.did_load_git_plugin then + return +end +vim.g.did_load_git_plugin = true + +local autocmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup +function DiffviewToggle() + local lib = require("diffview.lib") + + local view = lib.get_current_view() + if view then + vim.cmd(":DiffviewClose") + else + vim.cmd(":DiffviewOpen") + end +end +local gr = augroup("DiffView", { clear = true }) +vim.api.nvim_create_autocmd("User", { + group = gr, + pattern = "DiffviewViewEnter", + callback = function(event) + vim.keymap.set("n", "q", DiffviewToggle, { silent = true }) + end, +}) + +vim.api.nvim_create_autocmd("User", { + group = gr, + pattern = "DiffviewViewLeave", + callback = function() + vim.keymap.del("n", "q") + end, +}) + +require("lze").load({ + { + "gitsigns.nvim", + after = function() + require("gitsigns").setup({ + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map("n", "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk({ preview = true }) + end) + return "" + end, { expr = true, desc = "Git: next hunk" }) + + map("n", "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk({ preview = true }) + end) + return "" + end, { expr = true, desc = "Git: prev hunk" }) + end, + }) + end, + event = vim.g.pre_load_events, + keys = { + "[c", + "]c", + { "gb", ":Gitsign blame_line", desc = "Git: blake line" }, + { "gB", ":Gitsign blame", desc = "Git: blame" }, + { "gs", ":Gitsign stage_hunk", desc = "Git: stage hunk", mode = { "n", "v" } }, + { "gS", ":Gitsign stage_buffer", desc = "Git: stage buffer" }, + { "gu", ":Gitsign undo_stage_hunk", desc = "Git: undo stage hunk", mode = { "n", "v" } }, + { "gr", ":Gitsign reset_hunk", desc = "Git: reset hunk", mode = { "n", "v" } }, + { "gR", ":Gitsign reset_buffer", desc = "Git: reset buffer" }, + { "gp", ":Gitsign preview_hunk_inline", desc = "Git: preview hunk" }, + { "ih", ":Gitsigns select_hunk", desc = "Git: select hunk", mode = { "o", "x" } }, + }, + }, + { + "vim-fugitive", + cmd = { + "Git", + }, + }, + { + "sindrets/diffview.nvim", + keys = { + { "gD", DiffviewToggle, silent = true, desc = "Git: Diffview toggle" }, + { "gh", ":DiffviewFileHistory %", silent = true, desc = "Git: DiffviewFileHistory current" }, + { "gH", ":DiffviewFileHistory", silent = true, desc = "Git: DiffviewFileHistory current" }, + { "gh", ":'<,'>DiffviewFileHistory", "Log visual selection", mode = "v" }, + }, + cmd = { + "DiffviewOpen", + "DiffviewFileHistory", + "DiffviewToggleFiles", + "DiffviewFocusFiles", + "DiffviewRefresh", + }, + after = function() + require("diffview").setup({ + hooks = { + diff_buf_read = function(bufnr) + vim.b[bufnr].no_winbar = true + end, + }, + view = { + default = { + layout = "diff2_horizontal", + }, + merge_tool = { + layout = "diff4_mixed", + disable_diagnostics = true, + }, + file_history = { + layout = "diff2_horizontal", + }, + }, + }) + end, + }, +}) diff --git a/nvim/plugin/gui.lua b/nvim/plugin/gui.lua new file mode 100644 index 0000000..3cbdf9c --- /dev/null +++ b/nvim/plugin/gui.lua @@ -0,0 +1,73 @@ +if vim.g.did_load_gui_plugin then + return +end +vim.g.did_load_gui_plugin = true + +if vim.g.neovide then + vim.g.neovide_opacity = 0.85 + vim.g.neovide_input_macos_option_key_is_meta = "both" + vim.g.neovide_window_blurred = true + vim.g.neovide_remember_window_size = false + vim.g.neovide_input_use_logo = 1 + vim.g.neovide_unlink_border_highlights = true + + +-- stylua: ignore start +vim.cmd([[ + cmap + + map "+p + map! + + tmap + vmap "+y + + map ˙ + map ∆ + map ˚ + map ¬ + map ƒ + map © + tmap © + map † + tmap † + map ∫ + tmap ∫ + map ˆ + tmap ˆ +]]) + -- stylua: ignore end + + vim.g.neovide_scale_factor = 1.0 + local change_scale_factor = function(delta) + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + delta + vim.cmd(":redraw!") + end + vim.keymap.set("n", "", function() + change_scale_factor(0.25) + end) + vim.keymap.set("n", "", function() + change_scale_factor(-0.25) + end) + + -- local colors = { + -- "#10100E", + -- "#0087BD", + -- "#20B2AA", + -- "#009F6B", + -- "#9A4EAE", + -- "#C40233", + -- "#C6C6C4", + -- "#FFD700", + -- "#696969", + -- "#007FFF", + -- "#00CCCC", + -- "#03C03C", + -- "#FF1493", + -- "#FF2400", + -- "#FFFAFA", + -- "#FDFF00", + -- } + -- + -- for index, value in ipairs(colors) do + -- vim.g[string.format("terminal_color_%s", 15 - index)] = value + -- end +end diff --git a/nvim/plugin/indent.lua b/nvim/plugin/indent.lua new file mode 100644 index 0000000..1ca385d --- /dev/null +++ b/nvim/plugin/indent.lua @@ -0,0 +1,65 @@ +if vim.g.did_load_indent_plugin then + return +end +vim.g.did_load_indent_plugin = true + +vim.g.indentline_char = "|" + +vim.opt.listchars:append({ + leadmultispace = vim.g.indentline_char, +}) + +-- I don't know where copy paste ... +-- +local function update(is_local) + local listchars_update = function(items) + local listchars = vim.api.nvim_get_option_value("listchars", {}) + for item, val in pairs(items) do + if listchars:match(item) then + listchars = listchars:gsub("(" .. item .. ":)[^,]*", "%1" .. val) + else + listchars = listchars .. "," .. item .. ":" .. val + end + end + return listchars + end + local new_listchars = "" + if vim.api.nvim_get_option_value("expandtab", {}) then + local spaces = vim.api.nvim_get_option_value("shiftwidth", {}) + -- When shiftwidth is 0, vim will use tabstop value + if spaces == 0 then + spaces = vim.api.nvim_get_option_value("tabstop", {}) + end + new_listchars = listchars_update({ + tab = "→ ", + leadmultispace = vim.g.indentline_char .. string.rep(" ", spaces - 1), + }) + else + new_listchars = listchars_update({ + tab = vim.g.indentline_char .. " ", + leadmultispace = "␣", + }) + end + local opts = {} + if is_local then + opts.scope = "local" + end + vim.api.nvim_set_option_value("listchars", new_listchars, opts) +end +vim.api.nvim_create_augroup("indent_line", { clear = true }) +vim.api.nvim_create_autocmd({ "OptionSet" }, { + group = "indent_line", + pattern = { "shiftwidth", "expandtab", "tabstop" }, + callback = function() + update(vim.v.option_type == "local") + end, +}) +-- OptionSet is not triggered on startup +-- This may be not needed. The listchars has been set properly in options.vim and it will be sourced +-- on startup. +vim.api.nvim_create_autocmd({ "VimEnter" }, { + group = "indent_line", + callback = function() + update(false) + end, +}) diff --git a/nvim/plugin/keyhelper.lua b/nvim/plugin/keyhelper.lua new file mode 100644 index 0000000..0851bac --- /dev/null +++ b/nvim/plugin/keyhelper.lua @@ -0,0 +1,96 @@ +if vim.g.did_load_keyhelper_plugin then + return +end +vim.g.did_load_keyhelper_plugin = true + +require("lze").load({ + { + "which-key.nvim", + event = "VimEnter", + after = function() + require("which-key").setup({ + defaults = {}, + preset = "helix", + keys = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + spec = { + { + mode = { "n", "v" }, + { "d", group = "dap" }, + { "g", group = "git" }, + { "s", group = "search" }, + { "l", group = "lang", icon = { icon = "󱖫 ", color = "green" } }, + { "[", group = "prev" }, + { "]", group = "next" }, + { "g", group = "goto" }, + { "gz", group = "surround" }, + { "z", group = "fold" }, + { "m", group = "mark" }, + { "M", group = "mark" }, + { "dm", group = "mark" }, + { "lc", group = "copy_as" }, + { "lt", group = "tests" }, + { "h", group = "http" }, + { + "b", + group = "buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, + }, + }, + triggers = { + { "", mode = "nixsotc" }, + }, + }) + end, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Keymaps (which-key)", + }, + { + "", + function() + require("which-key").show({ keys = "", loop = true }) + end, + desc = "Window Hydra Mode (which-key)", + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + end, + }, + { + "better-escape.nvim", + after = function() + require("better_escape").setup({ + default_mappings = false, + mappings = { + i = { + j = { + k = "", + j = "", + }, + }, + c = {}, + t = { + j = { + k = "", + j = "", + }, + }, + v = {}, + s = {}, + }, + }) + end, + }, +}) diff --git a/nvim/plugin/keymap.lua b/nvim/plugin/keymap.lua new file mode 100644 index 0000000..04f1e08 --- /dev/null +++ b/nvim/plugin/keymap.lua @@ -0,0 +1,98 @@ +if vim.g.did_load_keymap_plugin then + return +end +vim.g.did_load_keymap_plugin = true + +local default_vim_keymap_set = vim.keymap.set + +vim.keymap.set = function(mode, lhs, rhs, opts) + if type(lhs) == "table" then + for _, key in ipairs(lhs) do + default_vim_keymap_set(mode, key, rhs, opts) + end + else + default_vim_keymap_set(mode, lhs, rhs, opts) + end +end + +vim.keymap.set({ "n" }, { "q", "q" }, ":q", { desc = "Quit", silent = true }) + +vim.keymap.set({ "n", "v" }, "", "10jzz") +vim.keymap.set({ "n", "v" }, "", "10kzz") +vim.keymap.set({ "n", "v" }, "", "") + +vim.keymap.set({ "n" }, "o", "o", { desc = "Add line under" }) +vim.keymap.set({ "n" }, "O", "O", { desc = "Add line prev" }) +vim.keymap.set({ "v" }, "p", "pgvy", { desc = "Disable yank on paste" }) + +vim.keymap.set({ "n" }, { "w", "'" }, ":w", { silent = true, desc = "normal mode: save" }) +vim.keymap.set( + { "v" }, + { "w", "'" }, + ":w", + { desc = "visual mode: escape to normal and save", silent = true } +) + +vim.keymap.set( + { "v" }, + { "W" }, + ":wa", + { silent = true, desc = "visual mode: escape to normal and save" } +) + +-- Tabpages +---@param tab_action function +---@param default_count number? +---@return function +local function tabswitch(tab_action, default_count) + return function() + local count = default_count or vim.v.count + local num_tabs = vim.fn.tabpagenr("$") + if num_tabs >= count then + tab_action(count ~= 0 and count or nil) + return + end + vim.cmd.tablast() + end +end +vim.keymap.set({ "n", "x" }, "gt", tabswitch(vim.cmd.tabnext), { desc = "Tabs: next" }) +vim.keymap.set({ "n", "x" }, "gT", tabswitch(vim.cmd.tabprev), { desc = "Tabs: prev" }) +vim.keymap.set({ "n", "x" }, "gy", tabswitch(vim.cmd.tabprev), { desc = "Tabs: prev" }) -- gT is too hard to press + +vim.keymap.set("n", "t", ":$tabnew", { desc = "Tabs: new" }) +vim.keymap.set("n", "[", ":-tabmove", { desc = "Tabs: move to prev" }) +vim.keymap.set("n", "]", ":+tabmove", { desc = "Tabs: move to next" }) + +for i = 1, 9, 1 do + vim.keymap.set({ "n", "x" }, "" .. i, tabswitch(vim.cmd.tabnext, i), { desc = "Tabs: go to " .. i }) + -- vim.keymap.set({ "t" }, "" .. i, tabswitch(vim.cmd.tabnext, i), { desc = "Tabs: go to " .. i }) +end + +vim.keymap.set("n", "lcl", function() + local s = string.format("%s:%s", vim.fn.expand("%"), vim.fn.line(".")) + vim.notify(string.format("Copied reference: %s", s)) + vim.fn.setreg("+", s) +end, { noremap = true, desc = "Copy as: line" }) + +vim.keymap.set("n", "", ":DiffviewOpen", { desc = "DIFF" }) + +vim.keymap.set("n", "D", ":DBUIToggle", { desc = "DBUI" }) + +vim.keymap.set( + "n", + "W", + (function() + local enabled = false + return function() + if not enabled then + vim.cmd([[let &winwidth = &columns * 7 / 10 ]]) + vim.cmd([[let &winheight = &lines * 7 / 10 ]]) + else + vim.opt.winwidth = vim.g.default_winwidth + vim.opt.winheight = vim.g.default_winheight + end + enabled = not enabled + end + end)(), + { desc = "Toggle autoresize height width buffers of window" } +) diff --git a/nvim/plugin/largefiles.lua b/nvim/plugin/largefiles.lua new file mode 100644 index 0000000..1ac8109 --- /dev/null +++ b/nvim/plugin/largefiles.lua @@ -0,0 +1,17 @@ +if vim.g.did_load_largefiles_plugin then + return +end +vim.g.did_load_largefiles_plugin = true + +local fn = require("funcs") +local lf = require("largefiles") + +fn.augroup("largefiles", { + vim.g.pre_load_events, + { + pattern = { "*" }, + callback = function(event) + lf.optimize_buffer(event.buf, event.match) + end, + }, +}) diff --git a/nvim/plugin/lint.lua b/nvim/plugin/lint.lua new file mode 100644 index 0000000..89772a3 --- /dev/null +++ b/nvim/plugin/lint.lua @@ -0,0 +1,139 @@ +if vim.g.did_load_lint_plugin then + return +end +vim.g.did_load_lint_plugin = true + +vim.g.linter_by_ft = { + sql = { "codespell", "sqlfluff" }, + jinja = { "djlint" }, + htmldjango = { "djlint" }, + python = { "codespell" }, + rust = { "codespell" }, + go = { "codespell" }, +} + +local patterns = {} + +for key, _ in pairs(vim.g.linter_by_ft) do + table.insert(patterns, key) +end + +local server = {} +local client_capabilities = { + capabilities = { + textDocumentSync = { + openClose = true, + save = true, + }, + }, +} + +local running_procs_by_buf = {} + +local opts = { ignore_errors = true } + +local function try_lint(bufnr) + if not vim.api.nvim_buf_is_valid(bufnr) then + if running_procs_by_buf[bufnr] ~= nil then + running_procs_by_buf[bufnr] = nil + end + return + end + + local nvimlint = require("lint") + local ft = vim.bo[bufnr].filetype + + local names = nvimlint._resolve_linter_by_ft(ft) + + local lookup_linter = function(name) + local linter = nvimlint.linters[name] + assert(linter, "Linter with name `" .. name .. "` not available") + if type(linter) == "function" then + linter = linter() + end + linter.name = linter.name or name + return linter + end + local running_procs = running_procs_by_buf[bufnr] or {} + for _, linter_name in pairs(names) do + local linter = lookup_linter(linter_name) + local proc = running_procs[linter.name] + if proc then + proc:cancel() + end + running_procs[linter.name] = nil + local ok, lintproc_or_error = pcall(nvimlint.lint, linter, opts) + if ok then + running_procs[linter.name] = lintproc_or_error + elseif not opts.ignore_errors then + vim.notify(lintproc_or_error --[[@as string]], vim.log.levels.WARN) + end + end + running_procs_by_buf[bufnr] = running_procs +end + +function server.create(buf) + return function() + local srv = {} + + function srv.initialize(params, callback) + callback(nil, client_capabilities) + end + + srv["textDocument/didOpen"] = function(params) + try_lint(buf) + end + srv["textDocument/didClose"] = function(params) + -- try_lint(buf) + end + srv["textDocument/didSave"] = function(params) + try_lint(buf) + end + + function srv.shutdown(params, callback) + callback(nil, nil) + end + + return { + request = function(method, params, callback) + if srv[method] then + srv[method](params, callback) + else + callback({ message = "Method not found: " .. method }) + end + end, + notify = function(method, params) + if srv[method] then + srv[method](params) + end + end, + is_closing = function() + return false + end, + terminate = function() + client_capabilities = {} + end, + } + end +end + +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("InlineLint", { clear = true }), + pattern = patterns, + callback = function(args) + local buf = args.buf + if not vim.bo[buf].modifiable or vim.list_contains({ "terminal", "nofile" }, vim.bo[buf].buftype) then + return + end + + vim.lsp.start({ + name = "inline-lint", + cmd = server.create(buf), + root_dir = vim.uv.cwd(), + reuse_client = function() + return true + end, + }) + end, + desc = "Inline nvim-lint autostart", +}) diff --git a/nvim/plugin/log-autocmds.vim.disabled b/nvim/plugin/log-autocmds.vim.disabled new file mode 100644 index 0000000..7910966 --- /dev/null +++ b/nvim/plugin/log-autocmds.vim.disabled @@ -0,0 +1,118 @@ +command! LogAutocmds call s:log_autocmds_toggle() + +function! s:log_autocmds_toggle() + augroup LogAutocmd + autocmd! + augroup END + + let l:date = strftime('%F', localtime()) + let s:activate = get(s:, 'activate', 0) ? 0 : 1 + if !s:activate + call s:log('Stopped autocmd log (' . l:date . ')') + return + endif + + call s:log('Started autocmd log (' . l:date . ')') + augroup LogAutocmd + for l:au in s:aulist + silent execute 'autocmd' l:au '* call s:log(''' . l:au . ''')' + endfor + augroup END +endfunction + +function! s:log(message) + silent execute '!echo "' + \ . strftime('%T', localtime()) . ' - ' . a:message . '"' + \ '>> /tmp/vim_log_autocommands' +endfunction + +" These are deliberately left out due to side effects +" - SourceCmd +" - FileAppendCmd +" - FileWriteCmd +" - BufWriteCmd +" - FileReadCmd +" - BufReadCmd +" - FuncUndefined + +let s:aulist = [ + \ 'BufNewFile', + \ 'BufReadPre', + \ 'BufRead', + \ 'BufReadPost', + \ 'FileReadPre', + \ 'FileReadPost', + \ 'FilterReadPre', + \ 'FilterReadPost', + \ 'StdinReadPre', + \ 'StdinReadPost', + \ 'BufWrite', + \ 'BufWritePre', + \ 'BufWritePost', + \ 'FileWritePre', + \ 'FileWritePost', + \ 'FileAppendPre', + \ 'FileAppendPost', + \ 'FilterWritePre', + \ 'FilterWritePost', + \ 'BufAdd', + \ 'BufCreate', + \ 'BufDelete', + \ 'BufWipeout', + \ 'BufFilePre', + \ 'BufFilePost', + \ 'BufEnter', + \ 'BufLeave', + \ 'BufWinEnter', + \ 'BufWinLeave', + \ 'BufUnload', + \ 'BufHidden', + \ 'BufNew', + \ 'SwapExists', + \ 'FileType', + \ 'Syntax', + \ 'EncodingChanged', + \ 'TermChanged', + \ 'VimEnter', + \ 'GUIEnter', + \ 'GUIFailed', + \ 'TermResponse', + \ 'QuitPre', + \ 'VimLeavePre', + \ 'VimLeave', + \ 'FileChangedShell', + \ 'FileChangedShellPost', + \ 'FileChangedRO', + \ 'ShellCmdPost', + \ 'ShellFilterPost', + \ 'CmdUndefined', + \ 'SpellFileMissing', + \ 'SourcePre', + \ 'VimResized', + \ 'FocusGained', + \ 'FocusLost', + \ 'CursorHold', + \ 'CursorHoldI', + \ 'CursorMoved', + \ 'CursorMovedI', + \ 'WinEnter', + \ 'WinLeave', + \ 'TabEnter', + \ 'TabLeave', + \ 'CmdwinEnter', + \ 'CmdwinLeave', + \ 'InsertEnter', + \ 'InsertChange', + \ 'InsertLeave', + \ 'InsertCharPre', + \ 'TextChanged', + \ 'TextChangedI', + \ 'ColorScheme', + \ 'RemoteReply', + \ 'QuickFixCmdPre', + \ 'QuickFixCmdPost', + \ 'SessionLoadPost', + \ 'MenuPopup', + \ 'CompleteDone', + \ 'User', + \ ] diff --git a/nvim/plugin/lspconfig.lua b/nvim/plugin/lspconfig.lua new file mode 100644 index 0000000..88683fe --- /dev/null +++ b/nvim/plugin/lspconfig.lua @@ -0,0 +1,17 @@ +if vim.env.NVIM_MINI ~= nil then + return +end + +local autocmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup + +local gr = augroup("lspconfig", { clear = true }) + +autocmd(vim.g.pre_load_events, { + pattern = "*", + group = gr, + once = true, + callback = function() + require("lsp").setup() + end, +}) diff --git a/nvim/plugin/snacks.lua b/nvim/plugin/snacks.lua new file mode 100644 index 0000000..5584c00 --- /dev/null +++ b/nvim/plugin/snacks.lua @@ -0,0 +1,126 @@ +if vim.g.did_load_snacks_plugin then + return +end +vim.g.did_load_snacks_plugin = true + +require("lze").load({ + "snacks.nvim", + after = function() + require("snacks").setup({ + bigfile = { enabled = false }, + dashboard = { enabled = false }, + explorer = { enabled = false }, + indent = { enabled = false }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 1000, + level = vim.log.levels.WARN, + }, + picker = { enabled = false }, + quickfile = { enabled = true }, + scope = { enabled = false }, + scroll = { enabled = false }, + statuscolumn = { + enabled = true, + folds = { + open = true, -- show open fold icons + git_hl = false, -- use Git Signs hl for fold icons + }, + refresh = 200, -- ms + }, + words = { enabled = false }, + styles = { + notification = { + wo = { wrap = true }, -- Wrap notifications + }, + }, + }) + end, + keys = { + { + "bd", + desc = "Buffers: delete current", + function() + Snacks.bufdelete.delete() + end, + }, + { + "bc", + desc = "Buffers: delete other", + function() + Snacks.bufdelete.other() + end, + }, + { + "M", + desc = "Notifications", + function() + Snacks.notifier.show_history() + end, + }, + { + "N", + desc = "Neovim News", + function() + Snacks.win({ + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = "yes", + statuscolumn = " ", + conceallevel = 3, + }, + }) + end, + }, + }, +}) + +_G.dd = function(...) + Snacks.debug.inspect(...) +end +_G.bt = function() + Snacks.debug.backtrace() +end +vim.print = _G.dd -- Override print to use snacks for `:=` command + +Snacks.toggle.option("hlsearch", { name = "HLSearch" }):map("th") +Snacks.toggle.option("spell", { name = "Spelling" }):map("ts") +Snacks.toggle.option("wrap", { name = "Wrap" }):map("tw") +Snacks.toggle + .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) + :map("tc") +Snacks.toggle.treesitter():map("tT") + +Snacks.toggle + .new({ + id = "diagnostic_virtuallines", + name = "DiagnosticsVirtualLines", + get = function() + local current = vim.diagnostic.config() + if not current then + return false + end + if not current.virtual_lines then + return false + end + + return current.virtual_lines.current_line + end, + set = function(state) + if state then + vim.diagnostic.config({ + virtual_lines = { current_line = true }, + }) + else + vim.diagnostic.config({ + virtual_lines = false, + }) + end + end, + }) + :map("td") diff --git a/nvim/plugin/term.lua b/nvim/plugin/term.lua new file mode 100644 index 0000000..0fc5830 --- /dev/null +++ b/nvim/plugin/term.lua @@ -0,0 +1,56 @@ +if vim.g.did_load_term_plugin then + return +end +vim.g.did_load_term_plugin = true + +local term = require("terminal") + +vim.api.nvim_create_user_command("Tterm", function(input) + term.open(input.args) +end, { nargs = "*" }) + +vim.api.nvim_create_user_command("Sterm", function(input) + term.open(input.args, "split") +end, { nargs = "*" }) + +vim.api.nvim_create_user_command("Vterm", function(input) + term.open(input.args, "vsplit") +end, { nargs = "*" }) + +local function term_open() + local bufnr = vim.api.nvim_get_current_buf() + if string.find(vim.fn.bufname(bufnr), "term://") ~= nil then + term.open(nil, "vsplit") + vim.cmd("vertical resize +15") + else + term.open(nil, "split") + vim.cmd("horizontal resize -15") + end +end + +vim.keymap.set("n", "", term_open, { desc = "Open terminal" }) +vim.keymap.set("t", "", term_open, { desc = "Open terminal" }) + +vim.keymap.set("n", "k", function() + local out = vim.system({ "fd", "-a", "--glob", "*yaml", vim.env.HOME .. "/.kube/configs" }, { text = true }):wait() + local selects = {} + for segment in string.gmatch(out.stdout, "[^\n]+") do + table.insert(selects, segment) + end + + vim.ui.select(selects, { + prompt = "Select kubeconfig:", + format_item = function(item) + return item + end, + }, function(choice) + if not choice then + return + end + local bufnr = + term.open(string.format("k9s --insecure-skip-tls-verify --all-namespaces --kubeconfig %s", choice), nil) + + vim.keymap.set("t", "", [[^]], { buffer = bufnr }) + vim.keymap.set("t", "", [[^]], { buffer = bufnr }) + end) +end, { desc = "K9S" }) diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua new file mode 100644 index 0000000..56d7859 --- /dev/null +++ b/nvim/plugin/treesitter.lua @@ -0,0 +1,141 @@ +if vim.g.did_load_treesitter_plugin then + return +end +vim.g.did_load_treesitter_plugin = true + +local is_large_file = require("largefiles").is_large_file +local FILE_TYPE = require("largefiles").FILE_TYPE + +---@diagnostic disable-next-line: unused-local +local is_disable = function(_lang, buf) + local _type = is_large_file(buf) + + local r = _type ~= FILE_TYPE.NORMAL + + return r + -- return _type == FILE_TYPE.READ_ONLY or _type == FILE_TYPE.LARGE_SIZE +end + +require("lze").load({ + "treesitter-context", + on_plugin = "nvim-treesitter", + after = function() + local tsc = require("treesitter-context") + tsc.setup({ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 5, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 30, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 5, -- Maximum number of lines to show for a single context + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + -- separator = "-", + zindex = 20, -- The Z-index of the context window + on_attach = function(buf) + local line_count = vim.api.nvim_buf_line_count(buf) + if line_count > 1000 then + return false + end + return not is_disable(nil, buf) + end, -- (fun(buf: integer): boolean) return false to disable attaching + }) + vim.api.nvim_create_autocmd({ "DiagnosticChanged" }, { + callback = function() + if tsc.enabled() then + tsc.disable() + tsc.enable() + end + end, + }) + end, +}) + +require("lze").load({ + "nvim-treesitter", + event = vim.g.post_load_events, + before = function() + local prev = vim.treesitter.language.get_lang + ---@diagnostic disable-next-line: duplicate-set-field + vim.treesitter.language.get_lang = function(...) + require("lze").trigger_load({ "nvim-treesitter" }) + return prev(...) + end + end, + after = function() + require("nvim-treesitter.configs").setup({ + autotag = { + enable = false, + disable = is_disable, + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + disable = is_disable, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + disable = is_disable, + }, + yati = { + enable = true, + disable = is_disable, + }, + indent = { + enable = false, + disable = is_disable, + }, + matchup = { + enable = false, + include_match_words = true, + disable = is_disable, + }, + }) + + vim.treesitter.language.register("htmldjango", "jinja") + + local colorpalette = { + { fg = "#EB75D6" }, + { fg = "#D49DA5" }, + { fg = "#ef9062" }, + { fg = "#e75a7c" }, + { fg = "#57a5e5" }, + { fg = "#3AC6BE" }, + { fg = "#8997F5" }, + { fg = "#7FEC35" }, + { fg = "#8FB272" }, + } + + require("hlargs").setup({ + use_colorpalette = true, + colorpalette = colorpalette, + paint_arg_declarations = true, + paint_arg_usages = true, + paint_catch_blocks = { + declarations = true, + usages = true, + }, + extras = { + named_parameters = true, + }, + excluded_argnames = { + declarations = {}, + usages = { + usages = { + python = {}, + lua = {}, + }, + }, + }, + disable = is_disable, + excluded_filetypes = { "jinja", "htmldjango" }, + }) + end, +}) diff --git a/nvim/snippets/editorconfig.json b/nvim/snippets/editorconfig.json new file mode 100644 index 0000000..7a11403 --- /dev/null +++ b/nvim/snippets/editorconfig.json @@ -0,0 +1,43 @@ +{ + "init": { + "prefix": [ + "!", + "init" + ], + "body": [ + " root = true", + "", + " [*]", + " charset = utf-8", + " end_of_line = lf", + " insert_final_newline = true", + " trim_trailing_whitespace = true", + " indent_style = space", + " indent_size = 4", + " max_line_length = 120", + "", + " [*.md]", + " trim_trailing_whitespace = false", + "", + " [jest.config]", + " indent_size = 2", + "", + " [*.{babelrc,stylelintrc,eslintrc,bowerrc,jsb3,jsb2,json,vue,scss,jshintrc,jscsrc,js,js.map,yaml,yml,tpl,pug,html,htm,jinja}]", + " indent_size = 2", + "", + " [{makefile,Makefile}]", + " indent_style = tab", + " tab_width = 4", + "", + " [Makefile.*]", + " indent_style = tab", + " tab_width = 4", + "", + " [*.{tab,tsv}]", + " indent_style = tab", + " tab_width = 1", + "", + "" + ] + } +} diff --git a/nvim/snippets/go.json b/nvim/snippets/go.json new file mode 100644 index 0000000..aa40c6a --- /dev/null +++ b/nvim/snippets/go.json @@ -0,0 +1,14 @@ +{ + "ie + if e + ife": { + "body": [ + "if err != nil {", + " $0", + "}" + ], + "prefix": [ + "ie", + "if e", + "ife" + ] + } +} diff --git a/nvim/snippets/http.json b/nvim/snippets/http.json new file mode 100644 index 0000000..49006fa --- /dev/null +++ b/nvim/snippets/http.json @@ -0,0 +1,56 @@ +{ + "header": { + "prefix": "header", + "body": [ + " ${2:header name}: ${3:header value}", + "" + ], + "description": "header" + }, + "get": { + "prefix": "get", + "body": [ + " GET ${1:url} HTTP/1.1", + "" + ], + "description": "get" + }, + "post": { + "prefix": "post", + "body": [ + " POST ${1:url} HTTP/1.1", + "", + " ${4:content}", + "" + ], + "description": "post" + }, + "put": { + "prefix": "put", + "body": [ + " PUT ${1:url} HTTP/1.1", + "", + " ${4:content}", + "" + ], + "description": "put" + }, + "patch": { + "prefix": "patch", + "body": [ + " PATCH ${1:url} HTTP/1.1", + "", + " ${4:content}", + "" + ], + "description": "patch" + }, + "delete": { + "prefix": "delete", + "body": [ + " DELETE ${1:url} HTTP/1.1", + "" + ], + "description": "delete" + } +} \ No newline at end of file diff --git a/nvim/snippets/json.json b/nvim/snippets/json.json new file mode 100644 index 0000000..a88c9df --- /dev/null +++ b/nvim/snippets/json.json @@ -0,0 +1,19 @@ +{ + "tsserverjavascript": { + "prefix": "tsserverjavascript", + "body": [ + "{", + " \"compilerOptions\": {", + "\t\"module\": \"commonjs\",", + "\t\"target\": \"es6\",", + "\t\"checkJs\": false", + " },", + " \"exclude\": [", + "\t\"node_modules\"", + " ]", + "}", + "" + ], + "description": "tsserverjavascript" + } +} \ No newline at end of file diff --git a/nvim/snippets/lua.json b/nvim/snippets/lua.json new file mode 100644 index 0000000..f2c2e4c --- /dev/null +++ b/nvim/snippets/lua.json @@ -0,0 +1,149 @@ +{ + "neogen": { + "prefix": "neogen", + "body": [ + " require(\"neogen\").setup({", + " enabled = true,", + " input_after_comment = true,", + " snippet_engine = \"luasnip\",", + " languages = {", + " python = {", + " template = {", + " annotation_convention = \"reST\",", + " },", + " },", + " },", + " })", + "" + ], + "description": "neogen" + }, + "jinja": { + "prefix": "jinja", + "body": [ + " vim.filetype.add({", + " extension = {", + " html = \"jinja\",", + " htm = \"jinja\",", + " }", + " })", + "" + ], + "description": "jinja" + }, + "tests": { + "prefix": "tests", + "body": [ + " require(\"neotest\").setup({})", + "" + ], + "description": "tests" + }, + "pytest": { + "prefix": "pytest", + "body": [ + " require(\"neotest\").setup({", + " adapters = {", + " require(\"neotest-python\")({", + " dap = { justMyCode = false },", + " args = {\"--log-level\", \"DEBUG\"},", + " runner = \"pytest\",", + " })", + " }", + " })", + "" + ], + "description": "pytest" + }, + "unittest": { + "prefix": "unittest", + "body": [ + " require(\"neotest\").setup({", + " adapters = {", + " require(\"neotest-python\")({", + " dap = { justMyCode = false },", + " args = {\"--log-level\", \"DEBUG\"},", + " runner = \"pytest\",", + " })", + " }", + " })", + "" + ], + "description": "unittest" + }, + "db": { + "prefix": "db", + "body": [ + " vim.g.db = \"postgresql://postgres:postgres@localhost:5432/postgres\"", + "" + ], + "description": "db" + }, + "py-lint": { + "prefix": "py-lint", + "body": [ + " require(\"lint\").linters_by_ft = {", + " python = { \"mypy\", \"bandit\" },", + " }", + "" + ], + "description": "py-lint" + }, + "py-proj": { + "prefix": "py-proj", + "body": [ + " require(\"neogen\").setup({", + " enabled = true,", + " input_after_comment = true,", + " snippet_engine = \"luasnip\",", + " languages = {", + " python = {", + " template = {", + " annotation_convention = \"google\",", + " },", + " },", + " },", + " })", + " require(\"neotest\").setup({", + " adapters = {", + " require(\"neotest-python\")({", + " dap = { justMyCode = false },", + " args = { \"--log-level\", \"DEBUG\" },", + " runner = \"pytest\",", + " }),", + " },", + " })", + " vim.g.db = \"postgresql://postgres:postgres@localhost:5432/postgres\"", + "", + " require(\"lint\").linters_by_ft = {", + " python = { \"mypy\", \"bandit\" },", + " }", + "" + ], + "description": "py-proj" + }, + "ignore": { + "prefix": "ignore", + "body": [ + " -- stylua: ignore start", + "", + " -- stylua: ignore end", + "" + ], + "description": "ignore" + }, + "jinja_lsp": { + "prefix": "jinja_lsp", + "body": [ + " local utils = require(\"lsp.utils\")", + " utils.setup_lsp(\"jinja_lsp\", {", + " templates = \"./templates\",", + " backend = { \"./src\" },", + " lang = \"python\",", + " })", + "", + "" + ], + "description": "jinja_lsp" + } +} \ No newline at end of file diff --git a/nvim/snippets/package.json b/nvim/snippets/package.json new file mode 100644 index 0000000..162eb5f --- /dev/null +++ b/nvim/snippets/package.json @@ -0,0 +1,20 @@ +{ + "contributes": { + "snippets": [ + { + "language": [ + "go" + ], + "path": "./go.json" + }, + { + "language": [ + "lua" + ], + "path": "./lua.json-1" + } + ] + }, + "description": "This package.json has been generated by nvim-scissors.", + "name": "my-snippets" +} diff --git a/nvim/snippets/python.json b/nvim/snippets/python.json new file mode 100644 index 0000000..d6b29aa --- /dev/null +++ b/nvim/snippets/python.json @@ -0,0 +1,41 @@ +{ + "logger = logging.getLogger(__name__)": { + "prefix": "logger", + "body": [ + "logger = logging.getLogger(${1:__name__})", + "" + ] + }, + "#pylintdisable": { + "prefix": "pylintdisable", + "body": [ + "pylint: disable=${0}", + "" + ], + "description": "#pylintdisable" + }, + "#typeignore": { + "prefix": "typeignore", + "body": [ + "type: ignore", + "" + ], + "description": "typeignore" + }, + "#nosec": { + "prefix": "nosec", + "body": [ + "nosec", + "" + ], + "description": "#nosec" + }, + "#codespell": { + "prefix": "codespell", + "body": [ + "codespell:ignore", + "" + ], + "description": "#codespell" + } +} diff --git a/nvim/snippets/rust.json b/nvim/snippets/rust.json new file mode 100644 index 0000000..896ee7d --- /dev/null +++ b/nvim/snippets/rust.json @@ -0,0 +1,10 @@ +{ + "#codespell": { + "prefix": "#codespell", + "body": [ + "# codespell:ignore", + "" + ], + "description": "#codespell" + } +} \ No newline at end of file diff --git a/nvim/snippets/sql.json b/nvim/snippets/sql.json new file mode 100644 index 0000000..57619dc --- /dev/null +++ b/nvim/snippets/sql.json @@ -0,0 +1,89 @@ +{ + "tbl": { + "prefix": "tbl", + "body": [ + "create table ${1:table} (", + "\t${0:columns}", + ");" + ], + "description": "tbl" + }, + "col": { + "prefix": "col", + "body": [ + "${1:name}\t${2:type}\t${3:default ''}\t${0:not null}" + ], + "description": "col" + }, + "ccol": { + "prefix": "ccol", + "body": [ + "${1:name}\tvarchar2(${2:size})\t${3:default ''}\t${0:not null}" + ], + "description": "ccol" + }, + "ncol": { + "prefix": "ncol", + "body": [ + "${1:name}\tnumber\t${3:default 0}\t${0:not null}" + ], + "description": "ncol" + }, + "dcol": { + "prefix": "dcol", + "body": [ + "${1:name}\tdate\t${3:default sysdate}\t${0:not null}" + ], + "description": "dcol" + }, + "ind": { + "prefix": "ind", + "body": [ + "create index ${0:$1_$2} on ${1:table}(${2:column});" + ], + "description": "ind" + }, + "uind": { + "prefix": "uind", + "body": [ + "create unique index ${1:name} on ${2:table}(${0:column});" + ], + "description": "uind" + }, + "tblcom": { + "prefix": "tblcom", + "body": [ + "comment on table ${1:table} is '${0:comment}';" + ], + "description": "tblcom" + }, + "colcom": { + "prefix": "colcom", + "body": [ + "comment on column ${1:table}.${2:column} is '${0:comment}';" + ], + "description": "colcom" + }, + "addcol": { + "prefix": "addcol", + "body": [ + "alter table ${1:table} add (${2:column} ${0:type});" + ], + "description": "addcol" + }, + "seq": { + "prefix": "seq", + "body": [ + "create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${0:1};" + ], + "description": "seq" + }, + "s*": { + "prefix": "s*", + "body": [ + "select * from ${0:table}", + "" + ], + "description": "s*" + } +} \ No newline at end of file diff --git a/nvim/snippets/vim.json b/nvim/snippets/vim.json new file mode 100644 index 0000000..300297f --- /dev/null +++ b/nvim/snippets/vim.json @@ -0,0 +1,12 @@ +{ + "lua": { + "prefix": "lua", + "body": [ + "lua << EOF", + "EOF", + "", + "" + ], + "description": "lua" + } +} \ No newline at end of file diff --git a/tests/a.c b/tests/a.c new file mode 100644 index 0000000..6afa8c7 --- /dev/null +++ b/tests/a.c @@ -0,0 +1,3 @@ +const int A = 1; + + diff --git a/tests/a.cpp b/tests/a.cpp new file mode 100644 index 0000000..e69de29 diff --git a/tests/a.cu b/tests/a.cu new file mode 100644 index 0000000..d524fbc --- /dev/null +++ b/tests/a.cu @@ -0,0 +1,16 @@ +// includes, system +#include + +// includes CUDA Runtime +#include +#include + +// includes, project +#include +#include // helper utility functions + +__global__ void increment_kernel(int *g_data, int inc_value) { + int idx = blockIdx.x * blockDim.x + threadIdx.x; + g_data[idx] = g_data[idx] + inc_value; +} + diff --git a/tests/a.h b/tests/a.h new file mode 100644 index 0000000..e69de29 diff --git a/tests/barrier.go b/tests/barrier.go new file mode 100644 index 0000000..3806a62 --- /dev/null +++ b/tests/barrier.go @@ -0,0 +1,2 @@ +// create pattern Barrier for golang like python + diff --git a/tests/colorschema.py b/tests/colorschema.py new file mode 100644 index 0000000..9e44a52 --- /dev/null +++ b/tests/colorschema.py @@ -0,0 +1,74 @@ +import os +import pathlib + + +# dldldld +"""asd +zxc +""" + +pathlib.Path(".").mkdir() + + +def sum_two_number(a: int, b: int) -> int: + return a + b + +# TODO: 123 +# FIXME: 11 + + +# TODO: implement getter setter for s +class TestClass: + s: str = "sad" + + def __init__(self, variable): + self.a = "%123" + self.variable = variable + + def func(self, N): + """fast sum from 1 to N""" + sums = N * (N + 1) / 2 + return sums + + +asdasdsa = asd + + +B = 123 + +C = 1111111111 + +value = 123 +name = 11 +c = TestClass() +setattr(TestClass, "s", value) +c.__setattr__(name, value) + +os.path.abspath(TestClass) +a: int = 1 +if True or False: + print(123) + +a, b, c = "1", "2", "3" + +c: int = 1 + + +def decorator(): ... + + +@decorator +def s(): ... + + +def f(val1: str, ss, sncjllll): + """asdsad.""" + + def f(): + def c(): + {} + print(1) + + return c + + return f diff --git a/tests/div.json.py b/tests/div.json.py new file mode 100644 index 0000000..3969bba --- /dev/null +++ b/tests/div.json.py @@ -0,0 +1,5172 @@ +VERSION = "2.19.1" +from decimal import Decimal +from fastjsonschema import JsonSchemaValueException + +print_n_fi +NoneType = type(None) + +def validate(data, custom_formats={}, name_prefix=None): + validate_div_json(data, custom_formats, (name_prefix or "data") + "") + return data + +def validate_div_json(data, custom_formats={}, name_prefix=None): + data_any_of_count1 = 0 + if not data_any_of_count1: + try: + validate_div_image_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_gif_image_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_text_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_separator_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_container_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_grid_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_gallery_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_pager_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_tabs_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_state_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_custom_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_indicator_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_slider_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_input_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_select_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + try: + validate_div_video_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count1 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count1: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_image', 'codegen': {'divan': {'forced_properties_order': ['image_url']}}, 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'$ref': 'div-image-base.json'}, {'properties': {'image_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_image_image_url'}, 'high_priority_preview_show': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_image_high_priority_preview_show', 'platforms': ['android', 'ios']}, 'type': {'type': 'string', 'enum': ['image']}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_image_tint_mode'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_image_tint_color'}, 'appearance_animation': {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_image_appearance_animation'}, 'filters': {'type': 'array', 'items': {'$ref': 'div-filter.json'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}}}], 'required': ['image_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_gif_image', 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'$ref': 'div-image-base.json'}, {'properties': {'gif_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_gif_image_gif_url'}, 'type': {'type': 'string', 'enum': ['gif']}}}], 'required': ['gif_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_text', 'codegen': {'divan': {'forced_properties_order': ['text']}}, 'definitions': {'range': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'image': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'ellipsis': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_text_ellipsis_text'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, 'ranges': {'type': 'array', 'items': {'$ref': '#/definitions/range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, 'images': {'type': 'array', 'items': {'$ref': '#/definitions/image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}}, 'required': ['text'], '$description': 'translations.json#/div_text_ellipsis', 'platforms': ['android', 'ios']}}, 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'properties': {'type': {'type': 'string', 'enum': ['text']}, 'font_size': {'$ref': 'common.json#/non_negative_integer', 'default_value': '12', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', 'platforms': ['android', 'ios']}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_line_height'}, 'max_lines': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_max_lines'}, 'min_hidden_lines': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_min_hidden_lines', 'platforms': ['android', 'ios']}, 'auto_ellipsize': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_text_auto_ellipsize', 'platforms': ['android']}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_text_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'text_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'start', '$description': 'translations.json#/div_text_text_alignment_horizontal'}, 'text_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'top', '$description': 'translations.json#/div_text_text_alignment_vertical'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_text_color'}, 'focused_text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_focused_text_color', 'platforms': ['android', 'web']}, 'text_gradient': {'$ref': 'div-text-gradient.json', '$description': 'translations.json#/div_text_text_gradient'}, 'text': {'$ref': 'common.json#/non_empty_string', 'client_optimized': True, '$description': 'translations.json#/div_text_text'}, 'underline': {'$ref': 'div-line-style.json', 'default_value': 'none', '$description': 'translations.json#/div_text_underline'}, 'strike': {'$ref': 'div-line-style.json', 'default_value': 'none', '$description': 'translations.json#/div_text_strike'}, 'ranges': {'type': 'array', 'items': {'$ref': '#/definitions/range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ranges'}, 'images': {'type': 'array', 'items': {'$ref': '#/definitions/image'}, 'minItems': 1, '$description': 'translations.json#/div_text_images'}, 'ellipsis': {'$ref': '#/definitions/ellipsis'}, 'selectable': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_text_selectable'}, 'truncate': {'type': 'string', 'enum': ['none', 'start', 'end', 'middle'], 'default_value': 'end', '$description': 'translations.json#/div_text_truncate', 'deprecated': True, 'code_generation_disabled_kotlin': True, 'code_generation_disabled_swift': True}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_shadow', 'platforms': ['android']}}}], 'required': ['type', 'text'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_separator', 'definitions': {'style': {'type': 'object', 'properties': {'color': {'$ref': 'common.json#/color', 'default_value': '#14000000', '$description': 'translations.json#/div_separator_style_color'}, 'orientation': {'type': 'string', 'enum': ['vertical', 'horizontal'], 'default_value': 'horizontal', '$description': 'translations.json#/div_separator_style_orientation'}}}}, 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'properties': {'delimiter_style': {'$ref': '#/definitions/style', '$description': 'translations.json#/div_separator_delimiter_style'}, 'type': {'type': 'string', 'enum': ['separator']}}, 'required': ['type']}], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_container', 'codegen': {'divan': {'forced_properties_order': ['orientation'], 'factories': {'row': {'vararg_property': 'items', 'inlines': {'orientation': 'horizontal'}}, 'column': {'vararg_property': 'items', 'inlines': {'orientation': 'vertical'}}, 'stack': {'vararg_property': 'items', 'inlines': {'orientation': 'overlap'}}}}, 'swift': {'generate_optional_arguments': False}}, 'definitions': {'separator': {'type': 'object', 'properties': {'show_at_start': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_start', 'default_value': 'false'}, 'show_between': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_between', 'default_value': 'true'}, 'show_at_end': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_end', 'default_value': 'false'}, 'style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_container_separator_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}}, 'required': ['style']}}, 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'properties': {'type': {'type': 'string', 'enum': ['container']}, 'content_alignment_vertical': {'$ref': 'div-content-alignment-vertical.json', 'default_value': 'top', '$description': 'translations.json#/div_container_content_alignment_vertical'}, 'content_alignment_horizontal': {'$ref': 'div-content-alignment-horizontal.json', 'default_value': 'start', '$description': 'translations.json#/div_container_content_alignment_horizontal'}, 'orientation': {'type': 'string', 'enum': ['vertical', 'horizontal', 'overlap'], 'default_value': 'vertical', '$description': 'translations.json#/div_container_orientation'}, 'layout_mode': {'type': 'string', 'enum': ['no_wrap', 'wrap'], 'default_value': 'no_wrap', '$description': 'translations.json#/div_container_layout_mode'}, 'separator': {'$ref': '#/definitions/separator', '$description': 'translations.json#/div_container_separator'}, 'line_separator': {'$ref': '#/definitions/separator', '$description': 'translations.json#/div_container_line_separator'}, 'items': {'type': 'array', 'items': {'$ref': 'div.json'}, 'minItems': 1, '$description': 'translations.json#/div_container_items'}, 'aspect': {'$ref': 'div-aspect.json', '$description': 'translations.json#/div_container_aspect'}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_grid', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'$ref': 'div-base.json'}, {'$ref': 'div-actionable.json'}, {'properties': {'content_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'top', '$description': 'translations.json#/div_grid_content_alignment_vertical'}, 'content_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'start', '$description': 'translations.json#/div_grid_content_alignment_horizontal'}, 'items': {'type': 'array', 'items': {'$ref': 'div.json'}, 'minItems': 1, 'strictParsing': True, '$description': 'translations.json#/div_grid_items'}, 'column_count': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_grid_column_count'}, 'type': {'type': 'string', 'enum': ['grid']}}}], 'required': ['items', 'column_count', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_gallery', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['gallery']}, 'cross_content_alignment': {'$description': 'translations.json#/div_gallery_cross_content_alignment', 'version': '2.1', 'type': 'string', 'enum': ['start', 'center', 'end'], 'default_value': 'start'}, 'column_count': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_gallery_column_count'}, 'item_spacing': {'$ref': 'common.json#/non_negative_integer', 'default_value': '8', '$description': 'translations.json#/div_gallery_item_spacing'}, 'cross_spacing': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_gallery_cross_spacing'}, 'scroll_mode': {'type': 'string', 'default_value': 'default', 'enum': ['paging', 'default'], '$description': 'translations.json#/div_gallery_scroll_mode'}, 'items': {'type': 'array', 'items': {'$ref': 'div.json'}, 'minItems': 1, '$description': 'translations.json#/div_gallery_items'}, 'orientation': {'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_gallery_orientation'}, 'restrict_parent_scroll': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_gallery_restrict_parent_scroll', 'platforms': ['android', 'web']}, 'default_item': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_gallery_default_item'}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_pager', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['pager']}, 'layout_mode': {'$ref': 'div-pager-layout-mode.json', '$description': 'translations.json#/div_pager_layout_mode'}, 'item_spacing': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":0}', '$description': 'translations.json#/div_pager_item_spacing'}, 'items': {'type': 'array', 'items': {'$ref': 'div.json'}, 'minItems': 1, '$description': 'translations.json#/div_pager_items'}, 'orientation': {'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_pager_orientation'}, 'restrict_parent_scroll': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_pager_restrict_parent_scroll', 'platforms': ['android', 'web']}, 'default_item': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_pager_default_item'}, 'infinite_scroll': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_pager_infinite_scroll', 'platforms': []}}}], 'required': ['type', 'items', 'layout_mode'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_tabs', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'definitions': {'item': {'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_tabs_item_title'}, 'title_click_action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_tabs_item_title_click_action'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tabs_item_div'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['tabs']}, 'title_paddings': {'$ref': 'div-edge-insets.json', 'default_value': '{"left": 12,"right": 12,"top": 0,"bottom": 8}', '$description': 'translations.json#/div_tabs_title_paddings'}, 'separator_paddings': {'$ref': 'div-edge-insets.json', 'default_value': '{"left": 12,"right": 12,"top": 0,"bottom": 0}', '$description': 'translations.json#/div_tabs_separator_paddings'}, 'tab_title_style': {'type': 'object', 'properties': {'font_size': {'$ref': 'common.json#/non_negative_integer', 'default_value': '12', '$description': 'translations.json#/div_tabs_tab_title_style_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_tabs_tab_title_style_font_size_unit', 'platforms': ['android', 'ios']}, 'paddings': {'$ref': 'div-edge-insets.json', 'default_value': '{"left": 8,"right": 8,"top": 6,"bottom": 6}', '$description': 'translations.json#/div_tabs_tab_title_style_paddings'}, 'item_spacing': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_tabs_tab_title_style_item_spacing'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_tabs_tab_title_style_line_height'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_tabs_tab_title_style_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_tabs_tab_title_style_font_weight', 'deprecated': True}, 'active_font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_tabs_tab_title_style_active_font_weight'}, 'inactive_font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_tabs_tab_title_style_inactive_font_weight'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'active_text_color': {'$ref': 'common.json#/color', 'default_value': '#CC000000', '$description': 'translations.json#/div_tabs_tab_title_style_active_text_color'}, 'inactive_text_color': {'$ref': 'common.json#/color', 'default_value': '#80000000', '$description': 'translations.json#/div_tabs_tab_title_style_inactive_text_color'}, 'active_background_color': {'$ref': 'common.json#/color', 'default_value': '#FFFFDC60', '$description': 'translations.json#/div_tabs_tab_title_style_active_background_color'}, 'inactive_background_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_tabs_tab_title_style_inactive_background_color'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_tabs_tab_title_style_corner_radius'}, 'corners_radius': {'$ref': 'div-corners-radius.json', '$description': 'translations.json#/div_tabs_tab_title_style_corners_radius'}, 'animation_type': {'type': 'string', 'enum': ['slide', 'fade', 'none'], 'default_value': 'slide', '$description': 'translations.json#/div_tabs_tab_title_style_animation_type', 'platforms': ['android', 'ios']}, 'animation_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_tabs_tab_title_style_animation_duration'}}, '$description': 'translations.json#/div_tabs_tab_title_style'}, 'selected_tab': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_tabs_selected_tab'}, 'has_separator': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_tabs_has_separator'}, 'switch_tabs_by_content_swipe_enabled': {'$ref': 'common.json#/boolean_int', 'default_value': 'true', '$description': 'translations.json#/div_tabs_switch_tabs_by_content_swipe_enabled'}, 'separator_color': {'$ref': 'common.json#/color', 'default_value': '#14000000', '$description': 'translations.json#/div_tabs_separator_color'}, 'items': {'type': 'array', 'items': {'$ref': '#/definitions/item'}, 'minItems': 1, '$description': 'translations.json#/div_tabs_items'}, 'dynamic_height': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_tabs_dynamic_height', 'platforms': ['android', 'ios']}, 'restrict_parent_scroll': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_tabs_restrict_parent_scroll', 'platforms': ['android', 'web']}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_state', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'definitions': {'div_state': {'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_state_div_state_div'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_in', 'platforms': ['android', 'ios'], 'deprecated': True}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_out', 'platforms': ['android', 'ios'], 'deprecated': True}, 'swipe_out_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['state']}, 'states': {'type': 'array', 'items': {'$ref': '#/definitions/div_state'}, 'minItems': 1, '$description': 'translations.json#/div_state_states'}, 'state_id_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_state_state_id_variable', 'platforms': ['web', 'android']}, 'div_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_id', 'deprecated': True}, 'default_state_id': {'type': 'string', '$description': 'translations.json#/div_state_default_state_id'}, 'transition_animation_selector': {'$ref': 'div-transition-selector.json', 'default_value': 'state_change', '$description': 'translations.json#/div_state_transition_animation_selector', 'deprecated': True}}, 'required': ['type', 'states']}], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_custom', 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['custom']}, 'items': {'type': 'array', 'items': {'$ref': 'div.json'}, 'minItems': 1, '$description': 'translations.json#/div_custom_items'}, 'custom_type': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_custom_custom_type'}, 'custom_props': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_custom_custom_props'}}}], 'required': ['type', 'custom_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_indicator', 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['indicator']}, 'pager_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_indicator_pager_id'}, 'items_placement': {'$ref': 'div-indicator-item-placement.json', '$description': 'translations.json#/div_indicator_item_placement'}, 'space_between_centers': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":15}', '$description': 'translations.json#/div_indicator_space_between_centers', 'deprecated': True}, 'inactive_item_color': {'$ref': 'common.json#/color', 'default_value': '#33919cb5', '$description': 'translations.json#/div_indicator_inactive_item_color', 'deprecated': True}, 'active_item_color': {'$ref': 'common.json#/color', 'default_value': '#ffdc60', '$description': 'translations.json#/div_indicator_active_item_color', 'deprecated': True}, 'shape': {'$ref': 'div-shape.json', 'default_value': '{"type":"rounded_rectangle"}', '$description': 'translations.json#/div_indicator_shape', 'deprecated': True}, 'active_item_size': {'$ref': 'common.json#/positive_number', 'default_value': '1.3', '$description': 'translations.json#/div_indicator_active_item_size', 'deprecated': True}, 'minimum_item_size': {'$ref': 'common.json#/positive_number', 'default_value': '0.5', '$description': 'translations.json#/div_indicator_minimum_item_size', 'platforms': ['android', 'ios'], 'deprecated': True}, 'active_shape': {'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_indicator_active_shape'}, 'inactive_shape': {'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_indicator_inactive_shape'}, 'inactive_minimum_shape': {'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_indicator_inactive_minimum_shape', 'platforms': ['android', 'ios']}, 'animation': {'type': 'string', 'enum': ['scale', 'worm', 'slider'], 'default_value': 'scale', '$description': 'translations.json#/div_indicator_animation', 'platforms': ['android', 'ios']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_slider', 'definitions': {'text_style': {'type': 'object', 'properties': {'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', 'platforms': ['android']}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_color'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_slider_text_style_offset'}}, 'required': ['font_size']}, 'range': {'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_active_style'}, 'track_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_inactive_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_slider_range_margins'}}}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['slider']}, 'min_value': {'type': 'integer', 'default_value': '0', '$description': 'translations.json#/div_slider_min_value'}, 'max_value': {'type': 'integer', 'default_value': '100', '$description': 'translations.json#/div_slider_max_value'}, 'thumb_value_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_slider_thumb_value_variable'}, 'thumb_secondary_value_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_slider_thumb_secondary_value_variable'}, 'thumb_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_thumb_style'}, 'thumb_secondary_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_thumb_secondary_style'}, 'thumb_text_style': {'$ref': '#/definitions/text_style', '$description': 'translations.json#/div_slider_thumb_text_style'}, 'thumb_secondary_text_style': {'$ref': '#/definitions/text_style', '$description': 'translations.json#/div_slider_thumb_secondary_text_style'}, 'track_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_active_style'}, 'tick_mark_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_tick_mark_active_style'}, 'track_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_inactive_style'}, 'tick_mark_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_tick_mark_inactive_style'}, 'ranges': {'type': 'array', 'items': {'$ref': '#/definitions/range'}, 'minItems': 1, '$description': 'translations.json#/div_slider_ranges', 'platforms': ['android', 'ios']}, 'secondary_value_accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_slider_secondary_value_accessibility', 'platforms': ['web']}}}], 'required': ['type', 'thumb_style', 'track_active_style', 'track_inactive_style'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_input', 'definitions': {'native_interface': {'type': 'object', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_input_native_interface_color'}}, 'required': ['color']}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['input']}, 'font_size': {'$ref': 'common.json#/non_negative_integer', 'default_value': '12', '$description': 'translations.json#/div_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_color'}, 'text_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_text_variable'}, 'text_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'start', '$description': 'translations.json#/div_text_text_alignment_horizontal', 'platforms': ['android', 'web']}, 'text_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'center', '$description': 'translations.json#/div_text_text_alignment_vertical', 'platforms': ['android', 'web']}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_input_line_height'}, 'max_visible_lines': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_input_max_visible_lines'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_input_letter_spacing'}, 'hint_text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_hint_text'}, 'hint_color': {'$ref': 'common.json#/color', 'default_value': '#73000000', '$description': 'translations.json#/div_input_hint_color'}, 'highlight_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_input_highlight_color'}, 'native_interface': {'$ref': '#/definitions/native_interface', '$description': 'translations.json#/div_input_native_interface', 'platforms': ['android']}, 'keyboard_type': {'type': 'string', 'enum': ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri'], 'default_value': 'multi_line_text', '$description': 'translations.json#/div_input_keyboard_type'}, 'select_all_on_focus': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_input_select_all_on_focus'}, 'mask': {'$ref': 'div-input-mask.json', '$description': 'translations.json#/div_input_mask'}, 'validators': {'type': 'array', '$description': 'translations.json#/div_input_validators', 'platforms': ['android', 'ios'], 'items': {'$ref': 'div-input-validator.json'}}}}], 'required': ['type', 'text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_select', 'definitions': {'option': {'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}}, 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['select']}, 'options': {'type': 'array', 'items': {'$ref': '#/definitions/option', '$description': 'translations.json#/div_select_option'}, 'minItems': 1}, 'value_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_select_value_variable'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', 'default_value': '12', '$description': 'translations.json#/div_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'hint_text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_select_hint_text'}, 'hint_color': {'$ref': 'common.json#/color', 'default_value': '#73000000', '$description': 'translations.json#/div_select_hint_color'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_select_line_height'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_color'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_select_letter_spacing'}}}], 'required': ['type', 'options', 'value_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_video', 'allOf': [{'$ref': 'div-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['video']}, 'video_sources': {'type': 'array', 'items': {'$ref': 'div-video-source.json', '$description': 'translations.json#/div_video_source'}, 'minItems': 1}, 'repeatable': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_video_repeatable'}, 'autostart': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_video_autostart'}, 'muted': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_video_muted'}, 'preview': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_video_preview'}, 'elapsed_time_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_video_elapsed_time_variable'}, 'resume_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_video_resume_actions'}, 'pause_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_video_pause_actions'}, 'end_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_video_end_actions'}, 'buffering_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_video_buffering_actions'}, 'fatal_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_video_fatal_actions'}, 'player_settings_payload': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_video_player_settings_payload', 'platforms': ['android', 'ios']}, 'aspect': {'$ref': 'div-aspect.json', '$description': 'translations.json#/div_aspect', 'platforms': []}, 'scale': {'$ref': 'div-video-scale.json', 'default_value': 'fit', '$description': 'translations.json#/div_video_scale', 'platforms': ['web']}}}], 'required': ['type', 'video_sources'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_video_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['video']}, rule='type') + if data__type not in ['video']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['video']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['video']}, rule='enum') + if "video_sources" in data_keys: + data_keys.remove("video_sources") + data__videosources = data["video_sources"] + if not isinstance(data__videosources, (list, tuple)): + if not (isinstance(data__videosources, str) and '@' in data__videosources): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".video_sources must be array", value=data__videosources, name="" + (name_prefix or "data") + ".video_sources", definition={'type': 'array', 'items': {'definitions': {'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_width'}, 'height': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_height'}}, 'required': ['type', 'width', 'height']}}, 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['video_source']}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_video_source_url'}, 'resolution': {'$ref': '#/definitions/resolution', '$description': 'translations.json#/div_video_source_resolution'}, 'mime_type': {'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, 'bitrate': {'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}}, 'required': ['type', 'url', 'mime_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1}, rule='type') + data__videosources_is_list = isinstance(data__videosources, (list, tuple)) + if data__videosources_is_list: + data__videosources_len = len(data__videosources) + if data__videosources_len < 1: + if not (isinstance(data__videosources, str) and '@' in data__videosources): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".video_sources must contain at least 1 items", value=data__videosources, name="" + (name_prefix or "data") + ".video_sources", definition={'type': 'array', 'items': {'definitions': {'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_width'}, 'height': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_height'}}, 'required': ['type', 'width', 'height']}}, 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['video_source']}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_video_source_url'}, 'resolution': {'$ref': '#/definitions/resolution', '$description': 'translations.json#/div_video_source_resolution'}, 'mime_type': {'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, 'bitrate': {'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}}, 'required': ['type', 'url', 'mime_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1}, rule='minItems') + for data__videosources_x, data__videosources_item in enumerate(data__videosources): + validate_div_video_source_json(data__videosources_item, custom_formats, (name_prefix or "data") + ".video_sources[{data__videosources_x}]".format(**locals())) + if "repeatable" in data_keys: + data_keys.remove("repeatable") + data__repeatable = data["repeatable"] + validate_common_json__boolean_int(data__repeatable, custom_formats, (name_prefix or "data") + ".repeatable") + if "autostart" in data_keys: + data_keys.remove("autostart") + data__autostart = data["autostart"] + validate_common_json__boolean_int(data__autostart, custom_formats, (name_prefix or "data") + ".autostart") + if "muted" in data_keys: + data_keys.remove("muted") + data__muted = data["muted"] + validate_common_json__boolean_int(data__muted, custom_formats, (name_prefix or "data") + ".muted") + if "preview" in data_keys: + data_keys.remove("preview") + data__preview = data["preview"] + validate_common_json__non_empty_string(data__preview, custom_formats, (name_prefix or "data") + ".preview") + if "elapsed_time_variable" in data_keys: + data_keys.remove("elapsed_time_variable") + data__elapsedtimevariable = data["elapsed_time_variable"] + validate_div_variable_name_json(data__elapsedtimevariable, custom_formats, (name_prefix or "data") + ".elapsed_time_variable") + if "resume_actions" in data_keys: + data_keys.remove("resume_actions") + data__resumeactions = data["resume_actions"] + if not isinstance(data__resumeactions, (list, tuple)): + if not (isinstance(data__resumeactions, str) and '@' in data__resumeactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".resume_actions must be array", value=data__resumeactions, name="" + (name_prefix or "data") + ".resume_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_resume_actions'}, rule='type') + data__resumeactions_is_list = isinstance(data__resumeactions, (list, tuple)) + if data__resumeactions_is_list: + data__resumeactions_len = len(data__resumeactions) + if data__resumeactions_len < 1: + if not (isinstance(data__resumeactions, str) and '@' in data__resumeactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".resume_actions must contain at least 1 items", value=data__resumeactions, name="" + (name_prefix or "data") + ".resume_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_resume_actions'}, rule='minItems') + for data__resumeactions_x, data__resumeactions_item in enumerate(data__resumeactions): + validate_div_action_json(data__resumeactions_item, custom_formats, (name_prefix or "data") + ".resume_actions[{data__resumeactions_x}]".format(**locals())) + if "pause_actions" in data_keys: + data_keys.remove("pause_actions") + data__pauseactions = data["pause_actions"] + if not isinstance(data__pauseactions, (list, tuple)): + if not (isinstance(data__pauseactions, str) and '@' in data__pauseactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pause_actions must be array", value=data__pauseactions, name="" + (name_prefix or "data") + ".pause_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_pause_actions'}, rule='type') + data__pauseactions_is_list = isinstance(data__pauseactions, (list, tuple)) + if data__pauseactions_is_list: + data__pauseactions_len = len(data__pauseactions) + if data__pauseactions_len < 1: + if not (isinstance(data__pauseactions, str) and '@' in data__pauseactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pause_actions must contain at least 1 items", value=data__pauseactions, name="" + (name_prefix or "data") + ".pause_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_pause_actions'}, rule='minItems') + for data__pauseactions_x, data__pauseactions_item in enumerate(data__pauseactions): + validate_div_action_json(data__pauseactions_item, custom_formats, (name_prefix or "data") + ".pause_actions[{data__pauseactions_x}]".format(**locals())) + if "end_actions" in data_keys: + data_keys.remove("end_actions") + data__endactions = data["end_actions"] + if not isinstance(data__endactions, (list, tuple)): + if not (isinstance(data__endactions, str) and '@' in data__endactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".end_actions must be array", value=data__endactions, name="" + (name_prefix or "data") + ".end_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_end_actions'}, rule='type') + data__endactions_is_list = isinstance(data__endactions, (list, tuple)) + if data__endactions_is_list: + data__endactions_len = len(data__endactions) + if data__endactions_len < 1: + if not (isinstance(data__endactions, str) and '@' in data__endactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".end_actions must contain at least 1 items", value=data__endactions, name="" + (name_prefix or "data") + ".end_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_end_actions'}, rule='minItems') + for data__endactions_x, data__endactions_item in enumerate(data__endactions): + validate_div_action_json(data__endactions_item, custom_formats, (name_prefix or "data") + ".end_actions[{data__endactions_x}]".format(**locals())) + if "buffering_actions" in data_keys: + data_keys.remove("buffering_actions") + data__bufferingactions = data["buffering_actions"] + if not isinstance(data__bufferingactions, (list, tuple)): + if not (isinstance(data__bufferingactions, str) and '@' in data__bufferingactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".buffering_actions must be array", value=data__bufferingactions, name="" + (name_prefix or "data") + ".buffering_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_buffering_actions'}, rule='type') + data__bufferingactions_is_list = isinstance(data__bufferingactions, (list, tuple)) + if data__bufferingactions_is_list: + data__bufferingactions_len = len(data__bufferingactions) + if data__bufferingactions_len < 1: + if not (isinstance(data__bufferingactions, str) and '@' in data__bufferingactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".buffering_actions must contain at least 1 items", value=data__bufferingactions, name="" + (name_prefix or "data") + ".buffering_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_buffering_actions'}, rule='minItems') + for data__bufferingactions_x, data__bufferingactions_item in enumerate(data__bufferingactions): + validate_div_action_json(data__bufferingactions_item, custom_formats, (name_prefix or "data") + ".buffering_actions[{data__bufferingactions_x}]".format(**locals())) + if "fatal_actions" in data_keys: + data_keys.remove("fatal_actions") + data__fatalactions = data["fatal_actions"] + if not isinstance(data__fatalactions, (list, tuple)): + if not (isinstance(data__fatalactions, str) and '@' in data__fatalactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".fatal_actions must be array", value=data__fatalactions, name="" + (name_prefix or "data") + ".fatal_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_fatal_actions'}, rule='type') + data__fatalactions_is_list = isinstance(data__fatalactions, (list, tuple)) + if data__fatalactions_is_list: + data__fatalactions_len = len(data__fatalactions) + if data__fatalactions_len < 1: + if not (isinstance(data__fatalactions, str) and '@' in data__fatalactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".fatal_actions must contain at least 1 items", value=data__fatalactions, name="" + (name_prefix or "data") + ".fatal_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_fatal_actions'}, rule='minItems') + for data__fatalactions_x, data__fatalactions_item in enumerate(data__fatalactions): + validate_div_action_json(data__fatalactions_item, custom_formats, (name_prefix or "data") + ".fatal_actions[{data__fatalactions_x}]".format(**locals())) + if "player_settings_payload" in data_keys: + data_keys.remove("player_settings_payload") + data__playersettingspayload = data["player_settings_payload"] + if not isinstance(data__playersettingspayload, (dict)): + if not (isinstance(data__playersettingspayload, str) and '@' in data__playersettingspayload): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".player_settings_payload must be object", value=data__playersettingspayload, name="" + (name_prefix or "data") + ".player_settings_payload", definition={'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_video_player_settings_payload', 'platforms': ['android', 'ios']}, rule='type') + data__playersettingspayload_is_dict = isinstance(data__playersettingspayload, dict) + if data__playersettingspayload_is_dict: + data__playersettingspayload_keys = set(data__playersettingspayload.keys()) + if "aspect" in data_keys: + data_keys.remove("aspect") + data__aspect = data["aspect"] + validate_div_aspect_json(data__aspect, custom_formats, (name_prefix or "data") + ".aspect") + if "scale" in data_keys: + data_keys.remove("scale") + data__scale = data["scale"] + validate_div_video_scale_json(data__scale, custom_formats, (name_prefix or "data") + ".scale") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'video_sources']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_video', 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['video']}, 'video_sources': {'type': 'array', 'items': {'definitions': {'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_width'}, 'height': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_height'}}, 'required': ['type', 'width', 'height']}}, 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['video_source']}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_video_source_url'}, 'resolution': {'$ref': '#/definitions/resolution', '$description': 'translations.json#/div_video_source_resolution'}, 'mime_type': {'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, 'bitrate': {'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}}, 'required': ['type', 'url', 'mime_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1}, 'repeatable': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'autostart': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'muted': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'preview': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'elapsed_time_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'resume_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_resume_actions'}, 'pause_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_pause_actions'}, 'end_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_end_actions'}, 'buffering_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_buffering_actions'}, 'fatal_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_video_fatal_actions'}, 'player_settings_payload': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_video_player_settings_payload', 'platforms': ['android', 'ios']}, 'aspect': {'type': 'object', '$description': 'translations.json#/div_aspect', 'properties': {'ratio': {'$ref': 'common.json#/positive_number', '$description': 'translations.json#/div_aspect_ratio'}}, 'required': ['ratio'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'scale': {'type': 'string', 'enum': ['fill', 'no_scale', 'fit'], '$schema': 'http://json-schema.org/draft-07/schema'}}}], 'required': ['type', 'video_sources'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_video_scale_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['fill', 'no_scale', 'fit'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['fill', 'no_scale', 'fit']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['fill', 'no_scale', 'fit']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['fill', 'no_scale', 'fit'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_aspect_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_aspect', 'properties': {'ratio': {'type': 'number', 'constraint': 'number > 0'}}, 'required': ['ratio'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['ratio']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_aspect', 'properties': {'ratio': {'type': 'number', 'constraint': 'number > 0'}}, 'required': ['ratio'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "ratio" in data_keys: + data_keys.remove("ratio") + data__ratio = data["ratio"] + validate_common_json__positive_number(data__ratio, custom_formats, (name_prefix or "data") + ".ratio") + return data + +def validate_common_json__positive_number(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (int, float, Decimal)) or isinstance(data, bool): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be number", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'number', 'constraint': 'number > 0'}, rule='type') + return data + +def validate_div_action_json(data, custom_formats={}, name_prefix=None): + validate_div_action_base_json(data, custom_formats, (name_prefix or "data") + "") + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'type': 'string', 'format': 'uri'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['log_id']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'type': 'string', 'format': 'uri'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}, rule='required') + data_keys = set(data.keys()) + if "menu_items" in data_keys: + data_keys.remove("menu_items") + data__menuitems = data["menu_items"] + if not isinstance(data__menuitems, (list, tuple)): + if not (isinstance(data__menuitems, str) and '@' in data__menuitems): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".menu_items must be array", value=data__menuitems, name="" + (name_prefix or "data") + ".menu_items", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, rule='type') + data__menuitems_is_list = isinstance(data__menuitems, (list, tuple)) + if data__menuitems_is_list: + data__menuitems_len = len(data__menuitems) + for data__menuitems_x, data__menuitems_item in enumerate(data__menuitems): + validate_div_action_json__definitions_menu_item(data__menuitems_item, custom_formats, (name_prefix or "data") + ".menu_items[{data__menuitems_x}]".format(**locals())) + if "log_url" in data_keys: + data_keys.remove("log_url") + data__logurl = data["log_url"] + validate_common_json__url(data__logurl, custom_formats, (name_prefix or "data") + ".log_url") + if "target" in data_keys: + data_keys.remove("target") + data__target = data["target"] + if not isinstance(data__target, (str)): + if not (isinstance(data__target, str) and '@' in data__target): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".target must be string", value=data__target, name="" + (name_prefix or "data") + ".target", definition={'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}, rule='type') + if data__target not in ['_self', '_blank']: + if not (isinstance(data__target, str) and '@' in data__target): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".target must be one of ['_self', '_blank']", value=data__target, name="" + (name_prefix or "data") + ".target", definition={'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}, rule='enum') + return data + +def validate_common_json__url(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'uri'}, rule='type') + if isinstance(data, str): + if not custom_formats["uri"](data): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be uri", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'uri'}, rule='format') + return data + +def validate_div_action_json__definitions_menu_item(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'action': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['text']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'action': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}, rule='required') + data_keys = set(data.keys()) + if "text" in data_keys: + data_keys.remove("text") + data__text = data["text"] + validate_common_json__non_empty_string(data__text, custom_formats, (name_prefix or "data") + ".text") + if "action" in data_keys: + data_keys.remove("action") + data__action = data["action"] + validate_div_action_json(data__action, custom_formats, (name_prefix or "data") + ".action") + if "actions" in data_keys: + data_keys.remove("actions") + data__actions = data["actions"] + if not isinstance(data__actions, (list, tuple)): + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must be array", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}, rule='type') + data__actions_is_list = isinstance(data__actions, (list, tuple)) + if data__actions_is_list: + data__actions_len = len(data__actions) + if data__actions_len < 1: + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must contain at least 1 items", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}, rule='minItems') + for data__actions_x, data__actions_item in enumerate(data__actions): + validate_div_action_json(data__actions_item, custom_formats, (name_prefix or "data") + ".actions[{data__actions_x}]".format(**locals())) + return data + +def validate_div_action_base_json(data, custom_formats={}, name_prefix=None): + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "log_id" in data_keys: + data_keys.remove("log_id") + data__logid = data["log_id"] + validate_common_json__non_empty_string(data__logid, custom_formats, (name_prefix or "data") + ".log_id") + if "url" in data_keys: + data_keys.remove("url") + data__url = data["url"] + validate_common_json__url(data__url, custom_formats, (name_prefix or "data") + ".url") + if "referer" in data_keys: + data_keys.remove("referer") + data__referer = data["referer"] + validate_common_json__url(data__referer, custom_formats, (name_prefix or "data") + ".referer") + if "payload" in data_keys: + data_keys.remove("payload") + data__payload = data["payload"] + if not isinstance(data__payload, (dict)): + if not (isinstance(data__payload, str) and '@' in data__payload): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".payload must be object", value=data__payload, name="" + (name_prefix or "data") + ".payload", definition={'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_action_base_payload'}, rule='type') + data__payload_is_dict = isinstance(data__payload, dict) + if data__payload_is_dict: + data__payload_keys = set(data__payload.keys()) + if "download_callbacks" in data_keys: + data_keys.remove("download_callbacks") + data__downloadcallbacks = data["download_callbacks"] + validate_div_download_callbacks_json(data__downloadcallbacks, custom_formats, (name_prefix or "data") + ".download_callbacks") + if "typed" in data_keys: + data_keys.remove("typed") + data__typed = data["typed"] + validate_div_action_typed_json(data__typed, custom_formats, (name_prefix or "data") + ".typed") + return data + +def validate_div_action_typed_json(data, custom_formats={}, name_prefix=None): + data_any_of_count2 = 0 + if not data_any_of_count2: + try: + validate_div_action_array_insert_value_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count2 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count2: + try: + validate_div_action_array_remove_value_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count2 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count2: + try: + validate_div_action_set_variable_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count2 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count2: + try: + validate_div_action_focus_element_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count2 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count2: + try: + validate_div_action_copy_to_clipboard_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count2 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count2: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_action_array_insert_value', 'properties': {'type': {'type': 'string', 'enum': ['array_insert_value']}, 'variable_name': {'$ref': 'common.json#/non_empty_string'}, 'index': {'type': 'integer'}, 'value': {'$ref': 'div-typed-value.json'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_action_array_remove_value', 'properties': {'type': {'type': 'string', 'enum': ['array_remove_value']}, 'variable_name': {'$ref': 'common.json#/non_empty_string'}, 'index': {'type': 'integer'}}, 'required': ['type', 'variable_name', 'index'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_action_set_variable', 'properties': {'type': {'type': 'string', 'enum': ['set_variable']}, 'variable_name': {'$ref': 'common.json#/non_empty_string'}, 'value': {'$ref': 'div-typed-value.json'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_action_focus_element', 'properties': {'type': {'type': 'string', 'enum': ['focus_element']}, 'element_id': {'$ref': 'common.json#/non_empty_string'}}, 'required': ['type', 'element_id'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_action_copy_to_clipboard', 'properties': {'type': {'type': 'string', 'enum': ['copy_to_clipboard']}, 'content': {'$ref': 'div-action-copy-to-clipboard-content.json'}}, 'required': ['type', 'content'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_action_copy_to_clipboard_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_copy_to_clipboard', 'properties': {'type': {'type': 'string', 'enum': ['copy_to_clipboard']}, 'content': {'definitions': {'content_text': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'content_url': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#/definitions/content_text'}, {'$ref': '#/definitions/content_url'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'content'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'content']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_copy_to_clipboard', 'properties': {'type': {'type': 'string', 'enum': ['copy_to_clipboard']}, 'content': {'definitions': {'content_text': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'content_url': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#/definitions/content_text'}, {'$ref': '#/definitions/content_url'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'content'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['copy_to_clipboard']}, rule='type') + if data__type not in ['copy_to_clipboard']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['copy_to_clipboard']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['copy_to_clipboard']}, rule='enum') + if "content" in data_keys: + data_keys.remove("content") + data__content = data["content"] + validate_div_action_copy_to_clipboard_content_json(data__content, custom_formats, (name_prefix or "data") + ".content") + return data + +def validate_div_action_copy_to_clipboard_content_json(data, custom_formats={}, name_prefix=None): + data_any_of_count3 = 0 + if not data_any_of_count3: + try: + validate_div_action_copy_to_clipboard_content_json__definitions_content_text(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count3 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count3: + try: + validate_div_action_copy_to_clipboard_content_json__definitions_content_url(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count3 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count3: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'definitions': {'content_text': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'content_url': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}}, 'anyOf': [{'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_action_copy_to_clipboard_content_json__definitions_content_url(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['url']}, rule='type') + if data__type not in ['url']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['url']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['url']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__url(data__value, custom_formats, (name_prefix or "data") + ".value") + return data + +def validate_div_action_copy_to_clipboard_content_json__definitions_content_text(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['text']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['text']}, rule='type') + if data__type not in ['text']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['text']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['text']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (str)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be string", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'string'}, rule='type') + return data + +def validate_div_action_focus_element_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_focus_element', 'properties': {'type': {'type': 'string', 'enum': ['focus_element']}, 'element_id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}, 'required': ['type', 'element_id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'element_id']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_focus_element', 'properties': {'type': {'type': 'string', 'enum': ['focus_element']}, 'element_id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}, 'required': ['type', 'element_id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['focus_element']}, rule='type') + if data__type not in ['focus_element']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['focus_element']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['focus_element']}, rule='enum') + if "element_id" in data_keys: + data_keys.remove("element_id") + data__elementid = data["element_id"] + validate_common_json__non_empty_string(data__elementid, custom_formats, (name_prefix or "data") + ".element_id") + return data + +def validate_div_action_set_variable_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_set_variable', 'properties': {'type': {'type': 'string', 'enum': ['set_variable']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'value': {'definitions': {'string_value': {'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'integer_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, 'number_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, 'color_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'$ref': 'common.json#/color'}}, 'required': ['type', 'value']}, 'boolean_value': {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, 'url_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}, 'dict_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, 'array_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#definitions/string_value'}, {'$ref': '#definitions/integer_value'}, {'$ref': '#definitions/number_value'}, {'$ref': '#definitions/color_value'}, {'$ref': '#definitions/boolean_value'}, {'$ref': '#definitions/url_value'}, {'$ref': '#definitions/dict_value'}, {'$ref': '#definitions/array_value'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'variable_name', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_set_variable', 'properties': {'type': {'type': 'string', 'enum': ['set_variable']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'value': {'definitions': {'string_value': {'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'integer_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, 'number_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, 'color_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'$ref': 'common.json#/color'}}, 'required': ['type', 'value']}, 'boolean_value': {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, 'url_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}, 'dict_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, 'array_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#definitions/string_value'}, {'$ref': '#definitions/integer_value'}, {'$ref': '#definitions/number_value'}, {'$ref': '#definitions/color_value'}, {'$ref': '#definitions/boolean_value'}, {'$ref': '#definitions/url_value'}, {'$ref': '#definitions/dict_value'}, {'$ref': '#definitions/array_value'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set_variable']}, rule='type') + if data__type not in ['set_variable']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['set_variable']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set_variable']}, rule='enum') + if "variable_name" in data_keys: + data_keys.remove("variable_name") + data__variablename = data["variable_name"] + validate_common_json__non_empty_string(data__variablename, custom_formats, (name_prefix or "data") + ".variable_name") + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_div_typed_value_json(data__value, custom_formats, (name_prefix or "data") + ".value") + return data + +def validate_div_typed_value_json(data, custom_formats={}, name_prefix=None): + data_any_of_count4 = 0 + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_string_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_integer_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_number_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_color_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_boolean_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_url_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_dict_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + try: + validate_div_typed_value_json_definitions_array_value(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count4: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'definitions': {'string_value': {'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'integer_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, 'number_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, 'color_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'type': 'string', 'format': 'color'}}, 'required': ['type', 'value']}, 'boolean_value': {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, 'url_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}, 'dict_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, 'array_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}}, 'anyOf': [{'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'$ref': 'common.json#/color'}}, 'required': ['type', 'value']}, {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_typed_value_json_definitions_array_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array']}, rule='type') + if data__type not in ['array']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['array']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (list, tuple)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be array", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'array'}, rule='type') + return data + +def validate_div_typed_value_json_definitions_dict_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['dict']}, rule='type') + if data__type not in ['dict']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['dict']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['dict']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (dict)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be object", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'object', 'additionalProperties': True}, rule='type') + data__value_is_dict = isinstance(data__value, dict) + if data__value_is_dict: + data__value_keys = set(data__value.keys()) + return data + +def validate_div_typed_value_json_definitions_url_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'type': 'string', 'format': 'uri'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['url']}, rule='type') + if data__type not in ['url']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['url']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['url']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__url(data__value, custom_formats, (name_prefix or "data") + ".value") + return data + +def validate_div_typed_value_json_definitions_boolean_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['boolean']}, rule='type') + if data__type not in ['boolean']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['boolean']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['boolean']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (bool)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be boolean", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'boolean'}, rule='type') + return data + +def validate_div_typed_value_json_definitions_color_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'type': 'string', 'format': 'color'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'type': 'string', 'format': 'color'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['color']}, rule='type') + if data__type not in ['color']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['color']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['color']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__color(data__value, custom_formats, (name_prefix or "data") + ".value") + return data + +def validate_common_json__color(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'color'}, rule='type') + if isinstance(data, str): + if not custom_formats["color"](data): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be color", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'color'}, rule='format') + return data + +def validate_div_typed_value_json_definitions_number_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['number']}, rule='type') + if data__type not in ['number']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['number']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['number']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int, float, Decimal)) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be number", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'number'}, rule='type') + return data + +def validate_div_typed_value_json_definitions_integer_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['integer']}, rule='type') + if data__type not in ['integer']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['integer']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['integer']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int)) and not (isinstance(data__value, float) and data__value.is_integer()) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be integer", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'integer'}, rule='type') + return data + +def validate_div_typed_value_json_definitions_string_value(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['string']}, rule='type') + if data__type not in ['string']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['string']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['string']}, rule='enum') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (str)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be string", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'string'}, rule='type') + return data + +def validate_div_action_array_remove_value_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_array_remove_value', 'properties': {'type': {'type': 'string', 'enum': ['array_remove_value']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'index': {'type': 'integer'}}, 'required': ['type', 'variable_name', 'index'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'variable_name', 'index']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_array_remove_value', 'properties': {'type': {'type': 'string', 'enum': ['array_remove_value']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'index': {'type': 'integer'}}, 'required': ['type', 'variable_name', 'index'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array_remove_value']}, rule='type') + if data__type not in ['array_remove_value']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['array_remove_value']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array_remove_value']}, rule='enum') + if "variable_name" in data_keys: + data_keys.remove("variable_name") + data__variablename = data["variable_name"] + validate_common_json__non_empty_string(data__variablename, custom_formats, (name_prefix or "data") + ".variable_name") + if "index" in data_keys: + data_keys.remove("index") + data__index = data["index"] + if not isinstance(data__index, (int)) and not (isinstance(data__index, float) and data__index.is_integer()) or isinstance(data__index, bool): + if not (isinstance(data__index, str) and '@' in data__index): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".index must be integer", value=data__index, name="" + (name_prefix or "data") + ".index", definition={'type': 'integer'}, rule='type') + return data + +def validate_div_action_array_insert_value_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_array_insert_value', 'properties': {'type': {'type': 'string', 'enum': ['array_insert_value']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'index': {'type': 'integer'}, 'value': {'definitions': {'string_value': {'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'integer_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, 'number_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, 'color_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'$ref': 'common.json#/color'}}, 'required': ['type', 'value']}, 'boolean_value': {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, 'url_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}, 'dict_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, 'array_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#definitions/string_value'}, {'$ref': '#definitions/integer_value'}, {'$ref': '#definitions/number_value'}, {'$ref': '#definitions/color_value'}, {'$ref': '#definitions/boolean_value'}, {'$ref': '#definitions/url_value'}, {'$ref': '#definitions/dict_value'}, {'$ref': '#definitions/array_value'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'variable_name', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_action_array_insert_value', 'properties': {'type': {'type': 'string', 'enum': ['array_insert_value']}, 'variable_name': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'index': {'type': 'integer'}, 'value': {'definitions': {'string_value': {'alias_kotlin': 'str_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['string']}, 'value': {'type': 'string'}}, 'required': ['type', 'value']}, 'integer_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['integer']}, 'value': {'type': 'integer'}}, 'required': ['type', 'value']}, 'number_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['number']}, 'value': {'type': 'number'}}, 'required': ['type', 'value']}, 'color_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['color']}, 'value': {'$ref': 'common.json#/color'}}, 'required': ['type', 'value']}, 'boolean_value': {'alias_kotlin': 'bool_value', 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['boolean']}, 'value': {'type': 'boolean'}}, 'required': ['type', 'value']}, 'url_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['url']}, 'value': {'$ref': 'common.json#/url'}}, 'required': ['type', 'value']}, 'dict_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['dict']}, 'value': {'type': 'object', 'additionalProperties': True}}, 'required': ['type', 'value']}, 'array_value': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['array']}, 'value': {'type': 'array'}}, 'required': ['type', 'value']}}, 'anyOf': [{'$ref': '#definitions/string_value'}, {'$ref': '#definitions/integer_value'}, {'$ref': '#definitions/number_value'}, {'$ref': '#definitions/color_value'}, {'$ref': '#definitions/boolean_value'}, {'$ref': '#definitions/url_value'}, {'$ref': '#definitions/dict_value'}, {'$ref': '#definitions/array_value'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'variable_name', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array_insert_value']}, rule='type') + if data__type not in ['array_insert_value']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['array_insert_value']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['array_insert_value']}, rule='enum') + if "variable_name" in data_keys: + data_keys.remove("variable_name") + data__variablename = data["variable_name"] + validate_common_json__non_empty_string(data__variablename, custom_formats, (name_prefix or "data") + ".variable_name") + if "index" in data_keys: + data_keys.remove("index") + data__index = data["index"] + if not isinstance(data__index, (int)) and not (isinstance(data__index, float) and data__index.is_integer()) or isinstance(data__index, bool): + if not (isinstance(data__index, str) and '@' in data__index): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".index must be integer", value=data__index, name="" + (name_prefix or "data") + ".index", definition={'type': 'integer'}, rule='type') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_div_typed_value_json(data__value, custom_formats, (name_prefix or "data") + ".value") + return data + +def validate_div_download_callbacks_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_download_callbacks', 'platforms': ['android', 'ios'], 'properties': {'on_fail_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_fail_actions'}, 'on_success_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_success_actions'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "on_fail_actions" in data_keys: + data_keys.remove("on_fail_actions") + data__onfailactions = data["on_fail_actions"] + if not isinstance(data__onfailactions, (list, tuple)): + if not (isinstance(data__onfailactions, str) and '@' in data__onfailactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_fail_actions must be array", value=data__onfailactions, name="" + (name_prefix or "data") + ".on_fail_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_fail_actions'}, rule='type') + data__onfailactions_is_list = isinstance(data__onfailactions, (list, tuple)) + if data__onfailactions_is_list: + data__onfailactions_len = len(data__onfailactions) + if data__onfailactions_len < 1: + if not (isinstance(data__onfailactions, str) and '@' in data__onfailactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_fail_actions must contain at least 1 items", value=data__onfailactions, name="" + (name_prefix or "data") + ".on_fail_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_fail_actions'}, rule='minItems') + for data__onfailactions_x, data__onfailactions_item in enumerate(data__onfailactions): + validate_div_action_json(data__onfailactions_item, custom_formats, (name_prefix or "data") + ".on_fail_actions[{data__onfailactions_x}]".format(**locals())) + if "on_success_actions" in data_keys: + data_keys.remove("on_success_actions") + data__onsuccessactions = data["on_success_actions"] + if not isinstance(data__onsuccessactions, (list, tuple)): + if not (isinstance(data__onsuccessactions, str) and '@' in data__onsuccessactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_success_actions must be array", value=data__onsuccessactions, name="" + (name_prefix or "data") + ".on_success_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_success_actions'}, rule='type') + data__onsuccessactions_is_list = isinstance(data__onsuccessactions, (list, tuple)) + if data__onsuccessactions_is_list: + data__onsuccessactions_len = len(data__onsuccessactions) + if data__onsuccessactions_len < 1: + if not (isinstance(data__onsuccessactions, str) and '@' in data__onsuccessactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_success_actions must contain at least 1 items", value=data__onsuccessactions, name="" + (name_prefix or "data") + ".on_success_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_download_callbacks_on_success_actions'}, rule='minItems') + for data__onsuccessactions_x, data__onsuccessactions_item in enumerate(data__onsuccessactions): + validate_div_action_json(data__onsuccessactions_item, custom_formats, (name_prefix or "data") + ".on_success_actions[{data__onsuccessactions_x}]".format(**locals())) + return data + +def validate_div_variable_name_json(data, custom_formats={}, name_prefix=None): + validate_common_json__non_empty_string(data, custom_formats, (name_prefix or "data") + "") + return data + +def validate_common_json__non_empty_string(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'minLength': 1, 'clientMinLength': 1}, rule='type') + if isinstance(data, str): + data_len = len(data) + if data_len < 1: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be longer than or equal to 1 characters", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'minLength': 1, 'clientMinLength': 1}, rule='minLength') + return data + +def validate_common_json__boolean_int(data, custom_formats={}, name_prefix=None): + data_one_of_count5 = 0 + if data_one_of_count5 < 2: + try: + if not isinstance(data, (bool)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be boolean", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'boolean'}, rule='type') + data_one_of_count5 += 1 + except JsonSchemaValueException: pass + if data_one_of_count5 < 2: + try: + if not isinstance(data, (int)) and not (isinstance(data, float) and data.is_integer()) or isinstance(data, bool): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be integer", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'integer', 'enum': [0, 1]}, rule='type') + if data not in [0, 1]: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of [0, 1]", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'integer', 'enum': [0, 1]}, rule='enum') + data_one_of_count5 += 1 + except JsonSchemaValueException: pass + if data_one_of_count5 != 1: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be valid exactly by one definition" + (" (" + str(data_one_of_count5) + " matches found)"), value=data, name="" + (name_prefix or "data") + "", definition={'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, rule='oneOf') + return data + +def validate_div_video_source_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'definitions': {'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'type': 'integer', 'constraint': 'number > 0'}, 'height': {'type': 'integer', 'constraint': 'number > 0'}}, 'required': ['type', 'width', 'height']}}, 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['video_source']}, 'url': {'type': 'string', 'format': 'uri'}, 'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_width'}, 'height': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_height'}}, 'required': ['type', 'width', 'height']}, 'mime_type': {'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, 'bitrate': {'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}}, 'required': ['type', 'url', 'mime_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'url', 'mime_type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'definitions': {'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'type': 'integer', 'constraint': 'number > 0'}, 'height': {'type': 'integer', 'constraint': 'number > 0'}}, 'required': ['type', 'width', 'height']}}, 'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['video_source']}, 'url': {'type': 'string', 'format': 'uri'}, 'resolution': {'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_width'}, 'height': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_video_source_resolution_height'}}, 'required': ['type', 'width', 'height']}, 'mime_type': {'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, 'bitrate': {'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}}, 'required': ['type', 'url', 'mime_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['video_source']}, rule='type') + if data__type not in ['video_source']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['video_source']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['video_source']}, rule='enum') + if "url" in data_keys: + data_keys.remove("url") + data__url = data["url"] + validate_common_json__url(data__url, custom_formats, (name_prefix or "data") + ".url") + if "resolution" in data_keys: + data_keys.remove("resolution") + data__resolution = data["resolution"] + validate_div_video_source_json__definitions_resolution(data__resolution, custom_formats, (name_prefix or "data") + ".resolution") + if "mime_type" in data_keys: + data_keys.remove("mime_type") + data__mimetype = data["mime_type"] + if not isinstance(data__mimetype, (str)): + if not (isinstance(data__mimetype, str) and '@' in data__mimetype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".mime_type must be string", value=data__mimetype, name="" + (name_prefix or "data") + ".mime_type", definition={'type': 'string', '$description': 'translations.json#/div_video_source_mime_type'}, rule='type') + if "bitrate" in data_keys: + data_keys.remove("bitrate") + data__bitrate = data["bitrate"] + if not isinstance(data__bitrate, (int)) and not (isinstance(data__bitrate, float) and data__bitrate.is_integer()) or isinstance(data__bitrate, bool): + if not (isinstance(data__bitrate, str) and '@' in data__bitrate): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".bitrate must be integer", value=data__bitrate, name="" + (name_prefix or "data") + ".bitrate", definition={'type': 'integer', '$description': 'translations.json#/div_video_source_bitrate'}, rule='type') + return data + +def validate_div_video_source_json__definitions_resolution(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'type': 'integer', 'constraint': 'number > 0'}, 'height': {'type': 'integer', 'constraint': 'number > 0'}}, 'required': ['type', 'width', 'height']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'width', 'height']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'type': {'type': 'string', 'enum': ['resolution']}, 'width': {'type': 'integer', 'constraint': 'number > 0'}, 'height': {'type': 'integer', 'constraint': 'number > 0'}}, 'required': ['type', 'width', 'height']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['resolution']}, rule='type') + if data__type not in ['resolution']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['resolution']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['resolution']}, rule='enum') + if "width" in data_keys: + data_keys.remove("width") + data__width = data["width"] + validate_common_json__positive_integer(data__width, custom_formats, (name_prefix or "data") + ".width") + if "height" in data_keys: + data_keys.remove("height") + data__height = data["height"] + validate_common_json__positive_integer(data__height, custom_formats, (name_prefix or "data") + ".height") + return data + +def validate_common_json__positive_integer(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (int)) and not (isinstance(data, float) and data.is_integer()) or isinstance(data, bool): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be integer", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'integer', 'constraint': 'number > 0'}, rule='type') + return data + +def validate_div_base_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'border': {'type': 'object', '$description': 'translations.json#/div_border', 'properties': {'has_shadow': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_border_has_shadow'}, 'shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_border_shadow'}, 'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_border_stroke'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_border_corner_radius'}, 'corners_radius': {'$ref': 'div-corners-radius.json', '$description': 'translations.json#/div_border_corners_radius'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'width': {'anyOf': [{'$ref': 'div-fixed-size.json', '$description': 'translations.json#/div_size_fixed'}, {'$ref': 'div-match-parent-size.json', '$description': 'translations.json#/div_size_match_parent'}, {'$ref': 'div-wrap-content-size.json', '$description': 'translations.json#/div_size_wrap_content'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'height': {'anyOf': [{'$ref': 'div-fixed-size.json', '$description': 'translations.json#/div_size_fixed'}, {'$ref': 'div-match-parent-size.json', '$description': 'translations.json#/div_size_match_parent'}, {'$ref': 'div-wrap-content-size.json', '$description': 'translations.json#/div_size_wrap_content'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'background': {'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'row_span': {'type': 'integer', 'constraint': 'number >= 0'}, 'column_span': {'type': 'integer', 'constraint': 'number >= 0'}, 'visibility_action': {'$description': 'translations.json#/div_visibility_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number > 0 && number <= 100', 'default_value': '50', '$description': 'translations.json#/div_visibility_action_visibility_percentage'}, 'visibility_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_visibility_action_visibility_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'visibility_actions': {'type': 'array', 'items': {'$description': 'translations.json#/div_visibility_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number > 0 && number <= 100', 'default_value': '50', '$description': 'translations.json#/div_visibility_action_visibility_percentage'}, 'visibility_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_visibility_action_visibility_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$description': 'translations.json#/div_disappear_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number >= 0 && number < 100', 'default_value': '0', '$description': 'translations.json#/div_disappear_action_visibility_percentage'}, 'disappear_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_disappear_action_disappear_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_tooltip', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_tooltip_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tooltip_div'}, 'position': {'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '5000', '$description': 'translations.json#/div_tooltip_duration'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_tooltip_offset'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_in'}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_out'}}, 'required': ['id', 'div', 'position'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'type': 'object', '$description': 'translations.json#/div_accessibility', 'properties': {'description': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_description'}, 'type': {'type': 'string', 'enum': ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select'], 'supports_expressions': False, '$description': 'translations.json#/div_accessibility_type', 'platforms': ['android', 'ios']}, 'state_description': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_state_description', 'platforms': ['android', 'ios']}, 'hint': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_hint', 'platforms': ['android', 'ios']}, 'mode': {'type': 'string', 'enum': ['default', 'merge', 'exclude'], 'default_value': 'default', '$description': 'translations.json#/div_accessibility_mode', 'platforms': ['android', 'ios']}, 'mute_after_action': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_accessibility_mute_after_action', 'platforms': ['ios']}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'extensions': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_extension', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_extension_id'}, 'params': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}}, 'required': ['id'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'type': 'string', 'enum': ['data_change', 'state_change', 'visibility_change'], '$description': 'translations.json#/div_transition_trigger', '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'transition_change': {'$description': 'translations.json#/div_change_transition', 'anyOf': [{'$ref': 'div-change-set-transition.json', '$description': 'translations.json#/div_change_transition_set'}, {'$ref': 'div-change-bounds-transition.json', '$description': 'translations.json#/div_change_transition_bounds'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'transition_out': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'selected_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'type': 'object', '$description': 'translations.json#/div_focus', 'properties': {'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_focus_background'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_focus_border'}, 'on_focus': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_focus'}, 'on_blur': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_blur'}, 'next_focus_ids': {'type': 'object', '$description': 'translations.json#/div_focus_next_focus_ids', 'properties': {'forward': {'$ref': 'common.json#/non_empty_string'}, 'right': {'$ref': 'common.json#/non_empty_string'}, 'down': {'$ref': 'common.json#/non_empty_string'}, 'left': {'$ref': 'common.json#/non_empty_string'}, 'up': {'$ref': 'common.json#/non_empty_string'}}, 'platforms': ['android', 'ios']}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'visibility': {'type': 'string', 'enum': ['visible', 'invisible', 'gone'], '$description': 'translations.json#/div_visibility', '$schema': 'http://json-schema.org/draft-07/schema'}, 'transform': {'type': 'object', '$description': 'translations.json#/div_transform', 'properties': {'rotation': {'type': 'number', '$description': 'translations.json#/div_transform_rotation'}, 'pivot_x': {'$ref': 'div-pivot.json', 'default_value': '{"type": "pivot-percentage","value":50}', '$description': 'translations.json#/div_transform_pivot_x'}, 'pivot_y': {'$ref': 'div-pivot.json', 'default_value': '{"type": "pivot-percentage","value":50}', '$description': 'translations.json#/div_transform_pivot_y'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "id" in data_keys: + data_keys.remove("id") + data__id = data["id"] + validate_common_json__non_empty_string(data__id, custom_formats, (name_prefix or "data") + ".id") + if "border" in data_keys: + data_keys.remove("border") + data__border = data["border"] + validate_div_border_json(data__border, custom_formats, (name_prefix or "data") + ".border") + if "width" in data_keys: + data_keys.remove("width") + data__width = data["width"] + validate_div_size_json(data__width, custom_formats, (name_prefix or "data") + ".width") + if "height" in data_keys: + data_keys.remove("height") + data__height = data["height"] + validate_div_size_json(data__height, custom_formats, (name_prefix or "data") + ".height") + if "background" in data_keys: + data_keys.remove("background") + data__background = data["background"] + if not isinstance(data__background, (list, tuple)): + if not (isinstance(data__background, str) and '@' in data__background): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".background must be array", value=data__background, name="" + (name_prefix or "data") + ".background", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, rule='type') + data__background_is_list = isinstance(data__background, (list, tuple)) + if data__background_is_list: + data__background_len = len(data__background) + if data__background_len < 1: + if not (isinstance(data__background, str) and '@' in data__background): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".background must contain at least 1 items", value=data__background, name="" + (name_prefix or "data") + ".background", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, rule='minItems') + for data__background_x, data__background_item in enumerate(data__background): + validate_div_background_json(data__background_item, custom_formats, (name_prefix or "data") + ".background[{data__background_x}]".format(**locals())) + if "paddings" in data_keys: + data_keys.remove("paddings") + data__paddings = data["paddings"] + validate_div_edge_insets_json(data__paddings, custom_formats, (name_prefix or "data") + ".paddings") + if "margins" in data_keys: + data_keys.remove("margins") + data__margins = data["margins"] + validate_div_edge_insets_json(data__margins, custom_formats, (name_prefix or "data") + ".margins") + if "alpha" in data_keys: + data_keys.remove("alpha") + data__alpha = data["alpha"] + if not isinstance(data__alpha, (int, float, Decimal)) or isinstance(data__alpha, bool): + if not (isinstance(data__alpha, str) and '@' in data__alpha): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".alpha must be number", value=data__alpha, name="" + (name_prefix or "data") + ".alpha", definition={'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, rule='type') + if "alignment_vertical" in data_keys: + data_keys.remove("alignment_vertical") + data__alignmentvertical = data["alignment_vertical"] + validate_div_alignment_vertical_json(data__alignmentvertical, custom_formats, (name_prefix or "data") + ".alignment_vertical") + if "alignment_horizontal" in data_keys: + data_keys.remove("alignment_horizontal") + data__alignmenthorizontal = data["alignment_horizontal"] + validate_div_alignment_horizontal_json(data__alignmenthorizontal, custom_formats, (name_prefix or "data") + ".alignment_horizontal") + if "row_span" in data_keys: + data_keys.remove("row_span") + data__rowspan = data["row_span"] + validate_common_json__non_negative_integer(data__rowspan, custom_formats, (name_prefix or "data") + ".row_span") + if "column_span" in data_keys: + data_keys.remove("column_span") + data__columnspan = data["column_span"] + validate_common_json__non_negative_integer(data__columnspan, custom_formats, (name_prefix or "data") + ".column_span") + if "visibility_action" in data_keys: + data_keys.remove("visibility_action") + data__visibilityaction = data["visibility_action"] + validate_div_visibility_action_json(data__visibilityaction, custom_formats, (name_prefix or "data") + ".visibility_action") + if "visibility_actions" in data_keys: + data_keys.remove("visibility_actions") + data__visibilityactions = data["visibility_actions"] + if not isinstance(data__visibilityactions, (list, tuple)): + if not (isinstance(data__visibilityactions, str) and '@' in data__visibilityactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".visibility_actions must be array", value=data__visibilityactions, name="" + (name_prefix or "data") + ".visibility_actions", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_visibility_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number > 0 && number <= 100', 'default_value': '50', '$description': 'translations.json#/div_visibility_action_visibility_percentage'}, 'visibility_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_visibility_action_visibility_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, rule='type') + data__visibilityactions_is_list = isinstance(data__visibilityactions, (list, tuple)) + if data__visibilityactions_is_list: + data__visibilityactions_len = len(data__visibilityactions) + if data__visibilityactions_len < 1: + if not (isinstance(data__visibilityactions, str) and '@' in data__visibilityactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".visibility_actions must contain at least 1 items", value=data__visibilityactions, name="" + (name_prefix or "data") + ".visibility_actions", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_visibility_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number > 0 && number <= 100', 'default_value': '50', '$description': 'translations.json#/div_visibility_action_visibility_percentage'}, 'visibility_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_visibility_action_visibility_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, rule='minItems') + for data__visibilityactions_x, data__visibilityactions_item in enumerate(data__visibilityactions): + validate_div_visibility_action_json(data__visibilityactions_item, custom_formats, (name_prefix or "data") + ".visibility_actions[{data__visibilityactions_x}]".format(**locals())) + if "disappear_actions" in data_keys: + data_keys.remove("disappear_actions") + data__disappearactions = data["disappear_actions"] + if not isinstance(data__disappearactions, (list, tuple)): + if not (isinstance(data__disappearactions, str) and '@' in data__disappearactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".disappear_actions must be array", value=data__disappearactions, name="" + (name_prefix or "data") + ".disappear_actions", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_disappear_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number >= 0 && number < 100', 'default_value': '0', '$description': 'translations.json#/div_disappear_action_visibility_percentage'}, 'disappear_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_disappear_action_disappear_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, rule='type') + data__disappearactions_is_list = isinstance(data__disappearactions, (list, tuple)) + if data__disappearactions_is_list: + data__disappearactions_len = len(data__disappearactions) + if data__disappearactions_len < 1: + if not (isinstance(data__disappearactions, str) and '@' in data__disappearactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".disappear_actions must contain at least 1 items", value=data__disappearactions, name="" + (name_prefix or "data") + ".disappear_actions", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_disappear_action', 'allOf': [{'$ref': 'div-sight-action.json'}, {'properties': {'visibility_percentage': {'type': 'integer', 'constraint': 'number >= 0 && number < 100', 'default_value': '0', '$description': 'translations.json#/div_disappear_action_visibility_percentage'}, 'disappear_duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '800', '$description': 'translations.json#/div_disappear_action_disappear_duration'}}}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, rule='minItems') + for data__disappearactions_x, data__disappearactions_item in enumerate(data__disappearactions): + validate_div_disappear_action_json(data__disappearactions_item, custom_formats, (name_prefix or "data") + ".disappear_actions[{data__disappearactions_x}]".format(**locals())) + if "tooltips" in data_keys: + data_keys.remove("tooltips") + data__tooltips = data["tooltips"] + if not isinstance(data__tooltips, (list, tuple)): + if not (isinstance(data__tooltips, str) and '@' in data__tooltips): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tooltips must be array", value=data__tooltips, name="" + (name_prefix or "data") + ".tooltips", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_tooltip', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_tooltip_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tooltip_div'}, 'position': {'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '5000', '$description': 'translations.json#/div_tooltip_duration'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_tooltip_offset'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_in'}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_out'}}, 'required': ['id', 'div', 'position'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, rule='type') + data__tooltips_is_list = isinstance(data__tooltips, (list, tuple)) + if data__tooltips_is_list: + data__tooltips_len = len(data__tooltips) + if data__tooltips_len < 1: + if not (isinstance(data__tooltips, str) and '@' in data__tooltips): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tooltips must contain at least 1 items", value=data__tooltips, name="" + (name_prefix or "data") + ".tooltips", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_tooltip', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_tooltip_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tooltip_div'}, 'position': {'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '5000', '$description': 'translations.json#/div_tooltip_duration'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_tooltip_offset'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_in'}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_tooltip_animation_out'}}, 'required': ['id', 'div', 'position'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, rule='minItems') + for data__tooltips_x, data__tooltips_item in enumerate(data__tooltips): + validate_div_tooltip_json(data__tooltips_item, custom_formats, (name_prefix or "data") + ".tooltips[{data__tooltips_x}]".format(**locals())) + if "accessibility" in data_keys: + data_keys.remove("accessibility") + data__accessibility = data["accessibility"] + validate_div_accessibility_json(data__accessibility, custom_formats, (name_prefix or "data") + ".accessibility") + if "extensions" in data_keys: + data_keys.remove("extensions") + data__extensions = data["extensions"] + if not isinstance(data__extensions, (list, tuple)): + if not (isinstance(data__extensions, str) and '@' in data__extensions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extensions must be array", value=data__extensions, name="" + (name_prefix or "data") + ".extensions", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_extension', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_extension_id'}, 'params': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}}, 'required': ['id'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, rule='type') + data__extensions_is_list = isinstance(data__extensions, (list, tuple)) + if data__extensions_is_list: + data__extensions_len = len(data__extensions) + if data__extensions_len < 1: + if not (isinstance(data__extensions, str) and '@' in data__extensions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extensions must contain at least 1 items", value=data__extensions, name="" + (name_prefix or "data") + ".extensions", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_extension', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_extension_id'}, 'params': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}}, 'required': ['id'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, rule='minItems') + for data__extensions_x, data__extensions_item in enumerate(data__extensions): + validate_div_extension_json(data__extensions_item, custom_formats, (name_prefix or "data") + ".extensions[{data__extensions_x}]".format(**locals())) + if "transition_triggers" in data_keys: + data_keys.remove("transition_triggers") + data__transitiontriggers = data["transition_triggers"] + if not isinstance(data__transitiontriggers, (list, tuple)): + if not (isinstance(data__transitiontriggers, str) and '@' in data__transitiontriggers): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".transition_triggers must be array", value=data__transitiontriggers, name="" + (name_prefix or "data") + ".transition_triggers", definition={'type': 'array', 'items': {'type': 'string', 'enum': ['data_change', 'state_change', 'visibility_change'], '$description': 'translations.json#/div_transition_trigger', '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, rule='type') + data__transitiontriggers_is_list = isinstance(data__transitiontriggers, (list, tuple)) + if data__transitiontriggers_is_list: + data__transitiontriggers_len = len(data__transitiontriggers) + if data__transitiontriggers_len < 1: + if not (isinstance(data__transitiontriggers, str) and '@' in data__transitiontriggers): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".transition_triggers must contain at least 1 items", value=data__transitiontriggers, name="" + (name_prefix or "data") + ".transition_triggers", definition={'type': 'array', 'items': {'type': 'string', 'enum': ['data_change', 'state_change', 'visibility_change'], '$description': 'translations.json#/div_transition_trigger', '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, rule='minItems') + for data__transitiontriggers_x, data__transitiontriggers_item in enumerate(data__transitiontriggers): + validate_div_transition_trigger_json(data__transitiontriggers_item, custom_formats, (name_prefix or "data") + ".transition_triggers[{data__transitiontriggers_x}]".format(**locals())) + if "transition_in" in data_keys: + data_keys.remove("transition_in") + data__transitionin = data["transition_in"] + validate_div_appearance_transition_json(data__transitionin, custom_formats, (name_prefix or "data") + ".transition_in") + if "transition_change" in data_keys: + data_keys.remove("transition_change") + data__transitionchange = data["transition_change"] + validate_div_change_transition_json(data__transitionchange, custom_formats, (name_prefix or "data") + ".transition_change") + if "transition_out" in data_keys: + data_keys.remove("transition_out") + data__transitionout = data["transition_out"] + validate_div_appearance_transition_json(data__transitionout, custom_formats, (name_prefix or "data") + ".transition_out") + if "selected_actions" in data_keys: + data_keys.remove("selected_actions") + data__selectedactions = data["selected_actions"] + if not isinstance(data__selectedactions, (list, tuple)): + if not (isinstance(data__selectedactions, str) and '@' in data__selectedactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".selected_actions must be array", value=data__selectedactions, name="" + (name_prefix or "data") + ".selected_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, rule='type') + data__selectedactions_is_list = isinstance(data__selectedactions, (list, tuple)) + if data__selectedactions_is_list: + data__selectedactions_len = len(data__selectedactions) + if data__selectedactions_len < 1: + if not (isinstance(data__selectedactions, str) and '@' in data__selectedactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".selected_actions must contain at least 1 items", value=data__selectedactions, name="" + (name_prefix or "data") + ".selected_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, rule='minItems') + for data__selectedactions_x, data__selectedactions_item in enumerate(data__selectedactions): + validate_div_action_json(data__selectedactions_item, custom_formats, (name_prefix or "data") + ".selected_actions[{data__selectedactions_x}]".format(**locals())) + if "focus" in data_keys: + data_keys.remove("focus") + data__focus = data["focus"] + validate_div_focus_json(data__focus, custom_formats, (name_prefix or "data") + ".focus") + if "visibility" in data_keys: + data_keys.remove("visibility") + data__visibility = data["visibility"] + validate_div_visibility_json(data__visibility, custom_formats, (name_prefix or "data") + ".visibility") + if "transform" in data_keys: + data_keys.remove("transform") + data__transform = data["transform"] + validate_div_transform_json(data__transform, custom_formats, (name_prefix or "data") + ".transform") + return data + +def validate_div_transform_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_transform', 'properties': {'rotation': {'type': 'number', '$description': 'translations.json#/div_transform_rotation'}, 'pivot_x': {'anyOf': [{'$ref': 'div-pivot-fixed.json', '$description': 'translations.json#/div_pivot_fixed'}, {'$ref': 'div-pivot-percentage.json', '$description': 'translations.json#/div_pivot_percentage'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'pivot_y': {'anyOf': [{'$ref': 'div-pivot-fixed.json', '$description': 'translations.json#/div_pivot_fixed'}, {'$ref': 'div-pivot-percentage.json', '$description': 'translations.json#/div_pivot_percentage'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "rotation" in data_keys: + data_keys.remove("rotation") + data__rotation = data["rotation"] + if not isinstance(data__rotation, (int, float, Decimal)) or isinstance(data__rotation, bool): + if not (isinstance(data__rotation, str) and '@' in data__rotation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".rotation must be number", value=data__rotation, name="" + (name_prefix or "data") + ".rotation", definition={'type': 'number', '$description': 'translations.json#/div_transform_rotation'}, rule='type') + if "pivot_x" in data_keys: + data_keys.remove("pivot_x") + data__pivotx = data["pivot_x"] + validate_div_pivot_json(data__pivotx, custom_formats, (name_prefix or "data") + ".pivot_x") + if "pivot_y" in data_keys: + data_keys.remove("pivot_y") + data__pivoty = data["pivot_y"] + validate_div_pivot_json(data__pivoty, custom_formats, (name_prefix or "data") + ".pivot_y") + return data + +def validate_div_pivot_json(data, custom_formats={}, name_prefix=None): + data_any_of_count6 = 0 + if not data_any_of_count6: + try: + validate_div_pivot_fixed_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count6 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count6: + try: + validate_div_pivot_percentage_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count6 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count6: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_pivot_fixed_short', 'properties': {'value': {'type': 'integer', '$description': 'translations.json#/div_pivot_fixed_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_pivot_fixed_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['pivot-fixed']}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_pivot_percentage_short', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_pivot_percentage_value'}, 'type': {'type': 'string', 'enum': ['pivot-percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_pivot_percentage_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_pivot_percentage_short', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_pivot_percentage_value'}, 'type': {'type': 'string', 'enum': ['pivot-percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_pivot_percentage_short', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_pivot_percentage_value'}, 'type': {'type': 'string', 'enum': ['pivot-percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int, float, Decimal)) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be number", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'number', '$description': 'translations.json#/div_pivot_percentage_value'}, rule='type') + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pivot-percentage']}, rule='type') + if data__type not in ['pivot-percentage']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['pivot-percentage']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pivot-percentage']}, rule='enum') + return data + +def validate_div_pivot_fixed_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_pivot_fixed_short', 'properties': {'value': {'type': 'integer', '$description': 'translations.json#/div_pivot_fixed_value'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['pivot-fixed']}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int)) and not (isinstance(data__value, float) and data__value.is_integer()) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be integer", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'integer', '$description': 'translations.json#/div_pivot_fixed_value'}, rule='type') + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pivot-fixed']}, rule='type') + if data__type not in ['pivot-fixed']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['pivot-fixed']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pivot-fixed']}, rule='enum') + return data + +def validate_div_size_unit_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['dp', 'sp', 'px']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['dp', 'sp', 'px']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_visibility_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['visible', 'invisible', 'gone'], '$description': 'translations.json#/div_visibility', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['visible', 'invisible', 'gone']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['visible', 'invisible', 'gone']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['visible', 'invisible', 'gone'], '$description': 'translations.json#/div_visibility', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_focus_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_focus', 'properties': {'background': {'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_background'}, 'border': {'type': 'object', '$description': 'translations.json#/div_border', 'properties': {'has_shadow': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_border_has_shadow'}, 'shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_border_shadow'}, 'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_border_stroke'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_border_corner_radius'}, 'corners_radius': {'$ref': 'div-corners-radius.json', '$description': 'translations.json#/div_border_corners_radius'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'on_focus': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_focus'}, 'on_blur': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_blur'}, 'next_focus_ids': {'type': 'object', '$description': 'translations.json#/div_focus_next_focus_ids', 'properties': {'forward': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'right': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'down': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'left': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'up': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}, 'platforms': ['android', 'ios']}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "background" in data_keys: + data_keys.remove("background") + data__background = data["background"] + if not isinstance(data__background, (list, tuple)): + if not (isinstance(data__background, str) and '@' in data__background): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".background must be array", value=data__background, name="" + (name_prefix or "data") + ".background", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_background'}, rule='type') + data__background_is_list = isinstance(data__background, (list, tuple)) + if data__background_is_list: + data__background_len = len(data__background) + if data__background_len < 1: + if not (isinstance(data__background, str) and '@' in data__background): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".background must contain at least 1 items", value=data__background, name="" + (name_prefix or "data") + ".background", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}, {'$ref': 'div-image-background.json', '$description': 'translations.json#/div_background_image'}, {'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}, {'$ref': 'div-nine-patch-background.json', '$description': 'translations.json#/div_nine_patch_background'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_background'}, rule='minItems') + for data__background_x, data__background_item in enumerate(data__background): + validate_div_background_json(data__background_item, custom_formats, (name_prefix or "data") + ".background[{data__background_x}]".format(**locals())) + if "border" in data_keys: + data_keys.remove("border") + data__border = data["border"] + validate_div_border_json(data__border, custom_formats, (name_prefix or "data") + ".border") + if "on_focus" in data_keys: + data_keys.remove("on_focus") + data__onfocus = data["on_focus"] + if not isinstance(data__onfocus, (list, tuple)): + if not (isinstance(data__onfocus, str) and '@' in data__onfocus): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_focus must be array", value=data__onfocus, name="" + (name_prefix or "data") + ".on_focus", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_focus'}, rule='type') + data__onfocus_is_list = isinstance(data__onfocus, (list, tuple)) + if data__onfocus_is_list: + data__onfocus_len = len(data__onfocus) + if data__onfocus_len < 1: + if not (isinstance(data__onfocus, str) and '@' in data__onfocus): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_focus must contain at least 1 items", value=data__onfocus, name="" + (name_prefix or "data") + ".on_focus", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_focus'}, rule='minItems') + for data__onfocus_x, data__onfocus_item in enumerate(data__onfocus): + validate_div_action_json(data__onfocus_item, custom_formats, (name_prefix or "data") + ".on_focus[{data__onfocus_x}]".format(**locals())) + if "on_blur" in data_keys: + data_keys.remove("on_blur") + data__onblur = data["on_blur"] + if not isinstance(data__onblur, (list, tuple)): + if not (isinstance(data__onblur, str) and '@' in data__onblur): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_blur must be array", value=data__onblur, name="" + (name_prefix or "data") + ".on_blur", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_blur'}, rule='type') + data__onblur_is_list = isinstance(data__onblur, (list, tuple)) + if data__onblur_is_list: + data__onblur_len = len(data__onblur) + if data__onblur_len < 1: + if not (isinstance(data__onblur, str) and '@' in data__onblur): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".on_blur must contain at least 1 items", value=data__onblur, name="" + (name_prefix or "data") + ".on_blur", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_focus_on_blur'}, rule='minItems') + for data__onblur_x, data__onblur_item in enumerate(data__onblur): + validate_div_action_json(data__onblur_item, custom_formats, (name_prefix or "data") + ".on_blur[{data__onblur_x}]".format(**locals())) + if "next_focus_ids" in data_keys: + data_keys.remove("next_focus_ids") + data__nextfocusids = data["next_focus_ids"] + if not isinstance(data__nextfocusids, (dict)): + if not (isinstance(data__nextfocusids, str) and '@' in data__nextfocusids): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".next_focus_ids must be object", value=data__nextfocusids, name="" + (name_prefix or "data") + ".next_focus_ids", definition={'type': 'object', '$description': 'translations.json#/div_focus_next_focus_ids', 'properties': {'forward': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'right': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'down': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'left': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'up': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}, 'platforms': ['android', 'ios']}, rule='type') + data__nextfocusids_is_dict = isinstance(data__nextfocusids, dict) + if data__nextfocusids_is_dict: + data__nextfocusids_keys = set(data__nextfocusids.keys()) + if "forward" in data__nextfocusids_keys: + data__nextfocusids_keys.remove("forward") + data__nextfocusids__forward = data__nextfocusids["forward"] + validate_common_json__non_empty_string(data__nextfocusids__forward, custom_formats, (name_prefix or "data") + ".next_focus_ids.forward") + if "right" in data__nextfocusids_keys: + data__nextfocusids_keys.remove("right") + data__nextfocusids__right = data__nextfocusids["right"] + validate_common_json__non_empty_string(data__nextfocusids__right, custom_formats, (name_prefix or "data") + ".next_focus_ids.right") + if "down" in data__nextfocusids_keys: + data__nextfocusids_keys.remove("down") + data__nextfocusids__down = data__nextfocusids["down"] + validate_common_json__non_empty_string(data__nextfocusids__down, custom_formats, (name_prefix or "data") + ".next_focus_ids.down") + if "left" in data__nextfocusids_keys: + data__nextfocusids_keys.remove("left") + data__nextfocusids__left = data__nextfocusids["left"] + validate_common_json__non_empty_string(data__nextfocusids__left, custom_formats, (name_prefix or "data") + ".next_focus_ids.left") + if "up" in data__nextfocusids_keys: + data__nextfocusids_keys.remove("up") + data__nextfocusids__up = data__nextfocusids["up"] + validate_common_json__non_empty_string(data__nextfocusids__up, custom_formats, (name_prefix or "data") + ".next_focus_ids.up") + return data + +def validate_div_change_transition_json(data, custom_formats={}, name_prefix=None): + data_any_of_count7 = 0 + if not data_any_of_count7: + try: + validate_div_change_set_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count7 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count7: + try: + validate_div_change_bounds_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count7 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count7: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_change_transition', 'anyOf': [{'type': 'object', '$description': 'translations.json#/div_change_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$ref': 'div-change-transition.json'}, 'minItems': 1, '$description': 'translations.json#/div_change_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_change_bounds_transition', 'allOf': [{'$ref': 'div-transition-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['change_bounds']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_change_bounds_transition_json(data, custom_formats={}, name_prefix=None): + validate_div_transition_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['change_bounds']}, rule='type') + if data__type not in ['change_bounds']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['change_bounds']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['change_bounds']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_change_bounds_transition', 'allOf': [{'type': 'object', 'protocol_name': 'div-transition-base', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_transition_base_start_delay'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '200', '$description': 'translations.json#/div_transition_base_duration'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'ease_in_out', '$description': 'translations.json#/div_transition_base_interpolator'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['change_bounds']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_transition_base_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'protocol_name': 'div-transition-base', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'start_delay': {'type': 'integer', 'constraint': 'number >= 0'}, 'duration': {'type': 'integer', 'constraint': 'number >= 0'}, 'interpolator': {'type': 'string', 'enum': ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring'], '$description': 'translations.json#/div_animation_interpolator', '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "start_delay" in data_keys: + data_keys.remove("start_delay") + data__startdelay = data["start_delay"] + validate_common_json__non_negative_integer(data__startdelay, custom_formats, (name_prefix or "data") + ".start_delay") + if "duration" in data_keys: + data_keys.remove("duration") + data__duration = data["duration"] + validate_common_json__non_negative_integer(data__duration, custom_formats, (name_prefix or "data") + ".duration") + if "interpolator" in data_keys: + data_keys.remove("interpolator") + data__interpolator = data["interpolator"] + validate_div_animation_interpolator_json(data__interpolator, custom_formats, (name_prefix or "data") + ".interpolator") + return data + +def validate_div_animation_interpolator_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring'], '$description': 'translations.json#/div_animation_interpolator', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring'], '$description': 'translations.json#/div_animation_interpolator', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_change_set_transition_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_change_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$description': 'translations.json#/div_change_transition', 'anyOf': [{'$ref': 'div-change-set-transition.json', '$description': 'translations.json#/div_change_transition_set'}, {'$ref': 'div-change-bounds-transition.json', '$description': 'translations.json#/div_change_transition_bounds'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_change_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_change_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$description': 'translations.json#/div_change_transition', 'anyOf': [{'$ref': 'div-change-set-transition.json', '$description': 'translations.json#/div_change_transition_set'}, {'$ref': 'div-change-bounds-transition.json', '$description': 'translations.json#/div_change_transition_bounds'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_change_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set']}, rule='type') + if data__type not in ['set']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['set']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set']}, rule='enum') + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_change_transition', 'anyOf': [{'$ref': 'div-change-set-transition.json', '$description': 'translations.json#/div_change_transition_set'}, {'$ref': 'div-change-bounds-transition.json', '$description': 'translations.json#/div_change_transition_bounds'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_change_set_transition_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_change_transition', 'anyOf': [{'$ref': 'div-change-set-transition.json', '$description': 'translations.json#/div_change_transition_set'}, {'$ref': 'div-change-bounds-transition.json', '$description': 'translations.json#/div_change_transition_bounds'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_change_set_transition_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_change_transition_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + return data + +def validate_div_appearance_transition_json(data, custom_formats={}, name_prefix=None): + data_any_of_count8 = 0 + if not data_any_of_count8: + try: + validate_div_appearance_set_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count8 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count8: + try: + validate_div_fade_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count8 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count8: + try: + validate_div_scale_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count8 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count8: + try: + validate_div_slide_transition_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count8 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count8: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'type': 'object', '$description': 'translations.json#/div_appearance_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$ref': 'div-appearance-transition.json'}, 'minItems': 1, '$description': 'translations.json#/div_appearance_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_fade_transition', 'allOf': [{'$ref': 'div-transition-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['fade']}, 'alpha': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.0', '$description': 'translations.json#/div_fade_transition_alpha'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_scale_transition', 'allOf': [{'$ref': 'div-transition-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['scale']}, 'scale': {'type': 'number', 'constraint': 'number >= 0.0', 'default_value': '0.0', '$description': 'translations.json#/div_scale_transition_scale'}, 'pivot_x': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_x'}, 'pivot_y': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_y'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_slide_transition', 'allOf': [{'$ref': 'div-transition-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['slide']}, 'edge': {'type': 'string', 'enum': ['left', 'top', 'right', 'bottom'], 'default_value': 'bottom', '$description': 'translations.json#/div_slide_transition_edge'}, 'distance': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_slide_transition_distance'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_slide_transition_json(data, custom_formats={}, name_prefix=None): + validate_div_transition_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['slide']}, rule='type') + if data__type not in ['slide']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['slide']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['slide']}, rule='enum') + if "edge" in data_keys: + data_keys.remove("edge") + data__edge = data["edge"] + if not isinstance(data__edge, (str)): + if not (isinstance(data__edge, str) and '@' in data__edge): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".edge must be string", value=data__edge, name="" + (name_prefix or "data") + ".edge", definition={'type': 'string', 'enum': ['left', 'top', 'right', 'bottom'], 'default_value': 'bottom', '$description': 'translations.json#/div_slide_transition_edge'}, rule='type') + if data__edge not in ['left', 'top', 'right', 'bottom']: + if not (isinstance(data__edge, str) and '@' in data__edge): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".edge must be one of ['left', 'top', 'right', 'bottom']", value=data__edge, name="" + (name_prefix or "data") + ".edge", definition={'type': 'string', 'enum': ['left', 'top', 'right', 'bottom'], 'default_value': 'bottom', '$description': 'translations.json#/div_slide_transition_edge'}, rule='enum') + if "distance" in data_keys: + data_keys.remove("distance") + data__distance = data["distance"] + validate_div_dimension_json(data__distance, custom_formats, (name_prefix or "data") + ".distance") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_slide_transition', 'allOf': [{'type': 'object', 'protocol_name': 'div-transition-base', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_transition_base_start_delay'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '200', '$description': 'translations.json#/div_transition_base_duration'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'ease_in_out', '$description': 'translations.json#/div_transition_base_interpolator'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['slide']}, 'edge': {'type': 'string', 'enum': ['left', 'top', 'right', 'bottom'], 'default_value': 'bottom', '$description': 'translations.json#/div_slide_transition_edge'}, 'distance': {'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_dimension_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int, float, Decimal)) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be number", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'number', '$description': 'translations.json#/div_dimension_value'}, rule='type') + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + return data + +def validate_div_scale_transition_json(data, custom_formats={}, name_prefix=None): + validate_div_transition_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['scale']}, rule='type') + if data__type not in ['scale']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['scale']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['scale']}, rule='enum') + if "scale" in data_keys: + data_keys.remove("scale") + data__scale = data["scale"] + if not isinstance(data__scale, (int, float, Decimal)) or isinstance(data__scale, bool): + if not (isinstance(data__scale, str) and '@' in data__scale): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".scale must be number", value=data__scale, name="" + (name_prefix or "data") + ".scale", definition={'type': 'number', 'constraint': 'number >= 0.0', 'default_value': '0.0', '$description': 'translations.json#/div_scale_transition_scale'}, rule='type') + if "pivot_x" in data_keys: + data_keys.remove("pivot_x") + data__pivotx = data["pivot_x"] + if not isinstance(data__pivotx, (int, float, Decimal)) or isinstance(data__pivotx, bool): + if not (isinstance(data__pivotx, str) and '@' in data__pivotx): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pivot_x must be number", value=data__pivotx, name="" + (name_prefix or "data") + ".pivot_x", definition={'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_x'}, rule='type') + if "pivot_y" in data_keys: + data_keys.remove("pivot_y") + data__pivoty = data["pivot_y"] + if not isinstance(data__pivoty, (int, float, Decimal)) or isinstance(data__pivoty, bool): + if not (isinstance(data__pivoty, str) and '@' in data__pivoty): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pivot_y must be number", value=data__pivoty, name="" + (name_prefix or "data") + ".pivot_y", definition={'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_y'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_scale_transition', 'allOf': [{'type': 'object', 'protocol_name': 'div-transition-base', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_transition_base_start_delay'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '200', '$description': 'translations.json#/div_transition_base_duration'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'ease_in_out', '$description': 'translations.json#/div_transition_base_interpolator'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['scale']}, 'scale': {'type': 'number', 'constraint': 'number >= 0.0', 'default_value': '0.0', '$description': 'translations.json#/div_scale_transition_scale'}, 'pivot_x': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_x'}, 'pivot_y': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.5', '$description': 'translations.json#/div_scale_transition_pivot_y'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_fade_transition_json(data, custom_formats={}, name_prefix=None): + validate_div_transition_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fade']}, rule='type') + if data__type not in ['fade']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fade']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fade']}, rule='enum') + if "alpha" in data_keys: + data_keys.remove("alpha") + data__alpha = data["alpha"] + if not isinstance(data__alpha, (int, float, Decimal)) or isinstance(data__alpha, bool): + if not (isinstance(data__alpha, str) and '@' in data__alpha): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".alpha must be number", value=data__alpha, name="" + (name_prefix or "data") + ".alpha", definition={'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.0', '$description': 'translations.json#/div_fade_transition_alpha'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_fade_transition', 'allOf': [{'type': 'object', 'protocol_name': 'div-transition-base', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_transition_base_start_delay'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '200', '$description': 'translations.json#/div_transition_base_duration'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'ease_in_out', '$description': 'translations.json#/div_transition_base_interpolator'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['fade']}, 'alpha': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.0', '$description': 'translations.json#/div_fade_transition_alpha'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_appearance_set_transition_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_appearance_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_appearance_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_appearance_set_transition', 'properties': {'type': {'type': 'string', 'enum': ['set']}, 'items': {'type': 'array', 'items': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_appearance_set_transition_items'}}, 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set']}, rule='type') + if data__type not in ['set']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['set']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['set']}, rule='enum') + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_appearance_set_transition_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'$description': 'translations.json#/div_appearance_transition', 'anyOf': [{'$ref': 'div-appearance-set-transition.json', '$description': 'translations.json#/div_appearance_transition_set'}, {'$ref': 'div-fade-transition.json', '$description': 'translations.json#/div_appearance_transition_fade'}, {'$ref': 'div-scale-transition.json', '$description': 'translations.json#/div_appearance_transition_scale'}, {'$ref': 'div-slide-transition.json', '$description': 'translations.json#/div_appearance_transition_slide'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_appearance_set_transition_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_appearance_transition_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + return data + +def validate_div_transition_trigger_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['data_change', 'state_change', 'visibility_change'], '$description': 'translations.json#/div_transition_trigger', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['data_change', 'state_change', 'visibility_change']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['data_change', 'state_change', 'visibility_change']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['data_change', 'state_change', 'visibility_change'], '$description': 'translations.json#/div_transition_trigger', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_extension_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_extension', 'properties': {'id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'params': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}}, 'required': ['id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['id']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_extension', 'properties': {'id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'params': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}}, 'required': ['id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "id" in data_keys: + data_keys.remove("id") + data__id = data["id"] + validate_common_json__non_empty_string(data__id, custom_formats, (name_prefix or "data") + ".id") + if "params" in data_keys: + data_keys.remove("params") + data__params = data["params"] + if not isinstance(data__params, (dict)): + if not (isinstance(data__params, str) and '@' in data__params): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".params must be object", value=data__params, name="" + (name_prefix or "data") + ".params", definition={'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_extension_params'}, rule='type') + data__params_is_dict = isinstance(data__params, dict) + if data__params_is_dict: + data__params_keys = set(data__params.keys()) + return data + +def validate_div_accessibility_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_accessibility', 'properties': {'description': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'type': {'type': 'string', 'enum': ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select'], 'supports_expressions': False, '$description': 'translations.json#/div_accessibility_type', 'platforms': ['android', 'ios']}, 'state_description': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'hint': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'mode': {'type': 'string', 'enum': ['default', 'merge', 'exclude'], 'default_value': 'default', '$description': 'translations.json#/div_accessibility_mode', 'platforms': ['android', 'ios']}, 'mute_after_action': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "description" in data_keys: + data_keys.remove("description") + data__description = data["description"] + validate_common_json__non_empty_string(data__description, custom_formats, (name_prefix or "data") + ".description") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select'], 'supports_expressions': False, '$description': 'translations.json#/div_accessibility_type', 'platforms': ['android', 'ios']}, rule='type') + if data__type not in ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select'], 'supports_expressions': False, '$description': 'translations.json#/div_accessibility_type', 'platforms': ['android', 'ios']}, rule='enum') + if "state_description" in data_keys: + data_keys.remove("state_description") + data__statedescription = data["state_description"] + validate_common_json__non_empty_string(data__statedescription, custom_formats, (name_prefix or "data") + ".state_description") + if "hint" in data_keys: + data_keys.remove("hint") + data__hint = data["hint"] + validate_common_json__non_empty_string(data__hint, custom_formats, (name_prefix or "data") + ".hint") + if "mode" in data_keys: + data_keys.remove("mode") + data__mode = data["mode"] + if not isinstance(data__mode, (str)): + if not (isinstance(data__mode, str) and '@' in data__mode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".mode must be string", value=data__mode, name="" + (name_prefix or "data") + ".mode", definition={'type': 'string', 'enum': ['default', 'merge', 'exclude'], 'default_value': 'default', '$description': 'translations.json#/div_accessibility_mode', 'platforms': ['android', 'ios']}, rule='type') + if data__mode not in ['default', 'merge', 'exclude']: + if not (isinstance(data__mode, str) and '@' in data__mode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".mode must be one of ['default', 'merge', 'exclude']", value=data__mode, name="" + (name_prefix or "data") + ".mode", definition={'type': 'string', 'enum': ['default', 'merge', 'exclude'], 'default_value': 'default', '$description': 'translations.json#/div_accessibility_mode', 'platforms': ['android', 'ios']}, rule='enum') + if "mute_after_action" in data_keys: + data_keys.remove("mute_after_action") + data__muteafteraction = data["mute_after_action"] + validate_common_json__boolean_int(data__muteafteraction, custom_formats, (name_prefix or "data") + ".mute_after_action") + return data + +def validate_div_tooltip_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_tooltip', 'properties': {'id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'position': {'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, 'duration': {'type': 'integer', 'constraint': 'number >= 0'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_in': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_out': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['id', 'div', 'position'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['id', 'div', 'position']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_tooltip', 'properties': {'id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'position': {'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, 'duration': {'type': 'integer', 'constraint': 'number >= 0'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_in': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_out': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['id', 'div', 'position'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "id" in data_keys: + data_keys.remove("id") + data__id = data["id"] + validate_common_json__non_empty_string(data__id, custom_formats, (name_prefix or "data") + ".id") + if "div" in data_keys: + data_keys.remove("div") + data__div = data["div"] + validate_div_json(data__div, custom_formats, (name_prefix or "data") + ".div") + if "position" in data_keys: + data_keys.remove("position") + data__position = data["position"] + if not isinstance(data__position, (str)): + if not (isinstance(data__position, str) and '@' in data__position): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".position must be string", value=data__position, name="" + (name_prefix or "data") + ".position", definition={'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, rule='type') + if data__position not in ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center']: + if not (isinstance(data__position, str) and '@' in data__position): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".position must be one of ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center']", value=data__position, name="" + (name_prefix or "data") + ".position", definition={'type': 'string', 'enum': ['left', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'center'], '$description': 'translations.json#/div_tooltip_position'}, rule='enum') + if "duration" in data_keys: + data_keys.remove("duration") + data__duration = data["duration"] + validate_common_json__non_negative_integer(data__duration, custom_formats, (name_prefix or "data") + ".duration") + if "offset" in data_keys: + data_keys.remove("offset") + data__offset = data["offset"] + validate_div_point_json(data__offset, custom_formats, (name_prefix or "data") + ".offset") + if "animation_in" in data_keys: + data_keys.remove("animation_in") + data__animationin = data["animation_in"] + validate_div_animation_json(data__animationin, custom_formats, (name_prefix or "data") + ".animation_in") + if "animation_out" in data_keys: + data_keys.remove("animation_out") + data__animationout = data["animation_out"] + validate_div_animation_json(data__animationout, custom_formats, (name_prefix or "data") + ".animation_out") + return data + +def validate_div_animation_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'type': 'integer', 'constraint': 'number >= 0'}, 'start_delay': {'type': 'integer', 'constraint': 'number >= 0'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'anyOf': [{'$ref': 'div-infinity-count.json', '$description': 'translations.json#/div_count_infinity'}, {'$ref': 'div-fixed-count.json', '$description': 'translations.json#/div_count_fixed'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'interpolator': {'type': 'string', 'enum': ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring'], '$description': 'translations.json#/div_animation_interpolator', '$schema': 'http://json-schema.org/draft-07/schema'}, 'items': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['name']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'type': 'integer', 'constraint': 'number >= 0'}, 'start_delay': {'type': 'integer', 'constraint': 'number >= 0'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'anyOf': [{'$ref': 'div-infinity-count.json', '$description': 'translations.json#/div_count_infinity'}, {'$ref': 'div-fixed-count.json', '$description': 'translations.json#/div_count_fixed'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'interpolator': {'type': 'string', 'enum': ['linear', 'ease', 'ease_in', 'ease_out', 'ease_in_out', 'spring'], '$description': 'translations.json#/div_animation_interpolator', '$schema': 'http://json-schema.org/draft-07/schema'}, 'items': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "name" in data_keys: + data_keys.remove("name") + data__name = data["name"] + if not isinstance(data__name, (str)): + if not (isinstance(data__name, str) and '@' in data__name): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be string", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, rule='type') + if data__name not in ['fade', 'translate', 'scale', 'native', 'set', 'no_animation']: + if not (isinstance(data__name, str) and '@' in data__name): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be one of ['fade', 'translate', 'scale', 'native', 'set', 'no_animation']", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, rule='enum') + if "duration" in data_keys: + data_keys.remove("duration") + data__duration = data["duration"] + validate_common_json__non_negative_integer(data__duration, custom_formats, (name_prefix or "data") + ".duration") + if "start_delay" in data_keys: + data_keys.remove("start_delay") + data__startdelay = data["start_delay"] + validate_common_json__non_negative_integer(data__startdelay, custom_formats, (name_prefix or "data") + ".start_delay") + if "start_value" in data_keys: + data_keys.remove("start_value") + data__startvalue = data["start_value"] + if not isinstance(data__startvalue, (int, float, Decimal)) or isinstance(data__startvalue, bool): + if not (isinstance(data__startvalue, str) and '@' in data__startvalue): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".start_value must be number", value=data__startvalue, name="" + (name_prefix or "data") + ".start_value", definition={'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, rule='type') + if "end_value" in data_keys: + data_keys.remove("end_value") + data__endvalue = data["end_value"] + if not isinstance(data__endvalue, (int, float, Decimal)) or isinstance(data__endvalue, bool): + if not (isinstance(data__endvalue, str) and '@' in data__endvalue): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".end_value must be number", value=data__endvalue, name="" + (name_prefix or "data") + ".end_value", definition={'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, rule='type') + if "repeat" in data_keys: + data_keys.remove("repeat") + data__repeat = data["repeat"] + validate_div_count_json(data__repeat, custom_formats, (name_prefix or "data") + ".repeat") + if "interpolator" in data_keys: + data_keys.remove("interpolator") + data__interpolator = data["interpolator"] + validate_div_animation_interpolator_json(data__interpolator, custom_formats, (name_prefix or "data") + ".interpolator") + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_animation_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + return data + +def validate_div_count_json(data, custom_formats={}, name_prefix=None): + data_any_of_count9 = 0 + if not data_any_of_count9: + try: + validate_div_infinity_count_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count9 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count9: + try: + validate_div_fixed_count_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count9 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count9: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_infinity_count', 'properties': {'type': {'type': 'string', 'enum': ['infinity']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_fixed_count', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_count_value'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_fixed_count_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_fixed_count', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_fixed_count', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__non_negative_integer(data__value, custom_formats, (name_prefix or "data") + ".value") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='type') + if data__type not in ['fixed']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fixed']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='enum') + return data + +def validate_div_infinity_count_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_infinity_count', 'properties': {'type': {'type': 'string', 'enum': ['infinity']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_infinity_count', 'properties': {'type': {'type': 'string', 'enum': ['infinity']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['infinity']}, rule='type') + if data__type not in ['infinity']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['infinity']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['infinity']}, rule='enum') + return data + +def validate_div_point_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'y': {'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['x', 'y']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'y': {'type': 'object', '$description': 'translations.json#/div_dimension', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_dimension_value'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['value'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "x" in data_keys: + data_keys.remove("x") + data__x = data["x"] + validate_div_dimension_json(data__x, custom_formats, (name_prefix or "data") + ".x") + if "y" in data_keys: + data_keys.remove("y") + data__y = data["y"] + validate_div_dimension_json(data__y, custom_formats, (name_prefix or "data") + ".y") + return data + +def validate_div_disappear_action_json(data, custom_formats={}, name_prefix=None): + validate_div_sight_action_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "visibility_percentage" in data_keys: + data_keys.remove("visibility_percentage") + data__visibilitypercentage = data["visibility_percentage"] + if not isinstance(data__visibilitypercentage, (int)) and not (isinstance(data__visibilitypercentage, float) and data__visibilitypercentage.is_integer()) or isinstance(data__visibilitypercentage, bool): + if not (isinstance(data__visibilitypercentage, str) and '@' in data__visibilitypercentage): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".visibility_percentage must be integer", value=data__visibilitypercentage, name="" + (name_prefix or "data") + ".visibility_percentage", definition={'type': 'integer', 'constraint': 'number >= 0 && number < 100', 'default_value': '0', '$description': 'translations.json#/div_disappear_action_visibility_percentage'}, rule='type') + if "disappear_duration" in data_keys: + data_keys.remove("disappear_duration") + data__disappearduration = data["disappear_duration"] + validate_common_json__non_negative_integer(data__disappearduration, custom_formats, (name_prefix or "data") + ".disappear_duration") + return data + +def validate_div_sight_action_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'protocol_name': 'div-sight-action', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': False}}, 'allOf': [{'properties': {'log_id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_action_base_log_id'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_base_url'}, 'referer': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_base_referer'}, 'payload': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_action_base_payload'}, 'download_callbacks': {'$ref': 'div-download-callbacks.json', '$description': 'translations.json#/div_action_base_download_callbacks'}, 'typed': {'$ref': 'div-action-typed.json'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'log_limit': {'type': 'integer', 'constraint': 'number >= 0'}}}], 'required': ['log_id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + validate_div_action_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "log_limit" in data_keys: + data_keys.remove("log_limit") + data__loglimit = data["log_limit"] + validate_common_json__non_negative_integer(data__loglimit, custom_formats, (name_prefix or "data") + ".log_limit") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['log_id']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'protocol_name': 'div-sight-action', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': False}}, 'allOf': [{'properties': {'log_id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_action_base_log_id'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_base_url'}, 'referer': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_base_referer'}, 'payload': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_action_base_payload'}, 'download_callbacks': {'$ref': 'div-download-callbacks.json', '$description': 'translations.json#/div_action_base_download_callbacks'}, 'typed': {'$ref': 'div-action-typed.json'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'log_limit': {'type': 'integer', 'constraint': 'number >= 0'}}}], 'required': ['log_id'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_visibility_action_json(data, custom_formats={}, name_prefix=None): + validate_div_sight_action_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "visibility_percentage" in data_keys: + data_keys.remove("visibility_percentage") + data__visibilitypercentage = data["visibility_percentage"] + if not isinstance(data__visibilitypercentage, (int)) and not (isinstance(data__visibilitypercentage, float) and data__visibilitypercentage.is_integer()) or isinstance(data__visibilitypercentage, bool): + if not (isinstance(data__visibilitypercentage, str) and '@' in data__visibilitypercentage): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".visibility_percentage must be integer", value=data__visibilitypercentage, name="" + (name_prefix or "data") + ".visibility_percentage", definition={'type': 'integer', 'constraint': 'number > 0 && number <= 100', 'default_value': '50', '$description': 'translations.json#/div_visibility_action_visibility_percentage'}, rule='type') + if "visibility_duration" in data_keys: + data_keys.remove("visibility_duration") + data__visibilityduration = data["visibility_duration"] + validate_common_json__non_negative_integer(data__visibilityduration, custom_formats, (name_prefix or "data") + ".visibility_duration") + return data + +def validate_common_json__non_negative_integer(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (int)) and not (isinstance(data, float) and data.is_integer()) or isinstance(data, bool): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be integer", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'integer', 'constraint': 'number >= 0'}, rule='type') + return data + +def validate_div_alignment_horizontal_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['left', 'center', 'right', 'start', 'end']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['left', 'center', 'right', 'start', 'end']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_alignment_vertical_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['top', 'center', 'bottom', 'baseline']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['top', 'center', 'bottom', 'baseline']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_edge_insets_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'type': 'integer', 'constraint': 'number >= 0'}, 'right': {'type': 'integer', 'constraint': 'number >= 0'}, 'top': {'type': 'integer', 'constraint': 'number >= 0'}, 'bottom': {'type': 'integer', 'constraint': 'number >= 0'}, 'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'end': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "left" in data_keys: + data_keys.remove("left") + data__left = data["left"] + validate_common_json__non_negative_integer(data__left, custom_formats, (name_prefix or "data") + ".left") + if "right" in data_keys: + data_keys.remove("right") + data__right = data["right"] + validate_common_json__non_negative_integer(data__right, custom_formats, (name_prefix or "data") + ".right") + if "top" in data_keys: + data_keys.remove("top") + data__top = data["top"] + validate_common_json__non_negative_integer(data__top, custom_formats, (name_prefix or "data") + ".top") + if "bottom" in data_keys: + data_keys.remove("bottom") + data__bottom = data["bottom"] + validate_common_json__non_negative_integer(data__bottom, custom_formats, (name_prefix or "data") + ".bottom") + if "start" in data_keys: + data_keys.remove("start") + data__start = data["start"] + validate_common_json__non_negative_integer(data__start, custom_formats, (name_prefix or "data") + ".start") + if "end" in data_keys: + data_keys.remove("end") + data__end = data["end"] + validate_common_json__non_negative_integer(data__end, custom_formats, (name_prefix or "data") + ".end") + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + return data + +def validate_div_background_json(data, custom_formats={}, name_prefix=None): + data_any_of_count10 = 0 + if not data_any_of_count10: + try: + validate_div_linear_gradient_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count10 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count10: + try: + validate_div_radial_gradient_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count10 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count10: + try: + validate_div_image_background_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count10 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count10: + try: + validate_div_solid_background_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count10 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count10: + try: + validate_div_nine_patch_background_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count10 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count10: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_gradient_linear', 'properties': {'colors': {'type': 'array', 'items': {'$ref': 'common.json#/color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'angle': {'type': 'integer', 'constraint': 'number >= 0 && number <= 360', 'default_value': '0', '$description': 'translations.json#/div_gradient_linear_angle'}, 'type': {'type': 'string', 'enum': ['gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_gradient_radial', 'properties': {'colors': {'type': 'array', 'items': {'$ref': 'common.json#/color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'radius': {'$ref': 'div-radial-gradient-radius.json', 'default_value': '{"type": "relative", "value": "farthest_corner" }', '$description': 'translations.json#/div_gradient_radial_radius'}, 'center_x': {'$ref': 'div-radial-gradient-center.json', 'default_value': '{"type": "relative", "value": 0.5 }', '$description': 'translations.json#/div_gradient_radial_center_x'}, 'center_y': {'$ref': 'div-radial-gradient-center.json', 'default_value': '{"type": "relative", "value": 0.5 }', '$description': 'translations.json#/div_gradient_radial_center_y'}, 'type': {'type': 'string', 'enum': ['radial_gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_image_background', 'properties': {'image_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_image_background_image_url'}, 'content_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'center', '$description': 'translations.json#/div_image_background_content_alignment_vertical'}, 'content_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'center', '$description': 'translations.json#/div_image_background_content_alignment_horizontal'}, 'scale': {'$ref': 'div-image-scale.json', 'default_value': 'fill', '$description': 'translations.json#/div_image_background_scale'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_image_background_alpha'}, 'preload_required': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_image_background_preload_required', 'platforms': ['android']}, 'filters': {'type': 'array', 'items': {'$ref': 'div-filter.json'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, 'type': {'type': 'string', 'enum': ['image']}}, 'required': ['image_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_solid_background', 'codegen': {'divan': {'forced_properties_order': ['color']}}, 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_solid_background_color'}, 'type': {'type': 'string', 'enum': ['solid']}}, 'required': ['color', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_nine_patch_background', 'properties': {'image_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_image_background_image_url'}, 'insets': {'$ref': 'div-absolute-edge-insets.json', '$description': 'translations.json#/div_nine_patch_background_insets'}, 'type': {'type': 'string', 'enum': ['nine_patch_image']}}, 'required': ['image_url', 'type', 'insets'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_nine_patch_background_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_nine_patch_background', 'properties': {'image_url': {'type': 'string', 'format': 'uri'}, 'insets': {'type': 'object', '$description': 'translations.json#/div_absolute_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['nine_patch_image']}}, 'required': ['image_url', 'type', 'insets'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['image_url', 'type', 'insets']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_nine_patch_background', 'properties': {'image_url': {'type': 'string', 'format': 'uri'}, 'insets': {'type': 'object', '$description': 'translations.json#/div_absolute_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['nine_patch_image']}}, 'required': ['image_url', 'type', 'insets'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "image_url" in data_keys: + data_keys.remove("image_url") + data__imageurl = data["image_url"] + validate_common_json__url(data__imageurl, custom_formats, (name_prefix or "data") + ".image_url") + if "insets" in data_keys: + data_keys.remove("insets") + data__insets = data["insets"] + validate_div_absolute_edge_insets_json(data__insets, custom_formats, (name_prefix or "data") + ".insets") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['nine_patch_image']}, rule='type') + if data__type not in ['nine_patch_image']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['nine_patch_image']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['nine_patch_image']}, rule='enum') + return data + +def validate_div_absolute_edge_insets_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_absolute_edge_insets', 'properties': {'left': {'type': 'integer', 'constraint': 'number >= 0'}, 'right': {'type': 'integer', 'constraint': 'number >= 0'}, 'top': {'type': 'integer', 'constraint': 'number >= 0'}, 'bottom': {'type': 'integer', 'constraint': 'number >= 0'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "left" in data_keys: + data_keys.remove("left") + data__left = data["left"] + validate_common_json__non_negative_integer(data__left, custom_formats, (name_prefix or "data") + ".left") + if "right" in data_keys: + data_keys.remove("right") + data__right = data["right"] + validate_common_json__non_negative_integer(data__right, custom_formats, (name_prefix or "data") + ".right") + if "top" in data_keys: + data_keys.remove("top") + data__top = data["top"] + validate_common_json__non_negative_integer(data__top, custom_formats, (name_prefix or "data") + ".top") + if "bottom" in data_keys: + data_keys.remove("bottom") + data__bottom = data["bottom"] + validate_common_json__non_negative_integer(data__bottom, custom_formats, (name_prefix or "data") + ".bottom") + return data + +def validate_div_solid_background_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_solid_background', 'codegen': {'divan': {'forced_properties_order': ['color']}}, 'properties': {'color': {'type': 'string', 'format': 'color'}, 'type': {'type': 'string', 'enum': ['solid']}}, 'required': ['color', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['color', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_solid_background', 'codegen': {'divan': {'forced_properties_order': ['color']}}, 'properties': {'color': {'type': 'string', 'format': 'color'}, 'type': {'type': 'string', 'enum': ['solid']}}, 'required': ['color', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['solid']}, rule='type') + if data__type not in ['solid']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['solid']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['solid']}, rule='enum') + return data + +def validate_div_image_background_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_image_background', 'properties': {'image_url': {'type': 'string', 'format': 'uri'}, 'content_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'content_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'scale': {'type': 'string', 'enum': ['fill', 'no_scale', 'fit', 'stretch'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_image_background_alpha'}, 'preload_required': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'filters': {'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, 'type': {'type': 'string', 'enum': ['image']}}, 'required': ['image_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['image_url', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_image_background', 'properties': {'image_url': {'type': 'string', 'format': 'uri'}, 'content_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'content_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'scale': {'type': 'string', 'enum': ['fill', 'no_scale', 'fit', 'stretch'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_image_background_alpha'}, 'preload_required': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'filters': {'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, 'type': {'type': 'string', 'enum': ['image']}}, 'required': ['image_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "image_url" in data_keys: + data_keys.remove("image_url") + data__imageurl = data["image_url"] + validate_common_json__url(data__imageurl, custom_formats, (name_prefix or "data") + ".image_url") + if "content_alignment_vertical" in data_keys: + data_keys.remove("content_alignment_vertical") + data__contentalignmentvertical = data["content_alignment_vertical"] + validate_div_alignment_vertical_json(data__contentalignmentvertical, custom_formats, (name_prefix or "data") + ".content_alignment_vertical") + if "content_alignment_horizontal" in data_keys: + data_keys.remove("content_alignment_horizontal") + data__contentalignmenthorizontal = data["content_alignment_horizontal"] + validate_div_alignment_horizontal_json(data__contentalignmenthorizontal, custom_formats, (name_prefix or "data") + ".content_alignment_horizontal") + if "scale" in data_keys: + data_keys.remove("scale") + data__scale = data["scale"] + validate_div_image_scale_json(data__scale, custom_formats, (name_prefix or "data") + ".scale") + if "alpha" in data_keys: + data_keys.remove("alpha") + data__alpha = data["alpha"] + if not isinstance(data__alpha, (int, float, Decimal)) or isinstance(data__alpha, bool): + if not (isinstance(data__alpha, str) and '@' in data__alpha): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".alpha must be number", value=data__alpha, name="" + (name_prefix or "data") + ".alpha", definition={'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_image_background_alpha'}, rule='type') + if "preload_required" in data_keys: + data_keys.remove("preload_required") + data__preloadrequired = data["preload_required"] + validate_common_json__boolean_int(data__preloadrequired, custom_formats, (name_prefix or "data") + ".preload_required") + if "filters" in data_keys: + data_keys.remove("filters") + data__filters = data["filters"] + if not isinstance(data__filters, (list, tuple)): + if not (isinstance(data__filters, str) and '@' in data__filters): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".filters must be array", value=data__filters, name="" + (name_prefix or "data") + ".filters", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, rule='type') + data__filters_is_list = isinstance(data__filters, (list, tuple)) + if data__filters_is_list: + data__filters_len = len(data__filters) + if data__filters_len < 1: + if not (isinstance(data__filters, str) and '@' in data__filters): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".filters must contain at least 1 items", value=data__filters, name="" + (name_prefix or "data") + ".filters", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, rule='minItems') + for data__filters_x, data__filters_item in enumerate(data__filters): + validate_div_filter_json(data__filters_item, custom_formats, (name_prefix or "data") + ".filters[{data__filters_x}]".format(**locals())) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['image']}, rule='type') + if data__type not in ['image']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['image']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['image']}, rule='enum') + return data + +def validate_div_filter_json(data, custom_formats={}, name_prefix=None): + data_any_of_count11 = 0 + if not data_any_of_count11: + try: + validate_div_blur_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count11 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count11: + try: + validate_div_filter_rtl_mirror_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count11 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count11: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_blur', 'properties': {'radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_blur_radius'}, 'type': {'type': 'string', 'enum': ['blur']}}, 'required': ['radius', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_filter_rtl_mirror', 'properties': {'type': {'type': 'string', 'enum': ['rtl_mirror']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_filter_rtl_mirror_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_filter_rtl_mirror', 'properties': {'type': {'type': 'string', 'enum': ['rtl_mirror']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_filter_rtl_mirror', 'properties': {'type': {'type': 'string', 'enum': ['rtl_mirror']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['rtl_mirror']}, rule='type') + if data__type not in ['rtl_mirror']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['rtl_mirror']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['rtl_mirror']}, rule='enum') + return data + +def validate_div_blur_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_blur', 'properties': {'radius': {'type': 'integer', 'constraint': 'number >= 0'}, 'type': {'type': 'string', 'enum': ['blur']}}, 'required': ['radius', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['radius', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_blur', 'properties': {'radius': {'type': 'integer', 'constraint': 'number >= 0'}, 'type': {'type': 'string', 'enum': ['blur']}}, 'required': ['radius', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "radius" in data_keys: + data_keys.remove("radius") + data__radius = data["radius"] + validate_common_json__non_negative_integer(data__radius, custom_formats, (name_prefix or "data") + ".radius") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['blur']}, rule='type') + if data__type not in ['blur']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['blur']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['blur']}, rule='enum') + return data + +def validate_div_image_scale_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['fill', 'no_scale', 'fit', 'stretch'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['fill', 'no_scale', 'fit', 'stretch']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['fill', 'no_scale', 'fit', 'stretch']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['fill', 'no_scale', 'fit', 'stretch'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_radial_gradient_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_gradient_radial', 'properties': {'colors': {'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'radius': {'anyOf': [{'$ref': 'div-fixed-size.json', '$description': 'translations.json#/div_size_fixed'}, {'$ref': 'div-radial-gradient-relative-radius.json', '$description': 'translations.json#/div_radial_gradient_relative_radius'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'center_x': {'anyOf': [{'$ref': 'div-radial-gradient-fixed-center.json', '$description': 'translations.json#/div_radial_gradient_fixed_center'}, {'$ref': 'div-radial-gradient-relative-center.json', '$description': 'translations.json#/div_radial_gradient_relative_center'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'center_y': {'anyOf': [{'$ref': 'div-radial-gradient-fixed-center.json', '$description': 'translations.json#/div_radial_gradient_fixed_center'}, {'$ref': 'div-radial-gradient-relative-center.json', '$description': 'translations.json#/div_radial_gradient_relative_center'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['radial_gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['colors', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_gradient_radial', 'properties': {'colors': {'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'radius': {'anyOf': [{'$ref': 'div-fixed-size.json', '$description': 'translations.json#/div_size_fixed'}, {'$ref': 'div-radial-gradient-relative-radius.json', '$description': 'translations.json#/div_radial_gradient_relative_radius'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'center_x': {'anyOf': [{'$ref': 'div-radial-gradient-fixed-center.json', '$description': 'translations.json#/div_radial_gradient_fixed_center'}, {'$ref': 'div-radial-gradient-relative-center.json', '$description': 'translations.json#/div_radial_gradient_relative_center'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'center_y': {'anyOf': [{'$ref': 'div-radial-gradient-fixed-center.json', '$description': 'translations.json#/div_radial_gradient_fixed_center'}, {'$ref': 'div-radial-gradient-relative-center.json', '$description': 'translations.json#/div_radial_gradient_relative_center'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['radial_gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "colors" in data_keys: + data_keys.remove("colors") + data__colors = data["colors"] + if not isinstance(data__colors, (list, tuple)): + if not (isinstance(data__colors, str) and '@' in data__colors): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".colors must be array", value=data__colors, name="" + (name_prefix or "data") + ".colors", definition={'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, rule='type') + data__colors_is_list = isinstance(data__colors, (list, tuple)) + if data__colors_is_list: + data__colors_len = len(data__colors) + if data__colors_len < 2: + if not (isinstance(data__colors, str) and '@' in data__colors): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".colors must contain at least 2 items", value=data__colors, name="" + (name_prefix or "data") + ".colors", definition={'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, rule='minItems') + for data__colors_x, data__colors_item in enumerate(data__colors): + validate_common_json__color(data__colors_item, custom_formats, (name_prefix or "data") + ".colors[{data__colors_x}]".format(**locals())) + if "radius" in data_keys: + data_keys.remove("radius") + data__radius = data["radius"] + validate_div_radial_gradient_radius_json(data__radius, custom_formats, (name_prefix or "data") + ".radius") + if "center_x" in data_keys: + data_keys.remove("center_x") + data__centerx = data["center_x"] + validate_div_radial_gradient_center_json(data__centerx, custom_formats, (name_prefix or "data") + ".center_x") + if "center_y" in data_keys: + data_keys.remove("center_y") + data__centery = data["center_y"] + validate_div_radial_gradient_center_json(data__centery, custom_formats, (name_prefix or "data") + ".center_y") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['radial_gradient']}, rule='type') + if data__type not in ['radial_gradient']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['radial_gradient']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['radial_gradient']}, rule='enum') + return data + +def validate_div_radial_gradient_center_json(data, custom_formats={}, name_prefix=None): + data_any_of_count12 = 0 + if not data_any_of_count12: + try: + validate_div_radial_gradient_fixed_center_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count12 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count12: + try: + validate_div_radial_gradient_relative_center_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count12 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count12: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_radial_gradient_fixed_center', 'properties': {'value': {'type': 'integer', '$description': 'translations.json#/div_radial_gradient_fixed_center_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_center', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_radial_gradient_relative_center_value'}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_radial_gradient_relative_center_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_center', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_radial_gradient_relative_center_value'}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_center', 'properties': {'value': {'type': 'number', '$description': 'translations.json#/div_radial_gradient_relative_center_value'}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int, float, Decimal)) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be number", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'number', '$description': 'translations.json#/div_radial_gradient_relative_center_value'}, rule='type') + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['relative']}, rule='type') + if data__type not in ['relative']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['relative']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['relative']}, rule='enum') + return data + +def validate_div_radial_gradient_fixed_center_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_fixed_center', 'properties': {'value': {'type': 'integer', '$description': 'translations.json#/div_radial_gradient_fixed_center_value'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_fixed_center', 'properties': {'value': {'type': 'integer', '$description': 'translations.json#/div_radial_gradient_fixed_center_value'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (int)) and not (isinstance(data__value, float) and data__value.is_integer()) or isinstance(data__value, bool): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be integer", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'integer', '$description': 'translations.json#/div_radial_gradient_fixed_center_value'}, rule='type') + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='type') + if data__type not in ['fixed']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fixed']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='enum') + return data + +def validate_div_radial_gradient_radius_json(data, custom_formats={}, name_prefix=None): + data_any_of_count13 = 0 + if not data_any_of_count13: + try: + validate_div_fixed_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count13 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count13: + try: + validate_div_radial_gradient_relative_radius_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count13 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count13: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_radius', 'properties': {'value': {'type': 'string', '$description': 'translations.json#/div_radial_gradient_relative_radius_value', 'enum': ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_radial_gradient_relative_radius_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_radius', 'properties': {'value': {'type': 'string', '$description': 'translations.json#/div_radial_gradient_relative_radius_value', 'enum': ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_radial_gradient_relative_radius', 'properties': {'value': {'type': 'string', '$description': 'translations.json#/div_radial_gradient_relative_radius_value', 'enum': ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']}, 'type': {'type': 'string', 'enum': ['relative']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (str)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be string", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'string', '$description': 'translations.json#/div_radial_gradient_relative_radius_value', 'enum': ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']}, rule='type') + if data__value not in ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']: + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be one of ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'string', '$description': 'translations.json#/div_radial_gradient_relative_radius_value', 'enum': ['nearest_corner', 'farthest_corner', 'nearest_side', 'farthest_side']}, rule='enum') + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['relative']}, rule='type') + if data__type not in ['relative']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['relative']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['relative']}, rule='enum') + return data + +def validate_div_fixed_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__non_negative_integer(data__value, custom_formats, (name_prefix or "data") + ".value") + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='type') + if data__type not in ['fixed']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fixed']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='enum') + return data + +def validate_div_linear_gradient_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_gradient_linear', 'properties': {'colors': {'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'angle': {'type': 'integer', 'constraint': 'number >= 0 && number <= 360', 'default_value': '0', '$description': 'translations.json#/div_gradient_linear_angle'}, 'type': {'type': 'string', 'enum': ['gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['colors', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_gradient_linear', 'properties': {'colors': {'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'angle': {'type': 'integer', 'constraint': 'number >= 0 && number <= 360', 'default_value': '0', '$description': 'translations.json#/div_gradient_linear_angle'}, 'type': {'type': 'string', 'enum': ['gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "colors" in data_keys: + data_keys.remove("colors") + data__colors = data["colors"] + if not isinstance(data__colors, (list, tuple)): + if not (isinstance(data__colors, str) and '@' in data__colors): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".colors must be array", value=data__colors, name="" + (name_prefix or "data") + ".colors", definition={'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, rule='type') + data__colors_is_list = isinstance(data__colors, (list, tuple)) + if data__colors_is_list: + data__colors_len = len(data__colors) + if data__colors_len < 2: + if not (isinstance(data__colors, str) and '@' in data__colors): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".colors must contain at least 2 items", value=data__colors, name="" + (name_prefix or "data") + ".colors", definition={'type': 'array', 'items': {'type': 'string', 'format': 'color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, rule='minItems') + for data__colors_x, data__colors_item in enumerate(data__colors): + validate_common_json__color(data__colors_item, custom_formats, (name_prefix or "data") + ".colors[{data__colors_x}]".format(**locals())) + if "angle" in data_keys: + data_keys.remove("angle") + data__angle = data["angle"] + if not isinstance(data__angle, (int)) and not (isinstance(data__angle, float) and data__angle.is_integer()) or isinstance(data__angle, bool): + if not (isinstance(data__angle, str) and '@' in data__angle): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".angle must be integer", value=data__angle, name="" + (name_prefix or "data") + ".angle", definition={'type': 'integer', 'constraint': 'number >= 0 && number <= 360', 'default_value': '0', '$description': 'translations.json#/div_gradient_linear_angle'}, rule='type') + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gradient']}, rule='type') + if data__type not in ['gradient']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['gradient']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gradient']}, rule='enum') + return data + +def validate_div_size_json(data, custom_formats={}, name_prefix=None): + data_any_of_count14 = 0 + if not data_any_of_count14: + try: + validate_div_fixed_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count14 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count14: + try: + validate_div_match_parent_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count14 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count14: + try: + validate_div_wrap_content_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count14 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count14: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'weight': {'$ref': 'common.json#/positive_number', '$description': 'translations.json#/div_match_parent_size_weight'}, 'type': {'type': 'string', 'enum': ['match_parent']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_wrap_content_size', 'definitions': {'constraint_size': {'type': 'object', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_size_unit', 'default_value': 'dp'}}, 'required': ['value']}}, 'properties': {'type': {'type': 'string', 'enum': ['wrap_content']}, 'constrained': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_wrap_content_size_constrained'}, 'min_size': {'$ref': '#/definitions/constraint_size', '$description': 'translations.json#/div_size_min'}, 'max_size': {'$ref': '#/definitions/constraint_size', '$description': 'translations.json#/div_size_max'}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_wrap_content_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_wrap_content_size', 'definitions': {'constraint_size': {'type': 'object', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value']}}, 'properties': {'type': {'type': 'string', 'enum': ['wrap_content']}, 'constrained': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'min_size': {'type': 'object', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_size_unit', 'default_value': 'dp'}}, 'required': ['value']}, 'max_size': {'type': 'object', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_size_unit', 'default_value': 'dp'}}, 'required': ['value']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_wrap_content_size', 'definitions': {'constraint_size': {'type': 'object', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value']}}, 'properties': {'type': {'type': 'string', 'enum': ['wrap_content']}, 'constrained': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'min_size': {'type': 'object', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_size_unit', 'default_value': 'dp'}}, 'required': ['value']}, 'max_size': {'type': 'object', 'properties': {'value': {'$ref': 'common.json#/non_negative_integer'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_size_unit', 'default_value': 'dp'}}, 'required': ['value']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['wrap_content']}, rule='type') + if data__type not in ['wrap_content']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['wrap_content']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['wrap_content']}, rule='enum') + if "constrained" in data_keys: + data_keys.remove("constrained") + data__constrained = data["constrained"] + validate_common_json__boolean_int(data__constrained, custom_formats, (name_prefix or "data") + ".constrained") + if "min_size" in data_keys: + data_keys.remove("min_size") + data__minsize = data["min_size"] + validate_div_wrap_content_size_json__definitions_constraint_size(data__minsize, custom_formats, (name_prefix or "data") + ".min_size") + if "max_size" in data_keys: + data_keys.remove("max_size") + data__maxsize = data["max_size"] + validate_div_wrap_content_size_json__definitions_constraint_size(data__maxsize, custom_formats, (name_prefix or "data") + ".max_size") + return data + +def validate_div_wrap_content_size_json__definitions_constraint_size(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'value': {'type': 'integer', 'constraint': 'number >= 0'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['value']}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__non_negative_integer(data__value, custom_formats, (name_prefix or "data") + ".value") + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + return data + +def validate_div_match_parent_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'weight': {'type': 'number', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['match_parent']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'weight': {'type': 'number', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['match_parent']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "weight" in data_keys: + data_keys.remove("weight") + data__weight = data["weight"] + validate_common_json__positive_number(data__weight, custom_formats, (name_prefix or "data") + ".weight") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['match_parent']}, rule='type') + if data__type not in ['match_parent']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['match_parent']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['match_parent']}, rule='enum') + return data + +def validate_div_border_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_border', 'properties': {'has_shadow': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'shadow': {'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shadow_color', 'default_value': '#000000'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_shadow_offset'}, 'blur': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_shadow_blur', 'default_value': '2'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'stroke': {'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'$ref': 'common.json#/non_negative_integer', 'default_value': '1', '$description': 'translations.json#/div_stroke_width'}, 'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_stroke_color'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'corner_radius': {'type': 'integer', 'constraint': 'number >= 0'}, 'corners_radius': {'type': 'object', '$description': 'translations.json#/div_corners_radius', 'properties': {'top-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_left'}, 'top-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_right'}, 'bottom-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_left'}, 'bottom-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_right'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "has_shadow" in data_keys: + data_keys.remove("has_shadow") + data__hasshadow = data["has_shadow"] + validate_common_json__boolean_int(data__hasshadow, custom_formats, (name_prefix or "data") + ".has_shadow") + if "shadow" in data_keys: + data_keys.remove("shadow") + data__shadow = data["shadow"] + validate_div_shadow_json(data__shadow, custom_formats, (name_prefix or "data") + ".shadow") + if "stroke" in data_keys: + data_keys.remove("stroke") + data__stroke = data["stroke"] + validate_div_stroke_json(data__stroke, custom_formats, (name_prefix or "data") + ".stroke") + if "corner_radius" in data_keys: + data_keys.remove("corner_radius") + data__cornerradius = data["corner_radius"] + validate_common_json__non_negative_integer(data__cornerradius, custom_formats, (name_prefix or "data") + ".corner_radius") + if "corners_radius" in data_keys: + data_keys.remove("corners_radius") + data__cornersradius = data["corners_radius"] + validate_div_corners_radius_json(data__cornersradius, custom_formats, (name_prefix or "data") + ".corners_radius") + return data + +def validate_div_corners_radius_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_corners_radius', 'properties': {'top-left': {'type': 'integer', 'constraint': 'number >= 0'}, 'top-right': {'type': 'integer', 'constraint': 'number >= 0'}, 'bottom-left': {'type': 'integer', 'constraint': 'number >= 0'}, 'bottom-right': {'type': 'integer', 'constraint': 'number >= 0'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "top-left" in data_keys: + data_keys.remove("top-left") + data__topleft = data["top-left"] + validate_common_json__non_negative_integer(data__topleft, custom_formats, (name_prefix or "data") + ".top-left") + if "top-right" in data_keys: + data_keys.remove("top-right") + data__topright = data["top-right"] + validate_common_json__non_negative_integer(data__topright, custom_formats, (name_prefix or "data") + ".top-right") + if "bottom-left" in data_keys: + data_keys.remove("bottom-left") + data__bottomleft = data["bottom-left"] + validate_common_json__non_negative_integer(data__bottomleft, custom_formats, (name_prefix or "data") + ".bottom-left") + if "bottom-right" in data_keys: + data_keys.remove("bottom-right") + data__bottomright = data["bottom-right"] + validate_common_json__non_negative_integer(data__bottomright, custom_formats, (name_prefix or "data") + ".bottom-right") + return data + +def validate_div_stroke_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'type': 'integer', 'constraint': 'number >= 0'}, 'color': {'type': 'string', 'format': 'color'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['color']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'type': 'integer', 'constraint': 'number >= 0'}, 'color': {'type': 'string', 'format': 'color'}, 'unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "width" in data_keys: + data_keys.remove("width") + data__width = data["width"] + validate_common_json__non_negative_integer(data__width, custom_formats, (name_prefix or "data") + ".width") + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + if "unit" in data_keys: + data_keys.remove("unit") + data__unit = data["unit"] + validate_div_size_unit_json(data__unit, custom_formats, (name_prefix or "data") + ".unit") + return data + +def validate_div_shadow_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'type': 'string', 'format': 'color'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'blur': {'type': 'integer', 'constraint': 'number >= 0'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['offset']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'type': 'string', 'format': 'color'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'blur': {'type': 'integer', 'constraint': 'number >= 0'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + if "offset" in data_keys: + data_keys.remove("offset") + data__offset = data["offset"] + validate_div_point_json(data__offset, custom_formats, (name_prefix or "data") + ".offset") + if "blur" in data_keys: + data_keys.remove("blur") + data__blur = data["blur"] + validate_common_json__non_negative_integer(data__blur, custom_formats, (name_prefix or "data") + ".blur") + if "alpha" in data_keys: + data_keys.remove("alpha") + data__alpha = data["alpha"] + if not isinstance(data__alpha, (int, float, Decimal)) or isinstance(data__alpha, bool): + if not (isinstance(data__alpha, str) and '@' in data__alpha): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".alpha must be number", value=data__alpha, name="" + (name_prefix or "data") + ".alpha", definition={'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}, rule='type') + return data + +def validate_div_select_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['select']}, rule='type') + if data__type not in ['select']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['select']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['select']}, rule='enum') + if "options" in data_keys: + data_keys.remove("options") + data__options = data["options"] + if not isinstance(data__options, (list, tuple)): + if not (isinstance(data__options, str) and '@' in data__options): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".options must be array", value=data__options, name="" + (name_prefix or "data") + ".options", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}, 'minItems': 1}, rule='type') + data__options_is_list = isinstance(data__options, (list, tuple)) + if data__options_is_list: + data__options_len = len(data__options) + if data__options_len < 1: + if not (isinstance(data__options, str) and '@' in data__options): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".options must contain at least 1 items", value=data__options, name="" + (name_prefix or "data") + ".options", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}, 'minItems': 1}, rule='minItems') + for data__options_x, data__options_item in enumerate(data__options): + validate_div_select_json__definitions_option(data__options_item, custom_formats, (name_prefix or "data") + ".options[{data__options_x}]".format(**locals())) + if "value_variable" in data_keys: + data_keys.remove("value_variable") + data__valuevariable = data["value_variable"] + validate_div_variable_name_json(data__valuevariable, custom_formats, (name_prefix or "data") + ".value_variable") + if "font_size" in data_keys: + data_keys.remove("font_size") + data__fontsize = data["font_size"] + validate_common_json__non_negative_integer(data__fontsize, custom_formats, (name_prefix or "data") + ".font_size") + if "font_size_unit" in data_keys: + data_keys.remove("font_size_unit") + data__fontsizeunit = data["font_size_unit"] + validate_div_size_unit_json(data__fontsizeunit, custom_formats, (name_prefix or "data") + ".font_size_unit") + if "font_family" in data_keys: + data_keys.remove("font_family") + data__fontfamily = data["font_family"] + validate_common_json__non_empty_string(data__fontfamily, custom_formats, (name_prefix or "data") + ".font_family") + if "font_weight" in data_keys: + data_keys.remove("font_weight") + data__fontweight = data["font_weight"] + validate_div_font_weight_json(data__fontweight, custom_formats, (name_prefix or "data") + ".font_weight") + if "hint_text" in data_keys: + data_keys.remove("hint_text") + data__hinttext = data["hint_text"] + validate_common_json__non_empty_string(data__hinttext, custom_formats, (name_prefix or "data") + ".hint_text") + if "hint_color" in data_keys: + data_keys.remove("hint_color") + data__hintcolor = data["hint_color"] + validate_common_json__color(data__hintcolor, custom_formats, (name_prefix or "data") + ".hint_color") + if "line_height" in data_keys: + data_keys.remove("line_height") + data__lineheight = data["line_height"] + validate_common_json__non_negative_integer(data__lineheight, custom_formats, (name_prefix or "data") + ".line_height") + if "text_color" in data_keys: + data_keys.remove("text_color") + data__textcolor = data["text_color"] + validate_common_json__color(data__textcolor, custom_formats, (name_prefix or "data") + ".text_color") + if "letter_spacing" in data_keys: + data_keys.remove("letter_spacing") + data__letterspacing = data["letter_spacing"] + if not isinstance(data__letterspacing, (int, float, Decimal)) or isinstance(data__letterspacing, bool): + if not (isinstance(data__letterspacing, str) and '@' in data__letterspacing): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".letter_spacing must be number", value=data__letterspacing, name="" + (name_prefix or "data") + ".letter_spacing", definition={'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_select_letter_spacing'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'options', 'value_variable']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_select', 'definitions': {'option': {'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['select']}, 'options': {'type': 'array', 'items': {'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}, 'minItems': 1}, 'value_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'hint_text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'hint_color': {'type': 'string', 'format': 'color'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'text_color': {'type': 'string', 'format': 'color'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_select_letter_spacing'}}}], 'required': ['type', 'options', 'value_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_font_weight_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['light', 'medium', 'regular', 'bold']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['light', 'medium', 'regular', 'bold']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_select_json__definitions_option(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', '$description': 'translations.json#/div_select_option_text'}, 'value': {'type': 'string', '$description': 'translations.json#/div_select_option_value'}}, 'required': ['value']}, rule='required') + data_keys = set(data.keys()) + if "text" in data_keys: + data_keys.remove("text") + data__text = data["text"] + if not isinstance(data__text, (str)): + if not (isinstance(data__text, str) and '@' in data__text): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".text must be string", value=data__text, name="" + (name_prefix or "data") + ".text", definition={'type': 'string', '$description': 'translations.json#/div_select_option_text'}, rule='type') + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + if not isinstance(data__value, (str)): + if not (isinstance(data__value, str) and '@' in data__value): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".value must be string", value=data__value, name="" + (name_prefix or "data") + ".value", definition={'type': 'string', '$description': 'translations.json#/div_select_option_value'}, rule='type') + return data + +def validate_div_input_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['input']}, rule='type') + if data__type not in ['input']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['input']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['input']}, rule='enum') + if "font_size" in data_keys: + data_keys.remove("font_size") + data__fontsize = data["font_size"] + validate_common_json__non_negative_integer(data__fontsize, custom_formats, (name_prefix or "data") + ".font_size") + if "font_size_unit" in data_keys: + data_keys.remove("font_size_unit") + data__fontsizeunit = data["font_size_unit"] + validate_div_size_unit_json(data__fontsizeunit, custom_formats, (name_prefix or "data") + ".font_size_unit") + if "font_family" in data_keys: + data_keys.remove("font_family") + data__fontfamily = data["font_family"] + validate_common_json__non_empty_string(data__fontfamily, custom_formats, (name_prefix or "data") + ".font_family") + if "font_weight" in data_keys: + data_keys.remove("font_weight") + data__fontweight = data["font_weight"] + validate_div_font_weight_json(data__fontweight, custom_formats, (name_prefix or "data") + ".font_weight") + if "text_color" in data_keys: + data_keys.remove("text_color") + data__textcolor = data["text_color"] + validate_common_json__color(data__textcolor, custom_formats, (name_prefix or "data") + ".text_color") + if "text_variable" in data_keys: + data_keys.remove("text_variable") + data__textvariable = data["text_variable"] + validate_div_variable_name_json(data__textvariable, custom_formats, (name_prefix or "data") + ".text_variable") + if "text_alignment_horizontal" in data_keys: + data_keys.remove("text_alignment_horizontal") + data__textalignmenthorizontal = data["text_alignment_horizontal"] + validate_div_alignment_horizontal_json(data__textalignmenthorizontal, custom_formats, (name_prefix or "data") + ".text_alignment_horizontal") + if "text_alignment_vertical" in data_keys: + data_keys.remove("text_alignment_vertical") + data__textalignmentvertical = data["text_alignment_vertical"] + validate_div_alignment_vertical_json(data__textalignmentvertical, custom_formats, (name_prefix or "data") + ".text_alignment_vertical") + if "line_height" in data_keys: + data_keys.remove("line_height") + data__lineheight = data["line_height"] + validate_common_json__non_negative_integer(data__lineheight, custom_formats, (name_prefix or "data") + ".line_height") + if "max_visible_lines" in data_keys: + data_keys.remove("max_visible_lines") + data__maxvisiblelines = data["max_visible_lines"] + validate_common_json__positive_integer(data__maxvisiblelines, custom_formats, (name_prefix or "data") + ".max_visible_lines") + if "letter_spacing" in data_keys: + data_keys.remove("letter_spacing") + data__letterspacing = data["letter_spacing"] + if not isinstance(data__letterspacing, (int, float, Decimal)) or isinstance(data__letterspacing, bool): + if not (isinstance(data__letterspacing, str) and '@' in data__letterspacing): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".letter_spacing must be number", value=data__letterspacing, name="" + (name_prefix or "data") + ".letter_spacing", definition={'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_input_letter_spacing'}, rule='type') + if "hint_text" in data_keys: + data_keys.remove("hint_text") + data__hinttext = data["hint_text"] + validate_common_json__non_empty_string(data__hinttext, custom_formats, (name_prefix or "data") + ".hint_text") + if "hint_color" in data_keys: + data_keys.remove("hint_color") + data__hintcolor = data["hint_color"] + validate_common_json__color(data__hintcolor, custom_formats, (name_prefix or "data") + ".hint_color") + if "highlight_color" in data_keys: + data_keys.remove("highlight_color") + data__highlightcolor = data["highlight_color"] + validate_common_json__color(data__highlightcolor, custom_formats, (name_prefix or "data") + ".highlight_color") + if "native_interface" in data_keys: + data_keys.remove("native_interface") + data__nativeinterface = data["native_interface"] + validate_div_input_json__definitions_native_interface(data__nativeinterface, custom_formats, (name_prefix or "data") + ".native_interface") + if "keyboard_type" in data_keys: + data_keys.remove("keyboard_type") + data__keyboardtype = data["keyboard_type"] + if not isinstance(data__keyboardtype, (str)): + if not (isinstance(data__keyboardtype, str) and '@' in data__keyboardtype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".keyboard_type must be string", value=data__keyboardtype, name="" + (name_prefix or "data") + ".keyboard_type", definition={'type': 'string', 'enum': ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri'], 'default_value': 'multi_line_text', '$description': 'translations.json#/div_input_keyboard_type'}, rule='type') + if data__keyboardtype not in ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri']: + if not (isinstance(data__keyboardtype, str) and '@' in data__keyboardtype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".keyboard_type must be one of ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri']", value=data__keyboardtype, name="" + (name_prefix or "data") + ".keyboard_type", definition={'type': 'string', 'enum': ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri'], 'default_value': 'multi_line_text', '$description': 'translations.json#/div_input_keyboard_type'}, rule='enum') + if "select_all_on_focus" in data_keys: + data_keys.remove("select_all_on_focus") + data__selectallonfocus = data["select_all_on_focus"] + validate_common_json__boolean_int(data__selectallonfocus, custom_formats, (name_prefix or "data") + ".select_all_on_focus") + if "mask" in data_keys: + data_keys.remove("mask") + data__mask = data["mask"] + validate_div_input_mask_json(data__mask, custom_formats, (name_prefix or "data") + ".mask") + if "validators" in data_keys: + data_keys.remove("validators") + data__validators = data["validators"] + if not isinstance(data__validators, (list, tuple)): + if not (isinstance(data__validators, str) and '@' in data__validators): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".validators must be array", value=data__validators, name="" + (name_prefix or "data") + ".validators", definition={'type': 'array', '$description': 'translations.json#/div_input_validators', 'platforms': ['android', 'ios'], 'items': {'anyOf': [{'$ref': 'div-input-validator-regex.json', '$description': 'translations.json#/div_input_validators_regex'}, {'$ref': 'div-input-validator-expression.json', '$description': 'translations.json#/div_input_validators_expression'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, rule='type') + data__validators_is_list = isinstance(data__validators, (list, tuple)) + if data__validators_is_list: + data__validators_len = len(data__validators) + for data__validators_x, data__validators_item in enumerate(data__validators): + validate_div_input_validator_json(data__validators_item, custom_formats, (name_prefix or "data") + ".validators[{data__validators_x}]".format(**locals())) + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'text_variable']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_input', 'definitions': {'native_interface': {'type': 'object', 'properties': {'color': {'type': 'string', 'format': 'color'}}, 'required': ['color']}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['input']}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'text_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'max_visible_lines': {'type': 'integer', 'constraint': 'number > 0'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_input_letter_spacing'}, 'hint_text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'hint_color': {'type': 'string', 'format': 'color'}, 'highlight_color': {'type': 'string', 'format': 'color'}, 'native_interface': {'type': 'object', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_input_native_interface_color'}}, 'required': ['color']}, 'keyboard_type': {'type': 'string', 'enum': ['single_line_text', 'multi_line_text', 'phone', 'number', 'email', 'uri'], 'default_value': 'multi_line_text', '$description': 'translations.json#/div_input_keyboard_type'}, 'select_all_on_focus': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'mask': {'anyOf': [{'$ref': 'div-fixed-length-input-mask.json', '$description': 'translations.json#/div_input_mask_fixed_length'}, {'$ref': 'div-currency-input-mask.json', '$description': 'translations.json#/div_input_mask_currency'}, {'$ref': 'div-phone-input-mask.json', '$description': 'translations.json#/div_input_mask_phone', 'platforms': ['android', 'ios']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'validators': {'type': 'array', '$description': 'translations.json#/div_input_validators', 'platforms': ['android', 'ios'], 'items': {'anyOf': [{'$ref': 'div-input-validator-regex.json', '$description': 'translations.json#/div_input_validators_regex'}, {'$ref': 'div-input-validator-expression.json', '$description': 'translations.json#/div_input_validators_expression'}], '$schema': 'http://json-schema.org/draft-07/schema'}}}}], 'required': ['type', 'text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_input_validator_json(data, custom_formats={}, name_prefix=None): + data_any_of_count15 = 0 + if not data_any_of_count15: + try: + validate_div_input_validator_regex_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count15 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count15: + try: + validate_div_input_validator_expression_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count15 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count15: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'$description': 'translations.json#/div_input_validators_regex', 'allOf': [{'$ref': 'div-input-validator-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['regex']}, 'pattern': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_validators_regex_pattern'}}}], 'required': ['type', 'pattern', 'label_id', 'variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_input_validators_expression', 'allOf': [{'$ref': 'div-input-validator-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['expression']}, 'condition': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_input_validators_expression_condition'}}}], 'required': ['type', 'condition', 'label_id', 'variable'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_input_validator_expression_json(data, custom_formats={}, name_prefix=None): + validate_div_input_validator_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['expression']}, rule='type') + if data__type not in ['expression']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['expression']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['expression']}, rule='enum') + if "condition" in data_keys: + data_keys.remove("condition") + data__condition = data["condition"] + validate_common_json__boolean_int(data__condition, custom_formats, (name_prefix or "data") + ".condition") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'condition', 'label_id', 'variable']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_input_validators_expression', 'allOf': [{'type': 'object', 'properties': {'label_id': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_validators_label_id'}, 'allow_empty': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_input_validators_allow_empty'}, 'variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_validators_variable'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['expression']}, 'condition': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}}}], 'required': ['type', 'condition', 'label_id', 'variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_input_validator_base_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'label_id': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'allow_empty': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "label_id" in data_keys: + data_keys.remove("label_id") + data__labelid = data["label_id"] + validate_common_json__non_empty_string(data__labelid, custom_formats, (name_prefix or "data") + ".label_id") + if "allow_empty" in data_keys: + data_keys.remove("allow_empty") + data__allowempty = data["allow_empty"] + validate_common_json__boolean_int(data__allowempty, custom_formats, (name_prefix or "data") + ".allow_empty") + if "variable" in data_keys: + data_keys.remove("variable") + data__variable = data["variable"] + validate_div_variable_name_json(data__variable, custom_formats, (name_prefix or "data") + ".variable") + return data + +def validate_div_input_validator_regex_json(data, custom_formats={}, name_prefix=None): + validate_div_input_validator_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['regex']}, rule='type') + if data__type not in ['regex']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['regex']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['regex']}, rule='enum') + if "pattern" in data_keys: + data_keys.remove("pattern") + data__pattern = data["pattern"] + validate_common_json__non_empty_string(data__pattern, custom_formats, (name_prefix or "data") + ".pattern") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'pattern', 'label_id', 'variable']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_input_validators_regex', 'allOf': [{'type': 'object', 'properties': {'label_id': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_validators_label_id'}, 'allow_empty': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_input_validators_allow_empty'}, 'variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_validators_variable'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['regex']}, 'pattern': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}}], 'required': ['type', 'pattern', 'label_id', 'variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_input_mask_json(data, custom_formats={}, name_prefix=None): + data_any_of_count16 = 0 + if not data_any_of_count16: + try: + validate_div_fixed_length_input_mask_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count16 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count16: + try: + validate_div_currency_input_mask_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count16 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count16: + try: + validate_div_phone_input_mask_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count16 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count16: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'$description': 'translations.json#/div_input_mask_fixed_length', 'allOf': [{'$ref': 'div-input-mask-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['fixed_length']}, 'pattern': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_mask_fixed_length_pattern'}, 'pattern_elements': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_regex'}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, 'minItems': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements'}, 'always_visible': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_input_mask_fixed_length_always_visible'}}}], 'required': ['type', 'pattern', 'pattern_elements'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_input_mask_currency', 'allOf': [{'$ref': 'div-input-mask-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['currency']}, 'locale': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_input_mask_currency_locale'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_input_mask_phone', 'allOf': [{'$ref': 'div-input-mask-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['phone']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_phone_input_mask_json(data, custom_formats={}, name_prefix=None): + validate_div_input_mask_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['phone']}, rule='type') + if data__type not in ['phone']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['phone']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['phone']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_input_mask_phone', 'allOf': [{'protocol_name': 'div-input-mask-base', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'raw_text_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_mask_raw_text_variable'}}, 'required': ['raw_text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['phone']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_input_mask_base_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'protocol_name': 'div-input-mask-base', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'raw_text_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['raw_text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['raw_text_variable']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'protocol_name': 'div-input-mask-base', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'raw_text_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['raw_text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "raw_text_variable" in data_keys: + data_keys.remove("raw_text_variable") + data__rawtextvariable = data["raw_text_variable"] + validate_div_variable_name_json(data__rawtextvariable, custom_formats, (name_prefix or "data") + ".raw_text_variable") + return data + +def validate_div_currency_input_mask_json(data, custom_formats={}, name_prefix=None): + validate_div_input_mask_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['currency']}, rule='type') + if data__type not in ['currency']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['currency']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['currency']}, rule='enum') + if "locale" in data_keys: + data_keys.remove("locale") + data__locale = data["locale"] + validate_common_json__non_empty_string(data__locale, custom_formats, (name_prefix or "data") + ".locale") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_input_mask_currency', 'allOf': [{'protocol_name': 'div-input-mask-base', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'raw_text_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_mask_raw_text_variable'}}, 'required': ['raw_text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['currency']}, 'locale': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_fixed_length_input_mask_json(data, custom_formats={}, name_prefix=None): + validate_div_input_mask_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed_length']}, rule='type') + if data__type not in ['fixed_length']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fixed_length']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed_length']}, rule='enum') + if "pattern" in data_keys: + data_keys.remove("pattern") + data__pattern = data["pattern"] + validate_common_json__non_empty_string(data__pattern, custom_formats, (name_prefix or "data") + ".pattern") + if "pattern_elements" in data_keys: + data_keys.remove("pattern_elements") + data__patternelements = data["pattern_elements"] + if not isinstance(data__patternelements, (list, tuple)): + if not (isinstance(data__patternelements, str) and '@' in data__patternelements): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements must be array", value=data__patternelements, name="" + (name_prefix or "data") + ".pattern_elements", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, 'minItems': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements'}, rule='type') + data__patternelements_is_list = isinstance(data__patternelements, (list, tuple)) + if data__patternelements_is_list: + data__patternelements_len = len(data__patternelements) + if data__patternelements_len < 1: + if not (isinstance(data__patternelements, str) and '@' in data__patternelements): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements must contain at least 1 items", value=data__patternelements, name="" + (name_prefix or "data") + ".pattern_elements", definition={'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, 'minItems': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements'}, rule='minItems') + for data__patternelements_x, data__patternelements_item in enumerate(data__patternelements): + if not isinstance(data__patternelements_item, (dict)): + if not (isinstance(data__patternelements_item, str) and '@' in data__patternelements_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}]".format(**locals()) + " must be object", value=data__patternelements_item, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}]".format(**locals()) + "", definition={'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, rule='type') + data__patternelements_item_is_dict = isinstance(data__patternelements_item, dict) + if data__patternelements_item_is_dict: + data__patternelements_item__missing_keys = set(['key']) - data__patternelements_item.keys() + if data__patternelements_item__missing_keys: + if not (isinstance(data__patternelements_item, str) and '@' in data__patternelements_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}]".format(**locals()) + " must contain " + (str(sorted(data__patternelements_item__missing_keys)) + " properties"), value=data__patternelements_item, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}]".format(**locals()) + "", definition={'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, rule='required') + data__patternelements_item_keys = set(data__patternelements_item.keys()) + if "key" in data__patternelements_item_keys: + data__patternelements_item_keys.remove("key") + data__patternelements_item__key = data__patternelements_item["key"] + if not isinstance(data__patternelements_item__key, (str)): + if not (isinstance(data__patternelements_item__key, str) and '@' in data__patternelements_item__key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + " must be string", value=data__patternelements_item__key, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + "", definition={'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, rule='type') + if isinstance(data__patternelements_item__key, str): + data__patternelements_item__key_len = len(data__patternelements_item__key) + if data__patternelements_item__key_len < 1: + if not (isinstance(data__patternelements_item__key, str) and '@' in data__patternelements_item__key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + " must be longer than or equal to 1 characters", value=data__patternelements_item__key, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + "", definition={'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, rule='minLength') + if data__patternelements_item__key_len > 1: + if not (isinstance(data__patternelements_item__key, str) and '@' in data__patternelements_item__key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + " must be shorter than or equal to 1 characters", value=data__patternelements_item__key, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].key".format(**locals()) + "", definition={'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, rule='maxLength') + if "regex" in data__patternelements_item_keys: + data__patternelements_item_keys.remove("regex") + data__patternelements_item__regex = data__patternelements_item["regex"] + validate_common_json__non_empty_string(data__patternelements_item__regex, custom_formats, (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].regex".format(**locals())) + if "placeholder" in data__patternelements_item_keys: + data__patternelements_item_keys.remove("placeholder") + data__patternelements_item__placeholder = data__patternelements_item["placeholder"] + if not isinstance(data__patternelements_item__placeholder, (str)): + if not (isinstance(data__patternelements_item__placeholder, str) and '@' in data__patternelements_item__placeholder): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].placeholder".format(**locals()) + " must be string", value=data__patternelements_item__placeholder, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].placeholder".format(**locals()) + "", definition={'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}, rule='type') + if isinstance(data__patternelements_item__placeholder, str): + data__patternelements_item__placeholder_len = len(data__patternelements_item__placeholder) + if data__patternelements_item__placeholder_len > 1: + if not (isinstance(data__patternelements_item__placeholder, str) and '@' in data__patternelements_item__placeholder): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].placeholder".format(**locals()) + " must be shorter than or equal to 1 characters", value=data__patternelements_item__placeholder, name="" + (name_prefix or "data") + ".pattern_elements[{data__patternelements_x}].placeholder".format(**locals()) + "", definition={'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}, rule='maxLength') + if "always_visible" in data_keys: + data_keys.remove("always_visible") + data__alwaysvisible = data["always_visible"] + validate_common_json__boolean_int(data__alwaysvisible, custom_formats, (name_prefix or "data") + ".always_visible") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'pattern', 'pattern_elements']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_input_mask_fixed_length', 'allOf': [{'protocol_name': 'div-input-mask-base', 'type': 'object', 'codegen': {'documentation': {'include_in_toc': True}}, 'properties': {'raw_text_variable': {'$ref': 'div-variable-name.json', '$description': 'translations.json#/div_input_mask_raw_text_variable'}}, 'required': ['raw_text_variable'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['fixed_length']}, 'pattern': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'pattern_elements': {'type': 'array', 'items': {'type': 'object', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements', 'properties': {'key': {'type': 'string', 'minLength': 1, 'maxLength': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_key'}, 'regex': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'placeholder': {'type': 'string', 'maxLength': 1, 'default_value': '_', '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements_placeholder'}}, 'required': ['key']}, 'minItems': 1, '$description': 'translations.json#/div_input_mask_fixed_length_pattern_elements'}, 'always_visible': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}}}], 'required': ['type', 'pattern', 'pattern_elements'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_input_json__definitions_native_interface(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'color': {'type': 'string', 'format': 'color'}}, 'required': ['color']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['color']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'color': {'type': 'string', 'format': 'color'}}, 'required': ['color']}, rule='required') + data_keys = set(data.keys()) + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + return data + +def validate_div_slider_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['slider']}, rule='type') + if data__type not in ['slider']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['slider']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['slider']}, rule='enum') + if "min_value" in data_keys: + data_keys.remove("min_value") + data__minvalue = data["min_value"] + if not isinstance(data__minvalue, (int)) and not (isinstance(data__minvalue, float) and data__minvalue.is_integer()) or isinstance(data__minvalue, bool): + if not (isinstance(data__minvalue, str) and '@' in data__minvalue): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".min_value must be integer", value=data__minvalue, name="" + (name_prefix or "data") + ".min_value", definition={'type': 'integer', 'default_value': '0', '$description': 'translations.json#/div_slider_min_value'}, rule='type') + if "max_value" in data_keys: + data_keys.remove("max_value") + data__maxvalue = data["max_value"] + if not isinstance(data__maxvalue, (int)) and not (isinstance(data__maxvalue, float) and data__maxvalue.is_integer()) or isinstance(data__maxvalue, bool): + if not (isinstance(data__maxvalue, str) and '@' in data__maxvalue): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".max_value must be integer", value=data__maxvalue, name="" + (name_prefix or "data") + ".max_value", definition={'type': 'integer', 'default_value': '100', '$description': 'translations.json#/div_slider_max_value'}, rule='type') + if "thumb_value_variable" in data_keys: + data_keys.remove("thumb_value_variable") + data__thumbvaluevariable = data["thumb_value_variable"] + validate_div_variable_name_json(data__thumbvaluevariable, custom_formats, (name_prefix or "data") + ".thumb_value_variable") + if "thumb_secondary_value_variable" in data_keys: + data_keys.remove("thumb_secondary_value_variable") + data__thumbsecondaryvaluevariable = data["thumb_secondary_value_variable"] + validate_div_variable_name_json(data__thumbsecondaryvaluevariable, custom_formats, (name_prefix or "data") + ".thumb_secondary_value_variable") + if "thumb_style" in data_keys: + data_keys.remove("thumb_style") + data__thumbstyle = data["thumb_style"] + validate_div_drawable_json(data__thumbstyle, custom_formats, (name_prefix or "data") + ".thumb_style") + if "thumb_secondary_style" in data_keys: + data_keys.remove("thumb_secondary_style") + data__thumbsecondarystyle = data["thumb_secondary_style"] + validate_div_drawable_json(data__thumbsecondarystyle, custom_formats, (name_prefix or "data") + ".thumb_secondary_style") + if "thumb_text_style" in data_keys: + data_keys.remove("thumb_text_style") + data__thumbtextstyle = data["thumb_text_style"] + validate_div_slider_json__definitions_text_style(data__thumbtextstyle, custom_formats, (name_prefix or "data") + ".thumb_text_style") + if "thumb_secondary_text_style" in data_keys: + data_keys.remove("thumb_secondary_text_style") + data__thumbsecondarytextstyle = data["thumb_secondary_text_style"] + validate_div_slider_json__definitions_text_style(data__thumbsecondarytextstyle, custom_formats, (name_prefix or "data") + ".thumb_secondary_text_style") + if "track_active_style" in data_keys: + data_keys.remove("track_active_style") + data__trackactivestyle = data["track_active_style"] + validate_div_drawable_json(data__trackactivestyle, custom_formats, (name_prefix or "data") + ".track_active_style") + if "tick_mark_active_style" in data_keys: + data_keys.remove("tick_mark_active_style") + data__tickmarkactivestyle = data["tick_mark_active_style"] + validate_div_drawable_json(data__tickmarkactivestyle, custom_formats, (name_prefix or "data") + ".tick_mark_active_style") + if "track_inactive_style" in data_keys: + data_keys.remove("track_inactive_style") + data__trackinactivestyle = data["track_inactive_style"] + validate_div_drawable_json(data__trackinactivestyle, custom_formats, (name_prefix or "data") + ".track_inactive_style") + if "tick_mark_inactive_style" in data_keys: + data_keys.remove("tick_mark_inactive_style") + data__tickmarkinactivestyle = data["tick_mark_inactive_style"] + validate_div_drawable_json(data__tickmarkinactivestyle, custom_formats, (name_prefix or "data") + ".tick_mark_inactive_style") + if "ranges" in data_keys: + data_keys.remove("ranges") + data__ranges = data["ranges"] + if not isinstance(data__ranges, (list, tuple)): + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must be array", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_active_style'}, 'track_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_inactive_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_slider_range_margins'}}}, 'minItems': 1, '$description': 'translations.json#/div_slider_ranges', 'platforms': ['android', 'ios']}, rule='type') + data__ranges_is_list = isinstance(data__ranges, (list, tuple)) + if data__ranges_is_list: + data__ranges_len = len(data__ranges) + if data__ranges_len < 1: + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must contain at least 1 items", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_active_style'}, 'track_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_inactive_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_slider_range_margins'}}}, 'minItems': 1, '$description': 'translations.json#/div_slider_ranges', 'platforms': ['android', 'ios']}, rule='minItems') + for data__ranges_x, data__ranges_item in enumerate(data__ranges): + validate_div_slider_json__definitions_range(data__ranges_item, custom_formats, (name_prefix or "data") + ".ranges[{data__ranges_x}]".format(**locals())) + if "secondary_value_accessibility" in data_keys: + data_keys.remove("secondary_value_accessibility") + data__secondaryvalueaccessibility = data["secondary_value_accessibility"] + validate_div_accessibility_json(data__secondaryvalueaccessibility, custom_formats, (name_prefix or "data") + ".secondary_value_accessibility") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'thumb_style', 'track_active_style', 'track_inactive_style']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_slider', 'definitions': {'text_style': {'type': 'object', 'properties': {'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['font_size']}, 'range': {'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'track_inactive_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['slider']}, 'min_value': {'type': 'integer', 'default_value': '0', '$description': 'translations.json#/div_slider_min_value'}, 'max_value': {'type': 'integer', 'default_value': '100', '$description': 'translations.json#/div_slider_max_value'}, 'thumb_value_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'thumb_secondary_value_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'thumb_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'thumb_secondary_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'thumb_text_style': {'type': 'object', 'properties': {'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', 'platforms': ['android']}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_color'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_slider_text_style_offset'}}, 'required': ['font_size']}, 'thumb_secondary_text_style': {'type': 'object', 'properties': {'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', 'platforms': ['android']}, 'font_weight': {'$ref': 'div-font-weight.json', 'default_value': 'regular', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', 'default_value': '#FF000000', '$description': 'translations.json#/div_text_color'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_slider_text_style_offset'}}, 'required': ['font_size']}, 'track_active_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'tick_mark_active_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'track_inactive_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'tick_mark_inactive_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'ranges': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_active_style'}, 'track_inactive_style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_slider_track_inactive_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_slider_range_margins'}}}, 'minItems': 1, '$description': 'translations.json#/div_slider_ranges', 'platforms': ['android', 'ios']}, 'secondary_value_accessibility': {'type': 'object', '$description': 'translations.json#/div_accessibility', 'properties': {'description': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_description'}, 'type': {'type': 'string', 'enum': ['none', 'button', 'image', 'text', 'edit_text', 'header', 'tab_bar', 'list', 'select'], 'supports_expressions': False, '$description': 'translations.json#/div_accessibility_type', 'platforms': ['android', 'ios']}, 'state_description': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_state_description', 'platforms': ['android', 'ios']}, 'hint': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_accessibility_hint', 'platforms': ['android', 'ios']}, 'mode': {'type': 'string', 'enum': ['default', 'merge', 'exclude'], 'default_value': 'default', '$description': 'translations.json#/div_accessibility_mode', 'platforms': ['android', 'ios']}, 'mute_after_action': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_accessibility_mute_after_action', 'platforms': ['ios']}}, '$schema': 'http://json-schema.org/draft-07/schema'}}}], 'required': ['type', 'thumb_style', 'track_active_style', 'track_inactive_style'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_slider_json__definitions_range(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'start': {'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, 'end': {'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, 'track_active_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'track_inactive_style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "start" in data_keys: + data_keys.remove("start") + data__start = data["start"] + if not isinstance(data__start, (int)) and not (isinstance(data__start, float) and data__start.is_integer()) or isinstance(data__start, bool): + if not (isinstance(data__start, str) and '@' in data__start): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".start must be integer", value=data__start, name="" + (name_prefix or "data") + ".start", definition={'type': 'integer', '$description': 'translations.json#/div_slider_range_start'}, rule='type') + if "end" in data_keys: + data_keys.remove("end") + data__end = data["end"] + if not isinstance(data__end, (int)) and not (isinstance(data__end, float) and data__end.is_integer()) or isinstance(data__end, bool): + if not (isinstance(data__end, str) and '@' in data__end): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".end must be integer", value=data__end, name="" + (name_prefix or "data") + ".end", definition={'type': 'integer', '$description': 'translations.json#/div_slider_range_end'}, rule='type') + if "track_active_style" in data_keys: + data_keys.remove("track_active_style") + data__trackactivestyle = data["track_active_style"] + validate_div_drawable_json(data__trackactivestyle, custom_formats, (name_prefix or "data") + ".track_active_style") + if "track_inactive_style" in data_keys: + data_keys.remove("track_inactive_style") + data__trackinactivestyle = data["track_inactive_style"] + validate_div_drawable_json(data__trackinactivestyle, custom_formats, (name_prefix or "data") + ".track_inactive_style") + if "margins" in data_keys: + data_keys.remove("margins") + data__margins = data["margins"] + validate_div_edge_insets_json(data__margins, custom_formats, (name_prefix or "data") + ".margins") + return data + +def validate_div_slider_json__definitions_text_style(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['font_size']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['font_size']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'offset': {'type': 'object', '$description': 'translations.json#/div_point', 'properties': {'x': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_x'}, 'y': {'$ref': 'div-dimension.json', '$description': 'translations.json#/div_point_y'}}, 'required': ['x', 'y'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['font_size']}, rule='required') + data_keys = set(data.keys()) + if "font_size" in data_keys: + data_keys.remove("font_size") + data__fontsize = data["font_size"] + validate_common_json__non_negative_integer(data__fontsize, custom_formats, (name_prefix or "data") + ".font_size") + if "font_size_unit" in data_keys: + data_keys.remove("font_size_unit") + data__fontsizeunit = data["font_size_unit"] + validate_div_size_unit_json(data__fontsizeunit, custom_formats, (name_prefix or "data") + ".font_size_unit") + if "font_weight" in data_keys: + data_keys.remove("font_weight") + data__fontweight = data["font_weight"] + validate_div_font_weight_json(data__fontweight, custom_formats, (name_prefix or "data") + ".font_weight") + if "text_color" in data_keys: + data_keys.remove("text_color") + data__textcolor = data["text_color"] + validate_common_json__color(data__textcolor, custom_formats, (name_prefix or "data") + ".text_color") + if "offset" in data_keys: + data_keys.remove("offset") + data__offset = data["offset"] + validate_div_point_json(data__offset, custom_formats, (name_prefix or "data") + ".offset") + return data + +def validate_div_drawable_json(data, custom_formats={}, name_prefix=None): + data_any_of_count17 = 0 + if not data_any_of_count17: + try: + validate_div_shape_drawable_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count17 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count17: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_shape_drawable', 'properties': {'shape': {'$ref': 'div-shape.json', '$description': 'translations.json#/div_shape_drawable_shape'}, 'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shape_drawable_color', 'deprecated': True}, 'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_shape_drawable_stroke', 'deprecated': True}, 'type': {'type': 'string', 'enum': ['shape_drawable']}}, 'required': ['type', 'shape', 'color'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_shape_drawable_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_shape_drawable', 'properties': {'shape': {'anyOf': [{'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_rounded_rectangle_shape'}, {'$ref': 'div-circle-shape.json', '$description': 'translations.json#/div_circle_shape', 'platforms': ['android', 'web']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'color': {'type': 'string', 'format': 'color'}, 'stroke': {'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'$ref': 'common.json#/non_negative_integer', 'default_value': '1', '$description': 'translations.json#/div_stroke_width'}, 'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_stroke_color'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['shape_drawable']}}, 'required': ['type', 'shape', 'color'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'shape', 'color']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_shape_drawable', 'properties': {'shape': {'anyOf': [{'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_rounded_rectangle_shape'}, {'$ref': 'div-circle-shape.json', '$description': 'translations.json#/div_circle_shape', 'platforms': ['android', 'web']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'color': {'type': 'string', 'format': 'color'}, 'stroke': {'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'$ref': 'common.json#/non_negative_integer', 'default_value': '1', '$description': 'translations.json#/div_stroke_width'}, 'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_stroke_color'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['shape_drawable']}}, 'required': ['type', 'shape', 'color'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "shape" in data_keys: + data_keys.remove("shape") + data__shape = data["shape"] + validate_div_shape_json(data__shape, custom_formats, (name_prefix or "data") + ".shape") + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + if "stroke" in data_keys: + data_keys.remove("stroke") + data__stroke = data["stroke"] + validate_div_stroke_json(data__stroke, custom_formats, (name_prefix or "data") + ".stroke") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['shape_drawable']}, rule='type') + if data__type not in ['shape_drawable']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['shape_drawable']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['shape_drawable']}, rule='enum') + return data + +def validate_div_shape_json(data, custom_formats={}, name_prefix=None): + data_any_of_count18 = 0 + if not data_any_of_count18: + try: + validate_div_rounded_rectangle_shape_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count18 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count18: + try: + validate_div_circle_shape_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count18 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count18: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'$description': 'translations.json#/div_rounded_rectangle_shape', 'allOf': [{'$ref': 'div-shape-base.json'}, {'type': 'object', 'properties': {'item_width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_width'}, 'item_height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_height'}, 'corner_radius': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":5}', '$description': 'translations.json#/div_rounded_rectangle_shape_corner_radius'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'$description': 'translations.json#/div_circle_shape', 'allOf': [{'$ref': 'div-shape-base.json'}, {'type': 'object', 'properties': {'radius': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_circle_shape_radius'}, 'type': {'type': 'string', 'enum': ['circle']}}}], 'required': ['type'], 'platforms': ['android', 'web'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_circle_shape_json(data, custom_formats={}, name_prefix=None): + validate_div_shape_base_json(data, custom_formats, (name_prefix or "data") + "") + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'radius': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['circle']}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "radius" in data_keys: + data_keys.remove("radius") + data__radius = data["radius"] + validate_div_fixed_size_json(data__radius, custom_formats, (name_prefix or "data") + ".radius") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['circle']}, rule='type') + if data__type not in ['circle']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['circle']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['circle']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_circle_shape', 'allOf': [{'properties': {'background_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shape_base_background_color'}, 'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_shape_base_stroke'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', 'properties': {'radius': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['circle']}}}], 'required': ['type'], 'platforms': ['android', 'web'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_shape_base_json(data, custom_formats={}, name_prefix=None): + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "background_color" in data_keys: + data_keys.remove("background_color") + data__backgroundcolor = data["background_color"] + validate_common_json__color(data__backgroundcolor, custom_formats, (name_prefix or "data") + ".background_color") + if "stroke" in data_keys: + data_keys.remove("stroke") + data__stroke = data["stroke"] + validate_div_stroke_json(data__stroke, custom_formats, (name_prefix or "data") + ".stroke") + return data + +def validate_div_rounded_rectangle_shape_json(data, custom_formats={}, name_prefix=None): + validate_div_shape_base_json(data, custom_formats, (name_prefix or "data") + "") + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'item_width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'item_height': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'corner_radius': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "item_width" in data_keys: + data_keys.remove("item_width") + data__itemwidth = data["item_width"] + validate_div_fixed_size_json(data__itemwidth, custom_formats, (name_prefix or "data") + ".item_width") + if "item_height" in data_keys: + data_keys.remove("item_height") + data__itemheight = data["item_height"] + validate_div_fixed_size_json(data__itemheight, custom_formats, (name_prefix or "data") + ".item_height") + if "corner_radius" in data_keys: + data_keys.remove("corner_radius") + data__cornerradius = data["corner_radius"] + validate_div_fixed_size_json(data__cornerradius, custom_formats, (name_prefix or "data") + ".corner_radius") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['rounded_rectangle']}, rule='type') + if data__type not in ['rounded_rectangle']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['rounded_rectangle']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['rounded_rectangle']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$description': 'translations.json#/div_rounded_rectangle_shape', 'allOf': [{'properties': {'background_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shape_base_background_color'}, 'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_shape_base_stroke'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', 'properties': {'item_width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'item_height': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'corner_radius': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_indicator_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['indicator']}, rule='type') + if data__type not in ['indicator']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['indicator']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['indicator']}, rule='enum') + if "pager_id" in data_keys: + data_keys.remove("pager_id") + data__pagerid = data["pager_id"] + if not isinstance(data__pagerid, (str)): + if not (isinstance(data__pagerid, str) and '@' in data__pagerid): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".pager_id must be string", value=data__pagerid, name="" + (name_prefix or "data") + ".pager_id", definition={'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_indicator_pager_id'}, rule='type') + if "items_placement" in data_keys: + data_keys.remove("items_placement") + data__itemsplacement = data["items_placement"] + validate_div_indicator_item_placement_json(data__itemsplacement, custom_formats, (name_prefix or "data") + ".items_placement") + if "space_between_centers" in data_keys: + data_keys.remove("space_between_centers") + data__spacebetweencenters = data["space_between_centers"] + validate_div_fixed_size_json(data__spacebetweencenters, custom_formats, (name_prefix or "data") + ".space_between_centers") + if "inactive_item_color" in data_keys: + data_keys.remove("inactive_item_color") + data__inactiveitemcolor = data["inactive_item_color"] + validate_common_json__color(data__inactiveitemcolor, custom_formats, (name_prefix or "data") + ".inactive_item_color") + if "active_item_color" in data_keys: + data_keys.remove("active_item_color") + data__activeitemcolor = data["active_item_color"] + validate_common_json__color(data__activeitemcolor, custom_formats, (name_prefix or "data") + ".active_item_color") + if "shape" in data_keys: + data_keys.remove("shape") + data__shape = data["shape"] + validate_div_shape_json(data__shape, custom_formats, (name_prefix or "data") + ".shape") + if "active_item_size" in data_keys: + data_keys.remove("active_item_size") + data__activeitemsize = data["active_item_size"] + validate_common_json__positive_number(data__activeitemsize, custom_formats, (name_prefix or "data") + ".active_item_size") + if "minimum_item_size" in data_keys: + data_keys.remove("minimum_item_size") + data__minimumitemsize = data["minimum_item_size"] + validate_common_json__positive_number(data__minimumitemsize, custom_formats, (name_prefix or "data") + ".minimum_item_size") + if "active_shape" in data_keys: + data_keys.remove("active_shape") + data__activeshape = data["active_shape"] + validate_div_rounded_rectangle_shape_json(data__activeshape, custom_formats, (name_prefix or "data") + ".active_shape") + if "inactive_shape" in data_keys: + data_keys.remove("inactive_shape") + data__inactiveshape = data["inactive_shape"] + validate_div_rounded_rectangle_shape_json(data__inactiveshape, custom_formats, (name_prefix or "data") + ".inactive_shape") + if "inactive_minimum_shape" in data_keys: + data_keys.remove("inactive_minimum_shape") + data__inactiveminimumshape = data["inactive_minimum_shape"] + validate_div_rounded_rectangle_shape_json(data__inactiveminimumshape, custom_formats, (name_prefix or "data") + ".inactive_minimum_shape") + if "animation" in data_keys: + data_keys.remove("animation") + data__animation = data["animation"] + if not isinstance(data__animation, (str)): + if not (isinstance(data__animation, str) and '@' in data__animation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".animation must be string", value=data__animation, name="" + (name_prefix or "data") + ".animation", definition={'type': 'string', 'enum': ['scale', 'worm', 'slider'], 'default_value': 'scale', '$description': 'translations.json#/div_indicator_animation', 'platforms': ['android', 'ios']}, rule='type') + if data__animation not in ['scale', 'worm', 'slider']: + if not (isinstance(data__animation, str) and '@' in data__animation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".animation must be one of ['scale', 'worm', 'slider']", value=data__animation, name="" + (name_prefix or "data") + ".animation", definition={'type': 'string', 'enum': ['scale', 'worm', 'slider'], 'default_value': 'scale', '$description': 'translations.json#/div_indicator_animation', 'platforms': ['android', 'ios']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_indicator', 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['indicator']}, 'pager_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_indicator_pager_id'}, 'items_placement': {'anyOf': [{'$ref': 'div-default-indicator-item-placement.json', '$description': 'translations.json#/div_indicator_item_placement_default'}, {'$ref': 'div-stretch-indicator-item-placement.json', '$description': 'translations.json#/div_indicator_item_placement_stretch'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'space_between_centers': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'inactive_item_color': {'type': 'string', 'format': 'color'}, 'active_item_color': {'type': 'string', 'format': 'color'}, 'shape': {'anyOf': [{'$ref': 'div-rounded-rectangle-shape.json', '$description': 'translations.json#/div_rounded_rectangle_shape'}, {'$ref': 'div-circle-shape.json', '$description': 'translations.json#/div_circle_shape', 'platforms': ['android', 'web']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'active_item_size': {'type': 'number', 'constraint': 'number > 0'}, 'minimum_item_size': {'type': 'number', 'constraint': 'number > 0'}, 'active_shape': {'$description': 'translations.json#/div_rounded_rectangle_shape', 'allOf': [{'$ref': 'div-shape-base.json'}, {'type': 'object', 'properties': {'item_width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_width'}, 'item_height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_height'}, 'corner_radius': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":5}', '$description': 'translations.json#/div_rounded_rectangle_shape_corner_radius'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'inactive_shape': {'$description': 'translations.json#/div_rounded_rectangle_shape', 'allOf': [{'$ref': 'div-shape-base.json'}, {'type': 'object', 'properties': {'item_width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_width'}, 'item_height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_height'}, 'corner_radius': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":5}', '$description': 'translations.json#/div_rounded_rectangle_shape_corner_radius'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'inactive_minimum_shape': {'$description': 'translations.json#/div_rounded_rectangle_shape', 'allOf': [{'$ref': 'div-shape-base.json'}, {'type': 'object', 'properties': {'item_width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_width'}, 'item_height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":10}', '$description': 'translations.json#/div_rounded_rectangle_shape_item_height'}, 'corner_radius': {'$ref': 'div-fixed-size.json', 'default_value': '{"type":"fixed","value":5}', '$description': 'translations.json#/div_rounded_rectangle_shape_corner_radius'}, 'type': {'type': 'string', 'enum': ['rounded_rectangle']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation': {'type': 'string', 'enum': ['scale', 'worm', 'slider'], 'default_value': 'scale', '$description': 'translations.json#/div_indicator_animation', 'platforms': ['android', 'ios']}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_indicator_item_placement_json(data, custom_formats={}, name_prefix=None): + data_any_of_count19 = 0 + if not data_any_of_count19: + try: + validate_div_default_indicator_item_placement_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count19 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count19: + try: + validate_div_stretch_indicator_item_placement_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count19 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count19: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'space_between_centers': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":15}', '$description': 'translations.json#/div_indicator_space_between_centers'}, 'type': {'type': 'string', 'enum': ['default']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'item_spacing': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":5}', '$description': 'translations.json#/div_indicator_space_between_centers'}, 'max_visible_items': {'$ref': 'common.json#/positive_integer', 'default_value': '10', '$description': 'translations.json#/div_indicator_max_visible_items'}, 'type': {'type': 'string', 'enum': ['stretch']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_stretch_indicator_item_placement_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'item_spacing': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'max_visible_items': {'type': 'integer', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['stretch']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'item_spacing': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'max_visible_items': {'type': 'integer', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['stretch']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "item_spacing" in data_keys: + data_keys.remove("item_spacing") + data__itemspacing = data["item_spacing"] + validate_div_fixed_size_json(data__itemspacing, custom_formats, (name_prefix or "data") + ".item_spacing") + if "max_visible_items" in data_keys: + data_keys.remove("max_visible_items") + data__maxvisibleitems = data["max_visible_items"] + validate_common_json__positive_integer(data__maxvisibleitems, custom_formats, (name_prefix or "data") + ".max_visible_items") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['stretch']}, rule='type') + if data__type not in ['stretch']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['stretch']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['stretch']}, rule='enum') + return data + +def validate_div_default_indicator_item_placement_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'space_between_centers': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['default']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_match_parent_size', 'properties': {'space_between_centers': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'type': {'type': 'string', 'enum': ['default']}}, 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "space_between_centers" in data_keys: + data_keys.remove("space_between_centers") + data__spacebetweencenters = data["space_between_centers"] + validate_div_fixed_size_json(data__spacebetweencenters, custom_formats, (name_prefix or "data") + ".space_between_centers") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['default']}, rule='type') + if data__type not in ['default']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['default']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['default']}, rule='enum') + return data + +def validate_div_custom_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['custom']}, rule='type') + if data__type not in ['custom']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['custom']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['custom']}, rule='enum') + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_custom_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_custom_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "custom_type" in data_keys: + data_keys.remove("custom_type") + data__customtype = data["custom_type"] + if not isinstance(data__customtype, (str)): + if not (isinstance(data__customtype, str) and '@' in data__customtype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".custom_type must be string", value=data__customtype, name="" + (name_prefix or "data") + ".custom_type", definition={'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_custom_custom_type'}, rule='type') + if "custom_props" in data_keys: + data_keys.remove("custom_props") + data__customprops = data["custom_props"] + if not isinstance(data__customprops, (dict)): + if not (isinstance(data__customprops, str) and '@' in data__customprops): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".custom_props must be object", value=data__customprops, name="" + (name_prefix or "data") + ".custom_props", definition={'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_custom_custom_props'}, rule='type') + data__customprops_is_dict = isinstance(data__customprops, dict) + if data__customprops_is_dict: + data__customprops_keys = set(data__customprops.keys()) + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'custom_type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_custom', 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['custom']}, 'items': {'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_custom_items'}, 'custom_type': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_custom_custom_type'}, 'custom_props': {'type': 'object', 'additionalProperties': True, '$description': 'translations.json#/div_custom_custom_props'}}}], 'required': ['type', 'custom_type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_state_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'states']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'properties': {'type': {'type': 'string', 'enum': ['state']}, 'states': {'type': 'array', 'items': {'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_state_div_state_div'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_in', 'platforms': ['android', 'ios'], 'deprecated': True}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_out', 'platforms': ['android', 'ios'], 'deprecated': True}, 'swipe_out_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}, 'minItems': 1, '$description': 'translations.json#/div_state_states'}, 'state_id_variable': {'supports_expressions': False, '$ref': 'common.json#/non_empty_string', '$schema': 'http://json-schema.org/draft-07/schema'}, 'div_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_id', 'deprecated': True}, 'default_state_id': {'type': 'string', '$description': 'translations.json#/div_state_default_state_id'}, 'transition_animation_selector': {'type': 'string', 'enum': ['none', 'data_change', 'state_change', 'any_change'], '$description': 'translations.json#/div_transition_selector', 'deprecated': True, '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'states']}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['state']}, rule='type') + if data__type not in ['state']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['state']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['state']}, rule='enum') + if "states" in data_keys: + data_keys.remove("states") + data__states = data["states"] + if not isinstance(data__states, (list, tuple)): + if not (isinstance(data__states, str) and '@' in data__states): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".states must be array", value=data__states, name="" + (name_prefix or "data") + ".states", definition={'type': 'array', 'items': {'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_state_div_state_div'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_in', 'platforms': ['android', 'ios'], 'deprecated': True}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_out', 'platforms': ['android', 'ios'], 'deprecated': True}, 'swipe_out_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}, 'minItems': 1, '$description': 'translations.json#/div_state_states'}, rule='type') + data__states_is_list = isinstance(data__states, (list, tuple)) + if data__states_is_list: + data__states_len = len(data__states) + if data__states_len < 1: + if not (isinstance(data__states, str) and '@' in data__states): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".states must contain at least 1 items", value=data__states, name="" + (name_prefix or "data") + ".states", definition={'type': 'array', 'items': {'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_state_div_state_div'}, 'animation_in': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_in', 'platforms': ['android', 'ios'], 'deprecated': True}, 'animation_out': {'$ref': 'div-animation.json', '$description': 'translations.json#/div_state_div_state_animation_out', 'platforms': ['android', 'ios'], 'deprecated': True}, 'swipe_out_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}, 'minItems': 1, '$description': 'translations.json#/div_state_states'}, rule='minItems') + for data__states_x, data__states_item in enumerate(data__states): + validate_div_state_json__definitions_div_state(data__states_item, custom_formats, (name_prefix or "data") + ".states[{data__states_x}]".format(**locals())) + if "state_id_variable" in data_keys: + data_keys.remove("state_id_variable") + data__stateidvariable = data["state_id_variable"] + validate_div_variable_name_json(data__stateidvariable, custom_formats, (name_prefix or "data") + ".state_id_variable") + if "div_id" in data_keys: + data_keys.remove("div_id") + data__divid = data["div_id"] + if not isinstance(data__divid, (str)): + if not (isinstance(data__divid, str) and '@' in data__divid): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".div_id must be string", value=data__divid, name="" + (name_prefix or "data") + ".div_id", definition={'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_id', 'deprecated': True}, rule='type') + if "default_state_id" in data_keys: + data_keys.remove("default_state_id") + data__defaultstateid = data["default_state_id"] + if not isinstance(data__defaultstateid, (str)): + if not (isinstance(data__defaultstateid, str) and '@' in data__defaultstateid): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".default_state_id must be string", value=data__defaultstateid, name="" + (name_prefix or "data") + ".default_state_id", definition={'type': 'string', '$description': 'translations.json#/div_state_default_state_id'}, rule='type') + if "transition_animation_selector" in data_keys: + data_keys.remove("transition_animation_selector") + data__transitionanimationselector = data["transition_animation_selector"] + validate_div_transition_selector_json(data__transitionanimationselector, custom_formats, (name_prefix or "data") + ".transition_animation_selector") + return data + +def validate_div_transition_selector_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['none', 'data_change', 'state_change', 'any_change'], '$description': 'translations.json#/div_transition_selector', 'deprecated': True, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['none', 'data_change', 'state_change', 'any_change']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['none', 'data_change', 'state_change', 'any_change']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['none', 'data_change', 'state_change', 'any_change'], '$description': 'translations.json#/div_transition_selector', 'deprecated': True, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_state_json__definitions_div_state(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_in': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_out': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'swipe_out_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['state_id']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'alias_divan': 'item', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'state_id': {'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_in': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_out': {'type': 'object', '$description': 'translations.json#/div_animation', 'properties': {'name': {'type': 'string', 'enum': ['fade', 'translate', 'scale', 'native', 'set', 'no_animation'], '$description': 'translations.json#/div_animation_name'}, 'duration': {'$ref': 'common.json#/non_negative_integer', 'default_value': '300', '$description': 'translations.json#/div_animation_duration'}, 'start_delay': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_animation_start_delay'}, 'start_value': {'type': 'number', '$description': 'translations.json#/div_animation_start_value'}, 'end_value': {'type': 'number', '$description': 'translations.json#/div_animation_end_value'}, 'repeat': {'alias_swift': 'repeat_count', '$ref': 'div-count.json', 'default_value': '{ "type": "infinity" }', '$description': 'translations.json#/div_animation_repeat'}, 'interpolator': {'$ref': 'div-animation-interpolator.json', 'default_value': 'spring', '$description': 'translations.json#/div_animation_interpolator'}, 'items': {'type': 'array', 'items': {'$ref': 'div-animation.json'}, 'minItems': 1, '$description': 'translations.json#/div_animation_items'}}, 'required': ['name'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'swipe_out_actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}}, 'required': ['state_id']}, rule='required') + data_keys = set(data.keys()) + if "state_id" in data_keys: + data_keys.remove("state_id") + data__stateid = data["state_id"] + if not isinstance(data__stateid, (str)): + if not (isinstance(data__stateid, str) and '@' in data__stateid): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".state_id must be string", value=data__stateid, name="" + (name_prefix or "data") + ".state_id", definition={'type': 'string', 'supports_expressions': False, '$description': 'translations.json#/div_state_div_state_state_id'}, rule='type') + if "div" in data_keys: + data_keys.remove("div") + data__div = data["div"] + validate_div_json(data__div, custom_formats, (name_prefix or "data") + ".div") + if "animation_in" in data_keys: + data_keys.remove("animation_in") + data__animationin = data["animation_in"] + validate_div_animation_json(data__animationin, custom_formats, (name_prefix or "data") + ".animation_in") + if "animation_out" in data_keys: + data_keys.remove("animation_out") + data__animationout = data["animation_out"] + validate_div_animation_json(data__animationout, custom_formats, (name_prefix or "data") + ".animation_out") + if "swipe_out_actions" in data_keys: + data_keys.remove("swipe_out_actions") + data__swipeoutactions = data["swipe_out_actions"] + if not isinstance(data__swipeoutactions, (list, tuple)): + if not (isinstance(data__swipeoutactions, str) and '@' in data__swipeoutactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".swipe_out_actions must be array", value=data__swipeoutactions, name="" + (name_prefix or "data") + ".swipe_out_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}, rule='type') + data__swipeoutactions_is_list = isinstance(data__swipeoutactions, (list, tuple)) + if data__swipeoutactions_is_list: + data__swipeoutactions_len = len(data__swipeoutactions) + if data__swipeoutactions_len < 1: + if not (isinstance(data__swipeoutactions, str) and '@' in data__swipeoutactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".swipe_out_actions must contain at least 1 items", value=data__swipeoutactions, name="" + (name_prefix or "data") + ".swipe_out_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_state_div_state_swipe_out_actions', 'platforms': ['android'], 'deprecated': True}, rule='minItems') + for data__swipeoutactions_x, data__swipeoutactions_item in enumerate(data__swipeoutactions): + validate_div_action_json(data__swipeoutactions_item, custom_formats, (name_prefix or "data") + ".swipe_out_actions[{data__swipeoutactions_x}]".format(**locals())) + return data + +def validate_div_tabs_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['tabs']}, rule='type') + if data__type not in ['tabs']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['tabs']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['tabs']}, rule='enum') + if "title_paddings" in data_keys: + data_keys.remove("title_paddings") + data__titlepaddings = data["title_paddings"] + validate_div_edge_insets_json(data__titlepaddings, custom_formats, (name_prefix or "data") + ".title_paddings") + if "separator_paddings" in data_keys: + data_keys.remove("separator_paddings") + data__separatorpaddings = data["separator_paddings"] + validate_div_edge_insets_json(data__separatorpaddings, custom_formats, (name_prefix or "data") + ".separator_paddings") + if "tab_title_style" in data_keys: + data_keys.remove("tab_title_style") + data__tabtitlestyle = data["tab_title_style"] + if not isinstance(data__tabtitlestyle, (dict)): + if not (isinstance(data__tabtitlestyle, str) and '@' in data__tabtitlestyle): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tab_title_style must be object", value=data__tabtitlestyle, name="" + (name_prefix or "data") + ".tab_title_style", definition={'type': 'object', 'properties': {'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'paddings': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'item_spacing': {'type': 'integer', 'constraint': 'number >= 0'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_tabs_tab_title_style_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'active_font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'inactive_font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'active_text_color': {'type': 'string', 'format': 'color'}, 'inactive_text_color': {'type': 'string', 'format': 'color'}, 'active_background_color': {'type': 'string', 'format': 'color'}, 'inactive_background_color': {'type': 'string', 'format': 'color'}, 'corner_radius': {'type': 'integer', 'constraint': 'number >= 0'}, 'corners_radius': {'type': 'object', '$description': 'translations.json#/div_corners_radius', 'properties': {'top-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_left'}, 'top-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_right'}, 'bottom-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_left'}, 'bottom-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_right'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_type': {'type': 'string', 'enum': ['slide', 'fade', 'none'], 'default_value': 'slide', '$description': 'translations.json#/div_tabs_tab_title_style_animation_type', 'platforms': ['android', 'ios']}, 'animation_duration': {'type': 'integer', 'constraint': 'number >= 0'}}, '$description': 'translations.json#/div_tabs_tab_title_style'}, rule='type') + data__tabtitlestyle_is_dict = isinstance(data__tabtitlestyle, dict) + if data__tabtitlestyle_is_dict: + data__tabtitlestyle_keys = set(data__tabtitlestyle.keys()) + if "font_size" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("font_size") + data__tabtitlestyle__fontsize = data__tabtitlestyle["font_size"] + validate_common_json__non_negative_integer(data__tabtitlestyle__fontsize, custom_formats, (name_prefix or "data") + ".tab_title_style.font_size") + if "font_size_unit" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("font_size_unit") + data__tabtitlestyle__fontsizeunit = data__tabtitlestyle["font_size_unit"] + validate_div_size_unit_json(data__tabtitlestyle__fontsizeunit, custom_formats, (name_prefix or "data") + ".tab_title_style.font_size_unit") + if "paddings" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("paddings") + data__tabtitlestyle__paddings = data__tabtitlestyle["paddings"] + validate_div_edge_insets_json(data__tabtitlestyle__paddings, custom_formats, (name_prefix or "data") + ".tab_title_style.paddings") + if "item_spacing" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("item_spacing") + data__tabtitlestyle__itemspacing = data__tabtitlestyle["item_spacing"] + validate_common_json__non_negative_integer(data__tabtitlestyle__itemspacing, custom_formats, (name_prefix or "data") + ".tab_title_style.item_spacing") + if "line_height" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("line_height") + data__tabtitlestyle__lineheight = data__tabtitlestyle["line_height"] + validate_common_json__non_negative_integer(data__tabtitlestyle__lineheight, custom_formats, (name_prefix or "data") + ".tab_title_style.line_height") + if "letter_spacing" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("letter_spacing") + data__tabtitlestyle__letterspacing = data__tabtitlestyle["letter_spacing"] + if not isinstance(data__tabtitlestyle__letterspacing, (int, float, Decimal)) or isinstance(data__tabtitlestyle__letterspacing, bool): + if not (isinstance(data__tabtitlestyle__letterspacing, str) and '@' in data__tabtitlestyle__letterspacing): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tab_title_style.letter_spacing must be number", value=data__tabtitlestyle__letterspacing, name="" + (name_prefix or "data") + ".tab_title_style.letter_spacing", definition={'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_tabs_tab_title_style_letter_spacing'}, rule='type') + if "font_weight" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("font_weight") + data__tabtitlestyle__fontweight = data__tabtitlestyle["font_weight"] + validate_div_font_weight_json(data__tabtitlestyle__fontweight, custom_formats, (name_prefix or "data") + ".tab_title_style.font_weight") + if "active_font_weight" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("active_font_weight") + data__tabtitlestyle__activefontweight = data__tabtitlestyle["active_font_weight"] + validate_div_font_weight_json(data__tabtitlestyle__activefontweight, custom_formats, (name_prefix or "data") + ".tab_title_style.active_font_weight") + if "inactive_font_weight" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("inactive_font_weight") + data__tabtitlestyle__inactivefontweight = data__tabtitlestyle["inactive_font_weight"] + validate_div_font_weight_json(data__tabtitlestyle__inactivefontweight, custom_formats, (name_prefix or "data") + ".tab_title_style.inactive_font_weight") + if "font_family" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("font_family") + data__tabtitlestyle__fontfamily = data__tabtitlestyle["font_family"] + validate_common_json__non_empty_string(data__tabtitlestyle__fontfamily, custom_formats, (name_prefix or "data") + ".tab_title_style.font_family") + if "active_text_color" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("active_text_color") + data__tabtitlestyle__activetextcolor = data__tabtitlestyle["active_text_color"] + validate_common_json__color(data__tabtitlestyle__activetextcolor, custom_formats, (name_prefix or "data") + ".tab_title_style.active_text_color") + if "inactive_text_color" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("inactive_text_color") + data__tabtitlestyle__inactivetextcolor = data__tabtitlestyle["inactive_text_color"] + validate_common_json__color(data__tabtitlestyle__inactivetextcolor, custom_formats, (name_prefix or "data") + ".tab_title_style.inactive_text_color") + if "active_background_color" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("active_background_color") + data__tabtitlestyle__activebackgroundcolor = data__tabtitlestyle["active_background_color"] + validate_common_json__color(data__tabtitlestyle__activebackgroundcolor, custom_formats, (name_prefix or "data") + ".tab_title_style.active_background_color") + if "inactive_background_color" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("inactive_background_color") + data__tabtitlestyle__inactivebackgroundcolor = data__tabtitlestyle["inactive_background_color"] + validate_common_json__color(data__tabtitlestyle__inactivebackgroundcolor, custom_formats, (name_prefix or "data") + ".tab_title_style.inactive_background_color") + if "corner_radius" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("corner_radius") + data__tabtitlestyle__cornerradius = data__tabtitlestyle["corner_radius"] + validate_common_json__non_negative_integer(data__tabtitlestyle__cornerradius, custom_formats, (name_prefix or "data") + ".tab_title_style.corner_radius") + if "corners_radius" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("corners_radius") + data__tabtitlestyle__cornersradius = data__tabtitlestyle["corners_radius"] + validate_div_corners_radius_json(data__tabtitlestyle__cornersradius, custom_formats, (name_prefix or "data") + ".tab_title_style.corners_radius") + if "animation_type" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("animation_type") + data__tabtitlestyle__animationtype = data__tabtitlestyle["animation_type"] + if not isinstance(data__tabtitlestyle__animationtype, (str)): + if not (isinstance(data__tabtitlestyle__animationtype, str) and '@' in data__tabtitlestyle__animationtype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tab_title_style.animation_type must be string", value=data__tabtitlestyle__animationtype, name="" + (name_prefix or "data") + ".tab_title_style.animation_type", definition={'type': 'string', 'enum': ['slide', 'fade', 'none'], 'default_value': 'slide', '$description': 'translations.json#/div_tabs_tab_title_style_animation_type', 'platforms': ['android', 'ios']}, rule='type') + if data__tabtitlestyle__animationtype not in ['slide', 'fade', 'none']: + if not (isinstance(data__tabtitlestyle__animationtype, str) and '@' in data__tabtitlestyle__animationtype): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tab_title_style.animation_type must be one of ['slide', 'fade', 'none']", value=data__tabtitlestyle__animationtype, name="" + (name_prefix or "data") + ".tab_title_style.animation_type", definition={'type': 'string', 'enum': ['slide', 'fade', 'none'], 'default_value': 'slide', '$description': 'translations.json#/div_tabs_tab_title_style_animation_type', 'platforms': ['android', 'ios']}, rule='enum') + if "animation_duration" in data__tabtitlestyle_keys: + data__tabtitlestyle_keys.remove("animation_duration") + data__tabtitlestyle__animationduration = data__tabtitlestyle["animation_duration"] + validate_common_json__non_negative_integer(data__tabtitlestyle__animationduration, custom_formats, (name_prefix or "data") + ".tab_title_style.animation_duration") + if "selected_tab" in data_keys: + data_keys.remove("selected_tab") + data__selectedtab = data["selected_tab"] + validate_common_json__non_negative_integer(data__selectedtab, custom_formats, (name_prefix or "data") + ".selected_tab") + if "has_separator" in data_keys: + data_keys.remove("has_separator") + data__hasseparator = data["has_separator"] + validate_common_json__boolean_int(data__hasseparator, custom_formats, (name_prefix or "data") + ".has_separator") + if "switch_tabs_by_content_swipe_enabled" in data_keys: + data_keys.remove("switch_tabs_by_content_swipe_enabled") + data__switchtabsbycontentswipeenabled = data["switch_tabs_by_content_swipe_enabled"] + validate_common_json__boolean_int(data__switchtabsbycontentswipeenabled, custom_formats, (name_prefix or "data") + ".switch_tabs_by_content_swipe_enabled") + if "separator_color" in data_keys: + data_keys.remove("separator_color") + data__separatorcolor = data["separator_color"] + validate_common_json__color(data__separatorcolor, custom_formats, (name_prefix or "data") + ".separator_color") + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_tabs_item_title'}, 'title_click_action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_tabs_item_title_click_action'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tabs_item_div'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}, 'minItems': 1, '$description': 'translations.json#/div_tabs_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_tabs_item_title'}, 'title_click_action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_tabs_item_title_click_action'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tabs_item_div'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}, 'minItems': 1, '$description': 'translations.json#/div_tabs_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_tabs_json__definitions_item(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "dynamic_height" in data_keys: + data_keys.remove("dynamic_height") + data__dynamicheight = data["dynamic_height"] + validate_common_json__boolean_int(data__dynamicheight, custom_formats, (name_prefix or "data") + ".dynamic_height") + if "restrict_parent_scroll" in data_keys: + data_keys.remove("restrict_parent_scroll") + data__restrictparentscroll = data["restrict_parent_scroll"] + validate_common_json__boolean_int(data__restrictparentscroll, custom_formats, (name_prefix or "data") + ".restrict_parent_scroll") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_tabs', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'definitions': {'item': {'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'title_click_action': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['tabs']}, 'title_paddings': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'separator_paddings': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'tab_title_style': {'type': 'object', 'properties': {'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'paddings': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'item_spacing': {'type': 'integer', 'constraint': 'number >= 0'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_tabs_tab_title_style_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'active_font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'inactive_font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'active_text_color': {'type': 'string', 'format': 'color'}, 'inactive_text_color': {'type': 'string', 'format': 'color'}, 'active_background_color': {'type': 'string', 'format': 'color'}, 'inactive_background_color': {'type': 'string', 'format': 'color'}, 'corner_radius': {'type': 'integer', 'constraint': 'number >= 0'}, 'corners_radius': {'type': 'object', '$description': 'translations.json#/div_corners_radius', 'properties': {'top-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_left'}, 'top-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_top_right'}, 'bottom-left': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_left'}, 'bottom-right': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_corners_radius_bottom_right'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'animation_type': {'type': 'string', 'enum': ['slide', 'fade', 'none'], 'default_value': 'slide', '$description': 'translations.json#/div_tabs_tab_title_style_animation_type', 'platforms': ['android', 'ios']}, 'animation_duration': {'type': 'integer', 'constraint': 'number >= 0'}}, '$description': 'translations.json#/div_tabs_tab_title_style'}, 'selected_tab': {'type': 'integer', 'constraint': 'number >= 0'}, 'has_separator': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'switch_tabs_by_content_swipe_enabled': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'separator_color': {'type': 'string', 'format': 'color'}, 'items': {'type': 'array', 'items': {'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_tabs_item_title'}, 'title_click_action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_tabs_item_title_click_action'}, 'div': {'$ref': 'div.json', '$description': 'translations.json#/div_tabs_item_div'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}, 'minItems': 1, '$description': 'translations.json#/div_tabs_items'}, 'dynamic_height': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'restrict_parent_scroll': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_tabs_json__definitions_item(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'title_click_action': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['title', 'div']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'properties': {'title': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'title_click_action': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'div': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['title', 'div'], '$description': 'translations.json#/div_tabs_item'}, rule='required') + data_keys = set(data.keys()) + if "title" in data_keys: + data_keys.remove("title") + data__title = data["title"] + validate_common_json__non_empty_string(data__title, custom_formats, (name_prefix or "data") + ".title") + if "title_click_action" in data_keys: + data_keys.remove("title_click_action") + data__titleclickaction = data["title_click_action"] + validate_div_action_json(data__titleclickaction, custom_formats, (name_prefix or "data") + ".title_click_action") + if "div" in data_keys: + data_keys.remove("div") + data__div = data["div"] + validate_div_json(data__div, custom_formats, (name_prefix or "data") + ".div") + return data + +def validate_div_pager_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pager']}, rule='type') + if data__type not in ['pager']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['pager']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['pager']}, rule='enum') + if "layout_mode" in data_keys: + data_keys.remove("layout_mode") + data__layoutmode = data["layout_mode"] + validate_div_pager_layout_mode_json(data__layoutmode, custom_formats, (name_prefix or "data") + ".layout_mode") + if "item_spacing" in data_keys: + data_keys.remove("item_spacing") + data__itemspacing = data["item_spacing"] + validate_div_fixed_size_json(data__itemspacing, custom_formats, (name_prefix or "data") + ".item_spacing") + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_pager_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_pager_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "orientation" in data_keys: + data_keys.remove("orientation") + data__orientation = data["orientation"] + if not isinstance(data__orientation, (str)): + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be string", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_pager_orientation'}, rule='type') + if data__orientation not in ['horizontal', 'vertical']: + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be one of ['horizontal', 'vertical']", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_pager_orientation'}, rule='enum') + if "restrict_parent_scroll" in data_keys: + data_keys.remove("restrict_parent_scroll") + data__restrictparentscroll = data["restrict_parent_scroll"] + validate_common_json__boolean_int(data__restrictparentscroll, custom_formats, (name_prefix or "data") + ".restrict_parent_scroll") + if "default_item" in data_keys: + data_keys.remove("default_item") + data__defaultitem = data["default_item"] + validate_common_json__non_negative_integer(data__defaultitem, custom_formats, (name_prefix or "data") + ".default_item") + if "infinite_scroll" in data_keys: + data_keys.remove("infinite_scroll") + data__infinitescroll = data["infinite_scroll"] + validate_common_json__boolean_int(data__infinitescroll, custom_formats, (name_prefix or "data") + ".infinite_scroll") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items', 'layout_mode']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_pager', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['pager']}, 'layout_mode': {'anyOf': [{'$ref': 'div-page-size.json', '$description': 'translations.json#/div_pager_layout_mode_page_size'}, {'$ref': 'div-neighbour-page-size.json', '$description': 'translations.json#/div_pager_layout_mode_neighbour_page_size'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'item_spacing': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'items': {'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_pager_items'}, 'orientation': {'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_pager_orientation'}, 'restrict_parent_scroll': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'default_item': {'type': 'integer', 'constraint': 'number >= 0'}, 'infinite_scroll': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}}}], 'required': ['type', 'items', 'layout_mode'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_pager_layout_mode_json(data, custom_formats={}, name_prefix=None): + data_any_of_count20 = 0 + if not data_any_of_count20: + try: + validate_div_page_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count20 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count20: + try: + validate_div_neighbour_page_size_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count20 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count20: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_page_size', 'properties': {'type': {'type': 'string', 'enum': ['percentage']}, 'page_width': {'$ref': 'div-percentage-size.json', '$description': 'translations.json#/div_page_size_page_width'}}, 'required': ['type', 'page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_neighbour_page_size', 'properties': {'type': {'type': 'string', 'enum': ['fixed']}, 'neighbour_page_width': {'$ref': 'div-fixed-size.json', '$description': 'translations.json#/div_neighbour_page_size_neighbour_page_width'}}, 'required': ['type', 'neighbour_page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_neighbour_page_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_neighbour_page_size', 'properties': {'type': {'type': 'string', 'enum': ['fixed']}, 'neighbour_page_width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'neighbour_page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'neighbour_page_width']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_neighbour_page_size', 'properties': {'type': {'type': 'string', 'enum': ['fixed']}, 'neighbour_page_width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'neighbour_page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='type') + if data__type not in ['fixed']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['fixed']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['fixed']}, rule='enum') + if "neighbour_page_width" in data_keys: + data_keys.remove("neighbour_page_width") + data__neighbourpagewidth = data["neighbour_page_width"] + validate_div_fixed_size_json(data__neighbourpagewidth, custom_formats, (name_prefix or "data") + ".neighbour_page_width") + return data + +def validate_div_page_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_page_size', 'properties': {'type': {'type': 'string', 'enum': ['percentage']}, 'page_width': {'type': 'object', '$description': 'translations.json#/div_percentage_size', 'properties': {'value': {'$ref': 'common.json#/positive_number', '$description': 'translations.json#/div_percentage_size_value'}, 'type': {'type': 'string', 'enum': ['percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'page_width']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_page_size', 'properties': {'type': {'type': 'string', 'enum': ['percentage']}, 'page_width': {'type': 'object', '$description': 'translations.json#/div_percentage_size', 'properties': {'value': {'$ref': 'common.json#/positive_number', '$description': 'translations.json#/div_percentage_size_value'}, 'type': {'type': 'string', 'enum': ['percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['type', 'page_width'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['percentage']}, rule='type') + if data__type not in ['percentage']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['percentage']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['percentage']}, rule='enum') + if "page_width" in data_keys: + data_keys.remove("page_width") + data__pagewidth = data["page_width"] + validate_div_percentage_size_json(data__pagewidth, custom_formats, (name_prefix or "data") + ".page_width") + return data + +def validate_div_percentage_size_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_percentage_size', 'properties': {'value': {'type': 'number', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'value']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_percentage_size', 'properties': {'value': {'type': 'number', 'constraint': 'number > 0'}, 'type': {'type': 'string', 'enum': ['percentage']}}, 'required': ['type', 'value'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + data_keys = set(data.keys()) + if "value" in data_keys: + data_keys.remove("value") + data__value = data["value"] + validate_common_json__positive_number(data__value, custom_formats, (name_prefix or "data") + ".value") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['percentage']}, rule='type') + if data__type not in ['percentage']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['percentage']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['percentage']}, rule='enum') + return data + +def validate_div_gallery_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gallery']}, rule='type') + if data__type not in ['gallery']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['gallery']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gallery']}, rule='enum') + if "cross_content_alignment" in data_keys: + data_keys.remove("cross_content_alignment") + data__crosscontentalignment = data["cross_content_alignment"] + if not isinstance(data__crosscontentalignment, (str)): + if not (isinstance(data__crosscontentalignment, str) and '@' in data__crosscontentalignment): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".cross_content_alignment must be string", value=data__crosscontentalignment, name="" + (name_prefix or "data") + ".cross_content_alignment", definition={'$description': 'translations.json#/div_gallery_cross_content_alignment', 'version': '2.1', 'type': 'string', 'enum': ['start', 'center', 'end'], 'default_value': 'start'}, rule='type') + if data__crosscontentalignment not in ['start', 'center', 'end']: + if not (isinstance(data__crosscontentalignment, str) and '@' in data__crosscontentalignment): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".cross_content_alignment must be one of ['start', 'center', 'end']", value=data__crosscontentalignment, name="" + (name_prefix or "data") + ".cross_content_alignment", definition={'$description': 'translations.json#/div_gallery_cross_content_alignment', 'version': '2.1', 'type': 'string', 'enum': ['start', 'center', 'end'], 'default_value': 'start'}, rule='enum') + if "column_count" in data_keys: + data_keys.remove("column_count") + data__columncount = data["column_count"] + validate_common_json__positive_integer(data__columncount, custom_formats, (name_prefix or "data") + ".column_count") + if "item_spacing" in data_keys: + data_keys.remove("item_spacing") + data__itemspacing = data["item_spacing"] + validate_common_json__non_negative_integer(data__itemspacing, custom_formats, (name_prefix or "data") + ".item_spacing") + if "cross_spacing" in data_keys: + data_keys.remove("cross_spacing") + data__crossspacing = data["cross_spacing"] + validate_common_json__non_negative_integer(data__crossspacing, custom_formats, (name_prefix or "data") + ".cross_spacing") + if "scroll_mode" in data_keys: + data_keys.remove("scroll_mode") + data__scrollmode = data["scroll_mode"] + if not isinstance(data__scrollmode, (str)): + if not (isinstance(data__scrollmode, str) and '@' in data__scrollmode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".scroll_mode must be string", value=data__scrollmode, name="" + (name_prefix or "data") + ".scroll_mode", definition={'type': 'string', 'default_value': 'default', 'enum': ['paging', 'default'], '$description': 'translations.json#/div_gallery_scroll_mode'}, rule='type') + if data__scrollmode not in ['paging', 'default']: + if not (isinstance(data__scrollmode, str) and '@' in data__scrollmode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".scroll_mode must be one of ['paging', 'default']", value=data__scrollmode, name="" + (name_prefix or "data") + ".scroll_mode", definition={'type': 'string', 'default_value': 'default', 'enum': ['paging', 'default'], '$description': 'translations.json#/div_gallery_scroll_mode'}, rule='enum') + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_gallery_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_gallery_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "orientation" in data_keys: + data_keys.remove("orientation") + data__orientation = data["orientation"] + if not isinstance(data__orientation, (str)): + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be string", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_gallery_orientation'}, rule='type') + if data__orientation not in ['horizontal', 'vertical']: + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be one of ['horizontal', 'vertical']", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_gallery_orientation'}, rule='enum') + if "restrict_parent_scroll" in data_keys: + data_keys.remove("restrict_parent_scroll") + data__restrictparentscroll = data["restrict_parent_scroll"] + validate_common_json__boolean_int(data__restrictparentscroll, custom_formats, (name_prefix or "data") + ".restrict_parent_scroll") + if "default_item" in data_keys: + data_keys.remove("default_item") + data__defaultitem = data["default_item"] + validate_common_json__non_negative_integer(data__defaultitem, custom_formats, (name_prefix or "data") + ".default_item") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_gallery', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['gallery']}, 'cross_content_alignment': {'$description': 'translations.json#/div_gallery_cross_content_alignment', 'version': '2.1', 'type': 'string', 'enum': ['start', 'center', 'end'], 'default_value': 'start'}, 'column_count': {'type': 'integer', 'constraint': 'number > 0'}, 'item_spacing': {'type': 'integer', 'constraint': 'number >= 0'}, 'cross_spacing': {'type': 'integer', 'constraint': 'number >= 0'}, 'scroll_mode': {'type': 'string', 'default_value': 'default', 'enum': ['paging', 'default'], '$description': 'translations.json#/div_gallery_scroll_mode'}, 'items': {'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_gallery_items'}, 'orientation': {'type': 'string', 'default_value': 'horizontal', 'enum': ['horizontal', 'vertical'], '$description': 'translations.json#/div_gallery_orientation'}, 'restrict_parent_scroll': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'default_item': {'type': 'integer', 'constraint': 'number >= 0'}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_grid_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "content_alignment_vertical" in data_keys: + data_keys.remove("content_alignment_vertical") + data__contentalignmentvertical = data["content_alignment_vertical"] + validate_div_alignment_vertical_json(data__contentalignmentvertical, custom_formats, (name_prefix or "data") + ".content_alignment_vertical") + if "content_alignment_horizontal" in data_keys: + data_keys.remove("content_alignment_horizontal") + data__contentalignmenthorizontal = data["content_alignment_horizontal"] + validate_div_alignment_horizontal_json(data__contentalignmenthorizontal, custom_formats, (name_prefix or "data") + ".content_alignment_horizontal") + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'strictParsing': True, '$description': 'translations.json#/div_grid_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'strictParsing': True, '$description': 'translations.json#/div_grid_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "column_count" in data_keys: + data_keys.remove("column_count") + data__columncount = data["column_count"] + validate_common_json__non_negative_integer(data__columncount, custom_formats, (name_prefix or "data") + ".column_count") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['grid']}, rule='type') + if data__type not in ['grid']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['grid']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['grid']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['items', 'column_count', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_grid', 'codegen': {'swift': {'generate_optional_arguments': False}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_actionable_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, 'longtap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, 'doubletap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, 'action_animation': {'$ref': 'div-animation.json', 'default_value': '{"name": "fade", "start_value": 1, "end_value": 0.6, "duration": 100 }', '$description': 'translations.json#/div_actionable_action_animation'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'content_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'content_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'items': {'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, 'strictParsing': True, '$description': 'translations.json#/div_grid_items'}, 'column_count': {'type': 'integer', 'constraint': 'number >= 0'}, 'type': {'type': 'string', 'enum': ['grid']}}}], 'required': ['items', 'column_count', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_actionable_json(data, custom_formats={}, name_prefix=None): + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "action" in data_keys: + data_keys.remove("action") + data__action = data["action"] + validate_div_action_json(data__action, custom_formats, (name_prefix or "data") + ".action") + if "actions" in data_keys: + data_keys.remove("actions") + data__actions = data["actions"] + if not isinstance(data__actions, (list, tuple)): + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must be array", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, rule='type') + data__actions_is_list = isinstance(data__actions, (list, tuple)) + if data__actions_is_list: + data__actions_len = len(data__actions) + if data__actions_len < 1: + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must contain at least 1 items", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, rule='minItems') + for data__actions_x, data__actions_item in enumerate(data__actions): + validate_div_action_json(data__actions_item, custom_formats, (name_prefix or "data") + ".actions[{data__actions_x}]".format(**locals())) + if "longtap_actions" in data_keys: + data_keys.remove("longtap_actions") + data__longtapactions = data["longtap_actions"] + if not isinstance(data__longtapactions, (list, tuple)): + if not (isinstance(data__longtapactions, str) and '@' in data__longtapactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".longtap_actions must be array", value=data__longtapactions, name="" + (name_prefix or "data") + ".longtap_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, rule='type') + data__longtapactions_is_list = isinstance(data__longtapactions, (list, tuple)) + if data__longtapactions_is_list: + data__longtapactions_len = len(data__longtapactions) + if data__longtapactions_len < 1: + if not (isinstance(data__longtapactions, str) and '@' in data__longtapactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".longtap_actions must contain at least 1 items", value=data__longtapactions, name="" + (name_prefix or "data") + ".longtap_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, rule='minItems') + for data__longtapactions_x, data__longtapactions_item in enumerate(data__longtapactions): + validate_div_action_json(data__longtapactions_item, custom_formats, (name_prefix or "data") + ".longtap_actions[{data__longtapactions_x}]".format(**locals())) + if "doubletap_actions" in data_keys: + data_keys.remove("doubletap_actions") + data__doubletapactions = data["doubletap_actions"] + if not isinstance(data__doubletapactions, (list, tuple)): + if not (isinstance(data__doubletapactions, str) and '@' in data__doubletapactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".doubletap_actions must be array", value=data__doubletapactions, name="" + (name_prefix or "data") + ".doubletap_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, rule='type') + data__doubletapactions_is_list = isinstance(data__doubletapactions, (list, tuple)) + if data__doubletapactions_is_list: + data__doubletapactions_len = len(data__doubletapactions) + if data__doubletapactions_len < 1: + if not (isinstance(data__doubletapactions, str) and '@' in data__doubletapactions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".doubletap_actions must contain at least 1 items", value=data__doubletapactions, name="" + (name_prefix or "data") + ".doubletap_actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, rule='minItems') + for data__doubletapactions_x, data__doubletapactions_item in enumerate(data__doubletapactions): + validate_div_action_json(data__doubletapactions_item, custom_formats, (name_prefix or "data") + ".doubletap_actions[{data__doubletapactions_x}]".format(**locals())) + if "action_animation" in data_keys: + data_keys.remove("action_animation") + data__actionanimation = data["action_animation"] + validate_div_animation_json(data__actionanimation, custom_formats, (name_prefix or "data") + ".action_animation") + return data + +def validate_div_container_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['container']}, rule='type') + if data__type not in ['container']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['container']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['container']}, rule='enum') + if "content_alignment_vertical" in data_keys: + data__contentalignmentvertical = data["content_alignment_vertical"] + validate_div_content_alignment_vertical_json(data__contentalignmentvertical, custom_formats, (name_prefix or "data") + ".content_alignment_vertical") + if "content_alignment_horizontal" in data_keys: + data_keys.remove("content_alignment_horizontal") + data__contentalignmenthorizontal = data["content_alignment_horizontal"] + validate_div_content_alignment_horizontal_json(data__contentalignmenthorizontal, custom_formats, (name_prefix or "data") + ".content_alignment_horizontal") + if "orientation" in data_keys: + data_keys.remove("orientation") + data__orientation = data["orientation"] + if not isinstance(data__orientation, (str)): + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be string", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'enum': ['vertical', 'horizontal', 'overlap'], 'default_value': 'vertical', '$description': 'translations.json#/div_container_orientation'}, rule='type') + if data__orientation not in ['vertical', 'horizontal', 'overlap']: + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be one of ['vertical', 'horizontal', 'overlap']", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'enum': ['vertical', 'horizontal', 'overlap'], 'default_value': 'vertical', '$description': 'translations.json#/div_container_orientation'}, rule='enum') + if "layout_mode" in data_keys: + data_keys.remove("layout_mode") + data__layoutmode = data["layout_mode"] + if not isinstance(data__layoutmode, (str)): + if not (isinstance(data__layoutmode, str) and '@' in data__layoutmode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".layout_mode must be string", value=data__layoutmode, name="" + (name_prefix or "data") + ".layout_mode", definition={'type': 'string', 'enum': ['no_wrap', 'wrap'], 'default_value': 'no_wrap', '$description': 'translations.json#/div_container_layout_mode'}, rule='type') + if data__layoutmode not in ['no_wrap', 'wrap']: + if not (isinstance(data__layoutmode, str) and '@' in data__layoutmode): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".layout_mode must be one of ['no_wrap', 'wrap']", value=data__layoutmode, name="" + (name_prefix or "data") + ".layout_mode", definition={'type': 'string', 'enum': ['no_wrap', 'wrap'], 'default_value': 'no_wrap', '$description': 'translations.json#/div_container_layout_mode'}, rule='enum') + if "separator" in data_keys: + data_keys.remove("separator") + data__separator = data["separator"] + validate_div_container_json__definitions_separator(data__separator, custom_formats, (name_prefix or "data") + ".separator") + if "line_separator" in data_keys: + data_keys.remove("line_separator") + data__lineseparator = data["line_separator"] + validate_div_container_json__definitions_separator(data__lineseparator, custom_formats, (name_prefix or "data") + ".line_separator") + if "items" in data_keys: + data_keys.remove("items") + data__items = data["items"] + if not isinstance(data__items, (list, tuple)): + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must be array", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_container_items'}, rule='type') + data__items_is_list = isinstance(data__items, (list, tuple)) + if data__items_is_list: + data__items_len = len(data__items) + if data__items_len < 1: + if not (isinstance(data__items, str) and '@' in data__items): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".items must contain at least 1 items", value=data__items, name="" + (name_prefix or "data") + ".items", definition={'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_container_items'}, rule='minItems') + for data__items_x, data__items_item in enumerate(data__items): + validate_div_json(data__items_item, custom_formats, (name_prefix or "data") + ".items[{data__items_x}]".format(**locals())) + if "aspect" in data_keys: + data_keys.remove("aspect") + data__aspect = data["aspect"] + validate_div_aspect_json(data__aspect, custom_formats, (name_prefix or "data") + ".aspect") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'items']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_container', 'codegen': {'divan': {'forced_properties_order': ['orientation'], 'factories': {'row': {'vararg_property': 'items', 'inlines': {'orientation': 'horizontal'}}, 'column': {'vararg_property': 'items', 'inlines': {'orientation': 'vertical'}}, 'stack': {'vararg_property': 'items', 'inlines': {'orientation': 'overlap'}}}}, 'swift': {'generate_optional_arguments': False}}, 'definitions': {'separator': {'type': 'object', 'properties': {'show_at_start': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_between': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_at_end': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['style']}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_actionable_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, 'longtap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, 'doubletap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, 'action_animation': {'$ref': 'div-animation.json', 'default_value': '{"name": "fade", "start_value": 1, "end_value": 0.6, "duration": 100 }', '$description': 'translations.json#/div_actionable_action_animation'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['container']}, 'content_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'content_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'orientation': {'type': 'string', 'enum': ['vertical', 'horizontal', 'overlap'], 'default_value': 'vertical', '$description': 'translations.json#/div_container_orientation'}, 'layout_mode': {'type': 'string', 'enum': ['no_wrap', 'wrap'], 'default_value': 'no_wrap', '$description': 'translations.json#/div_container_layout_mode'}, 'separator': {'type': 'object', 'properties': {'show_at_start': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_start', 'default_value': 'false'}, 'show_between': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_between', 'default_value': 'true'}, 'show_at_end': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_end', 'default_value': 'false'}, 'style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_container_separator_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}}, 'required': ['style']}, 'line_separator': {'type': 'object', 'properties': {'show_at_start': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_start', 'default_value': 'false'}, 'show_between': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_between', 'default_value': 'true'}, 'show_at_end': {'$ref': 'common.json#/boolean_int', '$description': 'translations.json#/div_container_separator_show_at_end', 'default_value': 'false'}, 'style': {'$ref': 'div-drawable.json', '$description': 'translations.json#/div_container_separator_style'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}}, 'required': ['style']}, 'items': {'type': 'array', 'items': {'generate_case_for_templates_kotlinDsl': True, 'generate_case_for_templates_typescript': True, 'anyOf': [{'$ref': 'div-image.json', '$description': 'translations.json#/div_image_short'}, {'$ref': 'div-gif-image.json', '$description': 'translations.json#/div_gif_image_short'}, {'$ref': 'div-text.json', '$description': 'translations.json#/div_text_short'}, {'$ref': 'div-separator.json', '$description': 'translations.json#/div_separator_short'}, {'$ref': 'div-container.json', '$description': 'translations.json#/div_container_short'}, {'$ref': 'div-grid.json', '$description': 'translations.json#/div_grid_short'}, {'$ref': 'div-gallery.json', '$description': 'translations.json#/div_gallery_short'}, {'$ref': 'div-pager.json', '$description': 'translations.json#/div_pager_short'}, {'$ref': 'div-tabs.json', '$description': 'translations.json#/div_tabs_short'}, {'$ref': 'div-state.json', '$description': 'translations.json#/div_state_short'}, {'$ref': 'div-custom.json', '$description': 'translations.json#/div_custom_short'}, {'$ref': 'div-indicator.json', '$description': 'translations.json#/div_indicator_short'}, {'$ref': 'div-slider.json', '$description': 'translations.json#/div_slider_short'}, {'$ref': 'div-input.json', '$description': 'translations.json#/div_input_short'}, {'$ref': 'div-select.json', '$description': 'translations.json#/div_select'}, {'$ref': 'div-video.json', '$description': 'translations.json#/div_video'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_container_items'}, 'aspect': {'type': 'object', '$description': 'translations.json#/div_aspect', 'properties': {'ratio': {'$ref': 'common.json#/positive_number', '$description': 'translations.json#/div_aspect_ratio'}}, 'required': ['ratio'], '$schema': 'http://json-schema.org/draft-07/schema'}}}], 'required': ['type', 'items'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_container_json__definitions_separator(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'show_at_start': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_between': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_at_end': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['style']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['style']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'show_at_start': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_between': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'show_at_end': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'style': {'anyOf': [{'$ref': 'div-shape-drawable.json', '$description': 'translations.json#/div_shape_drawable'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'margins': {'type': 'object', '$description': 'translations.json#/div_edge_insets', 'properties': {'left': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_left'}, 'right': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_right'}, 'top': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_top'}, 'bottom': {'$ref': 'common.json#/non_negative_integer', 'default_value': '0', '$description': 'translations.json#/div_edge_insets_bottom'}, 'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_start', 'platforms': []}, 'end': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_edge_insets_end', 'platforms': []}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['style']}, rule='required') + data_keys = set(data.keys()) + if "show_at_start" in data_keys: + data_keys.remove("show_at_start") + data__showatstart = data["show_at_start"] + validate_common_json__boolean_int(data__showatstart, custom_formats, (name_prefix or "data") + ".show_at_start") + if "show_between" in data_keys: + data_keys.remove("show_between") + data__showbetween = data["show_between"] + validate_common_json__boolean_int(data__showbetween, custom_formats, (name_prefix or "data") + ".show_between") + if "show_at_end" in data_keys: + data_keys.remove("show_at_end") + data__showatend = data["show_at_end"] + validate_common_json__boolean_int(data__showatend, custom_formats, (name_prefix or "data") + ".show_at_end") + if "style" in data_keys: + data_keys.remove("style") + data__style = data["style"] + validate_div_drawable_json(data__style, custom_formats, (name_prefix or "data") + ".style") + if "margins" in data_keys: + data_keys.remove("margins") + data__margins = data["margins"] + validate_div_edge_insets_json(data__margins, custom_formats, (name_prefix or "data") + ".margins") + return data + +def validate_div_content_alignment_horizontal_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['left', 'center', 'right', 'start', 'end', 'space-between', 'space-around', 'space-evenly']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['left', 'center', 'right', 'start', 'end', 'space-between', 'space-around', 'space-evenly']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_content_alignment_vertical_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['top', 'center', 'bottom', 'baseline', 'space-between', 'space-around', 'space-evenly']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['top', 'center', 'bottom', 'baseline', 'space-between', 'space-around', 'space-evenly']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline', 'space-between', 'space-around', 'space-evenly'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_separator_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'properties': {'delimiter_style': {'type': 'object', 'properties': {'color': {'$ref': 'common.json#/color', 'default_value': '#14000000', '$description': 'translations.json#/div_separator_style_color'}, 'orientation': {'type': 'string', 'enum': ['vertical', 'horizontal'], 'default_value': 'horizontal', '$description': 'translations.json#/div_separator_style_orientation'}}}, 'type': {'type': 'string', 'enum': ['separator']}}, 'required': ['type']}, rule='required') + data_keys = set(data.keys()) + if "delimiter_style" in data_keys: + data_keys.remove("delimiter_style") + data__delimiterstyle = data["delimiter_style"] + validate_div_separator_json__definitions_style(data__delimiterstyle, custom_formats, (name_prefix or "data") + ".delimiter_style") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['separator']}, rule='type') + if data__type not in ['separator']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['separator']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['separator']}, rule='enum') + return data + +def validate_div_separator_json__definitions_style(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'color': {'type': 'string', 'format': 'color'}, 'orientation': {'type': 'string', 'enum': ['vertical', 'horizontal'], 'default_value': 'horizontal', '$description': 'translations.json#/div_separator_style_orientation'}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "color" in data_keys: + data_keys.remove("color") + data__color = data["color"] + validate_common_json__color(data__color, custom_formats, (name_prefix or "data") + ".color") + if "orientation" in data_keys: + data_keys.remove("orientation") + data__orientation = data["orientation"] + if not isinstance(data__orientation, (str)): + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be string", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'enum': ['vertical', 'horizontal'], 'default_value': 'horizontal', '$description': 'translations.json#/div_separator_style_orientation'}, rule='type') + if data__orientation not in ['vertical', 'horizontal']: + if not (isinstance(data__orientation, str) and '@' in data__orientation): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".orientation must be one of ['vertical', 'horizontal']", value=data__orientation, name="" + (name_prefix or "data") + ".orientation", definition={'type': 'string', 'enum': ['vertical', 'horizontal'], 'default_value': 'horizontal', '$description': 'translations.json#/div_separator_style_orientation'}, rule='enum') + return data + +def validate_div_text_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['text']}, rule='type') + if data__type not in ['text']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['text']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['text']}, rule='enum') + if "font_size" in data_keys: + data_keys.remove("font_size") + data__fontsize = data["font_size"] + validate_common_json__non_negative_integer(data__fontsize, custom_formats, (name_prefix or "data") + ".font_size") + if "font_family" in data_keys: + data_keys.remove("font_family") + data__fontfamily = data["font_family"] + validate_common_json__non_empty_string(data__fontfamily, custom_formats, (name_prefix or "data") + ".font_family") + if "font_size_unit" in data_keys: + data_keys.remove("font_size_unit") + data__fontsizeunit = data["font_size_unit"] + validate_div_size_unit_json(data__fontsizeunit, custom_formats, (name_prefix or "data") + ".font_size_unit") + if "line_height" in data_keys: + data_keys.remove("line_height") + data__lineheight = data["line_height"] + validate_common_json__non_negative_integer(data__lineheight, custom_formats, (name_prefix or "data") + ".line_height") + if "max_lines" in data_keys: + data_keys.remove("max_lines") + data__maxlines = data["max_lines"] + validate_common_json__non_negative_integer(data__maxlines, custom_formats, (name_prefix or "data") + ".max_lines") + if "min_hidden_lines" in data_keys: + data_keys.remove("min_hidden_lines") + data__minhiddenlines = data["min_hidden_lines"] + validate_common_json__non_negative_integer(data__minhiddenlines, custom_formats, (name_prefix or "data") + ".min_hidden_lines") + if "auto_ellipsize" in data_keys: + data_keys.remove("auto_ellipsize") + data__autoellipsize = data["auto_ellipsize"] + validate_common_json__boolean_int(data__autoellipsize, custom_formats, (name_prefix or "data") + ".auto_ellipsize") + if "letter_spacing" in data_keys: + data_keys.remove("letter_spacing") + data__letterspacing = data["letter_spacing"] + if not isinstance(data__letterspacing, (int, float, Decimal)) or isinstance(data__letterspacing, bool): + if not (isinstance(data__letterspacing, str) and '@' in data__letterspacing): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".letter_spacing must be number", value=data__letterspacing, name="" + (name_prefix or "data") + ".letter_spacing", definition={'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_text_letter_spacing'}, rule='type') + if "font_weight" in data_keys: + data_keys.remove("font_weight") + data__fontweight = data["font_weight"] + validate_div_font_weight_json(data__fontweight, custom_formats, (name_prefix or "data") + ".font_weight") + if "text_alignment_horizontal" in data_keys: + data_keys.remove("text_alignment_horizontal") + data__textalignmenthorizontal = data["text_alignment_horizontal"] + validate_div_alignment_horizontal_json(data__textalignmenthorizontal, custom_formats, (name_prefix or "data") + ".text_alignment_horizontal") + if "text_alignment_vertical" in data_keys: + data_keys.remove("text_alignment_vertical") + data__textalignmentvertical = data["text_alignment_vertical"] + validate_div_alignment_vertical_json(data__textalignmentvertical, custom_formats, (name_prefix or "data") + ".text_alignment_vertical") + if "text_color" in data_keys: + data_keys.remove("text_color") + data__textcolor = data["text_color"] + validate_common_json__color(data__textcolor, custom_formats, (name_prefix or "data") + ".text_color") + if "focused_text_color" in data_keys: + data_keys.remove("focused_text_color") + data__focusedtextcolor = data["focused_text_color"] + validate_common_json__color(data__focusedtextcolor, custom_formats, (name_prefix or "data") + ".focused_text_color") + if "text_gradient" in data_keys: + data_keys.remove("text_gradient") + data__textgradient = data["text_gradient"] + validate_div_text_gradient_json(data__textgradient, custom_formats, (name_prefix or "data") + ".text_gradient") + if "text" in data_keys: + data_keys.remove("text") + data__text = data["text"] + validate_common_json__non_empty_string(data__text, custom_formats, (name_prefix or "data") + ".text") + if "underline" in data_keys: + data_keys.remove("underline") + data__underline = data["underline"] + validate_div_line_style_json(data__underline, custom_formats, (name_prefix or "data") + ".underline") + if "strike" in data_keys: + data_keys.remove("strike") + data__strike = data["strike"] + validate_div_line_style_json(data__strike, custom_formats, (name_prefix or "data") + ".strike") + if "ranges" in data_keys: + data_keys.remove("ranges") + data__ranges = data["ranges"] + if not isinstance(data__ranges, (list, tuple)): + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must be array", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ranges'}, rule='type') + data__ranges_is_list = isinstance(data__ranges, (list, tuple)) + if data__ranges_is_list: + data__ranges_len = len(data__ranges) + if data__ranges_len < 1: + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must contain at least 1 items", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ranges'}, rule='minItems') + for data__ranges_x, data__ranges_item in enumerate(data__ranges): + validate_div_text_json__definitions_range(data__ranges_item, custom_formats, (name_prefix or "data") + ".ranges[{data__ranges_x}]".format(**locals())) + if "images" in data_keys: + data_keys.remove("images") + data__images = data["images"] + if not isinstance(data__images, (list, tuple)): + if not (isinstance(data__images, str) and '@' in data__images): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".images must be array", value=data__images, name="" + (name_prefix or "data") + ".images", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_images'}, rule='type') + data__images_is_list = isinstance(data__images, (list, tuple)) + if data__images_is_list: + data__images_len = len(data__images) + if data__images_len < 1: + if not (isinstance(data__images, str) and '@' in data__images): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".images must contain at least 1 items", value=data__images, name="" + (name_prefix or "data") + ".images", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_images'}, rule='minItems') + for data__images_x, data__images_item in enumerate(data__images): + validate_div_text_json__definitions_image(data__images_item, custom_formats, (name_prefix or "data") + ".images[{data__images_x}]".format(**locals())) + if "ellipsis" in data_keys: + data_keys.remove("ellipsis") + data__ellipsis = data["ellipsis"] + validate_div_text_json__definitions_ellipsis(data__ellipsis, custom_formats, (name_prefix or "data") + ".ellipsis") + if "selectable" in data_keys: + data_keys.remove("selectable") + data__selectable = data["selectable"] + validate_common_json__boolean_int(data__selectable, custom_formats, (name_prefix or "data") + ".selectable") + if "truncate" in data_keys: + data_keys.remove("truncate") + data__truncate = data["truncate"] + if not isinstance(data__truncate, (str)): + if not (isinstance(data__truncate, str) and '@' in data__truncate): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".truncate must be string", value=data__truncate, name="" + (name_prefix or "data") + ".truncate", definition={'type': 'string', 'enum': ['none', 'start', 'end', 'middle'], 'default_value': 'end', '$description': 'translations.json#/div_text_truncate', 'deprecated': True, 'code_generation_disabled_kotlin': True, 'code_generation_disabled_swift': True}, rule='type') + if data__truncate not in ['none', 'start', 'end', 'middle']: + if not (isinstance(data__truncate, str) and '@' in data__truncate): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".truncate must be one of ['none', 'start', 'end', 'middle']", value=data__truncate, name="" + (name_prefix or "data") + ".truncate", definition={'type': 'string', 'enum': ['none', 'start', 'end', 'middle'], 'default_value': 'end', '$description': 'translations.json#/div_text_truncate', 'deprecated': True, 'code_generation_disabled_kotlin': True, 'code_generation_disabled_swift': True}, rule='enum') + if "text_shadow" in data_keys: + data_keys.remove("text_shadow") + data__textshadow = data["text_shadow"] + validate_div_shadow_json(data__textshadow, custom_formats, (name_prefix or "data") + ".text_shadow") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['type', 'text']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_text', 'codegen': {'divan': {'forced_properties_order': ['text']}}, 'definitions': {'range': {'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'end': {'type': 'integer', 'constraint': 'number > 0'}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'underline': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'strike': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'top_offset': {'type': 'integer', 'constraint': 'number >= 0'}, 'border': {'type': 'object', '$description': 'translations.json#/div_text_range_border', 'properties': {'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_border_stroke'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_border_corner_radius'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'background': {'anyOf': [{'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_shadow': {'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shadow_color', 'default_value': '#000000'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_shadow_offset'}, 'blur': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_shadow_blur', 'default_value': '2'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'image': {'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'url': {'type': 'string', 'format': 'uri'}, 'width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'height': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'tint_color': {'type': 'string', 'format': 'color'}, 'tint_mode': {'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'ellipsis': {'type': 'object', 'properties': {'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, 'ranges': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, 'images': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}}, 'required': ['text'], '$description': 'translations.json#/div_text_ellipsis', 'platforms': ['android', 'ios']}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_actionable_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, 'longtap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, 'doubletap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, 'action_animation': {'$ref': 'div-animation.json', 'default_value': '{"name": "fade", "start_value": 1, "end_value": 0.6, "duration": 100 }', '$description': 'translations.json#/div_actionable_action_animation'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'type': {'type': 'string', 'enum': ['text']}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'max_lines': {'type': 'integer', 'constraint': 'number >= 0'}, 'min_hidden_lines': {'type': 'integer', 'constraint': 'number >= 0'}, 'auto_ellipsize': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'letter_spacing': {'type': 'number', 'default_value': '0', '$description': 'translations.json#/div_text_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_alignment_horizontal': {'type': 'string', 'enum': ['left', 'center', 'right', 'start', 'end'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_alignment_vertical': {'type': 'string', 'enum': ['top', 'center', 'bottom', 'baseline'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'focused_text_color': {'type': 'string', 'format': 'color'}, 'text_gradient': {'anyOf': [{'$ref': 'div-linear-gradient.json', '$description': 'translations.json#/div_gradient_linear'}, {'$ref': 'div-radial-gradient.json', '$description': 'translations.json#/div_gradient_radial'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'underline': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'strike': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'ranges': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ranges'}, 'images': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_images'}, 'ellipsis': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_text_ellipsis_text'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, 'ranges': {'type': 'array', 'items': {'$ref': '#/definitions/range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, 'images': {'type': 'array', 'items': {'$ref': '#/definitions/image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}}, 'required': ['text'], '$description': 'translations.json#/div_text_ellipsis', 'platforms': ['android', 'ios']}, 'selectable': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'truncate': {'type': 'string', 'enum': ['none', 'start', 'end', 'middle'], 'default_value': 'end', '$description': 'translations.json#/div_text_truncate', 'deprecated': True, 'code_generation_disabled_kotlin': True, 'code_generation_disabled_swift': True}, 'text_shadow': {'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shadow_color', 'default_value': '#000000'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_shadow_offset'}, 'blur': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_shadow_blur', 'default_value': '2'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}}}], 'required': ['type', 'text'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_text_json__definitions_ellipsis(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, 'ranges': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, 'images': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}}, 'required': ['text'], '$description': 'translations.json#/div_text_ellipsis', 'platforms': ['android', 'ios']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['text']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'text': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, 'ranges': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, 'images': {'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}}, 'required': ['text'], '$description': 'translations.json#/div_text_ellipsis', 'platforms': ['android', 'ios']}, rule='required') + data_keys = set(data.keys()) + if "text" in data_keys: + data_keys.remove("text") + data__text = data["text"] + validate_common_json__non_empty_string(data__text, custom_formats, (name_prefix or "data") + ".text") + if "actions" in data_keys: + data_keys.remove("actions") + data__actions = data["actions"] + if not isinstance(data__actions, (list, tuple)): + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must be array", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, rule='type') + data__actions_is_list = isinstance(data__actions, (list, tuple)) + if data__actions_is_list: + data__actions_len = len(data__actions) + if data__actions_len < 1: + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must contain at least 1 items", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_actions'}, rule='minItems') + for data__actions_x, data__actions_item in enumerate(data__actions): + validate_div_action_json(data__actions_item, custom_formats, (name_prefix or "data") + ".actions[{data__actions_x}]".format(**locals())) + if "ranges" in data_keys: + data_keys.remove("ranges") + data__ranges = data["ranges"] + if not isinstance(data__ranges, (list, tuple)): + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must be array", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, rule='type') + data__ranges_is_list = isinstance(data__ranges, (list, tuple)) + if data__ranges_is_list: + data__ranges_len = len(data__ranges) + if data__ranges_len < 1: + if not (isinstance(data__ranges, str) and '@' in data__ranges): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ranges must contain at least 1 items", value=data__ranges, name="" + (name_prefix or "data") + ".ranges", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_start'}, 'end': {'$ref': 'common.json#/positive_integer', '$description': 'translations.json#/div_text_range_end'}, 'font_size': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_font_size'}, 'font_family': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_font_family'}, 'font_size_unit': {'$ref': 'div-size-unit.json', 'default_value': 'sp', '$description': 'translations.json#/div_font_size_unit', 'platforms': ['android', 'ios']}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'$ref': 'div-font-weight.json', '$description': 'translations.json#/div_font_weight'}, 'text_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_color'}, 'underline': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_underline'}, 'strike': {'$ref': 'div-line-style.json', '$description': 'translations.json#/div_text_range_strike'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_line_height'}, 'top_offset': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_range_top_offset'}, 'border': {'$ref': 'div-text-range-border.json', '$description': 'translations.json#/div_text_range_border'}, 'background': {'$ref': 'div-text-range-background.json', '$description': 'translations.json#/div_text_range_background'}, 'text_shadow': {'$ref': 'div-shadow.json', '$description': 'translations.json#/div_text_range_shadow', 'platforms': ['android']}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_ranges'}, rule='minItems') + for data__ranges_x, data__ranges_item in enumerate(data__ranges): + validate_div_text_json__definitions_range(data__ranges_item, custom_formats, (name_prefix or "data") + ".ranges[{data__ranges_x}]".format(**locals())) + if "images" in data_keys: + data_keys.remove("images") + data__images = data["images"] + if not isinstance(data__images, (list, tuple)): + if not (isinstance(data__images, str) and '@' in data__images): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".images must be array", value=data__images, name="" + (name_prefix or "data") + ".images", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}, rule='type') + data__images_is_list = isinstance(data__images, (list, tuple)) + if data__images_is_list: + data__images_len = len(data__images) + if data__images_len < 1: + if not (isinstance(data__images, str) and '@' in data__images): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".images must contain at least 1 items", value=data__images, name="" + (name_prefix or "data") + ".images", definition={'type': 'array', 'items': {'type': 'object', 'properties': {'start': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_text_image_start'}, 'url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_text_image_url'}, 'width': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_width'}, 'height': {'$ref': 'div-fixed-size.json', 'default_value': '{"type": "fixed","value":20}', '$description': 'translations.json#/div_text_image_height'}, 'tint_color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_text_image_tint_color'}, 'tint_mode': {'$ref': 'div-blend-mode.json', 'default_value': 'source_in', '$description': 'translations.json#/div_text_image_tint_mode', 'platforms': ['android', 'web']}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, 'minItems': 1, '$description': 'translations.json#/div_text_ellipsis_images'}, rule='minItems') + for data__images_x, data__images_item in enumerate(data__images): + validate_div_text_json__definitions_image(data__images_item, custom_formats, (name_prefix or "data") + ".images[{data__images_x}]".format(**locals())) + return data + +def validate_div_text_json__definitions_image(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'url': {'type': 'string', 'format': 'uri'}, 'width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'height': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'tint_color': {'type': 'string', 'format': 'color'}, 'tint_mode': {'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['url', 'start']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'url': {'type': 'string', 'format': 'uri'}, 'width': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'height': {'type': 'object', '$description': 'translations.json#/div_fixed_size', 'codegen': {'divan': {'forced_properties_order': ['value']}}, 'properties': {'value': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_fixed_size_value'}, 'unit': {'$ref': 'div-size-unit.json', '$description': 'translations.json#/div_fixed_size_unit', 'default_value': 'dp'}, 'type': {'type': 'string', 'enum': ['fixed']}}, 'required': ['value', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'tint_color': {'type': 'string', 'format': 'color'}, 'tint_mode': {'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['url', 'start'], '$description': 'translations.json#/div_text_image'}, rule='required') + data_keys = set(data.keys()) + if "start" in data_keys: + data_keys.remove("start") + data__start = data["start"] + validate_common_json__non_negative_integer(data__start, custom_formats, (name_prefix or "data") + ".start") + if "url" in data_keys: + data_keys.remove("url") + data__url = data["url"] + validate_common_json__url(data__url, custom_formats, (name_prefix or "data") + ".url") + if "width" in data_keys: + data_keys.remove("width") + data__width = data["width"] + validate_div_fixed_size_json(data__width, custom_formats, (name_prefix or "data") + ".width") + if "height" in data_keys: + data_keys.remove("height") + data__height = data["height"] + validate_div_fixed_size_json(data__height, custom_formats, (name_prefix or "data") + ".height") + if "tint_color" in data_keys: + data_keys.remove("tint_color") + data__tintcolor = data["tint_color"] + validate_common_json__color(data__tintcolor, custom_formats, (name_prefix or "data") + ".tint_color") + if "tint_mode" in data_keys: + data_keys.remove("tint_mode") + data__tintmode = data["tint_mode"] + validate_div_blend_mode_json(data__tintmode, custom_formats, (name_prefix or "data") + ".tint_mode") + return data + +def validate_div_blend_mode_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_text_json__definitions_range(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'end': {'type': 'integer', 'constraint': 'number > 0'}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'underline': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'strike': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'top_offset': {'type': 'integer', 'constraint': 'number >= 0'}, 'border': {'type': 'object', '$description': 'translations.json#/div_text_range_border', 'properties': {'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_border_stroke'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_border_corner_radius'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'background': {'anyOf': [{'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_shadow': {'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shadow_color', 'default_value': '#000000'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_shadow_offset'}, 'blur': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_shadow_blur', 'default_value': '2'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['start', 'end']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', 'properties': {'start': {'type': 'integer', 'constraint': 'number >= 0'}, 'end': {'type': 'integer', 'constraint': 'number > 0'}, 'font_size': {'type': 'integer', 'constraint': 'number >= 0'}, 'font_family': {'type': 'string', 'minLength': 1, 'clientMinLength': 1}, 'font_size_unit': {'type': 'string', 'enum': ['dp', 'sp', 'px'], '$description': 'translations.json#/div_size_unit', 'platforms': ['android', 'ios'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'letter_spacing': {'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, 'font_weight': {'type': 'string', 'enum': ['light', 'medium', 'regular', 'bold'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_color': {'type': 'string', 'format': 'color'}, 'underline': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'strike': {'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'actions': {'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, 'line_height': {'type': 'integer', 'constraint': 'number >= 0'}, 'top_offset': {'type': 'integer', 'constraint': 'number >= 0'}, 'border': {'type': 'object', '$description': 'translations.json#/div_text_range_border', 'properties': {'stroke': {'$ref': 'div-stroke.json', '$description': 'translations.json#/div_border_stroke'}, 'corner_radius': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_border_corner_radius'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, 'background': {'anyOf': [{'$ref': 'div-solid-background.json', '$description': 'translations.json#/div_background_solid'}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'text_shadow': {'type': 'object', '$description': 'translations.json#/div_shadow', 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_shadow_color', 'default_value': '#000000'}, 'offset': {'$ref': 'div-point.json', '$description': 'translations.json#/div_shadow_offset'}, 'blur': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_shadow_blur', 'default_value': '2'}, 'alpha': {'type': 'number', 'default_value': '0.19', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_shadow_alpha'}}, 'required': ['offset'], '$schema': 'http://json-schema.org/draft-07/schema'}}, 'required': ['start', 'end'], '$description': 'translations.json#/div_text_range'}, rule='required') + data_keys = set(data.keys()) + if "start" in data_keys: + data_keys.remove("start") + data__start = data["start"] + validate_common_json__non_negative_integer(data__start, custom_formats, (name_prefix or "data") + ".start") + if "end" in data_keys: + data_keys.remove("end") + data__end = data["end"] + validate_common_json__positive_integer(data__end, custom_formats, (name_prefix or "data") + ".end") + if "font_size" in data_keys: + data_keys.remove("font_size") + data__fontsize = data["font_size"] + validate_common_json__non_negative_integer(data__fontsize, custom_formats, (name_prefix or "data") + ".font_size") + if "font_family" in data_keys: + data_keys.remove("font_family") + data__fontfamily = data["font_family"] + validate_common_json__non_empty_string(data__fontfamily, custom_formats, (name_prefix or "data") + ".font_family") + if "font_size_unit" in data_keys: + data_keys.remove("font_size_unit") + data__fontsizeunit = data["font_size_unit"] + validate_div_size_unit_json(data__fontsizeunit, custom_formats, (name_prefix or "data") + ".font_size_unit") + if "letter_spacing" in data_keys: + data_keys.remove("letter_spacing") + data__letterspacing = data["letter_spacing"] + if not isinstance(data__letterspacing, (int, float, Decimal)) or isinstance(data__letterspacing, bool): + if not (isinstance(data__letterspacing, str) and '@' in data__letterspacing): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".letter_spacing must be number", value=data__letterspacing, name="" + (name_prefix or "data") + ".letter_spacing", definition={'type': 'number', '$description': 'translations.json#/div_text_range_letter_spacing'}, rule='type') + if "font_weight" in data_keys: + data_keys.remove("font_weight") + data__fontweight = data["font_weight"] + validate_div_font_weight_json(data__fontweight, custom_formats, (name_prefix or "data") + ".font_weight") + if "text_color" in data_keys: + data_keys.remove("text_color") + data__textcolor = data["text_color"] + validate_common_json__color(data__textcolor, custom_formats, (name_prefix or "data") + ".text_color") + if "underline" in data_keys: + data_keys.remove("underline") + data__underline = data["underline"] + validate_div_line_style_json(data__underline, custom_formats, (name_prefix or "data") + ".underline") + if "strike" in data_keys: + data_keys.remove("strike") + data__strike = data["strike"] + validate_div_line_style_json(data__strike, custom_formats, (name_prefix or "data") + ".strike") + if "actions" in data_keys: + data_keys.remove("actions") + data__actions = data["actions"] + if not isinstance(data__actions, (list, tuple)): + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must be array", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, rule='type') + data__actions_is_list = isinstance(data__actions, (list, tuple)) + if data__actions_is_list: + data__actions_len = len(data__actions) + if data__actions_len < 1: + if not (isinstance(data__actions, str) and '@' in data__actions): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".actions must contain at least 1 items", value=data__actions, name="" + (name_prefix or "data") + ".actions", definition={'type': 'array', 'items': {'definitions': {'menu_item': {'type': 'object', 'properties': {'text': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_action_menu_item_text'}, 'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_action_menu_item_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_action_menu_item_actions'}}, 'required': ['text']}}, 'allOf': [{'$ref': 'div-action-base.json'}, {'type': 'object', '$description': 'translations.json#/div_action', 'properties': {'menu_items': {'type': 'array', 'items': {'$ref': '#/definitions/menu_item'}, '$description': 'translations.json#/div_action_menu_items', 'platforms': ['android', 'ios']}, 'log_url': {'$ref': 'common.json#/url', '$description': 'translations.json#/div_action_log_url'}, 'target': {'type': 'string', 'enum': ['_self', '_blank'], 'force_enum_field': True, '$description': 'translations.json#/div_action_target', 'platforms': ['web'], 'code_generation_disabled_swift': True}}, 'required': ['log_id']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_text_range_actions'}, rule='minItems') + for data__actions_x, data__actions_item in enumerate(data__actions): + validate_div_action_json(data__actions_item, custom_formats, (name_prefix or "data") + ".actions[{data__actions_x}]".format(**locals())) + if "line_height" in data_keys: + data_keys.remove("line_height") + data__lineheight = data["line_height"] + validate_common_json__non_negative_integer(data__lineheight, custom_formats, (name_prefix or "data") + ".line_height") + if "top_offset" in data_keys: + data_keys.remove("top_offset") + data__topoffset = data["top_offset"] + validate_common_json__non_negative_integer(data__topoffset, custom_formats, (name_prefix or "data") + ".top_offset") + if "border" in data_keys: + data_keys.remove("border") + data__border = data["border"] + validate_div_text_range_border_json(data__border, custom_formats, (name_prefix or "data") + ".border") + if "background" in data_keys: + data_keys.remove("background") + data__background = data["background"] + validate_div_text_range_background_json(data__background, custom_formats, (name_prefix or "data") + ".background") + if "text_shadow" in data_keys: + data_keys.remove("text_shadow") + data__textshadow = data["text_shadow"] + validate_div_shadow_json(data__textshadow, custom_formats, (name_prefix or "data") + ".text_shadow") + return data + +def validate_div_text_range_background_json(data, custom_formats={}, name_prefix=None): + data_any_of_count21 = 0 + if not data_any_of_count21: + try: + validate_div_solid_background_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count21 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count21: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_solid_background', 'codegen': {'divan': {'forced_properties_order': ['color']}}, 'properties': {'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_solid_background_color'}, 'type': {'type': 'string', 'enum': ['solid']}}, 'required': ['color', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_text_range_border_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'object', '$description': 'translations.json#/div_text_range_border', 'properties': {'stroke': {'type': 'object', '$description': 'translations.json#/div_stroke', 'properties': {'width': {'$ref': 'common.json#/non_negative_integer', 'default_value': '1', '$description': 'translations.json#/div_stroke_width'}, 'color': {'$ref': 'common.json#/color', '$description': 'translations.json#/div_stroke_color'}, 'unit': {'$ref': 'div-size-unit.json', 'default_value': 'dp'}}, 'required': ['color'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'corner_radius': {'type': 'integer', 'constraint': 'number >= 0'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "stroke" in data_keys: + data_keys.remove("stroke") + data__stroke = data["stroke"] + validate_div_stroke_json(data__stroke, custom_formats, (name_prefix or "data") + ".stroke") + if "corner_radius" in data_keys: + data_keys.remove("corner_radius") + data__cornerradius = data["corner_radius"] + validate_common_json__non_negative_integer(data__cornerradius, custom_formats, (name_prefix or "data") + ".corner_radius") + return data + +def validate_div_line_style_json(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='type') + if data not in ['none', 'single']: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be one of ['none', 'single']", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', '$description': 'translations.json#/div_line_style', 'enum': ['none', 'single'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='enum') + return data + +def validate_div_text_gradient_json(data, custom_formats={}, name_prefix=None): + data_any_of_count22 = 0 + if not data_any_of_count22: + try: + validate_div_linear_gradient_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count22 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count22: + try: + validate_div_radial_gradient_json(data, custom_formats, (name_prefix or "data") + "") + data_any_of_count22 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count22: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'anyOf': [{'type': 'object', '$description': 'translations.json#/div_gradient_linear', 'properties': {'colors': {'type': 'array', 'items': {'$ref': 'common.json#/color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'angle': {'type': 'integer', 'constraint': 'number >= 0 && number <= 360', 'default_value': '0', '$description': 'translations.json#/div_gradient_linear_angle'}, 'type': {'type': 'string', 'enum': ['gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, {'type': 'object', '$description': 'translations.json#/div_gradient_radial', 'properties': {'colors': {'type': 'array', 'items': {'$ref': 'common.json#/color'}, 'minItems': 2, '$description': 'translations.json#/div_gradient_colors'}, 'radius': {'$ref': 'div-radial-gradient-radius.json', 'default_value': '{"type": "relative", "value": "farthest_corner" }', '$description': 'translations.json#/div_gradient_radial_radius'}, 'center_x': {'$ref': 'div-radial-gradient-center.json', 'default_value': '{"type": "relative", "value": 0.5 }', '$description': 'translations.json#/div_gradient_radial_center_x'}, 'center_y': {'$ref': 'div-radial-gradient-center.json', 'default_value': '{"type": "relative", "value": 0.5 }', '$description': 'translations.json#/div_gradient_radial_center_y'}, 'type': {'type': 'string', 'enum': ['radial_gradient']}}, 'required': ['colors', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='anyOf') + return data + +def validate_div_gif_image_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_image_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "gif_url" in data_keys: + data_keys.remove("gif_url") + data__gifurl = data["gif_url"] + validate_common_json__url(data__gifurl, custom_formats, (name_prefix or "data") + ".gif_url") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gif']}, rule='type') + if data__type not in ['gif']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['gif']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['gif']}, rule='enum') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['gif_url', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_gif_image', 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_actionable_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, 'longtap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, 'doubletap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, 'action_animation': {'$ref': 'div-animation.json', 'default_value': '{"name": "fade", "start_value": 1, "end_value": 0.6, "duration": 100 }', '$description': 'translations.json#/div_actionable_action_animation'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'placeholder_color': {'$ref': 'common.json#/color', 'default_value': '#14000000', '$description': 'translations.json#/div_image_base_placeholder_color'}, 'scale': {'$ref': 'div-image-scale.json', 'default_value': 'fill', '$description': 'translations.json#/div_image_base_scale'}, 'content_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'center', '$description': 'translations.json#/div_image_base_content_alignment_vertical'}, 'content_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'center', '$description': 'translations.json#/div_image_base_content_alignment_horizontal'}, 'preview': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_image_base_preview'}, 'preload_required': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_image_base_preload_required', 'platforms': ['android']}, 'aspect': {'$ref': 'div-aspect.json', '$description': 'translations.json#/div_aspect'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'gif_url': {'type': 'string', 'format': 'uri'}, 'type': {'type': 'string', 'enum': ['gif']}}}], 'required': ['gif_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data + +def validate_div_image_base_json(data, custom_formats={}, name_prefix=None): + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "placeholder_color" in data_keys: + data_keys.remove("placeholder_color") + data__placeholdercolor = data["placeholder_color"] + validate_common_json__color(data__placeholdercolor, custom_formats, (name_prefix or "data") + ".placeholder_color") + if "scale" in data_keys: + data_keys.remove("scale") + data__scale = data["scale"] + validate_div_image_scale_json(data__scale, custom_formats, (name_prefix or "data") + ".scale") + if "content_alignment_vertical" in data_keys: + data_keys.remove("content_alignment_vertical") + data__contentalignmentvertical = data["content_alignment_vertical"] + validate_div_alignment_vertical_json(data__contentalignmentvertical, custom_formats, (name_prefix or "data") + ".content_alignment_vertical") + if "content_alignment_horizontal" in data_keys: + data_keys.remove("content_alignment_horizontal") + data__contentalignmenthorizontal = data["content_alignment_horizontal"] + validate_div_alignment_horizontal_json(data__contentalignmenthorizontal, custom_formats, (name_prefix or "data") + ".content_alignment_horizontal") + if "preview" in data_keys: + data_keys.remove("preview") + data__preview = data["preview"] + validate_common_json__non_empty_string(data__preview, custom_formats, (name_prefix or "data") + ".preview") + if "preload_required" in data_keys: + data_keys.remove("preload_required") + data__preloadrequired = data["preload_required"] + validate_common_json__boolean_int(data__preloadrequired, custom_formats, (name_prefix or "data") + ".preload_required") + if "aspect" in data_keys: + data_keys.remove("aspect") + data__aspect = data["aspect"] + validate_div_aspect_json(data__aspect, custom_formats, (name_prefix or "data") + ".aspect") + return data + +def validate_div_image_json(data, custom_formats={}, name_prefix=None): + validate_div_base_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_actionable_json(data, custom_formats, (name_prefix or "data") + "") + validate_div_image_base_json(data, custom_formats, (name_prefix or "data") + "") + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "image_url" in data_keys: + data_keys.remove("image_url") + data__imageurl = data["image_url"] + validate_common_json__url(data__imageurl, custom_formats, (name_prefix or "data") + ".image_url") + if "high_priority_preview_show" in data_keys: + data_keys.remove("high_priority_preview_show") + data__highprioritypreviewshow = data["high_priority_preview_show"] + validate_common_json__boolean_int(data__highprioritypreviewshow, custom_formats, (name_prefix or "data") + ".high_priority_preview_show") + if "type" in data_keys: + data_keys.remove("type") + data__type = data["type"] + if not isinstance(data__type, (str)): + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be string", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['image']}, rule='type') + if data__type not in ['image']: + if not (isinstance(data__type, str) and '@' in data__type): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".type must be one of ['image']", value=data__type, name="" + (name_prefix or "data") + ".type", definition={'type': 'string', 'enum': ['image']}, rule='enum') + if "tint_mode" in data_keys: + data_keys.remove("tint_mode") + data__tintmode = data["tint_mode"] + validate_div_blend_mode_json(data__tintmode, custom_formats, (name_prefix or "data") + ".tint_mode") + if "tint_color" in data_keys: + data_keys.remove("tint_color") + data__tintcolor = data["tint_color"] + validate_common_json__color(data__tintcolor, custom_formats, (name_prefix or "data") + ".tint_color") + if "appearance_animation" in data_keys: + data_keys.remove("appearance_animation") + data__appearanceanimation = data["appearance_animation"] + validate_div_fade_transition_json(data__appearanceanimation, custom_formats, (name_prefix or "data") + ".appearance_animation") + if "filters" in data_keys: + data_keys.remove("filters") + data__filters = data["filters"] + if not isinstance(data__filters, (list, tuple)): + if not (isinstance(data__filters, str) and '@' in data__filters): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".filters must be array", value=data__filters, name="" + (name_prefix or "data") + ".filters", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, rule='type') + data__filters_is_list = isinstance(data__filters, (list, tuple)) + if data__filters_is_list: + data__filters_len = len(data__filters) + if data__filters_len < 1: + if not (isinstance(data__filters, str) and '@' in data__filters): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".filters must contain at least 1 items", value=data__filters, name="" + (name_prefix or "data") + ".filters", definition={'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}, rule='minItems') + for data__filters_x, data__filters_item in enumerate(data__filters): + validate_div_filter_json(data__filters_item, custom_formats, (name_prefix or "data") + ".filters[{data__filters_x}]".format(**locals())) + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['image_url', 'type']) - data.keys() + if data__missing_keys: + if not (isinstance(data, str) and '@' in data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'java_extends': 'DivBlockWithId', '$description': 'translations.json#/div_image', 'codegen': {'divan': {'forced_properties_order': ['image_url']}}, 'allOf': [{'protocol_name': 'div-base', 'codegen': {'swift': {'super_protocol': 'DivBlockModeling'}, 'documentation': {'include_in_toc': True}}, 'type': 'object', 'properties': {'id': {'$ref': 'common.json#/non_empty_string', 'supports_expressions': False, '$description': 'translations.json#/div_base_id'}, 'border': {'$ref': 'div-border.json', '$description': 'translations.json#/div_base_border'}, 'width': {'$ref': 'div-size.json', 'default_value': '{"type": "match_parent"}', '$description': 'translations.json#/div_base_width'}, 'height': {'$ref': 'div-size.json', 'default_value': '{"type": "wrap_content"}', '$description': 'translations.json#/div_base_height'}, 'background': {'type': 'array', 'items': {'$ref': 'div-background.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_background'}, 'paddings': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_paddings'}, 'margins': {'$ref': 'div-edge-insets.json', '$description': 'translations.json#/div_base_margins'}, 'alpha': {'type': 'number', 'default_value': '1.0', 'constraint': 'number >= 0.0 && number <= 1.0', '$description': 'translations.json#/div_base_alpha'}, 'alignment_vertical': {'$ref': 'div-alignment-vertical.json', '$description': 'translations.json#/div_base_alignment_vertical'}, 'alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', '$description': 'translations.json#/div_base_alignment_horizontal'}, 'row_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_row_span'}, 'column_span': {'$ref': 'common.json#/non_negative_integer', '$description': 'translations.json#/div_base_column_span'}, 'visibility_action': {'$ref': 'div-visibility-action.json', '$description': 'translations.json#/div_base_visibility_action'}, 'visibility_actions': {'type': 'array', 'items': {'$ref': 'div-visibility-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_visibility_actions'}, 'disappear_actions': {'type': 'array', 'items': {'$ref': 'div-disappear-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_disappear_actions'}, 'tooltips': {'type': 'array', 'items': {'$ref': 'div-tooltip.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_tooltips'}, 'accessibility': {'$ref': 'div-accessibility.json', '$description': 'translations.json#/div_base_accessibility'}, 'extensions': {'type': 'array', 'items': {'$ref': 'div-extension.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_extensions'}, 'transition_triggers': {'type': 'array', 'items': {'$ref': 'div-transition-trigger.json'}, 'minItems': 1, 'supports_expressions': False, '$description': 'translations.json#/div_base_transition_triggers'}, 'transition_in': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_in'}, 'transition_change': {'$ref': 'div-change-transition.json', '$description': 'translations.json#/div_base_transition_change'}, 'transition_out': {'$ref': 'div-appearance-transition.json', '$description': 'translations.json#/div_base_transition_out'}, 'selected_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_base_selected_actions'}, 'focus': {'$ref': 'div-focus.json', '$description': 'translations.json#/div_base_focus', 'platforms': ['android', 'ios']}, 'visibility': {'$ref': 'div-visibility.json', '$description': 'translations.json#/div_base_visibility', 'default_value': 'visible'}, 'transform': {'$ref': 'div-transform.json', '$description': 'translations.json#/div_base_transform'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'action': {'$ref': 'div-action.json', '$description': 'translations.json#/div_actionable_action'}, 'actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_actions'}, 'longtap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_longtap_actions'}, 'doubletap_actions': {'type': 'array', 'items': {'$ref': 'div-action.json'}, 'minItems': 1, '$description': 'translations.json#/div_actionable_doubletap_actions'}, 'action_animation': {'$ref': 'div-animation.json', 'default_value': '{"name": "fade", "start_value": 1, "end_value": 0.6, "duration": 100 }', '$description': 'translations.json#/div_actionable_action_animation'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'placeholder_color': {'$ref': 'common.json#/color', 'default_value': '#14000000', '$description': 'translations.json#/div_image_base_placeholder_color'}, 'scale': {'$ref': 'div-image-scale.json', 'default_value': 'fill', '$description': 'translations.json#/div_image_base_scale'}, 'content_alignment_vertical': {'$ref': 'div-alignment-vertical.json', 'default_value': 'center', '$description': 'translations.json#/div_image_base_content_alignment_vertical'}, 'content_alignment_horizontal': {'$ref': 'div-alignment-horizontal.json', 'default_value': 'center', '$description': 'translations.json#/div_image_base_content_alignment_horizontal'}, 'preview': {'$ref': 'common.json#/non_empty_string', '$description': 'translations.json#/div_image_base_preview'}, 'preload_required': {'$ref': 'common.json#/boolean_int', 'default_value': 'false', '$description': 'translations.json#/div_image_base_preload_required', 'platforms': ['android']}, 'aspect': {'$ref': 'div-aspect.json', '$description': 'translations.json#/div_aspect'}}, '$schema': 'http://json-schema.org/draft-07/schema'}, {'properties': {'image_url': {'type': 'string', 'format': 'uri'}, 'high_priority_preview_show': {'oneOf': [{'type': 'boolean'}, {'type': 'integer', 'enum': [0, 1]}]}, 'type': {'type': 'string', 'enum': ['image']}, 'tint_mode': {'type': 'string', 'enum': ['source_in', 'source_atop', 'darken', 'lighten', 'multiply', 'screen'], '$description': 'translations.json#/div_blend_mode', '$schema': 'http://json-schema.org/draft-07/schema'}, 'tint_color': {'type': 'string', 'format': 'color'}, 'appearance_animation': {'$description': 'translations.json#/div_fade_transition', 'allOf': [{'$ref': 'div-transition-base.json'}, {'properties': {'type': {'type': 'string', 'enum': ['fade']}, 'alpha': {'type': 'number', 'constraint': 'number >= 0.0 && number <= 1.0', 'default_value': '0.0', '$description': 'translations.json#/div_fade_transition_alpha'}}}], 'required': ['type'], '$schema': 'http://json-schema.org/draft-07/schema'}, 'filters': {'type': 'array', 'items': {'anyOf': [{'$ref': 'div-blur.json', '$description': 'translations.json#/div_filter'}, {'$ref': 'div-filter-rtl-mirror.json', '$description': 'translations.json#/div_filter_rtl_mirror', 'platforms': ['android']}], '$schema': 'http://json-schema.org/draft-07/schema'}, 'minItems': 1, '$description': 'translations.json#/div_filter'}}}], 'required': ['image_url', 'type'], '$schema': 'http://json-schema.org/draft-07/schema'}, rule='required') + return data diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml new file mode 100644 index 0000000..290b2b4 --- /dev/null +++ b/tests/docker-compose.yaml @@ -0,0 +1,4 @@ +services: + app: + volumes: + - hostPath:containerPath:ro diff --git a/tests/events.json b/tests/events.json new file mode 100644 index 0000000..2ced7fe --- /dev/null +++ b/tests/events.json @@ -0,0 +1,1942 @@ +[ + { + "id": "28603779002", + "type": "PushEvent", + "actor": { + "id": 57717366, + "login": "b3n3w", + "display_login": "b3n3w", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?" + }, + "repo": { + "id": 623054782, + "name": "b3n3w/chefcook-gpt", + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt" + }, + "payload": { + "repository_id": 623054782, + "push_id": 13397386499, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "6e3ab603711cacd27a6f430ddfad7ca6cb5401d1", + "before": "fc41ed6422c729a12a23dec6dce1bf07859b9dbc", + "commits": [ + { + "sha": "6e3ab603711cacd27a6f430ddfad7ca6cb5401d1", + "author": { + "email": "57717366+b3n3w@users.noreply.github.com", + "name": "b3n3w" + }, + "message": "Feature/introduce timeslider (#11)\n\n* add time section to generating page\r\n\r\n* generate recipe based on given time\r\n\r\n--- STYLING ----\r\n\r\n* fix padding of settings for smaller screens\r\n\r\n* show translate only if recipe has different language\r\n\r\n---------\r\n\r\nCo-authored-by: Benedikt Wagner ", + "distinct": true, + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt/commits/6e3ab603711cacd27a6f430ddfad7ca6cb5401d1" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778992", + "type": "PushEvent", + "actor": { + "id": 111665653, + "login": "SRIHITAKOTT1213", + "display_login": "SRIHITAKOTT1213", + "gravatar_id": "", + "url": "https://api.github.com/users/SRIHITAKOTT1213", + "avatar_url": "https://avatars.githubusercontent.com/u/111665653?" + }, + "repo": { + "id": 618171649, + "name": "SRIHITAKOTT1213/DVASS", + "url": "https://api.github.com/repos/SRIHITAKOTT1213/DVASS" + }, + "payload": { + "repository_id": 618171649, + "push_id": 13397386495, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/gh-pages", + "head": "e9728aee47c687319f740e6d64317d0aff44c637", + "before": "c141f7a4ac6cd4d96b2d4a0f3e6b05e05e439630", + "commits": [ + { + "sha": "e9728aee47c687319f740e6d64317d0aff44c637", + "author": { + "email": "vivianknee@users.noreply.github.com", + "name": "vivianknee" + }, + "message": "deploy: 2b60c8e6f05c30e9a0926908f9fe50c859402d71", + "distinct": true, + "url": "https://api.github.com/repos/SRIHITAKOTT1213/DVASS/commits/e9728aee47c687319f740e6d64317d0aff44c637" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778994", + "type": "PushEvent", + "actor": { + "id": 67547924, + "login": "ivan-zhirnov", + "display_login": "ivan-zhirnov", + "gravatar_id": "", + "url": "https://api.github.com/users/ivan-zhirnov", + "avatar_url": "https://avatars.githubusercontent.com/u/67547924?" + }, + "repo": { + "id": 629654566, + "name": "ivan-zhirnov/document_repository", + "url": "https://api.github.com/repos/ivan-zhirnov/document_repository" + }, + "payload": { + "repository_id": 629654566, + "push_id": 13397386488, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "8cb1cd64a8a90445813f3cdf9a281a7181bcdb20", + "before": "428bd9f840b4c64ed3ce0fdea1b70dfcc9abeb3f", + "commits": [ + { + "sha": "8cb1cd64a8a90445813f3cdf9a281a7181bcdb20", + "author": { + "email": "ivan.zhirnov@fleetcor.ru", + "name": "Ivan.Zhirnov" + }, + "message": "fix documents", + "distinct": true, + "url": "https://api.github.com/repos/ivan-zhirnov/document_repository/commits/8cb1cd64a8a90445813f3cdf9a281a7181bcdb20" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778985", + "type": "PushEvent", + "actor": { + "id": 75749677, + "login": "PotatoesSkill", + "display_login": "PotatoesSkill", + "gravatar_id": "", + "url": "https://api.github.com/users/PotatoesSkill", + "avatar_url": "https://avatars.githubusercontent.com/u/75749677?" + }, + "repo": { + "id": 605828707, + "name": "PotatoesSkill/2", + "url": "https://api.github.com/repos/PotatoesSkill/2" + }, + "payload": { + "repository_id": 605828707, + "push_id": 13397386472, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "cbe66f000b860175d0650b63b599768551b7e207", + "before": "d7f4d9c1cc4355ce3136bd6640254a99cc8c8993", + "commits": [ + { + "sha": "cbe66f000b860175d0650b63b599768551b7e207", + "author": { + "email": "75749677+PotatoesSkill@users.noreply.github.com", + "name": "PotatoesSkill" + }, + "message": "a", + "distinct": true, + "url": "https://api.github.com/repos/PotatoesSkill/2/commits/cbe66f000b860175d0650b63b599768551b7e207" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778999", + "type": "CreateEvent", + "actor": { + "id": 48808846, + "login": "joaom00", + "display_login": "joaom00", + "gravatar_id": "", + "url": "https://api.github.com/users/joaom00", + "avatar_url": "https://avatars.githubusercontent.com/u/48808846?" + }, + "repo": { + "id": 631668474, + "name": "joaom00/cmdk-pages", + "url": "https://api.github.com/repos/joaom00/cmdk-pages" + }, + "payload": { + "ref": null, + "ref_type": "repository", + "master_branch": "main", + "description": null, + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778996", + "type": "CreateEvent", + "actor": { + "id": 75343200, + "login": "Madfoxc2000", + "display_login": "Madfoxc2000", + "gravatar_id": "", + "url": "https://api.github.com/users/Madfoxc2000", + "avatar_url": "https://avatars.githubusercontent.com/u/75343200?" + }, + "repo": { + "id": 631668471, + "name": "Madfoxc2000/hello-world", + "url": "https://api.github.com/repos/Madfoxc2000/hello-world" + }, + "payload": { + "ref": "main", + "ref_type": "branch", + "master_branch": "main", + "description": "Git hub practice", + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603779005", + "type": "CreateEvent", + "actor": { + "id": 104024599, + "login": "CarlosMario-Pro", + "display_login": "CarlosMario-Pro", + "gravatar_id": "", + "url": "https://api.github.com/users/CarlosMario-Pro", + "avatar_url": "https://avatars.githubusercontent.com/u/104024599?" + }, + "repo": { + "id": 631663042, + "name": "CarlosMario-Pro/Mailchimp-App-Nest-JS", + "url": "https://api.github.com/repos/CarlosMario-Pro/Mailchimp-App-Nest-JS" + }, + "payload": { + "ref": "feature/MultiContactCreate-component", + "ref_type": "branch", + "master_branch": "master", + "description": null, + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778988", + "type": "PushEvent", + "actor": { + "id": 99473012, + "login": "Aristex12", + "display_login": "Aristex12", + "gravatar_id": "", + "url": "https://api.github.com/users/Aristex12", + "avatar_url": "https://avatars.githubusercontent.com/u/99473012?" + }, + "repo": { + "id": 621691753, + "name": "Aristex12/ProyectoIntegrador", + "url": "https://api.github.com/repos/Aristex12/ProyectoIntegrador" + }, + "payload": { + "repository_id": 621691753, + "push_id": 13397386476, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "f260a4cc2cd4f5492c1ff36671aff63ca254dba0", + "before": "bcf08e0cccf0cdfb4185a6bf8664d4dc07719262", + "commits": [ + { + "sha": "f260a4cc2cd4f5492c1ff36671aff63ca254dba0", + "author": { + "email": "99473012+Aristex12@users.noreply.github.com", + "name": "Aris Maximilian Kuhs" + }, + "message": "Create info.md", + "distinct": true, + "url": "https://api.github.com/repos/Aristex12/ProyectoIntegrador/commits/f260a4cc2cd4f5492c1ff36671aff63ca254dba0" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778987", + "type": "PushEvent", + "actor": { + "id": 47701536, + "login": "saattrupdan", + "display_login": "saattrupdan", + "gravatar_id": "", + "url": "https://api.github.com/users/saattrupdan", + "avatar_url": "https://avatars.githubusercontent.com/u/47701536?" + }, + "repo": { + "id": 251078964, + "name": "saattrupdan/doubt", + "url": "https://api.github.com/repos/saattrupdan/doubt" + }, + "payload": { + "repository_id": 251078964, + "push_id": 13397386470, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "62a07686b6937da32ee4f1419212197a859a99cb", + "before": "8002d58065ea6038d881dc15547034f7ec7dd343", + "commits": [ + { + "sha": "62a07686b6937da32ee4f1419212197a859a99cb", + "author": { + "email": "dan.nielsen@alexandra.dk", + "name": "Dan Saattrup Nielsen" + }, + "message": "feat: v4.4.1", + "distinct": true, + "url": "https://api.github.com/repos/saattrupdan/doubt/commits/62a07686b6937da32ee4f1419212197a859a99cb" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778973", + "type": "WatchEvent", + "actor": { + "id": 170023, + "login": "DannyNemer", + "display_login": "DannyNemer", + "gravatar_id": "", + "url": "https://api.github.com/users/DannyNemer", + "avatar_url": "https://avatars.githubusercontent.com/u/170023?" + }, + "repo": { + "id": 43056951, + "name": "graphql-python/graphene", + "url": "https://api.github.com/repos/graphql-python/graphene" + }, + "payload": { + "action": "started" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z", + "org": { + "id": 15002022, + "login": "graphql-python", + "gravatar_id": "", + "url": "https://api.github.com/orgs/graphql-python", + "avatar_url": "https://avatars.githubusercontent.com/u/15002022?" + } + }, + { + "id": "28603778980", + "type": "PushEvent", + "actor": { + "id": 37334813, + "login": "ThreeDP", + "display_login": "ThreeDP", + "gravatar_id": "", + "url": "https://api.github.com/users/ThreeDP", + "avatar_url": "https://avatars.githubusercontent.com/u/37334813?" + }, + "repo": { + "id": 616731852, + "name": "ThreeDP/minishelly", + "url": "https://api.github.com/repos/ThreeDP/minishelly" + }, + "payload": { + "repository_id": 616731852, + "push_id": 13397386482, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/master", + "head": "644d28ed81608016710735b356779011b0f64219", + "before": "03b2c40bd43cc0a993403141d3deeb7d3d974611", + "commits": [ + { + "sha": "644d28ed81608016710735b356779011b0f64219", + "author": { + "email": "davy.paulino@aluno.ifsp.edu.br", + "name": "threedp" + }, + "message": "BUILD; test workflows", + "distinct": true, + "url": "https://api.github.com/repos/ThreeDP/minishelly/commits/644d28ed81608016710735b356779011b0f64219" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778967", + "type": "PushEvent", + "actor": { + "id": 129284328, + "login": "ilkiinz", + "display_login": "ilkiinz", + "gravatar_id": "", + "url": "https://api.github.com/users/ilkiinz", + "avatar_url": "https://avatars.githubusercontent.com/u/129284328?" + }, + "repo": { + "id": 625887201, + "name": "ilkiinz/Layout", + "url": "https://api.github.com/repos/ilkiinz/Layout" + }, + "payload": { + "repository_id": 625887201, + "push_id": 13397386465, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "8c8392936dc5d457b1b6ce412d4d3e5c11a9af29", + "before": "5a55323612723aec1cae64d0709faa683324c732", + "commits": [ + { + "sha": "8c8392936dc5d457b1b6ce412d4d3e5c11a9af29", + "author": { + "email": "aqayev2205@gmail.com", + "name": "ilkiinz" + }, + "message": "change", + "distinct": true, + "url": "https://api.github.com/repos/ilkiinz/Layout/commits/8c8392936dc5d457b1b6ce412d4d3e5c11a9af29" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778976", + "type": "PushEvent", + "actor": { + "id": 91396657, + "login": "Bl1tzz18", + "display_login": "Bl1tzz18", + "gravatar_id": "", + "url": "https://api.github.com/users/Bl1tzz18", + "avatar_url": "https://avatars.githubusercontent.com/u/91396657?" + }, + "repo": { + "id": 566989912, + "name": "Bl1tzz18/ToDo_Posts", + "url": "https://api.github.com/repos/Bl1tzz18/ToDo_Posts" + }, + "payload": { + "repository_id": 566989912, + "push_id": 13397386481, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/master", + "head": "559ce750b1370467ee3f525e81215abd7e8b8a03", + "before": "823dd8495851b087bf20b654bd524834c1d9cf9a", + "commits": [ + { + "sha": "559ce750b1370467ee3f525e81215abd7e8b8a03", + "author": { + "email": "91396657+Bl1tzz18@users.noreply.github.com", + "name": "Bl1tzz18" + }, + "message": "ci/cd update", + "distinct": true, + "url": "https://api.github.com/repos/Bl1tzz18/ToDo_Posts/commits/559ce750b1370467ee3f525e81215abd7e8b8a03" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778960", + "type": "IssuesEvent", + "actor": { + "id": 127578501, + "login": "xy666666896", + "display_login": "xy666666896", + "gravatar_id": "", + "url": "https://api.github.com/users/xy666666896", + "avatar_url": "https://avatars.githubusercontent.com/u/127578501?" + }, + "repo": { + "id": 305007237, + "name": "leo424y/heysiri.ml", + "url": "https://api.github.com/repos/leo424y/heysiri.ml" + }, + "payload": { + "action": "opened", + "issue": { + "url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789", + "repository_url": "https://api.github.com/repos/leo424y/heysiri.ml", + "labels_url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789/labels{/name}", + "comments_url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789/comments", + "events_url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789/events", + "html_url": "https://github.com/leo424y/heysiri.ml/issues/307789", + "id": 1680124432, + "node_id": "I_kwDOEi4Khc5kJKoQ", + "number": 307789, + "title": "第一财经《快三可以每天盈利赚钱技巧》搜狗百科", + "user": { + "login": "xy666666896", + "id": 127578501, + "node_id": "U_kgDOB5qxhQ", + "avatar_url": "https://avatars.githubusercontent.com/u/127578501?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xy666666896", + "html_url": "https://github.com/xy666666896", + "followers_url": "https://api.github.com/users/xy666666896/followers", + "following_url": "https://api.github.com/users/xy666666896/following{/other_user}", + "gists_url": "https://api.github.com/users/xy666666896/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xy666666896/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xy666666896/subscriptions", + "organizations_url": "https://api.github.com/users/xy666666896/orgs", + "repos_url": "https://api.github.com/users/xy666666896/repos", + "events_url": "https://api.github.com/users/xy666666896/events{/privacy}", + "received_events_url": "https://api.github.com/users/xy666666896/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2023-04-23T18:38:42Z", + "updated_at": "2023-04-23T18:38:42Z", + "closed_at": null, + "author_association": "NONE", + "active_lock_reason": null, + "body": "快三可以每天盈利赚钱技巧➕小可Q⎝27888642 ⎠✅網⎝096cs.com ⎠ ✅✅碼77785839✅✅【顶-尖-名-师✅✅丨信.誉.平.台丨✅购财首`选丨一.对.一丨✅全.天.在.线.辅.导】✅✅WSXYZBDO她天生就拥有一双蓝色的双眼,但她却永远无法用它们来好好欣赏这大千世界,她是位天生的盲童。她从出生起便命途坎坷,被亲生父母狠心抛弃在孤儿院,从此便独自一人顽强地对抗这残酷的人世间。所幸,上帝给你关上一扇门,就会同时为你打开一扇窗,一对善良的美国夫妇在网络上了解到这位小女孩的一切,便义无反顾地从地球的另一端千里迢迢地赶到中国,收养了这位可怜的孩子。从此,这个可怜的女孩的人生发生了翻天覆地的转变。生来与众不同,不知是福是祸“物竞天择,适者生存”达尔文提出进化论的时候一定没想到这条定理同样适用于人类。就在2013年的十月,一位不速之客悄然来到这残酷的人世间。这位天生拥有蓝色双眼的小女孩刚刚降临人世,甚至没有张开双眼细细描绘父母的长相,便被自己的亲生父母舍弃在了福利院。蓝眼睛本该是西方人得天独厚的长相,如今却出现在一个中国小女孩身上,这原本甚至可以被称作“上天的杰作”,“黑头发,蓝眼睛,这听起来简直像是上帝身边小天使的模样。然而,上帝往往会把自己最喜欢的search 苹果留下一块深刻的印记。天意弄人,这位小女孩不仅眼睛大小不一,而且是位天生的盲童。", + "reactions": { + "url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/leo424y/heysiri.ml/issues/307789/timeline", + "performed_via_github_app": null, + "state_reason": null + } + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778971", + "type": "PullRequestEvent", + "actor": { + "id": 57717366, + "login": "b3n3w", + "display_login": "b3n3w", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?" + }, + "repo": { + "id": 623054782, + "name": "b3n3w/chefcook-gpt", + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt" + }, + "payload": { + "action": "closed", + "number": 11, + "pull_request": { + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11", + "id": 1324450937, + "node_id": "PR_kwDOJSMPvs5O8YR5", + "html_url": "https://github.com/b3n3w/chefcook-gpt/pull/11", + "diff_url": "https://github.com/b3n3w/chefcook-gpt/pull/11.diff", + "patch_url": "https://github.com/b3n3w/chefcook-gpt/pull/11.patch", + "issue_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/11", + "number": 11, + "state": "closed", + "locked": false, + "title": "Feature/introduce timeslider", + "user": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2023-04-23T18:38:00Z", + "updated_at": "2023-04-23T18:38:41Z", + "closed_at": "2023-04-23T18:38:41Z", + "merged_at": "2023-04-23T18:38:41Z", + "merge_commit_sha": "6e3ab603711cacd27a6f430ddfad7ca6cb5401d1", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11/commits", + "review_comments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11/comments", + "review_comment_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/11/comments", + "statuses_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/statuses/6a856feabdead245346f05e22ae175a8a86f256a", + "head": { + "label": "b3n3w:feature/introduce-timeslider", + "ref": "feature/introduce-timeslider", + "sha": "6a856feabdead245346f05e22ae175a8a86f256a", + "user": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 623054782, + "node_id": "R_kgDOJSMPvg", + "name": "chefcook-gpt", + "full_name": "b3n3w/chefcook-gpt", + "private": false, + "owner": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/b3n3w/chefcook-gpt", + "description": "Easily generate recipes with help of AI", + "fork": false, + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt", + "forks_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/forks", + "keys_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/teams", + "hooks_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/hooks", + "issue_events_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/events{/number}", + "events_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/events", + "assignees_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/assignees{/user}", + "branches_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/branches{/branch}", + "tags_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/tags", + "blobs_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/statuses/{sha}", + "languages_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/languages", + "stargazers_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/stargazers", + "contributors_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/contributors", + "subscribers_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/subscribers", + "subscription_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/subscription", + "commits_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/contents/{+path}", + "compare_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/merges", + "archive_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/downloads", + "issues_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues{/number}", + "pulls_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls{/number}", + "milestones_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/milestones{/number}", + "notifications_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/labels{/name}", + "releases_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/releases{/id}", + "deployments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/deployments", + "created_at": "2023-04-03T15:48:45Z", + "updated_at": "2023-04-23T16:01:16Z", + "pushed_at": "2023-04-23T18:38:41Z", + "git_url": "git://github.com/b3n3w/chefcook-gpt.git", + "ssh_url": "git@github.com:b3n3w/chefcook-gpt.git", + "clone_url": "https://github.com/b3n3w/chefcook-gpt.git", + "svn_url": "https://github.com/b3n3w/chefcook-gpt", + "homepage": "https://recipes-gpt.xyz", + "size": 18651, + "stargazers_count": 3, + "watchers_count": 3, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "chatgpt", + "openai", + "recipes", + "sveltekit" + ], + "visibility": "public", + "forks": 1, + "open_issues": 2, + "watchers": 3, + "default_branch": "main" + } + }, + "base": { + "label": "b3n3w:main", + "ref": "main", + "sha": "fc41ed6422c729a12a23dec6dce1bf07859b9dbc", + "user": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 623054782, + "node_id": "R_kgDOJSMPvg", + "name": "chefcook-gpt", + "full_name": "b3n3w/chefcook-gpt", + "private": false, + "owner": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/b3n3w/chefcook-gpt", + "description": "Easily generate recipes with help of AI", + "fork": false, + "url": "https://api.github.com/repos/b3n3w/chefcook-gpt", + "forks_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/forks", + "keys_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/teams", + "hooks_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/hooks", + "issue_events_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/events{/number}", + "events_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/events", + "assignees_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/assignees{/user}", + "branches_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/branches{/branch}", + "tags_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/tags", + "blobs_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/statuses/{sha}", + "languages_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/languages", + "stargazers_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/stargazers", + "contributors_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/contributors", + "subscribers_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/subscribers", + "subscription_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/subscription", + "commits_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/contents/{+path}", + "compare_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/merges", + "archive_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/downloads", + "issues_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues{/number}", + "pulls_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls{/number}", + "milestones_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/milestones{/number}", + "notifications_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/labels{/name}", + "releases_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/releases{/id}", + "deployments_url": "https://api.github.com/repos/b3n3w/chefcook-gpt/deployments", + "created_at": "2023-04-03T15:48:45Z", + "updated_at": "2023-04-23T16:01:16Z", + "pushed_at": "2023-04-23T18:38:41Z", + "git_url": "git://github.com/b3n3w/chefcook-gpt.git", + "ssh_url": "git@github.com:b3n3w/chefcook-gpt.git", + "clone_url": "https://github.com/b3n3w/chefcook-gpt.git", + "svn_url": "https://github.com/b3n3w/chefcook-gpt", + "homepage": "https://recipes-gpt.xyz", + "size": 18651, + "stargazers_count": 3, + "watchers_count": 3, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "chatgpt", + "openai", + "recipes", + "sveltekit" + ], + "visibility": "public", + "forks": 1, + "open_issues": 2, + "watchers": 3, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11" + }, + "html": { + "href": "https://github.com/b3n3w/chefcook-gpt/pull/11" + }, + "issue": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/11" + }, + "comments": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/issues/11/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/pulls/11/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/b3n3w/chefcook-gpt/statuses/6a856feabdead245346f05e22ae175a8a86f256a" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": true, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": { + "login": "b3n3w", + "id": 57717366, + "node_id": "MDQ6VXNlcjU3NzE3MzY2", + "avatar_url": "https://avatars.githubusercontent.com/u/57717366?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/b3n3w", + "html_url": "https://github.com/b3n3w", + "followers_url": "https://api.github.com/users/b3n3w/followers", + "following_url": "https://api.github.com/users/b3n3w/following{/other_user}", + "gists_url": "https://api.github.com/users/b3n3w/gists{/gist_id}", + "starred_url": "https://api.github.com/users/b3n3w/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/b3n3w/subscriptions", + "organizations_url": "https://api.github.com/users/b3n3w/orgs", + "repos_url": "https://api.github.com/users/b3n3w/repos", + "events_url": "https://api.github.com/users/b3n3w/events{/privacy}", + "received_events_url": "https://api.github.com/users/b3n3w/received_events", + "type": "User", + "site_admin": false + }, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 4, + "additions": 152, + "deletions": 88, + "changed_files": 16 + } + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778975", + "type": "CreateEvent", + "actor": { + "id": 640645, + "login": "naftalysh", + "display_login": "naftalysh", + "gravatar_id": "", + "url": "https://api.github.com/users/naftalysh", + "avatar_url": "https://avatars.githubusercontent.com/u/640645?" + }, + "repo": { + "id": 631668472, + "name": "naftalysh-org/load1-0005-app-EywcU-view-comment", + "url": "https://api.github.com/repos/naftalysh-org/load1-0005-app-EywcU-view-comment" + }, + "payload": { + "ref": null, + "ref_type": "repository", + "master_branch": "main", + "description": "GitOps Repository", + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z", + "org": { + "id": 129733508, + "login": "naftalysh-org", + "gravatar_id": "", + "url": "https://api.github.com/orgs/naftalysh-org", + "avatar_url": "https://avatars.githubusercontent.com/u/129733508?" + } + }, + { + "id": "28603778977", + "type": "PushEvent", + "actor": { + "id": 110963025, + "login": "SCKagura", + "display_login": "SCKagura", + "gravatar_id": "", + "url": "https://api.github.com/users/SCKagura", + "avatar_url": "https://avatars.githubusercontent.com/u/110963025?" + }, + "repo": { + "id": 622599960, + "name": "SCKagura/Html-CSS-Practice", + "url": "https://api.github.com/repos/SCKagura/Html-CSS-Practice" + }, + "payload": { + "repository_id": 622599960, + "push_id": 13397386474, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "b78f7769cb3e5b955f2f259ba5584d8406f91568", + "before": "7144026415d3f1b59673a4d8bcffb82fe1454e00", + "commits": [ + { + "sha": "b78f7769cb3e5b955f2f259ba5584d8406f91568", + "author": { + "email": "=", + "name": "SCKboss" + }, + "message": "จบ grid", + "distinct": true, + "url": "https://api.github.com/repos/SCKagura/Html-CSS-Practice/commits/b78f7769cb3e5b955f2f259ba5584d8406f91568" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778972", + "type": "DeleteEvent", + "actor": { + "id": 11362913, + "login": "ptrkstr", + "display_login": "ptrkstr", + "gravatar_id": "", + "url": "https://api.github.com/users/ptrkstr", + "avatar_url": "https://avatars.githubusercontent.com/u/11362913?" + }, + "repo": { + "id": 452207687, + "name": "ptrkstr/fastlane", + "url": "https://api.github.com/repos/ptrkstr/fastlane" + }, + "payload": { + "ref": "swift-optionality", + "ref_type": "branch", + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778974", + "type": "ReleaseEvent", + "actor": { + "id": 113355330, + "login": "GabrielMuscedere", + "display_login": "GabrielMuscedere", + "gravatar_id": "", + "url": "https://api.github.com/users/GabrielMuscedere", + "avatar_url": "https://avatars.githubusercontent.com/u/113355330?" + }, + "repo": { + "id": 622198820, + "name": "GabrielMuscedere/2023-HOMEWORK-577592", + "url": "https://api.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592" + }, + "payload": { + "action": "published", + "release": { + "url": "https://api.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592/releases/100571999", + "assets_url": "https://api.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592/releases/100571999/assets", + "upload_url": "https://uploads.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592/releases/100571999/assets{?name,label}", + "html_url": "https://github.com/GabrielMuscedere/2023-HOMEWORK-577592/releases/tag/v2.0", + "id": 100571999, + "author": { + "login": "GabrielMuscedere", + "id": 113355330, + "node_id": "U_kgDOBsGqQg", + "avatar_url": "https://avatars.githubusercontent.com/u/113355330?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/GabrielMuscedere", + "html_url": "https://github.com/GabrielMuscedere", + "followers_url": "https://api.github.com/users/GabrielMuscedere/followers", + "following_url": "https://api.github.com/users/GabrielMuscedere/following{/other_user}", + "gists_url": "https://api.github.com/users/GabrielMuscedere/gists{/gist_id}", + "starred_url": "https://api.github.com/users/GabrielMuscedere/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/GabrielMuscedere/subscriptions", + "organizations_url": "https://api.github.com/users/GabrielMuscedere/orgs", + "repos_url": "https://api.github.com/users/GabrielMuscedere/repos", + "events_url": "https://api.github.com/users/GabrielMuscedere/events{/privacy}", + "received_events_url": "https://api.github.com/users/GabrielMuscedere/received_events", + "type": "User", + "site_admin": false + }, + "node_id": "RE_kwDOJRYAJM4F_ptf", + "tag_name": "v2.0", + "target_commitish": "main", + "name": "2023-HOMEWORK2 577592", + "draft": false, + "prerelease": false, + "created_at": "2023-04-23T18:35:42Z", + "published_at": "2023-04-23T18:38:42Z", + "assets": [], + "tarball_url": "https://api.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592/tarball/v2.0", + "zipball_url": "https://api.github.com/repos/GabrielMuscedere/2023-HOMEWORK-577592/zipball/v2.0", + "body": "", + "short_description_html": "", + "is_short_description_html_truncated": false + } + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778961", + "type": "PushEvent", + "actor": { + "id": 83094100, + "login": "Dimetry537", + "display_login": "Dimetry537", + "gravatar_id": "", + "url": "https://api.github.com/users/Dimetry537", + "avatar_url": "https://avatars.githubusercontent.com/u/83094100?" + }, + "repo": { + "id": 360995742, + "name": "Dimetry537/Learning-Python", + "url": "https://api.github.com/repos/Dimetry537/Learning-Python" + }, + "payload": { + "repository_id": 360995742, + "push_id": 13397386462, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/tests_for_calc", + "head": "3e138297319419baf759cacab3a90c4688d1de6e", + "before": "df337afc94344228b3ae4d3c6ca6658862752062", + "commits": [ + { + "sha": "3e138297319419baf759cacab3a90c4688d1de6e", + "author": { + "email": "maksakov1988@gmail.com", + "name": "Dimetry537" + }, + "message": "complete tests for calcul polish not", + "distinct": true, + "url": "https://api.github.com/repos/Dimetry537/Learning-Python/commits/3e138297319419baf759cacab3a90c4688d1de6e" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778964", + "type": "CreateEvent", + "actor": { + "id": 58668583, + "login": "Adam-it", + "display_login": "Adam-it", + "gravatar_id": "", + "url": "https://api.github.com/users/Adam-it", + "avatar_url": "https://avatars.githubusercontent.com/u/58668583?" + }, + "repo": { + "id": 533528004, + "name": "Adam-it/pnp-powershell-extension", + "url": "https://api.github.com/repos/Adam-it/pnp-powershell-extension" + }, + "payload": { + "ref": "v2.4.4", + "ref_type": "tag", + "master_branch": "main", + "description": "This extension provides functionalities that may be helpful when creating scripts using PnP PowerShell.", + "pusher_type": "user" + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778940", + "type": "PushEvent", + "actor": { + "id": 98166939, + "login": "noahbarger", + "display_login": "noahbarger", + "gravatar_id": "", + "url": "https://api.github.com/users/noahbarger", + "avatar_url": "https://avatars.githubusercontent.com/u/98166939?" + }, + "repo": { + "id": 590567477, + "name": "mucsci-students/2023sp-420-MediaTek", + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek" + }, + "payload": { + "repository_id": 590567477, + "push_id": 13397386452, + "size": 3, + "distinct_size": 1, + "ref": "refs/heads/codecov-5", + "head": "8ddf08e07bc5d516f73c948ca4b079538c4e95ef", + "before": "4d06f54d06780e5828197f58983089b50119a8a1", + "commits": [ + { + "sha": "87cb725b364ba608be7e94eeb4eef26f756068a6", + "author": { + "email": "122769747+tmhughes1@users.noreply.github.com", + "name": "Tess Hughes" + }, + "message": "Update codecov.yml", + "distinct": false, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/87cb725b364ba608be7e94eeb4eef26f756068a6" + }, + { + "sha": "d446756111000772461a23e84d41b1af7fce83f1", + "author": { + "email": "98166939+noahbarger@users.noreply.github.com", + "name": "noahbarger" + }, + "message": "Merge pull request #334 from mucsci-students/codecov-4\n\nUpdate codecov.yml", + "distinct": false, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/d446756111000772461a23e84d41b1af7fce83f1" + }, + { + "sha": "8ddf08e07bc5d516f73c948ca4b079538c4e95ef", + "author": { + "email": "98166939+noahbarger@users.noreply.github.com", + "name": "noahbarger" + }, + "message": "Merge branch 'develop' into codecov-5", + "distinct": true, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/8ddf08e07bc5d516f73c948ca4b079538c4e95ef" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z", + "org": { + "id": 54920367, + "login": "mucsci-students", + "gravatar_id": "", + "url": "https://api.github.com/orgs/mucsci-students", + "avatar_url": "https://avatars.githubusercontent.com/u/54920367?" + } + }, + { + "id": "28603778942", + "type": "PushEvent", + "actor": { + "id": 117701637, + "login": "sairam030", + "display_login": "sairam030", + "gravatar_id": "", + "url": "https://api.github.com/users/sairam030", + "avatar_url": "https://avatars.githubusercontent.com/u/117701637?" + }, + "repo": { + "id": 630814971, + "name": "sairam030/sairam030", + "url": "https://api.github.com/repos/sairam030/sairam030" + }, + "payload": { + "repository_id": 630814971, + "push_id": 13397386456, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "3942a13eba2b9342a0d5cbe3b93960c58114c703", + "before": "f997469a0240dd54149cc62644999aea6a1c961e", + "commits": [ + { + "sha": "3942a13eba2b9342a0d5cbe3b93960c58114c703", + "author": { + "email": "41898282+github-actions[bot]@users.noreply.github.com", + "name": "readme-bot" + }, + "message": "Updated with Dev Metrics", + "distinct": true, + "url": "https://api.github.com/repos/sairam030/sairam030/commits/3942a13eba2b9342a0d5cbe3b93960c58114c703" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778956", + "type": "PullRequestEvent", + "actor": { + "id": 73205226, + "login": "gi00", + "display_login": "gi00", + "gravatar_id": "", + "url": "https://api.github.com/users/gi00", + "avatar_url": "https://avatars.githubusercontent.com/u/73205226?" + }, + "repo": { + "id": 626176282, + "name": "d4nnym/professional_frnd", + "url": "https://api.github.com/repos/d4nnym/professional_frnd" + }, + "payload": { + "action": "opened", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1", + "id": 1324451096, + "node_id": "PR_kwDOJVKxGs5O8YUY", + "html_url": "https://github.com/d4nnym/professional_frnd/pull/1", + "diff_url": "https://github.com/d4nnym/professional_frnd/pull/1.diff", + "patch_url": "https://github.com/d4nnym/professional_frnd/pull/1.patch", + "issue_url": "https://api.github.com/repos/d4nnym/professional_frnd/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "Seguimos Prueba 5", + "user": { + "login": "gi00", + "id": 73205226, + "node_id": "MDQ6VXNlcjczMjA1MjI2", + "avatar_url": "https://avatars.githubusercontent.com/u/73205226?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gi00", + "html_url": "https://github.com/gi00", + "followers_url": "https://api.github.com/users/gi00/followers", + "following_url": "https://api.github.com/users/gi00/following{/other_user}", + "gists_url": "https://api.github.com/users/gi00/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gi00/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gi00/subscriptions", + "organizations_url": "https://api.github.com/users/gi00/orgs", + "repos_url": "https://api.github.com/users/gi00/repos", + "events_url": "https://api.github.com/users/gi00/events{/privacy}", + "received_events_url": "https://api.github.com/users/gi00/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2023-04-23T18:38:41Z", + "updated_at": "2023-04-23T18:38:41Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/d4nnym/professional_frnd/issues/1/comments", + "statuses_url": "https://api.github.com/repos/d4nnym/professional_frnd/statuses/ddba403d854d8d74785564457756a18d11afb924", + "head": { + "label": "gi00:main", + "ref": "main", + "sha": "ddba403d854d8d74785564457756a18d11afb924", + "user": { + "login": "gi00", + "id": 73205226, + "node_id": "MDQ6VXNlcjczMjA1MjI2", + "avatar_url": "https://avatars.githubusercontent.com/u/73205226?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gi00", + "html_url": "https://github.com/gi00", + "followers_url": "https://api.github.com/users/gi00/followers", + "following_url": "https://api.github.com/users/gi00/following{/other_user}", + "gists_url": "https://api.github.com/users/gi00/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gi00/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gi00/subscriptions", + "organizations_url": "https://api.github.com/users/gi00/orgs", + "repos_url": "https://api.github.com/users/gi00/repos", + "events_url": "https://api.github.com/users/gi00/events{/privacy}", + "received_events_url": "https://api.github.com/users/gi00/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 631039994, + "node_id": "R_kgDOJZzn-g", + "name": "professional_frnd", + "full_name": "gi00/professional_frnd", + "private": false, + "owner": { + "login": "gi00", + "id": 73205226, + "node_id": "MDQ6VXNlcjczMjA1MjI2", + "avatar_url": "https://avatars.githubusercontent.com/u/73205226?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gi00", + "html_url": "https://github.com/gi00", + "followers_url": "https://api.github.com/users/gi00/followers", + "following_url": "https://api.github.com/users/gi00/following{/other_user}", + "gists_url": "https://api.github.com/users/gi00/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gi00/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gi00/subscriptions", + "organizations_url": "https://api.github.com/users/gi00/orgs", + "repos_url": "https://api.github.com/users/gi00/repos", + "events_url": "https://api.github.com/users/gi00/events{/privacy}", + "received_events_url": "https://api.github.com/users/gi00/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gi00/professional_frnd", + "description": "Professional Frontend Server ", + "fork": true, + "url": "https://api.github.com/repos/gi00/professional_frnd", + "forks_url": "https://api.github.com/repos/gi00/professional_frnd/forks", + "keys_url": "https://api.github.com/repos/gi00/professional_frnd/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gi00/professional_frnd/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gi00/professional_frnd/teams", + "hooks_url": "https://api.github.com/repos/gi00/professional_frnd/hooks", + "issue_events_url": "https://api.github.com/repos/gi00/professional_frnd/issues/events{/number}", + "events_url": "https://api.github.com/repos/gi00/professional_frnd/events", + "assignees_url": "https://api.github.com/repos/gi00/professional_frnd/assignees{/user}", + "branches_url": "https://api.github.com/repos/gi00/professional_frnd/branches{/branch}", + "tags_url": "https://api.github.com/repos/gi00/professional_frnd/tags", + "blobs_url": "https://api.github.com/repos/gi00/professional_frnd/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gi00/professional_frnd/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gi00/professional_frnd/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gi00/professional_frnd/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gi00/professional_frnd/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gi00/professional_frnd/languages", + "stargazers_url": "https://api.github.com/repos/gi00/professional_frnd/stargazers", + "contributors_url": "https://api.github.com/repos/gi00/professional_frnd/contributors", + "subscribers_url": "https://api.github.com/repos/gi00/professional_frnd/subscribers", + "subscription_url": "https://api.github.com/repos/gi00/professional_frnd/subscription", + "commits_url": "https://api.github.com/repos/gi00/professional_frnd/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gi00/professional_frnd/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gi00/professional_frnd/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gi00/professional_frnd/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gi00/professional_frnd/contents/{+path}", + "compare_url": "https://api.github.com/repos/gi00/professional_frnd/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gi00/professional_frnd/merges", + "archive_url": "https://api.github.com/repos/gi00/professional_frnd/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gi00/professional_frnd/downloads", + "issues_url": "https://api.github.com/repos/gi00/professional_frnd/issues{/number}", + "pulls_url": "https://api.github.com/repos/gi00/professional_frnd/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gi00/professional_frnd/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gi00/professional_frnd/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gi00/professional_frnd/labels{/name}", + "releases_url": "https://api.github.com/repos/gi00/professional_frnd/releases{/id}", + "deployments_url": "https://api.github.com/repos/gi00/professional_frnd/deployments", + "created_at": "2023-04-21T19:11:46Z", + "updated_at": "2023-04-21T19:32:38Z", + "pushed_at": "2023-04-23T18:32:34Z", + "git_url": "git://github.com/gi00/professional_frnd.git", + "ssh_url": "git@github.com:gi00/professional_frnd.git", + "clone_url": "https://github.com/gi00/professional_frnd.git", + "svn_url": "https://github.com/gi00/professional_frnd", + "homepage": null, + "size": 372, + "stargazers_count": 0, + "watchers_count": 0, + "language": "JavaScript", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + } + }, + "base": { + "label": "d4nnym:main", + "ref": "main", + "sha": "9194d87910ebbbff6e771c12430ad4296766d952", + "user": { + "login": "d4nnym", + "id": 83803328, + "node_id": "MDQ6VXNlcjgzODAzMzI4", + "avatar_url": "https://avatars.githubusercontent.com/u/83803328?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/d4nnym", + "html_url": "https://github.com/d4nnym", + "followers_url": "https://api.github.com/users/d4nnym/followers", + "following_url": "https://api.github.com/users/d4nnym/following{/other_user}", + "gists_url": "https://api.github.com/users/d4nnym/gists{/gist_id}", + "starred_url": "https://api.github.com/users/d4nnym/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/d4nnym/subscriptions", + "organizations_url": "https://api.github.com/users/d4nnym/orgs", + "repos_url": "https://api.github.com/users/d4nnym/repos", + "events_url": "https://api.github.com/users/d4nnym/events{/privacy}", + "received_events_url": "https://api.github.com/users/d4nnym/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 626176282, + "node_id": "R_kgDOJVKxGg", + "name": "professional_frnd", + "full_name": "d4nnym/professional_frnd", + "private": false, + "owner": { + "login": "d4nnym", + "id": 83803328, + "node_id": "MDQ6VXNlcjgzODAzMzI4", + "avatar_url": "https://avatars.githubusercontent.com/u/83803328?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/d4nnym", + "html_url": "https://github.com/d4nnym", + "followers_url": "https://api.github.com/users/d4nnym/followers", + "following_url": "https://api.github.com/users/d4nnym/following{/other_user}", + "gists_url": "https://api.github.com/users/d4nnym/gists{/gist_id}", + "starred_url": "https://api.github.com/users/d4nnym/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/d4nnym/subscriptions", + "organizations_url": "https://api.github.com/users/d4nnym/orgs", + "repos_url": "https://api.github.com/users/d4nnym/repos", + "events_url": "https://api.github.com/users/d4nnym/events{/privacy}", + "received_events_url": "https://api.github.com/users/d4nnym/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/d4nnym/professional_frnd", + "description": "Professional Frontend Server ", + "fork": false, + "url": "https://api.github.com/repos/d4nnym/professional_frnd", + "forks_url": "https://api.github.com/repos/d4nnym/professional_frnd/forks", + "keys_url": "https://api.github.com/repos/d4nnym/professional_frnd/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/d4nnym/professional_frnd/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/d4nnym/professional_frnd/teams", + "hooks_url": "https://api.github.com/repos/d4nnym/professional_frnd/hooks", + "issue_events_url": "https://api.github.com/repos/d4nnym/professional_frnd/issues/events{/number}", + "events_url": "https://api.github.com/repos/d4nnym/professional_frnd/events", + "assignees_url": "https://api.github.com/repos/d4nnym/professional_frnd/assignees{/user}", + "branches_url": "https://api.github.com/repos/d4nnym/professional_frnd/branches{/branch}", + "tags_url": "https://api.github.com/repos/d4nnym/professional_frnd/tags", + "blobs_url": "https://api.github.com/repos/d4nnym/professional_frnd/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/d4nnym/professional_frnd/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/d4nnym/professional_frnd/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/d4nnym/professional_frnd/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/d4nnym/professional_frnd/statuses/{sha}", + "languages_url": "https://api.github.com/repos/d4nnym/professional_frnd/languages", + "stargazers_url": "https://api.github.com/repos/d4nnym/professional_frnd/stargazers", + "contributors_url": "https://api.github.com/repos/d4nnym/professional_frnd/contributors", + "subscribers_url": "https://api.github.com/repos/d4nnym/professional_frnd/subscribers", + "subscription_url": "https://api.github.com/repos/d4nnym/professional_frnd/subscription", + "commits_url": "https://api.github.com/repos/d4nnym/professional_frnd/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/d4nnym/professional_frnd/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/d4nnym/professional_frnd/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/d4nnym/professional_frnd/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/d4nnym/professional_frnd/contents/{+path}", + "compare_url": "https://api.github.com/repos/d4nnym/professional_frnd/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/d4nnym/professional_frnd/merges", + "archive_url": "https://api.github.com/repos/d4nnym/professional_frnd/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/d4nnym/professional_frnd/downloads", + "issues_url": "https://api.github.com/repos/d4nnym/professional_frnd/issues{/number}", + "pulls_url": "https://api.github.com/repos/d4nnym/professional_frnd/pulls{/number}", + "milestones_url": "https://api.github.com/repos/d4nnym/professional_frnd/milestones{/number}", + "notifications_url": "https://api.github.com/repos/d4nnym/professional_frnd/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/d4nnym/professional_frnd/labels{/name}", + "releases_url": "https://api.github.com/repos/d4nnym/professional_frnd/releases{/id}", + "deployments_url": "https://api.github.com/repos/d4nnym/professional_frnd/deployments", + "created_at": "2023-04-11T00:32:49Z", + "updated_at": "2023-04-11T00:32:57Z", + "pushed_at": "2023-04-22T14:11:26Z", + "git_url": "git://github.com/d4nnym/professional_frnd.git", + "ssh_url": "git@github.com:d4nnym/professional_frnd.git", + "clone_url": "https://github.com/d4nnym/professional_frnd.git", + "svn_url": "https://github.com/d4nnym/professional_frnd", + "homepage": null, + "size": 372, + "stargazers_count": 0, + "watchers_count": 0, + "language": "JavaScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 1, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1" + }, + "html": { + "href": "https://github.com/d4nnym/professional_frnd/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/d4nnym/professional_frnd/statuses/ddba403d854d8d74785564457756a18d11afb924" + } + }, + "author_association": "NONE", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": true, + "commits": 1, + "additions": 275, + "deletions": 26, + "changed_files": 6 + } + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778947", + "type": "PushEvent", + "actor": { + "id": 41898282, + "login": "github-actions[bot]", + "display_login": "github-actions", + "gravatar_id": "", + "url": "https://api.github.com/users/github-actions[bot]", + "avatar_url": "https://avatars.githubusercontent.com/u/41898282?" + }, + "repo": { + "id": 627760438, + "name": "Joanna-Jasinska/Filmoteka", + "url": "https://api.github.com/repos/Joanna-Jasinska/Filmoteka" + }, + "payload": { + "repository_id": 627760438, + "push_id": 13397386453, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/gh-pages", + "head": "d91410df2664825697244a83e4d4de60a3e04ec1", + "before": "6a7348611abfae948490540544740f276e66e78e", + "commits": [ + { + "sha": "d91410df2664825697244a83e4d4de60a3e04ec1", + "author": { + "email": "111195576+Joanna-Jasinska@users.noreply.github.com", + "name": "Joanna-Jasinska" + }, + "message": "Deploying to gh-pages from @ Joanna-Jasinska/Filmoteka@fc4748e8aedd4e8e6a9e51e8fabe23a9495d0ac0 🚀", + "distinct": true, + "url": "https://api.github.com/repos/Joanna-Jasinska/Filmoteka/commits/d91410df2664825697244a83e4d4de60a3e04ec1" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778937", + "type": "PushEvent", + "actor": { + "id": 122472075, + "login": "udaygit123", + "display_login": "udaygit123", + "gravatar_id": "", + "url": "https://api.github.com/users/udaygit123", + "avatar_url": "https://avatars.githubusercontent.com/u/122472075?" + }, + "repo": { + "id": 628699891, + "name": "udaygit123/star-healthcare-project-uday", + "url": "https://api.github.com/repos/udaygit123/star-healthcare-project-uday" + }, + "payload": { + "repository_id": 628699891, + "push_id": 13397386449, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/master", + "head": "a95f49409302879136a8847ad4e32aabf1254753", + "before": "74d5f875633ab7b204afffe37d6762a25ea02dab", + "commits": [ + { + "sha": "a95f49409302879136a8847ad4e32aabf1254753", + "author": { + "email": "122472075+udaygit123@users.noreply.github.com", + "name": "udaygit123" + }, + "message": "Update main.tf", + "distinct": true, + "url": "https://api.github.com/repos/udaygit123/star-healthcare-project-uday/commits/a95f49409302879136a8847ad4e32aabf1254753" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778948", + "type": "PushEvent", + "actor": { + "id": 28780579, + "login": "farajist", + "display_login": "farajist", + "gravatar_id": "", + "url": "https://api.github.com/users/farajist", + "avatar_url": "https://avatars.githubusercontent.com/u/28780579?" + }, + "repo": { + "id": 577359323, + "name": "farajist/farajist.me", + "url": "https://api.github.com/repos/farajist/farajist.me" + }, + "payload": { + "repository_id": 577359323, + "push_id": 13397386450, + "size": 3, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "d6e327f9b6a657ea0e30d0b36c07f188c87a9f91", + "before": "49fdc3c1dceb1d65406a1c999a639eb37d30767d", + "commits": [ + { + "sha": "a3297680a6e49d461a2615239bfd3de961942ba9", + "author": { + "email": "farajist@duck.com", + "name": "farajist" + }, + "message": "BLOG-1: update some opengraph tags", + "distinct": false, + "url": "https://api.github.com/repos/farajist/farajist.me/commits/a3297680a6e49d461a2615239bfd3de961942ba9" + }, + { + "sha": "415a74c8276696705ace9cda53e7a0e1fcc33ee9", + "author": { + "email": "farajist@duck.com", + "name": "farajist" + }, + "message": "BLOG-1: update author image", + "distinct": false, + "url": "https://api.github.com/repos/farajist/farajist.me/commits/415a74c8276696705ace9cda53e7a0e1fcc33ee9" + }, + { + "sha": "d6e327f9b6a657ea0e30d0b36c07f188c87a9f91", + "author": { + "email": "28780579+farajist@users.noreply.github.com", + "name": "Hamza Faraji" + }, + "message": "Merge pull request #3 from farajist/BLOG-1_tags_and_seo\n\nBLOG-1: update some opengraph tags", + "distinct": true, + "url": "https://api.github.com/repos/farajist/farajist.me/commits/d6e327f9b6a657ea0e30d0b36c07f188c87a9f91" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778936", + "type": "PushEvent", + "actor": { + "id": 113960168, + "login": "auanmu", + "display_login": "auanmu", + "gravatar_id": "", + "url": "https://api.github.com/users/auanmu", + "avatar_url": "https://avatars.githubusercontent.com/u/113960168?" + }, + "repo": { + "id": 590567477, + "name": "mucsci-students/2023sp-420-MediaTek", + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek" + }, + "payload": { + "repository_id": 590567477, + "push_id": 13397386457, + "size": 3, + "distinct_size": 1, + "ref": "refs/heads/austintest", + "head": "fa2f30c1ae66fbda835ce3f92d8ed7f8175411e6", + "before": "3ba044f95acddb1a9bdad3dcbd7d335bdebe03ce", + "commits": [ + { + "sha": "87cb725b364ba608be7e94eeb4eef26f756068a6", + "author": { + "email": "122769747+tmhughes1@users.noreply.github.com", + "name": "Tess Hughes" + }, + "message": "Update codecov.yml", + "distinct": false, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/87cb725b364ba608be7e94eeb4eef26f756068a6" + }, + { + "sha": "d446756111000772461a23e84d41b1af7fce83f1", + "author": { + "email": "98166939+noahbarger@users.noreply.github.com", + "name": "noahbarger" + }, + "message": "Merge pull request #334 from mucsci-students/codecov-4\n\nUpdate codecov.yml", + "distinct": false, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/d446756111000772461a23e84d41b1af7fce83f1" + }, + { + "sha": "fa2f30c1ae66fbda835ce3f92d8ed7f8175411e6", + "author": { + "email": "113960168+auanmu@users.noreply.github.com", + "name": "Austin An" + }, + "message": "Merge branch 'develop' into austintest", + "distinct": true, + "url": "https://api.github.com/repos/mucsci-students/2023sp-420-MediaTek/commits/fa2f30c1ae66fbda835ce3f92d8ed7f8175411e6" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z", + "org": { + "id": 54920367, + "login": "mucsci-students", + "gravatar_id": "", + "url": "https://api.github.com/orgs/mucsci-students", + "avatar_url": "https://avatars.githubusercontent.com/u/54920367?" + } + }, + { + "id": "28603778941", + "type": "PushEvent", + "actor": { + "id": 44070647, + "login": "olivierlarose", + "display_login": "olivierlarose", + "gravatar_id": "", + "url": "https://api.github.com/users/olivierlarose", + "avatar_url": "https://avatars.githubusercontent.com/u/44070647?" + }, + "repo": { + "id": 631307324, + "name": "olivierlarose/3d-perspective-text", + "url": "https://api.github.com/repos/olivierlarose/3d-perspective-text" + }, + "payload": { + "repository_id": 631307324, + "push_id": 13397386458, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/main", + "head": "db9ad3c06e73a48fa31dabc9df583a02136fd9d0", + "before": "e5a8ba16a0501fda9b3435e3efcf6769b382f4fa", + "commits": [ + { + "sha": "db9ad3c06e73a48fa31dabc9df583a02136fd9d0", + "author": { + "email": "olivierlarose1@gmail.com", + "name": "Olivier Larose" + }, + "message": "update styling", + "distinct": true, + "url": "https://api.github.com/repos/olivierlarose/3d-perspective-text/commits/db9ad3c06e73a48fa31dabc9df583a02136fd9d0" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + }, + { + "id": "28603778925", + "type": "PushEvent", + "actor": { + "id": 41898282, + "login": "github-actions[bot]", + "display_login": "github-actions", + "gravatar_id": "", + "url": "https://api.github.com/users/github-actions[bot]", + "avatar_url": "https://avatars.githubusercontent.com/u/41898282?" + }, + "repo": { + "id": 429058553, + "name": "lokdil543/gh-action-data-scraping", + "url": "https://api.github.com/repos/lokdil543/gh-action-data-scraping" + }, + "payload": { + "repository_id": 429058553, + "push_id": 13397386442, + "size": 1, + "distinct_size": 1, + "ref": "refs/heads/master", + "head": "85f6603607de681093e0707c7cb06dcf2aae6287", + "before": "765febbb42ca2206f63aa60f75ed3e627269606c", + "commits": [ + { + "sha": "85f6603607de681093e0707c7cb06dcf2aae6287", + "author": { + "email": "actions@users.noreply.github.com", + "name": "Automated Publisher" + }, + "message": "Automated publish: Sun Apr 23 18:38:40 UTC 2023 765febbb42ca2206f63aa60f75ed3e627269606c", + "distinct": true, + "url": "https://api.github.com/repos/lokdil543/gh-action-data-scraping/commits/85f6603607de681093e0707c7cb06dcf2aae6287" + } + ] + }, + "public": true, + "created_at": "2023-04-23T18:38:42Z" + } +] diff --git a/tests/example.http b/tests/example.http new file mode 100644 index 0000000..77167dd --- /dev/null +++ b/tests/example.http @@ -0,0 +1,26 @@ +### +# this is a valid in-place variable syntax +@myhost = httpbin.org + +### +# get ip +GET https://jmarkin.ru/ip + +### +GET https://{{myhost}}/json + +### +GET https://{{myhost}}/uuid + + +### +GET https://{{myhost}}/html + +### +GET ya.ru + + + +### + +GET http://example.com diff --git a/tests/examplealign.txt b/tests/examplealign.txt new file mode 100644 index 0000000..7ce1e75 --- /dev/null +++ b/tests/examplealign.txt @@ -0,0 +1,45 @@ + +Paul McCartney 1942 +George Harrison 1943 +Ringo Starr 1940 +Pete Best 1941 + + + +| Option| Type | Default | Description | +|--|--|--|--| +| threads | Fixnum | 1 | number of threads in the thread pool | +|queues |Fixnum | 1 | number of concurrent queues | +|queue_size | Fixnum | 1000 | size of each queue | +| interval | Numeric | 0 | dispatcher interval for batch processing | +|batch | Boolean | false | enables batch processing mode | + |batch_size | Fixnum | nil | number of maximum items to be assigned at once | + |logger | Logger | nil | logger instance for debug logs | + + + + +a = +a = 1 +bbbb = 2 +ccccccc = 3 +ccccccccccccccc +ddd = 4 +eeee === eee = eee = eee=f +fff = ggg += gg &&= gg +g != hhhhhhhh == 888 +i := 5 +i %= 5 +i *= 5 +j =~ 5 +j >= 5 +aa => 123 +aa <<= 123 +aa >>= 123 +bbb => 123 +c => 1233123 +d => 123 +dddddd &&= 123 +dddddd ||= 123 +dddddd /= 123 +gg <=> ee diff --git a/tests/fib.py b/tests/fib.py new file mode 100644 index 0000000..a3d7648 --- /dev/null +++ b/tests/fib.py @@ -0,0 +1,20 @@ +import os +from time import time + + +def fib(): + a, b = 0, 1 + while True: # First iteration: + yield a # yield 0 to start with and then + a, b = b, a + b # a will now be 1, and b will also be 1, (0 + 1) + + +t = time() +for index, fibonacci_number in zip(range(100), fib()): + ti = time() + print("{i:3}: {f: >21} {t:.3e}".format(i=index, f=fibonacci_number, t=ti - t)) + t = ti + + +# Generate function where print first N of fibonachi numbers using fib function +def print_n_fibonacchi_numbers(n, messag_on_complete: str): diff --git a/tests/html.html b/tests/html.html new file mode 100644 index 0000000..84255be --- /dev/null +++ b/tests/html.html @@ -0,0 +1,16 @@ + + + + + + ss + + + ss +
+
slsl
+
+ + + + diff --git a/tests/inject.html b/tests/inject.html new file mode 100644 index 0000000..b0b719b --- /dev/null +++ b/tests/inject.html @@ -0,0 +1,13 @@ + + + +
+        import numpy
+    
+ diff --git a/tests/inject.py b/tests/inject.py new file mode 100644 index 0000000..437d5d1 --- /dev/null +++ b/tests/inject.py @@ -0,0 +1,45 @@ +import json + + +def word(f: str, g: int): + pass + + +def rst_test(a): + """This should be shown in rst formatting + + Args: + a: The parameter + + Example: + This is how you can use this function: + + + .. code-block:: python + + result = test(3) + print(result) + nestedcss = "color: red" + + The injections are nested by nvim-treesitter + """ + testcss = "background-color: pink" + testhtml = "

very great html

" + testjs = "const x=5" + json.loads('{"s": 1}') + + s_json = '{"s": 1}' + json.loads(s_json) + + text("select * from table") + s.execute("select * from table") + s.read_sql("select *" + " from table") + sa.text("select * from table") + + return [testcss, testhtml, testjs] + + +assert rs + + +print_f diff --git a/tests/ollama.http b/tests/ollama.http new file mode 100644 index 0000000..f0f4eb2 --- /dev/null +++ b/tests/ollama.http @@ -0,0 +1,62 @@ +@ollama = http://192.168.88.15:11434 + +### generate +POST {{ollama}}/api/generate +Content-Type: application/json + +{ + "raw": true, + "prompt": "# language: python indentation: use 4 spaces for a tab <|fim_prefix|>def quicksort(arr):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n <|fim_suffix|>\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quicksort(left) + middle + quicksort(right)<|fim_middle|>", + "model":"hf.co/unsloth/Qwen2.5-Coder-7B-Instruct-128K-GGUF:Q4_K_M", + "stream": false +} + +### openai completion +POST {{ollama}}/v1/chat/completions +Content-Type: application/json + +{ + "think": false, + "messages": [ + { + "role": "system", + "content": "You are Fill in the Middle completion. Respond with only the filled-in code." + }, + { + "role": "user", + "content": "generate 2 completion for next fim code. language python indentation 4 spaces for a tab. separate as separator of completion" + }, + { + "role": "user", + "content": "<|fim_prefix|>def quicksort(arr):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n <|fim_suffix|>\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quicksort(left) + middle + quicksort(right)<|fim_middle|>" + } + ], + "model":"deepseek-r1:8b", + "stream": false +} + + +### openai completion gemma +POST {{ollama}}/v1/chat/completions +Content-Type: application/json + +{ + "raw": true, + "messages": [ + { + "role": "system", + "content": "You are Fill in the Middle completion. Respond with only the filled-in code. Generate 5 different completion separate as separator of completion" + }, + { + "role": "user", + "content": "language python indentation 4 spaces for a tab." + }, + { + "role": "user", + "content": "<|fim_prefix|>def quicksort(arr):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n <|fim_suffix|>\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quicksort(left) + middle + quicksort(right)<|fim_middle|>" + } + ], + "model":"hf.co/unsloth/gemma-3-12b-it-qat-GGUF:Q4_K_M", + "stream": false +} + diff --git a/tests/rust.rs b/tests/rust.rs new file mode 100644 index 0000000..8367ccb --- /dev/null +++ b/tests/rust.rs @@ -0,0 +1,3 @@ +fn main() { + println!("123") +} diff --git a/tests/simple.html.jinja b/tests/simple.html.jinja new file mode 100644 index 0000000..47c2607 --- /dev/null +++ b/tests/simple.html.jinja @@ -0,0 +1,14 @@ + + + + + This is the title + + +

This is a header

+ {% block content %} +

This is the content.

+ {% endblock %} + + + diff --git a/tests/simple.sql b/tests/simple.sql new file mode 100644 index 0000000..2e41e02 --- /dev/null +++ b/tests/simple.sql @@ -0,0 +1,11 @@ +select count(*) from + checks +limit 100; + +select pc.counter from "public".parent_counter pc; + + +select + + + diff --git a/tests/t.js b/tests/t.js new file mode 100644 index 0000000..0f30515 --- /dev/null +++ b/tests/t.js @@ -0,0 +1,5 @@ +const a = 1; + +function test() { + console.log("123"); +} diff --git a/tests/test.xml b/tests/test.xml new file mode 100644 index 0000000..f949326 --- /dev/null +++ b/tests/test.xml @@ -0,0 +1,3 @@ + + + diff --git a/tests/x5airun.http b/tests/x5airun.http new file mode 100644 index 0000000..e69de29