fix(mac): bundle web chat UI deps
parent
9c32e630a0
commit
c5c50a2141
|
|
@ -0,0 +1,24 @@
|
|||
// Minimal browser-friendly stub for @mariozechner/pi-ai
|
||||
export function getModel(provider, id) {
|
||||
return {
|
||||
provider,
|
||||
id,
|
||||
name: id,
|
||||
api: `${provider}-messages`,
|
||||
input: ["text"],
|
||||
output: ["text"],
|
||||
maxTokens: 200000,
|
||||
reasoning: true,
|
||||
headers: undefined,
|
||||
baseUrl: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
// Dummy stream helpers used in some debug flows; no-ops in web chat.
|
||||
export function agentLoop() {
|
||||
throw new Error("agentLoop is not available in embedded web chat");
|
||||
}
|
||||
export class AssistantMessageEventStream {
|
||||
push() {}
|
||||
end() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<p align="center">
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/lmstudio-ai/lmstudio.js/assets/3611042/dd0b2298-beec-4dfe-9019-7d4dc5427e40">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/lmstudio-ai/lmstudio.js/assets/3611042/70f24e8f-302b-465d-8607-8c3f36cd4934">
|
||||
<img alt="lmstudio javascript library logo" src="https://github.com/lmstudio-ai/lmstudio.js/assets/3611042/70f24e8f-302b-465d-8607-8c3f36cd4934" width="290" height="86" style="max-width: 100%;">
|
||||
</picture>
|
||||
|
||||
</p>
|
||||
<p align="center"><code>Use local LLMs in JS/TS/Node</code></p>
|
||||
<p align="center"><i>LM Studio Client SDK</i></p>
|
||||
|
||||
`lmstudio-ts` is LM Studio's official JavaScript/TypeScript client SDK, it allows you to
|
||||
|
||||
- Use LLMs to [respond in chats](https://lmstudio.ai/docs/typescript/llm-prediction/chat-completion) or predict [text completions](https://lmstudio.ai/docs/typescript/llm-prediction/completion)
|
||||
- Define functions as tools, and turn LLMs into [autonomous agents](https://lmstudio.ai/docs/typescript/agent/act) that run completely locally
|
||||
- [Load](https://lmstudio.ai/docs/typescript/manage-models/loading), [configure](https://lmstudio.ai/docs/typescript/llm-prediction/parameters), and [unload](https://lmstudio.ai/docs/typescript/manage-models/loading) models from memory
|
||||
- Supports both browser and any Node-compatible environments
|
||||
- Generate embeddings for text, and more!
|
||||
|
||||
> Using python? See [lmstudio-python](https://github.com/lmstudio-ai/lmstudio-python)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @lmstudio/sdk --save
|
||||
```
|
||||
|
||||
## Quick Example
|
||||
|
||||
```ts
|
||||
import { LMStudioClient } from "@lmstudio/sdk";
|
||||
const client = new LMStudioClient();
|
||||
|
||||
const model = await client.llm.model("llama-3.2-1b-instruct");
|
||||
const result = await model.respond("What is the meaning of life?");
|
||||
|
||||
console.info(result.content);
|
||||
```
|
||||
|
||||
For more examples and documentation, visit [lmstudio-js docs](https://lmstudio.ai/docs/typescript).
|
||||
|
||||
## Why use `lmstudio-js` over `openai` sdk?
|
||||
|
||||
Open AI's SDK is designed to use with Open AI's proprietary models. As such, it is missing many features that are essential for using LLMs in a local environment, such as:
|
||||
|
||||
- Managing loading and unloading models from memory
|
||||
- Configuring load parameters (context length, gpu offload settings, etc.)
|
||||
- Speculative decoding
|
||||
- Getting information (such as context length, model size, etc.) about a model
|
||||
- ... and more
|
||||
|
||||
In addition, while `openai` sdk is automatically generated, `lmstudio-js` is designed from ground-up to be clean and easy to use for TypeScript/JavaScript developers.
|
||||
|
||||
## Contributing
|
||||
|
||||
You can build the project locally by following these steps:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/lmstudio-ai/lmstudio-js.git --recursive
|
||||
cd lmstudio-js
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Community
|
||||
|
||||
<p>Discuss all things lmstudio-js in <a href="https://discord.gg/aPQfnNkxGC">#dev-chat</a> in LM Studio's Community Discord server.</p>
|
||||
<a href="https://discord.gg/aPQfnNkxGC"><img alt="Discord" src="https://img.shields.io/discord/1110598183144399058?logo=discord&style=flat&logoColor=white"></a>
|
||||
52
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@lmstudio/sdk/package.json
vendored
Normal file
52
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@lmstudio/sdk/package.json
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "@lmstudio/sdk",
|
||||
"version": "1.5.0",
|
||||
"description": "LM Studio SDK",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build-tsc": "tsc",
|
||||
"build-rollup": "rollup -c",
|
||||
"build-ae": "api-extractor run --local",
|
||||
"build": "npm run build-tsc && npm run build-rollup && npm run build-ae",
|
||||
"watch-tsc": "tsc -w",
|
||||
"watch-rollup": "rollup -wc",
|
||||
"watch-ae": "nodemon --exec \"npm run build-ae\" --watch dist/index.cjs",
|
||||
"watch": "concurrently \"npm run watch-tsc\" \"npm run watch-rollup\" \"npm run watch-ae\"",
|
||||
"clean": "shx rm -rf ./dist ./ts-out ./tsconfig.tsbuildinfo"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.cjs",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.mjs",
|
||||
"README.md"
|
||||
],
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@lmstudio/lms-isomorphic": "^0.4.6",
|
||||
"chalk": "^4.1.2",
|
||||
"jsonschema": "^1.5.0",
|
||||
"zod": "^3.22.4",
|
||||
"zod-to-json-schema": "^3.22.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lmstudio/lms-client": "^1.5.0",
|
||||
"nodemon": "^3.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lmstudio-ai/lmstudio.js.git"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs",
|
||||
"default": "./dist/index.mjs"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "d95ce2feb067b4eec446c673155631ee1734e982"
|
||||
}
|
||||
21
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/LICENSE
vendored
Normal file
21
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Mario Zechner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
424
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/README.md
vendored
Normal file
424
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/README.md
vendored
Normal file
|
|
@ -0,0 +1,424 @@
|
|||
# mini-lit
|
||||
|
||||
Lightweight Lit components with shadcn-inspired theming, Tailwind CSS v4 styling, and Lucide icons.
|
||||
|
||||
**[View Live Demo & Interactive Documentation →](https://minilit.mariozechner.at)**
|
||||
Explore all components with live examples, copy-paste code snippets, and interactive playgrounds.
|
||||
|
||||
## Features
|
||||
|
||||
- **Two Types of Components**: Functional components for stateless UI elements (Button, Card, Badge) and Custom elements for components with internal state (theme-toggle, language-selector)
|
||||
- **shadcn/ui Themes**: Compatible with shadcn/ui design system. Built-in default and Claude themes. Dark mode support via `dark` class
|
||||
- **TypeScript First**: Full TypeScript support with type definitions. IDE autocomplete for all components and i18n
|
||||
- **Tailwind CSS v4**: Modern styling with the latest Tailwind features
|
||||
- **Lucide Icons**: Complete icon set with tree-shaking support
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Installation
|
||||
|
||||
```bash
|
||||
npm install lit @mariozechner/mini-lit
|
||||
```
|
||||
|
||||
### 2. Setup Tailwind CSS v4
|
||||
|
||||
#### Option A: Vite Plugin (Recommended)
|
||||
|
||||
```bash
|
||||
npm install -D @tailwindcss/vite
|
||||
```
|
||||
|
||||
```typescript
|
||||
// vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss()],
|
||||
});
|
||||
```
|
||||
|
||||
#### Option B: Tailwind CLI
|
||||
|
||||
```bash
|
||||
npm install -D @tailwindcss/cli
|
||||
```
|
||||
|
||||
```json
|
||||
// package.json scripts
|
||||
"scripts": {
|
||||
"dev": "tailwindcss -i ./src/app.css -o ./dist/app.css --watch",
|
||||
"build": "tailwindcss -i ./src/app.css -o ./dist/app.css --minify"
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Configure CSS
|
||||
|
||||
```css
|
||||
/* src/app.css */
|
||||
|
||||
/* Import theme (includes dark mode and utilities) */
|
||||
@import "@mariozechner/mini-lit/styles/themes/default.css";
|
||||
|
||||
/* Tell Tailwind to scan mini-lit components */
|
||||
@source "../node_modules/@mariozechner/mini-lit/dist";
|
||||
|
||||
/* Import Tailwind */
|
||||
@import "tailwindcss";
|
||||
```
|
||||
|
||||
### 4. Configure TypeScript (Important for LitElement)
|
||||
|
||||
If you're using LitElement components with decorators (custom elements or your own components extending LitElement), you **must** configure TypeScript properly:
|
||||
|
||||
```json
|
||||
// tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false // Critical for LitElement reactivity!
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** `useDefineForClassFields: false` is essential for LitElement's `@property()` and `@state()` decorators to work correctly. Without this setting, reactive properties won't trigger updates properly.
|
||||
|
||||
### 5. Use Components
|
||||
|
||||
```typescript
|
||||
import { html, render } from "lit";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { Card } from "@mariozechner/mini-lit/dist/Card.js";
|
||||
import { icon } from "@mariozechner/mini-lit/dist/icons.js";
|
||||
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
|
||||
import { Send } from "lucide";
|
||||
import "./app.css";
|
||||
|
||||
const App = () => html`
|
||||
<div class="p-8 bg-background text-foreground min-h-screen">
|
||||
<!-- mini-lit components with internal state are full LitElement instances with custom tags -->
|
||||
<theme-toggle class="fixed top-4 right-4"></theme-toggle>
|
||||
|
||||
<!-- mini-lit components without internal state are functional components returning TemplateResult -->
|
||||
${Card(html`
|
||||
<h1 class="text-2xl font-bold mb-4">Hello mini-lit!</h1>
|
||||
|
||||
${Button({
|
||||
children: html`
|
||||
${icon(Send, "sm")}
|
||||
<span>Send Message</span>
|
||||
`,
|
||||
})}
|
||||
`)}
|
||||
</div>
|
||||
`;
|
||||
|
||||
render(App(), document.body);
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
### Actions
|
||||
|
||||
- **Buttons** - All button variants and states
|
||||
- **Copy Button** - Copy text to clipboard
|
||||
- **Download Button** - Download files
|
||||
|
||||
### Layout
|
||||
|
||||
- **Cards** - Content containers with header, content, and footer sections
|
||||
- **Separators** - Visual dividers
|
||||
- **Split Panel** - Resizable layouts
|
||||
- **Dialogs** - Modal dialogs
|
||||
|
||||
### Forms
|
||||
|
||||
- **Inputs** - Text, email, password inputs
|
||||
- **Textareas** - Multi-line text input
|
||||
- **Selects** - Dropdown selections
|
||||
- **Checkboxes** - Boolean selections
|
||||
- **Switches** - Toggle controls
|
||||
- **Labels** - Form labels
|
||||
|
||||
### Feedback
|
||||
|
||||
- **Badges** - Status indicators
|
||||
- **Alerts** - Important messages with variants
|
||||
- **Progress** - Progress indicators
|
||||
|
||||
### Content
|
||||
|
||||
- **Code Block** - Syntax highlighted code with copy functionality
|
||||
- **Markdown** - Rendered markdown with KaTeX math support
|
||||
- **Diff Viewer** - Code difference viewer
|
||||
|
||||
### Utilities
|
||||
|
||||
- **Theme Toggle** - Dark/light mode switcher
|
||||
- **Language Selector** - i18n language switcher
|
||||
- **icon()** - Render Lucide icons with size variants
|
||||
- **i18n()** - Internationalization support
|
||||
|
||||
## Component Types
|
||||
|
||||
### Functional Components
|
||||
|
||||
Stateless components that return `TemplateResult`:
|
||||
|
||||
```typescript
|
||||
import { Button, Card, Badge } from "@mariozechner/mini-lit";
|
||||
|
||||
// Use directly in templates
|
||||
${Button({ variant: "primary", children: "Click me" })}
|
||||
${Badge({ children: "New" })}
|
||||
```
|
||||
|
||||
### Custom Elements
|
||||
|
||||
Stateful components that extend `LitElement`:
|
||||
|
||||
```typescript
|
||||
// Custom elements are automatically registered when using the main import
|
||||
import "@mariozechner/mini-lit";
|
||||
|
||||
// Use as HTML tags
|
||||
<theme-toggle></theme-toggle>
|
||||
<code-block .code=${"console.log('Hello')"} language="javascript"></code-block>
|
||||
```
|
||||
|
||||
## Tree-Shaking & Bundle Optimization
|
||||
|
||||
**IMPORTANT**: The root index (`@mariozechner/mini-lit`) now only exports core utilities (component system, i18n, and icons). Individual components are **not** exported from the root to encourage optimal tree-shaking.
|
||||
|
||||
### Recommended Import Strategy
|
||||
|
||||
```typescript
|
||||
// ✅ Optimal - only includes what you use (~50-100KB)
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { Card } from "@mariozechner/mini-lit/dist/Card.js";
|
||||
import { icon } from "@mariozechner/mini-lit/dist/icons.js";
|
||||
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
|
||||
|
||||
// ⚠️ Root index only exports core utilities (NOT components)
|
||||
import { i18n, setTranslations, createComponent } from "@mariozechner/mini-lit";
|
||||
```
|
||||
|
||||
**What's exported from the root index**:
|
||||
- Component system: `ComponentLitBase`, `createComponent`, `defineComponent`, `styleComponent`, and related types
|
||||
- i18n system: `i18n`, `setTranslations`, `setLanguage`, `getCurrentLanguage`, `defaultEnglish`, `defaultGerman`
|
||||
- Icons: `icon` function and related utilities
|
||||
|
||||
**Available component paths**:
|
||||
- Functional components: `/dist/Button.js`, `/dist/Card.js`, `/dist/Input.js`, `/dist/Select.js`, `/dist/Checkbox.js`, etc.
|
||||
- Custom elements: `/dist/ThemeToggle.js`, `/dist/CodeBlock.js`, `/dist/MarkdownBlock.js`, `/dist/LanguageSelector.js`, etc.
|
||||
- Core utilities: `/dist/mini.js` (fc, createState, refs)
|
||||
|
||||
**Bundle Size**:
|
||||
- Direct imports: ~50-100KB (only what you use)
|
||||
- Importing all components: ~400KB+ (if you manually import everything)
|
||||
|
||||
## Themes
|
||||
|
||||
mini-lit uses shadcn/ui compatible themes with CSS custom properties for colors, borders, and shadows.
|
||||
|
||||
### Built-in Themes
|
||||
|
||||
- `default` - Clean, modern theme
|
||||
- `claude` - Claude-inspired theme
|
||||
|
||||
Switch themes by importing a different CSS file:
|
||||
|
||||
```css
|
||||
@import "@mariozechner/mini-lit/styles/themes/claude.css";
|
||||
```
|
||||
|
||||
### Dark Mode
|
||||
|
||||
Toggle dark mode via the `dark` class:
|
||||
|
||||
```javascript
|
||||
document.documentElement.classList.toggle("dark");
|
||||
```
|
||||
|
||||
Or use the built-in `<theme-toggle>` component.
|
||||
|
||||
### Custom Themes
|
||||
|
||||
For custom themes and theme generators:
|
||||
|
||||
- [shadcn/ui themes](https://ui.shadcn.com/themes)
|
||||
- [Tweakcn theme generator](https://tweakcn.com/)
|
||||
|
||||
## Internationalization
|
||||
|
||||
### 1. Define TypeScript Interface (for autocomplete)
|
||||
|
||||
```typescript
|
||||
declare module "@mariozechner/mini-lit" {
|
||||
interface i18nMessages extends MiniLitRequiredMessages {
|
||||
Welcome: string;
|
||||
Settings: string;
|
||||
cartItems: (count: number) => string;
|
||||
greeting: (name: string, time: string) => string;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Set Translations
|
||||
|
||||
```typescript
|
||||
import { setTranslations, defaultEnglish, defaultGerman } from "@mariozechner/mini-lit";
|
||||
|
||||
const translations = {
|
||||
en: {
|
||||
...defaultEnglish, // Includes required messages like "Copy", "Copied!"
|
||||
Welcome: "Welcome",
|
||||
Settings: "Settings",
|
||||
cartItems: (count: number) =>
|
||||
count === 0 ? "Your cart is empty" : count === 1 ? "1 item in your cart" : `${count} items in your cart`,
|
||||
greeting: (name: string, time: string) => `Good ${time}, ${name}!`,
|
||||
},
|
||||
de: {
|
||||
...defaultGerman, // Includes required messages like "Kopieren", "Kopiert!"
|
||||
Welcome: "Willkommen",
|
||||
Settings: "Einstellungen",
|
||||
cartItems: (count: number) =>
|
||||
count === 0
|
||||
? "Ihr Warenkorb ist leer"
|
||||
: count === 1
|
||||
? "1 Artikel im Warenkorb"
|
||||
: `${count} Artikel im Warenkorb`,
|
||||
greeting: (name: string, time: string) => `Guten ${time}, ${name}!`,
|
||||
},
|
||||
};
|
||||
|
||||
setTranslations(translations);
|
||||
```
|
||||
|
||||
### 3. Use in Your App
|
||||
|
||||
```typescript
|
||||
import { i18n, getCurrentLanguage, setLanguage } from "@mariozechner/mini-lit";
|
||||
|
||||
// Simple strings
|
||||
${i18n("Welcome")}
|
||||
${i18n("Settings")}
|
||||
|
||||
// Functions with parameters
|
||||
${i18n("cartItems")(3)} // "3 items in your cart"
|
||||
${i18n("greeting")("Alice", "morning")} // "Good morning, Alice!"
|
||||
|
||||
// Language management
|
||||
getCurrentLanguage() // "en" or "de"
|
||||
setLanguage("de") // switches to German, reloads page
|
||||
|
||||
// Add language selector to UI
|
||||
<language-selector></language-selector>
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
The mini-lit repository includes both the component library and a comprehensive example gallery showcasing all components.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/badlogic/mini-lit.git
|
||||
cd mini-lit
|
||||
|
||||
# Install dependencies
|
||||
npm install
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
|
||||
Run the development server with hot module replacement:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
This command orchestrates:
|
||||
|
||||
1. **TypeScript compilation** of the mini-lit library (watching for changes in `/src`, outputting to `/dist`)
|
||||
2. **Vite dev server** for the example gallery (in `/example`), automatically picking up the latest mini-lit builds
|
||||
|
||||
Open the URL displayed by Vite (typically http://localhost:5173) to view the example gallery. Any changes to either the mini-lit source code or the example application will trigger automatic rebuilds and browser updates through HMR.
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
mini-lit/
|
||||
├── src/ # mini-lit component library source
|
||||
├── dist/ # Compiled library output
|
||||
├── styles/ # Theme CSS files
|
||||
├── example/ # Interactive component gallery
|
||||
│ └── src/
|
||||
│ └── pages/ # Individual component demos
|
||||
└── package.json # Library package configuration
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
|
||||
Run formatting and linting checks for both the library and example:
|
||||
|
||||
```bash
|
||||
npm run check
|
||||
```
|
||||
|
||||
This command:
|
||||
|
||||
- Formats all code with Prettier
|
||||
- Lints with Biome for code quality and style consistency
|
||||
- Type-checks both the library and example with TypeScript
|
||||
- Automatically runs on git commit via Husky pre-commit hooks
|
||||
|
||||
### Building for Production
|
||||
|
||||
```bash
|
||||
# Build the library
|
||||
npm run build
|
||||
|
||||
# Build the example gallery
|
||||
cd example && npm run build
|
||||
```
|
||||
|
||||
### Publishing & Deployment
|
||||
|
||||
#### Publishing to npm
|
||||
|
||||
```bash
|
||||
# Build and publish the library to npm
|
||||
npm run build
|
||||
npm publish --access public
|
||||
```
|
||||
|
||||
#### Deploying the Documentation Site
|
||||
|
||||
```bash
|
||||
# Quick sync (when only source files changed)
|
||||
./run.sh sync
|
||||
|
||||
# Full deploy (when Docker/infrastructure changed)
|
||||
./run.sh deploy
|
||||
```
|
||||
|
||||
The `sync` command builds and syncs files without restarting services, while `deploy` also restarts the Docker containers on the server.
|
||||
|
||||
## Examples
|
||||
|
||||
See the `/example` directory for a complete working example with all components, or visit the [live demo](https://minilit.mariozechner.at).
|
||||
|
||||
## Resources
|
||||
|
||||
- [npm Package](https://www.npmjs.com/package/@mariozechner/mini-lit)
|
||||
- [GitHub Repository](https://github.com/badlogic/mini-lit)
|
||||
- [Live Demo](https://minilit.mariozechner.at)
|
||||
- [Lit Documentation](https://lit.dev)
|
||||
- [Tailwind CSS v4](https://tailwindcss.com)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
681
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/llms.txt
vendored
Normal file
681
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/llms.txt
vendored
Normal file
|
|
@ -0,0 +1,681 @@
|
|||
# mini-lit Package Reference
|
||||
|
||||
Lightweight Lit components with shadcn-inspired theming and Tailwind CSS v4 integration.
|
||||
Live demo: https://minilit.mariozechner.at
|
||||
|
||||
## Important: How to Use This Documentation with LLMs
|
||||
|
||||
**Before using any component, instruct your LLM to read the source files** to fully understand:
|
||||
- The exact props interface and TypeScript types
|
||||
- How components handle different prop combinations
|
||||
- Available variants, sizes, and options
|
||||
- Internal implementation and rendering logic
|
||||
- Function overloads and shorthand syntaxes
|
||||
|
||||
### Files to Read for Component Implementation:
|
||||
|
||||
**Functional Components** (stateless, return TemplateResult):
|
||||
- `src/Alert.ts` - Alert with title and description
|
||||
- `src/Badge.ts` - Status indicators with variants
|
||||
- `src/Button.ts` - Buttons with loading, variants, sizes
|
||||
- `src/Card.ts` - Cards with header, content, footer sections
|
||||
- `src/Checkbox.ts` - Checkbox with label and indeterminate state
|
||||
- `src/Dialog.ts` - Modal dialogs with header/footer
|
||||
- `src/Input.ts` - Text inputs with validation
|
||||
- `src/Label.ts` - Form labels with required indicator
|
||||
- `src/Progress.ts` - Progress bars
|
||||
- `src/Select.ts` - Dropdowns with groups and icons
|
||||
- `src/Separator.ts` - Visual dividers
|
||||
- `src/Switch.ts` - Toggle switches
|
||||
- `src/Textarea.ts` - Multi-line text input
|
||||
- `src/Diff.ts` - Code difference viewer
|
||||
- `src/FileButton.ts` - File upload button
|
||||
- `src/CopyButton.ts` - Copy to clipboard button
|
||||
- `src/DownloadButton.ts` - Download file button
|
||||
|
||||
**Custom Elements** (stateful LitElement classes):
|
||||
- `src/CodeBlock.ts` - Syntax highlighted code (`<code-block>`)
|
||||
- `src/MarkdownBlock.ts` - Markdown with math (`<markdown-block>`)
|
||||
- `src/ThemeToggle.ts` - Dark/light switcher (`<theme-toggle>`)
|
||||
- `src/LanguageSelector.ts` - i18n language picker (`<language-selector>`)
|
||||
- `src/SplitPanel.ts` - Resizable panels (`<split-panel>`)
|
||||
- `src/ModeToggle.ts` - Mode switcher (`<mode-toggle>`)
|
||||
- `src/PreviewCode.ts` - Preview/code toggle (`<preview-code>`)
|
||||
- `src/Sidebar.ts` - Collapsible sidebar (`<sidebar>`)
|
||||
|
||||
**Core Systems**:
|
||||
- `src/mini.ts` - Core utilities (fc, createState, refs, types)
|
||||
- `src/i18n.ts` - Internationalization system
|
||||
- `src/icons.ts` - Icon rendering utilities
|
||||
- `src/index.ts` - Main exports
|
||||
|
||||
## Quick Setup
|
||||
|
||||
```bash
|
||||
npm install lit @mariozechner/mini-lit
|
||||
```
|
||||
|
||||
Configure Tailwind CSS v4:
|
||||
```css
|
||||
/* src/app.css */
|
||||
@import "@mariozechner/mini-lit/styles/themes/default.css";
|
||||
@source "../node_modules/@mariozechner/mini-lit/dist";
|
||||
@import "tailwindcss";
|
||||
```
|
||||
|
||||
**Available theme files:**
|
||||
- `@mariozechner/mini-lit/styles/themes/default.css` - Clean modern theme
|
||||
- `@mariozechner/mini-lit/styles/themes/claude.css` - Claude-inspired theme
|
||||
|
||||
## Component Architecture
|
||||
|
||||
mini-lit provides two component types:
|
||||
|
||||
1. **Functional Components**: Stateless, return TemplateResult
|
||||
- Alert, Badge, Button, Card, Checkbox, Dialog, Input, Label, Progress, Select, Separator, Switch, Textarea
|
||||
|
||||
2. **Custom Elements**: Stateful LitElement classes with HTML tags
|
||||
- `<code-block>`, `<markdown-block>`, `<theme-toggle>`, `<language-selector>`, `<split-panel>`, `<mode-toggle>`, `<preview-code>`
|
||||
|
||||
## Core Components Usage
|
||||
## Tree-Shaking & Bundle Optimization
|
||||
|
||||
**CRITICAL**: The root index (`@mariozechner/mini-lit`) now **ONLY** exports core utilities (component system, i18n, and icons). Individual components are **NOT** exported from the root to enforce optimal tree-shaking.
|
||||
|
||||
### What's Exported from Root Index
|
||||
```typescript
|
||||
// ✅ Core utilities available from root
|
||||
import {
|
||||
// Component system
|
||||
ComponentLitBase, createComponent, defineComponent, styleComponent,
|
||||
// i18n system
|
||||
i18n, setTranslations, setLanguage, getCurrentLanguage,
|
||||
defaultEnglish, defaultGerman,
|
||||
// Icons
|
||||
icon
|
||||
} from "@mariozechner/mini-lit";
|
||||
```
|
||||
|
||||
### Component Imports (Required)
|
||||
```typescript
|
||||
// ✅ MUST import components from their individual files
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { Card } from "@mariozechner/mini-lit/dist/Card.js";
|
||||
import { Input } from "@mariozechner/mini-lit/dist/Input.js";
|
||||
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
|
||||
|
||||
// ❌ Components are NOT exported from root
|
||||
import { Button, Card } from "@mariozechner/mini-lit"; // Won't work!
|
||||
```
|
||||
|
||||
**Bundle Size**:
|
||||
- Direct component imports: ~50-100KB (only what you use)
|
||||
- Core utilities from root: ~20KB
|
||||
|
||||
**Available Paths**:
|
||||
- Functional components: `/dist/Button.js`, `/dist/Card.js`, `/dist/Input.js`, `/dist/Select.js`, `/dist/Checkbox.js`, `/dist/Switch.js`, `/dist/Textarea.js`, `/dist/Label.js`, `/dist/Badge.js`, `/dist/Alert.js`, `/dist/Progress.js`, `/dist/Separator.js`, `/dist/Dialog.js`, `/dist/CopyButton.js`, `/dist/DownloadButton.js`, `/dist/FileButton.js`, `/dist/Diff.js`
|
||||
- Custom elements: `/dist/ThemeToggle.js`, `/dist/CodeBlock.js`, `/dist/MarkdownBlock.js`, `/dist/LanguageSelector.js`, `/dist/SplitPanel.js`, `/dist/ModeToggle.js`, `/dist/PreviewCode.js`, `/dist/Sidebar.js`
|
||||
- Core utilities: `/dist/mini.js` (fc, createState, refs), `/dist/i18n.js`, `/dist/icons.js`
|
||||
|
||||
|
||||
|
||||
### Button
|
||||
```typescript
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
|
||||
// Object syntax
|
||||
Button({
|
||||
variant: "default", // "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
|
||||
size: "md", // "sm" | "md" | "lg" | "icon"
|
||||
disabled: false,
|
||||
loading: false,
|
||||
onClick: (e) => console.log("clicked"),
|
||||
children: "Click me"
|
||||
})
|
||||
|
||||
// Shorthand syntax
|
||||
Button("Click me", "primary", "sm")
|
||||
```
|
||||
|
||||
### Card
|
||||
```typescript
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@mariozechner/mini-lit/dist/Card.js";
|
||||
|
||||
Card({
|
||||
hoverable: true,
|
||||
children: html`
|
||||
${CardHeader(html`
|
||||
${CardTitle("Card Title")}
|
||||
${CardDescription("Card description")}
|
||||
`)}
|
||||
${CardContent("Main content here")}
|
||||
${CardFooter("Footer content")}
|
||||
`
|
||||
})
|
||||
```
|
||||
|
||||
### Input
|
||||
```typescript
|
||||
import { Input } from "@mariozechner/mini-lit/dist/Input.js";
|
||||
|
||||
Input({
|
||||
type: "text", // "text" | "email" | "password" | "number" | "url" | "tel" | "search" | "date"
|
||||
size: "md", // "sm" | "md" | "lg"
|
||||
value: "",
|
||||
placeholder: "Enter text",
|
||||
label: "Name",
|
||||
error: "",
|
||||
disabled: false,
|
||||
required: true,
|
||||
onInput: (e) => console.log(e.target.value),
|
||||
onChange: (e) => console.log("changed")
|
||||
})
|
||||
```
|
||||
|
||||
### Select
|
||||
```typescript
|
||||
import { Select } from "@mariozechner/mini-lit/dist/Select.js";
|
||||
|
||||
Select({
|
||||
value: "option1",
|
||||
placeholder: "Select an option",
|
||||
options: [
|
||||
{ value: "option1", label: "Option 1" },
|
||||
{ value: "option2", label: "Option 2", disabled: true },
|
||||
{ value: "option3", label: "Option 3", icon: icon(Star) }
|
||||
],
|
||||
// Or grouped options:
|
||||
options: [
|
||||
{
|
||||
label: "Group 1",
|
||||
options: [
|
||||
{ value: "a", label: "Item A" },
|
||||
{ value: "b", label: "Item B" }
|
||||
]
|
||||
}
|
||||
],
|
||||
onChange: (value) => console.log(value),
|
||||
size: "md", // "sm" | "md" | "lg"
|
||||
variant: "default", // "default" | "ghost" | "outline"
|
||||
fitContent: false, // Auto-width to content
|
||||
width: "180px"
|
||||
})
|
||||
```
|
||||
|
||||
### Checkbox & Switch
|
||||
```typescript
|
||||
import { Checkbox } from "@mariozechner/mini-lit/dist/Checkbox.js";
|
||||
import { Switch } from "@mariozechner/mini-lit/dist/Switch.js";
|
||||
|
||||
Checkbox({
|
||||
checked: false,
|
||||
indeterminate: false,
|
||||
label: "Accept terms",
|
||||
disabled: false,
|
||||
onChange: (checked) => console.log(checked)
|
||||
})
|
||||
|
||||
Switch({
|
||||
checked: false,
|
||||
label: "Enable notifications",
|
||||
onChange: (checked) => console.log(checked)
|
||||
})
|
||||
```
|
||||
|
||||
### Dialog
|
||||
```typescript
|
||||
import { Dialog, DialogContent, DialogHeader, DialogFooter } from "@mariozechner/mini-lit/dist/Dialog.js";
|
||||
|
||||
Dialog({
|
||||
isOpen: true,
|
||||
onClose: () => console.log("closed"),
|
||||
width: "600px",
|
||||
height: "auto",
|
||||
children: html`
|
||||
${DialogContent(html`
|
||||
${DialogHeader({
|
||||
title: "Dialog Title",
|
||||
description: "Dialog description"
|
||||
})}
|
||||
<div>Main content</div>
|
||||
${DialogFooter(html`
|
||||
${Button({ children: "Cancel" })}
|
||||
${Button({ variant: "primary", children: "Confirm" })}
|
||||
`)}
|
||||
`)}
|
||||
`
|
||||
})
|
||||
```
|
||||
|
||||
### Alert & Badge
|
||||
```typescript
|
||||
import { Alert, AlertTitle, AlertDescription } from "@mariozechner/mini-lit/dist/Alert.js";
|
||||
import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
|
||||
|
||||
Alert({
|
||||
variant: "default", // "default" | "destructive"
|
||||
children: html`
|
||||
${AlertTitle("Alert Title")}
|
||||
${AlertDescription("Alert message here")}
|
||||
`
|
||||
})
|
||||
|
||||
Badge({
|
||||
variant: "default", // "default" | "secondary" | "destructive" | "outline"
|
||||
children: "New"
|
||||
})
|
||||
```
|
||||
|
||||
### Progress
|
||||
```typescript
|
||||
import { Progress } from "@mariozechner/mini-lit/dist/Progress.js";
|
||||
|
||||
Progress({
|
||||
value: 50,
|
||||
max: 100,
|
||||
className: "w-full"
|
||||
})
|
||||
```
|
||||
|
||||
### Separator
|
||||
```typescript
|
||||
import { Separator } from "@mariozechner/mini-lit/dist/Separator.js";
|
||||
|
||||
Separator({
|
||||
orientation: "horizontal", // "horizontal" | "vertical"
|
||||
decorative: true
|
||||
})
|
||||
```
|
||||
|
||||
## Custom Elements
|
||||
|
||||
### CodeBlock
|
||||
```html
|
||||
<code-block
|
||||
language="typescript"
|
||||
code="${btoa('const greeting = "Hello";')}"
|
||||
showLineNumbers="${true}"
|
||||
showCopyButton="${true}">
|
||||
</code-block>
|
||||
```
|
||||
|
||||
### MarkdownBlock
|
||||
```html
|
||||
<markdown-block
|
||||
content="# Heading\nSupports **markdown** with $LaTeX$ math"
|
||||
isThinking="${false}"
|
||||
escapeHtml="${true}">
|
||||
</markdown-block>
|
||||
```
|
||||
|
||||
### ThemeToggle
|
||||
```html
|
||||
<!-- Automatic dark/light mode switcher -->
|
||||
<theme-toggle></theme-toggle>
|
||||
```
|
||||
|
||||
### LanguageSelector
|
||||
```html
|
||||
<!-- Dropdown for language switching -->
|
||||
<language-selector></language-selector>
|
||||
```
|
||||
|
||||
### SplitPanel
|
||||
```html
|
||||
<split-panel
|
||||
.leftPanel=${html`<div>Left content</div>`}
|
||||
.rightPanel=${html`<div>Right content</div>`}
|
||||
initialSplit="50"
|
||||
minSize="200"
|
||||
hideRight="${false}"
|
||||
vertical="${false}">
|
||||
</split-panel>
|
||||
```
|
||||
|
||||
### ModeToggle
|
||||
```html
|
||||
<mode-toggle
|
||||
.modes=${["Preview", "Code"]}
|
||||
selectedIndex="0"
|
||||
@mode-change=${(e) => console.log(e.detail)}>
|
||||
</mode-toggle>
|
||||
```
|
||||
|
||||
## Icons
|
||||
|
||||
```typescript
|
||||
import { icon } from "@mariozechner/mini-lit/dist/icons.js";
|
||||
import { Send, Settings, User } from "lucide";
|
||||
|
||||
// Render icon with size
|
||||
icon(Send) // Default size
|
||||
icon(Send, "sm") // 16px
|
||||
icon(Send, "md") // 20px
|
||||
icon(Send, "lg") // 24px
|
||||
icon(Send, "xl") // 28px
|
||||
|
||||
// In component
|
||||
Button({
|
||||
children: html`${icon(Send, "sm")} Send Message`
|
||||
})
|
||||
```
|
||||
|
||||
## Internationalization (i18n)
|
||||
|
||||
**Read `src/i18n.ts` for complete implementation details.**
|
||||
|
||||
The i18n system provides:
|
||||
- Type-safe message keys with TypeScript
|
||||
- Support for parameterized messages (functions)
|
||||
- Browser language detection
|
||||
- localStorage persistence
|
||||
- Default English and German translations
|
||||
|
||||
### Setup TypeScript Interface
|
||||
```typescript
|
||||
// Extend with your messages
|
||||
declare module "@mariozechner/mini-lit" {
|
||||
interface i18nMessages extends MiniLitRequiredMessages {
|
||||
Welcome: string;
|
||||
Settings: string;
|
||||
itemCount: (count: number) => string;
|
||||
greeting: (name: string, time: string) => string;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configure Translations
|
||||
```typescript
|
||||
import { setTranslations, defaultEnglish, defaultGerman } from "@mariozechner/mini-lit";
|
||||
|
||||
setTranslations({
|
||||
en: {
|
||||
...defaultEnglish, // Required mini-lit messages
|
||||
Welcome: "Welcome",
|
||||
Settings: "Settings",
|
||||
itemCount: (count) => count === 1 ? "1 item" : `${count} items`,
|
||||
greeting: (name, time) => `Good ${time}, ${name}!`
|
||||
},
|
||||
de: {
|
||||
...defaultGerman,
|
||||
Welcome: "Willkommen",
|
||||
Settings: "Einstellungen",
|
||||
itemCount: (count) => count === 1 ? "1 Artikel" : `${count} Artikel`,
|
||||
greeting: (name, time) => `Guten ${time}, ${name}!`
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Use in Components
|
||||
```typescript
|
||||
import { i18n, getCurrentLanguage, setLanguage } from "@mariozechner/mini-lit";
|
||||
|
||||
// Simple strings
|
||||
${i18n("Welcome")}
|
||||
|
||||
// Functions with parameters
|
||||
${i18n("itemCount")(5)} // "5 items"
|
||||
${i18n("greeting")("Alice", "morning")} // "Good morning, Alice!"
|
||||
|
||||
// Language management
|
||||
getCurrentLanguage() // Returns current language code
|
||||
setLanguage("de") // Switch language and reload page
|
||||
```
|
||||
|
||||
## Utility Components
|
||||
|
||||
### FileButton
|
||||
```typescript
|
||||
import { FileButton } from "@mariozechner/mini-lit/dist/FileButton.js";
|
||||
|
||||
FileButton({
|
||||
accept: ".pdf,.doc",
|
||||
multiple: true,
|
||||
maxFileSize: 5 * 1024 * 1024, // 5MB
|
||||
onFilesSelected: (files) => console.log(files),
|
||||
children: "Upload Files"
|
||||
})
|
||||
```
|
||||
|
||||
### CopyButton
|
||||
```typescript
|
||||
import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js";
|
||||
|
||||
CopyButton({
|
||||
text: "Text to copy",
|
||||
onCopy: () => console.log("Copied!"),
|
||||
children: "Copy"
|
||||
})
|
||||
```
|
||||
|
||||
### DownloadButton
|
||||
```typescript
|
||||
import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
|
||||
|
||||
DownloadButton({
|
||||
data: "File content here",
|
||||
filename: "output.txt",
|
||||
mimeType: "text/plain",
|
||||
children: "Download"
|
||||
})
|
||||
```
|
||||
|
||||
### Diff Viewer
|
||||
```typescript
|
||||
import { Diff } from "@mariozechner/mini-lit/dist/Diff.js";
|
||||
|
||||
Diff({
|
||||
oldText: "Original text",
|
||||
newText: "Modified text",
|
||||
title: "Changes"
|
||||
})
|
||||
```
|
||||
|
||||
## mini.ts Core Utilities
|
||||
|
||||
### Functional Component Helper
|
||||
```typescript
|
||||
import { fc, html, type TemplateResult } from "@mariozechner/mini-lit/dist/mini.js";
|
||||
|
||||
const MyComponent = fc<{ text: string }>(({ text }) => {
|
||||
return html`<div>${text}</div>`;
|
||||
});
|
||||
```
|
||||
|
||||
### Reactive State
|
||||
```typescript
|
||||
import { createState } from "@mariozechner/mini-lit/dist/mini.js";
|
||||
|
||||
const state = createState({
|
||||
count: 0,
|
||||
name: ""
|
||||
});
|
||||
|
||||
// Subscribe to changes
|
||||
const unsubscribe = state.__subscribe(() => {
|
||||
console.log("State changed");
|
||||
});
|
||||
|
||||
// Update state (triggers subscribers)
|
||||
state.count++;
|
||||
```
|
||||
|
||||
### Refs
|
||||
```typescript
|
||||
import { createRef, ref } from "@mariozechner/mini-lit/dist/mini.js";
|
||||
|
||||
const inputRef = createRef<HTMLInputElement>();
|
||||
|
||||
html`
|
||||
<input ${ref(inputRef)} />
|
||||
<button @click=${() => console.log(inputRef.value?.value)}>
|
||||
Log Value
|
||||
</button>
|
||||
`
|
||||
```
|
||||
|
||||
## Theming
|
||||
|
||||
### Available Themes
|
||||
- `default.css` - Clean modern theme
|
||||
- `claude.css` - Claude-inspired theme
|
||||
|
||||
### Dark Mode
|
||||
```javascript
|
||||
// Toggle programmatically
|
||||
document.documentElement.classList.toggle("dark");
|
||||
|
||||
// Or use built-in component
|
||||
<theme-toggle></theme-toggle>
|
||||
```
|
||||
|
||||
### Custom Themes
|
||||
Create custom themes using CSS variables:
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 222.2 84% 4.9%;
|
||||
--primary: 221.2 83.2% 53.3%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
/* ... other variables */
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: 222.2 84% 4.9%;
|
||||
--foreground: 210 40% 98%;
|
||||
/* ... dark mode overrides */
|
||||
}
|
||||
```
|
||||
|
||||
## Component Props Interface
|
||||
|
||||
### BaseComponentProps
|
||||
All components accept:
|
||||
- `className?: string` - Additional CSS classes
|
||||
- `children?: TemplateResult | string | number`
|
||||
|
||||
### ComponentPropsWithoutChildren
|
||||
For components without children:
|
||||
- `className?: string`
|
||||
|
||||
## Complete Example
|
||||
|
||||
```typescript
|
||||
import { html, render } from "lit";
|
||||
import { Button } from "@mariozechner/mini-lit/dist/Button.js";
|
||||
import { Card, CardContent } from "@mariozechner/mini-lit/dist/Card.js";
|
||||
import { Input } from "@mariozechner/mini-lit/dist/Input.js";
|
||||
import { Select } from "@mariozechner/mini-lit/dist/Select.js";
|
||||
import { Switch } from "@mariozechner/mini-lit/dist/Switch.js";
|
||||
import { icon, i18n, setTranslations, defaultEnglish } from "@mariozechner/mini-lit";
|
||||
import "@mariozechner/mini-lit/dist/ThemeToggle.js";
|
||||
import { Send } from "lucide";
|
||||
import "./app.css";
|
||||
|
||||
// Setup i18n
|
||||
setTranslations({
|
||||
en: {
|
||||
...defaultEnglish,
|
||||
Welcome: "Welcome to mini-lit"
|
||||
}
|
||||
});
|
||||
|
||||
// State management
|
||||
const state = {
|
||||
name: "",
|
||||
theme: "light",
|
||||
notifications: true
|
||||
};
|
||||
|
||||
const App = () => html`
|
||||
<div class="p-8 bg-background min-h-screen">
|
||||
<theme-toggle class="fixed top-4 right-4"></theme-toggle>
|
||||
|
||||
${Card({
|
||||
children: html`
|
||||
${CardContent(html`
|
||||
<h1 class="text-2xl font-bold mb-4">${i18n("Welcome")}</h1>
|
||||
|
||||
${Input({
|
||||
label: "Name",
|
||||
value: state.name,
|
||||
onInput: (e) => state.name = e.target.value
|
||||
})}
|
||||
|
||||
${Select({
|
||||
value: state.theme,
|
||||
options: [
|
||||
{ value: "light", label: "Light Theme" },
|
||||
{ value: "dark", label: "Dark Theme" }
|
||||
],
|
||||
onChange: (value) => state.theme = value
|
||||
})}
|
||||
|
||||
${Switch({
|
||||
checked: state.notifications,
|
||||
label: "Enable notifications",
|
||||
onChange: (checked) => state.notifications = checked
|
||||
})}
|
||||
|
||||
${Button({
|
||||
variant: "primary",
|
||||
children: html`${icon(Send, "sm")} Submit`,
|
||||
onClick: () => console.log(state)
|
||||
})}
|
||||
`)}
|
||||
`
|
||||
})}
|
||||
</div>
|
||||
`;
|
||||
|
||||
render(App(), document.body);
|
||||
```
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
All components are fully typed. Import types:
|
||||
```typescript
|
||||
import type {
|
||||
ButtonProps, ButtonVariant, ButtonSize,
|
||||
InputProps, InputType, InputSize,
|
||||
SelectOption, SelectGroup,
|
||||
AlertProps, AlertVariant,
|
||||
BaseComponentProps,
|
||||
TemplateResult
|
||||
} from "@mariozechner/mini-lit";
|
||||
```
|
||||
|
||||
## Package Exports
|
||||
|
||||
- Main: `@mariozechner/mini-lit`
|
||||
- Styles: `@mariozechner/mini-lit/styles/*`
|
||||
- Components: Imported from main export
|
||||
|
||||
## Performance Tips
|
||||
|
||||
1. Use functional components for stateless UI
|
||||
2. Use custom elements only when internal state is needed
|
||||
3. Batch DOM updates with Lit's rendering system
|
||||
4. Leverage reactive state for efficient updates
|
||||
5. Use refs sparingly for direct DOM access
|
||||
|
||||
## Browser Support
|
||||
|
||||
Requires modern browsers with:
|
||||
- ES2020+ support
|
||||
- Web Components support
|
||||
- CSS custom properties
|
||||
- CSS grid and flexbox
|
||||
|
||||
## Dependencies
|
||||
|
||||
- lit: ^3.3.1 (peer dependency)
|
||||
- highlight.js: Code syntax highlighting
|
||||
- marked: Markdown parsing
|
||||
- katex: LaTeX math rendering
|
||||
- lucide: Icon library
|
||||
- diff: Text diffing
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
65
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/package.json
vendored
Normal file
65
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/package.json
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"name": "@mariozechner/mini-lit",
|
||||
"version": "0.2.1",
|
||||
"description": "Lightweight Lit components with shadcn-inspired theming and Tailwind CSS integration",
|
||||
"author": "Mario Zechner",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src/styles",
|
||||
"README.md",
|
||||
"llms.txt"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./dist/*": "./dist/*",
|
||||
"./styles/*": "./src/styles/*"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build:example": "cd example && npm run build",
|
||||
"dev": "npm install && cd example && npm install && cd .. && concurrently -k -n \"mini-lit,example\" -c \"blue,magenta\" \"npm run dev:tsc\" \"npm run dev:example\"",
|
||||
"dev:tsc": "npm install && tsc --watch --preserveWatchOutput",
|
||||
"dev:example": "cd example && npm run dev",
|
||||
"check": "biome check . --write && tsc --noEmit && cd example && npm run check",
|
||||
"prepare": "husky",
|
||||
"test": "vitest",
|
||||
"test:ui": "vitest --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@preact/signals-core": "^1.12.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"diff": "^8.0.2",
|
||||
"highlight.js": "^11.11.1",
|
||||
"html-parse-string": "^0.0.9",
|
||||
"katex": "^0.16.22",
|
||||
"lucide": "^0.544.0",
|
||||
"marked": "^16.3.0",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwind-variants": "^3.1.1",
|
||||
"uhtml": "^5.0.9"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"lit": "^3.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anthropic-ai/claude-code": "^1.0.128",
|
||||
"@biomejs/biome": "^2.2.4",
|
||||
"@types/node": "^24.5.2",
|
||||
"@vitest/ui": "^3.2.4",
|
||||
"concurrently": "^9.2.1",
|
||||
"happy-dom": "^20.0.8",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.6.2",
|
||||
"string-dedent": "^3.0.2",
|
||||
"tsx": "^4.20.5",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
}
|
||||
63
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/src/styles/base.css
vendored
Normal file
63
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@mariozechner/mini-lit/src/styles/base.css
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* Base styles for mini-lit */
|
||||
|
||||
/* Enable manual dark mode with class for Tailwind v4 */
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
/* Utility styles that are commonly needed */
|
||||
@import "./utils/syntax-highlighting.css";
|
||||
@import "./utils/math.css";
|
||||
@import "./utils/markdown.css";
|
||||
|
||||
/* biome-ignore lint/suspicious/noUnknownAtRules: Tailwind */
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-destructive-foreground: var(--destructive-foreground);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
|
||||
--font-family-sans: var(--font-sans);
|
||||
--font-family-mono: var(--font-mono);
|
||||
--font-family-serif: var(--font-serif);
|
||||
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
|
||||
--shadow-2xs: var(--shadow-2xs);
|
||||
--shadow-xs: var(--shadow-xs);
|
||||
--shadow-sm: var(--shadow-sm);
|
||||
--shadow: var(--shadow);
|
||||
--shadow-md: var(--shadow-md);
|
||||
--shadow-lg: var(--shadow-lg);
|
||||
--shadow-xl: var(--shadow-xl);
|
||||
--shadow-2xl: var(--shadow-2xl);
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
/* Import base styles including dark mode variant and utilities */
|
||||
@import "../base.css";
|
||||
|
||||
:root {
|
||||
--background: oklch(0.9818 0.0054 95.0986);
|
||||
--foreground: oklch(0.3438 0.0269 95.7226);
|
||||
--card: oklch(0.9818 0.0054 95.0986);
|
||||
--card-foreground: oklch(0.1908 0.002 106.5859);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.2671 0.0196 98.939);
|
||||
--primary: oklch(0.6171 0.1375 39.0427);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.9245 0.0138 92.9892);
|
||||
--secondary-foreground: oklch(0.4334 0.0177 98.6048);
|
||||
--muted: oklch(0.9341 0.0153 90.239);
|
||||
--muted-foreground: oklch(0.6059 0.0075 97.4233);
|
||||
--accent: oklch(0.9245 0.0138 92.9892);
|
||||
--accent-foreground: oklch(0.2671 0.0196 98.939);
|
||||
--destructive: oklch(0.1908 0.002 106.5859);
|
||||
--destructive-foreground: oklch(1 0 0);
|
||||
--border: oklch(0.8847 0.0069 97.3627);
|
||||
--input: oklch(0.7621 0.0156 98.3528);
|
||||
--ring: oklch(0.6171 0.1375 39.0427);
|
||||
--chart-1: oklch(0.5583 0.1276 42.9956);
|
||||
--chart-2: oklch(0.6898 0.1581 290.4107);
|
||||
--chart-3: oklch(0.8816 0.0276 93.128);
|
||||
--chart-4: oklch(0.8822 0.0403 298.1792);
|
||||
--chart-5: oklch(0.5608 0.1348 42.0584);
|
||||
--sidebar: oklch(0.9663 0.008 98.8792);
|
||||
--sidebar-foreground: oklch(0.359 0.0051 106.6524);
|
||||
--sidebar-primary: oklch(0.6171 0.1375 39.0427);
|
||||
--sidebar-primary-foreground: oklch(0.9881 0 0);
|
||||
--sidebar-accent: oklch(0.9245 0.0138 92.9892);
|
||||
--sidebar-accent-foreground: oklch(0.325 0 0);
|
||||
--sidebar-border: oklch(0.9401 0 0);
|
||||
--sidebar-ring: oklch(0.7731 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
||||
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--radius: 0.5rem;
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
--tracking-normal: 0em;
|
||||
--spacing: 0.25rem;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.2679 0.0036 106.6427);
|
||||
--foreground: oklch(0.8074 0.0142 93.0137);
|
||||
--card: oklch(0.2679 0.0036 106.6427);
|
||||
--card-foreground: oklch(0.9818 0.0054 95.0986);
|
||||
--popover: oklch(0.3085 0.0035 106.6039);
|
||||
--popover-foreground: oklch(0.9211 0.004 106.4781);
|
||||
--primary: oklch(0.6724 0.1308 38.7559);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.9818 0.0054 95.0986);
|
||||
--secondary-foreground: oklch(0.3085 0.0035 106.6039);
|
||||
--muted: oklch(0.2213 0.0038 106.707);
|
||||
--muted-foreground: oklch(0.7713 0.0169 99.0657);
|
||||
--accent: oklch(0.213 0.0078 95.4245);
|
||||
--accent-foreground: oklch(0.9663 0.008 98.8792);
|
||||
--destructive: oklch(0.6368 0.2078 25.3313);
|
||||
--destructive-foreground: oklch(1 0 0);
|
||||
--border: oklch(0.3618 0.0101 106.8928);
|
||||
--input: oklch(0.4336 0.0113 100.2195);
|
||||
--ring: oklch(0.6724 0.1308 38.7559);
|
||||
--chart-1: oklch(0.5583 0.1276 42.9956);
|
||||
--chart-2: oklch(0.6898 0.1581 290.4107);
|
||||
--chart-3: oklch(0.213 0.0078 95.4245);
|
||||
--chart-4: oklch(0.3074 0.0516 289.323);
|
||||
--chart-5: oklch(0.5608 0.1348 42.0584);
|
||||
--sidebar: oklch(0.2357 0.0024 67.7077);
|
||||
--sidebar-foreground: oklch(0.8074 0.0142 93.0137);
|
||||
--sidebar-primary: oklch(0.325 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.9881 0 0);
|
||||
--sidebar-accent: oklch(0.168 0.002 106.6177);
|
||||
--sidebar-accent-foreground: oklch(0.8074 0.0142 93.0137);
|
||||
--sidebar-border: oklch(0.9401 0 0);
|
||||
--sidebar-ring: oklch(0.7731 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
||||
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--radius: 0.5rem;
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-destructive-foreground: var(--destructive-foreground);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
|
||||
--font-family-sans: var(--font-sans);
|
||||
--font-family-mono: var(--font-mono);
|
||||
--font-family-serif: var(--font-serif);
|
||||
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
|
||||
--shadow-2xs: var(--shadow-2xs);
|
||||
--shadow-xs: var(--shadow-xs);
|
||||
--shadow-sm: var(--shadow-sm);
|
||||
--shadow: var(--shadow);
|
||||
--shadow-md: var(--shadow-md);
|
||||
--shadow-lg: var(--shadow-lg);
|
||||
--shadow-xl: var(--shadow-xl);
|
||||
--shadow-2xl: var(--shadow-2xl);
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/* Import base styles including dark mode variant and utilities */
|
||||
@import "../base.css";
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.4 0.18 240);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--destructive-foreground: oklch(1 0 0);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.81 0.1 252);
|
||||
--chart-2: oklch(53.553% 0.02798 259.829);
|
||||
--chart-3: oklch(0.55 0.22 263);
|
||||
--chart-4: oklch(0.49 0.22 264);
|
||||
--chart-5: oklch(0.42 0.18 266);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
||||
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--radius: 0.625rem;
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
--tracking-normal: 0em;
|
||||
--spacing: 0.25rem;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.269 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.371 0 0);
|
||||
--accent-foreground: oklch(0.75 0.18 85);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--destructive-foreground: oklch(0.985 0 0);
|
||||
--border: oklch(0.275 0 0);
|
||||
--input: oklch(0.325 0 0);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.81 0.1 252);
|
||||
--chart-2: oklch(0.62 0.19 260);
|
||||
--chart-3: oklch(0.55 0.22 263);
|
||||
--chart-4: oklch(0.49 0.22 264);
|
||||
--chart-5: oklch(0.42 0.18 266);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(0.275 0 0);
|
||||
--sidebar-ring: oklch(0.439 0 0);
|
||||
--font-sans:
|
||||
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
||||
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
--radius: 0.625rem;
|
||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/* Markdown content styles using Tailwind utilities */
|
||||
|
||||
.markdown-content h1 {
|
||||
@apply text-2xl font-semibold mt-5 mb-2;
|
||||
}
|
||||
|
||||
.markdown-content h2 {
|
||||
@apply text-xl font-semibold mt-4 mb-2;
|
||||
}
|
||||
|
||||
.markdown-content h3 {
|
||||
@apply text-lg font-semibold mt-3 mb-2;
|
||||
}
|
||||
|
||||
.markdown-content h4 {
|
||||
@apply text-base font-semibold mt-3 mb-2;
|
||||
}
|
||||
|
||||
.markdown-content h5 {
|
||||
@apply text-sm font-semibold mt-2 mb-1;
|
||||
}
|
||||
|
||||
.markdown-content h6 {
|
||||
@apply text-xs font-semibold mt-2 mb-1;
|
||||
}
|
||||
|
||||
.markdown-content p {
|
||||
@apply leading-relaxed mt-4 first:mt-0 max-w-full;
|
||||
}
|
||||
|
||||
.markdown-content a {
|
||||
@apply text-primary underline hover:text-primary/80;
|
||||
}
|
||||
|
||||
.markdown-content strong {
|
||||
@apply font-semibold;
|
||||
}
|
||||
|
||||
.markdown-content em {
|
||||
@apply italic;
|
||||
}
|
||||
|
||||
.markdown-content ul {
|
||||
@apply list-disc my-4 pl-6 space-y-2;
|
||||
}
|
||||
|
||||
.markdown-content ol {
|
||||
@apply list-decimal my-4 pl-6 space-y-2;
|
||||
}
|
||||
|
||||
.markdown-content li {
|
||||
@apply leading-relaxed;
|
||||
}
|
||||
|
||||
/* Nested lists should have less top margin */
|
||||
.markdown-content li > ul,
|
||||
.markdown-content li > ol {
|
||||
@apply mt-2 mb-0;
|
||||
}
|
||||
|
||||
/* Paragraphs in lists need proper spacing */
|
||||
.markdown-content li > p {
|
||||
@apply mb-2;
|
||||
}
|
||||
|
||||
.markdown-content li > p:last-child {
|
||||
@apply mb-0;
|
||||
}
|
||||
|
||||
.markdown-content blockquote {
|
||||
@apply border-l-4 border-border pl-4 my-4 text-muted-foreground;
|
||||
}
|
||||
|
||||
.markdown-content code:not(.hljs) {
|
||||
@apply bg-muted text-foreground px-1.5 py-0.5 rounded text-sm;
|
||||
}
|
||||
|
||||
.markdown-content table {
|
||||
@apply w-full border-collapse m-0;
|
||||
}
|
||||
|
||||
.markdown-content th {
|
||||
@apply bg-muted text-foreground font-semibold p-2 border-b border-r border-border text-left;
|
||||
}
|
||||
|
||||
.markdown-content th:last-child {
|
||||
@apply border-r-0;
|
||||
}
|
||||
|
||||
.markdown-content td {
|
||||
@apply p-2 text-foreground border-b border-r border-border;
|
||||
}
|
||||
|
||||
.markdown-content td:last-child {
|
||||
@apply border-r-0;
|
||||
}
|
||||
|
||||
.markdown-content tr:last-child td {
|
||||
@apply border-b-0;
|
||||
}
|
||||
|
||||
.markdown-content hr {
|
||||
@apply border-0 border-t border-border my-8;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/* KaTeX CSS for math rendering in markdown */
|
||||
@import "katex/dist/katex.min.css";
|
||||
|
||||
/* KaTeX display margin override */
|
||||
.katex-display {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/* Syntax highlighting colors - GitHub Light theme (default) */
|
||||
:root {
|
||||
--syntax-keyword: oklch(0.577 0.245 27.325); /* #d73a49 */
|
||||
--syntax-entity: oklch(0.511 0.136 307.715); /* #6f42c1 */
|
||||
--syntax-constant: oklch(0.435 0.141 237.016); /* #005cc5 */
|
||||
--syntax-string: oklch(0.296 0.103 244.038); /* #032f62 */
|
||||
--syntax-variable: oklch(0.608 0.178 54.291); /* #e36209 */
|
||||
--syntax-comment: oklch(0.54 0.019 247.858); /* #6a737d */
|
||||
--syntax-tag: oklch(0.403 0.111 145.348); /* #22863a */
|
||||
--syntax-heading: oklch(0.435 0.141 237.016); /* #005cc5 */
|
||||
--syntax-list: oklch(0.537 0.108 88.766); /* #735c0f */
|
||||
--syntax-addition-bg: oklch(0.984 0.029 166.113); /* #f0fff4 */
|
||||
--syntax-addition-fg: oklch(0.403 0.111 145.348); /* #22863a */
|
||||
--syntax-deletion-bg: oklch(0.981 0.025 17.672); /* #ffeef0 */
|
||||
--syntax-deletion-fg: oklch(0.431 0.183 27.522); /* #b31d28 */
|
||||
}
|
||||
|
||||
/* Syntax highlighting colors - GitHub Dark theme */
|
||||
.dark {
|
||||
--syntax-keyword: oklch(0.698 0.159 21.174); /* #ff7b72 */
|
||||
--syntax-entity: oklch(0.792 0.124 307.715); /* #d2a8ff */
|
||||
--syntax-constant: oklch(0.732 0.137 237.016); /* #79c0ff */
|
||||
--syntax-string: oklch(0.786 0.08 237.016); /* #a5d6ff */
|
||||
--syntax-variable: oklch(0.74 0.141 54.291); /* #ffa657 */
|
||||
--syntax-comment: oklch(0.626 0.025 247.858); /* #8b949e */
|
||||
--syntax-tag: oklch(0.812 0.159 145.348); /* #7ee787 */
|
||||
--syntax-heading: oklch(0.523 0.181 237.016); /* #1f6feb */
|
||||
--syntax-list: oklch(0.866 0.141 88.766); /* #f2cc60 */
|
||||
--syntax-addition-bg: oklch(0.188 0.06 166.113); /* #033a16 */
|
||||
--syntax-addition-fg: oklch(0.87 0.147 145.348); /* #aff5b4 */
|
||||
--syntax-deletion-bg: oklch(0.233 0.129 17.672); /* #67060c */
|
||||
--syntax-deletion-fg: oklch(0.92 0.067 17.672); /* #ffdcd7 */
|
||||
}
|
||||
|
||||
/* Keywords */
|
||||
.hljs-doctag,
|
||||
.hljs-keyword,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-type,
|
||||
.hljs-variable.language_ {
|
||||
color: var(--syntax-keyword);
|
||||
}
|
||||
|
||||
/* Entity (functions, classes) */
|
||||
.hljs-title,
|
||||
.hljs-title.class_,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-title.function_ {
|
||||
color: var(--syntax-entity);
|
||||
}
|
||||
|
||||
/* Constants */
|
||||
.hljs-attr,
|
||||
.hljs-attribute,
|
||||
.hljs-literal,
|
||||
.hljs-meta,
|
||||
.hljs-number,
|
||||
.hljs-operator,
|
||||
.hljs-variable,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-class,
|
||||
.hljs-selector-id {
|
||||
color: var(--syntax-constant);
|
||||
}
|
||||
|
||||
/* Strings */
|
||||
.hljs-regexp,
|
||||
.hljs-string,
|
||||
.hljs-meta .hljs-string {
|
||||
color: var(--syntax-string);
|
||||
}
|
||||
|
||||
/* Built-in variables */
|
||||
.hljs-built_in,
|
||||
.hljs-symbol {
|
||||
color: var(--syntax-variable);
|
||||
}
|
||||
|
||||
/* Comments */
|
||||
.hljs-comment,
|
||||
.hljs-code,
|
||||
.hljs-formula {
|
||||
color: var(--syntax-comment);
|
||||
}
|
||||
|
||||
/* Tags */
|
||||
.hljs-name,
|
||||
.hljs-quote,
|
||||
.hljs-selector-tag,
|
||||
.hljs-selector-pseudo {
|
||||
color: var(--syntax-tag);
|
||||
}
|
||||
|
||||
/* Default text */
|
||||
.hljs-subst {
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
/* Section headings */
|
||||
.hljs-section {
|
||||
color: var(--syntax-heading);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Bullets */
|
||||
.hljs-bullet {
|
||||
color: var(--syntax-list);
|
||||
}
|
||||
|
||||
/* Emphasis */
|
||||
.hljs-emphasis {
|
||||
color: var(--color-text-primary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Strong */
|
||||
.hljs-strong {
|
||||
color: var(--color-text-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Additions */
|
||||
.hljs-addition {
|
||||
color: var(--syntax-addition-fg);
|
||||
background-color: var(--syntax-addition-bg);
|
||||
}
|
||||
|
||||
/* Deletions */
|
||||
.hljs-deletion {
|
||||
color: var(--syntax-deletion-fg);
|
||||
background-color: var(--syntax-deletion-bg);
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
import { ValueErrorIterator } from '../errors/index';
|
||||
import { TypeBoxError } from '../type/error/index';
|
||||
import type { TSchema } from '../type/schema/index';
|
||||
import type { Static, StaticDecode, StaticEncode } from '../type/static/index';
|
||||
export type CheckFunction = (value: unknown) => boolean;
|
||||
export declare class TypeCheck<T extends TSchema> {
|
||||
private readonly schema;
|
||||
private readonly references;
|
||||
private readonly checkFunc;
|
||||
private readonly code;
|
||||
private readonly hasTransform;
|
||||
constructor(schema: T, references: TSchema[], checkFunc: CheckFunction, code: string);
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
Code(): string;
|
||||
/** Returns the schema type used to validate */
|
||||
Schema(): T;
|
||||
/** Returns reference types used to validate */
|
||||
References(): TSchema[];
|
||||
/** Returns an iterator for each error in this value. */
|
||||
Errors(value: unknown): ValueErrorIterator;
|
||||
/** Returns true if the value matches the compiled type. */
|
||||
Check(value: unknown): value is Static<T>;
|
||||
/** Decodes a value or throws if error */
|
||||
Decode<Static = StaticDecode<T>, Result extends Static = Static>(value: unknown): Result;
|
||||
/** Encodes a value or throws if error */
|
||||
Encode<Static = StaticEncode<T>, Result extends Static = Static>(value: unknown): Result;
|
||||
}
|
||||
export declare class TypeCompilerUnknownTypeError extends TypeBoxError {
|
||||
readonly schema: TSchema;
|
||||
constructor(schema: TSchema);
|
||||
}
|
||||
export declare class TypeCompilerTypeGuardError extends TypeBoxError {
|
||||
readonly schema: TSchema;
|
||||
constructor(schema: TSchema);
|
||||
}
|
||||
export declare namespace Policy {
|
||||
function IsExactOptionalProperty(value: string, key: string, expression: string): string;
|
||||
function IsObjectLike(value: string): string;
|
||||
function IsRecordLike(value: string): string;
|
||||
function IsNumberLike(value: string): string;
|
||||
function IsVoidLike(value: string): string;
|
||||
}
|
||||
export type TypeCompilerLanguageOption = 'typescript' | 'javascript';
|
||||
export interface TypeCompilerCodegenOptions {
|
||||
language?: TypeCompilerLanguageOption;
|
||||
}
|
||||
/** Compiles Types for Runtime Type Checking */
|
||||
export declare namespace TypeCompiler {
|
||||
/** Generates the code used to assert this type and returns it as a string */
|
||||
function Code<T extends TSchema>(schema: T, references: TSchema[], options?: TypeCompilerCodegenOptions): string;
|
||||
/** Generates the code used to assert this type and returns it as a string */
|
||||
function Code<T extends TSchema>(schema: T, options?: TypeCompilerCodegenOptions): string;
|
||||
/** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */
|
||||
function Compile<T extends TSchema>(schema: T, references?: TSchema[]): TypeCheck<T>;
|
||||
}
|
||||
669
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/compiler/compiler.js
vendored
Normal file
669
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/compiler/compiler.js
vendored
Normal file
|
|
@ -0,0 +1,669 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeCompiler = exports.Policy = exports.TypeCompilerTypeGuardError = exports.TypeCompilerUnknownTypeError = exports.TypeCheck = void 0;
|
||||
const index_1 = require("../value/transform/index");
|
||||
const index_2 = require("../errors/index");
|
||||
const index_3 = require("../system/index");
|
||||
const index_4 = require("../type/error/index");
|
||||
const index_5 = require("../value/deref/index");
|
||||
const index_6 = require("../value/hash/index");
|
||||
const index_7 = require("../type/symbols/index");
|
||||
const index_8 = require("../type/registry/index");
|
||||
const index_9 = require("../type/keyof/index");
|
||||
const extends_undefined_1 = require("../type/extends/extends-undefined");
|
||||
const index_10 = require("../type/never/index");
|
||||
const index_11 = require("../type/ref/index");
|
||||
// ------------------------------------------------------------------
|
||||
// ValueGuard
|
||||
// ------------------------------------------------------------------
|
||||
const index_12 = require("../value/guard/index");
|
||||
// ------------------------------------------------------------------
|
||||
// TypeGuard
|
||||
// ------------------------------------------------------------------
|
||||
const type_1 = require("../type/guard/type");
|
||||
// ------------------------------------------------------------------
|
||||
// TypeCheck
|
||||
// ------------------------------------------------------------------
|
||||
class TypeCheck {
|
||||
constructor(schema, references, checkFunc, code) {
|
||||
this.schema = schema;
|
||||
this.references = references;
|
||||
this.checkFunc = checkFunc;
|
||||
this.code = code;
|
||||
this.hasTransform = (0, index_1.HasTransform)(schema, references);
|
||||
}
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
Code() {
|
||||
return this.code;
|
||||
}
|
||||
/** Returns the schema type used to validate */
|
||||
Schema() {
|
||||
return this.schema;
|
||||
}
|
||||
/** Returns reference types used to validate */
|
||||
References() {
|
||||
return this.references;
|
||||
}
|
||||
/** Returns an iterator for each error in this value. */
|
||||
Errors(value) {
|
||||
return (0, index_2.Errors)(this.schema, this.references, value);
|
||||
}
|
||||
/** Returns true if the value matches the compiled type. */
|
||||
Check(value) {
|
||||
return this.checkFunc(value);
|
||||
}
|
||||
/** Decodes a value or throws if error */
|
||||
Decode(value) {
|
||||
if (!this.checkFunc(value))
|
||||
throw new index_1.TransformDecodeCheckError(this.schema, value, this.Errors(value).First());
|
||||
return (this.hasTransform ? (0, index_1.TransformDecode)(this.schema, this.references, value) : value);
|
||||
}
|
||||
/** Encodes a value or throws if error */
|
||||
Encode(value) {
|
||||
const encoded = this.hasTransform ? (0, index_1.TransformEncode)(this.schema, this.references, value) : value;
|
||||
if (!this.checkFunc(encoded))
|
||||
throw new index_1.TransformEncodeCheckError(this.schema, value, this.Errors(value).First());
|
||||
return encoded;
|
||||
}
|
||||
}
|
||||
exports.TypeCheck = TypeCheck;
|
||||
// ------------------------------------------------------------------
|
||||
// Character
|
||||
// ------------------------------------------------------------------
|
||||
var Character;
|
||||
(function (Character) {
|
||||
function DollarSign(code) {
|
||||
return code === 36;
|
||||
}
|
||||
Character.DollarSign = DollarSign;
|
||||
function IsUnderscore(code) {
|
||||
return code === 95;
|
||||
}
|
||||
Character.IsUnderscore = IsUnderscore;
|
||||
function IsAlpha(code) {
|
||||
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
|
||||
}
|
||||
Character.IsAlpha = IsAlpha;
|
||||
function IsNumeric(code) {
|
||||
return code >= 48 && code <= 57;
|
||||
}
|
||||
Character.IsNumeric = IsNumeric;
|
||||
})(Character || (Character = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// MemberExpression
|
||||
// ------------------------------------------------------------------
|
||||
var MemberExpression;
|
||||
(function (MemberExpression) {
|
||||
function IsFirstCharacterNumeric(value) {
|
||||
if (value.length === 0)
|
||||
return false;
|
||||
return Character.IsNumeric(value.charCodeAt(0));
|
||||
}
|
||||
function IsAccessor(value) {
|
||||
if (IsFirstCharacterNumeric(value))
|
||||
return false;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const code = value.charCodeAt(i);
|
||||
const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code);
|
||||
if (!check)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function EscapeHyphen(key) {
|
||||
return key.replace(/'/g, "\\'");
|
||||
}
|
||||
function Encode(object, key) {
|
||||
return IsAccessor(key) ? `${object}.${key}` : `${object}['${EscapeHyphen(key)}']`;
|
||||
}
|
||||
MemberExpression.Encode = Encode;
|
||||
})(MemberExpression || (MemberExpression = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// Identifier
|
||||
// ------------------------------------------------------------------
|
||||
var Identifier;
|
||||
(function (Identifier) {
|
||||
function Encode($id) {
|
||||
const buffer = [];
|
||||
for (let i = 0; i < $id.length; i++) {
|
||||
const code = $id.charCodeAt(i);
|
||||
if (Character.IsNumeric(code) || Character.IsAlpha(code)) {
|
||||
buffer.push($id.charAt(i));
|
||||
}
|
||||
else {
|
||||
buffer.push(`_${code}_`);
|
||||
}
|
||||
}
|
||||
return buffer.join('').replace(/__/g, '_');
|
||||
}
|
||||
Identifier.Encode = Encode;
|
||||
})(Identifier || (Identifier = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// LiteralString
|
||||
// ------------------------------------------------------------------
|
||||
var LiteralString;
|
||||
(function (LiteralString) {
|
||||
function Escape(content) {
|
||||
return content.replace(/'/g, "\\'");
|
||||
}
|
||||
LiteralString.Escape = Escape;
|
||||
})(LiteralString || (LiteralString = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// Errors
|
||||
// ------------------------------------------------------------------
|
||||
class TypeCompilerUnknownTypeError extends index_4.TypeBoxError {
|
||||
constructor(schema) {
|
||||
super('Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.TypeCompilerUnknownTypeError = TypeCompilerUnknownTypeError;
|
||||
class TypeCompilerTypeGuardError extends index_4.TypeBoxError {
|
||||
constructor(schema) {
|
||||
super('Preflight validation check failed to guard for the given schema');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.TypeCompilerTypeGuardError = TypeCompilerTypeGuardError;
|
||||
// ------------------------------------------------------------------
|
||||
// Policy
|
||||
// ------------------------------------------------------------------
|
||||
var Policy;
|
||||
(function (Policy) {
|
||||
function IsExactOptionalProperty(value, key, expression) {
|
||||
return index_3.TypeSystemPolicy.ExactOptionalPropertyTypes ? `('${key}' in ${value} ? ${expression} : true)` : `(${MemberExpression.Encode(value, key)} !== undefined ? ${expression} : true)`;
|
||||
}
|
||||
Policy.IsExactOptionalProperty = IsExactOptionalProperty;
|
||||
function IsObjectLike(value) {
|
||||
return !index_3.TypeSystemPolicy.AllowArrayObject ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}))` : `(typeof ${value} === 'object' && ${value} !== null)`;
|
||||
}
|
||||
Policy.IsObjectLike = IsObjectLike;
|
||||
function IsRecordLike(value) {
|
||||
return !index_3.TypeSystemPolicy.AllowArrayObject
|
||||
? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}) && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`
|
||||
: `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`;
|
||||
}
|
||||
Policy.IsRecordLike = IsRecordLike;
|
||||
function IsNumberLike(value) {
|
||||
return index_3.TypeSystemPolicy.AllowNaN ? `typeof ${value} === 'number'` : `Number.isFinite(${value})`;
|
||||
}
|
||||
Policy.IsNumberLike = IsNumberLike;
|
||||
function IsVoidLike(value) {
|
||||
return index_3.TypeSystemPolicy.AllowNullVoid ? `(${value} === undefined || ${value} === null)` : `${value} === undefined`;
|
||||
}
|
||||
Policy.IsVoidLike = IsVoidLike;
|
||||
})(Policy || (exports.Policy = Policy = {}));
|
||||
/** Compiles Types for Runtime Type Checking */
|
||||
var TypeCompiler;
|
||||
(function (TypeCompiler) {
|
||||
// ----------------------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------------------
|
||||
function IsAnyOrUnknown(schema) {
|
||||
return schema[index_7.Kind] === 'Any' || schema[index_7.Kind] === 'Unknown';
|
||||
}
|
||||
// ----------------------------------------------------------------
|
||||
// Types
|
||||
// ----------------------------------------------------------------
|
||||
function* FromAny(schema, references, value) {
|
||||
yield 'true';
|
||||
}
|
||||
function* FromArgument(schema, references, value) {
|
||||
yield 'true';
|
||||
}
|
||||
function* FromArray(schema, references, value) {
|
||||
yield `Array.isArray(${value})`;
|
||||
const [parameter, accumulator] = [CreateParameter('value', 'any'), CreateParameter('acc', 'number')];
|
||||
if ((0, index_12.IsNumber)(schema.maxItems))
|
||||
yield `${value}.length <= ${schema.maxItems}`;
|
||||
if ((0, index_12.IsNumber)(schema.minItems))
|
||||
yield `${value}.length >= ${schema.minItems}`;
|
||||
const elementExpression = CreateExpression(schema.items, references, 'value');
|
||||
yield `${value}.every((${parameter}) => ${elementExpression})`;
|
||||
if ((0, type_1.IsSchema)(schema.contains) || (0, index_12.IsNumber)(schema.minContains) || (0, index_12.IsNumber)(schema.maxContains)) {
|
||||
const containsSchema = (0, type_1.IsSchema)(schema.contains) ? schema.contains : (0, index_10.Never)();
|
||||
const checkExpression = CreateExpression(containsSchema, references, 'value');
|
||||
const checkMinContains = (0, index_12.IsNumber)(schema.minContains) ? [`(count >= ${schema.minContains})`] : [];
|
||||
const checkMaxContains = (0, index_12.IsNumber)(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : [];
|
||||
const checkCount = `const count = value.reduce((${accumulator}, ${parameter}) => ${checkExpression} ? acc + 1 : acc, 0)`;
|
||||
const check = [`(count > 0)`, ...checkMinContains, ...checkMaxContains].join(' && ');
|
||||
yield `((${parameter}) => { ${checkCount}; return ${check}})(${value})`;
|
||||
}
|
||||
if (schema.uniqueItems === true) {
|
||||
const check = `const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true`;
|
||||
const block = `const set = new Set(); for(const element of value) { ${check} }`;
|
||||
yield `((${parameter}) => { ${block} )(${value})`;
|
||||
}
|
||||
}
|
||||
function* FromAsyncIterator(schema, references, value) {
|
||||
yield `(typeof value === 'object' && Symbol.asyncIterator in ${value})`;
|
||||
}
|
||||
function* FromBigInt(schema, references, value) {
|
||||
yield `(typeof ${value} === 'bigint')`;
|
||||
if ((0, index_12.IsBigInt)(schema.exclusiveMaximum))
|
||||
yield `${value} < BigInt(${schema.exclusiveMaximum})`;
|
||||
if ((0, index_12.IsBigInt)(schema.exclusiveMinimum))
|
||||
yield `${value} > BigInt(${schema.exclusiveMinimum})`;
|
||||
if ((0, index_12.IsBigInt)(schema.maximum))
|
||||
yield `${value} <= BigInt(${schema.maximum})`;
|
||||
if ((0, index_12.IsBigInt)(schema.minimum))
|
||||
yield `${value} >= BigInt(${schema.minimum})`;
|
||||
if ((0, index_12.IsBigInt)(schema.multipleOf))
|
||||
yield `(${value} % BigInt(${schema.multipleOf})) === 0`;
|
||||
}
|
||||
function* FromBoolean(schema, references, value) {
|
||||
yield `(typeof ${value} === 'boolean')`;
|
||||
}
|
||||
function* FromConstructor(schema, references, value) {
|
||||
yield* Visit(schema.returns, references, `${value}.prototype`);
|
||||
}
|
||||
function* FromDate(schema, references, value) {
|
||||
yield `(${value} instanceof Date) && Number.isFinite(${value}.getTime())`;
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMaximumTimestamp))
|
||||
yield `${value}.getTime() < ${schema.exclusiveMaximumTimestamp}`;
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMinimumTimestamp))
|
||||
yield `${value}.getTime() > ${schema.exclusiveMinimumTimestamp}`;
|
||||
if ((0, index_12.IsNumber)(schema.maximumTimestamp))
|
||||
yield `${value}.getTime() <= ${schema.maximumTimestamp}`;
|
||||
if ((0, index_12.IsNumber)(schema.minimumTimestamp))
|
||||
yield `${value}.getTime() >= ${schema.minimumTimestamp}`;
|
||||
if ((0, index_12.IsNumber)(schema.multipleOfTimestamp))
|
||||
yield `(${value}.getTime() % ${schema.multipleOfTimestamp}) === 0`;
|
||||
}
|
||||
function* FromFunction(schema, references, value) {
|
||||
yield `(typeof ${value} === 'function')`;
|
||||
}
|
||||
function* FromImport(schema, references, value) {
|
||||
const members = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => {
|
||||
return [...result, schema.$defs[key]];
|
||||
}, []);
|
||||
yield* Visit((0, index_11.Ref)(schema.$ref), [...references, ...members], value);
|
||||
}
|
||||
function* FromInteger(schema, references, value) {
|
||||
yield `Number.isInteger(${value})`;
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMaximum))
|
||||
yield `${value} < ${schema.exclusiveMaximum}`;
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMinimum))
|
||||
yield `${value} > ${schema.exclusiveMinimum}`;
|
||||
if ((0, index_12.IsNumber)(schema.maximum))
|
||||
yield `${value} <= ${schema.maximum}`;
|
||||
if ((0, index_12.IsNumber)(schema.minimum))
|
||||
yield `${value} >= ${schema.minimum}`;
|
||||
if ((0, index_12.IsNumber)(schema.multipleOf))
|
||||
yield `(${value} % ${schema.multipleOf}) === 0`;
|
||||
}
|
||||
function* FromIntersect(schema, references, value) {
|
||||
const check1 = schema.allOf.map((schema) => CreateExpression(schema, references, value)).join(' && ');
|
||||
if (schema.unevaluatedProperties === false) {
|
||||
const keyCheck = CreateVariable(`${new RegExp((0, index_9.KeyOfPattern)(schema))};`);
|
||||
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key))`;
|
||||
yield `(${check1} && ${check2})`;
|
||||
}
|
||||
else if ((0, type_1.IsSchema)(schema.unevaluatedProperties)) {
|
||||
const keyCheck = CreateVariable(`${new RegExp((0, index_9.KeyOfPattern)(schema))};`);
|
||||
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key) || ${CreateExpression(schema.unevaluatedProperties, references, `${value}[key]`)})`;
|
||||
yield `(${check1} && ${check2})`;
|
||||
}
|
||||
else {
|
||||
yield `(${check1})`;
|
||||
}
|
||||
}
|
||||
function* FromIterator(schema, references, value) {
|
||||
yield `(typeof value === 'object' && Symbol.iterator in ${value})`;
|
||||
}
|
||||
function* FromLiteral(schema, references, value) {
|
||||
if (typeof schema.const === 'number' || typeof schema.const === 'boolean') {
|
||||
yield `(${value} === ${schema.const})`;
|
||||
}
|
||||
else {
|
||||
yield `(${value} === '${LiteralString.Escape(schema.const)}')`;
|
||||
}
|
||||
}
|
||||
function* FromNever(schema, references, value) {
|
||||
yield `false`;
|
||||
}
|
||||
function* FromNot(schema, references, value) {
|
||||
const expression = CreateExpression(schema.not, references, value);
|
||||
yield `(!${expression})`;
|
||||
}
|
||||
function* FromNull(schema, references, value) {
|
||||
yield `(${value} === null)`;
|
||||
}
|
||||
function* FromNumber(schema, references, value) {
|
||||
yield Policy.IsNumberLike(value);
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMaximum))
|
||||
yield `${value} < ${schema.exclusiveMaximum}`;
|
||||
if ((0, index_12.IsNumber)(schema.exclusiveMinimum))
|
||||
yield `${value} > ${schema.exclusiveMinimum}`;
|
||||
if ((0, index_12.IsNumber)(schema.maximum))
|
||||
yield `${value} <= ${schema.maximum}`;
|
||||
if ((0, index_12.IsNumber)(schema.minimum))
|
||||
yield `${value} >= ${schema.minimum}`;
|
||||
if ((0, index_12.IsNumber)(schema.multipleOf))
|
||||
yield `(${value} % ${schema.multipleOf}) === 0`;
|
||||
}
|
||||
function* FromObject(schema, references, value) {
|
||||
yield Policy.IsObjectLike(value);
|
||||
if ((0, index_12.IsNumber)(schema.minProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
||||
if ((0, index_12.IsNumber)(schema.maxProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`;
|
||||
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
||||
for (const knownKey of knownKeys) {
|
||||
const memberExpression = MemberExpression.Encode(value, knownKey);
|
||||
const property = schema.properties[knownKey];
|
||||
if (schema.required && schema.required.includes(knownKey)) {
|
||||
yield* Visit(property, references, memberExpression);
|
||||
if ((0, extends_undefined_1.ExtendsUndefinedCheck)(property) || IsAnyOrUnknown(property))
|
||||
yield `('${knownKey}' in ${value})`;
|
||||
}
|
||||
else {
|
||||
const expression = CreateExpression(property, references, memberExpression);
|
||||
yield Policy.IsExactOptionalProperty(value, knownKey, expression);
|
||||
}
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
if (schema.required && schema.required.length === knownKeys.length) {
|
||||
yield `Object.getOwnPropertyNames(${value}).length === ${knownKeys.length}`;
|
||||
}
|
||||
else {
|
||||
const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
|
||||
yield `Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key))`;
|
||||
}
|
||||
}
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
const expression = CreateExpression(schema.additionalProperties, references, `${value}[key]`);
|
||||
const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
|
||||
yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`;
|
||||
}
|
||||
}
|
||||
function* FromPromise(schema, references, value) {
|
||||
yield `${value} instanceof Promise`;
|
||||
}
|
||||
function* FromRecord(schema, references, value) {
|
||||
yield Policy.IsRecordLike(value);
|
||||
if ((0, index_12.IsNumber)(schema.minProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
||||
if ((0, index_12.IsNumber)(schema.maxProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`;
|
||||
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
||||
const variable = CreateVariable(`${new RegExp(patternKey)}`);
|
||||
const check1 = CreateExpression(patternSchema, references, 'value');
|
||||
const check2 = (0, type_1.IsSchema)(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? 'false' : 'true';
|
||||
const expression = `(${variable}.test(key) ? ${check1} : ${check2})`;
|
||||
yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`;
|
||||
}
|
||||
function* FromRef(schema, references, value) {
|
||||
const target = (0, index_5.Deref)(schema, references);
|
||||
// Reference: If we have seen this reference before we can just yield and return the function call.
|
||||
// If this isn't the case we defer to visit to generate and set the function for subsequent passes.
|
||||
if (state.functions.has(schema.$ref))
|
||||
return yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
||||
yield* Visit(target, references, value);
|
||||
}
|
||||
function* FromRegExp(schema, references, value) {
|
||||
const variable = CreateVariable(`${new RegExp(schema.source, schema.flags)};`);
|
||||
yield `(typeof ${value} === 'string')`;
|
||||
if ((0, index_12.IsNumber)(schema.maxLength))
|
||||
yield `${value}.length <= ${schema.maxLength}`;
|
||||
if ((0, index_12.IsNumber)(schema.minLength))
|
||||
yield `${value}.length >= ${schema.minLength}`;
|
||||
yield `${variable}.test(${value})`;
|
||||
}
|
||||
function* FromString(schema, references, value) {
|
||||
yield `(typeof ${value} === 'string')`;
|
||||
if ((0, index_12.IsNumber)(schema.maxLength))
|
||||
yield `${value}.length <= ${schema.maxLength}`;
|
||||
if ((0, index_12.IsNumber)(schema.minLength))
|
||||
yield `${value}.length >= ${schema.minLength}`;
|
||||
if (schema.pattern !== undefined) {
|
||||
const variable = CreateVariable(`${new RegExp(schema.pattern)};`);
|
||||
yield `${variable}.test(${value})`;
|
||||
}
|
||||
if (schema.format !== undefined) {
|
||||
yield `format('${schema.format}', ${value})`;
|
||||
}
|
||||
}
|
||||
function* FromSymbol(schema, references, value) {
|
||||
yield `(typeof ${value} === 'symbol')`;
|
||||
}
|
||||
function* FromTemplateLiteral(schema, references, value) {
|
||||
yield `(typeof ${value} === 'string')`;
|
||||
const variable = CreateVariable(`${new RegExp(schema.pattern)};`);
|
||||
yield `${variable}.test(${value})`;
|
||||
}
|
||||
function* FromThis(schema, references, value) {
|
||||
// Note: This types are assured to be hoisted prior to this call. Just yield the function.
|
||||
yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
||||
}
|
||||
function* FromTuple(schema, references, value) {
|
||||
yield `Array.isArray(${value})`;
|
||||
if (schema.items === undefined)
|
||||
return yield `${value}.length === 0`;
|
||||
yield `(${value}.length === ${schema.maxItems})`;
|
||||
for (let i = 0; i < schema.items.length; i++) {
|
||||
const expression = CreateExpression(schema.items[i], references, `${value}[${i}]`);
|
||||
yield `${expression}`;
|
||||
}
|
||||
}
|
||||
function* FromUndefined(schema, references, value) {
|
||||
yield `${value} === undefined`;
|
||||
}
|
||||
function* FromUnion(schema, references, value) {
|
||||
const expressions = schema.anyOf.map((schema) => CreateExpression(schema, references, value));
|
||||
yield `(${expressions.join(' || ')})`;
|
||||
}
|
||||
function* FromUint8Array(schema, references, value) {
|
||||
yield `${value} instanceof Uint8Array`;
|
||||
if ((0, index_12.IsNumber)(schema.maxByteLength))
|
||||
yield `(${value}.length <= ${schema.maxByteLength})`;
|
||||
if ((0, index_12.IsNumber)(schema.minByteLength))
|
||||
yield `(${value}.length >= ${schema.minByteLength})`;
|
||||
}
|
||||
function* FromUnknown(schema, references, value) {
|
||||
yield 'true';
|
||||
}
|
||||
function* FromVoid(schema, references, value) {
|
||||
yield Policy.IsVoidLike(value);
|
||||
}
|
||||
function* FromKind(schema, references, value) {
|
||||
const instance = state.instances.size;
|
||||
state.instances.set(instance, schema);
|
||||
yield `kind('${schema[index_7.Kind]}', ${instance}, ${value})`;
|
||||
}
|
||||
function* Visit(schema, references, value, useHoisting = true) {
|
||||
const references_ = (0, index_12.IsString)(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
// --------------------------------------------------------------
|
||||
// Hoisting
|
||||
// --------------------------------------------------------------
|
||||
if (useHoisting && (0, index_12.IsString)(schema.$id)) {
|
||||
const functionName = CreateFunctionName(schema.$id);
|
||||
if (state.functions.has(functionName)) {
|
||||
return yield `${functionName}(${value})`;
|
||||
}
|
||||
else {
|
||||
// Note: In the case of cyclic types, we need to create a 'functions' record
|
||||
// to prevent infinitely re-visiting the CreateFunction. Subsequent attempts
|
||||
// to visit will be caught by the above condition.
|
||||
state.functions.set(functionName, '<deferred>');
|
||||
const functionCode = CreateFunction(functionName, schema, references, 'value', false);
|
||||
state.functions.set(functionName, functionCode);
|
||||
return yield `${functionName}(${value})`;
|
||||
}
|
||||
}
|
||||
switch (schema_[index_7.Kind]) {
|
||||
case 'Any':
|
||||
return yield* FromAny(schema_, references_, value);
|
||||
case 'Argument':
|
||||
return yield* FromArgument(schema_, references_, value);
|
||||
case 'Array':
|
||||
return yield* FromArray(schema_, references_, value);
|
||||
case 'AsyncIterator':
|
||||
return yield* FromAsyncIterator(schema_, references_, value);
|
||||
case 'BigInt':
|
||||
return yield* FromBigInt(schema_, references_, value);
|
||||
case 'Boolean':
|
||||
return yield* FromBoolean(schema_, references_, value);
|
||||
case 'Constructor':
|
||||
return yield* FromConstructor(schema_, references_, value);
|
||||
case 'Date':
|
||||
return yield* FromDate(schema_, references_, value);
|
||||
case 'Function':
|
||||
return yield* FromFunction(schema_, references_, value);
|
||||
case 'Import':
|
||||
return yield* FromImport(schema_, references_, value);
|
||||
case 'Integer':
|
||||
return yield* FromInteger(schema_, references_, value);
|
||||
case 'Intersect':
|
||||
return yield* FromIntersect(schema_, references_, value);
|
||||
case 'Iterator':
|
||||
return yield* FromIterator(schema_, references_, value);
|
||||
case 'Literal':
|
||||
return yield* FromLiteral(schema_, references_, value);
|
||||
case 'Never':
|
||||
return yield* FromNever(schema_, references_, value);
|
||||
case 'Not':
|
||||
return yield* FromNot(schema_, references_, value);
|
||||
case 'Null':
|
||||
return yield* FromNull(schema_, references_, value);
|
||||
case 'Number':
|
||||
return yield* FromNumber(schema_, references_, value);
|
||||
case 'Object':
|
||||
return yield* FromObject(schema_, references_, value);
|
||||
case 'Promise':
|
||||
return yield* FromPromise(schema_, references_, value);
|
||||
case 'Record':
|
||||
return yield* FromRecord(schema_, references_, value);
|
||||
case 'Ref':
|
||||
return yield* FromRef(schema_, references_, value);
|
||||
case 'RegExp':
|
||||
return yield* FromRegExp(schema_, references_, value);
|
||||
case 'String':
|
||||
return yield* FromString(schema_, references_, value);
|
||||
case 'Symbol':
|
||||
return yield* FromSymbol(schema_, references_, value);
|
||||
case 'TemplateLiteral':
|
||||
return yield* FromTemplateLiteral(schema_, references_, value);
|
||||
case 'This':
|
||||
return yield* FromThis(schema_, references_, value);
|
||||
case 'Tuple':
|
||||
return yield* FromTuple(schema_, references_, value);
|
||||
case 'Undefined':
|
||||
return yield* FromUndefined(schema_, references_, value);
|
||||
case 'Union':
|
||||
return yield* FromUnion(schema_, references_, value);
|
||||
case 'Uint8Array':
|
||||
return yield* FromUint8Array(schema_, references_, value);
|
||||
case 'Unknown':
|
||||
return yield* FromUnknown(schema_, references_, value);
|
||||
case 'Void':
|
||||
return yield* FromVoid(schema_, references_, value);
|
||||
default:
|
||||
if (!index_8.TypeRegistry.Has(schema_[index_7.Kind]))
|
||||
throw new TypeCompilerUnknownTypeError(schema);
|
||||
return yield* FromKind(schema_, references_, value);
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------------
|
||||
// Compiler State
|
||||
// ----------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
const state = {
|
||||
language: 'javascript', // target language
|
||||
functions: new Map(), // local functions
|
||||
variables: new Map(), // local variables
|
||||
instances: new Map() // exterior kind instances
|
||||
};
|
||||
// ----------------------------------------------------------------
|
||||
// Compiler Factory
|
||||
// ----------------------------------------------------------------
|
||||
function CreateExpression(schema, references, value, useHoisting = true) {
|
||||
return `(${[...Visit(schema, references, value, useHoisting)].join(' && ')})`;
|
||||
}
|
||||
function CreateFunctionName($id) {
|
||||
return `check_${Identifier.Encode($id)}`;
|
||||
}
|
||||
function CreateVariable(expression) {
|
||||
const variableName = `local_${state.variables.size}`;
|
||||
state.variables.set(variableName, `const ${variableName} = ${expression}`);
|
||||
return variableName;
|
||||
}
|
||||
function CreateFunction(name, schema, references, value, useHoisting = true) {
|
||||
const [newline, pad] = ['\n', (length) => ''.padStart(length, ' ')];
|
||||
const parameter = CreateParameter('value', 'any');
|
||||
const returns = CreateReturns('boolean');
|
||||
const expression = [...Visit(schema, references, value, useHoisting)].map((expression) => `${pad(4)}${expression}`).join(` &&${newline}`);
|
||||
return `function ${name}(${parameter})${returns} {${newline}${pad(2)}return (${newline}${expression}${newline}${pad(2)})\n}`;
|
||||
}
|
||||
function CreateParameter(name, type) {
|
||||
const annotation = state.language === 'typescript' ? `: ${type}` : '';
|
||||
return `${name}${annotation}`;
|
||||
}
|
||||
function CreateReturns(type) {
|
||||
return state.language === 'typescript' ? `: ${type}` : '';
|
||||
}
|
||||
// ----------------------------------------------------------------
|
||||
// Compile
|
||||
// ----------------------------------------------------------------
|
||||
function Build(schema, references, options) {
|
||||
const functionCode = CreateFunction('check', schema, references, 'value'); // will populate functions and variables
|
||||
const parameter = CreateParameter('value', 'any');
|
||||
const returns = CreateReturns('boolean');
|
||||
const functions = [...state.functions.values()];
|
||||
const variables = [...state.variables.values()];
|
||||
// prettier-ignore
|
||||
const checkFunction = (0, index_12.IsString)(schema.$id) // ensure top level schemas with $id's are hoisted
|
||||
? `return function check(${parameter})${returns} {\n return ${CreateFunctionName(schema.$id)}(value)\n}`
|
||||
: `return ${functionCode}`;
|
||||
return [...variables, ...functions, checkFunction].join('\n');
|
||||
}
|
||||
/** Generates the code used to assert this type and returns it as a string */
|
||||
function Code(...args) {
|
||||
const defaults = { language: 'javascript' };
|
||||
// prettier-ignore
|
||||
const [schema, references, options] = (args.length === 2 && (0, index_12.IsArray)(args[1]) ? [args[0], args[1], defaults] :
|
||||
args.length === 2 && !(0, index_12.IsArray)(args[1]) ? [args[0], [], args[1]] :
|
||||
args.length === 3 ? [args[0], args[1], args[2]] :
|
||||
args.length === 1 ? [args[0], [], defaults] :
|
||||
[null, [], defaults]);
|
||||
// compiler-reset
|
||||
state.language = options.language;
|
||||
state.variables.clear();
|
||||
state.functions.clear();
|
||||
state.instances.clear();
|
||||
if (!(0, type_1.IsSchema)(schema))
|
||||
throw new TypeCompilerTypeGuardError(schema);
|
||||
for (const schema of references)
|
||||
if (!(0, type_1.IsSchema)(schema))
|
||||
throw new TypeCompilerTypeGuardError(schema);
|
||||
return Build(schema, references, options);
|
||||
}
|
||||
TypeCompiler.Code = Code;
|
||||
/** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */
|
||||
function Compile(schema, references = []) {
|
||||
const generatedCode = Code(schema, references, { language: 'javascript' });
|
||||
const compiledFunction = globalThis.Function('kind', 'format', 'hash', generatedCode);
|
||||
const instances = new Map(state.instances);
|
||||
function typeRegistryFunction(kind, instance, value) {
|
||||
if (!index_8.TypeRegistry.Has(kind) || !instances.has(instance))
|
||||
return false;
|
||||
const checkFunc = index_8.TypeRegistry.Get(kind);
|
||||
const schema = instances.get(instance);
|
||||
return checkFunc(schema, value);
|
||||
}
|
||||
function formatRegistryFunction(format, value) {
|
||||
if (!index_8.FormatRegistry.Has(format))
|
||||
return false;
|
||||
const checkFunc = index_8.FormatRegistry.Get(format);
|
||||
return checkFunc(value);
|
||||
}
|
||||
function hashFunction(value) {
|
||||
return (0, index_6.Hash)(value);
|
||||
}
|
||||
const checkFunction = compiledFunction(typeRegistryFunction, formatRegistryFunction, hashFunction);
|
||||
return new TypeCheck(schema, references, checkFunction, generatedCode);
|
||||
}
|
||||
TypeCompiler.Compile = Compile;
|
||||
})(TypeCompiler || (exports.TypeCompiler = TypeCompiler = {}));
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index';
|
||||
export * from './compiler';
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueErrorIterator = exports.ValueErrorType = void 0;
|
||||
var index_1 = require("../errors/index");
|
||||
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
||||
Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } });
|
||||
__exportStar(require("./compiler"), exports);
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
import { TypeBoxError } from '../type/error/index';
|
||||
import type { TSchema } from '../type/schema/index';
|
||||
export declare enum ValueErrorType {
|
||||
ArrayContains = 0,
|
||||
ArrayMaxContains = 1,
|
||||
ArrayMaxItems = 2,
|
||||
ArrayMinContains = 3,
|
||||
ArrayMinItems = 4,
|
||||
ArrayUniqueItems = 5,
|
||||
Array = 6,
|
||||
AsyncIterator = 7,
|
||||
BigIntExclusiveMaximum = 8,
|
||||
BigIntExclusiveMinimum = 9,
|
||||
BigIntMaximum = 10,
|
||||
BigIntMinimum = 11,
|
||||
BigIntMultipleOf = 12,
|
||||
BigInt = 13,
|
||||
Boolean = 14,
|
||||
DateExclusiveMaximumTimestamp = 15,
|
||||
DateExclusiveMinimumTimestamp = 16,
|
||||
DateMaximumTimestamp = 17,
|
||||
DateMinimumTimestamp = 18,
|
||||
DateMultipleOfTimestamp = 19,
|
||||
Date = 20,
|
||||
Function = 21,
|
||||
IntegerExclusiveMaximum = 22,
|
||||
IntegerExclusiveMinimum = 23,
|
||||
IntegerMaximum = 24,
|
||||
IntegerMinimum = 25,
|
||||
IntegerMultipleOf = 26,
|
||||
Integer = 27,
|
||||
IntersectUnevaluatedProperties = 28,
|
||||
Intersect = 29,
|
||||
Iterator = 30,
|
||||
Kind = 31,
|
||||
Literal = 32,
|
||||
Never = 33,
|
||||
Not = 34,
|
||||
Null = 35,
|
||||
NumberExclusiveMaximum = 36,
|
||||
NumberExclusiveMinimum = 37,
|
||||
NumberMaximum = 38,
|
||||
NumberMinimum = 39,
|
||||
NumberMultipleOf = 40,
|
||||
Number = 41,
|
||||
ObjectAdditionalProperties = 42,
|
||||
ObjectMaxProperties = 43,
|
||||
ObjectMinProperties = 44,
|
||||
ObjectRequiredProperty = 45,
|
||||
Object = 46,
|
||||
Promise = 47,
|
||||
RegExp = 48,
|
||||
StringFormatUnknown = 49,
|
||||
StringFormat = 50,
|
||||
StringMaxLength = 51,
|
||||
StringMinLength = 52,
|
||||
StringPattern = 53,
|
||||
String = 54,
|
||||
Symbol = 55,
|
||||
TupleLength = 56,
|
||||
Tuple = 57,
|
||||
Uint8ArrayMaxByteLength = 58,
|
||||
Uint8ArrayMinByteLength = 59,
|
||||
Uint8Array = 60,
|
||||
Undefined = 61,
|
||||
Union = 62,
|
||||
Void = 63
|
||||
}
|
||||
export interface ValueError {
|
||||
type: ValueErrorType;
|
||||
schema: TSchema;
|
||||
path: string;
|
||||
value: unknown;
|
||||
message: string;
|
||||
errors: ValueErrorIterator[];
|
||||
}
|
||||
export declare class ValueErrorsUnknownTypeError extends TypeBoxError {
|
||||
readonly schema: TSchema;
|
||||
constructor(schema: TSchema);
|
||||
}
|
||||
export declare class ValueErrorIterator {
|
||||
private readonly iterator;
|
||||
constructor(iterator: IterableIterator<ValueError>);
|
||||
[Symbol.iterator](): IterableIterator<ValueError>;
|
||||
/** Returns the first value error or undefined if no errors */
|
||||
First(): ValueError | undefined;
|
||||
}
|
||||
/** Returns an iterator for each error in this value. */
|
||||
export declare function Errors<T extends TSchema>(schema: T, references: TSchema[], value: unknown): ValueErrorIterator;
|
||||
/** Returns an iterator for each error in this value. */
|
||||
export declare function Errors<T extends TSchema>(schema: T, value: unknown): ValueErrorIterator;
|
||||
599
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/errors.js
vendored
Normal file
599
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/errors.js
vendored
Normal file
|
|
@ -0,0 +1,599 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueErrorIterator = exports.ValueErrorsUnknownTypeError = exports.ValueErrorType = void 0;
|
||||
exports.Errors = Errors;
|
||||
const index_1 = require("../system/index");
|
||||
const index_2 = require("../type/keyof/index");
|
||||
const index_3 = require("../type/registry/index");
|
||||
const extends_undefined_1 = require("../type/extends/extends-undefined");
|
||||
const function_1 = require("./function");
|
||||
const index_4 = require("../type/error/index");
|
||||
const index_5 = require("../value/deref/index");
|
||||
const index_6 = require("../value/hash/index");
|
||||
const index_7 = require("../value/check/index");
|
||||
const index_8 = require("../type/symbols/index");
|
||||
const index_9 = require("../type/never/index");
|
||||
// ------------------------------------------------------------------
|
||||
// ValueGuard
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
const index_10 = require("../value/guard/index");
|
||||
// ------------------------------------------------------------------
|
||||
// ValueErrorType
|
||||
// ------------------------------------------------------------------
|
||||
var ValueErrorType;
|
||||
(function (ValueErrorType) {
|
||||
ValueErrorType[ValueErrorType["ArrayContains"] = 0] = "ArrayContains";
|
||||
ValueErrorType[ValueErrorType["ArrayMaxContains"] = 1] = "ArrayMaxContains";
|
||||
ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems";
|
||||
ValueErrorType[ValueErrorType["ArrayMinContains"] = 3] = "ArrayMinContains";
|
||||
ValueErrorType[ValueErrorType["ArrayMinItems"] = 4] = "ArrayMinItems";
|
||||
ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 5] = "ArrayUniqueItems";
|
||||
ValueErrorType[ValueErrorType["Array"] = 6] = "Array";
|
||||
ValueErrorType[ValueErrorType["AsyncIterator"] = 7] = "AsyncIterator";
|
||||
ValueErrorType[ValueErrorType["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["BigIntMaximum"] = 10] = "BigIntMaximum";
|
||||
ValueErrorType[ValueErrorType["BigIntMinimum"] = 11] = "BigIntMinimum";
|
||||
ValueErrorType[ValueErrorType["BigIntMultipleOf"] = 12] = "BigIntMultipleOf";
|
||||
ValueErrorType[ValueErrorType["BigInt"] = 13] = "BigInt";
|
||||
ValueErrorType[ValueErrorType["Boolean"] = 14] = "Boolean";
|
||||
ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp";
|
||||
ValueErrorType[ValueErrorType["Date"] = 20] = "Date";
|
||||
ValueErrorType[ValueErrorType["Function"] = 21] = "Function";
|
||||
ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["IntegerMaximum"] = 24] = "IntegerMaximum";
|
||||
ValueErrorType[ValueErrorType["IntegerMinimum"] = 25] = "IntegerMinimum";
|
||||
ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 26] = "IntegerMultipleOf";
|
||||
ValueErrorType[ValueErrorType["Integer"] = 27] = "Integer";
|
||||
ValueErrorType[ValueErrorType["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties";
|
||||
ValueErrorType[ValueErrorType["Intersect"] = 29] = "Intersect";
|
||||
ValueErrorType[ValueErrorType["Iterator"] = 30] = "Iterator";
|
||||
ValueErrorType[ValueErrorType["Kind"] = 31] = "Kind";
|
||||
ValueErrorType[ValueErrorType["Literal"] = 32] = "Literal";
|
||||
ValueErrorType[ValueErrorType["Never"] = 33] = "Never";
|
||||
ValueErrorType[ValueErrorType["Not"] = 34] = "Not";
|
||||
ValueErrorType[ValueErrorType["Null"] = 35] = "Null";
|
||||
ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["NumberMaximum"] = 38] = "NumberMaximum";
|
||||
ValueErrorType[ValueErrorType["NumberMinimum"] = 39] = "NumberMinimum";
|
||||
ValueErrorType[ValueErrorType["NumberMultipleOf"] = 40] = "NumberMultipleOf";
|
||||
ValueErrorType[ValueErrorType["Number"] = 41] = "Number";
|
||||
ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 43] = "ObjectMaxProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectMinProperties"] = 44] = "ObjectMinProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty";
|
||||
ValueErrorType[ValueErrorType["Object"] = 46] = "Object";
|
||||
ValueErrorType[ValueErrorType["Promise"] = 47] = "Promise";
|
||||
ValueErrorType[ValueErrorType["RegExp"] = 48] = "RegExp";
|
||||
ValueErrorType[ValueErrorType["StringFormatUnknown"] = 49] = "StringFormatUnknown";
|
||||
ValueErrorType[ValueErrorType["StringFormat"] = 50] = "StringFormat";
|
||||
ValueErrorType[ValueErrorType["StringMaxLength"] = 51] = "StringMaxLength";
|
||||
ValueErrorType[ValueErrorType["StringMinLength"] = 52] = "StringMinLength";
|
||||
ValueErrorType[ValueErrorType["StringPattern"] = 53] = "StringPattern";
|
||||
ValueErrorType[ValueErrorType["String"] = 54] = "String";
|
||||
ValueErrorType[ValueErrorType["Symbol"] = 55] = "Symbol";
|
||||
ValueErrorType[ValueErrorType["TupleLength"] = 56] = "TupleLength";
|
||||
ValueErrorType[ValueErrorType["Tuple"] = 57] = "Tuple";
|
||||
ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength";
|
||||
ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength";
|
||||
ValueErrorType[ValueErrorType["Uint8Array"] = 60] = "Uint8Array";
|
||||
ValueErrorType[ValueErrorType["Undefined"] = 61] = "Undefined";
|
||||
ValueErrorType[ValueErrorType["Union"] = 62] = "Union";
|
||||
ValueErrorType[ValueErrorType["Void"] = 63] = "Void";
|
||||
})(ValueErrorType || (exports.ValueErrorType = ValueErrorType = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// ValueErrors
|
||||
// ------------------------------------------------------------------
|
||||
class ValueErrorsUnknownTypeError extends index_4.TypeBoxError {
|
||||
constructor(schema) {
|
||||
super('Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueErrorsUnknownTypeError = ValueErrorsUnknownTypeError;
|
||||
// ------------------------------------------------------------------
|
||||
// EscapeKey
|
||||
// ------------------------------------------------------------------
|
||||
function EscapeKey(key) {
|
||||
return key.replace(/~/g, '~0').replace(/\//g, '~1'); // RFC6901 Path
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Guards
|
||||
// ------------------------------------------------------------------
|
||||
function IsDefined(value) {
|
||||
return value !== undefined;
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// ValueErrorIterator
|
||||
// ------------------------------------------------------------------
|
||||
class ValueErrorIterator {
|
||||
constructor(iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.iterator;
|
||||
}
|
||||
/** Returns the first value error or undefined if no errors */
|
||||
First() {
|
||||
const next = this.iterator.next();
|
||||
return next.done ? undefined : next.value;
|
||||
}
|
||||
}
|
||||
exports.ValueErrorIterator = ValueErrorIterator;
|
||||
// --------------------------------------------------------------------------
|
||||
// Create
|
||||
// --------------------------------------------------------------------------
|
||||
function Create(errorType, schema, path, value, errors = []) {
|
||||
return {
|
||||
type: errorType,
|
||||
schema,
|
||||
path,
|
||||
value,
|
||||
message: (0, function_1.GetErrorFunction)()({ errorType, path, schema, value, errors }),
|
||||
errors,
|
||||
};
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
// Types
|
||||
// --------------------------------------------------------------------------
|
||||
function* FromAny(schema, references, path, value) { }
|
||||
function* FromArgument(schema, references, path, value) { }
|
||||
function* FromArray(schema, references, path, value) {
|
||||
if (!(0, index_10.IsArray)(value)) {
|
||||
return yield Create(ValueErrorType.Array, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
|
||||
yield Create(ValueErrorType.ArrayMinItems, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
||||
yield Create(ValueErrorType.ArrayMaxItems, schema, path, value);
|
||||
}
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
yield* Visit(schema.items, references, `${path}/${i}`, value[i]);
|
||||
}
|
||||
// prettier-ignore
|
||||
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
||||
const hashed = (0, index_6.Hash)(element);
|
||||
if (set.has(hashed)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
set.add(hashed);
|
||||
}
|
||||
} return true; })())) {
|
||||
yield Create(ValueErrorType.ArrayUniqueItems, schema, path, value);
|
||||
}
|
||||
// contains
|
||||
if (!(IsDefined(schema.contains) || IsDefined(schema.minContains) || IsDefined(schema.maxContains))) {
|
||||
return;
|
||||
}
|
||||
const containsSchema = IsDefined(schema.contains) ? schema.contains : (0, index_9.Never)();
|
||||
const containsCount = value.reduce((acc, value, index) => (Visit(containsSchema, references, `${path}${index}`, value).next().done === true ? acc + 1 : acc), 0);
|
||||
if (containsCount === 0) {
|
||||
yield Create(ValueErrorType.ArrayContains, schema, path, value);
|
||||
}
|
||||
if ((0, index_10.IsNumber)(schema.minContains) && containsCount < schema.minContains) {
|
||||
yield Create(ValueErrorType.ArrayMinContains, schema, path, value);
|
||||
}
|
||||
if ((0, index_10.IsNumber)(schema.maxContains) && containsCount > schema.maxContains) {
|
||||
yield Create(ValueErrorType.ArrayMaxContains, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromAsyncIterator(schema, references, path, value) {
|
||||
if (!(0, index_10.IsAsyncIterator)(value))
|
||||
yield Create(ValueErrorType.AsyncIterator, schema, path, value);
|
||||
}
|
||||
function* FromBigInt(schema, references, path, value) {
|
||||
if (!(0, index_10.IsBigInt)(value))
|
||||
return yield Create(ValueErrorType.BigInt, schema, path, value);
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield Create(ValueErrorType.BigIntMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield Create(ValueErrorType.BigIntMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
|
||||
yield Create(ValueErrorType.BigIntMultipleOf, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromBoolean(schema, references, path, value) {
|
||||
if (!(0, index_10.IsBoolean)(value))
|
||||
yield Create(ValueErrorType.Boolean, schema, path, value);
|
||||
}
|
||||
function* FromConstructor(schema, references, path, value) {
|
||||
yield* Visit(schema.returns, references, path, value.prototype);
|
||||
}
|
||||
function* FromDate(schema, references, path, value) {
|
||||
if (!(0, index_10.IsDate)(value))
|
||||
return yield Create(ValueErrorType.Date, schema, path, value);
|
||||
if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
||||
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
||||
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
||||
yield Create(ValueErrorType.DateMaximumTimestamp, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
||||
yield Create(ValueErrorType.DateMinimumTimestamp, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
|
||||
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromFunction(schema, references, path, value) {
|
||||
if (!(0, index_10.IsFunction)(value))
|
||||
yield Create(ValueErrorType.Function, schema, path, value);
|
||||
}
|
||||
function* FromImport(schema, references, path, value) {
|
||||
const definitions = globalThis.Object.values(schema.$defs);
|
||||
const target = schema.$defs[schema.$ref];
|
||||
yield* Visit(target, [...references, ...definitions], path, value);
|
||||
}
|
||||
function* FromInteger(schema, references, path, value) {
|
||||
if (!(0, index_10.IsInteger)(value))
|
||||
return yield Create(ValueErrorType.Integer, schema, path, value);
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield Create(ValueErrorType.IntegerMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield Create(ValueErrorType.IntegerMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
yield Create(ValueErrorType.IntegerMultipleOf, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromIntersect(schema, references, path, value) {
|
||||
let hasError = false;
|
||||
for (const inner of schema.allOf) {
|
||||
for (const error of Visit(inner, references, path, value)) {
|
||||
hasError = true;
|
||||
yield error;
|
||||
}
|
||||
}
|
||||
if (hasError) {
|
||||
return yield Create(ValueErrorType.Intersect, schema, path, value);
|
||||
}
|
||||
if (schema.unevaluatedProperties === false) {
|
||||
const keyCheck = new RegExp((0, index_2.KeyOfPattern)(schema));
|
||||
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
||||
if (!keyCheck.test(valueKey)) {
|
||||
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path}/${valueKey}`, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof schema.unevaluatedProperties === 'object') {
|
||||
const keyCheck = new RegExp((0, index_2.KeyOfPattern)(schema));
|
||||
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
||||
if (!keyCheck.test(valueKey)) {
|
||||
const next = Visit(schema.unevaluatedProperties, references, `${path}/${valueKey}`, value[valueKey]).next();
|
||||
if (!next.done)
|
||||
yield next.value; // yield interior
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* FromIterator(schema, references, path, value) {
|
||||
if (!(0, index_10.IsIterator)(value))
|
||||
yield Create(ValueErrorType.Iterator, schema, path, value);
|
||||
}
|
||||
function* FromLiteral(schema, references, path, value) {
|
||||
if (!(value === schema.const))
|
||||
yield Create(ValueErrorType.Literal, schema, path, value);
|
||||
}
|
||||
function* FromNever(schema, references, path, value) {
|
||||
yield Create(ValueErrorType.Never, schema, path, value);
|
||||
}
|
||||
function* FromNot(schema, references, path, value) {
|
||||
if (Visit(schema.not, references, path, value).next().done === true)
|
||||
yield Create(ValueErrorType.Not, schema, path, value);
|
||||
}
|
||||
function* FromNull(schema, references, path, value) {
|
||||
if (!(0, index_10.IsNull)(value))
|
||||
yield Create(ValueErrorType.Null, schema, path, value);
|
||||
}
|
||||
function* FromNumber(schema, references, path, value) {
|
||||
if (!index_1.TypeSystemPolicy.IsNumberLike(value))
|
||||
return yield Create(ValueErrorType.Number, schema, path, value);
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield Create(ValueErrorType.NumberMaximum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield Create(ValueErrorType.NumberMinimum, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
yield Create(ValueErrorType.NumberMultipleOf, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromObject(schema, references, path, value) {
|
||||
if (!index_1.TypeSystemPolicy.IsObjectLike(value))
|
||||
return yield Create(ValueErrorType.Object, schema, path, value);
|
||||
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
yield Create(ValueErrorType.ObjectMinProperties, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value);
|
||||
}
|
||||
const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
|
||||
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
||||
const unknownKeys = Object.getOwnPropertyNames(value);
|
||||
for (const requiredKey of requiredKeys) {
|
||||
if (unknownKeys.includes(requiredKey))
|
||||
continue;
|
||||
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path}/${EscapeKey(requiredKey)}`, undefined);
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
for (const valueKey of unknownKeys) {
|
||||
if (!knownKeys.includes(valueKey)) {
|
||||
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(valueKey)}`, value[valueKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
for (const valueKey of unknownKeys) {
|
||||
if (knownKeys.includes(valueKey))
|
||||
continue;
|
||||
yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(valueKey)}`, value[valueKey]);
|
||||
}
|
||||
}
|
||||
for (const knownKey of knownKeys) {
|
||||
const property = schema.properties[knownKey];
|
||||
if (schema.required && schema.required.includes(knownKey)) {
|
||||
yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]);
|
||||
if ((0, extends_undefined_1.ExtendsUndefinedCheck)(schema) && !(knownKey in value)) {
|
||||
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path}/${EscapeKey(knownKey)}`, undefined);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (index_1.TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
|
||||
yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* FromPromise(schema, references, path, value) {
|
||||
if (!(0, index_10.IsPromise)(value))
|
||||
yield Create(ValueErrorType.Promise, schema, path, value);
|
||||
}
|
||||
function* FromRecord(schema, references, path, value) {
|
||||
if (!index_1.TypeSystemPolicy.IsRecordLike(value))
|
||||
return yield Create(ValueErrorType.Object, schema, path, value);
|
||||
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
yield Create(ValueErrorType.ObjectMinProperties, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value);
|
||||
}
|
||||
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
||||
const regex = new RegExp(patternKey);
|
||||
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
||||
if (regex.test(propertyKey))
|
||||
yield* Visit(patternSchema, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue);
|
||||
}
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
||||
if (!regex.test(propertyKey))
|
||||
yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue);
|
||||
}
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
||||
if (regex.test(propertyKey))
|
||||
continue;
|
||||
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(propertyKey)}`, propertyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
function* FromRef(schema, references, path, value) {
|
||||
yield* Visit((0, index_5.Deref)(schema, references), references, path, value);
|
||||
}
|
||||
function* FromRegExp(schema, references, path, value) {
|
||||
if (!(0, index_10.IsString)(value))
|
||||
return yield Create(ValueErrorType.String, schema, path, value);
|
||||
if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) {
|
||||
yield Create(ValueErrorType.StringMinLength, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
||||
yield Create(ValueErrorType.StringMaxLength, schema, path, value);
|
||||
}
|
||||
const regex = new RegExp(schema.source, schema.flags);
|
||||
if (!regex.test(value)) {
|
||||
return yield Create(ValueErrorType.RegExp, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromString(schema, references, path, value) {
|
||||
if (!(0, index_10.IsString)(value))
|
||||
return yield Create(ValueErrorType.String, schema, path, value);
|
||||
if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) {
|
||||
yield Create(ValueErrorType.StringMinLength, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
||||
yield Create(ValueErrorType.StringMaxLength, schema, path, value);
|
||||
}
|
||||
if ((0, index_10.IsString)(schema.pattern)) {
|
||||
const regex = new RegExp(schema.pattern);
|
||||
if (!regex.test(value)) {
|
||||
yield Create(ValueErrorType.StringPattern, schema, path, value);
|
||||
}
|
||||
}
|
||||
if ((0, index_10.IsString)(schema.format)) {
|
||||
if (!index_3.FormatRegistry.Has(schema.format)) {
|
||||
yield Create(ValueErrorType.StringFormatUnknown, schema, path, value);
|
||||
}
|
||||
else {
|
||||
const format = index_3.FormatRegistry.Get(schema.format);
|
||||
if (!format(value)) {
|
||||
yield Create(ValueErrorType.StringFormat, schema, path, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* FromSymbol(schema, references, path, value) {
|
||||
if (!(0, index_10.IsSymbol)(value))
|
||||
yield Create(ValueErrorType.Symbol, schema, path, value);
|
||||
}
|
||||
function* FromTemplateLiteral(schema, references, path, value) {
|
||||
if (!(0, index_10.IsString)(value))
|
||||
return yield Create(ValueErrorType.String, schema, path, value);
|
||||
const regex = new RegExp(schema.pattern);
|
||||
if (!regex.test(value)) {
|
||||
yield Create(ValueErrorType.StringPattern, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromThis(schema, references, path, value) {
|
||||
yield* Visit((0, index_5.Deref)(schema, references), references, path, value);
|
||||
}
|
||||
function* FromTuple(schema, references, path, value) {
|
||||
if (!(0, index_10.IsArray)(value))
|
||||
return yield Create(ValueErrorType.Tuple, schema, path, value);
|
||||
if (schema.items === undefined && !(value.length === 0)) {
|
||||
return yield Create(ValueErrorType.TupleLength, schema, path, value);
|
||||
}
|
||||
if (!(value.length === schema.maxItems)) {
|
||||
return yield Create(ValueErrorType.TupleLength, schema, path, value);
|
||||
}
|
||||
if (!schema.items) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < schema.items.length; i++) {
|
||||
yield* Visit(schema.items[i], references, `${path}/${i}`, value[i]);
|
||||
}
|
||||
}
|
||||
function* FromUndefined(schema, references, path, value) {
|
||||
if (!(0, index_10.IsUndefined)(value))
|
||||
yield Create(ValueErrorType.Undefined, schema, path, value);
|
||||
}
|
||||
function* FromUnion(schema, references, path, value) {
|
||||
if ((0, index_7.Check)(schema, references, value))
|
||||
return;
|
||||
const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit(variant, references, path, value)));
|
||||
yield Create(ValueErrorType.Union, schema, path, value, errors);
|
||||
}
|
||||
function* FromUint8Array(schema, references, path, value) {
|
||||
if (!(0, index_10.IsUint8Array)(value))
|
||||
return yield Create(ValueErrorType.Uint8Array, schema, path, value);
|
||||
if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
||||
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path, value);
|
||||
}
|
||||
if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
||||
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path, value);
|
||||
}
|
||||
}
|
||||
function* FromUnknown(schema, references, path, value) { }
|
||||
function* FromVoid(schema, references, path, value) {
|
||||
if (!index_1.TypeSystemPolicy.IsVoidLike(value))
|
||||
yield Create(ValueErrorType.Void, schema, path, value);
|
||||
}
|
||||
function* FromKind(schema, references, path, value) {
|
||||
const check = index_3.TypeRegistry.Get(schema[index_8.Kind]);
|
||||
if (!check(schema, value))
|
||||
yield Create(ValueErrorType.Kind, schema, path, value);
|
||||
}
|
||||
function* Visit(schema, references, path, value) {
|
||||
const references_ = IsDefined(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema_[index_8.Kind]) {
|
||||
case 'Any':
|
||||
return yield* FromAny(schema_, references_, path, value);
|
||||
case 'Argument':
|
||||
return yield* FromArgument(schema_, references_, path, value);
|
||||
case 'Array':
|
||||
return yield* FromArray(schema_, references_, path, value);
|
||||
case 'AsyncIterator':
|
||||
return yield* FromAsyncIterator(schema_, references_, path, value);
|
||||
case 'BigInt':
|
||||
return yield* FromBigInt(schema_, references_, path, value);
|
||||
case 'Boolean':
|
||||
return yield* FromBoolean(schema_, references_, path, value);
|
||||
case 'Constructor':
|
||||
return yield* FromConstructor(schema_, references_, path, value);
|
||||
case 'Date':
|
||||
return yield* FromDate(schema_, references_, path, value);
|
||||
case 'Function':
|
||||
return yield* FromFunction(schema_, references_, path, value);
|
||||
case 'Import':
|
||||
return yield* FromImport(schema_, references_, path, value);
|
||||
case 'Integer':
|
||||
return yield* FromInteger(schema_, references_, path, value);
|
||||
case 'Intersect':
|
||||
return yield* FromIntersect(schema_, references_, path, value);
|
||||
case 'Iterator':
|
||||
return yield* FromIterator(schema_, references_, path, value);
|
||||
case 'Literal':
|
||||
return yield* FromLiteral(schema_, references_, path, value);
|
||||
case 'Never':
|
||||
return yield* FromNever(schema_, references_, path, value);
|
||||
case 'Not':
|
||||
return yield* FromNot(schema_, references_, path, value);
|
||||
case 'Null':
|
||||
return yield* FromNull(schema_, references_, path, value);
|
||||
case 'Number':
|
||||
return yield* FromNumber(schema_, references_, path, value);
|
||||
case 'Object':
|
||||
return yield* FromObject(schema_, references_, path, value);
|
||||
case 'Promise':
|
||||
return yield* FromPromise(schema_, references_, path, value);
|
||||
case 'Record':
|
||||
return yield* FromRecord(schema_, references_, path, value);
|
||||
case 'Ref':
|
||||
return yield* FromRef(schema_, references_, path, value);
|
||||
case 'RegExp':
|
||||
return yield* FromRegExp(schema_, references_, path, value);
|
||||
case 'String':
|
||||
return yield* FromString(schema_, references_, path, value);
|
||||
case 'Symbol':
|
||||
return yield* FromSymbol(schema_, references_, path, value);
|
||||
case 'TemplateLiteral':
|
||||
return yield* FromTemplateLiteral(schema_, references_, path, value);
|
||||
case 'This':
|
||||
return yield* FromThis(schema_, references_, path, value);
|
||||
case 'Tuple':
|
||||
return yield* FromTuple(schema_, references_, path, value);
|
||||
case 'Undefined':
|
||||
return yield* FromUndefined(schema_, references_, path, value);
|
||||
case 'Union':
|
||||
return yield* FromUnion(schema_, references_, path, value);
|
||||
case 'Uint8Array':
|
||||
return yield* FromUint8Array(schema_, references_, path, value);
|
||||
case 'Unknown':
|
||||
return yield* FromUnknown(schema_, references_, path, value);
|
||||
case 'Void':
|
||||
return yield* FromVoid(schema_, references_, path, value);
|
||||
default:
|
||||
if (!index_3.TypeRegistry.Has(schema_[index_8.Kind]))
|
||||
throw new ValueErrorsUnknownTypeError(schema);
|
||||
return yield* FromKind(schema_, references_, path, value);
|
||||
}
|
||||
}
|
||||
/** Returns an iterator for each error in this value. */
|
||||
function Errors(...args) {
|
||||
const iterator = args.length === 3 ? Visit(args[0], args[1], '', args[2]) : Visit(args[0], [], '', args[1]);
|
||||
return new ValueErrorIterator(iterator);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { TSchema } from '../type/schema/index';
|
||||
import { ValueErrorIterator, ValueErrorType } from './errors';
|
||||
/** Creates an error message using en-US as the default locale */
|
||||
export declare function DefaultErrorFunction(error: ErrorFunctionParameter): string;
|
||||
export type ErrorFunctionParameter = {
|
||||
/** The type of validation error */
|
||||
errorType: ValueErrorType;
|
||||
/** The path of the error */
|
||||
path: string;
|
||||
/** The schema associated with the error */
|
||||
schema: TSchema;
|
||||
/** The value associated with the error */
|
||||
value: unknown;
|
||||
/** Interior errors for this error */
|
||||
errors: ValueErrorIterator[];
|
||||
};
|
||||
export type ErrorFunction = (parameter: ErrorFunctionParameter) => string;
|
||||
/** Sets the error function used to generate error messages. */
|
||||
export declare function SetErrorFunction(callback: ErrorFunction): void;
|
||||
/** Gets the error function used to generate error messages */
|
||||
export declare function GetErrorFunction(): ErrorFunction;
|
||||
153
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/function.js
vendored
Normal file
153
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/function.js
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultErrorFunction = DefaultErrorFunction;
|
||||
exports.SetErrorFunction = SetErrorFunction;
|
||||
exports.GetErrorFunction = GetErrorFunction;
|
||||
const index_1 = require("../type/symbols/index");
|
||||
const errors_1 = require("./errors");
|
||||
/** Creates an error message using en-US as the default locale */
|
||||
function DefaultErrorFunction(error) {
|
||||
switch (error.errorType) {
|
||||
case errors_1.ValueErrorType.ArrayContains:
|
||||
return 'Expected array to contain at least one matching value';
|
||||
case errors_1.ValueErrorType.ArrayMaxContains:
|
||||
return `Expected array to contain no more than ${error.schema.maxContains} matching values`;
|
||||
case errors_1.ValueErrorType.ArrayMinContains:
|
||||
return `Expected array to contain at least ${error.schema.minContains} matching values`;
|
||||
case errors_1.ValueErrorType.ArrayMaxItems:
|
||||
return `Expected array length to be less or equal to ${error.schema.maxItems}`;
|
||||
case errors_1.ValueErrorType.ArrayMinItems:
|
||||
return `Expected array length to be greater or equal to ${error.schema.minItems}`;
|
||||
case errors_1.ValueErrorType.ArrayUniqueItems:
|
||||
return 'Expected array elements to be unique';
|
||||
case errors_1.ValueErrorType.Array:
|
||||
return 'Expected array';
|
||||
case errors_1.ValueErrorType.AsyncIterator:
|
||||
return 'Expected AsyncIterator';
|
||||
case errors_1.ValueErrorType.BigIntExclusiveMaximum:
|
||||
return `Expected bigint to be less than ${error.schema.exclusiveMaximum}`;
|
||||
case errors_1.ValueErrorType.BigIntExclusiveMinimum:
|
||||
return `Expected bigint to be greater than ${error.schema.exclusiveMinimum}`;
|
||||
case errors_1.ValueErrorType.BigIntMaximum:
|
||||
return `Expected bigint to be less or equal to ${error.schema.maximum}`;
|
||||
case errors_1.ValueErrorType.BigIntMinimum:
|
||||
return `Expected bigint to be greater or equal to ${error.schema.minimum}`;
|
||||
case errors_1.ValueErrorType.BigIntMultipleOf:
|
||||
return `Expected bigint to be a multiple of ${error.schema.multipleOf}`;
|
||||
case errors_1.ValueErrorType.BigInt:
|
||||
return 'Expected bigint';
|
||||
case errors_1.ValueErrorType.Boolean:
|
||||
return 'Expected boolean';
|
||||
case errors_1.ValueErrorType.DateExclusiveMinimumTimestamp:
|
||||
return `Expected Date timestamp to be greater than ${error.schema.exclusiveMinimumTimestamp}`;
|
||||
case errors_1.ValueErrorType.DateExclusiveMaximumTimestamp:
|
||||
return `Expected Date timestamp to be less than ${error.schema.exclusiveMaximumTimestamp}`;
|
||||
case errors_1.ValueErrorType.DateMinimumTimestamp:
|
||||
return `Expected Date timestamp to be greater or equal to ${error.schema.minimumTimestamp}`;
|
||||
case errors_1.ValueErrorType.DateMaximumTimestamp:
|
||||
return `Expected Date timestamp to be less or equal to ${error.schema.maximumTimestamp}`;
|
||||
case errors_1.ValueErrorType.DateMultipleOfTimestamp:
|
||||
return `Expected Date timestamp to be a multiple of ${error.schema.multipleOfTimestamp}`;
|
||||
case errors_1.ValueErrorType.Date:
|
||||
return 'Expected Date';
|
||||
case errors_1.ValueErrorType.Function:
|
||||
return 'Expected function';
|
||||
case errors_1.ValueErrorType.IntegerExclusiveMaximum:
|
||||
return `Expected integer to be less than ${error.schema.exclusiveMaximum}`;
|
||||
case errors_1.ValueErrorType.IntegerExclusiveMinimum:
|
||||
return `Expected integer to be greater than ${error.schema.exclusiveMinimum}`;
|
||||
case errors_1.ValueErrorType.IntegerMaximum:
|
||||
return `Expected integer to be less or equal to ${error.schema.maximum}`;
|
||||
case errors_1.ValueErrorType.IntegerMinimum:
|
||||
return `Expected integer to be greater or equal to ${error.schema.minimum}`;
|
||||
case errors_1.ValueErrorType.IntegerMultipleOf:
|
||||
return `Expected integer to be a multiple of ${error.schema.multipleOf}`;
|
||||
case errors_1.ValueErrorType.Integer:
|
||||
return 'Expected integer';
|
||||
case errors_1.ValueErrorType.IntersectUnevaluatedProperties:
|
||||
return 'Unexpected property';
|
||||
case errors_1.ValueErrorType.Intersect:
|
||||
return 'Expected all values to match';
|
||||
case errors_1.ValueErrorType.Iterator:
|
||||
return 'Expected Iterator';
|
||||
case errors_1.ValueErrorType.Literal:
|
||||
return `Expected ${typeof error.schema.const === 'string' ? `'${error.schema.const}'` : error.schema.const}`;
|
||||
case errors_1.ValueErrorType.Never:
|
||||
return 'Never';
|
||||
case errors_1.ValueErrorType.Not:
|
||||
return 'Value should not match';
|
||||
case errors_1.ValueErrorType.Null:
|
||||
return 'Expected null';
|
||||
case errors_1.ValueErrorType.NumberExclusiveMaximum:
|
||||
return `Expected number to be less than ${error.schema.exclusiveMaximum}`;
|
||||
case errors_1.ValueErrorType.NumberExclusiveMinimum:
|
||||
return `Expected number to be greater than ${error.schema.exclusiveMinimum}`;
|
||||
case errors_1.ValueErrorType.NumberMaximum:
|
||||
return `Expected number to be less or equal to ${error.schema.maximum}`;
|
||||
case errors_1.ValueErrorType.NumberMinimum:
|
||||
return `Expected number to be greater or equal to ${error.schema.minimum}`;
|
||||
case errors_1.ValueErrorType.NumberMultipleOf:
|
||||
return `Expected number to be a multiple of ${error.schema.multipleOf}`;
|
||||
case errors_1.ValueErrorType.Number:
|
||||
return 'Expected number';
|
||||
case errors_1.ValueErrorType.Object:
|
||||
return 'Expected object';
|
||||
case errors_1.ValueErrorType.ObjectAdditionalProperties:
|
||||
return 'Unexpected property';
|
||||
case errors_1.ValueErrorType.ObjectMaxProperties:
|
||||
return `Expected object to have no more than ${error.schema.maxProperties} properties`;
|
||||
case errors_1.ValueErrorType.ObjectMinProperties:
|
||||
return `Expected object to have at least ${error.schema.minProperties} properties`;
|
||||
case errors_1.ValueErrorType.ObjectRequiredProperty:
|
||||
return 'Expected required property';
|
||||
case errors_1.ValueErrorType.Promise:
|
||||
return 'Expected Promise';
|
||||
case errors_1.ValueErrorType.RegExp:
|
||||
return 'Expected string to match regular expression';
|
||||
case errors_1.ValueErrorType.StringFormatUnknown:
|
||||
return `Unknown format '${error.schema.format}'`;
|
||||
case errors_1.ValueErrorType.StringFormat:
|
||||
return `Expected string to match '${error.schema.format}' format`;
|
||||
case errors_1.ValueErrorType.StringMaxLength:
|
||||
return `Expected string length less or equal to ${error.schema.maxLength}`;
|
||||
case errors_1.ValueErrorType.StringMinLength:
|
||||
return `Expected string length greater or equal to ${error.schema.minLength}`;
|
||||
case errors_1.ValueErrorType.StringPattern:
|
||||
return `Expected string to match '${error.schema.pattern}'`;
|
||||
case errors_1.ValueErrorType.String:
|
||||
return 'Expected string';
|
||||
case errors_1.ValueErrorType.Symbol:
|
||||
return 'Expected symbol';
|
||||
case errors_1.ValueErrorType.TupleLength:
|
||||
return `Expected tuple to have ${error.schema.maxItems || 0} elements`;
|
||||
case errors_1.ValueErrorType.Tuple:
|
||||
return 'Expected tuple';
|
||||
case errors_1.ValueErrorType.Uint8ArrayMaxByteLength:
|
||||
return `Expected byte length less or equal to ${error.schema.maxByteLength}`;
|
||||
case errors_1.ValueErrorType.Uint8ArrayMinByteLength:
|
||||
return `Expected byte length greater or equal to ${error.schema.minByteLength}`;
|
||||
case errors_1.ValueErrorType.Uint8Array:
|
||||
return 'Expected Uint8Array';
|
||||
case errors_1.ValueErrorType.Undefined:
|
||||
return 'Expected undefined';
|
||||
case errors_1.ValueErrorType.Union:
|
||||
return 'Expected union value';
|
||||
case errors_1.ValueErrorType.Void:
|
||||
return 'Expected void';
|
||||
case errors_1.ValueErrorType.Kind:
|
||||
return `Expected kind '${error.schema[index_1.Kind]}'`;
|
||||
default:
|
||||
return 'Unknown error type';
|
||||
}
|
||||
}
|
||||
/** Manages error message providers */
|
||||
let errorFunction = DefaultErrorFunction;
|
||||
/** Sets the error function used to generate error messages. */
|
||||
function SetErrorFunction(callback) {
|
||||
errorFunction = callback;
|
||||
}
|
||||
/** Gets the error function used to generate error messages */
|
||||
function GetErrorFunction() {
|
||||
return errorFunction;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * from './errors';
|
||||
export * from './function';
|
||||
19
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/index.js
vendored
Normal file
19
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/errors/index.js
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./errors"), exports);
|
||||
__exportStar(require("./function"), exports);
|
||||
71
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/index.d.ts
vendored
Normal file
71
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
export * from './type/clone/index';
|
||||
export * from './type/create/index';
|
||||
export * from './type/error/index';
|
||||
export * from './type/guard/index';
|
||||
export * from './type/helpers/index';
|
||||
export * from './type/patterns/index';
|
||||
export * from './type/registry/index';
|
||||
export * from './type/sets/index';
|
||||
export * from './type/symbols/index';
|
||||
export * from './type/any/index';
|
||||
export * from './type/array/index';
|
||||
export * from './type/argument/index';
|
||||
export * from './type/async-iterator/index';
|
||||
export * from './type/awaited/index';
|
||||
export * from './type/bigint/index';
|
||||
export * from './type/boolean/index';
|
||||
export * from './type/composite/index';
|
||||
export * from './type/const/index';
|
||||
export * from './type/constructor/index';
|
||||
export * from './type/constructor-parameters/index';
|
||||
export * from './type/date/index';
|
||||
export * from './type/enum/index';
|
||||
export * from './type/exclude/index';
|
||||
export * from './type/extends/index';
|
||||
export * from './type/extract/index';
|
||||
export * from './type/function/index';
|
||||
export * from './type/indexed/index';
|
||||
export * from './type/instance-type/index';
|
||||
export * from './type/instantiate/index';
|
||||
export * from './type/integer/index';
|
||||
export * from './type/intersect/index';
|
||||
export * from './type/iterator/index';
|
||||
export * from './type/intrinsic/index';
|
||||
export * from './type/keyof/index';
|
||||
export * from './type/literal/index';
|
||||
export * from './type/module/index';
|
||||
export * from './type/mapped/index';
|
||||
export * from './type/never/index';
|
||||
export * from './type/not/index';
|
||||
export * from './type/null/index';
|
||||
export * from './type/number/index';
|
||||
export * from './type/object/index';
|
||||
export * from './type/omit/index';
|
||||
export * from './type/optional/index';
|
||||
export * from './type/parameters/index';
|
||||
export * from './type/partial/index';
|
||||
export * from './type/pick/index';
|
||||
export * from './type/promise/index';
|
||||
export * from './type/readonly/index';
|
||||
export * from './type/readonly-optional/index';
|
||||
export * from './type/record/index';
|
||||
export * from './type/recursive/index';
|
||||
export * from './type/ref/index';
|
||||
export * from './type/regexp/index';
|
||||
export * from './type/required/index';
|
||||
export * from './type/rest/index';
|
||||
export * from './type/return-type/index';
|
||||
export * from './type/schema/index';
|
||||
export * from './type/static/index';
|
||||
export * from './type/string/index';
|
||||
export * from './type/symbol/index';
|
||||
export * from './type/template-literal/index';
|
||||
export * from './type/transform/index';
|
||||
export * from './type/tuple/index';
|
||||
export * from './type/uint8array/index';
|
||||
export * from './type/undefined/index';
|
||||
export * from './type/union/index';
|
||||
export * from './type/unknown/index';
|
||||
export * from './type/unsafe/index';
|
||||
export * from './type/void/index';
|
||||
export * from './type/type/index';
|
||||
97
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/index.js
vendored
Normal file
97
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/index.js
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// ------------------------------------------------------------------
|
||||
// Infrastructure
|
||||
// ------------------------------------------------------------------
|
||||
__exportStar(require("./type/clone/index"), exports);
|
||||
__exportStar(require("./type/create/index"), exports);
|
||||
__exportStar(require("./type/error/index"), exports);
|
||||
__exportStar(require("./type/guard/index"), exports);
|
||||
__exportStar(require("./type/helpers/index"), exports);
|
||||
__exportStar(require("./type/patterns/index"), exports);
|
||||
__exportStar(require("./type/registry/index"), exports);
|
||||
__exportStar(require("./type/sets/index"), exports);
|
||||
__exportStar(require("./type/symbols/index"), exports);
|
||||
// ------------------------------------------------------------------
|
||||
// Types
|
||||
// ------------------------------------------------------------------
|
||||
__exportStar(require("./type/any/index"), exports);
|
||||
__exportStar(require("./type/array/index"), exports);
|
||||
__exportStar(require("./type/argument/index"), exports);
|
||||
__exportStar(require("./type/async-iterator/index"), exports);
|
||||
__exportStar(require("./type/awaited/index"), exports);
|
||||
__exportStar(require("./type/bigint/index"), exports);
|
||||
__exportStar(require("./type/boolean/index"), exports);
|
||||
__exportStar(require("./type/composite/index"), exports);
|
||||
__exportStar(require("./type/const/index"), exports);
|
||||
__exportStar(require("./type/constructor/index"), exports);
|
||||
__exportStar(require("./type/constructor-parameters/index"), exports);
|
||||
__exportStar(require("./type/date/index"), exports);
|
||||
__exportStar(require("./type/enum/index"), exports);
|
||||
__exportStar(require("./type/exclude/index"), exports);
|
||||
__exportStar(require("./type/extends/index"), exports);
|
||||
__exportStar(require("./type/extract/index"), exports);
|
||||
__exportStar(require("./type/function/index"), exports);
|
||||
__exportStar(require("./type/indexed/index"), exports);
|
||||
__exportStar(require("./type/instance-type/index"), exports);
|
||||
__exportStar(require("./type/instantiate/index"), exports);
|
||||
__exportStar(require("./type/integer/index"), exports);
|
||||
__exportStar(require("./type/intersect/index"), exports);
|
||||
__exportStar(require("./type/iterator/index"), exports);
|
||||
__exportStar(require("./type/intrinsic/index"), exports);
|
||||
__exportStar(require("./type/keyof/index"), exports);
|
||||
__exportStar(require("./type/literal/index"), exports);
|
||||
__exportStar(require("./type/module/index"), exports);
|
||||
__exportStar(require("./type/mapped/index"), exports);
|
||||
__exportStar(require("./type/never/index"), exports);
|
||||
__exportStar(require("./type/not/index"), exports);
|
||||
__exportStar(require("./type/null/index"), exports);
|
||||
__exportStar(require("./type/number/index"), exports);
|
||||
__exportStar(require("./type/object/index"), exports);
|
||||
__exportStar(require("./type/omit/index"), exports);
|
||||
__exportStar(require("./type/optional/index"), exports);
|
||||
__exportStar(require("./type/parameters/index"), exports);
|
||||
__exportStar(require("./type/partial/index"), exports);
|
||||
__exportStar(require("./type/pick/index"), exports);
|
||||
__exportStar(require("./type/promise/index"), exports);
|
||||
__exportStar(require("./type/readonly/index"), exports);
|
||||
__exportStar(require("./type/readonly-optional/index"), exports);
|
||||
__exportStar(require("./type/record/index"), exports);
|
||||
__exportStar(require("./type/recursive/index"), exports);
|
||||
__exportStar(require("./type/ref/index"), exports);
|
||||
__exportStar(require("./type/regexp/index"), exports);
|
||||
__exportStar(require("./type/required/index"), exports);
|
||||
__exportStar(require("./type/rest/index"), exports);
|
||||
__exportStar(require("./type/return-type/index"), exports);
|
||||
__exportStar(require("./type/schema/index"), exports);
|
||||
__exportStar(require("./type/static/index"), exports);
|
||||
__exportStar(require("./type/string/index"), exports);
|
||||
__exportStar(require("./type/symbol/index"), exports);
|
||||
__exportStar(require("./type/template-literal/index"), exports);
|
||||
__exportStar(require("./type/transform/index"), exports);
|
||||
__exportStar(require("./type/tuple/index"), exports);
|
||||
__exportStar(require("./type/uint8array/index"), exports);
|
||||
__exportStar(require("./type/undefined/index"), exports);
|
||||
__exportStar(require("./type/union/index"), exports);
|
||||
__exportStar(require("./type/unknown/index"), exports);
|
||||
__exportStar(require("./type/unsafe/index"), exports);
|
||||
__exportStar(require("./type/void/index"), exports);
|
||||
// ------------------------------------------------------------------
|
||||
// Type.*
|
||||
// ------------------------------------------------------------------
|
||||
__exportStar(require("./type/type/index"), exports);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * as Runtime from './runtime/index';
|
||||
export * as Static from './static/index';
|
||||
39
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/parser/index.js
vendored
Normal file
39
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/parser/index.js
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Static = exports.Runtime = void 0;
|
||||
exports.Runtime = __importStar(require("./runtime/index"));
|
||||
exports.Static = __importStar(require("./static/index"));
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import { IArray, IConst, IContext, IIdent, INumber, IOptional, IRef, IString, ITuple, IUnion } from './types';
|
||||
/** Returns true if the value is a Array Parser */
|
||||
export declare function IsArray(value: unknown): value is IArray;
|
||||
/** Returns true if the value is a Const Parser */
|
||||
export declare function IsConst(value: unknown): value is IConst;
|
||||
/** Returns true if the value is a Context Parser */
|
||||
export declare function IsContext(value: unknown): value is IContext;
|
||||
/** Returns true if the value is a Ident Parser */
|
||||
export declare function IsIdent(value: unknown): value is IIdent;
|
||||
/** Returns true if the value is a Number Parser */
|
||||
export declare function IsNumber(value: unknown): value is INumber;
|
||||
/** Returns true if the value is a Optional Parser */
|
||||
export declare function IsOptional(value: unknown): value is IOptional;
|
||||
/** Returns true if the value is a Ref Parser */
|
||||
export declare function IsRef(value: unknown): value is IRef;
|
||||
/** Returns true if the value is a String Parser */
|
||||
export declare function IsString(value: unknown): value is IString;
|
||||
/** Returns true if the value is a Tuple Parser */
|
||||
export declare function IsTuple(value: unknown): value is ITuple;
|
||||
/** Returns true if the value is a Union Parser */
|
||||
export declare function IsUnion(value: unknown): value is IUnion;
|
||||
/** Returns true if the value is a Parser */
|
||||
export declare function IsParser(value: unknown): value is IContext<unknown> | IUnion<unknown> | IArray<unknown> | IConst<unknown> | IIdent<unknown> | INumber<unknown> | IOptional<unknown> | IRef<unknown> | IString<unknown> | ITuple<unknown>;
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsArray = IsArray;
|
||||
exports.IsConst = IsConst;
|
||||
exports.IsContext = IsContext;
|
||||
exports.IsIdent = IsIdent;
|
||||
exports.IsNumber = IsNumber;
|
||||
exports.IsOptional = IsOptional;
|
||||
exports.IsRef = IsRef;
|
||||
exports.IsString = IsString;
|
||||
exports.IsTuple = IsTuple;
|
||||
exports.IsUnion = IsUnion;
|
||||
exports.IsParser = IsParser;
|
||||
// ------------------------------------------------------------------
|
||||
// Value Guard
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function HasPropertyKey(value, key) {
|
||||
return key in value;
|
||||
}
|
||||
// prettier-ignore
|
||||
function IsObjectValue(value) {
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
// prettier-ignore
|
||||
function IsArrayValue(value) {
|
||||
return globalThis.Array.isArray(value);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Parser Guard
|
||||
// ------------------------------------------------------------------
|
||||
/** Returns true if the value is a Array Parser */
|
||||
function IsArray(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Array' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser);
|
||||
}
|
||||
/** Returns true if the value is a Const Parser */
|
||||
function IsConst(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Const' && HasPropertyKey(value, 'value') && typeof value.value === 'string';
|
||||
}
|
||||
/** Returns true if the value is a Context Parser */
|
||||
function IsContext(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Context' && HasPropertyKey(value, 'left') && IsParser(value.left) && HasPropertyKey(value, 'right') && IsParser(value.right);
|
||||
}
|
||||
/** Returns true if the value is a Ident Parser */
|
||||
function IsIdent(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ident';
|
||||
}
|
||||
/** Returns true if the value is a Number Parser */
|
||||
function IsNumber(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Number';
|
||||
}
|
||||
/** Returns true if the value is a Optional Parser */
|
||||
function IsOptional(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Optional' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser);
|
||||
}
|
||||
/** Returns true if the value is a Ref Parser */
|
||||
function IsRef(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ref' && HasPropertyKey(value, 'ref') && typeof value.ref === 'string';
|
||||
}
|
||||
/** Returns true if the value is a String Parser */
|
||||
function IsString(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'String' && HasPropertyKey(value, 'options') && IsArrayValue(value.options);
|
||||
}
|
||||
/** Returns true if the value is a Tuple Parser */
|
||||
function IsTuple(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Tuple' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers);
|
||||
}
|
||||
/** Returns true if the value is a Union Parser */
|
||||
function IsUnion(value) {
|
||||
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Union' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers);
|
||||
}
|
||||
/** Returns true if the value is a Parser */
|
||||
function IsParser(value) {
|
||||
// prettier-ignore
|
||||
return (IsArray(value) ||
|
||||
IsConst(value) ||
|
||||
IsContext(value) ||
|
||||
IsIdent(value) ||
|
||||
IsNumber(value) ||
|
||||
IsOptional(value) ||
|
||||
IsRef(value) ||
|
||||
IsString(value) ||
|
||||
IsTuple(value) ||
|
||||
IsUnion(value));
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export * as Guard from './guard';
|
||||
export * as Token from './token';
|
||||
export * from './types';
|
||||
export * from './module';
|
||||
export * from './parse';
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Token = exports.Guard = void 0;
|
||||
exports.Guard = __importStar(require("./guard"));
|
||||
exports.Token = __importStar(require("./token"));
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./module"), exports);
|
||||
__exportStar(require("./parse"), exports);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import * as Types from './types';
|
||||
export declare class Module<Properties extends Types.IModuleProperties = Types.IModuleProperties> {
|
||||
private readonly properties;
|
||||
constructor(properties: Properties);
|
||||
/** Parses using one of the parsers defined on this instance */
|
||||
Parse<Key extends keyof Properties>(key: Key, content: string, context: unknown): [] | [Types.StaticParser<Properties[Key]>, string];
|
||||
/** Parses using one of the parsers defined on this instance */
|
||||
Parse<Key extends keyof Properties>(key: Key, content: string): [] | [Types.StaticParser<Properties[Key]>, string];
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Module = void 0;
|
||||
const parse_1 = require("./parse");
|
||||
// ------------------------------------------------------------------
|
||||
// Module
|
||||
// ------------------------------------------------------------------
|
||||
class Module {
|
||||
constructor(properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
/** Parses using one of the parsers defined on this instance */
|
||||
Parse(...args) {
|
||||
// prettier-ignore
|
||||
const [key, content, context] = (args.length === 3 ? [args[0], args[1], args[2]] :
|
||||
args.length === 2 ? [args[0], args[1], undefined] :
|
||||
(() => { throw Error('Invalid parse arguments'); })());
|
||||
return (0, parse_1.Parse)(this.properties, this.properties[key], content, context);
|
||||
}
|
||||
}
|
||||
exports.Module = Module;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import * as Types from './types';
|
||||
/** Parses content using the given Parser */
|
||||
export declare function Parse<Parser extends Types.IParser>(moduleProperties: Types.IModuleProperties, parser: Parser, code: string, context: unknown): [] | [Types.StaticParser<Parser>, string];
|
||||
/** Parses content using the given Parser */
|
||||
export declare function Parse<Parser extends Types.IParser>(moduleProperties: Types.IModuleProperties, parser: Parser, code: string): [] | [Types.StaticParser<Parser>, string];
|
||||
/** Parses content using the given Parser */
|
||||
export declare function Parse<Parser extends Types.IParser>(parser: Parser, content: string, context: unknown): [] | [Types.StaticParser<Parser>, string];
|
||||
/** Parses content using the given Parser */
|
||||
export declare function Parse<Parser extends Types.IParser>(parser: Parser, content: string): [] | [Types.StaticParser<Parser>, string];
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Parse = Parse;
|
||||
const Guard = __importStar(require("./guard"));
|
||||
const Token = __importStar(require("./token"));
|
||||
// ------------------------------------------------------------------
|
||||
// Context
|
||||
// ------------------------------------------------------------------
|
||||
function ParseContext(moduleProperties, left, right, code, context) {
|
||||
const result = ParseParser(moduleProperties, left, code, context);
|
||||
return result.length === 2 ? ParseParser(moduleProperties, right, result[1], result[0]) : [];
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Array
|
||||
// ------------------------------------------------------------------
|
||||
function ParseArray(moduleProperties, parser, code, context) {
|
||||
const buffer = [];
|
||||
let rest = code;
|
||||
while (rest.length > 0) {
|
||||
const result = ParseParser(moduleProperties, parser, rest, context);
|
||||
if (result.length === 0)
|
||||
return [buffer, rest];
|
||||
buffer.push(result[0]);
|
||||
rest = result[1];
|
||||
}
|
||||
return [buffer, rest];
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Const
|
||||
// ------------------------------------------------------------------
|
||||
function ParseConst(value, code, context) {
|
||||
return Token.Const(value, code);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Ident
|
||||
// ------------------------------------------------------------------
|
||||
function ParseIdent(code, _context) {
|
||||
return Token.Ident(code);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Number
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function ParseNumber(code, _context) {
|
||||
return Token.Number(code);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Optional
|
||||
// ------------------------------------------------------------------
|
||||
function ParseOptional(moduleProperties, parser, code, context) {
|
||||
const result = ParseParser(moduleProperties, parser, code, context);
|
||||
return (result.length === 2 ? [[result[0]], result[1]] : [[], code]);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Ref
|
||||
// ------------------------------------------------------------------
|
||||
function ParseRef(moduleProperties, ref, code, context) {
|
||||
const parser = moduleProperties[ref];
|
||||
if (!Guard.IsParser(parser))
|
||||
throw Error(`Cannot dereference Parser '${ref}'`);
|
||||
return ParseParser(moduleProperties, parser, code, context);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// String
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function ParseString(options, code, _context) {
|
||||
return Token.String(options, code);
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Tuple
|
||||
// ------------------------------------------------------------------
|
||||
function ParseTuple(moduleProperties, parsers, code, context) {
|
||||
const buffer = [];
|
||||
let rest = code;
|
||||
for (const parser of parsers) {
|
||||
const result = ParseParser(moduleProperties, parser, rest, context);
|
||||
if (result.length === 0)
|
||||
return [];
|
||||
buffer.push(result[0]);
|
||||
rest = result[1];
|
||||
}
|
||||
return [buffer, rest];
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Union
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function ParseUnion(moduleProperties, parsers, code, context) {
|
||||
for (const parser of parsers) {
|
||||
const result = ParseParser(moduleProperties, parser, code, context);
|
||||
if (result.length === 0)
|
||||
continue;
|
||||
return result;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Parser
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function ParseParser(moduleProperties, parser, code, context) {
|
||||
const result = (Guard.IsContext(parser) ? ParseContext(moduleProperties, parser.left, parser.right, code, context) :
|
||||
Guard.IsArray(parser) ? ParseArray(moduleProperties, parser.parser, code, context) :
|
||||
Guard.IsConst(parser) ? ParseConst(parser.value, code, context) :
|
||||
Guard.IsIdent(parser) ? ParseIdent(code, context) :
|
||||
Guard.IsNumber(parser) ? ParseNumber(code, context) :
|
||||
Guard.IsOptional(parser) ? ParseOptional(moduleProperties, parser.parser, code, context) :
|
||||
Guard.IsRef(parser) ? ParseRef(moduleProperties, parser.ref, code, context) :
|
||||
Guard.IsString(parser) ? ParseString(parser.options, code, context) :
|
||||
Guard.IsTuple(parser) ? ParseTuple(moduleProperties, parser.parsers, code, context) :
|
||||
Guard.IsUnion(parser) ? ParseUnion(moduleProperties, parser.parsers, code, context) :
|
||||
[]);
|
||||
return (result.length === 2
|
||||
? [parser.mapping(result[0], context), result[1]]
|
||||
: result);
|
||||
}
|
||||
/** Parses content using the given parser */
|
||||
// prettier-ignore
|
||||
function Parse(...args) {
|
||||
const withModuleProperties = typeof args[1] === 'string' ? false : true;
|
||||
const [moduleProperties, parser, content, context] = withModuleProperties
|
||||
? [args[0], args[1], args[2], args[3]]
|
||||
: [{}, args[0], args[1], args[2]];
|
||||
return ParseParser(moduleProperties, parser, content, context);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/** Takes the next constant string value skipping any whitespace */
|
||||
export declare function Const(value: string, code: string): [] | [string, string];
|
||||
/** Scans for the next Ident token */
|
||||
export declare function Ident(code: string): [] | [string, string];
|
||||
/** Scans for the next number token */
|
||||
export declare function Number(code: string): [string, string] | [];
|
||||
/** Scans the next Literal String value */
|
||||
export declare function String(options: string[], code: string): [string, string] | [];
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Const = Const;
|
||||
exports.Ident = Ident;
|
||||
exports.Number = Number;
|
||||
exports.String = String;
|
||||
// ------------------------------------------------------------------
|
||||
// Chars
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
var Chars;
|
||||
(function (Chars) {
|
||||
/** Returns true if the char code is a whitespace */
|
||||
function IsWhitespace(value) {
|
||||
return value === 32;
|
||||
}
|
||||
Chars.IsWhitespace = IsWhitespace;
|
||||
/** Returns true if the char code is a newline */
|
||||
function IsNewline(value) {
|
||||
return value === 10;
|
||||
}
|
||||
Chars.IsNewline = IsNewline;
|
||||
/** Returns true if the char code is a alpha */
|
||||
function IsAlpha(value) {
|
||||
return ((value >= 65 && value <= 90) || // A-Z
|
||||
(value >= 97 && value <= 122) // a-z
|
||||
);
|
||||
}
|
||||
Chars.IsAlpha = IsAlpha;
|
||||
/** Returns true if the char code is zero */
|
||||
function IsZero(value) {
|
||||
return value === 48;
|
||||
}
|
||||
Chars.IsZero = IsZero;
|
||||
/** Returns true if the char code is non-zero */
|
||||
function IsNonZero(value) {
|
||||
return value >= 49 && value <= 57;
|
||||
}
|
||||
Chars.IsNonZero = IsNonZero;
|
||||
/** Returns true if the char code is a digit */
|
||||
function IsDigit(value) {
|
||||
return (IsNonZero(value) ||
|
||||
IsZero(value));
|
||||
}
|
||||
Chars.IsDigit = IsDigit;
|
||||
/** Returns true if the char code is a dot */
|
||||
function IsDot(value) {
|
||||
return value === 46;
|
||||
}
|
||||
Chars.IsDot = IsDot;
|
||||
/** Returns true if this char code is a underscore */
|
||||
function IsUnderscore(value) {
|
||||
return value === 95;
|
||||
}
|
||||
Chars.IsUnderscore = IsUnderscore;
|
||||
/** Returns true if this char code is a dollar sign */
|
||||
function IsDollarSign(value) {
|
||||
return value === 36;
|
||||
}
|
||||
Chars.IsDollarSign = IsDollarSign;
|
||||
})(Chars || (Chars = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// Trim
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
var Trim;
|
||||
(function (Trim) {
|
||||
/** Trims Whitespace and retains Newline, Tabspaces, etc. */
|
||||
function TrimWhitespaceOnly(code) {
|
||||
for (let i = 0; i < code.length; i++) {
|
||||
if (Chars.IsWhitespace(code.charCodeAt(i)))
|
||||
continue;
|
||||
return code.slice(i);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
Trim.TrimWhitespaceOnly = TrimWhitespaceOnly;
|
||||
/** Trims Whitespace including Newline, Tabspaces, etc. */
|
||||
function TrimAll(code) {
|
||||
return code.trimStart();
|
||||
}
|
||||
Trim.TrimAll = TrimAll;
|
||||
})(Trim || (Trim = {}));
|
||||
// ------------------------------------------------------------------
|
||||
// Const
|
||||
// ------------------------------------------------------------------
|
||||
/** Checks the value matches the next string */
|
||||
// prettier-ignore
|
||||
function NextTokenCheck(value, code) {
|
||||
if (value.length > code.length)
|
||||
return false;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (value.charCodeAt(i) !== code.charCodeAt(i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/** Gets the next constant string value or empty if no match */
|
||||
// prettier-ignore
|
||||
function NextConst(value, code) {
|
||||
return NextTokenCheck(value, code)
|
||||
? [code.slice(0, value.length), code.slice(value.length)]
|
||||
: [];
|
||||
}
|
||||
/** Takes the next constant string value skipping any whitespace */
|
||||
// prettier-ignore
|
||||
function Const(value, code) {
|
||||
if (value.length === 0)
|
||||
return ['', code];
|
||||
const char_0 = value.charCodeAt(0);
|
||||
return (Chars.IsNewline(char_0) ? NextConst(value, Trim.TrimWhitespaceOnly(code)) :
|
||||
Chars.IsWhitespace(char_0) ? NextConst(value, code) :
|
||||
NextConst(value, Trim.TrimAll(code)));
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Ident
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function IdentIsFirst(char) {
|
||||
return (Chars.IsAlpha(char) ||
|
||||
Chars.IsDollarSign(char) ||
|
||||
Chars.IsUnderscore(char));
|
||||
}
|
||||
// prettier-ignore
|
||||
function IdentIsRest(char) {
|
||||
return (Chars.IsAlpha(char) ||
|
||||
Chars.IsDigit(char) ||
|
||||
Chars.IsDollarSign(char) ||
|
||||
Chars.IsUnderscore(char));
|
||||
}
|
||||
// prettier-ignore
|
||||
function NextIdent(code) {
|
||||
if (!IdentIsFirst(code.charCodeAt(0)))
|
||||
return [];
|
||||
for (let i = 1; i < code.length; i++) {
|
||||
const char = code.charCodeAt(i);
|
||||
if (IdentIsRest(char))
|
||||
continue;
|
||||
const slice = code.slice(0, i);
|
||||
const rest = code.slice(i);
|
||||
return [slice, rest];
|
||||
}
|
||||
return [code, ''];
|
||||
}
|
||||
/** Scans for the next Ident token */
|
||||
// prettier-ignore
|
||||
function Ident(code) {
|
||||
return NextIdent(Trim.TrimAll(code));
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// Number
|
||||
// ------------------------------------------------------------------
|
||||
/** Checks that the next number is not a leading zero */
|
||||
// prettier-ignore
|
||||
function NumberLeadingZeroCheck(code, index) {
|
||||
const char_0 = code.charCodeAt(index + 0);
|
||||
const char_1 = code.charCodeAt(index + 1);
|
||||
return ((
|
||||
// 1-9
|
||||
Chars.IsNonZero(char_0)) || (
|
||||
// 0
|
||||
Chars.IsZero(char_0) &&
|
||||
!Chars.IsDigit(char_1)) || (
|
||||
// 0.
|
||||
Chars.IsZero(char_0) &&
|
||||
Chars.IsDot(char_1)) || (
|
||||
// .0
|
||||
Chars.IsDot(char_0) &&
|
||||
Chars.IsDigit(char_1)));
|
||||
}
|
||||
/** Gets the next number token */
|
||||
// prettier-ignore
|
||||
function NextNumber(code) {
|
||||
const negated = code.charAt(0) === '-';
|
||||
const index = negated ? 1 : 0;
|
||||
if (!NumberLeadingZeroCheck(code, index)) {
|
||||
return [];
|
||||
}
|
||||
const dash = negated ? '-' : '';
|
||||
let hasDot = false;
|
||||
for (let i = index; i < code.length; i++) {
|
||||
const char_i = code.charCodeAt(i);
|
||||
if (Chars.IsDigit(char_i)) {
|
||||
continue;
|
||||
}
|
||||
if (Chars.IsDot(char_i)) {
|
||||
if (hasDot) {
|
||||
const slice = code.slice(index, i);
|
||||
const rest = code.slice(i);
|
||||
return [`${dash}${slice}`, rest];
|
||||
}
|
||||
hasDot = true;
|
||||
continue;
|
||||
}
|
||||
const slice = code.slice(index, i);
|
||||
const rest = code.slice(i);
|
||||
return [`${dash}${slice}`, rest];
|
||||
}
|
||||
return [code, ''];
|
||||
}
|
||||
/** Scans for the next number token */
|
||||
// prettier-ignore
|
||||
function Number(code) {
|
||||
return NextNumber(Trim.TrimAll(code));
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
// String
|
||||
// ------------------------------------------------------------------
|
||||
// prettier-ignore
|
||||
function NextString(options, code) {
|
||||
const first = code.charAt(0);
|
||||
if (!options.includes(first))
|
||||
return [];
|
||||
const quote = first;
|
||||
for (let i = 1; i < code.length; i++) {
|
||||
const char = code.charAt(i);
|
||||
if (char === quote) {
|
||||
const slice = code.slice(1, i);
|
||||
const rest = code.slice(i + 1);
|
||||
return [slice, rest];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
/** Scans the next Literal String value */
|
||||
// prettier-ignore
|
||||
function String(options, code) {
|
||||
return NextString(options, Trim.TrimAll(code));
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
export type IModuleProperties = Record<PropertyKey, IParser>;
|
||||
/** Force output static type evaluation for Arrays */
|
||||
export type StaticEnsure<T> = T extends infer R ? R : never;
|
||||
/** Infers the Output Parameter for a Parser */
|
||||
export type StaticParser<Parser extends IParser> = Parser extends IParser<infer Output extends unknown> ? Output : unknown;
|
||||
export type IMapping<Input extends unknown = any, Output extends unknown = unknown> = (input: Input, context: any) => Output;
|
||||
/** Maps input to output. This is the default Mapping */
|
||||
export declare const Identity: (value: unknown) => unknown;
|
||||
/** Maps the output as the given parameter T */
|
||||
export declare const As: <T>(mapping: T) => ((value: unknown) => T);
|
||||
export interface IParser<Output extends unknown = unknown> {
|
||||
type: string;
|
||||
mapping: IMapping<any, Output>;
|
||||
}
|
||||
export type ContextParameter<_Left extends IParser, Right extends IParser> = (StaticParser<Right>);
|
||||
export interface IContext<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Context';
|
||||
left: IParser;
|
||||
right: IParser;
|
||||
}
|
||||
/** `[Context]` Creates a Context Parser */
|
||||
export declare function Context<Left extends IParser, Right extends IParser, Mapping extends IMapping = IMapping<ContextParameter<Left, Right>>>(left: Left, right: Right, mapping: Mapping): IContext<ReturnType<Mapping>>;
|
||||
/** `[Context]` Creates a Context Parser */
|
||||
export declare function Context<Left extends IParser, Right extends IParser>(left: Left, right: Right): IContext<ContextParameter<Left, Right>>;
|
||||
export type ArrayParameter<Parser extends IParser> = StaticEnsure<StaticParser<Parser>[]>;
|
||||
export interface IArray<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Array';
|
||||
parser: IParser;
|
||||
}
|
||||
/** `[EBNF]` Creates an Array Parser */
|
||||
export declare function Array<Parser extends IParser, Mapping extends IMapping = IMapping<ArrayParameter<Parser>>>(parser: Parser, mapping: Mapping): IArray<ReturnType<Mapping>>;
|
||||
/** `[EBNF]` Creates an Array Parser */
|
||||
export declare function Array<Parser extends IParser>(parser: Parser): IArray<ArrayParameter<Parser>>;
|
||||
export interface IConst<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Const';
|
||||
value: string;
|
||||
}
|
||||
/** `[TERM]` Creates a Const Parser */
|
||||
export declare function Const<Value extends string, Mapping extends IMapping<Value>>(value: Value, mapping: Mapping): IConst<ReturnType<Mapping>>;
|
||||
/** `[TERM]` Creates a Const Parser */
|
||||
export declare function Const<Value extends string>(value: Value): IConst<Value>;
|
||||
export interface IRef<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Ref';
|
||||
ref: string;
|
||||
}
|
||||
/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */
|
||||
export declare function Ref<Type extends unknown, Mapping extends IMapping<Type>>(ref: string, mapping: Mapping): IRef<ReturnType<Mapping>>;
|
||||
/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */
|
||||
export declare function Ref<Type extends unknown>(ref: string): IRef<Type>;
|
||||
export interface IString<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'String';
|
||||
options: string[];
|
||||
}
|
||||
/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */
|
||||
export declare function String<Mapping extends IMapping<string>>(options: string[], mapping: Mapping): IString<ReturnType<Mapping>>;
|
||||
/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */
|
||||
export declare function String(options: string[]): IString<string>;
|
||||
export interface IIdent<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Ident';
|
||||
}
|
||||
/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */
|
||||
export declare function Ident<Mapping extends IMapping<string>>(mapping: Mapping): IIdent<ReturnType<Mapping>>;
|
||||
/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */
|
||||
export declare function Ident(): IIdent<string>;
|
||||
export interface INumber<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Number';
|
||||
}
|
||||
/** `[TERM]` Creates an Number Parser */
|
||||
export declare function Number<Mapping extends IMapping<string>>(mapping: Mapping): INumber<ReturnType<Mapping>>;
|
||||
/** `[TERM]` Creates an Number Parser */
|
||||
export declare function Number(): INumber<string>;
|
||||
export type OptionalParameter<Parser extends IParser, Result extends unknown = [StaticParser<Parser>] | []> = (Result);
|
||||
export interface IOptional<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Optional';
|
||||
parser: IParser;
|
||||
}
|
||||
/** `[EBNF]` Creates an Optional Parser */
|
||||
export declare function Optional<Parser extends IParser, Mapping extends IMapping = IMapping<OptionalParameter<Parser>>>(parser: Parser, mapping: Mapping): IOptional<ReturnType<Mapping>>;
|
||||
/** `[EBNF]` Creates an Optional Parser */
|
||||
export declare function Optional<Parser extends IParser>(parser: Parser): IOptional<OptionalParameter<Parser>>;
|
||||
export type TupleParameter<Parsers extends IParser[], Result extends unknown[] = []> = StaticEnsure<Parsers extends [infer Left extends IParser, ...infer Right extends IParser[]] ? TupleParameter<Right, [...Result, StaticEnsure<StaticParser<Left>>]> : Result>;
|
||||
export interface ITuple<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Tuple';
|
||||
parsers: IParser[];
|
||||
}
|
||||
/** `[BNF]` Creates a Tuple Parser */
|
||||
export declare function Tuple<Parsers extends IParser[], Mapping extends IMapping = IMapping<TupleParameter<Parsers>>>(parsers: [...Parsers], mapping: Mapping): ITuple<ReturnType<Mapping>>;
|
||||
/** `[BNF]` Creates a Tuple Parser */
|
||||
export declare function Tuple<Parsers extends IParser[]>(parsers: [...Parsers]): ITuple<TupleParameter<Parsers>>;
|
||||
export type UnionParameter<Parsers extends IParser[], Result extends unknown = never> = StaticEnsure<Parsers extends [infer Left extends IParser, ...infer Right extends IParser[]] ? UnionParameter<Right, Result | StaticParser<Left>> : Result>;
|
||||
export interface IUnion<Output extends unknown = unknown> extends IParser<Output> {
|
||||
type: 'Union';
|
||||
parsers: IParser[];
|
||||
}
|
||||
/** `[BNF]` Creates a Union parser */
|
||||
export declare function Union<Parsers extends IParser[], Mapping extends IMapping = IMapping<UnionParameter<Parsers>>>(parsers: [...Parsers], mapping: Mapping): IUnion<ReturnType<Mapping>>;
|
||||
/** `[BNF]` Creates a Union parser */
|
||||
export declare function Union<Parsers extends IParser[]>(parsers: [...Parsers]): IUnion<UnionParameter<Parsers>>;
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.As = exports.Identity = void 0;
|
||||
exports.Context = Context;
|
||||
exports.Array = Array;
|
||||
exports.Const = Const;
|
||||
exports.Ref = Ref;
|
||||
exports.String = String;
|
||||
exports.Ident = Ident;
|
||||
exports.Number = Number;
|
||||
exports.Optional = Optional;
|
||||
exports.Tuple = Tuple;
|
||||
exports.Union = Union;
|
||||
/** Maps input to output. This is the default Mapping */
|
||||
const Identity = (value) => value;
|
||||
exports.Identity = Identity;
|
||||
/** Maps the output as the given parameter T */
|
||||
// prettier-ignore
|
||||
const As = (mapping) => (_) => mapping;
|
||||
exports.As = As;
|
||||
/** `[Context]` Creates a Context Parser */
|
||||
function Context(...args) {
|
||||
const [left, right, mapping] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], args[1], exports.Identity];
|
||||
return { type: 'Context', left, right, mapping };
|
||||
}
|
||||
/** `[EBNF]` Creates an Array Parser */
|
||||
function Array(...args) {
|
||||
const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Array', parser, mapping };
|
||||
}
|
||||
/** `[TERM]` Creates a Const Parser */
|
||||
function Const(...args) {
|
||||
const [value, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Const', value, mapping };
|
||||
}
|
||||
/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */
|
||||
function Ref(...args) {
|
||||
const [ref, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Ref', ref, mapping };
|
||||
}
|
||||
/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */
|
||||
function String(...params) {
|
||||
const [options, mapping] = params.length === 2 ? [params[0], params[1]] : [params[0], exports.Identity];
|
||||
return { type: 'String', options, mapping };
|
||||
}
|
||||
/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */
|
||||
function Ident(...params) {
|
||||
const mapping = params.length === 1 ? params[0] : exports.Identity;
|
||||
return { type: 'Ident', mapping };
|
||||
}
|
||||
/** `[TERM]` Creates an Number Parser */
|
||||
function Number(...params) {
|
||||
const mapping = params.length === 1 ? params[0] : exports.Identity;
|
||||
return { type: 'Number', mapping };
|
||||
}
|
||||
/** `[EBNF]` Creates an Optional Parser */
|
||||
function Optional(...args) {
|
||||
const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Optional', parser, mapping };
|
||||
}
|
||||
/** `[BNF]` Creates a Tuple Parser */
|
||||
function Tuple(...args) {
|
||||
const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Tuple', parsers, mapping };
|
||||
}
|
||||
/** `[BNF]` Creates a Union parser */
|
||||
function Union(...args) {
|
||||
const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity];
|
||||
return { type: 'Union', parsers, mapping };
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
export * as Token from './token';
|
||||
export * from './parse';
|
||||
export * from './types';
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Token = void 0;
|
||||
exports.Token = __importStar(require("./token"));
|
||||
__exportStar(require("./parse"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import * as Tokens from './token';
|
||||
import * as Types from './types';
|
||||
type ContextParser<Left extends Types.IParser, Right extends Types.IParser, Code extends string, Context extends unknown> = (Parse<Left, Code, Context> extends [infer Context extends unknown, infer Rest extends string] ? Parse<Right, Rest, Context> : []);
|
||||
type ArrayParser<Parser extends Types.IParser, Code extends string, Context extends unknown, Result extends unknown[] = []> = (Parse<Parser, Code, Context> extends [infer Value1 extends unknown, infer Rest extends string] ? ArrayParser<Parser, Rest, Context, [...Result, Value1]> : [Result, Code]);
|
||||
type ConstParser<Value extends string, Code extends string, _Context extends unknown> = (Tokens.Const<Value, Code> extends [infer Match extends Value, infer Rest extends string] ? [Match, Rest] : []);
|
||||
type IdentParser<Code extends string, _Context extends unknown> = (Tokens.Ident<Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
|
||||
type NumberParser<Code extends string, _Context extends unknown> = (Tokens.Number<Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
|
||||
type OptionalParser<Parser extends Types.IParser, Code extends string, Context extends unknown> = (Parse<Parser, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? [[Value], Rest] : [[], Code]);
|
||||
type StringParser<Options extends string[], Code extends string, _Context extends unknown> = (Tokens.String<Options, Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
|
||||
type TupleParser<Parsers extends Types.IParser[], Code extends string, Context extends unknown, Result extends unknown[] = []> = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse<Left, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? TupleParser<Right, Rest, Context, [...Result, Value]> : [] : [Result, Code]);
|
||||
type UnionParser<Parsers extends Types.IParser[], Code extends string, Context extends unknown> = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse<Left, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? [Value, Rest] : UnionParser<Right, Code, Context> : []);
|
||||
type ParseCode<Type extends Types.IParser, Code extends string, Context extends unknown = unknown> = (Type extends Types.Context<infer Left extends Types.IParser, infer Right extends Types.IParser> ? ContextParser<Left, Right, Code, Context> : Type extends Types.Array<infer Parser extends Types.IParser> ? ArrayParser<Parser, Code, Context> : Type extends Types.Const<infer Value extends string> ? ConstParser<Value, Code, Context> : Type extends Types.Ident ? IdentParser<Code, Context> : Type extends Types.Number ? NumberParser<Code, Context> : Type extends Types.Optional<infer Parser extends Types.IParser> ? OptionalParser<Parser, Code, Context> : Type extends Types.String<infer Options extends string[]> ? StringParser<Options, Code, Context> : Type extends Types.Tuple<infer Parsers extends Types.IParser[]> ? TupleParser<Parsers, Code, Context> : Type extends Types.Union<infer Parsers extends Types.IParser[]> ? UnionParser<Parsers, Code, Context> : [
|
||||
]);
|
||||
type ParseMapping<Parser extends Types.IParser, Result extends unknown, Context extends unknown = unknown> = ((Parser['mapping'] & {
|
||||
input: Result;
|
||||
context: Context;
|
||||
})['output']);
|
||||
/** Parses code with the given parser */
|
||||
export type Parse<Type extends Types.IParser, Code extends string, Context extends unknown = unknown> = (ParseCode<Type, Code, Context> extends [infer L extends unknown, infer R extends string] ? [ParseMapping<Type, L, Context>, R] : []);
|
||||
export {};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
declare namespace Chars {
|
||||
type Empty = '';
|
||||
type Space = ' ';
|
||||
type Newline = '\n';
|
||||
type Dot = '.';
|
||||
type Hyphen = '-';
|
||||
type Digit = [
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9'
|
||||
];
|
||||
type Alpha = [
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'g',
|
||||
'h',
|
||||
'i',
|
||||
'j',
|
||||
'k',
|
||||
'l',
|
||||
'm',
|
||||
'n',
|
||||
'o',
|
||||
'p',
|
||||
'q',
|
||||
'r',
|
||||
's',
|
||||
't',
|
||||
'u',
|
||||
'v',
|
||||
'w',
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G',
|
||||
'H',
|
||||
'I',
|
||||
'J',
|
||||
'K',
|
||||
'L',
|
||||
'M',
|
||||
'N',
|
||||
'O',
|
||||
'P',
|
||||
'Q',
|
||||
'R',
|
||||
'S',
|
||||
'T',
|
||||
'U',
|
||||
'V',
|
||||
'W',
|
||||
'X',
|
||||
'Y',
|
||||
'Z'
|
||||
];
|
||||
}
|
||||
declare namespace Trim {
|
||||
type W4 = `${W3}${W3}`;
|
||||
type W3 = `${W2}${W2}`;
|
||||
type W2 = `${W1}${W1}`;
|
||||
type W1 = `${W0}${W0}`;
|
||||
type W0 = ` `;
|
||||
/** Trims whitespace only */
|
||||
export type TrimWhitespace<Code extends string> = (Code extends `${W4}${infer Rest extends string}` ? TrimWhitespace<Rest> : Code extends `${W3}${infer Rest extends string}` ? TrimWhitespace<Rest> : Code extends `${W1}${infer Rest extends string}` ? TrimWhitespace<Rest> : Code extends `${W0}${infer Rest extends string}` ? TrimWhitespace<Rest> : Code);
|
||||
/** Trims Whitespace and Newline */
|
||||
export type TrimAll<Code extends string> = (Code extends `${W4}${infer Rest extends string}` ? TrimAll<Rest> : Code extends `${W3}${infer Rest extends string}` ? TrimAll<Rest> : Code extends `${W1}${infer Rest extends string}` ? TrimAll<Rest> : Code extends `${W0}${infer Rest extends string}` ? TrimAll<Rest> : Code extends `${Chars.Newline}${infer Rest extends string}` ? TrimAll<Rest> : Code);
|
||||
export {};
|
||||
}
|
||||
/** Scans for the next match union */
|
||||
type NextUnion<Variants extends string[], Code extends string> = (Variants extends [infer Variant extends string, ...infer Rest1 extends string[]] ? NextConst<Variant, Code> extends [infer Match extends string, infer Rest2 extends string] ? [Match, Rest2] : NextUnion<Rest1, Code> : []);
|
||||
type NextConst<Value extends string, Code extends string> = (Code extends `${Value}${infer Rest extends string}` ? [Value, Rest] : []);
|
||||
/** Scans for the next constant value */
|
||||
export type Const<Value extends string, Code extends string> = (Value extends '' ? ['', Code] : Value extends `${infer First extends string}${string}` ? (First extends Chars.Newline ? NextConst<Value, Trim.TrimWhitespace<Code>> : First extends Chars.Space ? NextConst<Value, Code> : NextConst<Value, Trim.TrimAll<Code>>) : never);
|
||||
type NextNumberNegate<Code extends string> = (Code extends `${Chars.Hyphen}${infer Rest extends string}` ? [Chars.Hyphen, Rest] : [Chars.Empty, Code]);
|
||||
type NextNumberZeroCheck<Code extends string> = (Code extends `0${infer Rest}` ? NextUnion<Chars.Digit, Rest> extends [string, string] ? false : true : true);
|
||||
type NextNumberScan<Code extends string, HasDecimal extends boolean = false, Result extends string = Chars.Empty> = (NextUnion<[...Chars.Digit, Chars.Dot], Code> extends [infer Char extends string, infer Rest extends string] ? Char extends Chars.Dot ? HasDecimal extends false ? NextNumberScan<Rest, true, `${Result}${Char}`> : [Result, `.${Rest}`] : NextNumberScan<Rest, HasDecimal, `${Result}${Char}`> : [Result, Code]);
|
||||
export type NextNumber<Code extends string> = (NextNumberNegate<Code> extends [infer Negate extends string, infer Rest extends string] ? NextNumberZeroCheck<Rest> extends true ? NextNumberScan<Rest> extends [infer Number extends string, infer Rest2 extends string] ? Number extends Chars.Empty ? [] : [`${Negate}${Number}`, Rest2] : [] : [] : []);
|
||||
/** Scans for the next literal number */
|
||||
export type Number<Code extends string> = NextNumber<Trim.TrimAll<Code>>;
|
||||
type NextStringQuote<Options extends string[], Code extends string> = NextUnion<Options, Code>;
|
||||
type NextStringBody<Code extends string, Quote extends string, Result extends string = Chars.Empty> = (Code extends `${infer Char extends string}${infer Rest extends string}` ? Char extends Quote ? [Result, Rest] : NextStringBody<Rest, Quote, `${Result}${Char}`> : []);
|
||||
type NextString<Options extends string[], Code extends string> = (NextStringQuote<Options, Code> extends [infer Quote extends string, infer Rest extends string] ? NextStringBody<Rest, Quote> extends [infer String extends string, infer Rest extends string] ? [String, Rest] : [] : []);
|
||||
/** Scans for the next literal string */
|
||||
export type String<Options extends string[], Code extends string> = NextString<Options, Trim.TrimAll<Code>>;
|
||||
type IdentLeft = [...Chars.Alpha, '_', '$'];
|
||||
type IdentRight = [...Chars.Digit, ...IdentLeft];
|
||||
type NextIdentScan<Code extends string, Result extends string = Chars.Empty> = (NextUnion<IdentRight, Code> extends [infer Char extends string, infer Rest extends string] ? NextIdentScan<Rest, `${Result}${Char}`> : [Result, Code]);
|
||||
type NextIdent<Code extends string> = (NextUnion<IdentLeft, Code> extends [infer Left extends string, infer Rest1 extends string] ? NextIdentScan<Rest1> extends [infer Right extends string, infer Rest2 extends string] ? [`${Left}${Right}`, Rest2] : [] : []);
|
||||
/** Scans for the next Ident */
|
||||
export type Ident<Code extends string> = NextIdent<Trim.TrimAll<Code>>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* `[ACTION]` Inference mapping base type. Used to specify semantic actions for
|
||||
* Parser productions. This type is implemented as a higher-kinded type where
|
||||
* productions are received on the `input` property with mapping assigned
|
||||
* the `output` property. The parsing context is available on the `context`
|
||||
* property.
|
||||
*/
|
||||
export interface IMapping {
|
||||
context: unknown;
|
||||
input: unknown;
|
||||
output: unknown;
|
||||
}
|
||||
/** `[ACTION]` Default inference mapping. */
|
||||
export interface Identity extends IMapping {
|
||||
output: this['input'];
|
||||
}
|
||||
/** `[ACTION]` Maps the given argument `T` as the mapping output */
|
||||
export interface As<T> extends IMapping {
|
||||
output: T;
|
||||
}
|
||||
/** Base type Parser implemented by all other parsers */
|
||||
export interface IParser<Mapping extends IMapping = Identity> {
|
||||
type: string;
|
||||
mapping: Mapping;
|
||||
}
|
||||
/** `[Context]` Creates a Context Parser */
|
||||
export interface Context<Left extends IParser = IParser, Right extends IParser = IParser, Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Context';
|
||||
left: Left;
|
||||
right: Right;
|
||||
}
|
||||
/** `[EBNF]` Creates an Array Parser */
|
||||
export interface Array<Parser extends IParser = IParser, Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Array';
|
||||
parser: Parser;
|
||||
}
|
||||
/** `[TERM]` Creates a Const Parser */
|
||||
export interface Const<Value extends string = string, Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Const';
|
||||
value: Value;
|
||||
}
|
||||
/** `[TERM]` Creates an Ident Parser. */
|
||||
export interface Ident<Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Ident';
|
||||
}
|
||||
/** `[TERM]` Creates a Number Parser. */
|
||||
export interface Number<Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Number';
|
||||
}
|
||||
/** `[EBNF]` Creates a Optional Parser */
|
||||
export interface Optional<Parser extends IParser = IParser, Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Optional';
|
||||
parser: Parser;
|
||||
}
|
||||
/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */
|
||||
export interface String<Options extends string[], Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'String';
|
||||
quote: Options;
|
||||
}
|
||||
/** `[BNF]` Creates a Tuple Parser */
|
||||
export interface Tuple<Parsers extends IParser[] = [], Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Tuple';
|
||||
parsers: [...Parsers];
|
||||
}
|
||||
/** `[BNF]` Creates a Union Parser */
|
||||
export interface Union<Parsers extends IParser[] = [], Mapping extends IMapping = Identity> extends IParser<Mapping> {
|
||||
type: 'Union';
|
||||
parsers: [...Parsers];
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './syntax';
|
||||
18
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/index.js
vendored
Normal file
18
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/index.js
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./syntax"), exports);
|
||||
167
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/mapping.d.ts
vendored
Normal file
167
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/mapping.d.ts
vendored
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
import * as T from '../type/index';
|
||||
type TDereference<Context extends T.TProperties, Key extends string> = (Key extends keyof Context ? Context[Key] : T.TRef<Key>);
|
||||
type TDelimitedDecode<Input extends ([unknown, unknown] | unknown)[], Result extends unknown[] = []> = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode<Right, [...Result, Item]> : TDelimitedDecode<Right, [...Result, Left]> : Result);
|
||||
type TDelimited<Input extends [unknown, unknown]> = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : [];
|
||||
export type TGenericReferenceParameterListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
|
||||
export declare function GenericReferenceParameterListMapping(input: [unknown, unknown], context: unknown): unknown[];
|
||||
export type TGenericReferenceMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties, Result = Context extends T.TProperties ? Input extends [infer Reference extends string, '<', infer Args extends T.TSchema[], '>'] ? T.TInstantiate<TDereference<Context, Reference>, Args> : never : never> = Result;
|
||||
export declare function GenericReferenceMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TGenericArgumentsListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
|
||||
export declare function GenericArgumentsListMapping(input: [unknown, unknown], context: unknown): unknown[];
|
||||
type GenericArgumentsContext<Arguments extends string[], Context extends T.TProperties, Result extends T.TProperties = {}> = (Arguments extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext<Left, Context, Result & {
|
||||
[_ in Right]: T.TArgument<Left['length']>;
|
||||
}> : T.Evaluate<Result & Context>);
|
||||
export type TGenericArgumentsMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['<', infer Arguments extends string[], '>'] ? Context extends infer Context extends T.TProperties ? GenericArgumentsContext<Arguments, Context> : never : never;
|
||||
declare const GenericArgumentsContext: (_arguments: string[], context: T.TProperties) => T.TProperties;
|
||||
export declare function GenericArgumentsMapping(input: [unknown, unknown, unknown], context: unknown): T.TProperties;
|
||||
export type TKeywordStringMapping<Input extends 'string', Context extends T.TProperties> = T.TString;
|
||||
export declare function KeywordStringMapping(input: 'string', context: unknown): T.TString;
|
||||
export type TKeywordNumberMapping<Input extends 'number', Context extends T.TProperties> = T.TNumber;
|
||||
export declare function KeywordNumberMapping(input: 'number', context: unknown): T.TNumber;
|
||||
export type TKeywordBooleanMapping<Input extends 'boolean', Context extends T.TProperties> = T.TBoolean;
|
||||
export declare function KeywordBooleanMapping(input: 'boolean', context: unknown): T.TBoolean;
|
||||
export type TKeywordUndefinedMapping<Input extends 'undefined', Context extends T.TProperties> = T.TUndefined;
|
||||
export declare function KeywordUndefinedMapping(input: 'undefined', context: unknown): T.TUndefined;
|
||||
export type TKeywordNullMapping<Input extends 'null', Context extends T.TProperties> = T.TNull;
|
||||
export declare function KeywordNullMapping(input: 'null', context: unknown): T.TNull;
|
||||
export type TKeywordIntegerMapping<Input extends 'integer', Context extends T.TProperties> = T.TInteger;
|
||||
export declare function KeywordIntegerMapping(input: 'integer', context: unknown): T.TInteger;
|
||||
export type TKeywordBigIntMapping<Input extends 'bigint', Context extends T.TProperties> = T.TBigInt;
|
||||
export declare function KeywordBigIntMapping(input: 'bigint', context: unknown): T.TBigInt;
|
||||
export type TKeywordUnknownMapping<Input extends 'unknown', Context extends T.TProperties> = T.TUnknown;
|
||||
export declare function KeywordUnknownMapping(input: 'unknown', context: unknown): T.TUnknown;
|
||||
export type TKeywordAnyMapping<Input extends 'any', Context extends T.TProperties> = T.TAny;
|
||||
export declare function KeywordAnyMapping(input: 'any', context: unknown): T.TAny;
|
||||
export type TKeywordNeverMapping<Input extends 'never', Context extends T.TProperties> = T.TNever;
|
||||
export declare function KeywordNeverMapping(input: 'never', context: unknown): T.TNever;
|
||||
export type TKeywordSymbolMapping<Input extends 'symbol', Context extends T.TProperties> = T.TSymbol;
|
||||
export declare function KeywordSymbolMapping(input: 'symbol', context: unknown): T.TSymbol;
|
||||
export type TKeywordVoidMapping<Input extends 'void', Context extends T.TProperties> = T.TVoid;
|
||||
export declare function KeywordVoidMapping(input: 'void', context: unknown): T.TVoid;
|
||||
export type TKeywordMapping<Input extends unknown, Context extends T.TProperties> = Input;
|
||||
export declare function KeywordMapping(input: unknown, context: unknown): unknown;
|
||||
export type TLiteralStringMapping<Input extends string, Context extends T.TProperties> = Input extends T.TLiteralValue ? T.TLiteral<Input> : never;
|
||||
export declare function LiteralStringMapping(input: string, context: unknown): T.TLiteral<string>;
|
||||
export type TLiteralNumberMapping<Input extends string, Context extends T.TProperties> = Input extends `${infer Value extends number}` ? T.TLiteral<Value> : never;
|
||||
export declare function LiteralNumberMapping(input: string, context: unknown): T.TLiteral<number>;
|
||||
export type TLiteralBooleanMapping<Input extends 'true' | 'false', Context extends T.TProperties> = Input extends 'true' ? T.TLiteral<true> : T.TLiteral<false>;
|
||||
export declare function LiteralBooleanMapping(input: 'true' | 'false', context: unknown): T.TLiteral<boolean>;
|
||||
export type TLiteralMapping<Input extends unknown, Context extends T.TProperties> = Input;
|
||||
export declare function LiteralMapping(input: unknown, context: unknown): unknown;
|
||||
export type TKeyOfMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
|
||||
export declare function KeyOfMapping(input: [unknown] | [], context: unknown): boolean;
|
||||
type TIndexArrayMappingReduce<Input extends unknown[], Result extends unknown[] = []> = (Input extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends ['[', infer Type extends T.TSchema, ']'] ? TIndexArrayMappingReduce<Right, [...Result, [Type]]> : TIndexArrayMappingReduce<Right, [...Result, []]> : Result);
|
||||
export type TIndexArrayMapping<Input extends ([unknown, unknown, unknown] | [unknown, unknown])[], Context extends T.TProperties> = Input extends unknown[] ? TIndexArrayMappingReduce<Input> : [];
|
||||
export declare function IndexArrayMapping(input: ([unknown, unknown, unknown] | [unknown, unknown])[], context: unknown): unknown[];
|
||||
export type TExtendsMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown] | [], Context extends T.TProperties> = Input extends ['extends', infer Type extends T.TSchema, '?', infer True extends T.TSchema, ':', infer False extends T.TSchema] ? [Type, True, False] : [];
|
||||
export declare function ExtendsMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown] | [], context: unknown): unknown[];
|
||||
export type TBaseMapping<Input extends [unknown, unknown, unknown] | unknown, Context extends T.TProperties> = (Input extends ['(', infer Type extends T.TSchema, ')'] ? Type : Input extends infer Type extends T.TSchema ? Type : never);
|
||||
export declare function BaseMapping(input: [unknown, unknown, unknown] | unknown, context: unknown): unknown;
|
||||
type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [...infer Left extends unknown[], infer Right extends T.TSchema[]] ? (Right extends [infer Indexer extends T.TSchema] ? T.TIndex<TFactorIndexArray<Type, Left>, T.TIndexPropertyKeys<Indexer>> : Right extends [] ? T.TArray<TFactorIndexArray<Type, Left>> : T.TNever) : Type);
|
||||
type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? T.TExtends<Type, Right, True, False> : Type);
|
||||
export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? TFactorExtends<T.TKeyOf<TFactorIndexArray<Type, IndexArray>>, Extends> : TFactorExtends<TFactorIndexArray<Type, IndexArray>, Extends> : never;
|
||||
export declare function FactorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
type TExprBinaryMapping<Left extends T.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping<Right, Next> extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect<infer Types extends T.TSchema[]> ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion<infer Types extends T.TSchema[]> ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left);
|
||||
export type TExprTermTailMapping<Input extends [unknown, unknown, unknown] | [], Context extends T.TProperties> = Input;
|
||||
export declare function ExprTermTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown];
|
||||
export type TExprTermMapping<Input extends [unknown, unknown], Context extends T.TProperties> = (Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping<Left, Rest> : []);
|
||||
export declare function ExprTermMapping(input: [unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TExprTailMapping<Input extends [unknown, unknown, unknown] | [], Context extends T.TProperties> = Input;
|
||||
export declare function ExprTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown];
|
||||
export type TExprMapping<Input extends [unknown, unknown], Context extends T.TProperties> = Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping<Left, Rest> : [];
|
||||
export declare function ExprMapping(input: [unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TTypeMapping<Input extends unknown, Context extends T.TProperties> = Input;
|
||||
export declare function TypeMapping(input: unknown, context: unknown): unknown;
|
||||
export type TPropertyKeyMapping<Input extends string, Context extends T.TProperties> = Input;
|
||||
export declare function PropertyKeyMapping(input: string, context: unknown): string;
|
||||
export type TReadonlyMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
|
||||
export declare function ReadonlyMapping(input: [unknown] | [], context: unknown): boolean;
|
||||
export type TOptionalMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
|
||||
export declare function OptionalMapping(input: [unknown] | [], context: unknown): boolean;
|
||||
export type TPropertyMapping<Input extends [unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends T.TSchema] ? {
|
||||
[_ in Key]: ([
|
||||
IsReadonly,
|
||||
IsOptional
|
||||
] extends [true, true] ? T.TReadonlyOptional<Type> : [
|
||||
IsReadonly,
|
||||
IsOptional
|
||||
] extends [true, false] ? T.TReadonly<Type> : [
|
||||
IsReadonly,
|
||||
IsOptional
|
||||
] extends [false, true] ? T.TOptional<Type> : Type);
|
||||
} : never;
|
||||
export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): {
|
||||
[x: string]: T.TSchema;
|
||||
};
|
||||
export type TPropertyDelimiterMapping<Input extends [unknown, unknown] | [unknown], Context extends T.TProperties> = Input;
|
||||
export declare function PropertyDelimiterMapping(input: [unknown, unknown] | [unknown], context: unknown): [unknown] | [unknown, unknown];
|
||||
export type TPropertyListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
|
||||
export declare function PropertyListMapping(input: [unknown, unknown], context: unknown): unknown[];
|
||||
type TObjectMappingReduce<PropertiesList extends T.TProperties[], Result extends T.TProperties = {}> = (PropertiesList extends [infer Left extends T.TProperties, ...infer Right extends T.TProperties[]] ? TObjectMappingReduce<Right, Result & Left> : {
|
||||
[Key in keyof Result]: Result[Key];
|
||||
});
|
||||
export type TObjectMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['{', infer PropertyList extends T.TProperties[], '}'] ? T.TObject<TObjectMappingReduce<PropertyList>> : never;
|
||||
export declare function ObjectMapping(input: [unknown, unknown, unknown], context: unknown): T.TObject<T.TProperties>;
|
||||
export type TElementListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
|
||||
export declare function ElementListMapping(input: [unknown, unknown], context: unknown): unknown[];
|
||||
export type TTupleMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['[', infer Types extends T.TSchema[], ']'] ? T.TTuple<Types> : never;
|
||||
export declare function TupleMapping(input: [unknown, unknown, unknown], context: unknown): T.TTuple<T.TSchema[]>;
|
||||
export type TParameterMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends [string, ':', infer Type extends T.TSchema] ? Type : never;
|
||||
export declare function ParameterMapping(input: [unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TParameterListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
|
||||
export declare function ParameterListMapping(input: [unknown, unknown], context: unknown): unknown[];
|
||||
export type TFunctionMapping<Input extends [unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['(', infer ParameterList extends T.TSchema[], ')', '=>', infer ReturnType extends T.TSchema] ? T.TFunction<ParameterList, ReturnType> : never;
|
||||
export declare function FunctionMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): T.TFunction<T.TSchema[], T.TSchema>;
|
||||
export type TConstructorMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['new', '(', infer ParameterList extends T.TSchema[], ')', '=>', infer InstanceType extends T.TSchema] ? T.TConstructor<ParameterList, InstanceType> : never;
|
||||
export declare function ConstructorMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TConstructor<T.TSchema[], T.TSchema>;
|
||||
export type TMappedMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['{', '[', infer _Key extends string, 'in', infer _Right extends T.TSchema, ']', ':', infer _Type extends T.TSchema, '}'] ? T.TLiteral<'Mapped types not supported'> : never;
|
||||
export declare function MappedMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TLiteral<"Mapped types not supported">;
|
||||
export type TAsyncIteratorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['AsyncIterator', '<', infer Type extends T.TSchema, '>'] ? T.TAsyncIterator<Type> : never;
|
||||
export declare function AsyncIteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TAsyncIterator<T.TSchema>;
|
||||
export type TIteratorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Iterator', '<', infer Type extends T.TSchema, '>'] ? T.TIterator<Type> : never;
|
||||
export declare function IteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TIterator<T.TSchema>;
|
||||
export type TArgumentMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Argument', '<', infer Type extends T.TSchema, '>'] ? Type extends T.TLiteral<infer Index extends number> ? T.TArgument<Index> : T.TNever : never;
|
||||
export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever | T.TArgument<number>;
|
||||
export type TAwaitedMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Awaited', '<', infer Type extends T.TSchema, '>'] ? T.TAwaited<Type> : never;
|
||||
export declare function AwaitedMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TArrayMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Array', '<', infer Type extends T.TSchema, '>'] ? T.TArray<Type> : never;
|
||||
export declare function ArrayMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TArray<T.TSchema>;
|
||||
export type TRecordMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Record', '<', infer Key extends T.TSchema, ',', infer Type extends T.TSchema, '>'] ? T.TRecordOrObject<Key, Type> : never;
|
||||
export declare function RecordMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TPromiseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Promise', '<', infer Type extends T.TSchema, '>'] ? T.TPromise<Type> : never;
|
||||
export declare function PromiseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TPromise<T.TSchema>;
|
||||
export type TConstructorParametersMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['ConstructorParameters', '<', infer Type extends T.TSchema, '>'] ? T.TConstructorParameters<Type> : never;
|
||||
export declare function ConstructorParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TFunctionParametersMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Parameters', '<', infer Type extends T.TSchema, '>'] ? T.TParameters<Type> : never;
|
||||
export declare function FunctionParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TInstanceTypeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['InstanceType', '<', infer Type extends T.TSchema, '>'] ? T.TInstanceType<Type> : never;
|
||||
export declare function InstanceTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TReturnTypeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['ReturnType', '<', infer Type extends T.TSchema, '>'] ? T.TReturnType<Type> : never;
|
||||
export declare function ReturnTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TPartialMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Partial', '<', infer Type extends T.TSchema, '>'] ? T.TPartial<Type> : never;
|
||||
export declare function PartialMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
|
||||
export type TRequiredMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Required', '<', infer Type extends T.TSchema, '>'] ? T.TRequired<Type> : never;
|
||||
export declare function RequiredMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
|
||||
export type TPickMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Pick', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TPick<Type, Key> : never;
|
||||
export declare function PickMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
|
||||
export type TOmitMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Omit', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TOmit<Type, Key> : never;
|
||||
export declare function OmitMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
|
||||
export type TExcludeMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Exclude', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExclude<Type, Key> : never;
|
||||
export declare function ExcludeMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever;
|
||||
export type TExtractMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Extract', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExtract<Type, Key> : never;
|
||||
export declare function ExtractMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TUppercaseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Uppercase', '<', infer Type extends T.TSchema, '>'] ? T.TUppercase<Type> : never;
|
||||
export declare function UppercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TLowercaseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Lowercase', '<', infer Type extends T.TSchema, '>'] ? T.TLowercase<Type> : never;
|
||||
export declare function LowercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TCapitalizeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Capitalize', '<', infer Type extends T.TSchema, '>'] ? T.TCapitalize<Type> : never;
|
||||
export declare function CapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TUncapitalizeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Uncapitalize', '<', infer Type extends T.TSchema, '>'] ? T.TUncapitalize<Type> : never;
|
||||
export declare function UncapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
|
||||
export type TDateMapping<Input extends 'Date', Context extends T.TProperties> = T.TDate;
|
||||
export declare function DateMapping(input: 'Date', context: unknown): T.TDate;
|
||||
export type TUint8ArrayMapping<Input extends 'Uint8Array', Context extends T.TProperties> = T.TUint8Array;
|
||||
export declare function Uint8ArrayMapping(input: 'Uint8Array', context: unknown): T.TUint8Array;
|
||||
export type TReferenceMapping<Input extends string, Context extends T.TProperties> = Context extends T.TProperties ? Input extends string ? TDereference<Context, Input> : never : never;
|
||||
export declare function ReferenceMapping(input: string, context: unknown): T.TSchema;
|
||||
export {};
|
||||
491
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/mapping.js
vendored
Normal file
491
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/mapping.js
vendored
Normal file
|
|
@ -0,0 +1,491 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GenericReferenceParameterListMapping = GenericReferenceParameterListMapping;
|
||||
exports.GenericReferenceMapping = GenericReferenceMapping;
|
||||
exports.GenericArgumentsListMapping = GenericArgumentsListMapping;
|
||||
exports.GenericArgumentsMapping = GenericArgumentsMapping;
|
||||
exports.KeywordStringMapping = KeywordStringMapping;
|
||||
exports.KeywordNumberMapping = KeywordNumberMapping;
|
||||
exports.KeywordBooleanMapping = KeywordBooleanMapping;
|
||||
exports.KeywordUndefinedMapping = KeywordUndefinedMapping;
|
||||
exports.KeywordNullMapping = KeywordNullMapping;
|
||||
exports.KeywordIntegerMapping = KeywordIntegerMapping;
|
||||
exports.KeywordBigIntMapping = KeywordBigIntMapping;
|
||||
exports.KeywordUnknownMapping = KeywordUnknownMapping;
|
||||
exports.KeywordAnyMapping = KeywordAnyMapping;
|
||||
exports.KeywordNeverMapping = KeywordNeverMapping;
|
||||
exports.KeywordSymbolMapping = KeywordSymbolMapping;
|
||||
exports.KeywordVoidMapping = KeywordVoidMapping;
|
||||
exports.KeywordMapping = KeywordMapping;
|
||||
exports.LiteralStringMapping = LiteralStringMapping;
|
||||
exports.LiteralNumberMapping = LiteralNumberMapping;
|
||||
exports.LiteralBooleanMapping = LiteralBooleanMapping;
|
||||
exports.LiteralMapping = LiteralMapping;
|
||||
exports.KeyOfMapping = KeyOfMapping;
|
||||
exports.IndexArrayMapping = IndexArrayMapping;
|
||||
exports.ExtendsMapping = ExtendsMapping;
|
||||
exports.BaseMapping = BaseMapping;
|
||||
exports.FactorMapping = FactorMapping;
|
||||
exports.ExprTermTailMapping = ExprTermTailMapping;
|
||||
exports.ExprTermMapping = ExprTermMapping;
|
||||
exports.ExprTailMapping = ExprTailMapping;
|
||||
exports.ExprMapping = ExprMapping;
|
||||
exports.TypeMapping = TypeMapping;
|
||||
exports.PropertyKeyMapping = PropertyKeyMapping;
|
||||
exports.ReadonlyMapping = ReadonlyMapping;
|
||||
exports.OptionalMapping = OptionalMapping;
|
||||
exports.PropertyMapping = PropertyMapping;
|
||||
exports.PropertyDelimiterMapping = PropertyDelimiterMapping;
|
||||
exports.PropertyListMapping = PropertyListMapping;
|
||||
exports.ObjectMapping = ObjectMapping;
|
||||
exports.ElementListMapping = ElementListMapping;
|
||||
exports.TupleMapping = TupleMapping;
|
||||
exports.ParameterMapping = ParameterMapping;
|
||||
exports.ParameterListMapping = ParameterListMapping;
|
||||
exports.FunctionMapping = FunctionMapping;
|
||||
exports.ConstructorMapping = ConstructorMapping;
|
||||
exports.MappedMapping = MappedMapping;
|
||||
exports.AsyncIteratorMapping = AsyncIteratorMapping;
|
||||
exports.IteratorMapping = IteratorMapping;
|
||||
exports.ArgumentMapping = ArgumentMapping;
|
||||
exports.AwaitedMapping = AwaitedMapping;
|
||||
exports.ArrayMapping = ArrayMapping;
|
||||
exports.RecordMapping = RecordMapping;
|
||||
exports.PromiseMapping = PromiseMapping;
|
||||
exports.ConstructorParametersMapping = ConstructorParametersMapping;
|
||||
exports.FunctionParametersMapping = FunctionParametersMapping;
|
||||
exports.InstanceTypeMapping = InstanceTypeMapping;
|
||||
exports.ReturnTypeMapping = ReturnTypeMapping;
|
||||
exports.PartialMapping = PartialMapping;
|
||||
exports.RequiredMapping = RequiredMapping;
|
||||
exports.PickMapping = PickMapping;
|
||||
exports.OmitMapping = OmitMapping;
|
||||
exports.ExcludeMapping = ExcludeMapping;
|
||||
exports.ExtractMapping = ExtractMapping;
|
||||
exports.UppercaseMapping = UppercaseMapping;
|
||||
exports.LowercaseMapping = LowercaseMapping;
|
||||
exports.CapitalizeMapping = CapitalizeMapping;
|
||||
exports.UncapitalizeMapping = UncapitalizeMapping;
|
||||
exports.DateMapping = DateMapping;
|
||||
exports.Uint8ArrayMapping = Uint8ArrayMapping;
|
||||
exports.ReferenceMapping = ReferenceMapping;
|
||||
const T = __importStar(require("../type/index"));
|
||||
// prettier-ignore
|
||||
const Dereference = (context, key) => {
|
||||
return key in context ? context[key] : T.Ref(key);
|
||||
};
|
||||
// prettier-ignore
|
||||
const DelimitedDecode = (input, result = []) => {
|
||||
return input.reduce((result, left) => {
|
||||
return T.ValueGuard.IsArray(left) && left.length === 2
|
||||
? [...result, left[0]]
|
||||
: [...result, left];
|
||||
}, []);
|
||||
};
|
||||
// prettier-ignore
|
||||
const Delimited = (input) => {
|
||||
const [left, right] = input;
|
||||
return DelimitedDecode([...left, ...right]);
|
||||
};
|
||||
// prettier-ignore
|
||||
function GenericReferenceParameterListMapping(input, context) {
|
||||
return Delimited(input);
|
||||
}
|
||||
// prettier-ignore
|
||||
function GenericReferenceMapping(input, context) {
|
||||
const type = Dereference(context, input[0]);
|
||||
const args = input[2];
|
||||
return T.Instantiate(type, args);
|
||||
}
|
||||
// prettier-ignore
|
||||
function GenericArgumentsListMapping(input, context) {
|
||||
return Delimited(input);
|
||||
}
|
||||
// ...
|
||||
// prettier-ignore
|
||||
const GenericArgumentsContext = (_arguments, context) => {
|
||||
return _arguments.reduce((result, arg, index) => {
|
||||
return { ...result, [arg]: T.Argument(index) };
|
||||
}, context);
|
||||
};
|
||||
// prettier-ignore
|
||||
function GenericArgumentsMapping(input, context) {
|
||||
return input.length === 3
|
||||
? GenericArgumentsContext(input[1], context)
|
||||
: {};
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordStringMapping(input, context) {
|
||||
return T.String();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordNumberMapping(input, context) {
|
||||
return T.Number();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordBooleanMapping(input, context) {
|
||||
return T.Boolean();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordUndefinedMapping(input, context) {
|
||||
return T.Undefined();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordNullMapping(input, context) {
|
||||
return T.Null();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordIntegerMapping(input, context) {
|
||||
return T.Integer();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordBigIntMapping(input, context) {
|
||||
return T.BigInt();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordUnknownMapping(input, context) {
|
||||
return T.Unknown();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordAnyMapping(input, context) {
|
||||
return T.Any();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordNeverMapping(input, context) {
|
||||
return T.Never();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordSymbolMapping(input, context) {
|
||||
return T.Symbol();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordVoidMapping(input, context) {
|
||||
return T.Void();
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeywordMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function LiteralStringMapping(input, context) {
|
||||
return T.Literal(input);
|
||||
}
|
||||
// prettier-ignore
|
||||
function LiteralNumberMapping(input, context) {
|
||||
return T.Literal(parseFloat(input));
|
||||
}
|
||||
// prettier-ignore
|
||||
function LiteralBooleanMapping(input, context) {
|
||||
return T.Literal(input === 'true');
|
||||
}
|
||||
// prettier-ignore
|
||||
function LiteralMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function KeyOfMapping(input, context) {
|
||||
return input.length > 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
function IndexArrayMapping(input, context) {
|
||||
return input.reduce((result, current) => {
|
||||
return current.length === 3
|
||||
? [...result, [current[1]]]
|
||||
: [...result, []];
|
||||
}, []);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExtendsMapping(input, context) {
|
||||
return input.length === 6
|
||||
? [input[1], input[3], input[5]]
|
||||
: [];
|
||||
}
|
||||
// prettier-ignore
|
||||
function BaseMapping(input, context) {
|
||||
return T.ValueGuard.IsArray(input) && input.length === 3 ? input[1] : input;
|
||||
}
|
||||
// ...
|
||||
// prettier-ignore
|
||||
const FactorIndexArray = (Type, indexArray) => {
|
||||
return indexArray.reduceRight((result, right) => {
|
||||
const _right = right;
|
||||
return (_right.length === 1 ? T.Index(result, _right[0]) :
|
||||
_right.length === 0 ? T.Array(result, _right[0]) :
|
||||
T.Never());
|
||||
}, Type);
|
||||
};
|
||||
// prettier-ignore
|
||||
const FactorExtends = (Type, Extends) => {
|
||||
return Extends.length === 3
|
||||
? T.Extends(Type, Extends[0], Extends[1], Extends[2])
|
||||
: Type;
|
||||
};
|
||||
// prettier-ignore
|
||||
function FactorMapping(input, context) {
|
||||
const [KeyOf, Type, IndexArray, Extends] = input;
|
||||
return KeyOf
|
||||
? FactorExtends(T.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
|
||||
: FactorExtends(FactorIndexArray(Type, IndexArray), Extends);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExprBinaryMapping(Left, Rest) {
|
||||
return (Rest.length === 3 ? (() => {
|
||||
const [Operator, Right, Next] = Rest;
|
||||
const Schema = ExprBinaryMapping(Right, Next);
|
||||
if (Operator === '&') {
|
||||
return T.TypeGuard.IsIntersect(Schema)
|
||||
? T.Intersect([Left, ...Schema.allOf])
|
||||
: T.Intersect([Left, Schema]);
|
||||
}
|
||||
if (Operator === '|') {
|
||||
return T.TypeGuard.IsUnion(Schema)
|
||||
? T.Union([Left, ...Schema.anyOf])
|
||||
: T.Union([Left, Schema]);
|
||||
}
|
||||
throw 1;
|
||||
})() : Left);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExprTermTailMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExprTermMapping(input, context) {
|
||||
const [left, rest] = input;
|
||||
return ExprBinaryMapping(left, rest);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExprTailMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExprMapping(input, context) {
|
||||
const [left, rest] = input;
|
||||
return ExprBinaryMapping(left, rest);
|
||||
}
|
||||
// prettier-ignore
|
||||
function TypeMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function PropertyKeyMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function ReadonlyMapping(input, context) {
|
||||
return input.length > 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
function OptionalMapping(input, context) {
|
||||
return input.length > 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
function PropertyMapping(input, context) {
|
||||
const [isReadonly, key, isOptional, _colon, type] = input;
|
||||
return {
|
||||
[key]: (isReadonly && isOptional ? T.ReadonlyOptional(type) :
|
||||
isReadonly && !isOptional ? T.Readonly(type) :
|
||||
!isReadonly && isOptional ? T.Optional(type) :
|
||||
type)
|
||||
};
|
||||
}
|
||||
// prettier-ignore
|
||||
function PropertyDelimiterMapping(input, context) {
|
||||
return input;
|
||||
}
|
||||
// prettier-ignore
|
||||
function PropertyListMapping(input, context) {
|
||||
return Delimited(input);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ObjectMapping(input, context) {
|
||||
const propertyList = input[1];
|
||||
return T.Object(propertyList.reduce((result, property) => {
|
||||
return { ...result, ...property };
|
||||
}, {}));
|
||||
}
|
||||
// prettier-ignore
|
||||
function ElementListMapping(input, context) {
|
||||
return Delimited(input);
|
||||
}
|
||||
// prettier-ignore
|
||||
function TupleMapping(input, context) {
|
||||
return T.Tuple(input[1]);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ParameterMapping(input, context) {
|
||||
const [_ident, _colon, type] = input;
|
||||
return type;
|
||||
}
|
||||
// prettier-ignore
|
||||
function ParameterListMapping(input, context) {
|
||||
return Delimited(input);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FunctionMapping(input, context) {
|
||||
const [_lparan, parameterList, _rparan, _arrow, returnType] = input;
|
||||
return T.Function(parameterList, returnType);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ConstructorMapping(input, context) {
|
||||
const [_new, _lparan, parameterList, _rparan, _arrow, instanceType] = input;
|
||||
return T.Constructor(parameterList, instanceType);
|
||||
}
|
||||
// prettier-ignore
|
||||
function MappedMapping(input, context) {
|
||||
const [_lbrace, _lbracket, _key, _in, _right, _rbracket, _colon, _type] = input;
|
||||
return T.Literal('Mapped types not supported');
|
||||
}
|
||||
// prettier-ignore
|
||||
function AsyncIteratorMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.AsyncIterator(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function IteratorMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Iterator(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ArgumentMapping(input, context) {
|
||||
return T.KindGuard.IsLiteralNumber(input[2])
|
||||
? T.Argument(Math.trunc(input[2].const))
|
||||
: T.Never();
|
||||
}
|
||||
// prettier-ignore
|
||||
function AwaitedMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Awaited(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ArrayMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Array(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function RecordMapping(input, context) {
|
||||
const [_name, _langle, key, _comma, type, _rangle] = input;
|
||||
return T.Record(key, type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function PromiseMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Promise(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ConstructorParametersMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.ConstructorParameters(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FunctionParametersMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Parameters(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function InstanceTypeMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.InstanceType(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ReturnTypeMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.ReturnType(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function PartialMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Partial(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function RequiredMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Required(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function PickMapping(input, context) {
|
||||
const [_name, _langle, key, _comma, type, _rangle] = input;
|
||||
return T.Pick(key, type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function OmitMapping(input, context) {
|
||||
const [_name, _langle, key, _comma, type, _rangle] = input;
|
||||
return T.Omit(key, type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExcludeMapping(input, context) {
|
||||
const [_name, _langle, key, _comma, type, _rangle] = input;
|
||||
return T.Exclude(key, type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function ExtractMapping(input, context) {
|
||||
const [_name, _langle, key, _comma, type, _rangle] = input;
|
||||
return T.Extract(key, type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function UppercaseMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Uppercase(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function LowercaseMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Lowercase(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function CapitalizeMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Capitalize(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function UncapitalizeMapping(input, context) {
|
||||
const [_name, _langle, type, _rangle] = input;
|
||||
return T.Uncapitalize(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function DateMapping(input, context) {
|
||||
return T.Date();
|
||||
}
|
||||
// prettier-ignore
|
||||
function Uint8ArrayMapping(input, context) {
|
||||
return T.Uint8Array();
|
||||
}
|
||||
// prettier-ignore
|
||||
function ReferenceMapping(input, context) {
|
||||
const target = Dereference(context, input);
|
||||
return target;
|
||||
}
|
||||
162
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/parser.d.ts
vendored
Normal file
162
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/parser.d.ts
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
import { Static } from '../parser/index';
|
||||
import * as T from '../type/index';
|
||||
import * as S from './mapping';
|
||||
export type TGenericReferenceParameterList_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = (TType<Input, Context> extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericReferenceParameterList_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TGenericReferenceParameterList<Input extends string, Context extends T.TProperties = {}> = (TGenericReferenceParameterList_0<Input, Context> extends [infer _0, infer Input extends string] ? ((TType<Input, Context> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericReferenceParameterListMapping<_0, Context>, Input] : [];
|
||||
export type TGenericReference<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Ident<Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TGenericReferenceParameterList<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TGenericReferenceMapping<_0, Context>, Input] : [];
|
||||
export type TGenericArgumentsList_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = (Static.Token.Ident<Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericArgumentsList_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TGenericArgumentsList<Input extends string, Context extends T.TProperties = {}> = (TGenericArgumentsList_0<Input, Context> extends [infer _0, infer Input extends string] ? ((Static.Token.Ident<Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsListMapping<_0, Context>, Input] : [];
|
||||
export type TGenericArguments<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'<', Input> extends [infer _0, infer Input extends string] ? TGenericArgumentsList<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordString<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'string', Input> extends [infer _0 extends 'string', infer Input extends string] ? [S.TKeywordStringMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordNumber<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'number', Input> extends [infer _0 extends 'number', infer Input extends string] ? [S.TKeywordNumberMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordBoolean<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'boolean', Input> extends [infer _0 extends 'boolean', infer Input extends string] ? [S.TKeywordBooleanMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordUndefined<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'undefined', Input> extends [infer _0 extends 'undefined', infer Input extends string] ? [S.TKeywordUndefinedMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordNull<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'null', Input> extends [infer _0 extends 'null', infer Input extends string] ? [S.TKeywordNullMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordInteger<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'integer', Input> extends [infer _0 extends 'integer', infer Input extends string] ? [S.TKeywordIntegerMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordBigInt<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'bigint', Input> extends [infer _0 extends 'bigint', infer Input extends string] ? [S.TKeywordBigIntMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordUnknown<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'unknown', Input> extends [infer _0 extends 'unknown', infer Input extends string] ? [S.TKeywordUnknownMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordAny<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'any', Input> extends [infer _0 extends 'any', infer Input extends string] ? [S.TKeywordAnyMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordNever<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'never', Input> extends [infer _0 extends 'never', infer Input extends string] ? [S.TKeywordNeverMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordSymbol<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'symbol', Input> extends [infer _0 extends 'symbol', infer Input extends string] ? [S.TKeywordSymbolMapping<_0, Context>, Input] : [];
|
||||
export type TKeywordVoid<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'void', Input> extends [infer _0 extends 'void', infer Input extends string] ? [S.TKeywordVoidMapping<_0, Context>, Input] : [];
|
||||
export type TKeyword<Input extends string, Context extends T.TProperties = {}> = (TKeywordString<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNumber<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBoolean<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUndefined<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNull<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordInteger<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBigInt<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUnknown<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordAny<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNever<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordSymbol<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordVoid<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TKeywordMapping<_0, Context>, Input] : [];
|
||||
export type TLiteralString<Input extends string, Context extends T.TProperties = {}> = Static.Token.String<["'", '"', '`'], Input> extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralStringMapping<_0, Context>, Input] : [];
|
||||
export type TLiteralNumber<Input extends string, Context extends T.TProperties = {}> = Static.Token.Number<Input> extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralNumberMapping<_0, Context>, Input] : [];
|
||||
export type TLiteralBoolean<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'true', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.Const<'false', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends 'true' | 'false', infer Input extends string] ? [S.TLiteralBooleanMapping<_0, Context>, Input] : [];
|
||||
export type TLiteral<Input extends string, Context extends T.TProperties = {}> = (TLiteralBoolean<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralNumber<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralString<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TLiteralMapping<_0, Context>, Input] : [];
|
||||
export type TKeyOf<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'keyof', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TKeyOfMapping<_0, Context>, Input] : [];
|
||||
export type TIndexArray_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = ((Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TType<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<']', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [
|
||||
infer _0,
|
||||
infer Input extends string
|
||||
] ? [_0, Input] : []) extends [infer _0, infer Input extends string] ? TIndexArray_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TIndexArray<Input extends string, Context extends T.TProperties = {}> = TIndexArray_0<Input, Context> extends [infer _0 extends ([unknown, unknown, unknown] | [unknown, unknown])[], infer Input extends string] ? [S.TIndexArrayMapping<_0, Context>, Input] : [];
|
||||
export type TExtends<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'extends', Input> extends [infer _0, infer Input extends string] ? TType<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<'?', Input> extends [infer _2, infer Input extends string] ? TType<Input, Context> extends [infer _3, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _4, infer Input extends string] ? TType<Input, Context> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExtendsMapping<_0, Context>, Input] : [];
|
||||
export type TBase<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TType<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : TKeyword<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TObject<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TTuple<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteral<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructor<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TFunction<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TMapped<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TAsyncIterator<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TIterator<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructorParameters<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TFunctionParameters<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TInstanceType<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TReturnType<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TArgument<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TAwaited<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TArray<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TRecord<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TPromise<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TPartial<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TRequired<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TPick<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TOmit<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TExclude<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TExtract<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TUppercase<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TLowercase<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TCapitalize<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TUncapitalize<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TDate<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TUint8Array<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TGenericReference<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : TReference<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | unknown, infer Input extends string] ? [S.TBaseMapping<_0, Context>, Input] : [];
|
||||
export type TFactor<Input extends string, Context extends T.TProperties = {}> = (TKeyOf<Input, Context> extends [infer _0, infer Input extends string] ? TBase<Input, Context> extends [infer _1, infer Input extends string] ? TIndexArray<Input, Context> extends [infer _2, infer Input extends string] ? TExtends<Input, Context> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFactorMapping<_0, Context>, Input] : [];
|
||||
export type TExprTermTail<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'&', Input> extends [infer _0, infer Input extends string] ? TFactor<Input, Context> extends [infer _1, infer Input extends string] ? TExprTermTail<Input, Context> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTermTailMapping<_0, Context>, Input] : [];
|
||||
export type TExprTerm<Input extends string, Context extends T.TProperties = {}> = (TFactor<Input, Context> extends [infer _0, infer Input extends string] ? (TExprTermTail<Input, Context> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprTermMapping<_0, Context>, Input] : [];
|
||||
export type TExprTail<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'|', Input> extends [infer _0, infer Input extends string] ? TExprTerm<Input, Context> extends [infer _1, infer Input extends string] ? TExprTail<Input, Context> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTailMapping<_0, Context>, Input] : [];
|
||||
export type TExpr<Input extends string, Context extends T.TProperties = {}> = (TExprTerm<Input, Context> extends [infer _0, infer Input extends string] ? (TExprTail<Input, Context> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprMapping<_0, Context>, Input] : [];
|
||||
export type TType<Input extends string, Context extends T.TProperties = {}> = (TGenericArguments<Input, Context> extends [infer _0 extends T.TProperties, infer Input extends string] ? TExpr<Input, _0> : [] extends [infer _0, infer Input extends string] ? [_0, Input] : TExpr<Input, Context> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TTypeMapping<_0, Context>, Input] : [];
|
||||
export type TPropertyKey<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Ident<Input> extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.String<["'", '"'], Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends string, infer Input extends string] ? [S.TPropertyKeyMapping<_0, Context>, Input] : [];
|
||||
export type TReadonly<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'readonly', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TReadonlyMapping<_0, Context>, Input] : [];
|
||||
export type TOptional<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<'?', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TOptionalMapping<_0, Context>, Input] : [];
|
||||
export type TProperty<Input extends string, Context extends T.TProperties = {}> = (TReadonly<Input, Context> extends [infer _0, infer Input extends string] ? TPropertyKey<Input, Context> extends [infer _1, infer Input extends string] ? TOptional<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPropertyMapping<_0, Context>, Input] : [];
|
||||
export type TPropertyDelimiter<Input extends string, Context extends T.TProperties = {}> = ((Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [
|
||||
infer _0,
|
||||
infer Input extends string
|
||||
] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [
|
||||
infer _0,
|
||||
infer Input extends string
|
||||
] ? [_0, Input] : (Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'\n', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown] | [unknown], infer Input extends string] ? [S.TPropertyDelimiterMapping<_0, Context>, Input] : [];
|
||||
export type TPropertyList_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = (TProperty<Input, Context> extends [infer _0, infer Input extends string] ? (TPropertyDelimiter<Input, Context> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TPropertyList_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TPropertyList<Input extends string, Context extends T.TProperties = {}> = (TPropertyList_0<Input, Context> extends [infer _0, infer Input extends string] ? ((TProperty<Input, Context> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TPropertyListMapping<_0, Context>, Input] : [];
|
||||
export type TObject<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? TPropertyList<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TObjectMapping<_0, Context>, Input] : [];
|
||||
export type TElementList_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = (TType<Input, Context> extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TElementList_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TElementList<Input extends string, Context extends T.TProperties = {}> = (TElementList_0<Input, Context> extends [infer _0, infer Input extends string] ? ((TType<Input, Context> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TElementListMapping<_0, Context>, Input] : [];
|
||||
export type TTuple<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TElementList<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TTupleMapping<_0, Context>, Input] : [];
|
||||
export type TParameter<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Ident<Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TParameterMapping<_0, Context>, Input] : [];
|
||||
export type TParameterList_0<Input extends string, Context extends T.TProperties, Result extends unknown[] = []> = (TParameter<Input, Context> extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TParameterList_0<Input, Context, [...Result, _0]> : [Result, Input];
|
||||
export type TParameterList<Input extends string, Context extends T.TProperties = {}> = (TParameterList_0<Input, Context> extends [infer _0, infer Input extends string] ? ((TParameter<Input, Context> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TParameterListMapping<_0, Context>, Input] : [];
|
||||
export type TFunction<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TParameterList<Input, Context> extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionMapping<_0, Context>, Input] : [];
|
||||
export type TConstructor<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'new', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'(', Input> extends [infer _1, infer Input extends string] ? TParameterList<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _3, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _4, infer Input extends string] ? TType<Input, Context> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorMapping<_0, Context>, Input] : [];
|
||||
export type TMapped<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'[', Input> extends [infer _1, infer Input extends string] ? Static.Token.Ident<Input> extends [infer _2, infer Input extends string] ? Static.Token.Const<'in', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _5, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _6, infer Input extends string] ? TType<Input, Context> extends [infer _7, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _8, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5, _6, _7, _8], Input] : [] : [] : [] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TMappedMapping<_0, Context>, Input] : [];
|
||||
export type TAsyncIterator<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'AsyncIterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAsyncIteratorMapping<_0, Context>, Input] : [];
|
||||
export type TIterator<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Iterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TIteratorMapping<_0, Context>, Input] : [];
|
||||
export type TArgument<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Argument', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArgumentMapping<_0, Context>, Input] : [];
|
||||
export type TAwaited<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Awaited', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAwaitedMapping<_0, Context>, Input] : [];
|
||||
export type TArray<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Array', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArrayMapping<_0, Context>, Input] : [];
|
||||
export type TRecord<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Record', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRecordMapping<_0, Context>, Input] : [];
|
||||
export type TPromise<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Promise', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPromiseMapping<_0, Context>, Input] : [];
|
||||
export type TConstructorParameters<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'ConstructorParameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorParametersMapping<_0, Context>, Input] : [];
|
||||
export type TFunctionParameters<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Parameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionParametersMapping<_0, Context>, Input] : [];
|
||||
export type TInstanceType<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'InstanceType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TInstanceTypeMapping<_0, Context>, Input] : [];
|
||||
export type TReturnType<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'ReturnType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TReturnTypeMapping<_0, Context>, Input] : [];
|
||||
export type TPartial<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Partial', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPartialMapping<_0, Context>, Input] : [];
|
||||
export type TRequired<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Required', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRequiredMapping<_0, Context>, Input] : [];
|
||||
export type TPick<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Pick', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPickMapping<_0, Context>, Input] : [];
|
||||
export type TOmit<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Omit', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TOmitMapping<_0, Context>, Input] : [];
|
||||
export type TExclude<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Exclude', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExcludeMapping<_0, Context>, Input] : [];
|
||||
export type TExtract<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Extract', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType<Input, Context> extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExtractMapping<_0, Context>, Input] : [];
|
||||
export type TUppercase<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Uppercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUppercaseMapping<_0, Context>, Input] : [];
|
||||
export type TLowercase<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Lowercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TLowercaseMapping<_0, Context>, Input] : [];
|
||||
export type TCapitalize<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Capitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TCapitalizeMapping<_0, Context>, Input] : [];
|
||||
export type TUncapitalize<Input extends string, Context extends T.TProperties = {}> = (Static.Token.Const<'Uncapitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType<Input, Context> extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUncapitalizeMapping<_0, Context>, Input] : [];
|
||||
export type TDate<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'Date', Input> extends [infer _0 extends 'Date', infer Input extends string] ? [S.TDateMapping<_0, Context>, Input] : [];
|
||||
export type TUint8Array<Input extends string, Context extends T.TProperties = {}> = Static.Token.Const<'Uint8Array', Input> extends [infer _0 extends 'Uint8Array', infer Input extends string] ? [S.TUint8ArrayMapping<_0, Context>, Input] : [];
|
||||
export type TReference<Input extends string, Context extends T.TProperties = {}> = Static.Token.Ident<Input> extends [infer _0 extends string, infer Input extends string] ? [S.TReferenceMapping<_0, Context>, Input] : [];
|
||||
export declare const GenericReferenceParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const GenericReferenceParameterList: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const GenericReference: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const GenericArgumentsList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const GenericArgumentsList: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const GenericArguments: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordString: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordNumber: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordBoolean: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordUndefined: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordNull: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordInteger: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordBigInt: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordUnknown: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordAny: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordNever: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordSymbol: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeywordVoid: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Keyword: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const LiteralString: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const LiteralNumber: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const LiteralBoolean: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Literal: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const KeyOf: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const IndexArray_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const IndexArray: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Extends: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Base: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Factor: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ExprTermTail: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ExprTerm: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ExprTail: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Expr: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Type: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const PropertyKey: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Readonly: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Optional: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Property: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const PropertyDelimiter: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const PropertyList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const PropertyList: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const _Object: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ElementList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const ElementList: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Tuple: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Parameter: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string];
|
||||
export declare const ParameterList: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Function: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Constructor: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Mapped: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const AsyncIterator: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Iterator: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Argument: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Awaited: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Array: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Record: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Promise: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ConstructorParameters: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const FunctionParameters: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const InstanceType: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const ReturnType: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Partial: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Required: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Pick: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Omit: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Exclude: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Extract: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Uppercase: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Lowercase: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Capitalize: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Uncapitalize: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Date: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Uint8Array: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
export declare const Reference: (input: string, context?: T.TProperties) => [unknown, string] | [];
|
||||
191
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/parser.js
vendored
Normal file
191
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/parser.js
vendored
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Constructor = exports.Function = exports.ParameterList = exports.ParameterList_0 = exports.Parameter = exports.Tuple = exports.ElementList = exports.ElementList_0 = exports._Object = exports.PropertyList = exports.PropertyList_0 = exports.PropertyDelimiter = exports.Property = exports.Optional = exports.Readonly = exports.PropertyKey = exports.Type = exports.Expr = exports.ExprTail = exports.ExprTerm = exports.ExprTermTail = exports.Factor = exports.Base = exports.Extends = exports.IndexArray = exports.IndexArray_0 = exports.KeyOf = exports.Literal = exports.LiteralBoolean = exports.LiteralNumber = exports.LiteralString = exports.Keyword = exports.KeywordVoid = exports.KeywordSymbol = exports.KeywordNever = exports.KeywordAny = exports.KeywordUnknown = exports.KeywordBigInt = exports.KeywordInteger = exports.KeywordNull = exports.KeywordUndefined = exports.KeywordBoolean = exports.KeywordNumber = exports.KeywordString = exports.GenericArguments = exports.GenericArgumentsList = exports.GenericArgumentsList_0 = exports.GenericReference = exports.GenericReferenceParameterList = exports.GenericReferenceParameterList_0 = void 0;
|
||||
exports.Reference = exports.Uint8Array = exports.Date = exports.Uncapitalize = exports.Capitalize = exports.Lowercase = exports.Uppercase = exports.Extract = exports.Exclude = exports.Omit = exports.Pick = exports.Required = exports.Partial = exports.ReturnType = exports.InstanceType = exports.FunctionParameters = exports.ConstructorParameters = exports.Promise = exports.Record = exports.Array = exports.Awaited = exports.Argument = exports.Iterator = exports.AsyncIterator = exports.Mapped = void 0;
|
||||
const index_1 = require("../parser/index");
|
||||
const S = __importStar(require("./mapping"));
|
||||
const If = (result, left, right = () => []) => (result.length === 2 ? left(result) : right());
|
||||
const GenericReferenceParameterList_0 = (input, context, result = []) => If(If((0, exports.Type)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.GenericReferenceParameterList_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.GenericReferenceParameterList_0 = GenericReferenceParameterList_0;
|
||||
const GenericReferenceParameterList = (input, context = {}) => If(If((0, exports.GenericReferenceParameterList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Type)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericReferenceParameterListMapping(_0, context), input]);
|
||||
exports.GenericReferenceParameterList = GenericReferenceParameterList;
|
||||
const GenericReference = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.GenericReferenceParameterList)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.GenericReferenceMapping(_0, context), input]);
|
||||
exports.GenericReference = GenericReference;
|
||||
const GenericArgumentsList_0 = (input, context, result = []) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.GenericArgumentsList_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.GenericArgumentsList_0 = GenericArgumentsList_0;
|
||||
const GenericArgumentsList = (input, context = {}) => If(If((0, exports.GenericArgumentsList_0)(input, context), ([_0, input]) => If(If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericArgumentsListMapping(_0, context), input]);
|
||||
exports.GenericArgumentsList = GenericArgumentsList;
|
||||
const GenericArguments = (input, context = {}) => If(If(index_1.Runtime.Token.Const('<', input), ([_0, input]) => If((0, exports.GenericArgumentsList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('>', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.GenericArgumentsMapping(_0, context), input]);
|
||||
exports.GenericArguments = GenericArguments;
|
||||
const KeywordString = (input, context = {}) => If(index_1.Runtime.Token.Const('string', input), ([_0, input]) => [S.KeywordStringMapping(_0, context), input]);
|
||||
exports.KeywordString = KeywordString;
|
||||
const KeywordNumber = (input, context = {}) => If(index_1.Runtime.Token.Const('number', input), ([_0, input]) => [S.KeywordNumberMapping(_0, context), input]);
|
||||
exports.KeywordNumber = KeywordNumber;
|
||||
const KeywordBoolean = (input, context = {}) => If(index_1.Runtime.Token.Const('boolean', input), ([_0, input]) => [S.KeywordBooleanMapping(_0, context), input]);
|
||||
exports.KeywordBoolean = KeywordBoolean;
|
||||
const KeywordUndefined = (input, context = {}) => If(index_1.Runtime.Token.Const('undefined', input), ([_0, input]) => [S.KeywordUndefinedMapping(_0, context), input]);
|
||||
exports.KeywordUndefined = KeywordUndefined;
|
||||
const KeywordNull = (input, context = {}) => If(index_1.Runtime.Token.Const('null', input), ([_0, input]) => [S.KeywordNullMapping(_0, context), input]);
|
||||
exports.KeywordNull = KeywordNull;
|
||||
const KeywordInteger = (input, context = {}) => If(index_1.Runtime.Token.Const('integer', input), ([_0, input]) => [S.KeywordIntegerMapping(_0, context), input]);
|
||||
exports.KeywordInteger = KeywordInteger;
|
||||
const KeywordBigInt = (input, context = {}) => If(index_1.Runtime.Token.Const('bigint', input), ([_0, input]) => [S.KeywordBigIntMapping(_0, context), input]);
|
||||
exports.KeywordBigInt = KeywordBigInt;
|
||||
const KeywordUnknown = (input, context = {}) => If(index_1.Runtime.Token.Const('unknown', input), ([_0, input]) => [S.KeywordUnknownMapping(_0, context), input]);
|
||||
exports.KeywordUnknown = KeywordUnknown;
|
||||
const KeywordAny = (input, context = {}) => If(index_1.Runtime.Token.Const('any', input), ([_0, input]) => [S.KeywordAnyMapping(_0, context), input]);
|
||||
exports.KeywordAny = KeywordAny;
|
||||
const KeywordNever = (input, context = {}) => If(index_1.Runtime.Token.Const('never', input), ([_0, input]) => [S.KeywordNeverMapping(_0, context), input]);
|
||||
exports.KeywordNever = KeywordNever;
|
||||
const KeywordSymbol = (input, context = {}) => If(index_1.Runtime.Token.Const('symbol', input), ([_0, input]) => [S.KeywordSymbolMapping(_0, context), input]);
|
||||
exports.KeywordSymbol = KeywordSymbol;
|
||||
const KeywordVoid = (input, context = {}) => If(index_1.Runtime.Token.Const('void', input), ([_0, input]) => [S.KeywordVoidMapping(_0, context), input]);
|
||||
exports.KeywordVoid = KeywordVoid;
|
||||
const Keyword = (input, context = {}) => If(If((0, exports.KeywordString)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNumber)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordBoolean)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordUndefined)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNull)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordInteger)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordBigInt)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordUnknown)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordAny)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNever)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordSymbol)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordVoid)(input, context), ([_0, input]) => [_0, input], () => [])))))))))))), ([_0, input]) => [S.KeywordMapping(_0, context), input]);
|
||||
exports.Keyword = Keyword;
|
||||
const LiteralString = (input, context = {}) => If(index_1.Runtime.Token.String(["'", '"', '`'], input), ([_0, input]) => [S.LiteralStringMapping(_0, context), input]);
|
||||
exports.LiteralString = LiteralString;
|
||||
const LiteralNumber = (input, context = {}) => If(index_1.Runtime.Token.Number(input), ([_0, input]) => [S.LiteralNumberMapping(_0, context), input]);
|
||||
exports.LiteralNumber = LiteralNumber;
|
||||
const LiteralBoolean = (input, context = {}) => If(If(index_1.Runtime.Token.Const('true', input), ([_0, input]) => [_0, input], () => If(index_1.Runtime.Token.Const('false', input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.LiteralBooleanMapping(_0, context), input]);
|
||||
exports.LiteralBoolean = LiteralBoolean;
|
||||
const Literal = (input, context = {}) => If(If((0, exports.LiteralBoolean)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.LiteralNumber)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.LiteralString)(input, context), ([_0, input]) => [_0, input], () => []))), ([_0, input]) => [S.LiteralMapping(_0, context), input]);
|
||||
exports.Literal = Literal;
|
||||
const KeyOf = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('keyof', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.KeyOfMapping(_0, context), input]);
|
||||
exports.KeyOf = KeyOf;
|
||||
const IndexArray_0 = (input, context, result = []) => If(If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If(index_1.Runtime.Token.Const(']', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => (0, exports.IndexArray_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.IndexArray_0 = IndexArray_0;
|
||||
const IndexArray = (input, context = {}) => If((0, exports.IndexArray_0)(input, context), ([_0, input]) => [S.IndexArrayMapping(_0, context), input]);
|
||||
exports.IndexArray = IndexArray;
|
||||
const Extends = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('extends', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('?', input), ([_2, input]) => If((0, exports.Type)(input, context), ([_3, input]) => If(index_1.Runtime.Token.Const(':', input), ([_4, input]) => If((0, exports.Type)(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExtendsMapping(_0, context), input]);
|
||||
exports.Extends = Extends;
|
||||
const Base = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('(', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(')', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If((0, exports.Keyword)(input, context), ([_0, input]) => [_0, input], () => If((0, exports._Object)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Tuple)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Literal)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Constructor)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Function)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Mapped)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.AsyncIterator)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Iterator)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.ConstructorParameters)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.FunctionParameters)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.InstanceType)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.ReturnType)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Argument)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Awaited)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Array)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Record)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Promise)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Partial)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Required)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Pick)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Omit)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Exclude)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Extract)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uppercase)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Lowercase)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Capitalize)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uncapitalize)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Date)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uint8Array)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.GenericReference)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Reference)(input, context), ([_0, input]) => [_0, input], () => []))))))))))))))))))))))))))))))))), ([_0, input]) => [S.BaseMapping(_0, context), input]);
|
||||
exports.Base = Base;
|
||||
const Factor = (input, context = {}) => If(If((0, exports.KeyOf)(input, context), ([_0, input]) => If((0, exports.Base)(input, context), ([_1, input]) => If((0, exports.IndexArray)(input, context), ([_2, input]) => If((0, exports.Extends)(input, context), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FactorMapping(_0, context), input]);
|
||||
exports.Factor = Factor;
|
||||
const ExprTermTail = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('&', input), ([_0, input]) => If((0, exports.Factor)(input, context), ([_1, input]) => If((0, exports.ExprTermTail)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTermTailMapping(_0, context), input]);
|
||||
exports.ExprTermTail = ExprTermTail;
|
||||
const ExprTerm = (input, context = {}) => If(If((0, exports.Factor)(input, context), ([_0, input]) => If((0, exports.ExprTermTail)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprTermMapping(_0, context), input]);
|
||||
exports.ExprTerm = ExprTerm;
|
||||
const ExprTail = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('|', input), ([_0, input]) => If((0, exports.ExprTerm)(input, context), ([_1, input]) => If((0, exports.ExprTail)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTailMapping(_0, context), input]);
|
||||
exports.ExprTail = ExprTail;
|
||||
const Expr = (input, context = {}) => If(If((0, exports.ExprTerm)(input, context), ([_0, input]) => If((0, exports.ExprTail)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprMapping(_0, context), input]);
|
||||
exports.Expr = Expr;
|
||||
const Type = (input, context = {}) => If(If(If((0, exports.GenericArguments)(input, context), ([_0, input]) => (0, exports.Expr)(input, _0), () => []), ([_0, input]) => [_0, input], () => If((0, exports.Expr)(input, context), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.TypeMapping(_0, context), input]);
|
||||
exports.Type = Type;
|
||||
const PropertyKey = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [_0, input], () => If(index_1.Runtime.Token.String(["'", '"'], input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.PropertyKeyMapping(_0, context), input]);
|
||||
exports.PropertyKey = PropertyKey;
|
||||
const Readonly = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('readonly', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ReadonlyMapping(_0, context), input]);
|
||||
exports.Readonly = Readonly;
|
||||
const Optional = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('?', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.OptionalMapping(_0, context), input]);
|
||||
exports.Optional = Optional;
|
||||
const Property = (input, context = {}) => If(If((0, exports.Readonly)(input, context), ([_0, input]) => If((0, exports.PropertyKey)(input, context), ([_1, input]) => If((0, exports.Optional)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(':', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.PropertyMapping(_0, context), input]);
|
||||
exports.Property = Property;
|
||||
const PropertyDelimiter = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const(',', input), ([_0, input]) => If(index_1.Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(';', input), ([_0, input]) => If(index_1.Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(',', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(';', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const('\n', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => []))))), ([_0, input]) => [S.PropertyDelimiterMapping(_0, context), input]);
|
||||
exports.PropertyDelimiter = PropertyDelimiter;
|
||||
const PropertyList_0 = (input, context, result = []) => If(If((0, exports.Property)(input, context), ([_0, input]) => If((0, exports.PropertyDelimiter)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.PropertyList_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.PropertyList_0 = PropertyList_0;
|
||||
const PropertyList = (input, context = {}) => If(If((0, exports.PropertyList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Property)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.PropertyListMapping(_0, context), input]);
|
||||
exports.PropertyList = PropertyList;
|
||||
const _Object = (input, context = {}) => If(If(index_1.Runtime.Token.Const('{', input), ([_0, input]) => If((0, exports.PropertyList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('}', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ObjectMapping(_0, context), input]);
|
||||
exports._Object = _Object;
|
||||
const ElementList_0 = (input, context, result = []) => If(If((0, exports.Type)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.ElementList_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.ElementList_0 = ElementList_0;
|
||||
const ElementList = (input, context = {}) => If(If((0, exports.ElementList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Type)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ElementListMapping(_0, context), input]);
|
||||
exports.ElementList = ElementList;
|
||||
const Tuple = (input, context = {}) => If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If((0, exports.ElementList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.TupleMapping(_0, context), input]);
|
||||
exports.Tuple = Tuple;
|
||||
const Parameter = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const(':', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ParameterMapping(_0, context), input]);
|
||||
exports.Parameter = Parameter;
|
||||
const ParameterList_0 = (input, context, result = []) => If(If((0, exports.Parameter)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.ParameterList_0)(input, context, [...result, _0]), () => [result, input]);
|
||||
exports.ParameterList_0 = ParameterList_0;
|
||||
const ParameterList = (input, context = {}) => If(If((0, exports.ParameterList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Parameter)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ParameterListMapping(_0, context), input]);
|
||||
exports.ParameterList = ParameterList;
|
||||
const Function = (input, context = {}) => If(If(index_1.Runtime.Token.Const('(', input), ([_0, input]) => If((0, exports.ParameterList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(')', input), ([_2, input]) => If(index_1.Runtime.Token.Const('=>', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.FunctionMapping(_0, context), input]);
|
||||
exports.Function = Function;
|
||||
const Constructor = (input, context = {}) => If(If(index_1.Runtime.Token.Const('new', input), ([_0, input]) => If(index_1.Runtime.Token.Const('(', input), ([_1, input]) => If((0, exports.ParameterList)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(')', input), ([_3, input]) => If(index_1.Runtime.Token.Const('=>', input), ([_4, input]) => If((0, exports.Type)(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ConstructorMapping(_0, context), input]);
|
||||
exports.Constructor = Constructor;
|
||||
const Mapped = (input, context = {}) => If(If(index_1.Runtime.Token.Const('{', input), ([_0, input]) => If(index_1.Runtime.Token.Const('[', input), ([_1, input]) => If(index_1.Runtime.Token.Ident(input), ([_2, input]) => If(index_1.Runtime.Token.Const('in', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const(']', input), ([_5, input]) => If(index_1.Runtime.Token.Const(':', input), ([_6, input]) => If((0, exports.Type)(input, context), ([_7, input]) => If(index_1.Runtime.Token.Const('}', input), ([_8, input]) => [[_0, _1, _2, _3, _4, _5, _6, _7, _8], input]))))))))), ([_0, input]) => [S.MappedMapping(_0, context), input]);
|
||||
exports.Mapped = Mapped;
|
||||
const AsyncIterator = (input, context = {}) => If(If(index_1.Runtime.Token.Const('AsyncIterator', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AsyncIteratorMapping(_0, context), input]);
|
||||
exports.AsyncIterator = AsyncIterator;
|
||||
const Iterator = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Iterator', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.IteratorMapping(_0, context), input]);
|
||||
exports.Iterator = Iterator;
|
||||
const Argument = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Argument', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArgumentMapping(_0, context), input]);
|
||||
exports.Argument = Argument;
|
||||
const Awaited = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Awaited', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AwaitedMapping(_0, context), input]);
|
||||
exports.Awaited = Awaited;
|
||||
const Array = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Array', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArrayMapping(_0, context), input]);
|
||||
exports.Array = Array;
|
||||
const Record = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Record', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.RecordMapping(_0, context), input]);
|
||||
exports.Record = Record;
|
||||
const Promise = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Promise', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PromiseMapping(_0, context), input]);
|
||||
exports.Promise = Promise;
|
||||
const ConstructorParameters = (input, context = {}) => If(If(index_1.Runtime.Token.Const('ConstructorParameters', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ConstructorParametersMapping(_0, context), input]);
|
||||
exports.ConstructorParameters = ConstructorParameters;
|
||||
const FunctionParameters = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Parameters', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FunctionParametersMapping(_0, context), input]);
|
||||
exports.FunctionParameters = FunctionParameters;
|
||||
const InstanceType = (input, context = {}) => If(If(index_1.Runtime.Token.Const('InstanceType', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.InstanceTypeMapping(_0, context), input]);
|
||||
exports.InstanceType = InstanceType;
|
||||
const ReturnType = (input, context = {}) => If(If(index_1.Runtime.Token.Const('ReturnType', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ReturnTypeMapping(_0, context), input]);
|
||||
exports.ReturnType = ReturnType;
|
||||
const Partial = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Partial', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PartialMapping(_0, context), input]);
|
||||
exports.Partial = Partial;
|
||||
const Required = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Required', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.RequiredMapping(_0, context), input]);
|
||||
exports.Required = Required;
|
||||
const Pick = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Pick', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.PickMapping(_0, context), input]);
|
||||
exports.Pick = Pick;
|
||||
const Omit = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Omit', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.OmitMapping(_0, context), input]);
|
||||
exports.Omit = Omit;
|
||||
const Exclude = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Exclude', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExcludeMapping(_0, context), input]);
|
||||
exports.Exclude = Exclude;
|
||||
const Extract = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Extract', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExtractMapping(_0, context), input]);
|
||||
exports.Extract = Extract;
|
||||
const Uppercase = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Uppercase', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UppercaseMapping(_0, context), input]);
|
||||
exports.Uppercase = Uppercase;
|
||||
const Lowercase = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Lowercase', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.LowercaseMapping(_0, context), input]);
|
||||
exports.Lowercase = Lowercase;
|
||||
const Capitalize = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Capitalize', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.CapitalizeMapping(_0, context), input]);
|
||||
exports.Capitalize = Capitalize;
|
||||
const Uncapitalize = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Uncapitalize', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UncapitalizeMapping(_0, context), input]);
|
||||
exports.Uncapitalize = Uncapitalize;
|
||||
const Date = (input, context = {}) => If(index_1.Runtime.Token.Const('Date', input), ([_0, input]) => [S.DateMapping(_0, context), input]);
|
||||
exports.Date = Date;
|
||||
const Uint8Array = (input, context = {}) => If(index_1.Runtime.Token.Const('Uint8Array', input), ([_0, input]) => [S.Uint8ArrayMapping(_0, context), input]);
|
||||
exports.Uint8Array = Uint8Array;
|
||||
const Reference = (input, context = {}) => If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [S.ReferenceMapping(_0, context), input]);
|
||||
exports.Reference = Reference;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import * as t from '../type/index';
|
||||
import { TType } from './parser';
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */
|
||||
export declare function NoInfer<Context extends Record<PropertyKey, t.TSchema>, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): t.TSchema;
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */
|
||||
export declare function NoInfer<Input extends string>(input: Input, options?: t.SchemaOptions): t.TSchema;
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types */
|
||||
export type TSyntax<Context extends Record<PropertyKey, t.TSchema>, Code extends string> = (TType<Code, Context> extends [infer Type extends t.TSchema, string] ? Type : t.TNever);
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types */
|
||||
export declare function Syntax<Context extends Record<PropertyKey, t.TSchema>, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): TSyntax<Context, Input>;
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types */
|
||||
export declare function Syntax<Input extends string>(annotation: Input, options?: t.SchemaOptions): TSyntax<{}, Input>;
|
||||
54
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/syntax.js
vendored
Normal file
54
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/syntax/syntax.js
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NoInfer = NoInfer;
|
||||
exports.Syntax = Syntax;
|
||||
const t = __importStar(require("../type/index"));
|
||||
const parser_1 = require("./parser");
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */
|
||||
// prettier-ignore
|
||||
function NoInfer(...args) {
|
||||
const withContext = typeof args[0] === 'string' ? false : true;
|
||||
const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}];
|
||||
const result = (0, parser_1.Type)(code, context)[0];
|
||||
return t.KindGuard.IsSchema(result)
|
||||
? t.CloneType(result, options)
|
||||
: t.Never(options);
|
||||
}
|
||||
/** `[Experimental]` Parses type expressions into TypeBox types */
|
||||
function Syntax(...args) {
|
||||
return NoInfer.apply(null, args);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * from './policy';
|
||||
export * from './system';
|
||||
19
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/index.js
vendored
Normal file
19
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/index.js
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./policy"), exports);
|
||||
__exportStar(require("./system"), exports);
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
export declare namespace TypeSystemPolicy {
|
||||
/**
|
||||
* Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript
|
||||
* references for embedded types, which may cause side effects if type properties are explicitly updated
|
||||
* outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation,
|
||||
* preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making
|
||||
* it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the
|
||||
* fastest way to instantiate types. The default setting is `default`.
|
||||
*/
|
||||
let InstanceMode: 'default' | 'clone' | 'freeze';
|
||||
/** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */
|
||||
let ExactOptionalPropertyTypes: boolean;
|
||||
/** Sets whether arrays should be treated as a kind of objects. The default is `false` */
|
||||
let AllowArrayObject: boolean;
|
||||
/** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */
|
||||
let AllowNaN: boolean;
|
||||
/** Sets whether `null` should validate for void types. The default is `false` */
|
||||
let AllowNullVoid: boolean;
|
||||
/** Checks this value using the ExactOptionalPropertyTypes policy */
|
||||
function IsExactOptionalProperty(value: Record<keyof any, unknown>, key: string): boolean;
|
||||
/** Checks this value using the AllowArrayObjects policy */
|
||||
function IsObjectLike(value: unknown): value is Record<keyof any, unknown>;
|
||||
/** Checks this value as a record using the AllowArrayObjects policy */
|
||||
function IsRecordLike(value: unknown): value is Record<keyof any, unknown>;
|
||||
/** Checks this value using the AllowNaN policy */
|
||||
function IsNumberLike(value: unknown): value is number;
|
||||
/** Checks this value using the AllowVoidNull policy */
|
||||
function IsVoidLike(value: unknown): value is void;
|
||||
}
|
||||
58
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/policy.js
vendored
Normal file
58
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/policy.js
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeSystemPolicy = void 0;
|
||||
const index_1 = require("../value/guard/index");
|
||||
var TypeSystemPolicy;
|
||||
(function (TypeSystemPolicy) {
|
||||
// ------------------------------------------------------------------
|
||||
// TypeSystemPolicy: Instancing
|
||||
// ------------------------------------------------------------------
|
||||
/**
|
||||
* Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript
|
||||
* references for embedded types, which may cause side effects if type properties are explicitly updated
|
||||
* outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation,
|
||||
* preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making
|
||||
* it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the
|
||||
* fastest way to instantiate types. The default setting is `default`.
|
||||
*/
|
||||
TypeSystemPolicy.InstanceMode = 'default';
|
||||
// ------------------------------------------------------------------
|
||||
// TypeSystemPolicy: Checking
|
||||
// ------------------------------------------------------------------
|
||||
/** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */
|
||||
TypeSystemPolicy.ExactOptionalPropertyTypes = false;
|
||||
/** Sets whether arrays should be treated as a kind of objects. The default is `false` */
|
||||
TypeSystemPolicy.AllowArrayObject = false;
|
||||
/** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */
|
||||
TypeSystemPolicy.AllowNaN = false;
|
||||
/** Sets whether `null` should validate for void types. The default is `false` */
|
||||
TypeSystemPolicy.AllowNullVoid = false;
|
||||
/** Checks this value using the ExactOptionalPropertyTypes policy */
|
||||
function IsExactOptionalProperty(value, key) {
|
||||
return TypeSystemPolicy.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined;
|
||||
}
|
||||
TypeSystemPolicy.IsExactOptionalProperty = IsExactOptionalProperty;
|
||||
/** Checks this value using the AllowArrayObjects policy */
|
||||
function IsObjectLike(value) {
|
||||
const isObject = (0, index_1.IsObject)(value);
|
||||
return TypeSystemPolicy.AllowArrayObject ? isObject : isObject && !(0, index_1.IsArray)(value);
|
||||
}
|
||||
TypeSystemPolicy.IsObjectLike = IsObjectLike;
|
||||
/** Checks this value as a record using the AllowArrayObjects policy */
|
||||
function IsRecordLike(value) {
|
||||
return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
|
||||
}
|
||||
TypeSystemPolicy.IsRecordLike = IsRecordLike;
|
||||
/** Checks this value using the AllowNaN policy */
|
||||
function IsNumberLike(value) {
|
||||
return TypeSystemPolicy.AllowNaN ? (0, index_1.IsNumber)(value) : Number.isFinite(value);
|
||||
}
|
||||
TypeSystemPolicy.IsNumberLike = IsNumberLike;
|
||||
/** Checks this value using the AllowVoidNull policy */
|
||||
function IsVoidLike(value) {
|
||||
const isUndefined = (0, index_1.IsUndefined)(value);
|
||||
return TypeSystemPolicy.AllowNullVoid ? isUndefined || value === null : isUndefined;
|
||||
}
|
||||
TypeSystemPolicy.IsVoidLike = IsVoidLike;
|
||||
})(TypeSystemPolicy || (exports.TypeSystemPolicy = TypeSystemPolicy = {}));
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { type TUnsafe } from '../type/unsafe/index';
|
||||
import { TypeBoxError } from '../type/error/index';
|
||||
export declare class TypeSystemDuplicateTypeKind extends TypeBoxError {
|
||||
constructor(kind: string);
|
||||
}
|
||||
export declare class TypeSystemDuplicateFormat extends TypeBoxError {
|
||||
constructor(kind: string);
|
||||
}
|
||||
export type TypeFactoryFunction<Type, Options = Record<PropertyKey, unknown>> = (options?: Partial<Options>) => TUnsafe<Type>;
|
||||
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
||||
export declare namespace TypeSystem {
|
||||
/** Creates a new type */
|
||||
function Type<Type, Options = Record<PropertyKey, unknown>>(kind: string, check: (options: Options, value: unknown) => boolean): TypeFactoryFunction<Type, Options>;
|
||||
/** Creates a new string format */
|
||||
function Format<F extends string>(format: F, check: (value: string) => boolean): F;
|
||||
}
|
||||
43
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/system.js
vendored
Normal file
43
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/system/system.js
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0;
|
||||
const index_1 = require("../type/registry/index");
|
||||
const index_2 = require("../type/unsafe/index");
|
||||
const index_3 = require("../type/symbols/index");
|
||||
const index_4 = require("../type/error/index");
|
||||
// ------------------------------------------------------------------
|
||||
// Errors
|
||||
// ------------------------------------------------------------------
|
||||
class TypeSystemDuplicateTypeKind extends index_4.TypeBoxError {
|
||||
constructor(kind) {
|
||||
super(`Duplicate type kind '${kind}' detected`);
|
||||
}
|
||||
}
|
||||
exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind;
|
||||
class TypeSystemDuplicateFormat extends index_4.TypeBoxError {
|
||||
constructor(kind) {
|
||||
super(`Duplicate string format '${kind}' detected`);
|
||||
}
|
||||
}
|
||||
exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat;
|
||||
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
||||
var TypeSystem;
|
||||
(function (TypeSystem) {
|
||||
/** Creates a new type */
|
||||
function Type(kind, check) {
|
||||
if (index_1.TypeRegistry.Has(kind))
|
||||
throw new TypeSystemDuplicateTypeKind(kind);
|
||||
index_1.TypeRegistry.Set(kind, check);
|
||||
return (options = {}) => (0, index_2.Unsafe)({ ...options, [index_3.Kind]: kind });
|
||||
}
|
||||
TypeSystem.Type = Type;
|
||||
/** Creates a new string format */
|
||||
function Format(format, check) {
|
||||
if (index_1.FormatRegistry.Has(format))
|
||||
throw new TypeSystemDuplicateFormat(format);
|
||||
index_1.FormatRegistry.Set(format, check);
|
||||
return format;
|
||||
}
|
||||
TypeSystem.Format = Format;
|
||||
})(TypeSystem || (exports.TypeSystem = TypeSystem = {}));
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import type { TSchema, SchemaOptions } from '../schema/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface TAny extends TSchema {
|
||||
[Kind]: 'Any';
|
||||
static: any;
|
||||
}
|
||||
/** `[Json]` Creates an Any type */
|
||||
export declare function Any(options?: SchemaOptions): TAny;
|
||||
10
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/type/any/any.js
vendored
Normal file
10
apps/macos/Sources/Clawdis/Resources/WebChat/vendor/@sinclair/typebox/build/cjs/type/any/any.js
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Any = Any;
|
||||
const index_1 = require("../create/index");
|
||||
const index_2 = require("../symbols/index");
|
||||
/** `[Json]` Creates an Any type */
|
||||
function Any(options) {
|
||||
return (0, index_1.CreateType)({ [index_2.Kind]: 'Any' }, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './any';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./any"), exports);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type { TSchema } from '../schema/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface TArgument<Index extends number = number> extends TSchema {
|
||||
[Kind]: 'Argument';
|
||||
static: unknown;
|
||||
index: Index;
|
||||
}
|
||||
/** `[JavaScript]` Creates an Argument Type. */
|
||||
export declare function Argument<Index extends number>(index: Index): TArgument<Index>;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Argument = Argument;
|
||||
const type_1 = require("../create/type");
|
||||
const index_1 = require("../symbols/index");
|
||||
/** `[JavaScript]` Creates an Argument Type. */
|
||||
function Argument(index) {
|
||||
return (0, type_1.CreateType)({ [index_1.Kind]: 'Argument', index });
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './argument';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./argument"), exports);
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import { Ensure } from '../helpers/index';
|
||||
import type { SchemaOptions, TSchema } from '../schema/index';
|
||||
import type { Static } from '../static/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface ArrayOptions extends SchemaOptions {
|
||||
/** The minimum number of items in this array */
|
||||
minItems?: number;
|
||||
/** The maximum number of items in this array */
|
||||
maxItems?: number;
|
||||
/** Should this schema contain unique items */
|
||||
uniqueItems?: boolean;
|
||||
/** A schema for which some elements should match */
|
||||
contains?: TSchema;
|
||||
/** A minimum number of contains schema matches */
|
||||
minContains?: number;
|
||||
/** A maximum number of contains schema matches */
|
||||
maxContains?: number;
|
||||
}
|
||||
type ArrayStatic<T extends TSchema, P extends unknown[]> = Ensure<Static<T, P>[]>;
|
||||
export interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptions {
|
||||
[Kind]: 'Array';
|
||||
static: ArrayStatic<T, this['params']>;
|
||||
type: 'array';
|
||||
items: T;
|
||||
}
|
||||
/** `[Json]` Creates an Array type */
|
||||
export declare function Array<Type extends TSchema>(items: Type, options?: ArrayOptions): TArray<Type>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Array = Array;
|
||||
const type_1 = require("../create/type");
|
||||
const index_1 = require("../symbols/index");
|
||||
/** `[Json]` Creates an Array type */
|
||||
function Array(items, options) {
|
||||
return (0, type_1.CreateType)({ [index_1.Kind]: 'Array', type: 'array', items }, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './array';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./array"), exports);
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import type { TSchema, SchemaOptions } from '../schema/index';
|
||||
import type { Static } from '../static/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface TAsyncIterator<T extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'AsyncIterator';
|
||||
static: AsyncIterableIterator<Static<T, this['params']>>;
|
||||
type: 'AsyncIterator';
|
||||
items: T;
|
||||
}
|
||||
/** `[JavaScript]` Creates a AsyncIterator type */
|
||||
export declare function AsyncIterator<T extends TSchema>(items: T, options?: SchemaOptions): TAsyncIterator<T>;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AsyncIterator = AsyncIterator;
|
||||
const index_1 = require("../symbols/index");
|
||||
const type_1 = require("../create/type");
|
||||
/** `[JavaScript]` Creates a AsyncIterator type */
|
||||
function AsyncIterator(items, options) {
|
||||
return (0, type_1.CreateType)({ [index_1.Kind]: 'AsyncIterator', type: 'AsyncIterator', items }, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './async-iterator';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./async-iterator"), exports);
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import { Ensure } from '../helpers/index';
|
||||
import type { TSchema, SchemaOptions } from '../schema/index';
|
||||
import { type TComputed } from '../computed/index';
|
||||
import { type TIntersect } from '../intersect/index';
|
||||
import { type TUnion } from '../union/index';
|
||||
import { type TPromise } from '../promise/index';
|
||||
import { type TRef } from '../ref/index';
|
||||
type TFromComputed<Target extends string, Parameters extends TSchema[]> = Ensure<(TComputed<'Awaited', [TComputed<Target, Parameters>]>)>;
|
||||
type TFromRef<Ref extends string> = Ensure<TComputed<'Awaited', [TRef<Ref>]>>;
|
||||
type TFromRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<Right, [...Result, TAwaited<Left>]> : Result);
|
||||
export type TAwaited<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TPromise<infer Type extends TSchema> ? TAwaited<Type> : Type);
|
||||
/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
|
||||
export declare function Awaited<T extends TSchema>(type: T, options?: SchemaOptions): TAwaited<T>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Awaited = Awaited;
|
||||
const type_1 = require("../create/type");
|
||||
const index_1 = require("../computed/index");
|
||||
const index_2 = require("../intersect/index");
|
||||
const index_3 = require("../union/index");
|
||||
const index_4 = require("../ref/index");
|
||||
// ------------------------------------------------------------------
|
||||
// TypeGuard
|
||||
// ------------------------------------------------------------------
|
||||
const kind_1 = require("../guard/kind");
|
||||
// prettier-ignore
|
||||
function FromComputed(target, parameters) {
|
||||
return (0, index_1.Computed)('Awaited', [(0, index_1.Computed)(target, parameters)]);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FromRef($ref) {
|
||||
return (0, index_1.Computed)('Awaited', [(0, index_4.Ref)($ref)]);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FromIntersect(types) {
|
||||
return (0, index_2.Intersect)(FromRest(types));
|
||||
}
|
||||
// prettier-ignore
|
||||
function FromUnion(types) {
|
||||
return (0, index_3.Union)(FromRest(types));
|
||||
}
|
||||
// prettier-ignore
|
||||
function FromPromise(type) {
|
||||
return Awaited(type);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FromRest(types) {
|
||||
return types.map(type => Awaited(type));
|
||||
}
|
||||
/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
|
||||
function Awaited(type, options) {
|
||||
return (0, type_1.CreateType)((0, kind_1.IsComputed)(type) ? FromComputed(type.target, type.parameters) : (0, kind_1.IsIntersect)(type) ? FromIntersect(type.allOf) : (0, kind_1.IsUnion)(type) ? FromUnion(type.anyOf) : (0, kind_1.IsPromise)(type) ? FromPromise(type.item) : (0, kind_1.IsRef)(type) ? FromRef(type.$ref) : type, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './awaited';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./awaited"), exports);
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import type { TSchema, SchemaOptions } from '../schema/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface BigIntOptions extends SchemaOptions {
|
||||
exclusiveMaximum?: bigint;
|
||||
exclusiveMinimum?: bigint;
|
||||
maximum?: bigint;
|
||||
minimum?: bigint;
|
||||
multipleOf?: bigint;
|
||||
}
|
||||
export interface TBigInt extends TSchema, BigIntOptions {
|
||||
[Kind]: 'BigInt';
|
||||
static: bigint;
|
||||
type: 'bigint';
|
||||
}
|
||||
/** `[JavaScript]` Creates a BigInt type */
|
||||
export declare function BigInt(options?: BigIntOptions): TBigInt;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BigInt = BigInt;
|
||||
const index_1 = require("../symbols/index");
|
||||
const index_2 = require("../create/index");
|
||||
/** `[JavaScript]` Creates a BigInt type */
|
||||
function BigInt(options) {
|
||||
return (0, index_2.CreateType)({ [index_1.Kind]: 'BigInt', type: 'bigint' }, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './bigint';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./bigint"), exports);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type { TSchema, SchemaOptions } from '../schema/index';
|
||||
import { Kind } from '../symbols/index';
|
||||
export interface TBoolean extends TSchema {
|
||||
[Kind]: 'Boolean';
|
||||
static: boolean;
|
||||
type: 'boolean';
|
||||
}
|
||||
/** `[Json]` Creates a Boolean type */
|
||||
export declare function Boolean(options?: SchemaOptions): TBoolean;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Boolean = Boolean;
|
||||
const index_1 = require("../symbols/index");
|
||||
const index_2 = require("../create/index");
|
||||
/** `[Json]` Creates a Boolean type */
|
||||
function Boolean(options) {
|
||||
return (0, index_2.CreateType)({ [index_1.Kind]: 'Boolean', type: 'boolean' }, options);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './boolean';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./boolean"), exports);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * from './type';
|
||||
export * from './value';
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./type"), exports);
|
||||
__exportStar(require("./value"), exports);
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import { TSchema, SchemaOptions } from '../schema/index';
|
||||
/** Clones a Rest */
|
||||
export declare function CloneRest<T extends TSchema[]>(schemas: T): T;
|
||||
/** Clones a Type */
|
||||
export declare function CloneType<T extends TSchema>(schema: T, options?: SchemaOptions): T;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CloneRest = CloneRest;
|
||||
exports.CloneType = CloneType;
|
||||
const value_1 = require("./value");
|
||||
/** Clones a Rest */
|
||||
function CloneRest(schemas) {
|
||||
return schemas.map((schema) => CloneType(schema));
|
||||
}
|
||||
/** Clones a Type */
|
||||
function CloneType(schema, options) {
|
||||
return options === undefined ? (0, value_1.Clone)(schema) : (0, value_1.Clone)({ ...options, ...schema });
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/** Clones a value */
|
||||
export declare function Clone<T>(value: T): T;
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Clone = Clone;
|
||||
const ValueGuard = __importStar(require("../guard/value"));
|
||||
function ArrayType(value) {
|
||||
return value.map((value) => Visit(value));
|
||||
}
|
||||
function DateType(value) {
|
||||
return new Date(value.getTime());
|
||||
}
|
||||
function Uint8ArrayType(value) {
|
||||
return new Uint8Array(value);
|
||||
}
|
||||
function RegExpType(value) {
|
||||
return new RegExp(value.source, value.flags);
|
||||
}
|
||||
function ObjectType(value) {
|
||||
const result = {};
|
||||
for (const key of Object.getOwnPropertyNames(value)) {
|
||||
result[key] = Visit(value[key]);
|
||||
}
|
||||
for (const key of Object.getOwnPropertySymbols(value)) {
|
||||
result[key] = Visit(value[key]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// prettier-ignore
|
||||
function Visit(value) {
|
||||
return (ValueGuard.IsArray(value) ? ArrayType(value) :
|
||||
ValueGuard.IsDate(value) ? DateType(value) :
|
||||
ValueGuard.IsUint8Array(value) ? Uint8ArrayType(value) :
|
||||
ValueGuard.IsRegExp(value) ? RegExpType(value) :
|
||||
ValueGuard.IsObject(value) ? ObjectType(value) :
|
||||
value);
|
||||
}
|
||||
/** Clones a value */
|
||||
function Clone(value) {
|
||||
return Visit(value);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import type { TSchema } from '../schema/index';
|
||||
import type { Evaluate } from '../helpers/index';
|
||||
import { type TIntersectEvaluated } from '../intersect/index';
|
||||
import { type TIndexFromPropertyKeys } from '../indexed/index';
|
||||
import { type TKeyOfPropertyKeys } from '../keyof/index';
|
||||
import { type TNever } from '../never/index';
|
||||
import { type TObject, type TProperties, type ObjectOptions } from '../object/index';
|
||||
import { TSetDistinct } from '../sets/index';
|
||||
type TCompositeKeys<T extends TSchema[], Acc extends PropertyKey[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeKeys<R, [...Acc, ...TKeyOfPropertyKeys<L>]> : TSetDistinct<Acc>);
|
||||
type TFilterNever<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFilterNever<R, [...Acc]> : TFilterNever<R, [...Acc, L]> : Acc);
|
||||
type TCompositeProperty<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeProperty<R, K, [...Acc, ...TIndexFromPropertyKeys<L, [K]>]> : TFilterNever<Acc>);
|
||||
type TCompositeProperties<T extends TSchema[], K extends PropertyKey[], Acc = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TCompositeProperties<T, R, Acc & {
|
||||
[_ in L]: TIntersectEvaluated<TCompositeProperty<T, L>>;
|
||||
}> : Acc);
|
||||
type TCompositeEvaluate<T extends TSchema[], K extends PropertyKey[] = TCompositeKeys<T>, P extends TProperties = Evaluate<TCompositeProperties<T, K>>, R extends TObject = TObject<P>> = R;
|
||||
export type TComposite<T extends TSchema[]> = TCompositeEvaluate<T>;
|
||||
export declare function Composite<T extends TSchema[]>(T: [...T], options?: ObjectOptions): TComposite<T>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Composite = Composite;
|
||||
const index_1 = require("../intersect/index");
|
||||
const index_2 = require("../indexed/index");
|
||||
const index_3 = require("../keyof/index");
|
||||
const index_4 = require("../object/index");
|
||||
const index_5 = require("../sets/index");
|
||||
// ------------------------------------------------------------------
|
||||
// TypeGuard
|
||||
// ------------------------------------------------------------------
|
||||
const kind_1 = require("../guard/kind");
|
||||
// prettier-ignore
|
||||
function CompositeKeys(T) {
|
||||
const Acc = [];
|
||||
for (const L of T)
|
||||
Acc.push(...(0, index_3.KeyOfPropertyKeys)(L));
|
||||
return (0, index_5.SetDistinct)(Acc);
|
||||
}
|
||||
// prettier-ignore
|
||||
function FilterNever(T) {
|
||||
return T.filter(L => !(0, kind_1.IsNever)(L));
|
||||
}
|
||||
// prettier-ignore
|
||||
function CompositeProperty(T, K) {
|
||||
const Acc = [];
|
||||
for (const L of T)
|
||||
Acc.push(...(0, index_2.IndexFromPropertyKeys)(L, [K]));
|
||||
return FilterNever(Acc);
|
||||
}
|
||||
// prettier-ignore
|
||||
function CompositeProperties(T, K) {
|
||||
const Acc = {};
|
||||
for (const L of K) {
|
||||
Acc[L] = (0, index_1.IntersectEvaluated)(CompositeProperty(T, L));
|
||||
}
|
||||
return Acc;
|
||||
}
|
||||
// prettier-ignore
|
||||
function Composite(T, options) {
|
||||
const K = CompositeKeys(T);
|
||||
const P = CompositeProperties(T, K);
|
||||
const R = (0, index_4.Object)(P, options);
|
||||
return R;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './composite';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./composite"), exports);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue