diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..25b6752 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +date = '{{ .Date }}' +draft = true +title = '{{ replace .File.ContentBaseName "-" " " | title }}' ++++ diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..56f31ee --- /dev/null +++ b/content/_index.md @@ -0,0 +1,4 @@ +--- +# title: Home Page +weight: 1 +--- diff --git a/content/courses/_index.md b/content/courses/_index.md new file mode 100644 index 0000000..8c82801 --- /dev/null +++ b/content/courses/_index.md @@ -0,0 +1,7 @@ +--- +# title: Courses +weight: 2 +--- + + diff --git a/content/courses/paradigms/_index.md b/content/courses/paradigms/_index.md new file mode 100644 index 0000000..378be49 --- /dev/null +++ b/content/courses/paradigms/_index.md @@ -0,0 +1,5 @@ +--- +title: Paradgims of Programming +weight: 3 +--- + diff --git a/content/courses/prog-intro/_index.md b/content/courses/prog-intro/_index.md new file mode 100644 index 0000000..9f9f277 --- /dev/null +++ b/content/courses/prog-intro/_index.md @@ -0,0 +1,5 @@ +--- +title: Introduction to Programming in Java +weight: 3 +--- + diff --git a/content/courses/prog-intro/homeworks/_index.md b/content/courses/prog-intro/homeworks/_index.md new file mode 100644 index 0000000..c34f1a7 --- /dev/null +++ b/content/courses/prog-intro/homeworks/_index.md @@ -0,0 +1,4 @@ +--- +title: Homeworks +weight: 4 +--- diff --git a/content/courses/prog-intro/homeworks/sum/ParseIntExample.class b/content/courses/prog-intro/homeworks/sum/ParseIntExample.class new file mode 100644 index 0000000..44335b9 Binary files /dev/null and b/content/courses/prog-intro/homeworks/sum/ParseIntExample.class differ diff --git a/content/courses/prog-intro/homeworks/sum/ParseIntExample.java b/content/courses/prog-intro/homeworks/sum/ParseIntExample.java new file mode 100644 index 0000000..33a275d --- /dev/null +++ b/content/courses/prog-intro/homeworks/sum/ParseIntExample.java @@ -0,0 +1,12 @@ +// ParseIntExample.java + +public class ParseIntExample { + + public static void main(String[] args) { + String s = "123"; + int sum = 321; + //! sum = sum + s; + sum = sum + Integer.parseInt(s); + System.out.println(sum); + } +} diff --git a/content/courses/prog-intro/homeworks/sum/Sum.java b/content/courses/prog-intro/homeworks/sum/Sum.java new file mode 100644 index 0000000..27a3033 --- /dev/null +++ b/content/courses/prog-intro/homeworks/sum/Sum.java @@ -0,0 +1,17 @@ +// Sum.java + +public class Sum { + public static void main(String[] args) { + System.out.println("number of arguments: " + args.length); + + int sum = 0; + for (String argument : args) { + sum = sum + argument; + System.out.println(argument); + System.out.println(sum); + } + + System.out.println(sum); + } +} + diff --git a/content/courses/prog-intro/homeworks/sum/_index.md b/content/courses/prog-intro/homeworks/sum/_index.md new file mode 100644 index 0000000..49cf3e2 --- /dev/null +++ b/content/courses/prog-intro/homeworks/sum/_index.md @@ -0,0 +1,245 @@ +--- +title: Sum +weight: 5 +--- + +# Task + +1. You need to create a `Sum` class which will sum integers from command line arguments and output the sum to console. +2. Examples: + + ```sh + java Sum 1 2 3 + ``` + + Expected output: `6`. + + ```sh + java Sum 1 2 -3 + ``` + + Expected output: `0`. + + + ```sh + java Sum "1 2 3" + ``` + + Expected output: `6`. + + ```sh + java Sum "1 2" " 3" + ``` + + Expected output: `6`. + + ```sh + java Sum " " + ``` + + Expected output: `0`. + +3. Arguments can be: + - digits, + - signes `+` and `-`, + - [space symbols](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Character.html#isWhitespace(char)) + +4. You can assume that `int` type is sufficient for in-between calculations and result. +5. Before doing the task make sure to read docs for classes [`String`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html) and [`Integer`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Integer.html). +6. For debugging use [`System.err`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/System.html#err), because it will be ingnored by the testing program. + +--- + +# Solution + +After reading about [`String`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html), [`Integer`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Integer.html), [`System.err`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/System.html#err) we now know about some usefull methods: + +- [`Integer.parseInt(String s, int radix)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#parseInt-java.lang.String-) which parses the string argument as a signed integer in the radix specified by the second argument. So it basically converts a number from the `String` data type to `int`. +- [`Character.isWhitespace(char ch)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isWhitespace-char-) which checks if a character `ch` is a space symbol or not. + +Now let's start coding. Firstly let's define the structure of our program. I will be putting the name of the file at the first line comment in a file and its path if its nessesary. + +```java +// Sum.java + +public class Sum { + public static void main(String[] args) { + // ... + } +} +``` + +Okay that's done. What do we do next? Let's look at `String[] args` argument to our `main` method. It represents an array of command line arguments which we need to sum. So know we made our task a little bit easier. Now we can just say that we need to find sum of elements of array `args`. + +How are we going to do it though? First let's understand what we can do with this array. Let's modify our class a little bit. + +```java +// Sum.java + +public class Sum { + public static void main(String[] args) { + System.out.println(args.length); + } +} +``` + +We've added `System.out.println(args.length)` which takes the field `length` from our `args` object and prints it to the console. + +Let's try it. First compile our class using + +```sh +$ javac Sum.java +``` + +And then we can do some manual testing. + +```sh +$ java Sum 1 2 3 +3 +``` + +We got `3` as an output as expected. We gave our program 3 command line arguments: `1`, `2` and `3`. + +Here are all of the examples + +```sh +$ java Sum 1 2 -3 +3 +``` + +```sh +$ java Sum "1 2 3" +1 +``` + +> [!NOTE] +> Notice, that we got 1 instead of 3. That's because we put our arguments in `""` so this becomes a single string argument. + +```sh +$ java Sum "1 2" " 3" +2 +``` + +```sh +$ java Sum " " +1 +``` + +> [!NOTE] +> Here program gives us 1 instead of 0, because despite not having any numbers in the arguments a single whitespace is still an argument. + +Now let's try not obly to count our arguments but to list them as well. Let's modify our program a little bit more. + +```java +// Sum.java + +public class Sum { + public static void main(String[] args) { + System.out.println("number of arguments: " + args.length); + + for (String argument : args) { + System.out.println(argument); + } + } +} +``` + +Here I used `for` loop to do printing ***for*** every `String` element in `args`. + +Let's try this with our examples. And don't forget to recompile using `javac Sum.java`. + +```sh +$ java Sum 1 2 3 +number of arguments: 3 +1 +2 +3 +``` + +```sh +$ java Sum 1 2 -3 +number of arguments: 3 +1 +2 +-3 +``` + +```sh +$ java Sum "1 2 3" +number of arguments: 1 +1 2 3 +``` + +> [!NOTE] +> Again, notice only ***one*** string argument. + + +```sh +$ java Sum "1 2" " 3" +number of arguments: 2 +1 2 + 3 +``` + +```sh +$ java Sum " " +number of arguments: 1 + +``` + +Okay, now that we know how to ***iterate*** (or do something for every element), we can calculate the *sum* of all the numbers in the `args` array. To do that we need to create a new variable `sum` of *integer* type and assign it the **value** of `0`. Then for every number in `args` we will add it to `sum`, and so by the end of array we will have the sum of all numbers stored in variable `sum`. This is what the code will look like + +```java +// Sum.java + +public class Sum { + public static void main(String[] args) { + System.out.println("number of arguments: " + args.length); + + int sum = 0; + for (String argument : args) { + sum = sum + argument; + System.out.println(argument); + System.out.println(sum); + } + + System.out.println(sum); + } +} +``` + +Seems ok. But let's test it. + +```sh +$ javac Sum.java +Sum.java:9: error: incompatible types: String cannot be converted to int + sum = sum + argument; + ^ +1 error +``` + +We got a compilation error that says `String cannot be converted to int`. It means that when we try to add 2 variables `sum` and `argument` their types don't match. The type of `sum` is integer and string for `argument`. It seems pretty logical because what do we expect when adding for example `1` and `apple`?.. + +> [!IMPORTANT] +> So we need to *cast* `argument` to integer data type so that we can add it to `sum`. + +We can do so using [`Integer.parseInt()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#parseInt-java.lang.String-) method. + +It takes a `String s` and returns an `int`, which a string `s` represents. For example this code will work as expected + +```java +// ParseIntExample.java + +public class ParseIntExample { + + public static void main(String[] args) { + String s = "123"; + int sum = 321; + //! sum = sum + s; + sum = sum + Integer.parseInt(s); + System.out.println(sum); + } +} +``` + +The commented out line (`//!`) would have given us an exception. diff --git a/content/courses/prog-intro/lectures/_index.md b/content/courses/prog-intro/lectures/_index.md new file mode 100644 index 0000000..333b797 --- /dev/null +++ b/content/courses/prog-intro/lectures/_index.md @@ -0,0 +1,4 @@ +--- +title: Lectures +weight: 4 +--- diff --git a/content/courses/prog-intro/lectures/assets/compilation-process-simplified.svg b/content/courses/prog-intro/lectures/assets/compilation-process-simplified.svg new file mode 100644 index 0000000..9cdda93 --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/compilation-process-simplified.svg @@ -0,0 +1,4 @@ + + + +
Compilation
Human-readable text (code)
Machine code
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg b/content/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg new file mode 100644 index 0000000..76db010 --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg @@ -0,0 +1,4 @@ + + + +
C++ Compiler For x86-64 Platform 
С++ Source Code
Assembly
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg b/content/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg new file mode 100644 index 0000000..4c21e36 --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg @@ -0,0 +1,4 @@ + + + +
A
B
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/int-in-memory.svg b/content/courses/prog-intro/lectures/assets/int-in-memory.svg new file mode 100644 index 0000000..7840001 --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/int-in-memory.svg @@ -0,0 +1,4 @@ + + + +
int
4 bytes
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/java-code-compilation.svg b/content/courses/prog-intro/lectures/assets/java-code-compilation.svg new file mode 100644 index 0000000..fc26c64 --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/java-code-compilation.svg @@ -0,0 +1,4 @@ + + + +
Java Source Code
Java Byte Code
JVM
Native Processor
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/string-in-memory.svg b/content/courses/prog-intro/lectures/assets/string-in-memory.svg new file mode 100644 index 0000000..35700ee --- /dev/null +++ b/content/courses/prog-intro/lectures/assets/string-in-memory.svg @@ -0,0 +1,4 @@ + + + +
String
5 => 0x12347865
h
e
l
l
o
0x12347865
\ No newline at end of file diff --git a/content/courses/prog-intro/lectures/assets/tiobe.png b/content/courses/prog-intro/lectures/assets/tiobe.png new file mode 100644 index 0000000..5d144de Binary files /dev/null and b/content/courses/prog-intro/lectures/assets/tiobe.png differ diff --git a/content/courses/prog-intro/lectures/intro.md b/content/courses/prog-intro/lectures/intro.md new file mode 100644 index 0000000..4d021ac --- /dev/null +++ b/content/courses/prog-intro/lectures/intro.md @@ -0,0 +1,145 @@ +--- +title: Lecture 1. Introduction +weight: 5 +--- + +# Why do we choose Java? + +According to **TIOBE Programming Community Index** Java is one of the most demanded languages in the programming field. + +![TIOBE Programming Community Index](assets/tiobe.png) +*Img. 1 - TIOBE Programming Community Index* + +Also, Java has a lot of advantages for beginners such as: + +* It's fairly easy +* It has a broad spectre of usage + * Server + * Desktop + * Mobile devices + * Smart-cards + +# What does Java consist of? + +Java consists of multiple main components. The first one being the **Java compiler**. The process of converting *human-readable* text to *machine code* is called **compilation**. + +![Compilation Process Simplified](assets/compilation-process-simplified.svg) +*Img.2 - Simplified Compilation Process* + +The behaviour of the Java compiler is described by the [Java Language Specification](https://docs.oracle.com/javase/specs/) or JLS. + +Let's talk about compilers a little bit. For example if we will take *C++*. If we take C++ compiler for *x86-64* platform and *Windows* operating system, and launch the compiler on source code it will turn it directly into assembly code. + +![C++ code compilation under x86-64](assets/cpp-x86-64-compilation.svg) +*Img. X -- C++ code compilation process under x86-64 architecture.* + +But what if I want to run my program on *Linux* instead of Windows. I will need to take a different compiler under different operating system and recompile my code using a new compiler. It's not very convenient. + +Java tries to protect us from that. By converting the *Java source code* into *Java byte code*. And then the *byte code* will be ran on the *Java virtual machine* which will run our program on the native processor. + +![Java code compilation](assets/java-code-compilation.svg) +*Img. X -- Java code compilation* + +This approach allows to change only **JVM** according to our platform (*x86_64, ARM, ...*) and operating system (*Windows, MacOS, GNU-Linux, ...*) while *byte code* stays the same. We can only write our code once, than compile it and run under everywhere. + +As the motto says: + +> Write once -- ~debug~ run everywhere. + + The third component of Java is the standart library which is included in the JVM. + +There are multiple redactions of Java-platforms: + +* Standart edition + - *For regular aplications* +* Enterprise edition + - *For server aplications* +* Micro-edition + - *For mobile aplications* + - *Isn't in use nowadays 🪦* +* Java Card + - *Sim- and smart-cards* + +There also were multiple versions of Java throughout its history. + + +- JDK 1.0 (Jan 1996) +- J2SE 1.2 (Dec 1998) + * *Collections Framework* +- J2SE 5.0 (Sep 2004) + * *Generics* +- Java SE 8 (Mar 2014) + * *Streams and Lambdas* +- Java SE 9 (Sep 2017) + * *Modules* +- Java SE 10 (Mar 2018) + * `var` +- Java 11 (Sep 2018) + * `jshell` +- Java 17 [LTS-old] (Sep 2021) + * *Previous stable version* + * *Many little changes* +- Java 21 [LTS] (Sep 2023) + * *Current stable version* +- Java 25 (Sep 2025) + * *Next version* + +Java comes in two parts: **JDK - Java Development Kit** and **JVM - Java Virtual Machine**. + +There is also a **JRE - Java Runtime Environment**. For example if we want to run our code somewhere on the server we don't need to compile it there because we have our byte code and we just need JRE to run it. + +Some of the most popular JVMs right now are: + +- OpenJDK +- Eclipse +- Azul Systems +- Excelsior JET + +The disadvantage of such system is in the connection between JVM and a native processing unit. In case of C++ compiler that we reviewed earlier the source code is compiled directly into machine-code but in case with Java it is compiled into byte-code. And so the problem is to develop such a JVM that would quickly turn our byte-code into machine-code. Anyway it takes extra time. That's why it mostly will be slower than direct compilation into machine-code. So ultimately while we have the advantage of compiling out code only once, we have the disadvantage of turning byte-code into machine-code slower. + +None the less, there is a way to speed up this process which is called JIT - Just In Time compilation. How does it work? While our program is running some of the instructions or functions turns directly into processor commands. + +# What is garbage collection? + +For example we have `int` which is represented with 4 bytes of data which is directly stored in memory. + +![`int` in memory](assets/int-in-memory.svg) +*Img. X -- `int` in memory* + +But what if we have a `String`. How many memory cells does this string take? We don't know. We will say that our `String` that has length of 5 symbols is stored at `0x12347865`. We defined an address where this string is located in memory. And somewhere in the memory of our programm will be a large buffer where the 5 cells will be stored. + +![`String` in memory](assets/string-in-memory.svg) +*Img. X -- `String` in memory* + +But what do we do with that buffer? We won't need it forever and so sometimes we need to clear that buffer. In case with C/C++ whoever created the memory for that string is in charge of clearing it. There are also languages with garbage collection such as Java and Python. The purpose of the **Garbage Collector** is to automatically find variables that we no longer need and clear their memory. + +Suppose we have some code like this. + +```java +if (someCondition) { + x = [1, 3, 7] // first link + // some code here + y = x // second link + // some code here +} // no links +``` + +After the `if`-statement we no longer need `x` or `y`. Every variable in this case `x` and `y` is the link to our array (`[1, 3, 7]`). After we left the `if`-statement the amount of links to the array is zero, so we can safely delete the array. This approach is implemented in Python. The problem is that if we have to objects linked to one another and there are no external links, they will not be deleted by garbage collector since there link counter is 1. + +![Edge case for link couting](assets/edge-case-for-link-counting.svg) +*Img. X -- Edge case for link counting* + +The advanced way of implementing the garbage collection is *traversing the graph of links* which is implemented in Java, C# and Go. + +# What other advantages does Java have? + +- It's easy (in terms of syntax) +- It's secure and stable +- It supports Unicode +- It supports multithreading +- It has backwards compatibility + +# How should Java code look like? + +You can go and learn about it [here](https://google.github.io/styleguide/javaguide.html). + diff --git a/content/courses/spring-boot/_index.md b/content/courses/spring-boot/_index.md new file mode 100644 index 0000000..584a3a5 --- /dev/null +++ b/content/courses/spring-boot/_index.md @@ -0,0 +1,670 @@ +--- +# title: Courses +weight: 3 +--- + +# Prerequisites + +Before diving in, make sure you're comfortable with the following: + +- **Java** — solid understanding of the language +- **Object-oriented programming** — classes, methods and interfaces +- **Databases** — tables, primary keys, foreign keys, relationships, etc. +- **SQL** — ability to write basic SQL statements + +--- + +# What is a Spring Framework? + +**Spring** is a popular framework for building Java applications. It has a lot of modules, each designed to handle a specific task. They are combined into a few different layers. + +![Spring layers](assets/spring-layers.svg) +*Img. 1 — Spring layers* + +| **Layer** | **Purpose** | +|-----------|-------------| +| *Core* | Handling dependency injection, managing objects | +| *Web* | Building web applications | +| *Data* | Working with databases | +| *AOP* | Aspect oriented programming | +| *Test* | Testing spring components | + +--- + +While the Spring Framework is powerful, using it often involves a lot of configuration. For example, if you want to build a web app you might need to setup a web server, configure routing and manage dependencies manually. That's when **Spring Boot** comes in. + +> [!NOTE] +> You can think of Spring Boot as a layer on top of the Spring Framework that takes care of all of the setup. *Spring Boot* simplifies Spring development by providing sensible defaults and ready-to-use features. + +By the way, the Spring Framework is just one part of a larger family of projects in the **Spring ecosystem**. + +![Spring ecosystem](assets/spring-ecosystem.svg) +*Img. 2 — Spring ecosystem* + +| **Module Name** | **Purpose** | +|------------------------|-------------| +| *Spring Data* | Simplifying database access | +| *Spring Security* | Adding authentication and authorization | +| *Spring Batch* | Batch processing | +| *Spring Cloud* | Building microservices and distributed systems | +| *Spring Integration* | Simplifying messaging and integration between systems | + +--- + +# Initialize Spring Boot Project + +To initialize a new Spring Boot project, go to [start.spring.io](https://start.spring.io/) and select the options that suit you. + +![Spring Options](assets/spring-project-init.png) +*Img. 3 — Spring Boot options* + +After unpacking the `zip` archive, you'll have this template project: + +```bash +. +├── HELP.md +├── mvnw +├── mvnw.cmd +├── pom.xml +├── src +│ ├── main +│ │ ├── java +│ │ │ └── tech +│ │ │ └── codejava +│ │ │ └── store +│ │ │ └── StoreApplication.java +│ │ └── resources +│ │ └── application.properties +│ └── test +│ └── java +│ └── tech +│ └── codejava +│ └── store +│ └── StoreApplicationTests.java +└── target + ├── classes + │ ├── application.properties + │ └── tech + │ └── codejava + │ └── store + │ └── StoreApplication.class + ├── generated-sources + │ └── annotations + ├── generated-test-sources + │ └── test-annotations + ├── maven-status + │ └── maven-compiler-plugin + │ ├── compile + │ │ └── default-compile + │ │ ├── createdFiles.lst + │ │ └── inputFiles.lst + │ └── testCompile + │ └── default-testCompile + │ ├── createdFiles.lst + │ └── inputFiles.lst + ├── surefire-reports + │ ├── TEST-tech.codejava.store.StoreApplicationTests.xml + │ └── tech.codejava.store.StoreApplicationTests.txt + └── test-classes + └── tech + └── codejava + └── store + └── StoreApplicationTests.class +``` + +The "heart" of our project is `pom.xml`: + +```xml + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 4.0.2 + + + tech.codejava + store + 0.0.1-SNAPSHOT + store + Store + + + + + + + + + + + + + + + 21 + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + +``` + +Maven uses this file to download dependencies and build our project. + +In the `src` folder we have the actual code: + +```bash +src +├── main +│ ├── java +│ │ └── tech +│ │ └── codejava +│ │ └── store +│ │ └── StoreApplication.java +│ └── resources +│ └── application.properties +└── test + └── java + └── tech + └── codejava + └── store + └── StoreApplicationTests.java +``` + +`StoreApplication.java` is the entry point to our application: + +```java +package tech.codejava.store; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StoreApplication { + + public static void main(String[] args) { + SpringApplication.run(StoreApplication.class, args); + } + +} +``` + +In the `main` method we have a call to `SpringApplication.run`. + +Running `mvn clean install` from the root of our project gives us this result *(output partially reduced)*: + +```bash +... +[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.542 s -- in tech.codejava.store.StoreApplicationTests +[INFO] +[INFO] Results: +[INFO] +[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 +[INFO] +[INFO] +[INFO] --- jar:3.4.2:jar (default-jar) @ store --- +[INFO] Building jar: /home/fymio/store/target/store-0.0.1-SNAPSHOT.jar +[INFO] +[INFO] --- spring-boot:4.0.2:repackage (repackage) @ store --- +... +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 14.787 s +[INFO] Finished at: 2026-02-19T13:16:47+03:00 +[INFO] ------------------------------------------------------------------------ +``` + +Our application built without errors. + +--- + +# Dependency Management + +Dependencies are third-party libraries or frameworks we use in our application. For example, to build a web application we need an embedded web server like *Tomcat*, libraries for handling web requests, building APIs, processing JSON data, logging and so on. + +In Spring Boot applications, instead of adding multiple individual libraries, we can use a **starter dependency**. + +![Spring Boot Starter Web](assets/spring-boot-starter-web.svg) +*Img. 5 — Spring Boot Starter Web* + +To use this dependency, copy the following into your `pom.xml`: + +```xml + + org.springframework.boot + spring-boot-starter-web + 4.1.0-M1 + +``` + +So the `dependencies` section would look like this: + +```xml + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-web + + + +``` + +> [!IMPORTANT] +> Notice that the version is commented out. It's a better practice to let Spring Boot decide what version of the dependency to use, as it ensures compatibility across your project. + +--- + +# Controllers + +**Spring MVC** stands for *Model View Controller*. + +- **Model** is where our application's data lives. It represents the business logic and is usually connected to a database or other data sources. In Spring Boot, the model can be a simple Java class. +- **View** is what the user sees. It's the HTML, CSS or JavaScript rendered in the browser. In Spring MVC, views can be static files or dynamically generated. +- **Controller** is like a traffic controller. It handles incoming requests from the user, interacts with the model to get data and then tells the view what to display. + +Let's add a new Java class called `HomeController` at `src/main/java/tech/codejava/store/HomeController.java`: + +```java +package tech.codejava.store; + +public class HomeController {} +``` + +To make this a controller, decorate it with the `@Controller` annotation: + +```java +package tech.codejava.store; + +import org.springframework.stereotype.Controller; + +@Controller +public class HomeController {} +``` + +Now let's add an `index` method. When we send a request to the root of our website, we want this method to be called: + +```java +package tech.codejava.store; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class HomeController { + + @RequestMapping("/") // this represents the root of our website + public String index() { + return "index.html"; // this returns the view + } +} +``` + +Now we need to create the view. Add `index.html` at `src/main/resources/static/index.html`: + +```html + + + + + + View + + +

Hello world!

+ + +``` + +Let's build and run our application using `mvn spring-boot:run`. From the logs: + +```bash +2026-02-19T14:55:23.948+03:00 INFO 36752 --- [store] [ main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http) +``` + +Our app is up and running at [localhost:8080](http://localhost:8080/). + +![Hello world!](assets/hello-world.png) +*Img. 7 — Our app is up and running!* + +--- + +# Configuring Application Properties + +Let's take a look at `src/main/resources/application.properties`: + +```properties +spring.application.name=store +``` + +To use this property in our code, we can use the `@Value` annotation. Let's update `HomeController` to print the application name: + +```java +package tech.codejava.store; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class HomeController { + + @Value("${spring.application.name}") + private String appName; + + @RequestMapping("/") // this represents the root of our website + public String index() { + System.out.println("application name = " + appName); + return "index.html"; // this returns the view + } +} +``` + +After running the application, we can see `store` printed in the terminal: + +```bash +... +2026-02-19T15:32:37.507+03:00 INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2026-02-19T15:32:37.509+03:00 INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms +application name = store +... +``` + +--- + +# Dependency Injection + +Imagine we're building an E-Commerce application that handles placing orders. When an order is placed, the customer's payment needs to be processed — so `OrderService` depends on a payment service like `StripePaymentService`. We can say that `OrderService` is *dependent on* (or *coupled to*) `StripePaymentService`. + +![Depends on/Coupled to relation](assets/depends-on-coupled-to.svg) +*Img. 8 — Depends On/Coupled To relation* + +Let's talk about the issues that arise when one class is **tightly coupled** to another. + +1. **Inflexibility** — `OrderService` can only use `StripePaymentService`. If tomorrow we decide to switch to a different payment provider like PayPal, we would have to modify `OrderService`. Once we change it, it has to be recompiled and retested, which could impact other classes that depend on it. +2. **Untestability** — We cannot test `OrderService` in isolation, because `OrderService` is tightly coupled with `StripePaymentService` and we can't test its logic separately from it. + +> [!NOTE] +> The problem here isn't that `OrderService` *depends* on `StripePaymentService` — dependencies are normal in any application. The issue is about *how* the dependency is created and managed. + +**Analogy:** Think of a restaurant. A restaurant needs a chef — that's a perfectly normal dependency. If the current chef becomes unavailable, the restaurant can hire another one. + +![Restaurant — Chef dependency](assets/restaurant-chef-dependency.svg) +*Img. X — Restaurant — Chef dependency (Normal)* + +Now what if we replace "chef" with a specific person: John? Our restaurant is now dependent on *John specifically*. If John becomes unavailable, we can't replace him — the restaurant is in trouble. This is an example of **tight** or **bad coupling**. + +![Restaurant — John dependency](assets/restaurant-john-dependency.svg) +*Img. X — Restaurant — John dependency (Bad coupling)* + +We don't want `OrderService` to be tightly coupled to a specific payment service like Stripe. Instead, we want it to depend on a `PaymentService` *interface*, which could be Stripe, PayPal, or any other provider. To achieve this we can use the *interface* to decouple `OrderService` from `StripePaymentService`. + +![Payment Service as `interface`](assets/payment-service-as-interface.svg) +*Img. X — `PaymentService` as `interface`* + +If `OrderService` depends on a `PaymentService` interface, it doesn't know anything about Stripe, PayPal, or any other payment provider. As long as these providers implement `PaymentService`, they can be used to handle payments — and `OrderService` won't care which one is being used. + +**Benefits:** + +1. If we replace `StripePaymentService` with `PayPalPaymentService`, the `OrderService` class is not affected. +2. We don't need to modify or recompile `OrderService`. +3. We can test `OrderService` in isolation, without relying on the specific payment provider like Stripe. + +With this setup, we simply give `OrderService` a particular implementation of `PaymentService`. This is called **dependency injection** — we *inject* the dependency into a class. + +![Dependency Injection example](assets/dependency-injection.svg) +*Img. X — Dependency Injection example* + +Let's see how it works in our project. Create `OrderService` at `src/main/java/tech/codejava/store/OrderService.java`: + +```java +package tech.codejava.store; + +public class OrderService { + + public void placeOrder() {} +} +``` + +> [!NOTE] +> In a real project we would need to provide something like `Order order` to this method, but for teaching purposes we won't do that. + +Now create `StripePaymentService` in the same directory: + +```java +package tech.codejava.store; + +public class StripePaymentService { + + public void processPayment(double amount) { + System.out.println("=== STRIPE ==="); + System.out.println("amount: " + amount); + } +} +``` + +Let's implement `placeOrder` in `OrderService` using `StripePaymentService`: + +```java +package tech.codejava.store; + +public class OrderService { + + public void placeOrder() { + var paymentService = new StripePaymentService(); + paymentService.processPayment(10); + } +} +``` + +> [!IMPORTANT] +> This is our *before* setup — before we introduced the interface. In this implementation, `OrderService` is **tightly coupled** to `StripePaymentService`. We cannot test `OrderService` in isolation, and switching to another payment provider would require modifying `OrderService`. + +Let's fix this. Create a `PaymentService` interface in the same directory: + +```java +package tech.codejava.store; + +public interface PaymentService { + void processPayment(double amount); +} +``` + +Modify `StripePaymentService` to implement `PaymentService`: + +```java +package tech.codejava.store; + +public class StripePaymentService implements PaymentService { + + @Override + public void processPayment(double amount) { + System.out.println("=== STRIPE ==="); + System.out.println("amount: " + amount); + } +} +``` + +The recommended way to inject a dependency into a class is via its **constructor**. Let's define one in `OrderService`: + +```java +package tech.codejava.store; + +public class OrderService { + + private PaymentService paymentService; + + public OrderService(PaymentService paymentService) { + this.paymentService = paymentService; + } + + public void placeOrder() { + paymentService.processPayment(10); + } +} +``` + +Now let's see this in action. Modify `StoreApplication`: + +```java +package tech.codejava.store; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StoreApplication { + + public static void main(String[] args) { + // SpringApplication.run(StoreApplication.class, args); + + var orderService = new OrderService(new StripePaymentService()); + orderService.placeOrder(); + } +} +``` + +Running the application *(output intentionally reduced)*: + +```bash +... +=== STRIPE === +amount: 10.0 +... +``` + +Now let's create a `PayPalPaymentService` in the same directory: + +```java +package tech.codejava.store; + +public class PayPalPaymentService implements PaymentService { + + @Override + public void processPayment(double amount) { + System.out.println("=== PayPal ==="); + System.out.println("amount: " + amount); + } +} +``` + +Now we can switch from `StripePaymentService` to `PayPalPaymentService` in `StoreApplication` — without touching `OrderService` at all: + +```java +package tech.codejava.store; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StoreApplication { + + public static void main(String[] args) { + // SpringApplication.run(StoreApplication.class, args); + + // var orderService = new OrderService(new StripePaymentService()); + var orderService = new OrderService(new PayPalPaymentService()); + orderService.placeOrder(); + } +} +``` + +```bash +... +=== PayPal === +amount: 10.0 +... +``` + +Notice that we didn't change `OrderService`. In *object-oriented programming* this is known as the **Open/Closed Principle**: + +> A class should be open for extension and closed for modification. + +In other words: we should be able to add new functionality to a class without changing its existing code. This reduces the risk of introducing bugs and breaking other parts of the application. + +--- + +## Setter Injection + +Another way to inject a dependency is via a **setter**. In `OrderService`, let's define one: + +```java +package tech.codejava.store; + +public class OrderService { + + private PaymentService paymentService; + + public void setPaymentService(PaymentService paymentService) { + this.paymentService = paymentService; + } + + public OrderService(PaymentService paymentService) { + this.paymentService = paymentService; + } + + public void placeOrder() { + paymentService.processPayment(10); + } +} +``` + +We can use it like this in `StoreApplication`: + +```java +package tech.codejava.store; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StoreApplication { + + public static void main(String[] args) { + // SpringApplication.run(StoreApplication.class, args); + + // var orderService = new OrderService(new StripePaymentService()); + var orderService = new OrderService(new PayPalPaymentService()); + orderService.setPaymentService(new PayPalPaymentService()); + orderService.placeOrder(); + } +} +``` + +> [!IMPORTANT] +> If you remove the constructor from `OrderService` and forget to call the setter, the application will crash with a `NullPointerException`. Use setter injection only for **optional** dependencies — ones that `OrderService` can function without. diff --git a/content/courses/spring-boot/assets/dependency-injection.svg b/content/courses/spring-boot/assets/dependency-injection.svg new file mode 100644 index 0000000..a4e6341 --- /dev/null +++ b/content/courses/spring-boot/assets/dependency-injection.svg @@ -0,0 +1,4 @@ + + + +
OrderService
PaymentService
<<interface>>
Stripe
PayPal
<<class>>
<<class>>
Dependency Injection
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/depends-on-coupled-to.svg b/content/courses/spring-boot/assets/depends-on-coupled-to.svg new file mode 100644 index 0000000..e11d6b5 --- /dev/null +++ b/content/courses/spring-boot/assets/depends-on-coupled-to.svg @@ -0,0 +1,4 @@ + + + +
OrderService
StripePaymentService
Depends On
Coupled To
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/hello-world.png b/content/courses/spring-boot/assets/hello-world.png new file mode 100644 index 0000000..7a9725d Binary files /dev/null and b/content/courses/spring-boot/assets/hello-world.png differ diff --git a/content/courses/spring-boot/assets/payment-service-as-interface.svg b/content/courses/spring-boot/assets/payment-service-as-interface.svg new file mode 100644 index 0000000..c70e4ff --- /dev/null +++ b/content/courses/spring-boot/assets/payment-service-as-interface.svg @@ -0,0 +1,4 @@ + + + +
OrderService
PaymentService
<<interface>>
Stripe
PayPal
<<class>>
<<class>>
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/restaurant-chef-dependency.svg b/content/courses/spring-boot/assets/restaurant-chef-dependency.svg new file mode 100644 index 0000000..f9e814f --- /dev/null +++ b/content/courses/spring-boot/assets/restaurant-chef-dependency.svg @@ -0,0 +1,4 @@ + + + +
Restaurant
Chef
Normal
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/restaurant-john-dependency.svg b/content/courses/spring-boot/assets/restaurant-john-dependency.svg new file mode 100644 index 0000000..1451100 --- /dev/null +++ b/content/courses/spring-boot/assets/restaurant-john-dependency.svg @@ -0,0 +1,4 @@ + + + +
Restaurant
John
Bad coupling
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/spring-boot-starter-web.svg b/content/courses/spring-boot/assets/spring-boot-starter-web.svg new file mode 100644 index 0000000..69bf952 --- /dev/null +++ b/content/courses/spring-boot/assets/spring-boot-starter-web.svg @@ -0,0 +1,4 @@ + + + +
tomcat
web
webmvc
jackson
logging
spring-boot-starter-web
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/spring-ecosystem.svg b/content/courses/spring-boot/assets/spring-ecosystem.svg new file mode 100644 index 0000000..8e50dcb --- /dev/null +++ b/content/courses/spring-boot/assets/spring-ecosystem.svg @@ -0,0 +1,4 @@ + + + +
Spring Boot
Spring Framework
Spring Batch
Spring Integration
Spring Data
Spring Security
Spring Cloud
Spring Shell
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/spring-layers.svg b/content/courses/spring-boot/assets/spring-layers.svg new file mode 100644 index 0000000..2eb13c7 --- /dev/null +++ b/content/courses/spring-boot/assets/spring-layers.svg @@ -0,0 +1,4 @@ + + + +
Web
Data
AOP
Core
Test
\ No newline at end of file diff --git a/content/courses/spring-boot/assets/spring-project-init.png b/content/courses/spring-boot/assets/spring-project-init.png new file mode 100644 index 0000000..37fc1a7 Binary files /dev/null and b/content/courses/spring-boot/assets/spring-project-init.png differ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d63f48f --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.fymio.us/me/codejava.tech + +go 1.25.7 + +require github.com/imfing/hextra v0.11.1 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..efb638f --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/imfing/hextra v0.11.1 h1:8pTc4ReYbzGTHAnyiebmlT3ijFfIXiGu1r7tM/UGjFI= +github.com/imfing/hextra v0.11.1/go.mod h1:cEfel3lU/bSx7lTE/+uuR4GJaphyOyiwNR3PTqFTXpI= diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..55fd5d0 --- /dev/null +++ b/hugo.toml @@ -0,0 +1,17 @@ +baseURL = 'https://codejava.tech/' +title = 'CodeJava' +theme = 'github.com/imfing/hextra' + +[menu] + [[menu.main]] + name = 'Courses' + pageRef = '/courses' + weight = 1 + [[menu.main]] + name = 'Search' + weight = 2 + [menu.main.params] + type = 'search' + +[params] + description = 'Learn Java programming' diff --git a/layouts/list.rss.xml b/layouts/list.rss.xml new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..357d87a --- /dev/null +++ b/public/404.html @@ -0,0 +1,40 @@ + + + +
+ +

+ 404 +

+
+

This page could not be found.

+
+
+ + diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png new file mode 100644 index 0000000..7f0493c Binary files /dev/null and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png new file mode 100644 index 0000000..faea4c2 Binary files /dev/null and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..eb281cb Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/casts/demo.cast b/public/casts/demo.cast new file mode 100644 index 0000000..cbb32c3 --- /dev/null +++ b/public/casts/demo.cast @@ -0,0 +1,19 @@ +{"version": 2, "width": 80, "height": 24, "timestamp": 1640995200, "env": {"TERM": "xterm-256color", "SHELL": "/bin/bash"}, "title": "Demo Terminal Session"} +[0.0, "o", "Welcome to the demo!\r\n"] +[1.0, "o", "$ "] +[2.0, "o", "ls -la\r\n"] +[2.5, "o", "total 8\r\n"] +[2.6, "o", "drwxr-xr-x 2 user user 4096 Jan 1 12:00 .\r\n"] +[2.7, "o", "drwxr-xr-x 20 user user 4096 Jan 1 12:00 ..\r\n"] +[2.8, "o", "-rw-r--r-- 1 user user 0 Jan 1 12:00 demo.txt\r\n"] +[3.0, "o", "$ "] +[4.0, "o", "cat demo.txt\r\n"] +[4.5, "o", "Hello, this is a demo file!\r\n"] +[5.0, "o", "$ "] +[6.0, "o", "echo 'This is a test command'\r\n"] +[6.5, "o", "This is a test command\r\n"] +[7.0, "o", "$ "] +[8.0, "o", "pwd\r\n"] +[8.5, "o", "/home/user/demo\r\n"] +[9.0, "o", "$ "] +[10.0, "o", "exit\r\n"] \ No newline at end of file diff --git a/public/categories/index.html b/public/categories/index.html new file mode 100644 index 0000000..44247d9 --- /dev/null +++ b/public/categories/index.html @@ -0,0 +1,355 @@ + + + + + + + + + + +Categories – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+
+

Categories

+
+
+ +
+
+ +
+
+
+
+ + + + + + + + diff --git a/public/categories/index.xml b/public/categories/index.xml new file mode 100644 index 0000000..c4a1d12 --- /dev/null +++ b/public/categories/index.xml @@ -0,0 +1,18 @@ + + + CodeJava – Categories + http://localhost:1313/categories/ + Recent content in Categories on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + diff --git a/public/courses/index.html b/public/courses/index.html new file mode 100644 index 0000000..e9736fb --- /dev/null +++ b/public/courses/index.html @@ -0,0 +1,385 @@ + + + + + + + + + + +CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+ + +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/index.xml b/public/courses/index.xml new file mode 100644 index 0000000..c6ba6ed --- /dev/null +++ b/public/courses/index.xml @@ -0,0 +1,51 @@ + + + CodeJava – + http://localhost:1313/courses/ + Recent content on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + Lecture 1. Introduction + http://localhost:1313/courses/prog-intro/lectures/intro/ + Mon, 01 Jan 0001 00:00:00 +0000 + + http://localhost:1313/courses/prog-intro/lectures/intro/ + + + + <h1>Why do we choose Java?</h1><p>According to <strong>TIOBE Programming Community Index</strong> Java is one of the most demanded languages in the programming field.</p> +<p> + <img src="../assets/tiobe.png" alt="TIOBE Programming Community Index" loading="lazy" /> +<em>Img. 1 - TIOBE Programming Community Index</em></p> +<p>Also, Java has a lot of advantages for beginners such as:</p> +<ul> +<li>It&rsquo;s fairly easy</li> +<li>It has a broad spectre of usage +<ul> +<li>Server</li> +<li>Desktop</li> +<li>Mobile devices</li> +<li>Smart-cards</li> +</ul> +</li> +</ul> +<h1>What does Java consist of?</h1><p>Java consists of multiple main components. The first one being the <strong>Java compiler</strong>. The process of converting <em>human-readable</em> text to <em>machine code</em> is called <strong>compilation</strong>.</p> +<p> + <img src="../assets/compilation-process-simplified.svg" alt="Compilation Process Simplified" loading="lazy" /> +<em>Img.2 - Simplified Compilation Process</em></p> + + + + + + diff --git a/public/courses/paradigms/index.html b/public/courses/paradigms/index.html new file mode 100644 index 0000000..9c0ba70 --- /dev/null +++ b/public/courses/paradigms/index.html @@ -0,0 +1,385 @@ + + + + + + + + + + +Paradgims of Programming – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Paradgims of Programming

+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/paradigms/index.xml b/public/courses/paradigms/index.xml new file mode 100644 index 0000000..0158b36 --- /dev/null +++ b/public/courses/paradigms/index.xml @@ -0,0 +1,18 @@ + + + CodeJava – Paradgims of Programming + http://localhost:1313/courses/paradigms/ + Recent content in Paradgims of Programming on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + diff --git a/public/courses/prog-intro/assets/compilation-process.svg b/public/courses/prog-intro/assets/compilation-process.svg new file mode 100644 index 0000000..650391b --- /dev/null +++ b/public/courses/prog-intro/assets/compilation-process.svg @@ -0,0 +1,4 @@ + + + +
Compilation
Human-readable text (code)
Machine code
\ No newline at end of file diff --git a/public/courses/prog-intro/homeworks/index.html b/public/courses/prog-intro/homeworks/index.html new file mode 100644 index 0000000..df0e230 --- /dev/null +++ b/public/courses/prog-intro/homeworks/index.html @@ -0,0 +1,385 @@ + + + + + + + + + + +Homeworks – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Homeworks

+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/prog-intro/homeworks/index.xml b/public/courses/prog-intro/homeworks/index.xml new file mode 100644 index 0000000..24a8c34 --- /dev/null +++ b/public/courses/prog-intro/homeworks/index.xml @@ -0,0 +1,18 @@ + + + CodeJava – Homeworks + http://localhost:1313/courses/prog-intro/homeworks/ + Recent content in Homeworks on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + diff --git a/public/courses/prog-intro/homeworks/sum/ParseIntExample.class b/public/courses/prog-intro/homeworks/sum/ParseIntExample.class new file mode 100644 index 0000000..44335b9 Binary files /dev/null and b/public/courses/prog-intro/homeworks/sum/ParseIntExample.class differ diff --git a/public/courses/prog-intro/homeworks/sum/ParseIntExample.java b/public/courses/prog-intro/homeworks/sum/ParseIntExample.java new file mode 100644 index 0000000..33a275d --- /dev/null +++ b/public/courses/prog-intro/homeworks/sum/ParseIntExample.java @@ -0,0 +1,12 @@ +// ParseIntExample.java + +public class ParseIntExample { + + public static void main(String[] args) { + String s = "123"; + int sum = 321; + //! sum = sum + s; + sum = sum + Integer.parseInt(s); + System.out.println(sum); + } +} diff --git a/public/courses/prog-intro/homeworks/sum/Sum.java b/public/courses/prog-intro/homeworks/sum/Sum.java new file mode 100644 index 0000000..27a3033 --- /dev/null +++ b/public/courses/prog-intro/homeworks/sum/Sum.java @@ -0,0 +1,17 @@ +// Sum.java + +public class Sum { + public static void main(String[] args) { + System.out.println("number of arguments: " + args.length); + + int sum = 0; + for (String argument : args) { + sum = sum + argument; + System.out.println(argument); + System.out.println(sum); + } + + System.out.println(sum); + } +} + diff --git a/public/courses/prog-intro/homeworks/sum/index.html b/public/courses/prog-intro/homeworks/sum/index.html new file mode 100644 index 0000000..7e452a9 --- /dev/null +++ b/public/courses/prog-intro/homeworks/sum/index.html @@ -0,0 +1,814 @@ + + + + + + + + + + +Sum – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Sum

+

Task

    +
  1. +

    You need to create a Sum class which will sum integers from command line arguments and output the sum to console.

    +
  2. +
  3. +

    Examples:

    +
    + +
    java Sum 1 2 3
    + +
    +
    +

    Expected output: 6.

    +
    + +
    java Sum 1 2 -3
    + +
    +
    +

    Expected output: 0.

    +
    + +
    java Sum "1 2 3"
    + +
    +
    +

    Expected output: 6.

    +
    + +
    java Sum "1 2" " 3"
    + +
    +
    +

    Expected output: 6.

    +
    + +
    java Sum " "
    + +
    +
    +

    Expected output: 0.

    +
  4. +
  5. +

    Arguments can be:

    + +
  6. +
  7. +

    You can assume that int type is sufficient for in-between calculations and result.

    +
  8. +
  9. +

    Before doing the task make sure to read docs for classes String and Integer.

    +
  10. +
  11. +

    For debugging use System.err, because it will be ingnored by the testing program.

    +
  12. +
+
+

Solution

After reading about String, Integer, System.err we now know about some usefull methods:

+ +

Now let’s start coding. Firstly let’s define the structure of our program. I will be putting the name of the file at the first line comment in a file and its path if its nessesary.

+
+ +
// Sum.java
+
+public class Sum {
+    public static void main(String[] args) {
+        // ...
+    }
+}
+ +
+
+

Okay that’s done. What do we do next? Let’s look at String[] args argument to our main method. It represents an array of command line arguments which we need to sum. So know we made our task a little bit easier. Now we can just say that we need to find sum of elements of array args.

+

How are we going to do it though? First let’s understand what we can do with this array. Let’s modify our class a little bit.

+
+ +
// Sum.java
+
+public class Sum {
+    public static void main(String[] args) {
+        System.out.println(args.length);
+    }
+}
+ +
+
+

We’ve added System.out.println(args.length) which takes the field length from our args object and prints it to the console.

+

Let’s try it. First compile our class using

+
+ +
$ javac Sum.java
+ +
+
+

And then we can do some manual testing.

+
+ +
$ java Sum 1 2 3
+3
+ +
+
+

We got 3 as an output as expected. We gave our program 3 command line arguments: 1, 2 and 3.

+

Here are all of the examples

+
+ +
$ java Sum 1 2 -3
+3
+ +
+
+
+ +
$ java Sum "1 2 3"
+1
+ +
+
+
+

Note

+ +
+

Notice, that we got 1 instead of 3. That’s because we put our arguments in "" so this becomes a single string argument.

+
+
+
+ +
$ java Sum "1 2" " 3"
+2
+ +
+
+
+ +
$ java Sum " "
+1
+ +
+
+
+

Note

+ +
+

Here program gives us 1 instead of 0, because despite not having any numbers in the arguments a single whitespace is still an argument.

+
+
+

Now let’s try not obly to count our arguments but to list them as well. Let’s modify our program a little bit more.

+
+ +
// Sum.java
+
+public class Sum {
+    public static void main(String[] args) {
+        System.out.println("number of arguments: " + args.length);
+        
+        for (String argument : args) {
+            System.out.println(argument);
+        }
+    }
+}
+ +
+
+

Here I used for loop to do printing for every String element in args.

+

Let’s try this with our examples. And don’t forget to recompile using javac Sum.java.

+
+ +
$ java Sum 1 2 3
+number of arguments: 3
+1
+2
+3
+ +
+
+
+ +
$ java Sum 1 2 -3
+number of arguments: 3
+1
+2
+-3
+ +
+
+
+ +
$ java Sum "1 2 3"
+number of arguments: 1
+1 2 3
+ +
+
+
+

Note

+ +
+

Again, notice only one string argument.

+
+
+
+ +
$ java Sum "1 2" " 3"
+number of arguments: 2
+1 2
+ 3
+ +
+
+
+ +
$ java Sum " "
+number of arguments: 1
+ 
+ +
+
+

Okay, now that we know how to iterate (or do something for every element), we can calculate the sum of all the numbers in the args array. To do that we need to create a new variable sum of integer type and assign it the value of 0. Then for every number in args we will add it to sum, and so by the end of array we will have the sum of all numbers stored in variable sum. This is what the code will look like

+
+ +
// Sum.java
+
+public class Sum {
+    public static void main(String[] args) {
+        System.out.println("number of arguments: " + args.length);
+        
+        int sum = 0;
+        for (String argument : args) {
+            sum = sum + argument;
+            System.out.println(argument);
+            System.out.println(sum);
+        }
+        
+        System.out.println(sum);
+    }
+}
+ +
+
+

Seems ok. But let’s test it.

+
+ +
$ javac Sum.java
+Sum.java:9: error: incompatible types: String cannot be converted to int
+            sum = sum + argument;
+                      ^
+1 error
+ +
+
+

We got a compilation error that says String cannot be converted to int. It means that when we try to add 2 variables sum and argument their types don’t match. The type of sum is integer and string for argument. It seems pretty logical because what do we expect when adding for example 1 and apple?..

+
+

Important

+ +
+

So we need to cast argument to integer data type so that we can add it to sum.

+
+
+

We can do so using Integer.parseInt() method.

+

It takes a String s and returns an int, which a string s represents. For example this code will work as expected

+
+ +
// ParseIntExample.java
+
+public class ParseIntExample {
+
+    public static void main(String[] args) {
+        String s = "123";
+        int sum = 321;
+        //! sum = sum + s;
+        sum = sum + Integer.parseInt(s);
+        System.out.println(sum);
+    }
+}
+ +
+
+

The commented out line (//!) would have given us an exception.

+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/prog-intro/index.html b/public/courses/prog-intro/index.html new file mode 100644 index 0000000..728e078 --- /dev/null +++ b/public/courses/prog-intro/index.html @@ -0,0 +1,385 @@ + + + + + + + + + + +Introduction to Programming in Java – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Introduction to Programming in Java

+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/prog-intro/index.xml b/public/courses/prog-intro/index.xml new file mode 100644 index 0000000..1625534 --- /dev/null +++ b/public/courses/prog-intro/index.xml @@ -0,0 +1,44 @@ + + + CodeJava – Introduction to Programming in Java + http://localhost:1313/courses/prog-intro/ + Recent content in Introduction to Programming in Java on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + Homeworks + http://localhost:1313/courses/prog-intro/homeworks/ + Mon, 01 Jan 0001 00:00:00 +0000 + + http://localhost:1313/courses/prog-intro/homeworks/ + + + + + + + + + Lectures + http://localhost:1313/courses/prog-intro/lectures/ + Mon, 01 Jan 0001 00:00:00 +0000 + + http://localhost:1313/courses/prog-intro/lectures/ + + + + + + + + + diff --git a/public/courses/prog-intro/lectures/assets/compilation-process-simplified.svg b/public/courses/prog-intro/lectures/assets/compilation-process-simplified.svg new file mode 100644 index 0000000..9cdda93 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/compilation-process-simplified.svg @@ -0,0 +1,4 @@ + + + +
Compilation
Human-readable text (code)
Machine code
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/compilations-process-simplified.svg b/public/courses/prog-intro/lectures/assets/compilations-process-simplified.svg new file mode 100644 index 0000000..0286ca2 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/compilations-process-simplified.svg @@ -0,0 +1 @@ +
Compilation
Compilation
Human-readable text (code)
Human-readable text (code)
Machine code
Machine code
Text is not SVG - cannot display
diff --git a/public/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg b/public/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg new file mode 100644 index 0000000..76db010 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/cpp-x86-64-compilation.svg @@ -0,0 +1,4 @@ + + + +
C++ Compiler For x86-64 Platform 
С++ Source Code
Assembly
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg b/public/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg new file mode 100644 index 0000000..4c21e36 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/edge-case-for-link-counting.svg @@ -0,0 +1,4 @@ + + + +
A
B
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/int-in-memory.svg b/public/courses/prog-intro/lectures/assets/int-in-memory.svg new file mode 100644 index 0000000..7840001 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/int-in-memory.svg @@ -0,0 +1,4 @@ + + + +
int
4 bytes
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/java-code-compilation.svg b/public/courses/prog-intro/lectures/assets/java-code-compilation.svg new file mode 100644 index 0000000..fc26c64 --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/java-code-compilation.svg @@ -0,0 +1,4 @@ + + + +
Java Source Code
Java Byte Code
JVM
Native Processor
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/string-in-memory.svg b/public/courses/prog-intro/lectures/assets/string-in-memory.svg new file mode 100644 index 0000000..35700ee --- /dev/null +++ b/public/courses/prog-intro/lectures/assets/string-in-memory.svg @@ -0,0 +1,4 @@ + + + +
String
5 => 0x12347865
h
e
l
l
o
0x12347865
\ No newline at end of file diff --git a/public/courses/prog-intro/lectures/assets/tiobe.png b/public/courses/prog-intro/lectures/assets/tiobe.png new file mode 100644 index 0000000..5d144de Binary files /dev/null and b/public/courses/prog-intro/lectures/assets/tiobe.png differ diff --git a/public/courses/prog-intro/lectures/index.html b/public/courses/prog-intro/lectures/index.html new file mode 100644 index 0000000..0eeed66 --- /dev/null +++ b/public/courses/prog-intro/lectures/index.html @@ -0,0 +1,385 @@ + + + + + + + + + + +Lectures – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Lectures

+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/prog-intro/lectures/index.xml b/public/courses/prog-intro/lectures/index.xml new file mode 100644 index 0000000..e3bc101 --- /dev/null +++ b/public/courses/prog-intro/lectures/index.xml @@ -0,0 +1,51 @@ + + + CodeJava – Lectures + http://localhost:1313/courses/prog-intro/lectures/ + Recent content in Lectures on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + Lecture 1. Introduction + http://localhost:1313/courses/prog-intro/lectures/intro/ + Mon, 01 Jan 0001 00:00:00 +0000 + + http://localhost:1313/courses/prog-intro/lectures/intro/ + + + + <h1>Why do we choose Java?</h1><p>According to <strong>TIOBE Programming Community Index</strong> Java is one of the most demanded languages in the programming field.</p> +<p> + <img src="../assets/tiobe.png" alt="TIOBE Programming Community Index" loading="lazy" /> +<em>Img. 1 - TIOBE Programming Community Index</em></p> +<p>Also, Java has a lot of advantages for beginners such as:</p> +<ul> +<li>It&rsquo;s fairly easy</li> +<li>It has a broad spectre of usage +<ul> +<li>Server</li> +<li>Desktop</li> +<li>Mobile devices</li> +<li>Smart-cards</li> +</ul> +</li> +</ul> +<h1>What does Java consist of?</h1><p>Java consists of multiple main components. The first one being the <strong>Java compiler</strong>. The process of converting <em>human-readable</em> text to <em>machine code</em> is called <strong>compilation</strong>.</p> +<p> + <img src="../assets/compilation-process-simplified.svg" alt="Compilation Process Simplified" loading="lazy" /> +<em>Img.2 - Simplified Compilation Process</em></p> + + + + + + diff --git a/public/courses/prog-intro/lectures/intro/index.html b/public/courses/prog-intro/lectures/intro/index.html new file mode 100644 index 0000000..e3b8f1c --- /dev/null +++ b/public/courses/prog-intro/lectures/intro/index.html @@ -0,0 +1,559 @@ + + + + + + + + + + +Lecture 1. Introduction – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+

Lecture 1. Introduction

+
+
+

Why do we choose Java?

According to TIOBE Programming Community Index Java is one of the most demanded languages in the programming field.

+

+ TIOBE Programming Community Index +Img. 1 - TIOBE Programming Community Index

+

Also, Java has a lot of advantages for beginners such as:

+
    +
  • It’s fairly easy
  • +
  • It has a broad spectre of usage +
      +
    • Server
    • +
    • Desktop
    • +
    • Mobile devices
    • +
    • Smart-cards
    • +
    +
  • +
+

What does Java consist of?

Java consists of multiple main components. The first one being the Java compiler. The process of converting human-readable text to machine code is called compilation.

+

+ Compilation Process Simplified +Img.2 - Simplified Compilation Process

+

The behaviour of the Java compiler is described by the Java Language Specification or JLS.

+

Let’s talk about compilers a little bit. For example if we will take C++. If we take C++ compiler for x86-64 platform and Windows operating system, and launch the compiler on source code it will turn it directly into assembly code.

+

+ C++ code compilation under x86-64 +Img. X – C++ code compilation process under x86-64 architecture.

+

But what if I want to run my program on Linux instead of Windows. I will need to take a different compiler under different operating system and recompile my code using a new compiler. It’s not very convenient.

+

Java tries to protect us from that. By converting the Java source code into Java byte code. And then the byte code will be ran on the Java virtual machine which will run our program on the native processor.

+

+ Java code compilation +Img. X – Java code compilation

+

This approach allows to change only JVM according to our platform (x86_64, ARM, …) and operating system (Windows, MacOS, GNU-Linux, …) while byte code stays the same. We can only write our code once, than compile it and run under everywhere.

+

As the motto says:

+
+

Write once – debug run everywhere.

+ +
+

The third component of Java is the standart library which is included in the JVM.

+

There are multiple redactions of Java-platforms:

+
    +
  • Standart edition +
      +
    • For regular aplications
    • +
    +
  • +
  • Enterprise edition +
      +
    • For server aplications
    • +
    +
  • +
  • Micro-edition +
      +
    • For mobile aplications
    • +
    • Isn’t in use nowadays 🪦
    • +
    +
  • +
  • Java Card +
      +
    • Sim- and smart-cards
    • +
    +
  • +
+

There also were multiple versions of Java throughout its history.

+
    +
  • JDK 1.0 (Jan 1996)
  • +
  • J2SE 1.2 (Dec 1998) +
      +
    • Collections Framework
    • +
    +
  • +
  • J2SE 5.0 (Sep 2004) +
      +
    • Generics
    • +
    +
  • +
  • Java SE 8 (Mar 2014) +
      +
    • Streams and Lambdas
    • +
    +
  • +
  • Java SE 9 (Sep 2017) +
      +
    • Modules
    • +
    +
  • +
  • Java SE 10 (Mar 2018) +
      +
    • var
    • +
    +
  • +
  • Java 11 (Sep 2018) +
      +
    • jshell
    • +
    +
  • +
  • Java 17 [LTS-old] (Sep 2021) +
      +
    • Previous stable version
    • +
    • Many little changes
    • +
    +
  • +
  • Java 21 [LTS] (Sep 2023) +
      +
    • Current stable version
    • +
    +
  • +
  • Java 25 (Sep 2025) +
      +
    • Next version
    • +
    +
  • +
+

Java comes in two parts: JDK - Java Development Kit and JVM - Java Virtual Machine.

+

There is also a JRE - Java Runtime Environment. For example if we want to run our code somewhere on the server we don’t need to compile it there because we have our byte code and we just need JRE to run it.

+

Some of the most popular JVMs right now are:

+
    +
  • OpenJDK
  • +
  • Eclipse
  • +
  • Azul Systems
  • +
  • Excelsior JET
  • +
+

The disadvantage of such system is in the connection between JVM and a native processing unit. In case of C++ compiler that we reviewed earlier the source code is compiled directly into machine-code but in case with Java it is compiled into byte-code. And so the problem is to develop such a JVM that would quickly turn our byte-code into machine-code. Anyway it takes extra time. That’s why it mostly will be slower than direct compilation into machine-code. So ultimately while we have the advantage of compiling out code only once, we have the disadvantage of turning byte-code into machine-code slower.

+

None the less, there is a way to speed up this process which is called JIT - Just In Time compilation. How does it work? While our program is running some of the instructions or functions turns directly into processor commands.

+

What is garbage collection?

For example we have int which is represented with 4 bytes of data which is directly stored in memory.

+

+ int in memory +Img. X – int in memory

+

But what if we have a String. How many memory cells does this string take? We don’t know. We will say that our String that has length of 5 symbols is stored at 0x12347865. We defined an address where this string is located in memory. And somewhere in the memory of our programm will be a large buffer where the 5 cells will be stored.

+

+ String in memory +Img. X – String in memory

+

But what do we do with that buffer? We won’t need it forever and so sometimes we need to clear that buffer. In case with C/C++ whoever created the memory for that string is in charge of clearing it. There are also languages with garbage collection such as Java and Python. The purpose of the Garbage Collector is to automatically find variables that we no longer need and clear their memory.

+

Suppose we have some code like this.

+
+ +
if (someCondition) { 
+    x = [1, 3, 7] // first link 
+    // some code here 
+    y = x // second link 
+    // some code here 
+} // no links
+ +
+
+

After the if-statement we no longer need x or y. Every variable in this case x and y is the link to our array ([1, 3, 7]). After we left the if-statement the amount of links to the array is zero, so we can safely delete the array. This approach is implemented in Python. The problem is that if we have to objects linked to one another and there are no external links, they will not be deleted by garbage collector since there link counter is 1.

+

+ Edge case for link couting +Img. X – Edge case for link counting

+

The advanced way of implementing the garbage collection is traversing the graph of links which is implemented in Java, C# and Go.

+

What other advantages does Java have?

    +
  • It’s easy (in terms of syntax)
  • +
  • It’s secure and stable
  • +
  • It supports Unicode
  • +
  • It supports multithreading
  • +
  • It has backwards compatibility
  • +
+

How should Java code look like?

You can go and learn about it here.

+ +
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/prog-intro/lectures/tiobe.png b/public/courses/prog-intro/lectures/tiobe.png new file mode 100644 index 0000000..5d144de Binary files /dev/null and b/public/courses/prog-intro/lectures/tiobe.png differ diff --git a/public/courses/prog-intro/tiobe.png b/public/courses/prog-intro/tiobe.png new file mode 100644 index 0000000..5d144de Binary files /dev/null and b/public/courses/prog-intro/tiobe.png differ diff --git a/public/courses/spring-boot/assets/Untitled Diagram.drawio.svg b/public/courses/spring-boot/assets/Untitled Diagram.drawio.svg new file mode 100644 index 0000000..8e50dcb --- /dev/null +++ b/public/courses/spring-boot/assets/Untitled Diagram.drawio.svg @@ -0,0 +1,4 @@ + + + +
Spring Boot
Spring Framework
Spring Batch
Spring Integration
Spring Data
Spring Security
Spring Cloud
Spring Shell
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/dependency-injection.svg b/public/courses/spring-boot/assets/dependency-injection.svg new file mode 100644 index 0000000..a4e6341 --- /dev/null +++ b/public/courses/spring-boot/assets/dependency-injection.svg @@ -0,0 +1,4 @@ + + + +
OrderService
PaymentService
<<interface>>
Stripe
PayPal
<<class>>
<<class>>
Dependency Injection
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/depends-on-coupled-to.svg b/public/courses/spring-boot/assets/depends-on-coupled-to.svg new file mode 100644 index 0000000..e11d6b5 --- /dev/null +++ b/public/courses/spring-boot/assets/depends-on-coupled-to.svg @@ -0,0 +1,4 @@ + + + +
OrderService
StripePaymentService
Depends On
Coupled To
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/hello-world b/public/courses/spring-boot/assets/hello-world new file mode 100644 index 0000000..7a9725d Binary files /dev/null and b/public/courses/spring-boot/assets/hello-world differ diff --git a/public/courses/spring-boot/assets/hello-world.png b/public/courses/spring-boot/assets/hello-world.png new file mode 100644 index 0000000..7a9725d Binary files /dev/null and b/public/courses/spring-boot/assets/hello-world.png differ diff --git a/public/courses/spring-boot/assets/layers.svg b/public/courses/spring-boot/assets/layers.svg new file mode 100644 index 0000000..2eb13c7 --- /dev/null +++ b/public/courses/spring-boot/assets/layers.svg @@ -0,0 +1,4 @@ + + + +
Web
Data
AOP
Core
Test
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/payment-service-as-interface.svg b/public/courses/spring-boot/assets/payment-service-as-interface.svg new file mode 100644 index 0000000..c70e4ff --- /dev/null +++ b/public/courses/spring-boot/assets/payment-service-as-interface.svg @@ -0,0 +1,4 @@ + + + +
OrderService
PaymentService
<<interface>>
Stripe
PayPal
<<class>>
<<class>>
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/restaurant-chef-dependency.svg b/public/courses/spring-boot/assets/restaurant-chef-dependency.svg new file mode 100644 index 0000000..f9e814f --- /dev/null +++ b/public/courses/spring-boot/assets/restaurant-chef-dependency.svg @@ -0,0 +1,4 @@ + + + +
Restaurant
Chef
Normal
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/restaurant-john-dependency.svg b/public/courses/spring-boot/assets/restaurant-john-dependency.svg new file mode 100644 index 0000000..1451100 --- /dev/null +++ b/public/courses/spring-boot/assets/restaurant-john-dependency.svg @@ -0,0 +1,4 @@ + + + +
Restaurant
John
Bad coupling
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/scheme.svg b/public/courses/spring-boot/assets/scheme.svg new file mode 100644 index 0000000..1f82a6b --- /dev/null +++ b/public/courses/spring-boot/assets/scheme.svg @@ -0,0 +1,4 @@ + + + +
OrderService
StripePaymentService
Depends On
Coupled To
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/spring-boot-starter-web.svg b/public/courses/spring-boot/assets/spring-boot-starter-web.svg new file mode 100644 index 0000000..69bf952 --- /dev/null +++ b/public/courses/spring-boot/assets/spring-boot-starter-web.svg @@ -0,0 +1,4 @@ + + + +
tomcat
web
webmvc
jackson
logging
spring-boot-starter-web
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/spring-ecosystem.svg b/public/courses/spring-boot/assets/spring-ecosystem.svg new file mode 100644 index 0000000..8e50dcb --- /dev/null +++ b/public/courses/spring-boot/assets/spring-ecosystem.svg @@ -0,0 +1,4 @@ + + + +
Spring Boot
Spring Framework
Spring Batch
Spring Integration
Spring Data
Spring Security
Spring Cloud
Spring Shell
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/spring-layers.svg b/public/courses/spring-boot/assets/spring-layers.svg new file mode 100644 index 0000000..2eb13c7 --- /dev/null +++ b/public/courses/spring-boot/assets/spring-layers.svg @@ -0,0 +1,4 @@ + + + +
Web
Data
AOP
Core
Test
\ No newline at end of file diff --git a/public/courses/spring-boot/assets/spring-modules.svg b/public/courses/spring-boot/assets/spring-modules.svg new file mode 100644 index 0000000..c49808d --- /dev/null +++ b/public/courses/spring-boot/assets/spring-modules.svg @@ -0,0 +1 @@ +
Web
Web
Data
Data
AOP
AOP
CORE
CORE
TEST
TEST
Text is not SVG - cannot display
diff --git a/public/courses/spring-boot/assets/spring-project-init.png b/public/courses/spring-boot/assets/spring-project-init.png new file mode 100644 index 0000000..37fc1a7 Binary files /dev/null and b/public/courses/spring-boot/assets/spring-project-init.png differ diff --git a/public/courses/spring-boot/index.html b/public/courses/spring-boot/index.html new file mode 100644 index 0000000..500d051 --- /dev/null +++ b/public/courses/spring-boot/index.html @@ -0,0 +1,1283 @@ + + + + + + + + + + +CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + +
+
+ +
+ +

Prerequisites

Before diving in, make sure you’re comfortable with the following:

+
    +
  • Java — solid understanding of the language
  • +
  • Object-oriented programming — classes, methods and interfaces
  • +
  • Databases — tables, primary keys, foreign keys, relationships, etc.
  • +
  • SQL — ability to write basic SQL statements
  • +
+
+

What is a Spring Framework?

Spring is a popular framework for building Java applications. It has a lot of modules, each designed to handle a specific task. They are combined into a few different layers.

+

Spring layers +Img. 1 — Spring layers

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LayerPurpose
CoreHandling dependency injection, managing objects
WebBuilding web applications
DataWorking with databases
AOPAspect oriented programming
TestTesting spring components
+
+

While the Spring Framework is powerful, using it often involves a lot of configuration. For example, if you want to build a web app you might need to setup a web server, configure routing and manage dependencies manually. That’s when Spring Boot comes in.

+
+

Note

+ +
+

You can think of Spring Boot as a layer on top of the Spring Framework that takes care of all of the setup. Spring Boot simplifies Spring development by providing sensible defaults and ready-to-use features.

+
+
+

By the way, the Spring Framework is just one part of a larger family of projects in the Spring ecosystem.

+

Spring ecosystem +Img. 2 — Spring ecosystem

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Module NamePurpose
Spring DataSimplifying database access
Spring SecurityAdding authentication and authorization
Spring BatchBatch processing
Spring CloudBuilding microservices and distributed systems
Spring IntegrationSimplifying messaging and integration between systems
+
+

Initialize Spring Boot Project

To initialize a new Spring Boot project, go to start.spring.io and select the options that suit you.

+

Spring Options +Img. 3 — Spring Boot options

+

After unpacking the zip archive, you’ll have this template project:

+
+ +
.
+├── HELP.md
+├── mvnw
+├── mvnw.cmd
+├── pom.xml
+├── src
+│   ├── main
+│   │   ├── java
+│   │   │   └── tech
+│   │   │       └── codejava
+│   │   │           └── store
+│   │   │               └── StoreApplication.java
+│   │   └── resources
+│   │       └── application.properties
+│   └── test
+│       └── java
+│           └── tech
+│               └── codejava
+│                   └── store
+│                       └── StoreApplicationTests.java
+└── target
+    ├── classes
+    │   ├── application.properties
+    │   └── tech
+    │       └── codejava
+    │           └── store
+    │               └── StoreApplication.class
+    ├── generated-sources
+    │   └── annotations
+    ├── generated-test-sources
+    │   └── test-annotations
+    ├── maven-status
+    │   └── maven-compiler-plugin
+    │       ├── compile
+    │       │   └── default-compile
+    │       │       ├── createdFiles.lst
+    │       │       └── inputFiles.lst
+    │       └── testCompile
+    │           └── default-testCompile
+    │               ├── createdFiles.lst
+    │               └── inputFiles.lst
+    ├── surefire-reports
+    │   ├── TEST-tech.codejava.store.StoreApplicationTests.xml
+    │   └── tech.codejava.store.StoreApplicationTests.txt
+    └── test-classes
+        └── tech
+            └── codejava
+                └── store
+                    └── StoreApplicationTests.class
+ +
+
+

The “heart” of our project is pom.xml:

+
+ +
<?xml version="1.0" encoding="UTF-8" ?>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>4.0.2</version>
+        <relativePath /> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>tech.codejava</groupId>
+    <artifactId>store</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>store</name>
+    <description>Store</description>
+    <url />
+    <licenses>
+        <license />
+    </licenses>
+    <developers>
+        <developer />
+    </developers>
+    <scm>
+        <connection />
+        <developerConnection />
+        <tag />
+        <url />
+    </scm>
+    <properties>
+        <java.version>21</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
+ +
+
+

Maven uses this file to download dependencies and build our project.

+

In the src folder we have the actual code:

+
+ +
src
+├── main
+│   ├── java
+│   │   └── tech
+│   │       └── codejava
+│   │           └── store
+│   │               └── StoreApplication.java
+│   └── resources
+│       └── application.properties
+└── test
+    └── java
+        └── tech
+            └── codejava
+                └── store
+                    └── StoreApplicationTests.java
+ +
+
+

StoreApplication.java is the entry point to our application:

+
+ +
package tech.codejava.store;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class StoreApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(StoreApplication.class, args);
+    }
+
+}
+ +
+
+

In the main method we have a call to SpringApplication.run.

+

Running mvn clean install from the root of our project gives us this result (output partially reduced):

+
+ +
...
+[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.542 s -- in tech.codejava.store.StoreApplicationTests
+[INFO]
+[INFO] Results:
+[INFO]
+[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+[INFO]
+[INFO]
+[INFO] --- jar:3.4.2:jar (default-jar) @ store ---
+[INFO] Building jar: /home/fymio/store/target/store-0.0.1-SNAPSHOT.jar
+[INFO]
+[INFO] --- spring-boot:4.0.2:repackage (repackage) @ store ---
+...
+[INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time:  14.787 s
+[INFO] Finished at: 2026-02-19T13:16:47+03:00
+[INFO] ------------------------------------------------------------------------
+ +
+
+

Our application built without errors.

+
+

Dependency Management

Dependencies are third-party libraries or frameworks we use in our application. For example, to build a web application we need an embedded web server like Tomcat, libraries for handling web requests, building APIs, processing JSON data, logging and so on.

+

In Spring Boot applications, instead of adding multiple individual libraries, we can use a starter dependency.

+

Spring Boot Starter Web +Img. 5 — Spring Boot Starter Web

+

To use this dependency, copy the following into your pom.xml:

+
+ +
<dependency>
+    <groupId>org.springframework.boot</groupId>
+    <artifactId>spring-boot-starter-web</artifactId>
+    <version>4.1.0-M1</version>
+</dependency>
+ +
+
+

So the dependencies section would look like this:

+
+ +
<dependencies>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-test</artifactId>
+        <scope>test</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        <!-- <version>4.1.0-M1</version> -->
+    </dependency>
+</dependencies>
+ +
+
+
+

Important

+ +
+

Notice that the version is commented out. It’s a better practice to let Spring Boot decide what version of the dependency to use, as it ensures compatibility across your project.

+
+
+
+

Controllers

Spring MVC stands for Model View Controller.

+
    +
  • Model is where our application’s data lives. It represents the business logic and is usually connected to a database or other data sources. In Spring Boot, the model can be a simple Java class.
  • +
  • View is what the user sees. It’s the HTML, CSS or JavaScript rendered in the browser. In Spring MVC, views can be static files or dynamically generated.
  • +
  • Controller is like a traffic controller. It handles incoming requests from the user, interacts with the model to get data and then tells the view what to display.
  • +
+

Let’s add a new Java class called HomeController at src/main/java/tech/codejava/store/HomeController.java:

+
+ +
package tech.codejava.store;
+
+public class HomeController {}
+ +
+
+

To make this a controller, decorate it with the @Controller annotation:

+
+ +
package tech.codejava.store;
+
+import org.springframework.stereotype.Controller;
+
+@Controller
+public class HomeController {}
+ +
+
+

Now let’s add an index method. When we send a request to the root of our website, we want this method to be called:

+
+ +
package tech.codejava.store;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+public class HomeController {
+
+    @RequestMapping("/") // this represents the root of our website
+    public String index() {
+        return "index.html"; // this returns the view
+    }
+}
+ +
+
+

Now we need to create the view. Add index.html at src/main/resources/static/index.html:

+
+ +
<!doctype html>
+<html lang="en">
+    <head>
+        <meta charset="UTF-8" />
+        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+        <title>View</title>
+    </head>
+    <body>
+        <h1>Hello world!</h1>
+    </body>
+</html>
+ +
+
+

Let’s build and run our application using mvn spring-boot:run. From the logs:

+
+ +
2026-02-19T14:55:23.948+03:00  INFO 36752 --- [store] [           main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
+ +
+
+

Our app is up and running at localhost:8080.

+

Hello world! +Img. 7 — Our app is up and running!

+
+

Configuring Application Properties

Let’s take a look at src/main/resources/application.properties:

+
+ +
spring.application.name=store
+ +
+
+

To use this property in our code, we can use the @Value annotation. Let’s update HomeController to print the application name:

+
+ +
package tech.codejava.store;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+public class HomeController {
+
+    @Value("${spring.application.name}")
+    private String appName;
+
+    @RequestMapping("/") // this represents the root of our website
+    public String index() {
+        System.out.println("application name = " + appName);
+        return "index.html"; // this returns the view
+    }
+}
+ +
+
+

After running the application, we can see store printed in the terminal:

+
+ +
...
+2026-02-19T15:32:37.507+03:00  INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
+2026-02-19T15:32:37.509+03:00  INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
+application name = store
+...
+ +
+
+
+

Dependency Injection

Imagine we’re building an E-Commerce application that handles placing orders. When an order is placed, the customer’s payment needs to be processed — so OrderService depends on a payment service like StripePaymentService. We can say that OrderService is dependent on (or coupled to) StripePaymentService.

+

Depends on/Coupled to relation +Img. 8 — Depends On/Coupled To relation

+

Let’s talk about the issues that arise when one class is tightly coupled to another.

+
    +
  1. InflexibilityOrderService can only use StripePaymentService. If tomorrow we decide to switch to a different payment provider like PayPal, we would have to modify OrderService. Once we change it, it has to be recompiled and retested, which could impact other classes that depend on it.
  2. +
  3. Untestability — We cannot test OrderService in isolation, because OrderService is tightly coupled with StripePaymentService and we can’t test its logic separately from it.
  4. +
+
+

Note

+ +
+

The problem here isn’t that OrderService depends on StripePaymentService — dependencies are normal in any application. The issue is about how the dependency is created and managed.

+
+
+

Analogy: Think of a restaurant. A restaurant needs a chef — that’s a perfectly normal dependency. If the current chef becomes unavailable, the restaurant can hire another one.

+

Restaurant — Chef dependency +Img. X — Restaurant — Chef dependency (Normal)

+

Now what if we replace “chef” with a specific person: John? Our restaurant is now dependent on John specifically. If John becomes unavailable, we can’t replace him — the restaurant is in trouble. This is an example of tight or bad coupling.

+

Restaurant — John dependency +Img. X — Restaurant — John dependency (Bad coupling)

+

We don’t want OrderService to be tightly coupled to a specific payment service like Stripe. Instead, we want it to depend on a PaymentService interface, which could be Stripe, PayPal, or any other provider. To achieve this we can use the interface to decouple OrderService from StripePaymentService.

+

Payment Service as interface +Img. X — PaymentService as interface

+

If OrderService depends on a PaymentService interface, it doesn’t know anything about Stripe, PayPal, or any other payment provider. As long as these providers implement PaymentService, they can be used to handle payments — and OrderService won’t care which one is being used.

+

Benefits:

+
    +
  1. If we replace StripePaymentService with PayPalPaymentService, the OrderService class is not affected.
  2. +
  3. We don’t need to modify or recompile OrderService.
  4. +
  5. We can test OrderService in isolation, without relying on the specific payment provider like Stripe.
  6. +
+

With this setup, we simply give OrderService a particular implementation of PaymentService. This is called dependency injection — we inject the dependency into a class.

+

Dependency Injection example +Img. X — Dependency Injection example

+

Let’s see how it works in our project. Create OrderService at src/main/java/tech/codejava/store/OrderService.java:

+
+ +
package tech.codejava.store;
+
+public class OrderService {
+
+    public void placeOrder() {}
+}
+ +
+
+
+

Note

+ +
+

In a real project we would need to provide something like Order order to this method, but for teaching purposes we won’t do that.

+
+
+

Now create StripePaymentService in the same directory:

+
+ +
package tech.codejava.store;
+
+public class StripePaymentService {
+
+    public void processPayment(double amount) {
+        System.out.println("=== STRIPE ===");
+        System.out.println("amount: " + amount);
+    }
+}
+ +
+
+

Let’s implement placeOrder in OrderService using StripePaymentService:

+
+ +
package tech.codejava.store;
+
+public class OrderService {
+
+    public void placeOrder() {
+        var paymentService = new StripePaymentService();
+        paymentService.processPayment(10);
+    }
+}
+ +
+
+
+

Important

+ +
+

This is our before setup — before we introduced the interface. In this implementation, OrderService is tightly coupled to StripePaymentService. We cannot test OrderService in isolation, and switching to another payment provider would require modifying OrderService.

+
+
+

Let’s fix this. Create a PaymentService interface in the same directory:

+
+ +
package tech.codejava.store;
+
+public interface PaymentService {
+    void processPayment(double amount);
+}
+ +
+
+

Modify StripePaymentService to implement PaymentService:

+
+ +
package tech.codejava.store;
+
+public class StripePaymentService implements PaymentService {
+
+    @Override
+    public void processPayment(double amount) {
+        System.out.println("=== STRIPE ===");
+        System.out.println("amount: " + amount);
+    }
+}
+ +
+
+

The recommended way to inject a dependency into a class is via its constructor. Let’s define one in OrderService:

+
+ +
package tech.codejava.store;
+
+public class OrderService {
+
+    private PaymentService paymentService;
+
+    public OrderService(PaymentService paymentService) {
+        this.paymentService = paymentService;
+    }
+
+    public void placeOrder() {
+        paymentService.processPayment(10);
+    }
+}
+ +
+
+

Now let’s see this in action. Modify StoreApplication:

+
+ +
package tech.codejava.store;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class StoreApplication {
+
+    public static void main(String[] args) {
+        // SpringApplication.run(StoreApplication.class, args);
+
+        var orderService = new OrderService(new StripePaymentService());
+        orderService.placeOrder();
+    }
+}
+ +
+
+

Running the application (output intentionally reduced):

+
+ +
...
+=== STRIPE ===
+amount: 10.0
+...
+ +
+
+

Now let’s create a PayPalPaymentService in the same directory:

+
+ +
package tech.codejava.store;
+
+public class PayPalPaymentService implements PaymentService {
+
+    @Override
+    public void processPayment(double amount) {
+        System.out.println("=== PayPal ===");
+        System.out.println("amount: " + amount);
+    }
+}
+ +
+
+

Now we can switch from StripePaymentService to PayPalPaymentService in StoreApplication — without touching OrderService at all:

+
+ +
package tech.codejava.store;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class StoreApplication {
+
+    public static void main(String[] args) {
+        // SpringApplication.run(StoreApplication.class, args);
+
+        // var orderService = new OrderService(new StripePaymentService());
+        var orderService = new OrderService(new PayPalPaymentService());
+        orderService.placeOrder();
+    }
+}
+ +
+
+
+ +
...
+=== PayPal ===
+amount: 10.0
+...
+ +
+
+

Notice that we didn’t change OrderService. In object-oriented programming this is known as the Open/Closed Principle:

+
+

A class should be open for extension and closed for modification.

+ +
+

In other words: we should be able to add new functionality to a class without changing its existing code. This reduces the risk of introducing bugs and breaking other parts of the application.

+
+

Setter Injection +

Another way to inject a dependency is via a setter. In OrderService, let’s define one:

+
+ +
package tech.codejava.store;
+
+public class OrderService {
+
+    private PaymentService paymentService;
+
+    public void setPaymentService(PaymentService paymentService) {
+        this.paymentService = paymentService;
+    }
+
+    public OrderService(PaymentService paymentService) {
+        this.paymentService = paymentService;
+    }
+
+    public void placeOrder() {
+        paymentService.processPayment(10);
+    }
+}
+ +
+
+

We can use it like this in StoreApplication:

+
+ +
package tech.codejava.store;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class StoreApplication {
+
+    public static void main(String[] args) {
+        // SpringApplication.run(StoreApplication.class, args);
+
+        // var orderService = new OrderService(new StripePaymentService());
+        var orderService = new OrderService(new PayPalPaymentService());
+        orderService.setPaymentService(new PayPalPaymentService());
+        orderService.placeOrder();
+    }
+}
+ +
+
+
+

Important

+ +
+

If you remove the constructor from OrderService and forget to call the setter, the application will crash with a NullPointerException. Use setter injection only for optional dependencies — ones that OrderService can function without.

+
+
+ +
+
+
+ +
+
+
+ + + + + + + + diff --git a/public/courses/spring-boot/index.xml b/public/courses/spring-boot/index.xml new file mode 100644 index 0000000..14b878c --- /dev/null +++ b/public/courses/spring-boot/index.xml @@ -0,0 +1,18 @@ + + + CodeJava – + http://localhost:1313/courses/spring-boot/ + Recent content on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + + diff --git a/public/css/compiled/main.css b/public/css/compiled/main.css new file mode 100644 index 0000000..44333b9 --- /dev/null +++ b/public/css/compiled/main.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--hx-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--hx-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--hx-color-red-100:oklch(93.6% .032 17.717);--hx-color-red-200:oklch(88.5% .062 18.334);--hx-color-red-900:oklch(39.6% .141 25.723);--hx-color-orange-50:oklch(98% .016 73.684);--hx-color-orange-100:oklch(95.4% .038 75.164);--hx-color-orange-300:oklch(83.7% .128 66.29);--hx-color-orange-400:oklch(75% .183 55.934);--hx-color-orange-800:oklch(47% .157 37.304);--hx-color-amber-100:oklch(96.2% .059 95.617);--hx-color-amber-200:oklch(92.4% .12 95.746);--hx-color-amber-900:oklch(41.4% .112 45.904);--hx-color-yellow-50:oklch(98.7% .026 102.212);--hx-color-yellow-100:oklch(97.3% .071 103.193);--hx-color-yellow-200:oklch(94.5% .129 101.54);--hx-color-yellow-700:oklch(55.4% .135 66.442);--hx-color-yellow-900:oklch(42.1% .095 57.708);--hx-color-green-100:oklch(96.2% .044 156.743);--hx-color-green-200:oklch(92.5% .084 155.995);--hx-color-green-900:oklch(39.3% .095 152.535);--hx-color-blue-100:oklch(93.2% .032 255.585);--hx-color-blue-200:oklch(88.2% .059 254.128);--hx-color-blue-900:oklch(37.9% .146 265.522);--hx-color-indigo-100:oklch(93% .034 272.788);--hx-color-indigo-200:oklch(87% .065 274.039);--hx-color-indigo-900:oklch(35.9% .144 278.697);--hx-color-purple-100:oklch(94.6% .033 307.174);--hx-color-purple-200:oklch(90.2% .063 306.703);--hx-color-purple-900:oklch(38.1% .176 304.987);--hx-color-slate-50:oklch(98.4% .003 247.858);--hx-color-slate-100:oklch(96.8% .007 247.896);--hx-color-slate-900:oklch(20.8% .042 265.755);--hx-color-gray-50:oklch(98.5% .002 247.839);--hx-color-gray-100:oklch(96.7% .003 264.542);--hx-color-gray-200:oklch(92.8% .006 264.531);--hx-color-gray-300:oklch(87.2% .01 258.338);--hx-color-gray-400:oklch(70.7% .022 261.325);--hx-color-gray-500:oklch(55.1% .027 264.364);--hx-color-gray-600:oklch(44.6% .03 256.802);--hx-color-gray-700:oklch(37.3% .034 259.733);--hx-color-gray-800:oklch(27.8% .033 256.848);--hx-color-gray-900:oklch(21% .034 264.665);--hx-color-neutral-50:oklch(98.5% 0 0);--hx-color-neutral-200:oklch(92.2% 0 0);--hx-color-neutral-300:oklch(87% 0 0);--hx-color-neutral-400:oklch(70.8% 0 0);--hx-color-neutral-500:oklch(55.6% 0 0);--hx-color-neutral-600:oklch(43.9% 0 0);--hx-color-neutral-700:oklch(37.1% 0 0);--hx-color-neutral-800:oklch(26.9% 0 0);--hx-color-neutral-900:oklch(20.5% 0 0);--hx-color-black:#000;--hx-color-white:#fff;--hx-spacing:.25rem;--hx-breakpoint-xl:80rem;--hx-container-6xl:72rem;--hx-text-xs:.75rem;--hx-text-xs--line-height:calc(1/.75);--hx-text-sm:.875rem;--hx-text-sm--line-height:calc(1.25/.875);--hx-text-base:1rem;--hx-text-base--line-height:calc(1.5/1);--hx-text-lg:1.125rem;--hx-text-lg--line-height:calc(1.75/1.125);--hx-text-xl:1.25rem;--hx-text-xl--line-height:calc(1.75/1.25);--hx-text-2xl:1.5rem;--hx-text-2xl--line-height:calc(2/1.5);--hx-text-3xl:1.875rem;--hx-text-3xl--line-height:calc(2.25/1.875);--hx-text-4xl:2.25rem;--hx-text-4xl--line-height:calc(2.5/2.25);--hx-text-5xl:3rem;--hx-text-5xl--line-height:1;--hx-font-weight-normal:400;--hx-font-weight-medium:500;--hx-font-weight-semibold:600;--hx-font-weight-bold:700;--hx-font-weight-extrabold:800;--hx-tracking-tighter:-.05em;--hx-tracking-tight:-.025em;--hx-leading-tight:1.25;--hx-radius-xs:.125rem;--hx-radius-sm:.25rem;--hx-radius-md:.375rem;--hx-radius-lg:.5rem;--hx-radius-xl:.75rem;--hx-radius-3xl:1.5rem;--hx-ease-in:cubic-bezier(.4,0,1,1);--hx-ease-out:cubic-bezier(0,0,.2,1);--hx-ease-in-out:cubic-bezier(.4,0,.2,1);--hx-blur-md:12px;--hx-default-transition-duration:.15s;--hx-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--hx-default-font-family:var(--hx-font-sans);--hx-default-mono-font-family:var(--hx-font-mono);--hx-color-primary-50:hsl(var(--primary-hue)var(--primary-saturation)calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness))/50)*47));--hx-color-primary-100:hsl(var(--primary-hue)var(--primary-saturation)calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness))/50)*44));--hx-color-primary-200:hsl(var(--primary-hue)var(--primary-saturation)calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness))/50)*36));--hx-color-primary-300:hsl(var(--primary-hue)var(--primary-saturation)calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness))/50)*27));--hx-color-primary-400:hsl(var(--primary-hue)var(--primary-saturation)calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness))/50)*16));--hx-color-primary-500:hsl(var(--primary-hue)var(--primary-saturation)var(--primary-lightness));--hx-color-primary-600:hsl(var(--primary-hue)var(--primary-saturation)calc(calc(var(--primary-lightness)/50)*45));--hx-color-primary-700:hsl(var(--primary-hue)var(--primary-saturation)calc(calc(var(--primary-lightness)/50)*39));--hx-color-primary-800:hsl(var(--primary-hue)var(--primary-saturation)calc(calc(var(--primary-lightness)/50)*32));--hx-color-primary-900:hsl(var(--primary-hue)var(--primary-saturation)calc(calc(var(--primary-lightness)/50)*24));--hx-color-dark:#111}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--hx-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--hx-default-font-feature-settings,normal);font-variation-settings:var(--hx-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--hx-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--hx-default-mono-font-feature-settings,normal);font-variation-settings:var(--hx-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.hx\:pointer-events-none{pointer-events:none}.hx\:sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.hx\:absolute{position:absolute}.hx\:relative{position:relative}.hx\:sticky{position:sticky}.hx\:inset-x-0{inset-inline:calc(var(--hx-spacing)*0)}.hx\:inset-y-0{inset-block:calc(var(--hx-spacing)*0)}.hx\:top-0{top:calc(var(--hx-spacing)*0)}.hx\:top-8{top:calc(var(--hx-spacing)*8)}.hx\:top-16{top:calc(var(--hx-spacing)*16)}.hx\:top-\[40\%\]{top:40%}.hx\:top-full{top:100%}.hx\:right-0{right:calc(var(--hx-spacing)*0)}.hx\:bottom-0{bottom:calc(var(--hx-spacing)*0)}.hx\:left-\[24px\]{left:24px}.hx\:left-\[36px\]{left:36px}.hx\:z-20{z-index:20}.hx\:z-\[-1\]{z-index:-1}.hx\:order-last{order:9999}.hx\:m-\[11px\]{margin:11px}.hx\:mx-1{margin-inline:calc(var(--hx-spacing)*1)}.hx\:mx-4{margin-inline:calc(var(--hx-spacing)*4)}.hx\:mx-auto{margin-inline:auto}.hx\:my-1\.5{margin-block:calc(var(--hx-spacing)*1.5)}.hx\:my-2{margin-block:calc(var(--hx-spacing)*2)}.hx\:-mt-20{margin-top:calc(var(--hx-spacing)*-20)}.hx\:mt-1{margin-top:calc(var(--hx-spacing)*1)}.hx\:mt-1\.5{margin-top:calc(var(--hx-spacing)*1.5)}.hx\:mt-2{margin-top:calc(var(--hx-spacing)*2)}.hx\:mt-4{margin-top:calc(var(--hx-spacing)*4)}.hx\:mt-5{margin-top:calc(var(--hx-spacing)*5)}.hx\:mt-6{margin-top:calc(var(--hx-spacing)*6)}.hx\:mt-8{margin-top:calc(var(--hx-spacing)*8)}.hx\:mt-12{margin-top:calc(var(--hx-spacing)*12)}.hx\:mt-16{margin-top:calc(var(--hx-spacing)*16)}.hx\:-mr-2{margin-right:calc(var(--hx-spacing)*-2)}.hx\:mr-1{margin-right:calc(var(--hx-spacing)*1)}.hx\:mr-2{margin-right:calc(var(--hx-spacing)*2)}.hx\:-mb-0\.5{margin-bottom:calc(var(--hx-spacing)*-.5)}.hx\:mb-2{margin-bottom:calc(var(--hx-spacing)*2)}.hx\:mb-4{margin-bottom:calc(var(--hx-spacing)*4)}.hx\:mb-6{margin-bottom:calc(var(--hx-spacing)*6)}.hx\:mb-8{margin-bottom:calc(var(--hx-spacing)*8)}.hx\:mb-10{margin-bottom:calc(var(--hx-spacing)*10)}.hx\:mb-12{margin-bottom:calc(var(--hx-spacing)*12)}.hx\:mb-16{margin-bottom:calc(var(--hx-spacing)*16)}.hx\:-ml-2{margin-left:calc(var(--hx-spacing)*-2)}.hx\:ml-4{margin-left:calc(var(--hx-spacing)*4)}.hx\:line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.hx\:block{display:block}.hx\:flex{display:flex}.hx\:grid{display:grid}.hx\:hidden{display:none}.hx\:inline{display:inline}.hx\:inline-block{display:inline-block}.hx\:inline-flex{display:inline-flex}.hx\:aspect-auto{aspect-ratio:auto}.hx\:h-0{height:calc(var(--hx-spacing)*0)}.hx\:h-2{height:calc(var(--hx-spacing)*2)}.hx\:h-3\.5{height:calc(var(--hx-spacing)*3.5)}.hx\:h-4{height:calc(var(--hx-spacing)*4)}.hx\:h-5{height:calc(var(--hx-spacing)*5)}.hx\:h-7{height:calc(var(--hx-spacing)*7)}.hx\:h-10{height:calc(var(--hx-spacing)*10)}.hx\:h-16{height:calc(var(--hx-spacing)*16)}.hx\:h-\[18px\]{height:18px}.hx\:h-full{height:100%}.hx\:max-h-\(--menu-height\){max-height:var(--menu-height)}.hx\:max-h-64{max-height:calc(var(--hx-spacing)*64)}.hx\:max-h-\[calc\(100vh-var\(--navbar-height\)-env\(safe-area-inset-bottom\)\)\]{max-height:calc(100vh - var(--navbar-height) - env(safe-area-inset-bottom))}.hx\:max-h-\[min\(calc\(50vh-11rem-env\(safe-area-inset-bottom\)\)\,400px\)\]{max-height:min(calc(50vh - 11rem - env(safe-area-inset-bottom)),400px)}.hx\:min-h-\[100px\]{min-height:100px}.hx\:min-h-\[calc\(100vh-var\(--navbar-height\)\)\]{min-height:calc(100vh - var(--navbar-height))}.hx\:w-2{width:calc(var(--hx-spacing)*2)}.hx\:w-3\.5{width:calc(var(--hx-spacing)*3.5)}.hx\:w-4{width:calc(var(--hx-spacing)*4)}.hx\:w-10{width:calc(var(--hx-spacing)*10)}.hx\:w-64{width:calc(var(--hx-spacing)*64)}.hx\:w-\[110\%\]{width:110%}.hx\:w-\[180\%\]{width:180%}.hx\:w-full{width:100%}.hx\:w-max{width:max-content}.hx\:w-screen{width:100vw}.hx\:max-w-6xl{max-width:var(--hx-container-6xl)}.hx\:max-w-\[50\%\]{max-width:50%}.hx\:max-w-\[90rem\]{max-width:90rem}.hx\:max-w-\[min\(calc\(100vw-2rem\)\,calc\(100\%\+20rem\)\)\]{max-width:min(100vw - 2rem,100% + 20rem)}.hx\:max-w-full{max-width:100%}.hx\:max-w-none{max-width:none}.hx\:max-w-screen-xl{max-width:var(--hx-breakpoint-xl)}.hx\:min-w-0{min-width:calc(var(--hx-spacing)*0)}.hx\:min-w-\[18px\]{min-width:18px}.hx\:min-w-\[24px\]{min-width:24px}.hx\:min-w-full{min-width:100%}.hx\:shrink-0{flex-shrink:0}.hx\:grow{flex-grow:1}.hx\:origin-center{transform-origin:50%}.hx\:cursor-default{cursor:default}.hx\:cursor-pointer{cursor:pointer}.hx\:scroll-my-6{scroll-margin-block:calc(var(--hx-spacing)*6)}.hx\:scroll-py-6{scroll-padding-block:calc(var(--hx-spacing)*6)}.hx\:list-none{list-style-type:none}.hx\:appearance-none{appearance:none}.hx\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.hx\:flex-col{flex-direction:column}.hx\:flex-wrap{flex-wrap:wrap}.hx\:items-center{align-items:center}.hx\:items-start{align-items:flex-start}.hx\:justify-between{justify-content:space-between}.hx\:justify-center{justify-content:center}.hx\:justify-end{justify-content:flex-end}.hx\:justify-start{justify-content:flex-start}.hx\:justify-items-start{justify-items:start}.hx\:gap-1{gap:calc(var(--hx-spacing)*1)}.hx\:gap-2{gap:calc(var(--hx-spacing)*2)}.hx\:gap-4{gap:calc(var(--hx-spacing)*4)}.hx\:gap-x-1\.5{column-gap:calc(var(--hx-spacing)*1.5)}.hx\:gap-x-2{column-gap:calc(var(--hx-spacing)*2)}.hx\:gap-y-1{row-gap:calc(var(--hx-spacing)*1)}.hx\:gap-y-2{row-gap:calc(var(--hx-spacing)*2)}.hx\:overflow-auto{overflow:auto}.hx\:overflow-hidden{overflow:hidden}.hx\:overflow-x-auto{overflow-x:auto}.hx\:overflow-x-hidden{overflow-x:hidden}.hx\:overflow-y-auto{overflow-y:auto}.hx\:overflow-y-hidden{overflow-y:hidden}.hx\:overscroll-contain{overscroll-behavior:contain}.hx\:overscroll-x-contain{overscroll-behavior-x:contain}.hx\:rounded-3xl{border-radius:var(--hx-radius-3xl)}.hx\:rounded-full{border-radius:3.40282e38px}.hx\:rounded-lg{border-radius:var(--hx-radius-lg)}.hx\:rounded-md{border-radius:var(--hx-radius-md)}.hx\:rounded-sm{border-radius:var(--hx-radius-sm)}.hx\:rounded-xl{border-radius:var(--hx-radius-xl)}.hx\:rounded-xs{border-radius:var(--hx-radius-xs)}.hx\:rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.hx\:border{border-style:var(--tw-border-style);border-width:1px}.hx\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.hx\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.hx\:border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.hx\:border-amber-200{border-color:var(--hx-color-amber-200)}.hx\:border-black\/5{border-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.hx\:border-black\/5{border-color:color-mix(in oklab,var(--hx-color-black)5%,transparent)}}.hx\:border-blue-200{border-color:var(--hx-color-blue-200)}.hx\:border-gray-200{border-color:var(--hx-color-gray-200)}.hx\:border-gray-500{border-color:var(--hx-color-gray-500)}.hx\:border-green-200{border-color:var(--hx-color-green-200)}.hx\:border-indigo-200{border-color:var(--hx-color-indigo-200)}.hx\:border-orange-100{border-color:var(--hx-color-orange-100)}.hx\:border-purple-200{border-color:var(--hx-color-purple-200)}.hx\:border-red-200{border-color:var(--hx-color-red-200)}.hx\:border-transparent{border-color:#0000}.hx\:border-yellow-100{border-color:var(--hx-color-yellow-100)}.hx\:bg-amber-100{background-color:var(--hx-color-amber-100)}.hx\:bg-black\/\[\.05\]{background-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.hx\:bg-black\/\[\.05\]{background-color:color-mix(in oklab,var(--hx-color-black)5%,transparent)}}.hx\:bg-blue-100{background-color:var(--hx-color-blue-100)}.hx\:bg-gray-100{background-color:var(--hx-color-gray-100)}.hx\:bg-green-100{background-color:var(--hx-color-green-100)}.hx\:bg-indigo-100{background-color:var(--hx-color-indigo-100)}.hx\:bg-neutral-50{background-color:var(--hx-color-neutral-50)}.hx\:bg-neutral-900{background-color:var(--hx-color-neutral-900)}.hx\:bg-orange-50{background-color:var(--hx-color-orange-50)}.hx\:bg-primary-100{background-color:var(--hx-color-primary-100)}.hx\:bg-primary-400{background-color:var(--hx-color-primary-400)}.hx\:bg-primary-600{background-color:var(--hx-color-primary-600)}.hx\:bg-primary-700\/5{background-color:var(--hx-color-primary-700)}@supports (color:color-mix(in lab, red, red)){.hx\:bg-primary-700\/5{background-color:color-mix(in oklab,var(--hx-color-primary-700)5%,transparent)}}.hx\:bg-purple-100{background-color:var(--hx-color-purple-100)}.hx\:bg-red-100{background-color:var(--hx-color-red-100)}.hx\:bg-transparent{background-color:#0000}.hx\:bg-white{background-color:var(--hx-color-white)}.hx\:bg-yellow-50{background-color:var(--hx-color-yellow-50)}.hx\:bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.hx\:from-gray-900{--tw-gradient-from:var(--hx-color-gray-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hx\:to-gray-600{--tw-gradient-to:var(--hx-color-gray-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hx\:bg-clip-text{-webkit-background-clip:text;background-clip:text}.hx\:p-0\.5{padding:calc(var(--hx-spacing)*.5)}.hx\:p-1{padding:calc(var(--hx-spacing)*1)}.hx\:p-1\.5{padding:calc(var(--hx-spacing)*1.5)}.hx\:p-2{padding:calc(var(--hx-spacing)*2)}.hx\:p-4{padding:calc(var(--hx-spacing)*4)}.hx\:p-6{padding:calc(var(--hx-spacing)*6)}.hx\:px-1\.5{padding-inline:calc(var(--hx-spacing)*1.5)}.hx\:px-2{padding-inline:calc(var(--hx-spacing)*2)}.hx\:px-2\.5{padding-inline:calc(var(--hx-spacing)*2.5)}.hx\:px-3{padding-inline:calc(var(--hx-spacing)*3)}.hx\:px-4{padding-inline:calc(var(--hx-spacing)*4)}.hx\:px-6{padding-inline:calc(var(--hx-spacing)*6)}.hx\:px-8{padding-inline:calc(var(--hx-spacing)*8)}.hx\:py-1{padding-block:calc(var(--hx-spacing)*1)}.hx\:py-1\.5{padding-block:calc(var(--hx-spacing)*1.5)}.hx\:py-2{padding-block:calc(var(--hx-spacing)*2)}.hx\:py-2\.5{padding-block:calc(var(--hx-spacing)*2.5)}.hx\:py-3{padding-block:calc(var(--hx-spacing)*3)}.hx\:py-4{padding-block:calc(var(--hx-spacing)*4)}.hx\:py-12{padding-block:calc(var(--hx-spacing)*12)}.hx\:pt-4{padding-top:calc(var(--hx-spacing)*4)}.hx\:pt-6{padding-top:calc(var(--hx-spacing)*6)}.hx\:pt-8{padding-top:calc(var(--hx-spacing)*8)}.hx\:pr-2{padding-right:calc(var(--hx-spacing)*2)}.hx\:pr-4{padding-right:calc(var(--hx-spacing)*4)}.hx\:pr-\[calc\(env\(safe-area-inset-right\)-1\.5rem\)\]{padding-right:calc(env(safe-area-inset-right) - 1.5rem)}.hx\:pr-\[max\(env\(safe-area-inset-left\)\,1\.5rem\)\]{padding-right:max(env(safe-area-inset-left),1.5rem)}.hx\:pr-\[max\(env\(safe-area-inset-right\)\,1\.5rem\)\]{padding-right:max(env(safe-area-inset-right),1.5rem)}.hx\:pb-8{padding-bottom:calc(var(--hx-spacing)*8)}.hx\:pb-\[env\(safe-area-inset-bottom\)\]{padding-bottom:env(safe-area-inset-bottom)}.hx\:pb-px{padding-bottom:1px}.hx\:pl-\[max\(env\(safe-area-inset-left\)\,1\.5rem\)\]{padding-left:max(env(safe-area-inset-left),1.5rem)}.hx\:text-center{text-align:center}.hx\:text-left{text-align:left}.hx\:align-\[-2\.5px\]{vertical-align:-2.5px}.hx\:align-baseline{vertical-align:baseline}.hx\:align-middle{vertical-align:middle}.hx\:align-text-bottom{vertical-align:text-bottom}.hx\:font-mono{font-family:var(--hx-font-mono)}.hx\:text-2xl{font-size:var(--hx-text-2xl);line-height:var(--tw-leading,var(--hx-text-2xl--line-height))}.hx\:text-4xl{font-size:var(--hx-text-4xl);line-height:var(--tw-leading,var(--hx-text-4xl--line-height))}.hx\:text-base{font-size:var(--hx-text-base);line-height:var(--tw-leading,var(--hx-text-base--line-height))}.hx\:text-lg{font-size:var(--hx-text-lg);line-height:var(--tw-leading,var(--hx-text-lg--line-height))}.hx\:text-sm{font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height))}.hx\:text-xl{font-size:var(--hx-text-xl);line-height:var(--tw-leading,var(--hx-text-xl--line-height))}.hx\:text-xs{font-size:var(--hx-text-xs);line-height:var(--tw-leading,var(--hx-text-xs--line-height))}.hx\:text-\[\.65rem\]{font-size:.65rem}.hx\:text-\[10px\]{font-size:10px}.hx\:leading-5{--tw-leading:calc(var(--hx-spacing)*5);line-height:calc(var(--hx-spacing)*5)}.hx\:leading-6{--tw-leading:calc(var(--hx-spacing)*6);line-height:calc(var(--hx-spacing)*6)}.hx\:leading-7{--tw-leading:calc(var(--hx-spacing)*7);line-height:calc(var(--hx-spacing)*7)}.hx\:leading-none{--tw-leading:1;line-height:1}.hx\:leading-tight{--tw-leading:var(--hx-leading-tight);line-height:var(--hx-leading-tight)}.hx\:font-bold{--tw-font-weight:var(--hx-font-weight-bold);font-weight:var(--hx-font-weight-bold)}.hx\:font-extrabold{--tw-font-weight:var(--hx-font-weight-extrabold);font-weight:var(--hx-font-weight-extrabold)}.hx\:font-medium{--tw-font-weight:var(--hx-font-weight-medium);font-weight:var(--hx-font-weight-medium)}.hx\:font-normal{--tw-font-weight:var(--hx-font-weight-normal);font-weight:var(--hx-font-weight-normal)}.hx\:font-semibold{--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold)}.hx\:tracking-tight{--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight)}.hx\:tracking-tighter{--tw-tracking:var(--hx-tracking-tighter);letter-spacing:var(--hx-tracking-tighter)}.hx\:break-words{overflow-wrap:break-word}.hx\:text-ellipsis{text-overflow:ellipsis}.hx\:whitespace-nowrap{white-space:nowrap}.hx\:text-\[color\:hsl\(var\(--primary-hue\)\,100\%\,50\%\)\]{color:hsl(var(--primary-hue),100%,50%)}.hx\:text-amber-900{color:var(--hx-color-amber-900)}.hx\:text-blue-900{color:var(--hx-color-blue-900)}.hx\:text-current{color:currentColor}.hx\:text-gray-100{color:var(--hx-color-gray-100)}.hx\:text-gray-500{color:var(--hx-color-gray-500)}.hx\:text-gray-600{color:var(--hx-color-gray-600)}.hx\:text-gray-700{color:var(--hx-color-gray-700)}.hx\:text-gray-800{color:var(--hx-color-gray-800)}.hx\:text-gray-900{color:var(--hx-color-gray-900)}.hx\:text-green-900{color:var(--hx-color-green-900)}.hx\:text-indigo-900{color:var(--hx-color-indigo-900)}.hx\:text-orange-800{color:var(--hx-color-orange-800)}.hx\:text-primary-800{color:var(--hx-color-primary-800)}.hx\:text-purple-900{color:var(--hx-color-purple-900)}.hx\:text-red-900{color:var(--hx-color-red-900)}.hx\:text-slate-50{color:var(--hx-color-slate-50)}.hx\:text-slate-900{color:var(--hx-color-slate-900)}.hx\:text-transparent{color:#0000}.hx\:text-white{color:var(--hx-color-white)}.hx\:text-yellow-900{color:var(--hx-color-yellow-900)}.hx\:capitalize{text-transform:capitalize}.hx\:no-underline{text-decoration-line:none}.hx\:underline{text-decoration-line:underline}.hx\:decoration-from-font{text-decoration-thickness:from-font}.hx\:underline-offset-2{text-underline-offset:2px}.hx\:opacity-0{opacity:0}.hx\:opacity-50{opacity:.5}.hx\:opacity-80{opacity:.8}.hx\:shadow-\[0_-12px_16px_\#fff\]{--tw-shadow:0 -12px 16px var(--tw-shadow-color,#fff);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-\[0_-12px_16px_white\]{--tw-shadow:0 -12px 16px var(--tw-shadow-color,white);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-\[0_2px_4px_rgba\(0\,0\,0\,\.02\)\,0_1px_0_rgba\(0\,0\,0\,\.06\)\]{--tw-shadow:0 2px 4px var(--tw-shadow-color,#00000005),0 1px 0 var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:shadow-gray-100{--tw-shadow-color:var(--hx-color-gray-100)}@supports (color:color-mix(in lab, red, red)){.hx\:shadow-gray-100{--tw-shadow-color:color-mix(in oklab,var(--hx-color-gray-100)var(--tw-shadow-alpha),transparent)}}.hx\:ring-black\/5{--tw-ring-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.hx\:ring-black\/5{--tw-ring-color:color-mix(in oklab,var(--hx-color-black)5%,transparent)}}.hx\:transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:duration-75{--tw-duration:75ms;transition-duration:75ms}.hx\:duration-200{--tw-duration:.2s;transition-duration:.2s}.hx\:ease-in{--tw-ease:var(--hx-ease-in);transition-timing-function:var(--hx-ease-in)}.hx\:ease-in-out{--tw-ease:var(--hx-ease-in-out);transition-timing-function:var(--hx-ease-in-out)}.hx\:select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hx\:group-hover\:underline:is(:where(.hx\:group):hover *){text-decoration-line:underline}.hx\:group-hover\/code\:opacity-100:is(:where(.hx\:group\/code):hover *){opacity:1}}.hx\:group-data-\[theme\=dark\]\:hidden:is(:where(.hx\:group)[data-theme=dark] *),.hx\:group-data-\[theme\=light\]\:hidden:is(:where(.hx\:group)[data-theme=light] *),.hx\:group-data-\[theme\=system\]\:hidden:is(:where(.hx\:group)[data-theme=system] *){display:none}.hx\:group-\[\.copied\]\/copybtn\:block:is(:where(.hx\:group\/copybtn).copied *){display:block}.hx\:group-\[\.copied\]\/copybtn\:hidden:is(:where(.hx\:group\/copybtn).copied *){display:none}.hx\:placeholder\:text-gray-500::placeholder{color:var(--hx-color-gray-500)}.hx\:before\:pointer-events-none:before{content:var(--tw-content);pointer-events:none}.hx\:before\:absolute:before{content:var(--tw-content);position:absolute}.hx\:before\:inset-0:before{content:var(--tw-content);inset:calc(var(--hx-spacing)*0)}.hx\:before\:inset-y-1:before{content:var(--tw-content);inset-block:calc(var(--hx-spacing)*1)}.hx\:before\:mr-1:before{content:var(--tw-content);margin-right:calc(var(--hx-spacing)*1)}.hx\:before\:inline-block:before{content:var(--tw-content);display:inline-block}.hx\:before\:w-px:before{content:var(--tw-content);width:1px}.hx\:before\:bg-gray-200:before{content:var(--tw-content);background-color:var(--hx-color-gray-200)}.hx\:before\:opacity-25:before{content:var(--tw-content);opacity:.25}.hx\:before\:transition-transform:before{content:var(--tw-content);transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.hx\:before\:content-\[\"\"\]:before{content:var(--tw-content);--tw-content:"";content:var(--tw-content)}.hx\:before\:content-\[\'\#\'\]:before{content:var(--tw-content);--tw-content:"#";content:var(--tw-content)}.hx\:before\:content-\[\'\'\]:before{content:var(--tw-content);--tw-content:"";content:var(--tw-content)}.hx\:before\:content-\[\\\"\\\"\]:before{content:var(--tw-content);--tw-content:\"\";content:var(--tw-content)}.hx\:group-open\:before\:rotate-90:is(:where(.hx\:group):is([open],:popover-open,:open) *):before{content:var(--tw-content);rotate:90deg}.hx\:first\:mt-0:first-child{margin-top:calc(var(--hx-spacing)*0)}.hx\:last-of-type\:mb-0:last-of-type{margin-bottom:calc(var(--hx-spacing)*0)}@media (hover:hover){.hx\:hover\:border-gray-200:hover{border-color:var(--hx-color-gray-200)}.hx\:hover\:border-gray-300:hover{border-color:var(--hx-color-gray-300)}.hx\:hover\:border-gray-400:hover{border-color:var(--hx-color-gray-400)}.hx\:hover\:border-gray-900:hover{border-color:var(--hx-color-gray-900)}.hx\:hover\:bg-gray-100:hover{background-color:var(--hx-color-gray-100)}.hx\:hover\:bg-gray-800\/5:hover{background-color:var(--hx-color-gray-800)}@supports (color:color-mix(in lab, red, red)){.hx\:hover\:bg-gray-800\/5:hover{background-color:color-mix(in oklab,var(--hx-color-gray-800)5%,transparent)}}.hx\:hover\:bg-primary-50:hover{background-color:var(--hx-color-primary-50)}.hx\:hover\:bg-primary-700:hover{background-color:var(--hx-color-primary-700)}.hx\:hover\:bg-slate-50:hover{background-color:var(--hx-color-slate-50)}.hx\:hover\:text-black:hover{color:var(--hx-color-black)}.hx\:hover\:text-gray-800:hover{color:var(--hx-color-gray-800)}.hx\:hover\:text-gray-900:hover{color:var(--hx-color-gray-900)}.hx\:hover\:text-primary-600:hover{color:var(--hx-color-primary-600)}.hx\:hover\:opacity-60:hover{opacity:.6}.hx\:hover\:opacity-75:hover{opacity:.75}.hx\:hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:hover\:shadow-gray-100:hover{--tw-shadow-color:var(--hx-color-gray-100)}@supports (color:color-mix(in lab, red, red)){.hx\:hover\:shadow-gray-100:hover{--tw-shadow-color:color-mix(in oklab,var(--hx-color-gray-100)var(--tw-shadow-alpha),transparent)}}}.hx\:focus\:bg-white:focus{background-color:var(--hx-color-white)}.hx\:focus\:hextra-focus:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:var(--hx-color-primary-200);--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color);--tw-ring-offset-color:var(--hx-color-primary-300);--tw-outline-style:none;outline-style:none}.hx\:focus\:hextra-focus:focus:where(.dark,.dark *){--tw-ring-color:var(--hx-color-primary-800);--tw-ring-offset-color:var(--hx-color-primary-700)}.hx\:focus\:ring-4:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(4px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:focus\:ring-primary-300:focus{--tw-ring-color:var(--hx-color-primary-300)}.hx\:focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.hx\:focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.hx\:active\:bg-gray-400\/20:active{background-color:var(--hx-color-gray-400)}@supports (color:color-mix(in lab, red, red)){.hx\:active\:bg-gray-400\/20:active{background-color:color-mix(in oklab,var(--hx-color-gray-400)20%,transparent)}}.hx\:active\:opacity-50:active{opacity:.5}.hx\:active\:shadow-sm:active{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:active\:shadow-gray-200:active{--tw-shadow-color:var(--hx-color-gray-200)}@supports (color:color-mix(in lab, red, red)){.hx\:active\:shadow-gray-200:active{--tw-shadow-color:color-mix(in oklab,var(--hx-color-gray-200)var(--tw-shadow-alpha),transparent)}}.hx\:data-\[state\=closed\]\:hidden[data-state=closed],.hx\:data-\[state\=open\]\:hidden[data-state=open]{display:none}.hx\:data-\[state\=selected\]\:block[data-state=selected]{display:block}.hx\:data-\[state\=selected\]\:border-primary-500[data-state=selected]{border-color:var(--hx-color-primary-500)}.hx\:data-\[state\=selected\]\:text-primary-600[data-state=selected]{color:var(--hx-color-primary-600)}@media (prefers-contrast:more){.hx\:contrast-more\:border{border-style:var(--tw-border-style);border-width:1px}.hx\:contrast-more\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.hx\:contrast-more\:border-current{border-color:currentColor}.hx\:contrast-more\:border-gray-800{border-color:var(--hx-color-gray-800)}.hx\:contrast-more\:border-gray-900{border-color:var(--hx-color-gray-900)}.hx\:contrast-more\:border-neutral-400{border-color:var(--hx-color-neutral-400)}.hx\:contrast-more\:border-primary-500{border-color:var(--hx-color-primary-500)}.hx\:contrast-more\:border-transparent{border-color:#0000}.hx\:contrast-more\:font-bold{--tw-font-weight:var(--hx-font-weight-bold);font-weight:var(--hx-font-weight-bold)}.hx\:contrast-more\:text-current{color:currentColor}.hx\:contrast-more\:text-gray-700{color:var(--hx-color-gray-700)}.hx\:contrast-more\:text-gray-800{color:var(--hx-color-gray-800)}.hx\:contrast-more\:text-gray-900{color:var(--hx-color-gray-900)}.hx\:contrast-more\:underline{text-decoration-line:underline}.hx\:contrast-more\:shadow-\[0_0_0_1px_\#000\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#000);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:contrast-more\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media (hover:hover){.hx\:contrast-more\:hover\:border-gray-900:hover{border-color:var(--hx-color-gray-900)}}}@media not all and (min-width:80rem){.hx\:max-xl\:hidden{display:none}}@media not all and (min-width:64rem){.hx\:max-lg\:min-h-\[340px\]{min-height:340px}}@media not all and (min-width:48rem){.hx\:max-md\:sticky{position:sticky}.hx\:max-md\:hidden{display:none}.hx\:max-md\:min-h-\[340px\]{min-height:340px}.hx\:max-md\:\[transform\:translate3d\(0\,-100\%\,0\)\]{transform:translateY(-100%)}.hx\:max-md\:\[transform\:translate3d\(0\,0\,0\)\]{transform:translate(0)}}@media not all and (min-width:40rem){.hx\:max-sm\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}@media (min-width:40rem){.hx\:sm\:block{display:block}.hx\:sm\:flex{display:flex}.hx\:sm\:w-\[110\%\]{width:110%}.hx\:sm\:items-start{align-items:flex-start}.hx\:sm\:text-xl{font-size:var(--hx-text-xl);line-height:var(--tw-leading,var(--hx-text-xl--line-height))}@media not all and (min-width:64rem){.hx\:sm\:max-lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}@media (min-width:48rem){.hx\:md\:sticky{position:sticky}.hx\:md\:top-16{top:calc(var(--hx-spacing)*16)}.hx\:md\:mr-0{margin-right:calc(var(--hx-spacing)*0)}.hx\:md\:hidden{display:none}.hx\:md\:inline-block{display:inline-block}.hx\:md\:inline-flex{display:inline-flex}.hx\:md\:aspect-\[1\.1\/1\]{aspect-ratio:1.1}.hx\:md\:h-\[calc\(100vh-var\(--navbar-height\)-var\(--menu-height\)\)\]{height:calc(100vh - var(--navbar-height) - var(--menu-height))}.hx\:md\:max-h-\[min\(calc\(100vh-5rem-env\(safe-area-inset-bottom\)\)\,400px\)\]{max-height:min(calc(100vh - 5rem - env(safe-area-inset-bottom)),400px)}.hx\:md\:w-64{width:calc(var(--hx-spacing)*64)}.hx\:md\:shrink-0{flex-shrink:0}.hx\:md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.hx\:md\:justify-start{justify-content:flex-start}.hx\:md\:self-start{align-self:flex-start}.hx\:md\:overflow-auto{overflow:auto}.hx\:md\:px-12{padding-inline:calc(var(--hx-spacing)*12)}.hx\:md\:pt-12{padding-top:calc(var(--hx-spacing)*12)}.hx\:md\:text-3xl{font-size:var(--hx-text-3xl);line-height:var(--tw-leading,var(--hx-text-3xl--line-height))}.hx\:md\:text-5xl{font-size:var(--hx-text-5xl);line-height:var(--tw-leading,var(--hx-text-5xl--line-height))}.hx\:md\:text-lg{font-size:var(--hx-text-lg);line-height:var(--tw-leading,var(--hx-text-lg--line-height))}.hx\:md\:text-sm{font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height))}}@media (min-width:64rem){.hx\:lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:80rem){.hx\:xl\:block{display:block}.hx\:xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.hx\:ltr\:right-1\.5:where(:dir(ltr),[dir=ltr],[dir=ltr] *){right:calc(var(--hx-spacing)*1.5)}.hx\:ltr\:right-3:where(:dir(ltr),[dir=ltr],[dir=ltr] *){right:calc(var(--hx-spacing)*3)}.hx\:ltr\:-mr-4:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-right:calc(var(--hx-spacing)*-4)}.hx\:ltr\:mr-auto:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-right:auto}.hx\:ltr\:ml-1:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:calc(var(--hx-spacing)*1)}.hx\:ltr\:ml-3:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:calc(var(--hx-spacing)*3)}.hx\:ltr\:ml-auto:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:auto}.hx\:ltr\:rotate-180:where(:dir(ltr),[dir=ltr],[dir=ltr] *){rotate:180deg}.hx\:ltr\:border-l:where(:dir(ltr),[dir=ltr],[dir=ltr] *){border-left-style:var(--tw-border-style);border-left-width:1px}.hx\:ltr\:pr-0:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-right:calc(var(--hx-spacing)*0)}.hx\:ltr\:pr-2:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-right:calc(var(--hx-spacing)*2)}.hx\:ltr\:pr-4:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-right:calc(var(--hx-spacing)*4)}.hx\:ltr\:pr-9:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-right:calc(var(--hx-spacing)*9)}.hx\:ltr\:pl-3:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*3)}.hx\:ltr\:pl-4:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*4)}.hx\:ltr\:pl-5:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*5)}.hx\:ltr\:pl-6:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*6)}.hx\:ltr\:pl-8:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*8)}.hx\:ltr\:pl-12:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*12)}.hx\:ltr\:pl-16:where(:dir(ltr),[dir=ltr],[dir=ltr] *){padding-left:calc(var(--hx-spacing)*16)}.hx\:ltr\:text-right:where(:dir(ltr),[dir=ltr],[dir=ltr] *){text-align:right}.hx\:ltr\:before\:left-0:where(:dir(ltr),[dir=ltr],[dir=ltr] *):before{content:var(--tw-content);left:calc(var(--hx-spacing)*0)}@media (min-width:48rem){.hx\:ltr\:md\:left-auto:where(:dir(ltr),[dir=ltr],[dir=ltr] *){left:auto}}.hx\:rtl\:left-1\.5:where(:dir(rtl),[dir=rtl],[dir=rtl] *){left:calc(var(--hx-spacing)*1.5)}.hx\:rtl\:left-3:where(:dir(rtl),[dir=rtl],[dir=rtl] *){left:calc(var(--hx-spacing)*3)}.hx\:rtl\:mr-1:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:calc(var(--hx-spacing)*1)}.hx\:rtl\:mr-3:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:calc(var(--hx-spacing)*3)}.hx\:rtl\:mr-auto:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:auto}.hx\:rtl\:-ml-4:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-left:calc(var(--hx-spacing)*-4)}.hx\:rtl\:ml-auto:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-left:auto}.hx\:rtl\:-rotate-180:where(:dir(rtl),[dir=rtl],[dir=rtl] *){rotate:-180deg}.hx\:rtl\:rotate-270:where(:dir(rtl),[dir=rtl],[dir=rtl] *){rotate:270deg}.hx\:rtl\:border-r:where(:dir(rtl),[dir=rtl],[dir=rtl] *){border-right-style:var(--tw-border-style);border-right-width:1px}.hx\:rtl\:pr-3:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*3)}.hx\:rtl\:pr-4:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*4)}.hx\:rtl\:pr-5:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*5)}.hx\:rtl\:pr-6:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*6)}.hx\:rtl\:pr-8:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*8)}.hx\:rtl\:pr-12:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*12)}.hx\:rtl\:pr-16:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-right:calc(var(--hx-spacing)*16)}.hx\:rtl\:pl-2:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-left:calc(var(--hx-spacing)*2)}.hx\:rtl\:pl-4:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-left:calc(var(--hx-spacing)*4)}.hx\:rtl\:pl-9:where(:dir(rtl),[dir=rtl],[dir=rtl] *){padding-left:calc(var(--hx-spacing)*9)}.hx\:rtl\:text-left:where(:dir(rtl),[dir=rtl],[dir=rtl] *){text-align:left}.hx\:rtl\:before\:right-0:where(:dir(rtl),[dir=rtl],[dir=rtl] *):before{content:var(--tw-content);right:calc(var(--hx-spacing)*0)}.hx\:rtl\:before\:rotate-180:where(:dir(rtl),[dir=rtl],[dir=rtl] *):before{content:var(--tw-content);rotate:180deg}@media (min-width:48rem){.hx\:rtl\:md\:right-auto:where(:dir(rtl),[dir=rtl],[dir=rtl] *){right:auto}}.hx\:dark\:block:where(.dark,.dark *){display:block}.hx\:dark\:hidden:where(.dark,.dark *){display:none}.hx\:dark\:border-amber-200\/30:where(.dark,.dark *){border-color:var(--hx-color-amber-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-amber-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-amber-200)30%,transparent)}}.hx\:dark\:border-blue-200\/30:where(.dark,.dark *){border-color:var(--hx-color-blue-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-blue-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-blue-200)30%,transparent)}}.hx\:dark\:border-gray-100\/20:where(.dark,.dark *){border-color:var(--hx-color-gray-100)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-gray-100\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-gray-100)20%,transparent)}}.hx\:dark\:border-gray-400:where(.dark,.dark *){border-color:var(--hx-color-gray-400)}.hx\:dark\:border-green-200\/30:where(.dark,.dark *){border-color:var(--hx-color-green-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-green-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-green-200)30%,transparent)}}.hx\:dark\:border-indigo-200\/30:where(.dark,.dark *){border-color:var(--hx-color-indigo-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-indigo-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-indigo-200)30%,transparent)}}.hx\:dark\:border-neutral-700:where(.dark,.dark *){border-color:var(--hx-color-neutral-700)}.hx\:dark\:border-neutral-800:where(.dark,.dark *){border-color:var(--hx-color-neutral-800)}.hx\:dark\:border-orange-400\/30:where(.dark,.dark *){border-color:var(--hx-color-orange-400)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-orange-400\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-orange-400)30%,transparent)}}.hx\:dark\:border-purple-200\/30:where(.dark,.dark *){border-color:var(--hx-color-purple-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-purple-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-purple-200)30%,transparent)}}.hx\:dark\:border-red-200\/30:where(.dark,.dark *){border-color:var(--hx-color-red-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-red-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-red-200)30%,transparent)}}.hx\:dark\:border-white\/10:where(.dark,.dark *){border-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-white\/10:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-white)10%,transparent)}}.hx\:dark\:border-yellow-200\/30:where(.dark,.dark *){border-color:var(--hx-color-yellow-200)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:border-yellow-200\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-yellow-200)30%,transparent)}}.hx\:dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:var(--hx-color-amber-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-amber-900)30%,transparent)}}.hx\:dark\:bg-blue-900\/30:where(.dark,.dark *){background-color:var(--hx-color-blue-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-blue-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-blue-900)30%,transparent)}}.hx\:dark\:bg-dark:where(.dark,.dark *),.hx\:dark\:bg-dark\/50:where(.dark,.dark *){background-color:var(--hx-color-dark)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-dark\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-dark)50%,transparent)}}.hx\:dark\:bg-gray-50\/10:where(.dark,.dark *){background-color:var(--hx-color-gray-50)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-gray-50\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-gray-50)10%,transparent)}}.hx\:dark\:bg-green-900\/30:where(.dark,.dark *){background-color:var(--hx-color-green-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-green-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-green-900)30%,transparent)}}.hx\:dark\:bg-indigo-900\/30:where(.dark,.dark *){background-color:var(--hx-color-indigo-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-indigo-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-indigo-900)30%,transparent)}}.hx\:dark\:bg-neutral-800:where(.dark,.dark *){background-color:var(--hx-color-neutral-800)}.hx\:dark\:bg-neutral-900:where(.dark,.dark *){background-color:var(--hx-color-neutral-900)}.hx\:dark\:bg-orange-400\/20:where(.dark,.dark *){background-color:var(--hx-color-orange-400)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-orange-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-orange-400)20%,transparent)}}.hx\:dark\:bg-primary-300\/10:where(.dark,.dark *){background-color:var(--hx-color-primary-300)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-primary-300\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-300)10%,transparent)}}.hx\:dark\:bg-primary-400\/10:where(.dark,.dark *){background-color:var(--hx-color-primary-400)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-primary-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-400)10%,transparent)}}.hx\:dark\:bg-primary-600:where(.dark,.dark *){background-color:var(--hx-color-primary-600)}.hx\:dark\:bg-purple-900\/30:where(.dark,.dark *){background-color:var(--hx-color-purple-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-purple-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-purple-900)30%,transparent)}}.hx\:dark\:bg-red-900\/30:where(.dark,.dark *){background-color:var(--hx-color-red-900)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-red-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-red-900)30%,transparent)}}.hx\:dark\:bg-yellow-700\/30:where(.dark,.dark *){background-color:var(--hx-color-yellow-700)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:bg-yellow-700\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-yellow-700)30%,transparent)}}.hx\:dark\:from-gray-100:where(.dark,.dark *){--tw-gradient-from:var(--hx-color-gray-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hx\:dark\:to-gray-400:where(.dark,.dark *){--tw-gradient-to:var(--hx-color-gray-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hx\:dark\:text-amber-200:where(.dark,.dark *){color:var(--hx-color-amber-200)}.hx\:dark\:text-blue-200:where(.dark,.dark *){color:var(--hx-color-blue-200)}.hx\:dark\:text-gray-50:where(.dark,.dark *){color:var(--hx-color-gray-50)}.hx\:dark\:text-gray-100:where(.dark,.dark *){color:var(--hx-color-gray-100)}.hx\:dark\:text-gray-200:where(.dark,.dark *){color:var(--hx-color-gray-200)}.hx\:dark\:text-gray-300:where(.dark,.dark *){color:var(--hx-color-gray-300)}.hx\:dark\:text-gray-400:where(.dark,.dark *){color:var(--hx-color-gray-400)}.hx\:dark\:text-green-200:where(.dark,.dark *){color:var(--hx-color-green-200)}.hx\:dark\:text-indigo-200:where(.dark,.dark *){color:var(--hx-color-indigo-200)}.hx\:dark\:text-neutral-200:where(.dark,.dark *){color:var(--hx-color-neutral-200)}.hx\:dark\:text-neutral-400:where(.dark,.dark *){color:var(--hx-color-neutral-400)}.hx\:dark\:text-orange-300:where(.dark,.dark *){color:var(--hx-color-orange-300)}.hx\:dark\:text-primary-600:where(.dark,.dark *){color:var(--hx-color-primary-600)}.hx\:dark\:text-purple-200:where(.dark,.dark *){color:var(--hx-color-purple-200)}.hx\:dark\:text-red-200:where(.dark,.dark *){color:var(--hx-color-red-200)}.hx\:dark\:text-slate-100:where(.dark,.dark *){color:var(--hx-color-slate-100)}.hx\:dark\:text-white:where(.dark,.dark *){color:var(--hx-color-white)}.hx\:dark\:text-yellow-200:where(.dark,.dark *){color:var(--hx-color-yellow-200)}.hx\:dark\:opacity-80:where(.dark,.dark *){opacity:.8}.hx\:dark\:shadow-\[0_-1px_0_rgba\(255\,255\,255\,\.1\)_inset\]:where(.dark,.dark *){--tw-shadow:0 -1px 0 var(--tw-shadow-color,#ffffff1a)inset;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:dark\:shadow-\[0_-12px_16px_\#111\]:where(.dark,.dark *){--tw-shadow:0 -12px 16px var(--tw-shadow-color,#111);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:dark\:shadow-none:where(.dark,.dark *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:dark\:ring-white\/20:where(.dark,.dark *){--tw-ring-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:ring-white\/20:where(.dark,.dark *){--tw-ring-color:color-mix(in oklab,var(--hx-color-white)20%,transparent)}}.hx\:dark\:placeholder\:text-gray-400:where(.dark,.dark *)::placeholder{color:var(--hx-color-gray-400)}.hx\:dark\:before\:bg-neutral-800:where(.dark,.dark *):before{content:var(--tw-content);background-color:var(--hx-color-neutral-800)}.hx\:dark\:before\:invert:where(.dark,.dark *):before{content:var(--tw-content);--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}@media (hover:hover){.hx\:dark\:hover\:border-gray-100:where(.dark,.dark *):hover{border-color:var(--hx-color-gray-100)}.hx\:dark\:hover\:border-gray-600:where(.dark,.dark *):hover{border-color:var(--hx-color-gray-600)}.hx\:dark\:hover\:border-neutral-500:where(.dark,.dark *):hover{border-color:var(--hx-color-neutral-500)}.hx\:dark\:hover\:border-neutral-700:where(.dark,.dark *):hover{border-color:var(--hx-color-neutral-700)}.hx\:dark\:hover\:border-neutral-800:where(.dark,.dark *):hover{border-color:var(--hx-color-neutral-800)}.hx\:dark\:hover\:bg-gray-100\/5:where(.dark,.dark *):hover{background-color:var(--hx-color-gray-100)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:hover\:bg-gray-100\/5:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--hx-color-gray-100)5%,transparent)}}.hx\:dark\:hover\:bg-neutral-700:where(.dark,.dark *):hover{background-color:var(--hx-color-neutral-700)}.hx\:dark\:hover\:bg-neutral-800:where(.dark,.dark *):hover{background-color:var(--hx-color-neutral-800)}.hx\:dark\:hover\:bg-neutral-900:where(.dark,.dark *):hover{background-color:var(--hx-color-neutral-900)}.hx\:dark\:hover\:bg-primary-100\/5:where(.dark,.dark *):hover{background-color:var(--hx-color-primary-100)}@supports (color:color-mix(in lab, red, red)){.hx\:dark\:hover\:bg-primary-100\/5:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--hx-color-primary-100)5%,transparent)}}.hx\:dark\:hover\:bg-primary-700:where(.dark,.dark *):hover{background-color:var(--hx-color-primary-700)}.hx\:hover\:dark\:bg-primary-500\/10:hover:where(.dark,.dark *){background-color:var(--hx-color-primary-500)}@supports (color:color-mix(in lab, red, red)){.hx\:hover\:dark\:bg-primary-500\/10:hover:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-500)10%,transparent)}}.hx\:dark\:hover\:text-gray-50:where(.dark,.dark *):hover{color:var(--hx-color-gray-50)}.hx\:dark\:hover\:text-gray-100:where(.dark,.dark *):hover{color:var(--hx-color-gray-100)}.hx\:dark\:hover\:text-gray-200:where(.dark,.dark *):hover{color:var(--hx-color-gray-200)}.hx\:dark\:hover\:text-gray-300:where(.dark,.dark *):hover{color:var(--hx-color-gray-300)}.hx\:dark\:hover\:text-neutral-50:where(.dark,.dark *):hover{color:var(--hx-color-neutral-50)}.hx\:dark\:hover\:text-white:where(.dark,.dark *):hover{color:var(--hx-color-white)}.hx\:hover\:dark\:text-primary-600:hover:where(.dark,.dark *){color:var(--hx-color-primary-600)}.hx\:dark\:hover\:shadow-none:where(.dark,.dark *):hover{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.hx\:dark\:focus\:bg-dark:where(.dark,.dark *):focus{background-color:var(--hx-color-dark)}.hx\:dark\:focus\:ring-primary-800:where(.dark,.dark *):focus{--tw-ring-color:var(--hx-color-primary-800)}.hx\:data-\[state\=selected\]\:dark\:border-primary-500[data-state=selected]:where(.dark,.dark *){border-color:var(--hx-color-primary-500)}.hx\:data-\[state\=selected\]\:dark\:text-primary-600[data-state=selected]:where(.dark,.dark *){color:var(--hx-color-primary-600)}@media (prefers-contrast:more){.hx\:contrast-more\:dark\:border-current:where(.dark,.dark *){border-color:currentColor}.hx\:contrast-more\:dark\:border-gray-50:where(.dark,.dark *){border-color:var(--hx-color-gray-50)}.hx\:contrast-more\:dark\:border-neutral-400:where(.dark,.dark *){border-color:var(--hx-color-neutral-400)}.hx\:contrast-more\:dark\:border-primary-500:where(.dark,.dark *){border-color:var(--hx-color-primary-500)}.hx\:dark\:contrast-more\:border-neutral-400:where(.dark,.dark *){border-color:var(--hx-color-neutral-400)}.hx\:contrast-more\:dark\:text-current:where(.dark,.dark *){color:currentColor}.hx\:contrast-more\:dark\:text-gray-50:where(.dark,.dark *){color:var(--hx-color-gray-50)}.hx\:contrast-more\:dark\:text-gray-100:where(.dark,.dark *){color:var(--hx-color-gray-100)}.hx\:contrast-more\:dark\:text-gray-300:where(.dark,.dark *){color:var(--hx-color-gray-300)}.hx\:contrast-more\:dark\:shadow-\[0_0_0_1px_\#fff\]:where(.dark,.dark *){--tw-shadow:0 0 0 1px var(--tw-shadow-color,#fff);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hx\:contrast-more\:dark\:shadow-none:where(.dark,.dark *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media (hover:hover){.hx\:contrast-more\:dark\:hover\:border-gray-50:where(.dark,.dark *):hover{border-color:var(--hx-color-gray-50)}}}@media print{.hx\:print\:\[display\:none\],.hx\:print\:hidden{display:none}.hx\:print\:bg-transparent{background-color:#0000}}}html{font-size:var(--hx-text-base);line-height:var(--tw-leading,var(--hx-text-base--line-height));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background-color:var(--hx-color-white);width:100%}body:where(.dark,.dark *){background-color:var(--hx-color-dark);color:var(--hx-color-gray-100)}:root{--primary-hue:212deg;--primary-saturation:100%;--primary-lightness:50%;--navbar-height:4rem;--hextra-banner-height:2rem;--menu-height:3.75rem}.dark{--primary-hue:204deg;--primary-saturation:100%;--primary-lightness:50%}.content :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*2);font-size:var(--hx-text-4xl);line-height:var(--tw-leading,var(--hx-text-4xl--line-height));--tw-font-weight:var(--hx-font-weight-bold);font-weight:var(--hx-font-weight-bold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}.content :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*10);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--hx-color-neutral-200)}@supports (color:color-mix(in lab, red, red)){.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:color-mix(in oklab,var(--hx-color-neutral-200)70%,transparent)}}.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){padding-bottom:calc(var(--hx-spacing)*1);font-size:var(--hx-text-3xl);line-height:var(--tw-leading,var(--hx-text-3xl--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}@media (prefers-contrast:more){.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--hx-color-neutral-400)}}.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-primary-100)}@supports (color:color-mix(in lab, red, red)){.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-primary-100)10%,transparent)}}.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}@media (prefers-contrast:more){.content :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-neutral-400)}}.content :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*8);font-size:var(--hx-text-2xl);line-height:var(--tw-leading,var(--hx-text-2xl--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}.content :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}.content :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*8);font-size:var(--hx-text-xl);line-height:var(--tw-leading,var(--hx-text-xl--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}.content :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}.content :where(h5):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*8);font-size:var(--hx-text-lg);line-height:var(--tw-leading,var(--hx-text-lg--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}.content :where(h5):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}.content :where(h6):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*8);font-size:var(--hx-text-base);line-height:var(--tw-leading,var(--hx-text-base--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);--tw-tracking:var(--hx-tracking-tight);letter-spacing:var(--hx-tracking-tight);color:var(--hx-color-slate-900)}.content :where(h6):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){color:var(--hx-color-slate-100)}.content :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*6);--tw-leading:calc(var(--hx-spacing)*7);line-height:calc(var(--hx-spacing)*7)}.content :where(p):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--hx-color-primary-600);text-decoration-line:underline;text-decoration-thickness:from-font}.content :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*6);border-color:var(--hx-color-gray-300);color:var(--hx-color-gray-700);font-style:italic}.content :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(ltr),[dir=ltr],[dir=ltr] *){border-left-style:var(--tw-border-style);padding-left:calc(var(--hx-spacing)*6);border-left-width:2px}.content :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(rtl),[dir=rtl],[dir=rtl] *){border-right-style:var(--tw-border-style);padding-right:calc(var(--hx-spacing)*6);border-right-width:2px}.content :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-gray-700);color:var(--hx-color-gray-400)}.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){margin-bottom:calc(var(--hx-spacing)*4);border-radius:var(--hx-radius-xl);background-color:var(--hx-color-primary-700);overflow-x:auto}@supports (color:color-mix(in lab, red, red)){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){background-color:color-mix(in oklab,var(--hx-color-primary-700)5%,transparent)}}.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){padding-block:calc(var(--hx-spacing)*4);--tw-font-weight:var(--hx-font-weight-medium);font-size:.9em;font-weight:var(--hx-font-weight-medium);-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}@media (prefers-contrast:more){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){border-style:var(--tw-border-style);border-width:1px;border-color:var(--hx-color-primary-900)}@supports (color:color-mix(in lab, red, red)){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){border-color:color-mix(in oklab,var(--hx-color-primary-900)20%,transparent)}}.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){--tw-contrast:contrast(150%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:var(--hx-color-primary-300)}@supports (color:color-mix(in lab, red, red)){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-300)10%,transparent)}}@media (prefers-contrast:more){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-primary-100)}@supports (color:color-mix(in lab, red, red)){.content :where(pre):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-primary-100)40%,transparent)}}}.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)){border-radius:var(--hx-radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)){border-color:color-mix(in oklab,var(--hx-color-black)4%,transparent)}}.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)){background-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)){background-color:color-mix(in oklab,var(--hx-color-black)3%,transparent)}}.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)){padding-inline:.25em;padding-block:calc(var(--hx-spacing)*.5);overflow-wrap:break-word;font-size:.9em}.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-white)10%,transparent)}}.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.content :where(code):not(:where(.hextra-code-block code,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-white)10%,transparent)}}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)){margin-block:calc(var(--hx-spacing)*6);width:100%;padding:calc(var(--hx-spacing)*0);font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height));--tw-leading:calc(var(--hx-spacing)*5);line-height:calc(var(--hx-spacing)*5);display:block;overflow-x:auto}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) thead{border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--hx-color-gray-200)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) thead:where(.dark,.dark *){border-color:var(--hx-color-neutral-800)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) tbody tr{margin:calc(var(--hx-spacing)*0);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--hx-color-gray-100)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) tbody tr:where(.dark,.dark *){border-color:var(--hx-color-neutral-800)}@supports (color:color-mix(in lab, red, red)){.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) tbody tr:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-neutral-800)50%,transparent)}}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) th{margin:calc(var(--hx-spacing)*0);padding:calc(var(--hx-spacing)*2);--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) th:first-child{padding-left:calc(var(--hx-spacing)*0)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) th:last-child{padding-right:calc(var(--hx-spacing)*0)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) td{margin:calc(var(--hx-spacing)*0);padding:calc(var(--hx-spacing)*2)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) td:first-child{padding-left:calc(var(--hx-spacing)*0)}.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) td:last-child{padding-right:calc(var(--hx-spacing)*0)}.content :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*6);list-style-type:decimal}.content :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:calc(var(--hx-spacing)*6)}.content :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:calc(var(--hx-spacing)*6)}.content :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)) li{margin-block:calc(var(--hx-spacing)*2)}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*6);list-style-type:disc}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:calc(var(--hx-spacing)*6)}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)):where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:calc(var(--hx-spacing)*6)}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)) li{margin-block:calc(var(--hx-spacing)*2)}.content :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)):has(li input[type=checkbox]){list-style-type:none}.content :where(ul,ol)>li>:where(ul,ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:calc(var(--hx-spacing)*0)}.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){border-radius:var(--hx-radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:color-mix(in oklab,var(--hx-color-black)4%,transparent)}}.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:color-mix(in oklab,var(--hx-color-black)3%,transparent)}}.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline:.25em;padding-block:calc(var(--hx-spacing)*.5);overflow-wrap:break-word;font-size:.9em}.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-white)10%,transparent)}}.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-white)10%,transparent)}}.content :where(pre.mermaid):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)){background-color:#0000;border-radius:0}.content :where(pre.mermaid):not(:where(.hextra-code-block pre,[class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){background-color:#0000}.content :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-inline:auto;margin-block:calc(var(--hx-spacing)*4);border-radius:var(--hx-radius-md)}.content :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)) figcaption{margin-top:calc(var(--hx-spacing)*2);text-align:center;font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height));color:var(--hx-color-gray-500);display:block}.content :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)) figcaption:where(.dark,.dark *){color:var(--hx-color-gray-400)}.content :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)) dt{margin-top:calc(var(--hx-spacing)*6);--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold)}.content :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)) dd{margin-block:calc(var(--hx-spacing)*2);padding-inline-start:calc(var(--hx-spacing)*6)}.content :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-block:calc(var(--hx-spacing)*10);border-color:var(--hx-color-gray-200)}.content :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}.content :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)):last-child{margin-bottom:calc(var(--hx-spacing)*0)}.content :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)):where(.dark,.dark *){border-color:var(--hx-color-neutral-800)}.content .footnotes{margin-top:calc(var(--hx-spacing)*12);font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height))}.content .footnotes hr{border-color:var(--hx-color-gray-200)}.content .footnotes hr:where(.dark,.dark *){border-color:var(--hx-color-neutral-800)}.content .subheading-anchor{opacity:0;transition-property:opacity;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration))}.content .subheading-anchor:where(:dir(ltr),[dir=ltr],[dir=ltr] *){margin-left:calc(var(--hx-spacing)*1)}.content .subheading-anchor:where(:dir(rtl),[dir=rtl],[dir=rtl] *){margin-right:calc(var(--hx-spacing)*1)}span:target+:is(.content .subheading-anchor),:hover>:is(.content .subheading-anchor),.content .subheading-anchor:focus{opacity:1}span+:is(.content .subheading-anchor),:hover>:is(.content .subheading-anchor){text-decoration-line:none!important}.content .subheading-anchor:after{content:var(--tw-content);color:var(--hx-color-gray-300)}.content .subheading-anchor:where(.dark,.dark *):after{content:var(--tw-content);color:var(--hx-color-neutral-700)}.content .subheading-anchor:after{padding-inline:calc(var(--hx-spacing)*1);--tw-content:"#";content:var(--tw-content)}span:target+:is(){color:var(--hx-color-gray-400)}span:target+:is():where(.dark,.dark *){color:var(--hx-color-neutral-500)}article details>summary::-webkit-details-marker{display:none}article details>summary:before{vertical-align:-4px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='hx:h-5 hx:w-5' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z' clip-rule='evenodd' /%3E%3C/svg%3E");width:1.2em;height:1.2em;padding:0 .6em}:lang(fa) ol{list-style-type:persian}.highlight .chroma .err{color:#a61717;background-color:#e3d2d2}.highlight .chroma .lnlinks{color:inherit;outline:none;text-decoration:none}.highlight .chroma .line{display:flex}.highlight .chroma .k,.highlight .chroma .kc,.highlight .chroma .kd,.highlight .chroma .kn,.highlight .chroma .kp,.highlight .chroma .kr{color:#000;font-weight:700}.highlight .chroma .kt{color:#458;font-weight:700}.highlight .chroma .na{color:teal}.highlight .chroma .nb{color:#0086b3}.highlight .chroma .bp{color:#999}.highlight .chroma .nc{color:#458;font-weight:700}.highlight .chroma .no{color:teal}.highlight .chroma .nd{color:#3c5d5d;font-weight:700}.highlight .chroma .ni{color:purple}.highlight .chroma .ne,.highlight .chroma .nf,.highlight .chroma .nl{color:#900;font-weight:700}.highlight .chroma .nn{color:#555}.highlight .chroma .nt{color:navy}.highlight .chroma .nv,.highlight .chroma .vc,.highlight .chroma .vg,.highlight .chroma .vi{color:teal}.highlight .chroma .s,.highlight .chroma .sa,.highlight .chroma .sb,.highlight .chroma .sc,.highlight .chroma .dl,.highlight .chroma .sd,.highlight .chroma .s2,.highlight .chroma .se,.highlight .chroma .sh,.highlight .chroma .si,.highlight .chroma .sx{color:#d14}.highlight .chroma .sr{color:#009926}.highlight .chroma .s1{color:#d14}.highlight .chroma .ss{color:#990073}.highlight .chroma .m,.highlight .chroma .mb,.highlight .chroma .mf,.highlight .chroma .mh,.highlight .chroma .mi,.highlight .chroma .il,.highlight .chroma .mo{color:#099}.highlight .chroma .o,.highlight .chroma .ow{color:#000;font-weight:700}.highlight .chroma .c,.highlight .chroma .ch,.highlight .chroma .cm,.highlight .chroma .c1{color:#998;font-style:italic}.highlight .chroma .cs,.highlight .chroma .cp,.highlight .chroma .cpf{color:#999;font-style:italic;font-weight:700}.highlight .chroma .gd{color:#000;background-color:#fdd}.highlight .chroma .ge{color:#000;font-style:italic}.highlight .chroma .gr{color:#a00}.highlight .chroma .gh{color:#999}.highlight .chroma .gi{color:#000;background-color:#dfd}.highlight .chroma .go{color:#888}.highlight .chroma .gp{color:#555}.highlight .chroma .gs{font-weight:700}.highlight .chroma .gu{color:#aaa}.highlight .chroma .gt{color:#a00}.highlight .chroma .gl{text-decoration:underline}.highlight .chroma .w{color:#bbb}.dark .highlight .chroma .err{color:#f85149}.dark .highlight .chroma .lnlinks{color:inherit;outline:none;text-decoration:none}.dark .highlight .chroma .line{display:flex}.dark .highlight .chroma .k{color:#ff7b72}.dark .highlight .chroma .kc{color:#79c0ff}.dark .highlight .chroma .kd,.dark .highlight .chroma .kn{color:#ff7b72}.dark .highlight .chroma .kp{color:#79c0ff}.dark .highlight .chroma .kr,.dark .highlight .chroma .kt{color:#ff7b72}.dark .highlight .chroma .nc{color:#f0883e;font-weight:700}.dark .highlight .chroma .no{color:#79c0ff;font-weight:700}.dark .highlight .chroma .nd{color:#d2a8ff;font-weight:700}.dark .highlight .chroma .ni{color:#ffa657}.dark .highlight .chroma .ne{color:#f0883e;font-weight:700}.dark .highlight .chroma .nf{color:#d2a8ff;font-weight:700}.dark .highlight .chroma .nl{color:#79c0ff;font-weight:700}.dark .highlight .chroma .nn{color:#ff7b72}.dark .highlight .chroma .py{color:#79c0ff}.dark .highlight .chroma .nt{color:#7ee787}.dark .highlight .chroma .nv{color:#79c0ff}.dark .highlight .chroma .l{color:#a5d6ff}.dark .highlight .chroma .ld{color:#79c0ff}.dark .highlight .chroma .s{color:#a5d6ff}.dark .highlight .chroma .sa{color:#79c0ff}.dark .highlight .chroma .sb,.dark .highlight .chroma .sc{color:#a5d6ff}.dark .highlight .chroma .dl{color:#79c0ff}.dark .highlight .chroma .sd,.dark .highlight .chroma .s2{color:#a5d6ff}.dark .highlight .chroma .se,.dark .highlight .chroma .sh{color:#79c0ff}.dark .highlight .chroma .si,.dark .highlight .chroma .sx{color:#a5d6ff}.dark .highlight .chroma .sr{color:#79c0ff}.dark .highlight .chroma .s1,.dark .highlight .chroma .ss,.dark .highlight .chroma .m,.dark .highlight .chroma .mb,.dark .highlight .chroma .mf,.dark .highlight .chroma .mh,.dark .highlight .chroma .mi,.dark .highlight .chroma .il,.dark .highlight .chroma .mo{color:#a5d6ff}.dark .highlight .chroma .o,.dark .highlight .chroma .ow{color:#ff7b72;font-weight:700}.dark .highlight .chroma .c,.dark .highlight .chroma .ch,.dark .highlight .chroma .cm,.dark .highlight .chroma .c1{color:#8b949e;font-style:italic}.dark .highlight .chroma .cs,.dark .highlight .chroma .cp,.dark .highlight .chroma .cpf{color:#8b949e;font-style:italic;font-weight:700}.dark .highlight .chroma .gd{color:#ffa198;background-color:#490202}.dark .highlight .chroma .ge{color:inherit;font-style:italic}.dark .highlight .chroma .gr{color:#ffa198}.dark .highlight .chroma .gh{color:#79c0ff;font-weight:700}.dark .highlight .chroma .gi{color:#56d364;background-color:#0f5323}.dark .highlight .chroma .go,.dark .highlight .chroma .gp{color:#8b949e}.dark .highlight .chroma .gs{font-weight:700}.dark .highlight .chroma .gu{color:#79c0ff}.dark .highlight .chroma .gt{color:#ff7b72}.dark .highlight .chroma .gl{text-decoration:underline}.dark .highlight .chroma .w{color:#6e7681}.hextra-code-block{--tw-leading:calc(var(--hx-spacing)*5);font-size:.9em;line-height:calc(var(--hx-spacing)*5)}.hextra-code-block pre{background-color:var(--hx-color-primary-700);overflow-x:auto}@supports (color:color-mix(in lab, red, red)){.hextra-code-block pre{background-color:color-mix(in oklab,var(--hx-color-primary-700)5%,transparent)}}.hextra-code-block pre{--tw-font-weight:var(--hx-font-weight-medium);font-size:.9em;font-weight:var(--hx-font-weight-medium);-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}@media (prefers-contrast:more){.hextra-code-block pre{border-style:var(--tw-border-style);border-width:1px;border-color:var(--hx-color-primary-900)}@supports (color:color-mix(in lab, red, red)){.hextra-code-block pre{border-color:color-mix(in oklab,var(--hx-color-primary-900)20%,transparent)}}.hextra-code-block pre{--tw-contrast:contrast(150%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.hextra-code-block pre:where(.dark,.dark *){background-color:var(--hx-color-primary-300)}@supports (color:color-mix(in lab, red, red)){.hextra-code-block pre:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-300)10%,transparent)}}@media (prefers-contrast:more){.hextra-code-block pre:where(.dark,.dark *){border-color:var(--hx-color-primary-100)}@supports (color:color-mix(in lab, red, red)){.hextra-code-block pre:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-primary-100)40%,transparent)}}}.hextra-code-block .hextra-code-filename{top:calc(var(--hx-spacing)*0);z-index:1;text-overflow:ellipsis;white-space:nowrap;border-top-left-radius:var(--hx-radius-xl);border-top-right-radius:var(--hx-radius-xl);background-color:var(--hx-color-primary-700);width:100%;position:absolute;overflow:hidden}@supports (color:color-mix(in lab, red, red)){.hextra-code-block .hextra-code-filename{background-color:color-mix(in oklab,var(--hx-color-primary-700)5%,transparent)}}.hextra-code-block .hextra-code-filename{padding-inline:calc(var(--hx-spacing)*4);padding-block:calc(var(--hx-spacing)*2);font-size:var(--hx-text-xs);line-height:var(--tw-leading,var(--hx-text-xs--line-height));color:var(--hx-color-gray-700)}.hextra-code-block .hextra-code-filename:where(.dark,.dark *){background-color:var(--hx-color-primary-300)}@supports (color:color-mix(in lab, red, red)){.hextra-code-block .hextra-code-filename:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-primary-300)10%,transparent)}}.hextra-code-block .hextra-code-filename:where(.dark,.dark *){color:var(--hx-color-gray-200)}.hextra-code-block .hextra-code-filename+pre:not(.lntable pre){padding-top:calc(var(--hx-spacing)*12)}.hextra-code-block pre:not(.lntable pre){margin-bottom:calc(var(--hx-spacing)*4);border-radius:var(--hx-radius-xl);padding-inline:calc(var(--hx-spacing)*4);padding-block:calc(var(--hx-spacing)*4)}.hextra-code-block div:nth-of-type(2) pre{padding-top:calc(var(--hx-spacing)*12);padding-bottom:calc(var(--hx-spacing)*4)}.chroma .lntable{margin:calc(var(--hx-spacing)*0);border-radius:var(--hx-radius-xl);width:auto;display:block;overflow:auto}.chroma .lntable pre{padding-top:calc(var(--hx-spacing)*4);padding-bottom:calc(var(--hx-spacing)*4)}.chroma .ln,.chroma .lnt:not(.hl>.lnt),.chroma .hl:not(.line){min-width:2.6rem;padding-right:calc(var(--hx-spacing)*4);padding-left:calc(var(--hx-spacing)*4);color:var(--hx-color-neutral-600)}:is(.chroma .ln,.chroma .lnt:not(.hl>.lnt),.chroma .hl:not(.line)):where(.dark,.dark *){color:var(--hx-color-neutral-300)}.chroma .lntd{padding:calc(var(--hx-spacing)*0);vertical-align:top}.chroma .lntd:last-of-type{width:100%}.chroma .hl{background-color:var(--hx-color-primary-800);width:100%;display:block}@supports (color:color-mix(in lab, red, red)){.chroma .hl{background-color:color-mix(in oklab,var(--hx-color-primary-800)10%,transparent)}}.hextra-cards{grid-template-columns:repeat(auto-fill,minmax(max(250px,calc((100% - 1rem*2)/var(--hextra-cards-grid-cols))),1fr))}.hextra-card{position:relative}.hextra-card img{-webkit-user-select:none;user-select:none}.hextra-card:hover .hextra-card-icon svg{color:currentColor}.hextra-card .hextra-card-icon svg{color:#0003;width:1.5rem;transition:color .3s}.hextra-card p{margin-top:.5rem;position:relative}.dark .hextra-card .hextra-card-icon svg{color:#fff6}.dark .hextra-card:hover .hextra-card-icon svg{color:currentColor}.hextra-card-tag{z-index:10;position:absolute;top:5px}.hextra-card-tag:where(:dir(ltr)){right:5px}.hextra-card-tag:where(:dir(rtl)){left:5px}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker){counter-increment:step}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):where(:dir(ltr),[dir=ltr],[dir=ltr] *):before{content:var(--tw-content);margin-left:-41px}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):where(:dir(rtl),[dir=rtl],[dir=rtl] *):before{content:var(--tw-content);margin-right:-44px}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):before{content:var(--tw-content);background-color:var(--hx-color-gray-100)}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):where(.dark,.dark *):before{content:var(--tw-content);background-color:var(--hx-color-neutral-800)}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):before{content:var(--tw-content);border-style:var(--tw-border-style);content:var(--tw-content);border-width:4px;border-color:var(--hx-color-white)}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):where(.dark,.dark *):before{content:var(--tw-content);border-color:var(--hx-color-dark)}.hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):before{content:counter(step);text-align:center;text-indent:-1px;width:33px;height:33px;font-size:var(--hx-text-base);line-height:var(--tw-leading,var(--hx-text-base--line-height));--tw-font-weight:var(--hx-font-weight-normal);font-weight:var(--hx-font-weight-normal);color:var(--hx-color-neutral-400);border-radius:3.40282e38px;position:absolute}:lang(fa) .hextra-steps :where(h2,h3,h4,h5,h6):not(.no-step-marker):before{content:counter(step,persian)}.hextra-search-wrapper li{margin-inline:calc(var(--hx-spacing)*2.5);border-radius:var(--hx-radius-md);overflow-wrap:break-word;color:var(--hx-color-gray-800)}@media (prefers-contrast:more){.hextra-search-wrapper li{border-style:var(--tw-border-style);border-width:1px;border-color:#0000}}.hextra-search-wrapper li:where(.dark,.dark *){color:var(--hx-color-gray-300)}.hextra-search-wrapper li a{scroll-margin:calc(var(--hx-spacing)*12);padding-inline:calc(var(--hx-spacing)*2.5);padding-block:calc(var(--hx-spacing)*2);display:block}.hextra-search-wrapper li a:focus,.hextra-search-wrapper li a:focus-visible{--tw-outline-style:none;outline-style:none}.hextra-search-wrapper li .hextra-search-title{font-size:var(--hx-text-base);line-height:var(--tw-leading,var(--hx-text-base--line-height));--tw-leading:calc(var(--hx-spacing)*5);line-height:calc(var(--hx-spacing)*5);--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold)}.hextra-search-wrapper li .hextra-search-active{border-radius:var(--hx-radius-md);background-color:var(--hx-color-primary-500)}@supports (color:color-mix(in lab, red, red)){.hextra-search-wrapper li .hextra-search-active{background-color:color-mix(in oklab,var(--hx-color-primary-500)10%,transparent)}}@media (prefers-contrast:more){.hextra-search-wrapper li .hextra-search-active{border-color:var(--hx-color-primary-500)}}.hextra-search-wrapper .hextra-search-no-result{padding:calc(var(--hx-spacing)*8);text-align:center;font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height));color:var(--hx-color-gray-400);-webkit-user-select:none;user-select:none;display:block}.hextra-search-wrapper .hextra-search-prefix{margin-inline:calc(var(--hx-spacing)*2.5);margin-top:calc(var(--hx-spacing)*6);margin-bottom:calc(var(--hx-spacing)*2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--hx-color-black)}@supports (color:color-mix(in lab, red, red)){.hextra-search-wrapper .hextra-search-prefix{border-color:color-mix(in oklab,var(--hx-color-black)10%,transparent)}}.hextra-search-wrapper .hextra-search-prefix{padding-inline:calc(var(--hx-spacing)*2.5);padding-bottom:calc(var(--hx-spacing)*1.5);font-size:var(--hx-text-xs);line-height:var(--tw-leading,var(--hx-text-xs--line-height));--tw-font-weight:var(--hx-font-weight-semibold);font-weight:var(--hx-font-weight-semibold);color:var(--hx-color-gray-500);text-transform:uppercase;-webkit-user-select:none;user-select:none}.hextra-search-wrapper .hextra-search-prefix:first-child{margin-top:calc(var(--hx-spacing)*0)}@media (prefers-contrast:more){.hextra-search-wrapper .hextra-search-prefix{border-color:var(--hx-color-gray-600);color:var(--hx-color-gray-900)}}.hextra-search-wrapper .hextra-search-prefix:where(.dark,.dark *){border-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.hextra-search-wrapper .hextra-search-prefix:where(.dark,.dark *){border-color:color-mix(in oklab,var(--hx-color-white)20%,transparent)}}.hextra-search-wrapper .hextra-search-prefix:where(.dark,.dark *){color:var(--hx-color-gray-300)}@media (prefers-contrast:more){.hextra-search-wrapper .hextra-search-prefix:where(.dark,.dark *){border-color:var(--hx-color-gray-50);color:var(--hx-color-gray-50)}}.hextra-search-wrapper .hextra-search-excerpt{margin-top:calc(var(--hx-spacing)*1);font-size:var(--hx-text-sm);line-height:var(--tw-leading,var(--hx-text-sm--line-height));--tw-leading:1.35rem;text-overflow:ellipsis;color:var(--hx-color-gray-600);line-height:1.35rem;overflow:hidden}.hextra-search-wrapper .hextra-search-excerpt:where(.dark,.dark *){color:var(--hx-color-gray-400)}@media (prefers-contrast:more){.hextra-search-wrapper .hextra-search-excerpt:where(.dark,.dark *){color:var(--hx-color-gray-50)}}.hextra-search-wrapper .hextra-search-excerpt{line-clamp:1;-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box}.hextra-search-wrapper .hextra-search-match{color:var(--hx-color-primary-600)}@media (max-width:48rem){.hextra-sidebar-container{top:calc(var(--hx-spacing)*0);bottom:calc(var(--hx-spacing)*0);z-index:15;overscroll-behavior:contain;background-color:var(--hx-color-white);width:100%;padding-top:calc(var(--navbar-height) + var(--hextra-banner-height));position:fixed}.hextra-sidebar-container:where(.dark,.dark *){background-color:var(--hx-color-dark)}.hextra-sidebar-container{will-change:transform,opacity;contain:layout style;backface-visibility:hidden;transition:transform .4s cubic-bezier(.52,.16,.04,1)}}.hextra-sidebar-container li>div{height:calc(var(--hx-spacing)*0)}.hextra-sidebar-container li.open>div{height:auto;padding-top:calc(var(--hx-spacing)*1)}.hextra-sidebar-container li.open>a>span>svg>path{rotate:90deg}.hextra-banner-hidden .hextra-banner{display:none}.hextra-banner :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){text-decoration-line:underline;text-decoration-thickness:from-font}.hextra-banner :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){--tw-leading:calc(var(--hx-spacing)*7);line-height:calc(var(--hx-spacing)*7)}.hextra-banner :where(p):not(:where([class~=not-prose],[class~=not-prose] *)):first-child{margin-top:calc(var(--hx-spacing)*0)}nav .hextra-search-wrapper{display:none}@media (min-width:48rem){nav .hextra-search-wrapper{display:inline-block}}@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){.hextra-nav-container-blur{background-color:var(--hx-color-white)}@supports (color:color-mix(in lab, red, red)){.hextra-nav-container-blur{background-color:color-mix(in oklab,var(--hx-color-white)85%,transparent)}}.hextra-nav-container-blur{--tw-backdrop-blur:blur(var(--hx-blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.hextra-nav-container-blur:where(.dark,.dark *){background-color:var(--hx-color-dark)!important}@supports (color:color-mix(in lab, red, red)){.hextra-nav-container-blur:where(.dark,.dark *){background-color:color-mix(in oklab,var(--hx-color-dark)80%,transparent)!important}}}.hextra-hamburger-menu svg g{transform-origin:50%;transition-property:all;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration));--tw-duration:.1s;--tw-ease:var(--hx-ease-out);transition-duration:.1s;transition-timing-function:var(--hx-ease-out)}.hextra-hamburger-menu svg path{opacity:1;transition-property:all;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration));--tw-duration:.1s;--tw-ease:var(--hx-ease-out);transition-duration:.1s;transition-delay:.1s;transition-timing-function:var(--hx-ease-out)}.hextra-hamburger-menu svg.open path{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration));--tw-duration:.1s;--tw-ease:var(--hx-ease-out);transition-duration:.1s;transition-delay:0s;transition-timing-function:var(--hx-ease-out)}.hextra-hamburger-menu svg.open g{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration));--tw-duration:.1s;--tw-ease:var(--hx-ease-out);transition-duration:.1s;transition-delay:.1s;transition-timing-function:var(--hx-ease-out)}.hextra-hamburger-menu svg.open>path{opacity:0}.hextra-hamburger-menu svg.open>g:first-of-type{rotate:45deg}.hextra-hamburger-menu svg.open>g:first-of-type path{--tw-translate-y:calc(var(--hx-spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.hextra-hamburger-menu svg.open>g:nth-of-type(2){rotate:-45deg}.hextra-hamburger-menu svg.open>g:nth-of-type(2) path{--tw-translate-y:calc(var(--hx-spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.hextra-scrollbar,.hextra-scrollbar *{scrollbar-width:thin;scrollbar-color:oklch(55.55% 0 0/.4) transparent;scrollbar-gutter:stable}:is(.hextra-scrollbar,.hextra-scrollbar *)::-webkit-scrollbar{height:calc(var(--hx-spacing)*3);width:calc(var(--hx-spacing)*3)}:is(.hextra-scrollbar,.hextra-scrollbar *)::-webkit-scrollbar-track{background-color:#0000}:is(.hextra-scrollbar,.hextra-scrollbar *)::-webkit-scrollbar-thumb{border-radius:10px}:is(.hextra-scrollbar,.hextra-scrollbar *):hover::-webkit-scrollbar-thumb{background-color:var(--tw-shadow-color);--tw-shadow-color:var(--hx-color-neutral-500);background-clip:content-box;border:3px solid #0000}@supports (color:color-mix(in lab, red, red)){:is(.hextra-scrollbar,.hextra-scrollbar *):hover::-webkit-scrollbar-thumb{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--hx-color-neutral-500)20%,transparent)var(--tw-shadow-alpha),transparent)}}@media (hover:hover){:is(.hextra-scrollbar,.hextra-scrollbar *):hover::-webkit-scrollbar-thumb:hover{--tw-shadow-color:var(--hx-color-neutral-500)}@supports (color:color-mix(in lab, red, red)){:is(.hextra-scrollbar,.hextra-scrollbar *):hover::-webkit-scrollbar-thumb:hover{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--hx-color-neutral-500)40%,transparent)var(--tw-shadow-alpha),transparent)}}}@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){.hextra-code-copy-btn{opacity:.85;--tw-backdrop-blur:blur(var(--hx-blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.hextra-code-copy-btn:where(.dark,.dark *){opacity:.8}}@media (min-width:1024px){.hextra-feature-grid{grid-template-columns:repeat(var(--hextra-feature-grid-cols),minmax(0,1fr))}}.hextra-jupyter-code-cell{scrollbar-gutter:auto;margin-top:calc(var(--hx-spacing)*6)}.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container{font-size:var(--hx-text-xs);line-height:var(--tw-leading,var(--hx-text-xs--line-height));overflow:hidden}.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container .hextra-jupyter-code-cell-outputs{max-height:50vh;overflow:auto}.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container .hextra-jupyter-code-cell-outputs pre{max-width:100%;font-size:var(--hx-text-xs);line-height:var(--tw-leading,var(--hx-text-xs--line-height));overflow:auto}.hextra-badge{align-items:center;display:inline-flex}.hextra-toc a.hextra-toc-active{transition-property:all;transition-timing-function:var(--tw-ease,var(--hx-default-transition-timing-function));transition-duration:var(--tw-duration,var(--hx-default-transition-duration));--tw-duration:.2s;transition-duration:.2s;color:var(--hx-color-gray-900)!important}.hextra-toc a.hextra-toc-active:where(.dark,.dark *){color:var(--hx-color-gray-50)!important}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0} diff --git a/public/css/custom.css b/public/css/custom.css new file mode 100644 index 0000000..e69de29 diff --git a/public/css/variables.css b/public/css/variables.css new file mode 100644 index 0000000..e09ba2e --- /dev/null +++ b/public/css/variables.css @@ -0,0 +1,21 @@ +/* Hugo template to derive CSS variables from site and page parameters */ + +/* Do not remove the following comment. It is used by Hugo to render CSS variables.*/ + +:root { + --hextra-max-page-width: 80rem; + --hextra-max-navbar-width: 80rem; + --hextra-max-footer-width: 80rem; +} + +.hextra-max-page-width { + max-width: var(--hextra-max-page-width); +} + +.hextra-max-navbar-width { + max-width: var(--hextra-max-navbar-width); +} + +.hextra-max-footer-width { + max-width: var(--hextra-max-footer-width); +} diff --git a/public/en.search-data.json b/public/en.search-data.json new file mode 100644 index 0000000..e57d07c --- /dev/null +++ b/public/en.search-data.json @@ -0,0 +1 @@ +{"/courses/prog-intro/homeworks/sum/":{"data":{"solution#Solution":"After reading about String, Integer, System.err we now know about some usefull methods:\nInteger.parseInt(String s, int radix) which parses the string argument as a signed integer in the radix specified by the second argument. So it basically converts a number from the String data type to int. Character.isWhitespace(char ch) which checks if a character ch is a space symbol or not. Now let’s start coding. Firstly let’s define the structure of our program. I will be putting the name of the file at the first line comment in a file and its path if its nessesary.\n// Sum.java public class Sum { public static void main(String[] args) { // ... } } Okay that’s done. What do we do next? Let’s look at String[] args argument to our main method. It represents an array of command line arguments which we need to sum. So know we made our task a little bit easier. Now we can just say that we need to find sum of elements of array args.\nHow are we going to do it though? First let’s understand what we can do with this array. Let’s modify our class a little bit.\n// Sum.java public class Sum { public static void main(String[] args) { System.out.println(args.length); } } We’ve added System.out.println(args.length) which takes the field length from our args object and prints it to the console.\nLet’s try it. First compile our class using\n$ javac Sum.java And then we can do some manual testing.\n$ java Sum 1 2 3 3 We got 3 as an output as expected. We gave our program 3 command line arguments: 1, 2 and 3.\nHere are all of the examples\n$ java Sum 1 2 -3 3 $ java Sum \"1 2 3\" 1 Note\nNotice, that we got 1 instead of 3. That’s because we put our arguments in \"\" so this becomes a single string argument.\n$ java Sum \"1 2\" \" 3\" 2 $ java Sum \" \" 1 Note\nHere program gives us 1 instead of 0, because despite not having any numbers in the arguments a single whitespace is still an argument.\nNow let’s try not obly to count our arguments but to list them as well. Let’s modify our program a little bit more.\n// Sum.java public class Sum { public static void main(String[] args) { System.out.println(\"number of arguments: \" + args.length); for (String argument : args) { System.out.println(argument); } } } Here I used for loop to do printing for every String element in args.\nLet’s try this with our examples. And don’t forget to recompile using javac Sum.java.\n$ java Sum 1 2 3 number of arguments: 3 1 2 3 $ java Sum 1 2 -3 number of arguments: 3 1 2 -3 $ java Sum \"1 2 3\" number of arguments: 1 1 2 3 Note\nAgain, notice only one string argument.\n$ java Sum \"1 2\" \" 3\" number of arguments: 2 1 2 3 $ java Sum \" \" number of arguments: 1 Okay, now that we know how to iterate (or do something for every element), we can calculate the sum of all the numbers in the args array. To do that we need to create a new variable sum of integer type and assign it the value of 0. Then for every number in args we will add it to sum, and so by the end of array we will have the sum of all numbers stored in variable sum. This is what the code will look like\n// Sum.java public class Sum { public static void main(String[] args) { System.out.println(\"number of arguments: \" + args.length); int sum = 0; for (String argument : args) { sum = sum + argument; System.out.println(argument); System.out.println(sum); } System.out.println(sum); } } Seems ok. But let’s test it.\n$ javac Sum.java Sum.java:9: error: incompatible types: String cannot be converted to int sum = sum + argument; ^ 1 error We got a compilation error that says String cannot be converted to int. It means that when we try to add 2 variables sum and argument their types don’t match. The type of sum is integer and string for argument. It seems pretty logical because what do we expect when adding for example 1 and apple?..\nImportant\nSo we need to cast argument to integer data type so that we can add it to sum.\nWe can do so using Integer.parseInt() method.\nIt takes a String s and returns an int, which a string s represents. For example this code will work as expected\n// ParseIntExample.java public class ParseIntExample { public static void main(String[] args) { String s = \"123\"; int sum = 321; //! sum = sum + s; sum = sum + Integer.parseInt(s); System.out.println(sum); } } The commented out line (//!) would have given us an exception.","task#Task":"Task You need to create a Sum class which will sum integers from command line arguments and output the sum to console.\nExamples:\njava Sum 1 2 3 Expected output: 6.\njava Sum 1 2 -3 Expected output: 0.\njava Sum \"1 2 3\" Expected output: 6.\njava Sum \"1 2\" \" 3\" Expected output: 6.\njava Sum \" \" Expected output: 0.\nArguments can be:\ndigits, signes + and -, space symbols You can assume that int type is sufficient for in-between calculations and result.\nBefore doing the task make sure to read docs for classes String and Integer.\nFor debugging use System.err, because it will be ingnored by the testing program."},"title":"Sum"},"/courses/prog-intro/lectures/intro/":{"data":{"how-should-java-code-look-like#How should Java code look like?":"You can go and learn about it here.","what-does-java-consist-of#What does Java consist of?":"Java consists of multiple main components. The first one being the Java compiler. The process of converting human-readable text to machine code is called compilation.\nImg.2 - Simplified Compilation Process\nThe behaviour of the Java compiler is described by the Java Language Specification or JLS.\nLet’s talk about compilers a little bit. For example if we will take C++. If we take C++ compiler for x86-64 platform and Windows operating system, and launch the compiler on source code it will turn it directly into assembly code.\nImg. X – C++ code compilation process under x86-64 architecture.\nBut what if I want to run my program on Linux instead of Windows. I will need to take a different compiler under different operating system and recompile my code using a new compiler. It’s not very convenient.\nJava tries to protect us from that. By converting the Java source code into Java byte code. And then the byte code will be ran on the Java virtual machine which will run our program on the native processor.\nImg. X – Java code compilation\nThis approach allows to change only JVM according to our platform (x86_64, ARM, …) and operating system (Windows, MacOS, GNU-Linux, …) while byte code stays the same. We can only write our code once, than compile it and run under everywhere.\nAs the motto says:\nWrite once – debug run everywhere.\nThe third component of Java is the standart library which is included in the JVM.\nThere are multiple redactions of Java-platforms:\nStandart edition For regular aplications Enterprise edition For server aplications Micro-edition For mobile aplications Isn’t in use nowadays 🪦 Java Card Sim- and smart-cards There also were multiple versions of Java throughout its history.\nJDK 1.0 (Jan 1996) J2SE 1.2 (Dec 1998) Collections Framework J2SE 5.0 (Sep 2004) Generics Java SE 8 (Mar 2014) Streams and Lambdas Java SE 9 (Sep 2017) Modules Java SE 10 (Mar 2018) var Java 11 (Sep 2018) jshell Java 17 [LTS-old] (Sep 2021) Previous stable version Many little changes Java 21 [LTS] (Sep 2023) Current stable version Java 25 (Sep 2025) Next version Java comes in two parts: JDK - Java Development Kit and JVM - Java Virtual Machine.\nThere is also a JRE - Java Runtime Environment. For example if we want to run our code somewhere on the server we don’t need to compile it there because we have our byte code and we just need JRE to run it.\nSome of the most popular JVMs right now are:\nOpenJDK Eclipse Azul Systems Excelsior JET The disadvantage of such system is in the connection between JVM and a native processing unit. In case of C++ compiler that we reviewed earlier the source code is compiled directly into machine-code but in case with Java it is compiled into byte-code. And so the problem is to develop such a JVM that would quickly turn our byte-code into machine-code. Anyway it takes extra time. That’s why it mostly will be slower than direct compilation into machine-code. So ultimately while we have the advantage of compiling out code only once, we have the disadvantage of turning byte-code into machine-code slower.\nNone the less, there is a way to speed up this process which is called JIT - Just In Time compilation. How does it work? While our program is running some of the instructions or functions turns directly into processor commands.","what-is-garbage-collection#What is garbage collection?":"For example we have int which is represented with 4 bytes of data which is directly stored in memory.\nImg. X – int in memory\nBut what if we have a String. How many memory cells does this string take? We don’t know. We will say that our String that has length of 5 symbols is stored at 0x12347865. We defined an address where this string is located in memory. And somewhere in the memory of our programm will be a large buffer where the 5 cells will be stored.\nImg. X – String in memory\nBut what do we do with that buffer? We won’t need it forever and so sometimes we need to clear that buffer. In case with C/C++ whoever created the memory for that string is in charge of clearing it. There are also languages with garbage collection such as Java and Python. The purpose of the Garbage Collector is to automatically find variables that we no longer need and clear their memory.\nSuppose we have some code like this.\nif (someCondition) { x = [1, 3, 7] // first link // some code here y = x // second link // some code here } // no links After the if-statement we no longer need x or y. Every variable in this case x and y is the link to our array ([1, 3, 7]). After we left the if-statement the amount of links to the array is zero, so we can safely delete the array. This approach is implemented in Python. The problem is that if we have to objects linked to one another and there are no external links, they will not be deleted by garbage collector since there link counter is 1.\nImg. X – Edge case for link counting\nThe advanced way of implementing the garbage collection is traversing the graph of links which is implemented in Java, C# and Go.","what-other-advantages-does-java-have#What other advantages does Java have?":"It’s easy (in terms of syntax) It’s secure and stable It supports Unicode It supports multithreading It has backwards compatibility","why-do-we-choose-java#Why do we choose Java?":"Why do we choose Java?According to TIOBE Programming Community Index Java is one of the most demanded languages in the programming field.\nImg. 1 - TIOBE Programming Community Index\nAlso, Java has a lot of advantages for beginners such as:\nIt’s fairly easy It has a broad spectre of usage Server Desktop Mobile devices Smart-cards"},"title":"Lecture 1. Introduction"},"/courses/spring-boot/":{"data":{"configuring-application-properties#Configuring Application Properties":"Let’s take a look at src/main/resources/application.properties:\nspring.application.name=store To use this property in our code, we can use the @Value annotation. Let’s update HomeController to print the application name:\npackage tech.codejava.store; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HomeController { @Value(\"${spring.application.name}\") private String appName; @RequestMapping(\"/\") // this represents the root of our website public String index() { System.out.println(\"application name = \" + appName); return \"index.html\"; // this returns the view } } After running the application, we can see store printed in the terminal:\n... 2026-02-19T15:32:37.507+03:00 INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2026-02-19T15:32:37.509+03:00 INFO 41536 --- [store] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms application name = store ...","controllers#Controllers":"Spring MVC stands for Model View Controller.\nModel is where our application’s data lives. It represents the business logic and is usually connected to a database or other data sources. In Spring Boot, the model can be a simple Java class. View is what the user sees. It’s the HTML, CSS or JavaScript rendered in the browser. In Spring MVC, views can be static files or dynamically generated. Controller is like a traffic controller. It handles incoming requests from the user, interacts with the model to get data and then tells the view what to display. Let’s add a new Java class called HomeController at src/main/java/tech/codejava/store/HomeController.java:\npackage tech.codejava.store; public class HomeController {} To make this a controller, decorate it with the @Controller annotation:\npackage tech.codejava.store; import org.springframework.stereotype.Controller; @Controller public class HomeController {} Now let’s add an index method. When we send a request to the root of our website, we want this method to be called:\npackage tech.codejava.store; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HomeController { @RequestMapping(\"/\") // this represents the root of our website public String index() { return \"index.html\"; // this returns the view } } Now we need to create the view. Add index.html at src/main/resources/static/index.html:\n\u003c!doctype html\u003e \u003chtml lang=\"en\"\u003e \u003chead\u003e \u003cmeta charset=\"UTF-8\" /\u003e \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e \u003ctitle\u003eView\u003c/title\u003e \u003c/head\u003e \u003cbody\u003e \u003ch1\u003eHello world!\u003c/h1\u003e \u003c/body\u003e \u003c/html\u003e Let’s build and run our application using mvn spring-boot:run. From the logs:\n2026-02-19T14:55:23.948+03:00 INFO 36752 --- [store] [ main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http) Our app is up and running at localhost:8080.\nImg. 7 — Our app is up and running!","dependency-injection#Dependency Injection":"Imagine we’re building an E-Commerce application that handles placing orders. When an order is placed, the customer’s payment needs to be processed — so OrderService depends on a payment service like StripePaymentService. We can say that OrderService is dependent on (or coupled to) StripePaymentService.\nImg. 8 — Depends On/Coupled To relation\nLet’s talk about the issues that arise when one class is tightly coupled to another.\nInflexibility — OrderService can only use StripePaymentService. If tomorrow we decide to switch to a different payment provider like PayPal, we would have to modify OrderService. Once we change it, it has to be recompiled and retested, which could impact other classes that depend on it. Untestability — We cannot test OrderService in isolation, because OrderService is tightly coupled with StripePaymentService and we can’t test its logic separately from it. Note\nThe problem here isn’t that OrderService depends on StripePaymentService — dependencies are normal in any application. The issue is about how the dependency is created and managed.\nAnalogy: Think of a restaurant. A restaurant needs a chef — that’s a perfectly normal dependency. If the current chef becomes unavailable, the restaurant can hire another one.\nImg. X — Restaurant — Chef dependency (Normal)\nNow what if we replace “chef” with a specific person: John? Our restaurant is now dependent on John specifically. If John becomes unavailable, we can’t replace him — the restaurant is in trouble. This is an example of tight or bad coupling.\nImg. X — Restaurant — John dependency (Bad coupling)\nWe don’t want OrderService to be tightly coupled to a specific payment service like Stripe. Instead, we want it to depend on a PaymentService interface, which could be Stripe, PayPal, or any other provider. To achieve this we can use the interface to decouple OrderService from StripePaymentService.\nImg. X — PaymentService as interface\nIf OrderService depends on a PaymentService interface, it doesn’t know anything about Stripe, PayPal, or any other payment provider. As long as these providers implement PaymentService, they can be used to handle payments — and OrderService won’t care which one is being used.\nBenefits:\nIf we replace StripePaymentService with PayPalPaymentService, the OrderService class is not affected. We don’t need to modify or recompile OrderService. We can test OrderService in isolation, without relying on the specific payment provider like Stripe. With this setup, we simply give OrderService a particular implementation of PaymentService. This is called dependency injection — we inject the dependency into a class.\nImg. X — Dependency Injection example\nLet’s see how it works in our project. Create OrderService at src/main/java/tech/codejava/store/OrderService.java:\npackage tech.codejava.store; public class OrderService { public void placeOrder() {} } Note\nIn a real project we would need to provide something like Order order to this method, but for teaching purposes we won’t do that.\nNow create StripePaymentService in the same directory:\npackage tech.codejava.store; public class StripePaymentService { public void processPayment(double amount) { System.out.println(\"=== STRIPE ===\"); System.out.println(\"amount: \" + amount); } } Let’s implement placeOrder in OrderService using StripePaymentService:\npackage tech.codejava.store; public class OrderService { public void placeOrder() { var paymentService = new StripePaymentService(); paymentService.processPayment(10); } } Important\nThis is our before setup — before we introduced the interface. In this implementation, OrderService is tightly coupled to StripePaymentService. We cannot test OrderService in isolation, and switching to another payment provider would require modifying OrderService.\nLet’s fix this. Create a PaymentService interface in the same directory:\npackage tech.codejava.store; public interface PaymentService { void processPayment(double amount); } Modify StripePaymentService to implement PaymentService:\npackage tech.codejava.store; public class StripePaymentService implements PaymentService { @Override public void processPayment(double amount) { System.out.println(\"=== STRIPE ===\"); System.out.println(\"amount: \" + amount); } } The recommended way to inject a dependency into a class is via its constructor. Let’s define one in OrderService:\npackage tech.codejava.store; public class OrderService { private PaymentService paymentService; public OrderService(PaymentService paymentService) { this.paymentService = paymentService; } public void placeOrder() { paymentService.processPayment(10); } } Now let’s see this in action. Modify StoreApplication:\npackage tech.codejava.store; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StoreApplication { public static void main(String[] args) { // SpringApplication.run(StoreApplication.class, args); var orderService = new OrderService(new StripePaymentService()); orderService.placeOrder(); } } Running the application (output intentionally reduced):\n... === STRIPE === amount: 10.0 ... Now let’s create a PayPalPaymentService in the same directory:\npackage tech.codejava.store; public class PayPalPaymentService implements PaymentService { @Override public void processPayment(double amount) { System.out.println(\"=== PayPal ===\"); System.out.println(\"amount: \" + amount); } } Now we can switch from StripePaymentService to PayPalPaymentService in StoreApplication — without touching OrderService at all:\npackage tech.codejava.store; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StoreApplication { public static void main(String[] args) { // SpringApplication.run(StoreApplication.class, args); // var orderService = new OrderService(new StripePaymentService()); var orderService = new OrderService(new PayPalPaymentService()); orderService.placeOrder(); } } ... === PayPal === amount: 10.0 ... Notice that we didn’t change OrderService. In object-oriented programming this is known as the Open/Closed Principle:\nA class should be open for extension and closed for modification.\nIn other words: we should be able to add new functionality to a class without changing its existing code. This reduces the risk of introducing bugs and breaking other parts of the application.","dependency-management#Dependency Management":"Dependencies are third-party libraries or frameworks we use in our application. For example, to build a web application we need an embedded web server like Tomcat, libraries for handling web requests, building APIs, processing JSON data, logging and so on.\nIn Spring Boot applications, instead of adding multiple individual libraries, we can use a starter dependency.\nImg. 5 — Spring Boot Starter Web\nTo use this dependency, copy the following into your pom.xml:\norg.springframework.boot spring-boot-starter-web 4.1.0-M1 So the dependencies section would look like this:\norg.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-web Important\nNotice that the version is commented out. It’s a better practice to let Spring Boot decide what version of the dependency to use, as it ensures compatibility across your project.","initialize-spring-boot-project#Initialize Spring Boot Project":"To initialize a new Spring Boot project, go to start.spring.io and select the options that suit you.\nImg. 3 — Spring Boot options\nAfter unpacking the zip archive, you’ll have this template project:\n. ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── tech │ │ │ └── codejava │ │ │ └── store │ │ │ └── StoreApplication.java │ │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── tech │ └── codejava │ └── store │ └── StoreApplicationTests.java └── target ├── classes │ ├── application.properties │ └── tech │ └── codejava │ └── store │ └── StoreApplication.class ├── generated-sources │ └── annotations ├── generated-test-sources │ └── test-annotations ├── maven-status │ └── maven-compiler-plugin │ ├── compile │ │ └── default-compile │ │ ├── createdFiles.lst │ │ └── inputFiles.lst │ └── testCompile │ └── default-testCompile │ ├── createdFiles.lst │ └── inputFiles.lst ├── surefire-reports │ ├── TEST-tech.codejava.store.StoreApplicationTests.xml │ └── tech.codejava.store.StoreApplicationTests.txt └── test-classes └── tech └── codejava └── store └── StoreApplicationTests.class The “heart” of our project is pom.xml:\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?\u003e","prerequisites#Prerequisites":"PrerequisitesBefore diving in, make sure you’re comfortable with the following:\nJava — solid understanding of the language Object-oriented programming — classes, methods and interfaces Databases — tables, primary keys, foreign keys, relationships, etc. SQL — ability to write basic SQL statements","setter-injection#Setter Injection":"Another way to inject a dependency is via a setter. In OrderService, let’s define one:\npackage tech.codejava.store; public class OrderService { private PaymentService paymentService; public void setPaymentService(PaymentService paymentService) { this.paymentService = paymentService; } public OrderService(PaymentService paymentService) { this.paymentService = paymentService; } public void placeOrder() { paymentService.processPayment(10); } } We can use it like this in StoreApplication:\npackage tech.codejava.store; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StoreApplication { public static void main(String[] args) { // SpringApplication.run(StoreApplication.class, args); // var orderService = new OrderService(new StripePaymentService()); var orderService = new OrderService(new PayPalPaymentService()); orderService.setPaymentService(new PayPalPaymentService()); orderService.placeOrder(); } } Important\nIf you remove the constructor from OrderService and forget to call the setter, the application will crash with a NullPointerException. Use setter injection only for optional dependencies — ones that OrderService can function without.","what-is-a-spring-framework#What is a Spring Framework?":"Spring is a popular framework for building Java applications. It has a lot of modules, each designed to handle a specific task. They are combined into a few different layers.\nImg. 1 — Spring layers\nLayer Purpose Core Handling dependency injection, managing objects Web Building web applications Data Working with databases AOP Aspect oriented programming Test Testing spring components While the Spring Framework is powerful, using it often involves a lot of configuration. For example, if you want to build a web app you might need to setup a web server, configure routing and manage dependencies manually. That’s when Spring Boot comes in.\nNote\nYou can think of Spring Boot as a layer on top of the Spring Framework that takes care of all of the setup. Spring Boot simplifies Spring development by providing sensible defaults and ready-to-use features.\nBy the way, the Spring Framework is just one part of a larger family of projects in the Spring ecosystem.\nImg. 2 — Spring ecosystem\nModule Name Purpose Spring Data Simplifying database access Spring Security Adding authentication and authorization Spring Batch Batch processing Spring Cloud Building microservices and distributed systems Spring Integration Simplifying messaging and integration between systems"},"title":"_index"}} \ No newline at end of file diff --git a/public/en.search.js b/public/en.search.js new file mode 100644 index 0000000..4f46d3e --- /dev/null +++ b/public/en.search.js @@ -0,0 +1,437 @@ +// Search functionality using FlexSearch. + +// Change shortcut key to cmd+k on Mac, iPad or iPhone. +document.addEventListener("DOMContentLoaded", function () { + if (/iPad|iPhone|Macintosh/.test(navigator.userAgent)) { + // select the kbd element under the .hextra-search-wrapper class + const keys = document.querySelectorAll(".hextra-search-wrapper kbd"); + keys.forEach(key => { + key.innerHTML = 'K'; + }); + } +}); + +// Render the search data as JSON. +// +// +// +// + +(function () { + const searchDataURL = '/en.search-data.json'; + + const inputElements = document.querySelectorAll('.hextra-search-input'); + for (const el of inputElements) { + el.addEventListener('focus', init); + el.addEventListener('keyup', search); + el.addEventListener('keydown', handleKeyDown); + el.addEventListener('input', handleInputChange); + } + + const shortcutElements = document.querySelectorAll('.hextra-search-wrapper kbd'); + + function setShortcutElementsOpacity(opacity) { + shortcutElements.forEach(el => { + el.style.opacity = opacity; + }); + } + + function handleInputChange(e) { + const opacity = e.target.value.length > 0 ? 0 : 100; + setShortcutElementsOpacity(opacity); + } + + // Get the search wrapper, input, and results elements. + function getActiveSearchElement() { + const inputs = Array.from(document.querySelectorAll('.hextra-search-wrapper')).filter(el => el.clientHeight > 0); + if (inputs.length === 1) { + return { + wrapper: inputs[0], + inputElement: inputs[0].querySelector('.hextra-search-input'), + resultsElement: inputs[0].querySelector('.hextra-search-results') + }; + } + return undefined; + } + + const INPUTS = ['input', 'select', 'button', 'textarea'] + + // Focus the search input when pressing ctrl+k/cmd+k or /. + document.addEventListener('keydown', function (e) { + const { inputElement } = getActiveSearchElement(); + if (!inputElement) return; + + const activeElement = document.activeElement; + const tagName = activeElement && activeElement.tagName; + if ( + inputElement === activeElement || + !tagName || + INPUTS.includes(tagName) || + (activeElement && activeElement.isContentEditable)) + return; + + if ( + e.key === '/' || + (e.key === 'k' && + (e.metaKey /* for Mac */ || /* for non-Mac */ e.ctrlKey)) + ) { + e.preventDefault(); + inputElement.focus(); + } else if (e.key === 'Escape' && inputElement.value) { + inputElement.blur(); + } + }); + + // Dismiss the search results when clicking outside the search box. + document.addEventListener('mousedown', function (e) { + const { inputElement, resultsElement } = getActiveSearchElement(); + if (!inputElement || !resultsElement) return; + if ( + e.target !== inputElement && + e.target !== resultsElement && + !resultsElement.contains(e.target) + ) { + setShortcutElementsOpacity(100); + hideSearchResults(); + } + }); + + // Get the currently active result and its index. + function getActiveResult() { + const { resultsElement } = getActiveSearchElement(); + if (!resultsElement) return { result: undefined, index: -1 }; + + const result = resultsElement.querySelector('.hextra-search-active'); + if (!result) return { result: undefined, index: -1 }; + + const index = parseInt(result.dataset.index, 10); + return { result, index }; + } + + // Set the active result by index. + function setActiveResult(index) { + const { resultsElement } = getActiveSearchElement(); + if (!resultsElement) return; + + const { result: activeResult } = getActiveResult(); + activeResult && activeResult.classList.remove('hextra-search-active'); + const result = resultsElement.querySelector(`[data-index="${index}"]`); + if (result) { + result.classList.add('hextra-search-active'); + result.focus(); + } + } + + // Get the number of search results from the DOM. + function getResultsLength() { + const { resultsElement } = getActiveSearchElement(); + if (!resultsElement) return 0; + return resultsElement.dataset.count; + } + + // Finish the search by hiding the results and clearing the input. + function finishSearch() { + const { inputElement } = getActiveSearchElement(); + if (!inputElement) return; + hideSearchResults(); + inputElement.value = ''; + inputElement.blur(); + } + + function hideSearchResults() { + const { resultsElement } = getActiveSearchElement(); + if (!resultsElement) return; + resultsElement.classList.add('hx:hidden'); + } + + // Handle keyboard events. + function handleKeyDown(e) { + const { inputElement } = getActiveSearchElement(); + if (!inputElement) return; + + const resultsLength = getResultsLength(); + const { result: activeResult, index: activeIndex } = getActiveResult(); + + switch (e.key) { + case 'ArrowUp': + e.preventDefault(); + if (activeIndex > 0) setActiveResult(activeIndex - 1); + break; + case 'ArrowDown': + e.preventDefault(); + if (activeIndex + 1 < resultsLength) setActiveResult(activeIndex + 1); + break; + case 'Enter': + e.preventDefault(); + if (activeResult) { + activeResult.click(); + } + finishSearch(); + case 'Escape': + e.preventDefault(); + hideSearchResults(); + // Clear the input when pressing escape + inputElement.value = ''; + inputElement.dispatchEvent(new Event('input')); + // Remove focus from the input + inputElement.blur(); + break; + } + } + + // Initializes the search. + function init(e) { + e.target.removeEventListener('focus', init); + if (!(window.pageIndex && window.sectionIndex)) { + preloadIndex(); + } + } + + /** + * Preloads the search index by fetching data and adding it to the FlexSearch index. + * @returns {Promise} A promise that resolves when the index is preloaded. + */ + async function preloadIndex() { + const tokenize = 'forward'; + + // https://github.com/TryGhost/Ghost/pull/21148 + const regex = new RegExp( + `[\u{4E00}-\u{9FFF}\u{3040}-\u{309F}\u{30A0}-\u{30FF}\u{AC00}-\u{D7A3}\u{3400}-\u{4DBF}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B73F}\u{2B740}-\u{2B81F}\u{2B820}-\u{2CEAF}\u{2CEB0}-\u{2EBEF}\u{30000}-\u{3134F}\u{31350}-\u{323AF}\u{2EBF0}-\u{2EE5F}\u{F900}-\u{FAFF}\u{2F800}-\u{2FA1F}]|[0-9A-Za-zа-я\u00C0-\u017F\u0400-\u04FF\u0600-\u06FF\u0980-\u09FF\u1E00-\u1EFF\u0590-\u05FF]+`, + 'mug' + ); + const encode = (str) => { return ('' + str).toLowerCase().match(regex) ?? []; } + + window.pageIndex = new FlexSearch.Document({ + tokenize, + encode, + cache: 100, + document: { + id: 'id', + store: ['title', 'crumb'], + index: "content" + } + }); + + window.sectionIndex = new FlexSearch.Document({ + tokenize, + encode, + cache: 100, + document: { + id: 'id', + store: ['title', 'content', 'url', 'display', 'crumb'], + index: "content", + tag: [{ + field: "pageId" + }] + } + }); + + const resp = await fetch(searchDataURL); + const data = await resp.json(); + let pageId = 0; + for (const route in data) { + let pageContent = ''; + ++pageId; + const urlParts = route.split('/').filter(x => x != "" && !x.startsWith('#')); + + let crumb = ''; + let searchUrl = '/'; + for (let i = 0; i < urlParts.length; i++) { + const urlPart = urlParts[i]; + searchUrl += urlPart + '/' + + const crumbData = data[searchUrl]; + if (!crumbData) { + console.warn('Excluded page', searchUrl, '- will not be included for search result breadcrumb for', route); + continue; + } + + let title = data[searchUrl].title; + if (title == "_index") { + title = urlPart.split("-").map(x => x).join(" "); + } + crumb += title; + + if (i < urlParts.length - 1) { + crumb += ' > '; + } + } + + for (const heading in data[route].data) { + const [hash, text] = heading.split('#'); + const url = route.trimEnd('/') + (hash ? '#' + hash : ''); + const title = text || data[route].title; + + const content = data[route].data[heading] || ''; + const paragraphs = content.split('\n').filter(Boolean); + + sectionIndex.add({ + id: url, + url, + title, + crumb, + pageId: `page_${pageId}`, + content: title, + ...(paragraphs[0] && { display: paragraphs[0] }) + }); + + for (let i = 0; i < paragraphs.length; i++) { + sectionIndex.add({ + id: `${url}_${i}`, + url, + title, + crumb, + pageId: `page_${pageId}`, + content: paragraphs[i] + }); + } + + pageContent += ` ${title} ${content}`; + } + + window.pageIndex.add({ + id: pageId, + title: data[route].title, + crumb, + content: pageContent + }); + + } + } + + /** + * Performs a search based on the provided query and displays the results. + * @param {Event} e - The event object. + */ + function search(e) { + const query = e.target.value; + if (!e.target.value) { + hideSearchResults(); + return; + } + + const { resultsElement } = getActiveSearchElement(); + while (resultsElement.firstChild) { + resultsElement.removeChild(resultsElement.firstChild); + } + resultsElement.classList.remove('hx:hidden'); + + const pageResults = window.pageIndex.search(query, 5, { enrich: true, suggest: true })[0]?.result || []; + + const results = []; + const pageTitleMatches = {}; + + for (let i = 0; i < pageResults.length; i++) { + const result = pageResults[i]; + pageTitleMatches[i] = 0; + + // Show the top 5 results for each page + const sectionResults = window.sectionIndex.search(query, 5, { enrich: true, suggest: true, tag: { 'pageId': `page_${result.id}` } })[0]?.result || []; + let isFirstItemOfPage = true + const occurred = {} + + for (let j = 0; j < sectionResults.length; j++) { + const { doc } = sectionResults[j] + const isMatchingTitle = doc.display !== undefined + if (isMatchingTitle) { + pageTitleMatches[i]++ + } + const { url, title } = doc + const content = doc.display || doc.content + + if (occurred[url + '@' + content]) continue + occurred[url + '@' + content] = true + results.push({ + _page_rk: i, + _section_rk: j, + route: url, + prefix: isFirstItemOfPage ? result.doc.crumb : undefined, + children: { title, content } + }) + isFirstItemOfPage = false + } + } + const sortedResults = results + .sort((a, b) => { + // Sort by number of matches in the title. + if (a._page_rk === b._page_rk) { + return a._section_rk - b._section_rk + } + if (pageTitleMatches[a._page_rk] !== pageTitleMatches[b._page_rk]) { + return pageTitleMatches[b._page_rk] - pageTitleMatches[a._page_rk] + } + return a._page_rk - b._page_rk + }) + .map(res => ({ + id: `${res._page_rk}_${res._section_rk}`, + route: res.route, + prefix: res.prefix, + children: res.children + })); + displayResults(sortedResults, query); + } + + /** + * Displays the search results on the page. + * + * @param {Array} results - The array of search results. + * @param {string} query - The search query. + */ + function displayResults(results, query) { + const { resultsElement } = getActiveSearchElement(); + if (!resultsElement) return; + + if (!results.length) { + resultsElement.innerHTML = `No results found.`; + return; + } + + // Highlight the query in the result text. + function highlightMatches(text, query) { + const escapedQuery = query.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); + const regex = new RegExp(escapedQuery, 'gi'); + return text.replace(regex, (match) => `${match}`); + } + + // Create a DOM element from the HTML string. + function createElement(str) { + const div = document.createElement('div'); + div.innerHTML = str.trim(); + return div.firstChild; + } + + function handleMouseMove(e) { + const target = e.target.closest('a'); + if (target) { + const active = resultsElement.querySelector('a.hextra-search-active'); + if (active) { + active.classList.remove('hextra-search-active'); + } + target.classList.add('hextra-search-active'); + } + } + + const fragment = document.createDocumentFragment(); + for (let i = 0; i < results.length; i++) { + const result = results[i]; + if (result.prefix) { + fragment.appendChild(createElement(` +
${result.prefix}
`)); + } + let li = createElement(` +
  • + +
    `+ highlightMatches(result.children.title, query) + `
    ` + + (result.children.content ? + `
    ` + highlightMatches(result.children.content, query) + `
    ` : '') + ` +
    +
  • `); + li.addEventListener('mousemove', handleMouseMove); + li.addEventListener('keydown', handleKeyDown); + li.querySelector('a').addEventListener('click', finishSearch); + fragment.appendChild(li); + } + resultsElement.appendChild(fragment); + resultsElement.dataset.count = results.length; + } +})(); diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..0f2dd2b Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..5c1aea5 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..553fa15 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..6a08d10 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,13 @@ + + + diff --git a/public/images/logo-dark.svg b/public/images/logo-dark.svg new file mode 100644 index 0000000..2857264 --- /dev/null +++ b/public/images/logo-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/images/logo.svg b/public/images/logo.svg new file mode 100644 index 0000000..1ed7daf --- /dev/null +++ b/public/images/logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..c0ad1a0 --- /dev/null +++ b/public/index.html @@ -0,0 +1,362 @@ + + + + + + + + + + + +CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + +
    + + + + + +
    +
    + +
    + +
    +
    +
    +
    + +

    + + + + + + diff --git a/public/index.xml b/public/index.xml new file mode 100644 index 0000000..e39d238 --- /dev/null +++ b/public/index.xml @@ -0,0 +1,17 @@ + + + CodeJava – + http://localhost:1313/ + Recent content on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + diff --git a/public/js/flexsearch.9f5b5908f93ae86f1ecd4b043b799f580c2d1654e703dd9357d568ac41b2547a.js b/public/js/flexsearch.9f5b5908f93ae86f1ecd4b043b799f580c2d1654e703dd9357d568ac41b2547a.js new file mode 100644 index 0000000..82ae0dd --- /dev/null +++ b/public/js/flexsearch.9f5b5908f93ae86f1ecd4b043b799f580c2d1654e703dd9357d568ac41b2547a.js @@ -0,0 +1,2525 @@ +/**! + * FlexSearch.js v0.8.143 (Bundle/Debug) + * Author and Copyright: Thomas Wilkerling + * Licence: Apache-2.0 + * Hosted by Nextapps GmbH + * https://github.com/nextapps-de/flexsearch + */ +(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f; +var t; +function z(a, c, b) { + const e = typeof b, d = typeof a; + if ("undefined" !== e) { + if ("undefined" !== d) { + if (b) { + if ("function" === d && e === d) { + return function(k) { + return a(b(k)); + }; + } + c = a.constructor; + if (c === b.constructor) { + if (c === Array) { + return b.concat(a); + } + if (c === Map) { + var f = new Map(b); + for (var g of a) { + f.set(g[0], g[1]); + } + return f; + } + if (c === Set) { + g = new Set(b); + for (f of a.values()) { + g.add(f); + } + return g; + } + } + } + return a; + } + return b; + } + return "undefined" === d ? c : a; +} +function B() { + return Object.create(null); +} +function E(a) { + return "string" === typeof a; +} +function I(a) { + return "object" === typeof a; +} +function aa(a) { + const c = []; + for (const b of a.keys()) { + c.push(b); + } + return c; +} +function ba(a, c) { + if (E(c)) { + a = a[c]; + } else { + for (let b = 0; a && b < c.length; b++) { + a = a[c[b]]; + } + } + return a; +} +function ca(a) { + let c = 0; + for (let b = 0, e; b < a.length; b++) { + (e = a[b]) && c < e.length && (c = e.length); + } + return c; +} +;const da = /[^\p{L}\p{N}]+/u, ea = /(\d{3})/g, fa = /(\D)(\d{3})/g, ha = /(\d{3})(\D)/g, ia = /[\u0300-\u036f]/g; +function ja(a = {}) { + if (!this || this.constructor !== ja) { + return new ja(...arguments); + } + if (arguments.length) { + for (a = 0; a < arguments.length; a++) { + this.assign(arguments[a]); + } + } else { + this.assign(a); + } +} +t = ja.prototype; +t.assign = function(a) { + this.normalize = z(a.normalize, !0, this.normalize); + let c = a.include, b = c || a.exclude || a.split, e; + if (b || "" === b) { + if ("object" === typeof b && b.constructor !== RegExp) { + let d = ""; + e = !c; + c || (d += "\\p{Z}"); + b.letter && (d += "\\p{L}"); + b.number && (d += "\\p{N}", e = !!c); + b.symbol && (d += "\\p{S}"); + b.punctuation && (d += "\\p{P}"); + b.control && (d += "\\p{C}"); + if (b = b.char) { + d += "object" === typeof b ? b.join("") : b; + } + try { + this.split = new RegExp("[" + (c ? "^" : "") + d + "]+", "u"); + } catch (f) { + console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; + } + } else { + this.split = b, e = !1 === b || 2 > "a1a".split(b).length; + } + this.numeric = z(a.numeric, e); + } else { + try { + this.split = z(this.split, da); + } catch (d) { + console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; + } + this.numeric = z(a.numeric, z(this.numeric, !0)); + } + this.prepare = z(a.prepare, null, this.prepare); + this.finalize = z(a.finalize, null, this.finalize); + b = a.filter; + this.filter = "function" === typeof b ? b : z(b && new Set(b), null, this.filter); + this.dedupe = z(a.dedupe, !1, this.dedupe); + this.matcher = z((b = a.matcher) && new Map(b), null, this.matcher); + this.mapper = z((b = a.mapper) && new Map(b), null, this.mapper); + this.stemmer = z((b = a.stemmer) && new Map(b), null, this.stemmer); + this.replacer = z(a.replacer, null, this.replacer); + this.minlength = z(a.minlength, 1, this.minlength); + this.maxlength = z(a.maxlength, 0, this.maxlength); + this.rtl = z(a.rtl, !1, this.rtl); + if (this.cache = b = z(a.cache, !0, this.cache)) { + this.H = null, this.S = "number" === typeof b ? b : 2e5, this.B = new Map(), this.G = new Map(), this.L = this.K = 128; + } + this.h = ""; + this.M = null; + this.A = ""; + this.N = null; + if (this.matcher) { + for (const d of this.matcher.keys()) { + this.h += (this.h ? "|" : "") + d; + } + } + if (this.stemmer) { + for (const d of this.stemmer.keys()) { + this.A += (this.A ? "|" : "") + d; + } + } + return this; +}; +t.addStemmer = function(a, c) { + this.stemmer || (this.stemmer = new Map()); + this.stemmer.set(a, c); + this.A += (this.A ? "|" : "") + a; + this.N = null; + this.cache && J(this); + return this; +}; +t.addFilter = function(a) { + "function" === typeof a ? this.filter = a : (this.filter || (this.filter = new Set()), this.filter.add(a)); + this.cache && J(this); + return this; +}; +t.addMapper = function(a, c) { + if ("object" === typeof a) { + return this.addReplacer(a, c); + } + if (1 < a.length) { + return this.addMatcher(a, c); + } + this.mapper || (this.mapper = new Map()); + this.mapper.set(a, c); + this.cache && J(this); + return this; +}; +t.addMatcher = function(a, c) { + if ("object" === typeof a) { + return this.addReplacer(a, c); + } + if (2 > a.length && (this.dedupe || this.mapper)) { + return this.addMapper(a, c); + } + this.matcher || (this.matcher = new Map()); + this.matcher.set(a, c); + this.h += (this.h ? "|" : "") + a; + this.M = null; + this.cache && J(this); + return this; +}; +t.addReplacer = function(a, c) { + if ("string" === typeof a) { + return this.addMatcher(a, c); + } + this.replacer || (this.replacer = []); + this.replacer.push(a, c); + this.cache && J(this); + return this; +}; +t.encode = function(a) { + if (this.cache && a.length <= this.K) { + if (this.H) { + if (this.B.has(a)) { + return this.B.get(a); + } + } else { + this.H = setTimeout(J, 50, this); + } + } + this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = ia ? a.normalize("NFKD").replace(ia, "").toLowerCase() : a.toLowerCase()); + this.prepare && (a = this.prepare(a)); + this.numeric && 3 < a.length && (a = a.replace(fa, "$1 $2").replace(ha, "$1 $2").replace(ea, "$1 ")); + const c = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer); + let b = [], e = this.split || "" === this.split ? a.split(this.split) : a; + for (let f = 0, g, k; f < e.length; f++) { + if ((g = k = e[f]) && !(g.length < this.minlength)) { + if (c) { + b.push(g); + } else { + if (!this.filter || ("function" === typeof this.filter ? this.filter(g) : !this.filter.has(g))) { + if (this.cache && g.length <= this.L) { + if (this.H) { + var d = this.G.get(g); + if (d || "" === d) { + d && b.push(d); + continue; + } + } else { + this.H = setTimeout(J, 50, this); + } + } + this.stemmer && 2 < g.length && (this.N || (this.N = new RegExp("(?!^)(" + this.A + ")$")), d = g, g = g.replace(this.N, h => this.stemmer.get(h)), d !== g && this.filter && g.length >= this.minlength && ("function" === typeof this.filter ? !this.filter(g) : this.filter.has(g)) && (g = "")); + if (g && (this.mapper || this.dedupe && 1 < g.length)) { + d = ""; + for (let h = 0, l = "", n, m; h < g.length; h++) { + n = g.charAt(h), n === l && this.dedupe || ((m = this.mapper && this.mapper.get(n)) || "" === m ? m === l && this.dedupe || !(l = m) || (d += m) : d += l = n); + } + g = d; + } + this.matcher && 1 < g.length && (this.M || (this.M = new RegExp("(" + this.h + ")", "g")), g = g.replace(this.M, h => this.matcher.get(h))); + if (g && this.replacer) { + for (d = 0; g && d < this.replacer.length; d += 2) { + g = g.replace(this.replacer[d], this.replacer[d + 1]); + } + } + this.cache && k.length <= this.L && (this.G.set(k, g), this.G.size > this.S && (this.G.clear(), this.L = this.L / 1.1 | 0)); + g && b.push(g); + } + } + } + } + this.finalize && (b = this.finalize(b) || b); + this.cache && a.length <= this.K && (this.B.set(a, b), this.B.size > this.S && (this.B.clear(), this.K = this.K / 1.1 | 0)); + return b; +}; +function J(a) { + a.H = null; + a.B.clear(); + a.G.clear(); +} +;let K, M; +async function ka(a) { + a = a.data; + var c = a.task; + const b = a.id; + let e = a.args; + switch(c) { + case "init": + M = a.options || {}; + (c = a.factory) ? (Function("return " + c)()(self), K = new self.FlexSearch.Index(M), delete self.FlexSearch) : K = new N(M); + postMessage({id:b}); + break; + default: + let d; + if ("export" === c) { + if (!M.export || "function" !== typeof M.export) { + throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "export".'); + } + e[1] ? (e[0] = M.export, e[2] = 0, e[3] = 1) : e = null; + } + if ("import" === c) { + if (!M.import || "function" !== typeof M.import) { + throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "import".'); + } + e[0] && (a = await M.import.call(K, e[0]), K.import(e[0], a)); + } else { + (d = e && K[c].apply(K, e)) && d.then && (d = await d); + } + postMessage("search" === c ? {id:b, msg:d} : {id:b}); + } +} +;function la(a) { + ma.call(a, "add"); + ma.call(a, "append"); + ma.call(a, "search"); + ma.call(a, "update"); + ma.call(a, "remove"); +} +let na, oa, pa; +function qa() { + na = pa = 0; +} +function ma(a) { + this[a + "Async"] = function() { + const c = arguments; + var b = c[c.length - 1]; + let e; + "function" === typeof b && (e = b, delete c[c.length - 1]); + na ? pa || (pa = Date.now() - oa >= this.priority * this.priority * 3) : (na = setTimeout(qa, 0), oa = Date.now()); + if (pa) { + const f = this; + return new Promise(g => { + setTimeout(function() { + g(f[a + "Async"].apply(f, c)); + }, 0); + }); + } + const d = this[a].apply(this, c); + b = d.then ? d : new Promise(f => f(d)); + e && b.then(e); + return b; + }; +} +;let O = 0; +function P(a = {}) { + function c(g) { + function k(h) { + h = h.data || h; + const l = h.id, n = l && d.h[l]; + n && (n(h.msg), delete d.h[l]); + } + this.worker = g; + this.h = B(); + if (this.worker) { + e ? this.worker.on("message", k) : this.worker.onmessage = k; + if (a.config) { + return new Promise(function(h) { + d.h[++O] = function() { + h(d); + 1e9 < O && (O = 0); + }; + d.worker.postMessage({id:O, task:"init", factory:b, options:a}); + }); + } + this.worker.postMessage({task:"init", factory:b, options:a}); + this.priority = a.priority || 4; + return this; + } + } + if (!this || this.constructor !== P) { + return new P(a); + } + let b = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null; + b && (b = b.toString()); + const e = "undefined" === typeof window, d = this, f = ra(b, e, a.worker); + return f.then ? f.then(function(g) { + return c.call(d, g); + }) : c.call(this, f); +} +Q("add"); +Q("append"); +Q("search"); +Q("update"); +Q("remove"); +Q("clear"); +Q("export"); +Q("import"); +la(P.prototype); +function Q(a) { + P.prototype[a] = function() { + const c = this, b = [].slice.call(arguments); + var e = b[b.length - 1]; + let d; + "function" === typeof e && (d = e, b.pop()); + e = new Promise(function(f) { + "export" === a && "function" === typeof b[0] && (b[0] = null); + c.h[++O] = f; + c.worker.postMessage({task:a, id:O, args:b}); + }); + return d ? (e.then(d), this) : e; + }; +} +function ra(a, c, b) { + return c ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/node/node.js") : import("worker_threads").then(function(worker){return new worker["Worker"]((1,eval)("import.meta.dirname")+"/node/node.mjs")}) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + ka.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof b ? b : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", + "module/worker/worker.js"), {type:"module"}); +} +;function sa(a, c = 0) { + let b = [], e = []; + c && (c = 250000 / c * 5000 | 0); + for (const d of a.entries()) { + e.push(d), e.length === c && (b.push(e), e = []); + } + e.length && b.push(e); + return b; +} +function ta(a, c) { + c || (c = new Map()); + for (let b = 0, e; b < a.length; b++) { + e = a[b], c.set(e[0], e[1]); + } + return c; +} +function ua(a, c = 0) { + let b = [], e = []; + c && (c = 250000 / c * 1000 | 0); + for (const d of a.entries()) { + e.push([d[0], sa(d[1])[0]]), e.length === c && (b.push(e), e = []); + } + e.length && b.push(e); + return b; +} +function va(a, c) { + c || (c = new Map()); + for (let b = 0, e, d; b < a.length; b++) { + e = a[b], d = c.get(e[0]), c.set(e[0], ta(e[1], d)); + } + return c; +} +function wa(a) { + let c = [], b = []; + for (const e of a.keys()) { + b.push(e), 250000 === b.length && (c.push(b), b = []); + } + b.length && c.push(b); + return c; +} +function xa(a, c) { + c || (c = new Set()); + for (let b = 0; b < a.length; b++) { + c.add(a[b]); + } + return c; +} +function ya(a, c, b, e, d, f, g = 0) { + const k = e && e.constructor === Array; + var h = k ? e.shift() : e; + if (!h) { + return this.export(a, c, d, f + 1); + } + if ((h = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(h))) && h.then) { + const l = this; + return h.then(function() { + return ya.call(l, a, c, b, k ? e : null, d, f, g + 1); + }); + } + return ya.call(this, a, c, b, k ? e : null, d, f, g + 1); +} +function za(a, c) { + let b = ""; + for (const e of a.entries()) { + a = e[0]; + const d = e[1]; + let f = ""; + for (let g = 0, k; g < d.length; g++) { + k = d[g] || [""]; + let h = ""; + for (let l = 0; l < k.length; l++) { + h += (h ? "," : "") + ("string" === c ? '"' + k[l] + '"' : k[l]); + } + h = "[" + h + "]"; + f += (f ? "," : "") + h; + } + f = '["' + a + '",[' + f + "]]"; + b += (b ? "," : "") + f; + } + return b; +} +;function Aa(a, c, b, e) { + let d = []; + for (let f = 0, g; f < a.index.length; f++) { + if (g = a.index[f], c >= g.length) { + c -= g.length; + } else { + c = g[e ? "splice" : "slice"](c, b); + const k = c.length; + if (k && (d = d.length ? d.concat(c) : c, b -= k, e && (a.length -= k), !b)) { + break; + } + c = 0; + } + } + return d; +} +function R(a) { + if (!this || this.constructor !== R) { + return new R(a); + } + this.index = a ? [a] : []; + this.length = a ? a.length : 0; + const c = this; + return new Proxy([], {get(b, e) { + if ("length" === e) { + return c.length; + } + if ("push" === e) { + return function(d) { + c.index[c.index.length - 1].push(d); + c.length++; + }; + } + if ("pop" === e) { + return function() { + if (c.length) { + return c.length--, c.index[c.index.length - 1].pop(); + } + }; + } + if ("indexOf" === e) { + return function(d) { + let f = 0; + for (let g = 0, k, h; g < c.index.length; g++) { + k = c.index[g]; + h = k.indexOf(d); + if (0 <= h) { + return f + h; + } + f += k.length; + } + return -1; + }; + } + if ("includes" === e) { + return function(d) { + for (let f = 0; f < c.index.length; f++) { + if (c.index[f].includes(d)) { + return !0; + } + } + return !1; + }; + } + if ("slice" === e) { + return function(d, f) { + return Aa(c, d || 0, f || c.length, !1); + }; + } + if ("splice" === e) { + return function(d, f) { + return Aa(c, d || 0, f || c.length, !0); + }; + } + if ("constructor" === e) { + return Array; + } + if ("symbol" !== typeof e) { + return (b = c.index[e / 2 ** 31 | 0]) && b[e]; + } + }, set(b, e, d) { + b = e / 2 ** 31 | 0; + (c.index[b] || (c.index[b] = []))[e] = d; + c.length++; + return !0; + }}); +} +R.prototype.clear = function() { + this.index.length = 0; +}; +R.prototype.destroy = function() { + this.proxy = this.index = null; +}; +R.prototype.push = function() { +}; +function S(a = 8) { + if (!this || this.constructor !== S) { + return new S(a); + } + this.index = B(); + this.h = []; + this.size = 0; + 32 < a ? (this.B = Ba, this.A = BigInt(a)) : (this.B = Ca, this.A = a); +} +S.prototype.get = function(a) { + const c = this.index[this.B(a)]; + return c && c.get(a); +}; +S.prototype.set = function(a, c) { + var b = this.B(a); + let e = this.index[b]; + e ? (b = e.size, e.set(a, c), (b -= e.size) && this.size++) : (this.index[b] = e = new Map([[a, c]]), this.h.push(e), this.size++); +}; +function T(a = 8) { + if (!this || this.constructor !== T) { + return new T(a); + } + this.index = B(); + this.h = []; + this.size = 0; + 32 < a ? (this.B = Ba, this.A = BigInt(a)) : (this.B = Ca, this.A = a); +} +T.prototype.add = function(a) { + var c = this.B(a); + let b = this.index[c]; + b ? (c = b.size, b.add(a), (c -= b.size) && this.size++) : (this.index[c] = b = new Set([a]), this.h.push(b), this.size++); +}; +t = S.prototype; +t.has = T.prototype.has = function(a) { + const c = this.index[this.B(a)]; + return c && c.has(a); +}; +t.delete = T.prototype.delete = function(a) { + const c = this.index[this.B(a)]; + c && c.delete(a) && this.size--; +}; +t.clear = T.prototype.clear = function() { + this.index = B(); + this.h = []; + this.size = 0; +}; +t.values = T.prototype.values = function*() { + for (let a = 0; a < this.h.length; a++) { + for (let c of this.h[a].values()) { + yield c; + } + } +}; +t.keys = T.prototype.keys = function*() { + for (let a = 0; a < this.h.length; a++) { + for (let c of this.h[a].keys()) { + yield c; + } + } +}; +t.entries = T.prototype.entries = function*() { + for (let a = 0; a < this.h.length; a++) { + for (let c of this.h[a].entries()) { + yield c; + } + } +}; +function Ca(a) { + let c = 2 ** this.A - 1; + if ("number" == typeof a) { + return a & c; + } + let b = 0, e = this.A + 1; + for (let d = 0; d < a.length; d++) { + b = (b * e ^ a.charCodeAt(d)) & c; + } + return 32 === this.A ? b + 2 ** 31 : b; +} +function Ba(a) { + let c = BigInt(2) ** this.A - BigInt(1); + var b = typeof a; + if ("bigint" === b) { + return a & c; + } + if ("number" === b) { + return BigInt(a) & c; + } + b = BigInt(0); + let e = this.A + BigInt(1); + for (let d = 0; d < a.length; d++) { + b = (b * e ^ BigInt(a.charCodeAt(d))) & c; + } + return b; +} +;U.prototype.add = function(a, c, b) { + I(a) && (c = a, a = ba(c, this.key)); + if (c && (a || 0 === a)) { + if (!b && this.reg.has(a)) { + return this.update(a, c); + } + for (let k = 0, h; k < this.field.length; k++) { + h = this.D[k]; + var e = this.index.get(this.field[k]); + if ("function" === typeof h) { + var d = h(c); + d && e.add(a, d, !1, !0); + } else { + if (d = h.I, !d || d(c)) { + h.constructor === String ? h = ["" + h] : E(h) && (h = [h]), Da(c, h, this.J, 0, e, a, h[0], b); + } + } + } + if (this.tag) { + for (e = 0; e < this.F.length; e++) { + var f = this.F[e], g = this.R[e]; + d = this.tag.get(g); + let k = B(); + if ("function" === typeof f) { + if (f = f(c), !f) { + continue; + } + } else { + const h = f.I; + if (h && !h(c)) { + continue; + } + f.constructor === String && (f = "" + f); + f = ba(c, f); + } + if (d && f) { + E(f) && (f = [f]); + for (let h = 0, l, n; h < f.length; h++) { + if (l = f[h], !k[l] && (k[l] = 1, (g = d.get(l)) ? n = g : d.set(l, n = []), !b || !n.includes(a))) { + if (n.length === 2 ** 31 - 1) { + g = new R(n); + if (this.fastupdate) { + for (let m of this.reg.values()) { + m.includes(n) && (m[m.indexOf(n)] = g); + } + } + d.set(l, n = g); + } + n.push(a); + this.fastupdate && ((g = this.reg.get(a)) ? g.push(n) : this.reg.set(a, [n])); + } + } + } else { + d || console.warn("Tag '" + g + "' was not found"); + } + } + } + if (this.store && (!b || !this.store.has(a))) { + let k; + if (this.C) { + k = B(); + for (let h = 0, l; h < this.C.length; h++) { + l = this.C[h]; + if ((b = l.I) && !b(c)) { + continue; + } + let n; + if ("function" === typeof l) { + n = l(c); + if (!n) { + continue; + } + l = [l.V]; + } else if (E(l) || l.constructor === String) { + k[l] = c[l]; + continue; + } + Ea(c, k, l, 0, l[0], n); + } + } + this.store.set(a, k || c); + } + this.worker && (this.fastupdate || this.reg.add(a)); + } + return this; +}; +function Ea(a, c, b, e, d, f) { + a = a[d]; + if (e === b.length - 1) { + c[d] = f || a; + } else if (a) { + if (a.constructor === Array) { + for (c = c[d] = Array(a.length), d = 0; d < a.length; d++) { + Ea(a, c, b, e, d); + } + } else { + c = c[d] || (c[d] = B()), d = b[++e], Ea(a, c, b, e, d); + } + } +} +function Da(a, c, b, e, d, f, g, k) { + if (a = a[g]) { + if (e === c.length - 1) { + if (a.constructor === Array) { + if (b[e]) { + for (c = 0; c < a.length; c++) { + d.add(f, a[c], !0, !0); + } + return; + } + a = a.join(" "); + } + d.add(f, a, k, !0); + } else { + if (a.constructor === Array) { + for (g = 0; g < a.length; g++) { + Da(a, c, b, e, d, f, g, k); + } + } else { + g = c[++e], Da(a, c, b, e, d, f, g, k); + } + } + } else { + d.db && d.remove(f); + } +} +;function Fa(a, c, b, e, d, f, g) { + const k = a.length; + let h = [], l, n; + l = B(); + for (let m = 0, q, p, r, u; m < c; m++) { + for (let v = 0; v < k; v++) { + if (r = a[v], m < r.length && (q = r[m])) { + for (let w = 0; w < q.length; w++) { + p = q[w]; + (n = l[p]) ? l[p]++ : (n = 0, l[p] = 1); + u = h[n] || (h[n] = []); + if (!g) { + let y = m + (v || !d ? 0 : f || 0); + u = u[y] || (u[y] = []); + } + u.push(p); + if (g && b && n === k - 1 && u.length - e === b) { + return u; + } + } + } + } + } + if (a = h.length) { + if (d) { + h = 1 < h.length ? Ga(h, b, e, g, f) : (h = h[0]).length > b || e ? h.slice(e, b + e) : h; + } else { + if (a < k) { + return []; + } + h = h[a - 1]; + if (b || e) { + if (g) { + if (h.length > b || e) { + h = h.slice(e, b + e); + } + } else { + d = []; + for (let m = 0, q; m < h.length; m++) { + if (q = h[m], q.length > e) { + e -= q.length; + } else { + if (q.length > b || e) { + q = q.slice(e, b + e), b -= q.length, e && (e -= q.length); + } + d.push(q); + if (!b) { + break; + } + } + } + h = 1 < d.length ? [].concat.apply([], d) : d[0]; + } + } + } + } + return h; +} +function Ga(a, c, b, e, d) { + const f = [], g = B(); + let k; + var h = a.length; + let l; + if (e) { + for (d = h - 1; 0 <= d; d--) { + if (l = (e = a[d]) && e.length) { + for (h = 0; h < l; h++) { + if (k = e[h], !g[k]) { + if (g[k] = 1, b) { + b--; + } else { + if (f.push(k), f.length === c) { + return f; + } + } + } + } + } + } + } else { + for (let n = h - 1, m, q = 0; 0 <= n; n--) { + m = a[n]; + for (let p = 0; p < m.length; p++) { + if (l = (e = m[p]) && e.length) { + for (let r = 0; r < l; r++) { + if (k = e[r], !g[k]) { + if (g[k] = 1, b) { + b--; + } else { + let u = (p + (n < h - 1 ? d || 0 : 0)) / (n + 1) | 0; + (f[u] || (f[u] = [])).push(k); + if (++q === c) { + return f; + } + } + } + } + } + } + } + } + return f; +} +function Ha(a, c, b) { + const e = B(), d = []; + for (let f = 0, g; f < c.length; f++) { + g = c[f]; + for (let k = 0; k < g.length; k++) { + e[g[k]] = 1; + } + } + if (b) { + for (let f = 0, g; f < a.length; f++) { + g = a[f], e[g] && (d.push(g), e[g] = 0); + } + } else { + for (let f = 0, g, k; f < a.result.length; f++) { + for (g = a.result[f], c = 0; c < g.length; c++) { + k = g[c], e[k] && ((d[f] || (d[f] = [])).push(k), e[k] = 0); + } + } + } + return d; +} +;function Ia(a, c, b, e) { + if (!a.length) { + return a; + } + if (1 === a.length) { + return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a, e ? V.call(this, a) : a; + } + let d = []; + for (let f = 0, g, k; f < a.length; f++) { + if ((g = a[f]) && (k = g.length)) { + if (b) { + if (b >= k) { + b -= k; + continue; + } + b < k && (g = c ? g.slice(b, b + c) : g.slice(b), k = g.length, b = 0); + } + k > c && (g = g.slice(0, c), k = c); + if (!d.length && k >= c) { + return e ? V.call(this, g) : g; + } + d.push(g); + c -= k; + if (!c) { + break; + } + } + } + d = 1 < d.length ? [].concat.apply([], d) : d[0]; + return e ? V.call(this, d) : d; +} +;function Ja(a, c, b) { + var e = b[0]; + if (e.then) { + return Promise.all(b).then(function(n) { + return a[c].apply(a, n); + }); + } + if (e[0] && e[0].index) { + return a[c].apply(a, e); + } + e = []; + let d = [], f = 0, g = 0, k, h, l; + for (let n = 0, m; n < b.length; n++) { + if (m = b[n]) { + let q; + if (m.constructor === W) { + q = m.result; + } else if (m.constructor === Array) { + q = m; + } else { + if (f = m.limit || 0, g = m.offset || 0, l = m.suggest, h = m.resolve, k = m.enrich && h, m.index) { + m.resolve = !1, m.enrich = !1, q = m.index.search(m).result, m.resolve = h, m.enrich = k; + } else if (m.and) { + q = a.and(m.and); + } else if (m.or) { + q = a.or(m.or); + } else if (m.xor) { + q = a.xor(m.xor); + } else if (m.not) { + q = a.not(m.not); + } else { + continue; + } + } + if (q.then) { + d.push(q); + } else if (q.length) { + e[n] = q; + } else if (!l && ("and" === c || "xor" === c)) { + e = []; + break; + } + } + } + return {O:e, P:d, limit:f, offset:g, enrich:k, resolve:h, suggest:l}; +} +;W.prototype.or = function() { + const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f} = Ja(this, "or", arguments); + return Ka.call(this, a, c, b, e, d, f); +}; +function Ka(a, c, b, e, d, f) { + if (c.length) { + const g = this; + return Promise.all(c).then(function(k) { + a = []; + for (let h = 0, l; h < k.length; h++) { + (l = k[h]).length && (a[h] = l); + } + return Ka.call(g, a, [], b, e, d, f); + }); + } + a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = Ga(a, b, e, !1, this.h), e = 0)); + return f ? this.resolve(b, e, d) : this; +} +;W.prototype.and = function() { + let a = this.result.length, c, b, e, d; + if (!a) { + const f = arguments[0]; + f && (a = !!f.suggest, d = f.resolve, c = f.limit, b = f.offset, e = f.enrich && d); + } + if (a) { + const {O:f, P:g, limit:k, offset:h, enrich:l, resolve:n, suggest:m} = Ja(this, "and", arguments); + return La.call(this, f, g, k, h, l, n, m); + } + return d ? this.resolve(c, b, e) : this; +}; +function La(a, c, b, e, d, f, g) { + if (c.length) { + const k = this; + return Promise.all(c).then(function(h) { + a = []; + for (let l = 0, n; l < h.length; l++) { + (n = h[l]).length && (a[l] = n); + } + return La.call(k, a, [], b, e, d, f, g); + }); + } + if (a.length) { + if (this.result.length && a.unshift(this.result), 2 > a.length) { + this.result = a[0]; + } else { + if (c = ca(a)) { + return this.result = Fa(a, c, b, e, g, this.h, f), f ? d ? V.call(this.index, this.result) : this.result : this; + } + this.result = []; + } + } else { + g || (this.result = a); + } + return f ? this.resolve(b, e, d) : this; +} +;W.prototype.xor = function() { + const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ja(this, "xor", arguments); + return Ma.call(this, a, c, b, e, d, f, g); +}; +function Ma(a, c, b, e, d, f, g) { + if (c.length) { + const k = this; + return Promise.all(c).then(function(h) { + a = []; + for (let l = 0, n; l < h.length; l++) { + (n = h[l]).length && (a[l] = n); + } + return Ma.call(k, a, [], b, e, d, f, g); + }); + } + if (a.length) { + if (this.result.length && a.unshift(this.result), 2 > a.length) { + this.result = a[0]; + } else { + return this.result = Na.call(this, a, b, e, f, this.h), f ? d ? V.call(this.index, this.result) : this.result : this; + } + } else { + g || (this.result = a); + } + return f ? this.resolve(b, e, d) : this; +} +function Na(a, c, b, e, d) { + const f = [], g = B(); + let k = 0; + for (let h = 0, l; h < a.length; h++) { + if (l = a[h]) { + k < l.length && (k = l.length); + for (let n = 0, m; n < l.length; n++) { + if (m = l[n]) { + for (let q = 0, p; q < m.length; q++) { + p = m[q], g[p] = g[p] ? 2 : 1; + } + } + } + } + } + for (let h = 0, l, n = 0; h < k; h++) { + for (let m = 0, q; m < a.length; m++) { + if (q = a[m]) { + if (l = q[h]) { + for (let p = 0, r; p < l.length; p++) { + if (r = l[p], 1 === g[r]) { + if (b) { + b--; + } else { + if (e) { + if (f.push(r), f.length === c) { + return f; + } + } else { + const u = h + (m ? d : 0); + f[u] || (f[u] = []); + f[u].push(r); + if (++n === c) { + return f; + } + } + } + } + } + } + } + } + } + return f; +} +;W.prototype.not = function() { + const {O:a, P:c, limit:b, offset:e, enrich:d, resolve:f, suggest:g} = Ja(this, "not", arguments); + return Oa.call(this, a, c, b, e, d, f, g); +}; +function Oa(a, c, b, e, d, f, g) { + if (c.length) { + const k = this; + return Promise.all(c).then(function(h) { + a = []; + for (let l = 0, n; l < h.length; l++) { + (n = h[l]).length && (a[l] = n); + } + return Oa.call(k, a, [], b, e, d, f, g); + }); + } + if (a.length && this.result.length) { + this.result = Pa.call(this, a, b, e, f); + } else if (f) { + return this.resolve(b, e, d); + } + return f ? d ? V.call(this.index, this.result) : this.result : this; +} +function Pa(a, c, b, e) { + const d = []; + a = new Set(a.flat().flat()); + for (let f = 0, g, k = 0; f < this.result.length; f++) { + if (g = this.result[f]) { + for (let h = 0, l; h < g.length; h++) { + if (l = g[h], !a.has(l)) { + if (b) { + b--; + } else { + if (e) { + if (d.push(l), d.length === c) { + return d; + } + } else { + if (d[f] || (d[f] = []), d[f].push(l), ++k === c) { + return d; + } + } + } + } + } + } + } + return d; +} +;function W(a) { + if (!this || this.constructor !== W) { + return new W(a); + } + if (a && a.index) { + return a.resolve = !1, this.index = a.index, this.h = a.boost || 0, this.result = a.index.search(a).result, this; + } + this.index = null; + this.result = a || []; + this.h = 0; +} +W.prototype.limit = function(a) { + if (this.result.length) { + const c = []; + for (let b = 0, e; b < this.result.length; b++) { + if (e = this.result[b]) { + if (e.length <= a) { + if (c[b] = e, a -= e.length, !a) { + break; + } + } else { + c[b] = e.slice(0, a); + break; + } + } + } + this.result = c; + } + return this; +}; +W.prototype.offset = function(a) { + if (this.result.length) { + const c = []; + for (let b = 0, e; b < this.result.length; b++) { + if (e = this.result[b]) { + e.length <= a ? a -= e.length : (c[b] = e.slice(a), a = 0); + } + } + this.result = c; + } + return this; +}; +W.prototype.boost = function(a) { + this.h += a; + return this; +}; +W.prototype.resolve = function(a, c, b) { + const e = this.result, d = this.index; + this.result = this.index = null; + return e.length ? ("object" === typeof a && (b = a.enrich, c = a.offset, a = a.limit), Ia.call(d, e, a || 100, c, b)) : e; +}; +B(); +U.prototype.search = function(a, c, b, e) { + b || (!c && I(a) ? (b = a, a = "") : I(c) && (b = c, c = 0)); + let d = []; + var f = [], g; + let k; + let h, l; + let n = 0; + var m = !0; + let q; + if (b) { + b.constructor === Array && (b = {index:b}); + a = b.query || a; + var p = b.pluck; + k = b.merge; + h = p || b.field || (h = b.index) && (h.index ? null : h); + l = this.tag && b.tag; + var r = b.suggest; + m = !1 !== b.resolve; + if (!m && !p) { + if (h = h || this.field) { + E(h) ? p = h : (h.constructor === Array && 1 === h.length && (h = h[0]), p = h.field || h.index); + } + if (!p) { + throw Error("Apply resolver on document search requires either the option 'pluck' to be set or just select a single field name in your query."); + } + } + this.store && b.enrich && !m && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })"); + q = (g = this.store && b.enrich && m) && b.highlight; + c = b.limit || c; + var u = b.offset || 0; + c || (c = 100); + if (l && (!this.db || !e)) { + l.constructor !== Array && (l = [l]); + var v = []; + for (let A = 0, x; A < l.length; A++) { + x = l[A]; + if (E(x)) { + throw Error("A tag option can't be a string, instead it needs a { field: tag } format."); + } + if (x.field && x.tag) { + var w = x.tag; + if (w.constructor === Array) { + for (var y = 0; y < w.length; y++) { + v.push(x.field, w[y]); + } + } else { + v.push(x.field, w); + } + } else { + w = Object.keys(x); + for (let D = 0, H, C; D < w.length; D++) { + if (H = w[D], C = x[H], C.constructor === Array) { + for (y = 0; y < C.length; y++) { + v.push(H, C[y]); + } + } else { + v.push(H, C); + } + } + } + } + if (!v.length) { + throw Error("Your tag definition within the search options is probably wrong. No valid tags found."); + } + l = v; + if (!a) { + m = []; + if (v.length) { + for (f = 0; f < v.length; f += 2) { + if (this.db) { + p = this.index.get(v[f]); + if (!p) { + console.warn("Tag '" + v[f] + ":" + v[f + 1] + "' will be skipped because there is no field '" + v[f] + "'."); + continue; + } + m.push(p = p.db.tag(v[f + 1], c, u, g)); + } else { + p = Qa.call(this, v[f], v[f + 1], c, u, g); + } + d.push({field:v[f], tag:v[f + 1], result:p}); + } + } + return m.length ? Promise.all(m).then(function(A) { + for (let x = 0; x < A.length; x++) { + d[x].result = A[x]; + } + return d; + }) : d; + } + } + h && h.constructor !== Array && (h = [h]); + } + h || (h = this.field); + v = !e && (this.worker || this.db) && []; + let F; + for (let A = 0, x, D, H; A < h.length; A++) { + D = h[A]; + if (this.db && this.tag && !this.D[A]) { + continue; + } + let C; + E(D) || (C = D, D = C.field, a = C.query || a, c = C.limit || c, u = C.offset || u, r = C.suggest || r, g = this.store && (C.enrich || g)); + if (e) { + x = e[A]; + } else { + if (w = C || b, y = this.index.get(D), l && (this.db && (w.tag = l, F = y.db.support_tag_search, w.field = h), F || (w.enrich = !1)), v) { + v[A] = y.search(a, c, w); + w && g && (w.enrich = g); + continue; + } else { + x = y.search(a, c, w), w && g && (w.enrich = g); + } + } + H = x && (m ? x.length : x.result.length); + if (l && H) { + w = []; + y = 0; + if (this.db && e) { + if (!F) { + for (let G = h.length; G < e.length; G++) { + let L = e[G]; + if (L && L.length) { + y++, w.push(L); + } else if (!r) { + return m ? d : new W(d); + } + } + } + } else { + for (let G = 0, L, tb; G < l.length; G += 2) { + L = this.tag.get(l[G]); + if (!L) { + if (console.warn("Tag '" + l[G] + ":" + l[G + 1] + "' will be skipped because there is no field '" + l[G] + "'."), r) { + continue; + } else { + return m ? d : new W(d); + } + } + if (tb = (L = L && L.get(l[G + 1])) && L.length) { + y++, w.push(L); + } else if (!r) { + return m ? d : new W(d); + } + } + } + if (y) { + x = Ha(x, w, m); + H = x.length; + if (!H && !r) { + return m ? x : new W(x); + } + y--; + } + } + if (H) { + f[n] = D, d.push(x), n++; + } else if (1 === h.length) { + return m ? d : new W(d); + } + } + if (v) { + if (this.db && l && l.length && !F) { + for (g = 0; g < l.length; g += 2) { + f = this.index.get(l[g]); + if (!f) { + if (console.warn("Tag '" + l[g] + ":" + l[g + 1] + "' was not found because there is no field '" + l[g] + "'."), r) { + continue; + } else { + return m ? d : new W(d); + } + } + v.push(f.db.tag(l[g + 1], c, u, !1)); + } + } + const A = this; + return Promise.all(v).then(function(x) { + return x.length ? A.search(a, c, b, x) : x; + }); + } + if (!n) { + return m ? d : new W(d); + } + if (p && (!g || !this.store)) { + return d[0]; + } + v = []; + for (u = 0; u < f.length; u++) { + r = d[u]; + g && r.length && "undefined" === typeof r[0].doc && (this.db ? v.push(r = this.index.get(this.field[0]).db.enrich(r)) : r = V.call(this, r)); + if (p) { + return m ? r : new W(r); + } + d[u] = {field:f[u], result:r}; + } + if (g && this.db && v.length) { + const A = this; + return Promise.all(v).then(function(x) { + for (let D = 0; D < x.length; D++) { + d[D].result = x[D]; + } + return k ? Ra(d, c) : q ? Sa(d, a, A.index, A.field, A.D, q) : d; + }); + } + return k ? Ra(d, c) : q ? Sa(d, a, this.index, this.field, this.D, q) : d; +}; +function Sa(a, c, b, e, d, f) { + let g, k, h; + for (let n = 0, m, q, p, r; n < a.length; n++) { + let u = a[n].result; + m = a[n].field; + p = b.get(m); + q = p.encoder; + h = p.tokenize; + r = d[e.indexOf(m)]; + q !== g && (g = q, k = g.encode(c)); + for (let v = 0; v < u.length; v++) { + let w = ""; + var l = ba(u[v].doc, r); + let y = g.encode(l); + l = l.split(g.split); + for (let F = 0, A, x; F < y.length; F++) { + A = y[F]; + x = l[F]; + if (!A || !x) { + continue; + } + let D; + for (let H = 0, C; H < k.length; H++) { + if (C = k[H], "strict" === h) { + if (A === C) { + w += (w ? " " : "") + f.replace("$1", x); + D = !0; + break; + } + } else { + const G = A.indexOf(C); + if (-1 < G) { + w += (w ? " " : "") + x.substring(0, G) + f.replace("$1", x.substring(G, C.length)) + x.substring(G + C.length); + D = !0; + break; + } + } + } + D || (w += (w ? " " : "") + l[F]); + } + u[v].highlight = w; + } + } + return a; +} +function Ra(a, c) { + const b = [], e = B(); + for (let d = 0, f, g; d < a.length; d++) { + f = a[d]; + g = f.result; + for (let k = 0, h, l, n; k < g.length; k++) { + if (l = g[k], "object" !== typeof l && (l = {id:l}), h = l.id, n = e[h]) { + n.push(f.field); + } else { + if (b.length === c) { + return b; + } + l.field = e[h] = [f.field]; + b.push(l); + } + } + } + return b; +} +function Qa(a, c, b, e, d) { + let f = this.tag.get(a); + if (!f) { + return console.warn("Tag '" + a + "' was not found"), []; + } + if ((a = (f = f && f.get(c)) && f.length - e) && 0 < a) { + if (a > b || e) { + f = f.slice(e, e + b); + } + d && (f = V.call(this, f)); + return f; + } +} +function V(a) { + if (!this || !this.store) { + return a; + } + const c = Array(a.length); + for (let b = 0, e; b < a.length; b++) { + e = a[b], c[b] = {id:e, doc:this.store.get(e)}; + } + return c; +} +;function U(a) { + if (!this || this.constructor !== U) { + return new U(a); + } + const c = a.document || a.doc || a; + let b, e; + this.D = []; + this.field = []; + this.J = []; + this.key = (b = c.key || c.id) && Ta(b, this.J) || "id"; + (e = a.keystore || 0) && (this.keystore = e); + this.fastupdate = !!a.fastupdate; + this.reg = !this.fastupdate || a.worker || a.db ? e ? new T(e) : new Set() : e ? new S(e) : new Map(); + this.C = (b = c.store || null) && b && !0 !== b && []; + this.store = b && (e ? new S(e) : new Map()); + this.cache = (b = a.cache || null) && new X(b); + a.cache = !1; + this.worker = a.worker; + this.priority = a.priority || 4; + this.index = Ua.call(this, a, c); + this.tag = null; + if (b = c.tag) { + if ("string" === typeof b && (b = [b]), b.length) { + this.tag = new Map(); + this.F = []; + this.R = []; + for (let d = 0, f, g; d < b.length; d++) { + f = b[d]; + g = f.field || f; + if (!g) { + throw Error("The tag field from the document descriptor is undefined."); + } + f.custom ? this.F[d] = f.custom : (this.F[d] = Ta(g, this.J), f.filter && ("string" === typeof this.F[d] && (this.F[d] = new String(this.F[d])), this.F[d].I = f.filter)); + this.R[d] = g; + this.tag.set(g, new Map()); + } + } + } + if (this.worker) { + this.fastupdate = !1; + a = []; + for (const d of this.index.values()) { + d.then && a.push(d); + } + if (a.length) { + const d = this; + return Promise.all(a).then(function(f) { + let g = 0; + for (const k of d.index.entries()) { + const h = k[0]; + k[1].then && d.index.set(h, f[g++]); + } + return d; + }); + } + } else { + a.db && (this.fastupdate = !1, this.mount(a.db)); + } +} +t = U.prototype; +t.mount = function(a) { + if (this.worker) { + throw Error("You can't use Worker-Indexes on a persistent model. That would be useless, since each of the persistent model acts like Worker-Index by default (Master/Slave)."); + } + let c = this.field; + if (this.tag) { + for (let d = 0, f; d < this.R.length; d++) { + f = this.R[d]; + var b = void 0; + this.index.set(f, b = new N({}, this.reg)); + c === this.field && (c = c.slice(0)); + c.push(f); + b.tag = this.tag.get(f); + } + } + b = []; + const e = {db:a.db, type:a.type, fastupdate:a.fastupdate}; + for (let d = 0, f, g; d < c.length; d++) { + e.field = g = c[d]; + f = this.index.get(g); + const k = new a.constructor(a.id, e); + k.id = a.id; + b[d] = k.mount(f); + f.document = !0; + d ? f.bypass = !0 : f.store = this.store; + } + this.db = !0; + return Promise.all(b); +}; +t.commit = async function(a, c) { + const b = []; + for (const e of this.index.values()) { + b.push(e.commit(a, c)); + } + await Promise.all(b); + this.reg.clear(); +}; +t.destroy = function() { + const a = []; + for (const c of this.index.values()) { + a.push(c.destroy()); + } + return Promise.all(a); +}; +function Ua(a, c) { + const b = new Map(); + let e = c.index || c.field || c; + E(e) && (e = [e]); + for (let d = 0, f, g; d < e.length; d++) { + f = e[d]; + E(f) || (g = f, f = f.field); + g = I(g) ? Object.assign({}, a, g) : a; + if (this.worker) { + const k = new P(g); + b.set(f, k); + } + this.worker || b.set(f, new N(g, this.reg)); + g.custom ? this.D[d] = g.custom : (this.D[d] = Ta(f, this.J), g.filter && ("string" === typeof this.D[d] && (this.D[d] = new String(this.D[d])), this.D[d].I = g.filter)); + this.field[d] = f; + } + if (this.C) { + a = c.store; + E(a) && (a = [a]); + for (let d = 0, f, g; d < a.length; d++) { + f = a[d], g = f.field || f, f.custom ? (this.C[d] = f.custom, f.custom.V = g) : (this.C[d] = Ta(g, this.J), f.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].I = f.filter)); + } + } + return b; +} +function Ta(a, c) { + const b = a.split(":"); + let e = 0; + for (let d = 0; d < b.length; d++) { + a = b[d], "]" === a[a.length - 1] && (a = a.substring(0, a.length - 2)) && (c[e] = !0), a && (b[e++] = a); + } + e < b.length && (b.length = e); + return 1 < e ? b : b[0]; +} +t.append = function(a, c) { + return this.add(a, c, !0); +}; +t.update = function(a, c) { + return this.remove(a).add(a, c); +}; +t.remove = function(a) { + I(a) && (a = ba(a, this.key)); + for (var c of this.index.values()) { + c.remove(a, !0); + } + if (this.reg.has(a)) { + if (this.tag && !this.fastupdate) { + for (let b of this.tag.values()) { + for (let e of b) { + c = e[0]; + const d = e[1], f = d.indexOf(a); + -1 < f && (1 < d.length ? d.splice(f, 1) : b.delete(c)); + } + } + } + this.store && this.store.delete(a); + this.reg.delete(a); + } + this.cache && this.cache.remove(a); + return this; +}; +t.clear = function() { + const a = []; + for (const c of this.index.values()) { + const b = c.clear(); + b.then && a.push(b); + } + if (this.tag) { + for (const c of this.tag.values()) { + c.clear(); + } + } + this.store && this.store.clear(); + this.cache && this.cache.clear(); + return a.length ? Promise.all(a) : this; +}; +t.contain = function(a) { + return this.db ? this.index.get(this.field[0]).db.has(a) : this.reg.has(a); +}; +t.cleanup = function() { + for (const a of this.index.values()) { + a.cleanup(); + } + return this; +}; +t.get = function(a) { + return this.db ? this.index.get(this.field[0]).db.enrich(a).then(function(c) { + return c[0] && c[0].doc; + }) : this.store.get(a); +}; +t.set = function(a, c) { + this.store.set(a, c); + return this; +}; +t.searchCache = Va; +t.export = function(a, c, b = 0, e = 0) { + if (b < this.field.length) { + const g = this.field[b]; + if ((c = this.index.get(g).export(a, g, b, e = 1)) && c.then) { + const k = this; + return c.then(function() { + return k.export(a, g, b + 1); + }); + } + return this.export(a, g, b + 1); + } + let d, f; + switch(e) { + case 0: + d = "reg"; + f = wa(this.reg); + c = null; + break; + case 1: + d = "tag"; + f = this.tag && ua(this.tag, this.reg.size); + c = null; + break; + case 2: + d = "doc"; + f = this.store && sa(this.store); + c = null; + break; + default: + return; + } + return ya.call(this, a, c, d, f, b, e); +}; +t.import = function(a, c) { + var b = a.split("."); + "json" === b[b.length - 1] && b.pop(); + const e = 2 < b.length ? b[0] : ""; + b = 2 < b.length ? b[2] : b[1]; + if (this.worker && e) { + return this.index.get(e).import(a); + } + if (c) { + "string" === typeof c && (c = JSON.parse(c)); + if (e) { + return this.index.get(e).import(b, c); + } + switch(b) { + case "reg": + this.fastupdate = !1; + this.reg = xa(c, this.reg); + for (let d = 0, f; d < this.field.length; d++) { + f = this.index.get(this.field[d]), f.fastupdate = !1, f.reg = this.reg; + } + if (this.worker) { + c = []; + for (const d of this.index.values()) { + c.push(d.import(a)); + } + return Promise.all(c); + } + break; + case "tag": + this.tag = va(c, this.tag); + break; + case "doc": + this.store = ta(c, this.store); + } + } +}; +la(U.prototype); +function Va(a, c, b) { + a = ("object" === typeof a ? "" + a.query : a).toLowerCase(); + this.cache || (this.cache = new X()); + let e = this.cache.get(a); + if (!e) { + e = this.search(a, c, b); + if (e.then) { + const d = this; + e.then(function(f) { + d.cache.set(a, f); + return f; + }); + } + this.cache.set(a, e); + } + return e; +} +function X(a) { + this.limit = a && !0 !== a ? a : 1000; + this.cache = new Map(); + this.h = ""; +} +X.prototype.set = function(a, c) { + this.cache.set(this.h = a, c); + this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value); +}; +X.prototype.get = function(a) { + const c = this.cache.get(a); + c && this.h !== a && (this.cache.delete(a), this.cache.set(this.h = a, c)); + return c; +}; +X.prototype.remove = function(a) { + for (const c of this.cache) { + const b = c[0]; + c[1].includes(a) && this.cache.delete(b); + } +}; +X.prototype.clear = function() { + this.cache.clear(); + this.h = ""; +}; +const Wa = {normalize:!1, numeric:!1, split:/\s+/}; +const Xa = {normalize:!0}; +const Ya = {normalize:!0, dedupe:!0}; +const Za = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]); +const $a = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), ab = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"]; +const bb = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6}; +var cb = {X:Wa, W:Xa, Y:Ya, LatinBalance:{normalize:!0, dedupe:!0, mapper:Za}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Za, matcher:$a, replacer:ab}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Za, replacer:ab.concat([/(?!^)[aeo]/g, ""]), matcher:$a}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) { + for (let b = 0; b < a.length; b++) { + var c = a[b]; + let e = c.charAt(0), d = bb[e]; + for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = bb[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) { + } + a[b] = e; + } +}}, LatinExact:Wa, LatinDefault:Xa, LatinSimple:Ya}; +const db = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}}; +N.prototype.add = function(a, c, b, e) { + if (c && (a || 0 === a)) { + if (!e && !b && this.reg.has(a)) { + return this.update(a, c); + } + c = this.encoder.encode(c); + if (e = c.length) { + const l = B(), n = B(), m = this.depth, q = this.resolution; + for (let p = 0; p < e; p++) { + let r = c[this.rtl ? e - 1 - p : p]; + var d = r.length; + if (d && (m || !n[r])) { + var f = this.score ? this.score(c, r, p, null, 0) : eb(q, e, p), g = ""; + switch(this.tokenize) { + case "full": + if (2 < d) { + for (let u = 0, v; u < d; u++) { + for (f = d; f > u; f--) { + g = r.substring(u, f); + v = this.rtl ? d - 1 - u : u; + var k = this.score ? this.score(c, r, p, g, v) : eb(q, e, p, d, v); + fb(this, n, g, k, a, b); + } + } + break; + } + case "bidirectional": + case "reverse": + if (1 < d) { + for (k = d - 1; 0 < k; k--) { + g = r[this.rtl ? d - 1 - k : k] + g; + var h = this.score ? this.score(c, r, p, g, k) : eb(q, e, p, d, k); + fb(this, n, g, h, a, b); + } + g = ""; + } + case "forward": + if (1 < d) { + for (k = 0; k < d; k++) { + g += r[this.rtl ? d - 1 - k : k], fb(this, n, g, f, a, b); + } + break; + } + default: + if (fb(this, n, r, f, a, b), m && 1 < e && p < e - 1) { + for (d = B(), g = this.U, f = r, k = Math.min(m + 1, this.rtl ? p + 1 : e - p), d[f] = 1, h = 1; h < k; h++) { + if ((r = c[this.rtl ? e - 1 - p - h : p + h]) && !d[r]) { + d[r] = 1; + const u = this.score ? this.score(c, f, p, r, h - 1) : eb(g + (e / 2 > g ? 0 : 1), e, p, k - 1, h - 1), v = this.bidirectional && r > f; + fb(this, l, v ? f : r, u, a, b, v ? r : f); + } + } + } + } + } + } + this.fastupdate || this.reg.add(a); + } else { + c = ""; + } + } + this.db && (c || this.commit_task.push({del:a}), this.T && gb(this)); + return this; +}; +function fb(a, c, b, e, d, f, g) { + let k = g ? a.ctx : a.map, h; + if (!c[b] || g && !(h = c[b])[g]) { + if (g ? (c = h || (c[b] = B()), c[g] = 1, (h = k.get(g)) ? k = h : k.set(g, k = new Map())) : c[b] = 1, (h = k.get(b)) ? k = h : k.set(b, k = h = []), k = k[e] || (k[e] = []), !f || !k.includes(d)) { + if (k.length === 2 ** 31 - 1) { + c = new R(k); + if (a.fastupdate) { + for (let l of a.reg.values()) { + l.includes(k) && (l[l.indexOf(k)] = c); + } + } + h[e] = k = c; + } + k.push(d); + a.fastupdate && ((e = a.reg.get(d)) ? e.push(k) : a.reg.set(d, [k])); + } + } +} +function eb(a, c, b, e, d) { + return b && 1 < a ? c + (e || 0) <= a ? b + (d || 0) : (a - 1) / (c + (e || 0)) * (b + (d || 0)) + 1 | 0 : 0; +} +;N.prototype.search = function(a, c, b) { + b || (!c && I(a) ? (b = a, a = "") : I(c) && (b = c, c = 0)); + let e = [], d, f, g, k = 0, h, l, n, m, q; + b ? (a = b.query || a, c = b.limit || c, k = b.offset || 0, f = b.context, g = b.suggest, q = (h = !1 !== b.resolve) && b.enrich, n = b.boost, m = b.resolution, l = this.db && b.tag) : h = this.resolve; + let p = this.encoder.encode(a); + d = p.length; + c = c || (h ? 100 : 0); + if (1 === d) { + return hb.call(this, p[0], "", c, k, h, q, l); + } + f = this.depth && !1 !== f; + if (2 === d && f && !g) { + return hb.call(this, p[0], p[1], c, k, h, q, l); + } + let r = B(), u = 0, v; + 1 < d && f && (v = p[0], u = 1); + m || 0 === m || (m = v ? this.U : this.resolution); + if (this.db) { + if (this.db.search && (a = this.db.search(this, p, c, k, g, h, q, l), !1 !== a)) { + return a; + } + const w = this; + return async function() { + for (let y, F; u < d; u++) { + if ((F = p[u]) && !r[F]) { + r[F] = 1; + y = await ib(w, F, v, 0, 0, !1, !1); + if (y = jb(y, e, g, m)) { + e = y; + break; + } + v && (g && y && e.length || (v = F)); + } + g && v && u === d - 1 && !e.length && (m = w.resolution, v = "", u = -1, r = B()); + } + return kb(e, m, c, k, g, n, h); + }(); + } + for (let w, y; u < d; u++) { + if ((y = p[u]) && !r[y]) { + r[y] = 1; + w = ib(this, y, v, 0, 0, !1, !1); + if (w = jb(w, e, g, m)) { + e = w; + break; + } + v && (g && w && e.length || (v = y)); + } + g && v && u === d - 1 && !e.length && (m = this.resolution, v = "", u = -1, r = B()); + } + return kb(e, m, c, k, g, n, h); +}; +function kb(a, c, b, e, d, f, g) { + let k = a.length, h = a; + if (1 < k) { + h = Fa(a, c, b, e, d, f, g); + } else if (1 === k) { + return g ? Ia.call(null, a[0], b, e) : new W(a[0]); + } + return g ? h : new W(h); +} +function hb(a, c, b, e, d, f, g) { + a = ib(this, a, c, b, e, d, f, g); + return this.db ? a.then(function(k) { + return d ? k || [] : new W(k); + }) : a && a.length ? d ? Ia.call(this, a, b, e) : new W(a) : d ? [] : new W(); +} +function jb(a, c, b, e) { + let d = []; + if (a && a.length) { + if (a.length <= e) { + c.push(a); + return; + } + for (let f = 0, g; f < e; f++) { + if (g = a[f]) { + d[f] = g; + } + } + if (d.length) { + c.push(d); + return; + } + } + if (!b) { + return d; + } +} +function ib(a, c, b, e, d, f, g, k) { + let h; + b && (h = a.bidirectional && c > b) && (h = b, b = c, c = h); + if (a.db) { + return a.db.get(c, b, e, d, f, g, k); + } + a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c); + return a; +} +;N.prototype.remove = function(a, c) { + const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a)); + if (b) { + if (this.fastupdate) { + for (let e = 0, d; e < b.length; e++) { + if (d = b[e]) { + if (2 > d.length) { + d.pop(); + } else { + const f = d.indexOf(a); + f === b.length - 1 ? d.pop() : d.splice(f, 1); + } + } + } + } else { + lb(this.map, a), this.depth && lb(this.ctx, a); + } + c || this.reg.delete(a); + } + this.db && (this.commit_task.push({del:a}), this.T && gb(this)); + this.cache && this.cache.remove(a); + return this; +}; +function lb(a, c) { + let b = 0; + if (a.constructor === Array) { + for (let e = 0, d, f; e < a.length; e++) { + if ((d = a[e]) && d.length) { + if (f = d.indexOf(c), 0 <= f) { + 1 < d.length ? (d.splice(f, 1), b++) : delete a[e]; + break; + } else { + b++; + } + } + } + } else { + for (let e of a.entries()) { + const d = e[0], f = lb(e[1], c); + f ? b += f : a.delete(d); + } + } + return b; +} +;function N(a, c) { + if (!this || this.constructor !== N) { + return new N(a); + } + if (a) { + var b = E(a) ? a : a.preset; + b && (db[b] || console.warn("Preset not found: " + b), a = Object.assign({}, db[b], a)); + } else { + a = {}; + } + b = a.context; + const e = !0 === b ? {depth:1} : b || {}, d = E(a.encoder) ? cb[a.encoder] : a.encode || a.encoder || Xa; + this.encoder = d.encode ? d : "object" === typeof d ? new ja(d) : {encode:d}; + this.resolution = a.resolution || 9; + this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict"; + this.depth = "strict" === b && e.depth || 0; + this.bidirectional = !1 !== e.bidirectional; + this.fastupdate = !!a.fastupdate; + this.score = a.score || null; + e && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".'); + (b = a.keystore || 0) && (this.keystore = b); + this.map = b ? new S(b) : new Map(); + this.ctx = b ? new S(b) : new Map(); + this.reg = c || (this.fastupdate ? b ? new S(b) : new Map() : b ? new T(b) : new Set()); + this.U = e.resolution || 3; + this.rtl = d.rtl || a.rtl || !1; + this.cache = (b = a.cache || null) && new X(b); + this.resolve = !1 !== a.resolve; + if (b = a.db) { + this.db = this.mount(b); + } + this.T = !1 !== a.commit; + this.commit_task = []; + this.commit_timer = null; + this.priority = a.priority || 4; +} +t = N.prototype; +t.mount = function(a) { + this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); + return a.mount(this); +}; +t.commit = function(a, c) { + this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); + return this.db.commit(this, a, c); +}; +t.destroy = function() { + this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); + return this.db.destroy(); +}; +function gb(a) { + a.commit_timer || (a.commit_timer = setTimeout(function() { + a.commit_timer = null; + a.db.commit(a, void 0, void 0); + }, 1)); +} +t.clear = function() { + this.map.clear(); + this.ctx.clear(); + this.reg.clear(); + this.cache && this.cache.clear(); + this.db && (this.commit_timer && clearTimeout(this.commit_timer), this.commit_timer = null, this.commit_task = [{clear:!0}]); + return this; +}; +t.append = function(a, c) { + return this.add(a, c, !0); +}; +t.contain = function(a) { + return this.db ? this.db.has(a) : this.reg.has(a); +}; +t.update = function(a, c) { + const b = this, e = this.remove(a); + return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c); +}; +function mb(a) { + let c = 0; + if (a.constructor === Array) { + for (let b = 0, e; b < a.length; b++) { + (e = a[b]) && (c += e.length); + } + } else { + for (const b of a.entries()) { + const e = b[0], d = mb(b[1]); + d ? c += d : a.delete(e); + } + } + return c; +} +t.cleanup = function() { + if (!this.fastupdate) { + return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this; + } + mb(this.map); + this.depth && mb(this.ctx); + return this; +}; +t.searchCache = Va; +t.export = function(a, c, b = 0, e = 0) { + let d, f; + switch(e) { + case 0: + d = "reg"; + f = wa(this.reg); + break; + case 1: + d = "cfg"; + f = null; + break; + case 2: + d = "map"; + f = sa(this.map, this.reg.size); + break; + case 3: + d = "ctx"; + f = ua(this.ctx, this.reg.size); + break; + default: + return; + } + return ya.call(this, a, c, d, f, b, e); +}; +t.import = function(a, c) { + if (c) { + switch("string" === typeof c && (c = JSON.parse(c)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) { + case "reg": + this.fastupdate = !1; + this.reg = xa(c, this.reg); + break; + case "map": + this.map = ta(c, this.map); + break; + case "ctx": + this.ctx = va(c, this.ctx); + } + } +}; +t.serialize = function(a = !0) { + let c = "", b = "", e = ""; + if (this.reg.size) { + let f; + for (var d of this.reg.keys()) { + f || (f = typeof d), c += (c ? "," : "") + ("string" === f ? '"' + d + '"' : d); + } + c = "index.reg=new Set([" + c + "]);"; + b = za(this.map, f); + b = "index.map=new Map([" + b + "]);"; + for (const g of this.ctx.entries()) { + d = g[0]; + let k = za(g[1], f); + k = "new Map([" + k + "])"; + k = '["' + d + '",' + k + "]"; + e += (e ? "," : "") + k; + } + e = "index.ctx=new Map([" + e + "]);"; + } + return a ? "function inject(index){" + c + b + e + "}" : c + b + e; +}; +la(N.prototype); +const nb = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), ob = ["map", "ctx", "tag", "reg", "cfg"], Y = B(); +function pb(a, c = {}) { + if (!this) { + return new pb(a, c); + } + "object" === typeof a && (c = a, a = a.name); + a || console.info("Default storage space was used, because a name was not passed."); + this.id = "flexsearch" + (a ? ":" + a.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : ""); + this.field = c.field ? c.field.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : ""; + this.type = c.type; + this.fastupdate = this.support_tag_search = !1; + this.db = null; + this.h = {}; +} +t = pb.prototype; +t.mount = function(a) { + if (!a.encoder) { + return a.mount(this); + } + a.db = this; + return this.open(); +}; +t.open = function() { + if (this.db) { + return this.db; + } + let a = this; + navigator.storage && navigator.storage.persist(); + Y[a.id] || (Y[a.id] = []); + Y[a.id].push(a.field); + const c = nb.open(a.id, 1); + c.onupgradeneeded = function() { + const b = a.db = this.result; + for (let e = 0, d; e < ob.length; e++) { + d = ob[e]; + for (let f = 0, g; f < Y[a.id].length; f++) { + g = Y[a.id][f], b.objectStoreNames.contains(d + ("reg" !== d ? g ? ":" + g : "" : "")) || b.createObjectStore(d + ("reg" !== d ? g ? ":" + g : "" : "")); + } + } + }; + return a.db = Z(c, function(b) { + a.db = b; + a.db.onversionchange = function() { + a.close(); + }; + }); +}; +t.close = function() { + this.db && this.db.close(); + this.db = null; +}; +t.destroy = function() { + const a = nb.deleteDatabase(this.id); + return Z(a); +}; +t.clear = function() { + const a = []; + for (let b = 0, e; b < ob.length; b++) { + e = ob[b]; + for (let d = 0, f; d < Y[this.id].length; d++) { + f = Y[this.id][d], a.push(e + ("reg" !== e ? f ? ":" + f : "" : "")); + } + } + const c = this.db.transaction(a, "readwrite"); + for (let b = 0; b < a.length; b++) { + c.objectStore(a[b]).clear(); + } + return Z(c); +}; +t.get = function(a, c, b = 0, e = 0, d = !0, f = !1) { + a = this.db.transaction((c ? "ctx" : "map") + (this.field ? ":" + this.field : ""), "readonly").objectStore((c ? "ctx" : "map") + (this.field ? ":" + this.field : "")).get(c ? c + ":" + a : a); + const g = this; + return Z(a).then(function(k) { + let h = []; + if (!k || !k.length) { + return h; + } + if (d) { + if (!b && !e && 1 === k.length) { + return k[0]; + } + for (let l = 0, n; l < k.length; l++) { + if ((n = k[l]) && n.length) { + if (e >= n.length) { + e -= n.length; + continue; + } + const m = b ? e + Math.min(n.length - e, b) : n.length; + for (let q = e; q < m; q++) { + h.push(n[q]); + } + e = 0; + if (h.length === b) { + break; + } + } + } + return f ? g.enrich(h) : h; + } + return k; + }); +}; +t.tag = function(a, c = 0, b = 0, e = !1) { + a = this.db.transaction("tag" + (this.field ? ":" + this.field : ""), "readonly").objectStore("tag" + (this.field ? ":" + this.field : "")).get(a); + const d = this; + return Z(a).then(function(f) { + if (!f || !f.length || b >= f.length) { + return []; + } + if (!c && !b) { + return f; + } + f = f.slice(b, b + c); + return e ? d.enrich(f) : f; + }); +}; +t.enrich = function(a) { + "object" !== typeof a && (a = [a]); + const c = this.db.transaction("reg", "readonly").objectStore("reg"), b = []; + for (let e = 0; e < a.length; e++) { + b[e] = Z(c.get(a[e])); + } + return Promise.all(b).then(function(e) { + for (let d = 0; d < e.length; d++) { + e[d] = {id:a[d], doc:e[d] ? JSON.parse(e[d]) : null}; + } + return e; + }); +}; +t.has = function(a) { + a = this.db.transaction("reg", "readonly").objectStore("reg").getKey(a); + return Z(a).then(function(c) { + return !!c; + }); +}; +t.search = null; +t.info = function() { +}; +t.transaction = function(a, c, b) { + a += "reg" !== a ? this.field ? ":" + this.field : "" : ""; + let e = this.h[a + ":" + c]; + if (e) { + return b.call(this, e); + } + let d = this.db.transaction(a, c); + this.h[a + ":" + c] = e = d.objectStore(a); + const f = b.call(this, e); + this.h[a + ":" + c] = null; + return Z(d).finally(function() { + d = e = null; + return f; + }); +}; +t.commit = async function(a, c, b) { + if (c) { + await this.clear(), a.commit_task = []; + } else { + let e = a.commit_task; + a.commit_task = []; + for (let d = 0, f; d < e.length; d++) { + if (f = e[d], f.clear) { + await this.clear(); + c = !0; + break; + } else { + e[d] = f.del; + } + } + c || (b || (e = e.concat(aa(a.reg))), e.length && await this.remove(e)); + } + a.reg.size && (await this.transaction("map", "readwrite", function(e) { + for (const d of a.map) { + const f = d[0], g = d[1]; + g.length && (c ? e.put(g, f) : e.get(f).onsuccess = function() { + let k = this.result; + var h; + if (k && k.length) { + const l = Math.max(k.length, g.length); + for (let n = 0, m, q; n < l; n++) { + if ((q = g[n]) && q.length) { + if ((m = k[n]) && m.length) { + for (h = 0; h < q.length; h++) { + m.push(q[h]); + } + } else { + k[n] = q; + } + h = 1; + } + } + } else { + k = g, h = 1; + } + h && e.put(k, f); + }); + } + }), await this.transaction("ctx", "readwrite", function(e) { + for (const d of a.ctx) { + const f = d[0], g = d[1]; + for (const k of g) { + const h = k[0], l = k[1]; + l.length && (c ? e.put(l, f + ":" + h) : e.get(f + ":" + h).onsuccess = function() { + let n = this.result; + var m; + if (n && n.length) { + const q = Math.max(n.length, l.length); + for (let p = 0, r, u; p < q; p++) { + if ((u = l[p]) && u.length) { + if ((r = n[p]) && r.length) { + for (m = 0; m < u.length; m++) { + r.push(u[m]); + } + } else { + n[p] = u; + } + m = 1; + } + } + } else { + n = l, m = 1; + } + m && e.put(n, f + ":" + h); + }); + } + } + }), a.store ? await this.transaction("reg", "readwrite", function(e) { + for (const d of a.store) { + const f = d[0], g = d[1]; + e.put("object" === typeof g ? JSON.stringify(g) : 1, f); + } + }) : a.bypass || await this.transaction("reg", "readwrite", function(e) { + for (const d of a.reg.keys()) { + e.put(1, d); + } + }), a.tag && await this.transaction("tag", "readwrite", function(e) { + for (const d of a.tag) { + const f = d[0], g = d[1]; + g.length && (e.get(f).onsuccess = function() { + let k = this.result; + k = k && k.length ? k.concat(g) : g; + e.put(k, f); + }); + } + }), a.map.clear(), a.ctx.clear(), a.tag && a.tag.clear(), a.store && a.store.clear(), a.document || a.reg.clear()); +}; +function qb(a, c, b) { + const e = a.value; + let d, f = 0; + for (let g = 0, k; g < e.length; g++) { + if (k = b ? e : e[g]) { + for (let h = 0, l, n; h < c.length; h++) { + if (n = c[h], l = k.indexOf(n), 0 <= l) { + if (d = 1, 1 < k.length) { + k.splice(l, 1); + } else { + e[g] = []; + break; + } + } + } + f += k.length; + } + if (b) { + break; + } + } + f ? d && a.update(e) : a.delete(); + a.continue(); +} +t.remove = function(a) { + "object" !== typeof a && (a = [a]); + return Promise.all([this.transaction("map", "readwrite", function(c) { + c.openCursor().onsuccess = function() { + const b = this.result; + b && qb(b, a); + }; + }), this.transaction("ctx", "readwrite", function(c) { + c.openCursor().onsuccess = function() { + const b = this.result; + b && qb(b, a); + }; + }), this.transaction("tag", "readwrite", function(c) { + c.openCursor().onsuccess = function() { + const b = this.result; + b && qb(b, a, !0); + }; + }), this.transaction("reg", "readwrite", function(c) { + for (let b = 0; b < a.length; b++) { + c.delete(a[b]); + } + })]); +}; +function Z(a, c) { + return new Promise((b, e) => { + a.onsuccess = a.oncomplete = function() { + c && c(this.result); + c = null; + b(this.result); + }; + a.onerror = a.onblocked = e; + a = null; + }); +} +;const rb = {Index:N, Charset:cb, Encoder:ja, Document:U, Worker:P, Resolver:W, IndexedDB:pb, Language:{}}, sb = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self; +let ub; +(ub = sb.define) && ub.amd ? ub([], function() { + return rb; +}) : "object" === typeof sb.exports ? sb.exports = rb : sb.FlexSearch = rb; +}(this||self)); diff --git a/public/js/main.js b/public/js/main.js new file mode 100644 index 0000000..2331717 --- /dev/null +++ b/public/js/main.js @@ -0,0 +1,574 @@ +function computeMenuTranslation(switcher, optionsElement) { + // Calculate the position of a language options element. + const switcherRect = switcher.getBoundingClientRect(); + + // Must be called before optionsElement.clientWidth. + optionsElement.style.minWidth = `${Math.max(switcherRect.width, 50)}px`; + + const isOnTop = switcher.dataset.location === 'top'; + const isOnBottom = switcher.dataset.location === 'bottom'; + const isOnBottomRight = switcher.dataset.location === 'bottom-right'; + const isRTL = document.documentElement.dir === 'rtl' + + // Stuck on the left side of the switcher. + let x = switcherRect.left; + + if (isOnTop && !isRTL || isOnBottom && isRTL || isOnBottomRight && !isRTL) { + // Stuck on the right side of the switcher. + x = switcherRect.right - optionsElement.clientWidth; + } + + // Stuck on the top of the switcher. + let y = switcherRect.top - window.innerHeight - 10; + + if (isOnTop) { + // Stuck on the bottom of the switcher. + y = switcherRect.top - window.innerHeight + optionsElement.clientHeight + switcher.clientHeight + 4; + } + + return { x: x, y: y }; +} + +function toggleMenu(switcher) { + const optionsElement = switcher.nextElementSibling; + + optionsElement.classList.toggle('hx:hidden'); + + // Calculate the position of a language options element. + const translate = computeMenuTranslation(switcher, optionsElement); + + optionsElement.style.transform = `translate3d(${translate.x}px, ${translate.y}px, 0)`; +} + +function resizeMenu(switcher) { + const optionsElement = switcher.nextElementSibling; + + if (optionsElement.classList.contains('hx:hidden')) return; + + // Calculate the position of a language options element. + const translate = computeMenuTranslation(switcher, optionsElement); + + optionsElement.style.transform = `translate3d(${translate.x}px, ${translate.y}px, 0)`; +} + +; +// Light / Dark theme toggle +(function () { + const defaultTheme = 'system' + const themes = ["light", "dark"]; + + const themeToggleButtons = document.querySelectorAll(".hextra-theme-toggle"); + const themeToggleOptions = document.querySelectorAll(".hextra-theme-toggle-options p"); + + function applyTheme(theme) { + theme = themes.includes(theme) ? theme : "system"; + + themeToggleButtons.forEach((btn) => btn.parentElement.dataset.theme = theme ); + + localStorage.setItem("color-theme", theme); + } + + function switchTheme(theme) { + setTheme(theme); + applyTheme(theme); + } + + const colorTheme = "color-theme" in localStorage ? localStorage.getItem("color-theme") : defaultTheme; + switchTheme(colorTheme); + + // Add click event handler to the menu items. + themeToggleOptions.forEach((option) => { + option.addEventListener("click", function (e) { + e.preventDefault(); + + switchTheme(option.dataset.item); + }) + }) + + // Add click event handler to the buttons + themeToggleButtons.forEach((toggler) => { + toggler.addEventListener("click", function (e) { + e.preventDefault(); + + toggleMenu(toggler); + }); + }); + + window.addEventListener("resize", () => themeToggleButtons.forEach(resizeMenu)) + + // Dismiss the menu when clicking outside + document.addEventListener('click', (e) => { + if (e.target.closest('.hextra-theme-toggle') === null) { + themeToggleButtons.forEach((toggler) => { + toggler.dataset.state = 'closed'; + toggler.nextElementSibling.classList.add('hx:hidden'); + }); + } + }); + + // Listen for system theme changes + window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => { + if (localStorage.getItem("color-theme") === "system") { + setTheme("system"); + } + }); +})(); + +; +// +; +// Hamburger menu for mobile navigation + +document.addEventListener('DOMContentLoaded', function () { + const menu = document.querySelector('.hextra-hamburger-menu'); + const sidebarContainer = document.querySelector('.hextra-sidebar-container'); + + function toggleMenu() { + // Toggle the hamburger menu + menu.querySelector('svg').classList.toggle('open'); + + // When the menu is open, we want to show the navigation sidebar + sidebarContainer.classList.toggle('hx:max-md:[transform:translate3d(0,-100%,0)]'); + sidebarContainer.classList.toggle('hx:max-md:[transform:translate3d(0,0,0)]'); + + // When the menu is open, we want to prevent the body from scrolling + document.body.classList.toggle('hx:overflow-hidden'); + document.body.classList.toggle('hx:md:overflow-auto'); + } + + menu.addEventListener('click', (e) => { + e.preventDefault(); + toggleMenu(); + }); + + // Select all anchor tags in the sidebar container + const sidebarLinks = sidebarContainer.querySelectorAll('a'); + + // Add click event listener to each anchor tag + sidebarLinks.forEach(link => { + link.addEventListener('click', (e) => { + // Check if the href attribute contains a hash symbol (links to a heading) + if (link.getAttribute('href') && link.getAttribute('href').startsWith('#')) { + // Only dismiss overlay on mobile view + if (window.innerWidth < 768) { + toggleMenu(); + } + } + }); + }); +}); + +; +// Copy button for code blocks + +document.addEventListener('DOMContentLoaded', function () { + const getCopyIcon = () => { + const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.innerHTML = ` + + `; + svg.setAttribute('fill', 'none'); + svg.setAttribute('viewBox', '0 0 24 24'); + svg.setAttribute('stroke', 'currentColor'); + svg.setAttribute('stroke-width', '2'); + return svg; + } + + const getSuccessIcon = () => { + const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.innerHTML = ` + + `; + svg.setAttribute('fill', 'none'); + svg.setAttribute('viewBox', '0 0 24 24'); + svg.setAttribute('stroke', 'currentColor'); + svg.setAttribute('stroke-width', '2'); + return svg; + } + + document.querySelectorAll('.hextra-code-copy-btn').forEach(function (button) { + // Add copy and success icons + button.querySelector('.hextra-copy-icon')?.appendChild(getCopyIcon()); + button.querySelector('.hextra-success-icon')?.appendChild(getSuccessIcon()); + + // Add click event listener for copy button + button.addEventListener('click', function (e) { + e.preventDefault(); + // Get the code target + const target = button.parentElement.previousElementSibling; + let codeElement; + if (target.tagName === 'CODE') { + codeElement = target; + } else { + // Select the last code element in case line numbers are present + const codeElements = target.querySelectorAll('code'); + codeElement = codeElements[codeElements.length - 1]; + } + if (codeElement) { + let code = codeElement.innerText; + // Replace double newlines with single newlines in the innerText + // as each line inside has trailing newline '\n' + if ("lang" in codeElement.dataset) { + code = code.replace(/\n\n/g, '\n'); + } + navigator.clipboard.writeText(code).then(function () { + button.classList.add('copied'); + setTimeout(function () { + button.classList.remove('copied'); + }, 1000); + }).catch(function (err) { + console.error('Failed to copy text: ', err); + }); + } else { + console.error('Target element not found'); + } + }); + }); +}); + +; +(function () { + function updateGroup(container, index) { + const tabs = Array.from(container.querySelectorAll('.hextra-tabs-toggle')); + tabs.forEach((tab, i) => { + tab.dataset.state = i === index ? 'selected' : ''; + if (i === index) { + tab.setAttribute('aria-selected', 'true'); + tab.tabIndex = 0; + } else { + tab.removeAttribute('aria-selected'); + tab.removeAttribute('tabindex'); + } + }); + const panelsContainer = container.parentElement.nextElementSibling; + if (!panelsContainer) return; + Array.from(panelsContainer.children).forEach((panel, i) => { + panel.dataset.state = i === index ? 'selected' : ''; + if (i === index) { + panel.tabIndex = 0; + } else { + panel.removeAttribute('tabindex'); + } + }); + } + + const syncGroups = document.querySelectorAll('[data-tab-group]'); + + syncGroups.forEach((group) => { + const key = encodeURIComponent(group.dataset.tabGroup); + const saved = localStorage.getItem('hextra-tab-' + key); + if (saved !== null) { + updateGroup(group, parseInt(saved, 10)); + } + }); + + document.querySelectorAll('.hextra-tabs-toggle').forEach((button) => { + button.addEventListener('click', function (e) { + const container = e.target.parentElement; + const index = Array.from(container.querySelectorAll('.hextra-tabs-toggle')).indexOf( + e.target + ); + + if (container.dataset.tabGroup) { + // Sync behavior: update all tab groups with the same name + const tabGroupValue = container.dataset.tabGroup; + const key = encodeURIComponent(tabGroupValue); + document + .querySelectorAll('[data-tab-group="' + tabGroupValue + '"]') + .forEach((grp) => updateGroup(grp, index)); + localStorage.setItem('hextra-tab-' + key, index.toString()); + } else { + // Non-sync behavior: update only this specific tab group + updateGroup(container, index); + } + }); + }); +})(); + +; +(function () { + const languageSwitchers = document.querySelectorAll('.hextra-language-switcher'); + + languageSwitchers.forEach((switcher) => { + switcher.addEventListener('click', (e) => { + e.preventDefault(); + + switcher.dataset.state = switcher.dataset.state === 'open' ? 'closed' : 'open'; + + toggleMenu(switcher); + }); + }); + + window.addEventListener("resize", () => languageSwitchers.forEach(resizeMenu)) + + // Dismiss language switcher when clicking outside + document.addEventListener('click', (e) => { + if (e.target.closest('.hextra-language-switcher') === null) { + languageSwitchers.forEach((switcher) => { + switcher.dataset.state = 'closed'; + const optionsElement = switcher.nextElementSibling; + optionsElement.classList.add('hx:hidden'); + }); + } + }); +})(); + +; +(function () { + const hiddenClass = "hx:hidden"; + const dropdownToggles = document.querySelectorAll(".hextra-nav-menu-toggle"); + + dropdownToggles.forEach((toggle) => { + toggle.addEventListener("click", (e) => { + e.preventDefault(); + e.stopPropagation(); + + // Close all other dropdowns first + dropdownToggles.forEach((otherToggle) => { + if (otherToggle !== toggle) { + otherToggle.dataset.state = "closed"; + const otherMenuItems = otherToggle.nextElementSibling; + otherMenuItems.classList.add(hiddenClass); + } + }); + + // Toggle current dropdown + const isOpen = toggle.dataset.state === "open"; + toggle.dataset.state = isOpen ? "closed" : "open"; + const menuItemsElement = toggle.nextElementSibling; + + if (!isOpen) { + // Position dropdown centered with toggle + menuItemsElement.style.position = "absolute"; + menuItemsElement.style.top = "100%"; + menuItemsElement.style.left = "50%"; + menuItemsElement.style.transform = "translateX(-50%)"; + menuItemsElement.style.zIndex = "1000"; + + // Show dropdown + menuItemsElement.classList.remove(hiddenClass); + } else { + // Hide dropdown + menuItemsElement.classList.add(hiddenClass); + } + }); + }); + + // Dismiss dropdown when clicking outside + document.addEventListener("click", (e) => { + if (e.target.closest(".hextra-nav-menu-toggle") === null) { + dropdownToggles.forEach((toggle) => { + toggle.dataset.state = "closed"; + const menuItemsElement = toggle.nextElementSibling; + menuItemsElement.classList.add(hiddenClass); + }); + } + }); + + // Close dropdowns on escape key + document.addEventListener("keydown", (e) => { + if (e.key === "Escape") { + dropdownToggles.forEach((toggle) => { + toggle.dataset.state = "closed"; + const menuItemsElement = toggle.nextElementSibling; + menuItemsElement.classList.add(hiddenClass); + }); + } + }); +})(); + +; +// Script for filetree shortcode collapsing/expanding folders used in the theme +// ====================================================================== +document.addEventListener("DOMContentLoaded", function () { + const folders = document.querySelectorAll(".hextra-filetree-folder"); + folders.forEach(function (folder) { + folder.addEventListener("click", function () { + Array.from(folder.children).forEach(function (el) { + el.dataset.state = el.dataset.state === "open" ? "closed" : "open"; + }); + folder.nextElementSibling.dataset.state = folder.nextElementSibling.dataset.state === "open" ? "closed" : "open"; + }); + }); +}); + +; +document.addEventListener("DOMContentLoaded", function () { + scrollToActiveItem(); + enableCollapsibles(); +}); + +function enableCollapsibles() { + const buttons = document.querySelectorAll(".hextra-sidebar-collapsible-button"); + buttons.forEach(function (button) { + button.addEventListener("click", function (e) { + e.preventDefault(); + const list = button.parentElement.parentElement; + if (list) { + list.classList.toggle("open") + } + }); + }); +} + +function scrollToActiveItem() { + const sidebarScrollbar = document.querySelector("aside.hextra-sidebar-container > .hextra-scrollbar"); + const activeItems = document.querySelectorAll(".hextra-sidebar-active-item"); + const visibleActiveItem = Array.from(activeItems).find(function (activeItem) { + return activeItem.getBoundingClientRect().height > 0; + }); + + if (!visibleActiveItem) { + return; + } + + const yOffset = visibleActiveItem.clientHeight; + const yDistance = visibleActiveItem.getBoundingClientRect().top - sidebarScrollbar.getBoundingClientRect().top; + sidebarScrollbar.scrollTo({ + behavior: "instant", + top: yDistance - yOffset + }); +} + +; +// Back to top button + +document.addEventListener("DOMContentLoaded", function () { + const backToTop = document.querySelector("#backToTop"); + if (backToTop) { + document.addEventListener("scroll", (e) => { + if (window.scrollY > 300) { + backToTop.classList.remove("hx:opacity-0"); + } else { + backToTop.classList.add("hx:opacity-0"); + } + }); + } +}); + +function scrollUp() { + window.scroll({ + top: 0, + left: 0, + behavior: "smooth", + }); +} + +; +/** + * TOC Scroll - Highlights active TOC links based on visible headings + * + * Uses Intersection Observer to track heading visibility and applies + * 'hextra-toc-active' class to corresponding TOC links. Selects the + * topmost heading when multiple are visible. + * + * Requires: .hextra-toc element, matching heading IDs, toc.css styles + */ +document.addEventListener("DOMContentLoaded", function () { + const toc = document.querySelector(".hextra-toc"); + if (!toc) return; + + const tocLinks = toc.querySelectorAll('a[href^="#"]'); + if (tocLinks.length === 0) return; + + const headingIds = Array.from(tocLinks).map((link) => link.getAttribute("href").substring(1)); + + const headings = headingIds.map((id) => document.getElementById(decodeURIComponent(id))).filter(Boolean); + if (headings.length === 0) return; + + let currentActiveLink = null; + let isHashNavigation = false; + + // Create intersection observer + const observer = new IntersectionObserver( + (entries) => { + // Skip observer updates during hash navigation + if (isHashNavigation) return; + + const visibleHeadings = entries.filter((entry) => entry.isIntersecting).map((entry) => entry.target); + + if (visibleHeadings.length === 0) return; + + // Find the heading closest to the top of the viewport + const topMostHeading = visibleHeadings.reduce((closest, heading) => { + const headingTop = heading.getBoundingClientRect().top; + const closestTop = closest.getBoundingClientRect().top; + return Math.abs(headingTop) < Math.abs(closestTop) ? heading : closest; + }); + + // Encode the id and make it lowercase to match the TOC link + const targetId = encodeURIComponent(topMostHeading.id).toLowerCase(); + const targetLink = toc.querySelector(`a[href="#${targetId}"]`); + + if (targetLink && targetLink !== currentActiveLink) { + // Remove active class from previous link + if (currentActiveLink) { + currentActiveLink.classList.remove("hextra-toc-active"); + } + + // Add active class to current link + targetLink.classList.add("hextra-toc-active"); + currentActiveLink = targetLink; + } + }, + { + rootMargin: "-20px 0px -60% 0px", // Adjust sensitivity + threshold: [0, 0.1, 0.5, 1], + } + ); + + // Observe all headings + headings.forEach((heading) => observer.observe(heading)); + + // Handle direct navigation to page with hash + function handleHashNavigation() { + const hash = window.location.hash; // already url encoded + if (hash) { + const targetLink = toc.querySelector(`a[href="${hash}"]`); + if (targetLink) { + // Disable observer temporarily during hash navigation + isHashNavigation = true; + + if (currentActiveLink) { + currentActiveLink.classList.remove("hextra-toc-active"); + } + targetLink.classList.add("hextra-toc-active"); + currentActiveLink = targetLink; + + // Re-enable observer after scroll settles + setTimeout(() => { isHashNavigation = false; }, 500); + return; + } + } + } + + // Handle hash changes navigation + window.addEventListener("hashchange", handleHashNavigation); + + // Handle initial load + setTimeout(handleHashNavigation, 100); +}); + +; +// +(function () { + const faviconEl = document.getElementById("favicon-svg"); + const faviconDarkExists = "false" === "true"; + + if (faviconEl && faviconDarkExists) { + const lightFavicon = '/favicon.svg'; + const darkFavicon = '/favicon-dark.svg'; + + const darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)"); + + function updateFavicon(e) { + faviconEl.href = e.matches ? darkFavicon : lightFavicon; + } + + // Set favicon on load + updateFavicon(darkModeQuery); + + // Listen for system preference changes + darkModeQuery.addEventListener("change", updateFavicon); + } +})(); diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 0000000..c36f3b3 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,20 @@ +{ + "name": "Hextra", + "short_name": "Hextra", + "start_url": "index.html", + "icons": [ + { + "src": "android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#000000", + "background_color": "#000000", + "display": "standalone" +} diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..a7a80f2 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,27 @@ + + + + http://localhost:1313/ + + http://localhost:1313/courses/ + + http://localhost:1313/courses/spring-boot/ + + http://localhost:1313/courses/prog-intro/ + + http://localhost:1313/courses/paradigms/ + + http://localhost:1313/courses/prog-intro/homeworks/ + + http://localhost:1313/courses/prog-intro/lectures/ + + http://localhost:1313/courses/prog-intro/lectures/intro/ + + http://localhost:1313/courses/prog-intro/homeworks/sum/ + + http://localhost:1313/categories/ + + http://localhost:1313/tags/ + + diff --git a/public/tags/index.html b/public/tags/index.html new file mode 100644 index 0000000..8d53a13 --- /dev/null +++ b/public/tags/index.html @@ -0,0 +1,355 @@ + + + + + + + + + + +Tags – CodeJava + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + +
    + + + + + +
    +
    +
    +

    Tags

    +
    +
    + +
    +
    + +
    +
    +
    +
    + +

    + + + + + + diff --git a/public/tags/index.xml b/public/tags/index.xml new file mode 100644 index 0000000..c48e99d --- /dev/null +++ b/public/tags/index.xml @@ -0,0 +1,18 @@ + + + CodeJava – Tags + http://localhost:1313/tags/ + Recent content in Tags on CodeJava + Hugo -- gohugo.io + en + + + + + + + + + + +