@remoteoss/json-schema-form 1.0.0-dev.20250520155439 â 1.0.0-dev.20250828124250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -67
- package/dist/index.d.ts +52 -11
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Remote Technology, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,87 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/media/jsf_logo_dark.png" width="600" alt="json-schema-form">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<code>json-schema-form</code> is a headless UI form library powered by <a href="https://json-schema.org/">JSON Schemas</a>.
|
|
7
|
+
<br/>
|
|
8
|
+
It transforms JSON schemas into Javascript `fields` to be more easily consumed by your UI libraries.
|
|
9
|
+
</p>
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
avoiding any major breaking change.
|
|
11
|
-
This is under active development, more info soon!
|
|
11
|
+
---
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Why JSON Schemas for forms?
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
JSON Schemas are the SSoT (Single Source of Truth) that allows you to share form's data _structure_ and _validations_ between the server (backend) and the client (frontend), regardless of the language used.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
git clone https://github.com/remoteoss/json-schema-form.git --recursive
|
|
19
|
-
```
|
|
17
|
+
You can use it beyond UI Forms, like lists, tables, and any other UI that needs structured JSON data.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
you can initialize and update them with:
|
|
19
|
+
## Installation
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
git submodule update --init
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
2. Navigate to the "next" folder
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
cd json-schema-form/next
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
3. Install dependencies. You **must use [`pnpm`](https://pnpm.io/)**
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pnpm install
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
4. Work in the "next" folder only
|
|
41
|
-
|
|
42
|
-
Open your editor in this folder and run commands from.
|
|
43
|
-
Otherwise, your editor may fail to set up linting and type checking,
|
|
44
|
-
while your terminal may fail to resolve paths.
|
|
45
|
-
|
|
46
|
-
The limitation of this approach is that
|
|
47
|
-
your editor will fail to recognise our git repository here.
|
|
48
|
-
This also means you should turn off the editor's suggestion
|
|
49
|
-
to open git repository at root.
|
|
50
|
-
|
|
51
|
-
## Testing
|
|
52
|
-
|
|
53
|
-
To run the tests, navigate to the "next" folder and run:
|
|
21
|
+
Available on [NPM](https://www.npmjs.com/package/@remoteoss/json-schema-form).
|
|
54
22
|
|
|
55
23
|
```bash
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Or run the tests in watch mode:
|
|
24
|
+
npm install @remoteoss/json-schema-form
|
|
25
|
+
# or
|
|
60
26
|
|
|
61
|
-
|
|
62
|
-
pnpm test:watch
|
|
27
|
+
yarn install @remoteoss/json-schema-form
|
|
63
28
|
```
|
|
64
29
|
|
|
65
|
-
|
|
30
|
+
## Getting Started
|
|
66
31
|
|
|
67
|
-
|
|
68
|
-
1. The new tests for this version
|
|
32
|
+
Check the đ **[JSF website](https://json-schema-form.vercel.app/)** for documentation.
|
|
69
33
|
|
|
70
|
-
|
|
71
|
-
The new tests are located in the `./test` folder.
|
|
34
|
+
### Playground
|
|
72
35
|
|
|
73
|
-
|
|
36
|
+
Check the đšī¸ **[JSF Playground](https://json-schema-form.vercel.app/?path=/docs/playground--docs)** for demos.
|
|
74
37
|
|
|
75
|
-
##
|
|
38
|
+
## Contributing
|
|
76
39
|
|
|
77
|
-
|
|
78
|
-
We recommend using the exact version specified in `.nvmrc`:
|
|
40
|
+
Read [CONTRIBUTING](CONTRIBUTING.md) to get started.
|
|
79
41
|
|
|
80
|
-
|
|
42
|
+
## Migrating
|
|
81
43
|
|
|
82
|
-
|
|
83
|
-
nvm use
|
|
84
|
-
```
|
|
44
|
+
If you're using `v0` and wish to migrate to `v1`, read [MIGRATING](MIGRATING.md) to get started.
|
|
85
45
|
|
|
86
|
-
|
|
87
|
-
tests and other development tasks will likely fail.
|
|
46
|
+
_Backed by [Remote.com](https://remote.com/)_
|
package/dist/index.d.ts
CHANGED
|
@@ -52,13 +52,20 @@ type JsfSchema = JSONSchema & {
|
|
|
52
52
|
'if'?: JsfSchema;
|
|
53
53
|
'then'?: JsfSchema;
|
|
54
54
|
'else'?: JsfSchema;
|
|
55
|
+
'value'?: SchemaValue;
|
|
55
56
|
'required'?: string[];
|
|
57
|
+
/** Defines the order of the fields in the form. */
|
|
56
58
|
'x-jsf-order'?: string[];
|
|
59
|
+
/** Defines the presentation of the field in the form. */
|
|
57
60
|
'x-jsf-presentation'?: JsfPresentation;
|
|
61
|
+
/** Defines the error message of the field in the form. */
|
|
58
62
|
'x-jsf-errorMessage'?: Record<string, string>;
|
|
63
|
+
/** Defines all JSON Logic rules for the schema (both validations and computed values). */
|
|
59
64
|
'x-jsf-logic'?: JsonLogicSchema;
|
|
65
|
+
/** Extra validations to run. References validations declared in the `x-jsf-logic` root property. */
|
|
60
66
|
'x-jsf-logic-validations'?: string[];
|
|
61
|
-
|
|
67
|
+
/** Extra attributes to add to the schema. References computedValues in the `x-jsf-logic` root property. */
|
|
68
|
+
'x-jsf-logic-computedAttrs'?: Record<string, string | object>;
|
|
62
69
|
};
|
|
63
70
|
/**
|
|
64
71
|
* JSON Schema Form type without booleans.
|
|
@@ -100,18 +107,38 @@ interface Field {
|
|
|
100
107
|
options?: unknown[];
|
|
101
108
|
const?: unknown;
|
|
102
109
|
checkboxValue?: unknown;
|
|
110
|
+
default?: unknown;
|
|
103
111
|
[key: string]: unknown;
|
|
104
112
|
}
|
|
105
|
-
type FieldType = 'text' | 'number' | 'select' | 'file' | 'radio' | 'group-array' | 'email' | 'date' | 'checkbox' | 'fieldset' | 'money' | 'country' | 'textarea';
|
|
113
|
+
type FieldType = 'text' | 'number' | 'select' | 'file' | 'radio' | 'group-array' | 'email' | 'date' | 'checkbox' | 'fieldset' | 'money' | 'country' | 'textarea' | 'hidden';
|
|
106
114
|
|
|
107
|
-
interface
|
|
115
|
+
interface LegacyOptions {
|
|
108
116
|
/**
|
|
109
117
|
* A null value will be treated as undefined.
|
|
110
|
-
*
|
|
118
|
+
* When true, providing a value to a schema that is `false`,
|
|
111
119
|
* the validation will succeed instead of returning a type error.
|
|
120
|
+
* This was a bug in v0, we fixed it in v1. If you need the same wrong behavior, set this to true.
|
|
112
121
|
* @default false
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* Schema: { "properties": { "name": { "type": "string" } } }
|
|
125
|
+
* Value: { "name": null } // Validation succeeds, even though the type is not 'null'
|
|
126
|
+
* ```
|
|
113
127
|
*/
|
|
114
128
|
treatNullAsUndefined?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* A value against a schema "false" will be allowed.
|
|
131
|
+
* When true, providing a value to a non-required field that is not of type 'null' or ['null']
|
|
132
|
+
* the validation will succeed instead of returning a type error.
|
|
133
|
+
* This was a bug in v0, we fixed it in v1. If you need the same wrong behavior, set this to true.
|
|
134
|
+
* @default false
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* Schema: { "properties": { "age": false } }
|
|
138
|
+
* Value: { age: 10 } // Validation succeeds, even though the value is forbidden;
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
allowForbiddenValues?: boolean;
|
|
115
142
|
}
|
|
116
143
|
|
|
117
144
|
interface FormResult {
|
|
@@ -138,22 +165,36 @@ interface CreateHeadlessFormOptions {
|
|
|
138
165
|
*/
|
|
139
166
|
initialValues?: SchemaValue;
|
|
140
167
|
/**
|
|
141
|
-
*
|
|
168
|
+
* Backward compatibility config with v0
|
|
142
169
|
*/
|
|
143
|
-
|
|
170
|
+
legacyOptions?: LegacyOptions;
|
|
144
171
|
/**
|
|
145
172
|
* When enabled, ['x-jsf-presentation'].inputType is required for all properties.
|
|
146
173
|
* @default false
|
|
147
174
|
*/
|
|
148
175
|
strictInputType?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Custom user defined functions. A dictionary of name and function
|
|
178
|
+
*/
|
|
179
|
+
customJsonLogicOps?: Record<string, (...args: any[]) => any>;
|
|
149
180
|
}
|
|
150
181
|
declare function createHeadlessForm(schema: JsfObjectSchema, options?: CreateHeadlessFormOptions): FormResult;
|
|
151
182
|
|
|
152
|
-
type FieldOutput = Partial<JsfSchema
|
|
183
|
+
type FieldOutput = Partial<JsfSchema>;
|
|
184
|
+
type FieldModification = Partial<JsfSchema> & {
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated Use `x-jsf-presentation` instead
|
|
187
|
+
*/
|
|
188
|
+
presentation?: JsfSchema['x-jsf-presentation'];
|
|
189
|
+
/**
|
|
190
|
+
* @deprecated Use `x-jsf-errorMessage` instead
|
|
191
|
+
*/
|
|
192
|
+
errorMessage?: JsfSchema['x-jsf-errorMessage'];
|
|
193
|
+
};
|
|
153
194
|
interface ModifyConfig {
|
|
154
|
-
fields?: Record<string,
|
|
155
|
-
allFields?: (name: string, attrs: JsfSchema) =>
|
|
156
|
-
create?: Record<string,
|
|
195
|
+
fields?: Record<string, FieldModification | ((attrs: JsfSchema) => FieldOutput)>;
|
|
196
|
+
allFields?: (name: string, attrs: JsfSchema) => FieldModification;
|
|
197
|
+
create?: Record<string, FieldModification>;
|
|
157
198
|
pick?: string[];
|
|
158
199
|
orderRoot?: string[] | ((originalOrder: string[]) => string[]);
|
|
159
200
|
muteLogging?: boolean;
|
|
@@ -183,4 +224,4 @@ declare function modifySchema(originalSchema: JsfSchema, config: ModifyConfig):
|
|
|
183
224
|
warnings: (Warning | null)[];
|
|
184
225
|
};
|
|
185
226
|
|
|
186
|
-
export { type CreateHeadlessFormOptions, type Field, type FieldType, type FormErrors, type
|
|
227
|
+
export { type CreateHeadlessFormOptions, type Field, type FieldType, type FormErrors, type LegacyOptions, type ValidationResult, createHeadlessForm, modifySchema as modify };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var Ua=Object.create;var pr=Object.defineProperty;var Ha=Object.getOwnPropertyDescriptor;var za=Object.getOwnPropertyNames;var Ga=Object.getPrototypeOf,Wa=Object.prototype.hasOwnProperty;var u=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ka=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of za(r))!Wa.call(e,i)&&i!==t&&pr(e,i,{get:()=>r[i],enumerable:!(n=Ha(r,i))||n.enumerable});return e};var A=(e,r,t)=>(t=e!=null?Ua(Ga(e)):{},ka(r||!e||!e.__esModule?pr(t,"default",{value:e,enumerable:!0}):t,e));var W=u((am,dr)=>{"use strict";dr.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var Ae=u(q=>{"use strict";var h=W(),_e=()=>[{type:h.RANGE,from:48,to:57}],hr=()=>[{type:h.CHAR,value:95},{type:h.RANGE,from:97,to:122},{type:h.RANGE,from:65,to:90}].concat(_e()),mr=()=>[{type:h.CHAR,value:9},{type:h.CHAR,value:10},{type:h.CHAR,value:11},{type:h.CHAR,value:12},{type:h.CHAR,value:13},{type:h.CHAR,value:32},{type:h.CHAR,value:160},{type:h.CHAR,value:5760},{type:h.RANGE,from:8192,to:8202},{type:h.CHAR,value:8232},{type:h.CHAR,value:8233},{type:h.CHAR,value:8239},{type:h.CHAR,value:8287},{type:h.CHAR,value:12288},{type:h.CHAR,value:65279}],Ka=()=>[{type:h.CHAR,value:10},{type:h.CHAR,value:13},{type:h.CHAR,value:8232},{type:h.CHAR,value:8233}];q.words=()=>({type:h.SET,set:hr(),not:!1});q.notWords=()=>({type:h.SET,set:hr(),not:!0});q.ints=()=>({type:h.SET,set:_e(),not:!1});q.notInts=()=>({type:h.SET,set:_e(),not:!0});q.whitespace=()=>({type:h.SET,set:mr(),not:!1});q.notWhitespace=()=>({type:h.SET,set:mr(),not:!0});q.anyChar=()=>({type:h.SET,set:Ka(),not:!0})});var yr=u(k=>{"use strict";var gr=W(),F=Ae(),Xa="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",Ya={0:0,t:9,n:10,v:11,f:12,r:13};k.strToChars=function(e){var r=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return e=e.replace(r,function(t,n,i,o,a,s,l,f){if(i)return t;var c=n?8:o?parseInt(o,16):a?parseInt(a,16):s?parseInt(s,8):l?Xa.indexOf(l):Ya[f],p=String.fromCharCode(c);return/[[\]{}^$.|?*+()]/.test(p)&&(p="\\"+p),p}),e};k.tokenizeClass=(e,r)=>{for(var t=[],n=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,i,o;(i=n.exec(e))!=null;)if(i[1])t.push(F.words());else if(i[2])t.push(F.ints());else if(i[3])t.push(F.whitespace());else if(i[4])t.push(F.notWords());else if(i[5])t.push(F.notInts());else if(i[6])t.push(F.notWhitespace());else if(i[7])t.push({type:gr.RANGE,from:(i[8]||i[9]).charCodeAt(0),to:i[10].charCodeAt(0)});else if(o=i[12])t.push({type:gr.CHAR,value:o.charCodeAt(0)});else return[t,n.lastIndex];k.error(r,"Unterminated character class")};k.error=(e,r)=>{throw new SyntaxError("Invalid regular expression: /"+e+"/: "+r)}});var br=u(K=>{"use strict";var ce=W();K.wordBoundary=()=>({type:ce.POSITION,value:"b"});K.nonWordBoundary=()=>({type:ce.POSITION,value:"B"});K.begin=()=>({type:ce.POSITION,value:"^"});K.end=()=>({type:ce.POSITION,value:"$"})});var xr=u((fm,Ve)=>{"use strict";var J=yr(),v=W(),V=Ae(),pe=br();Ve.exports=e=>{var r=0,t,n,i={type:v.ROOT,stack:[]},o=i,a=i.stack,s=[],l=$a=>{J.error(e,`Nothing to repeat at column ${$a-1}`)},f=J.strToChars(e);for(t=f.length;r<t;)switch(n=f[r++],n){case"\\":switch(n=f[r++],n){case"b":a.push(pe.wordBoundary());break;case"B":a.push(pe.nonWordBoundary());break;case"w":a.push(V.words());break;case"W":a.push(V.notWords());break;case"d":a.push(V.ints());break;case"D":a.push(V.notInts());break;case"s":a.push(V.whitespace());break;case"S":a.push(V.notWhitespace());break;default:/\d/.test(n)?a.push({type:v.REFERENCE,value:parseInt(n,10)}):a.push({type:v.CHAR,value:n.charCodeAt(0)})}break;case"^":a.push(pe.begin());break;case"$":a.push(pe.end());break;case"[":var c;f[r]==="^"?(c=!0,r++):c=!1;var p=J.tokenizeClass(f.slice(r),e);r+=p[1],a.push({type:v.SET,set:p[0],not:c});break;case".":a.push(V.anyChar());break;case"(":var d={type:v.GROUP,stack:[],remember:!0};n=f[r],n==="?"&&(n=f[r+1],r+=2,n==="="?d.followedBy=!0:n==="!"?d.notFollowedBy=!0:n!==":"&&J.error(e,`Invalid group, character '${n}' after '?' at column ${r-1}`),d.remember=!1),a.push(d),s.push(o),o=d,a=d.stack;break;case")":s.length===0&&J.error(e,`Unmatched ) at column ${r-1}`),o=s.pop(),a=o.options?o.options[o.options.length-1]:o.stack;break;case"|":o.options||(o.options=[o.stack],delete o.stack);var g=[];o.options.push(g),a=g;break;case"{":var x=/^(\d+)(,(\d+)?)?\}/.exec(f.slice(r)),_,cr;x!==null?(a.length===0&&l(r),_=parseInt(x[1],10),cr=x[2]?x[3]?parseInt(x[3],10):1/0:_,r+=x[0].length,a.push({type:v.REPETITION,min:_,max:cr,value:a.pop()})):a.push({type:v.CHAR,value:123});break;case"?":a.length===0&&l(r),a.push({type:v.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&l(r),a.push({type:v.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&l(r),a.push({type:v.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:v.CHAR,value:n.charCodeAt(0)})}return s.length!==0&&J.error(e,"Unterminated group"),i};Ve.exports.types=v});var vr=u((cm,Sr)=>{"use strict";var P=class e{constructor(r,t){this.low=r,this.high=t,this.length=1+t-r}overlaps(r){return!(this.high<r.low||this.low>r.high)}touches(r){return!(this.high+1<r.low||this.low-1>r.high)}add(r){return new e(Math.min(this.low,r.low),Math.max(this.high,r.high))}subtract(r){return r.low<=this.low&&r.high>=this.high?[]:r.low>this.low&&r.high<this.high?[new e(this.low,r.low-1),new e(r.high+1,this.high)]:r.low<=this.low?[new e(r.high+1,this.high)]:[new e(this.low,r.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},Ce=class e{constructor(r,t){this.ranges=[],this.length=0,r!=null&&this.add(r,t)}_update_length(){this.length=this.ranges.reduce((r,t)=>r+t.length,0)}add(r,t){var n=i=>{for(var o=0;o<this.ranges.length&&!i.touches(this.ranges[o]);)o++;for(var a=this.ranges.slice(0,o);o<this.ranges.length&&i.touches(this.ranges[o]);)i=i.add(this.ranges[o]),o++;a.push(i),this.ranges=a.concat(this.ranges.slice(o)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new P(r,t))),this}subtract(r,t){var n=i=>{for(var o=0;o<this.ranges.length&&!i.overlaps(this.ranges[o]);)o++;for(var a=this.ranges.slice(0,o);o<this.ranges.length&&i.overlaps(this.ranges[o]);)a=a.concat(this.ranges[o].subtract(i)),o++;this.ranges=a.concat(this.ranges.slice(o)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new P(r,t))),this}intersect(r,t){var n=[],i=o=>{for(var a=0;a<this.ranges.length&&!o.overlaps(this.ranges[a]);)a++;for(;a<this.ranges.length&&o.overlaps(this.ranges[a]);){var s=Math.max(this.ranges[a].low,o.low),l=Math.min(this.ranges[a].high,o.high);n.push(new P(s,l)),a++}};return r instanceof e?r.ranges.forEach(i):(t==null&&(t=r),i(new P(r,t))),this.ranges=n,this._update_length(),this}index(r){for(var t=0;t<this.ranges.length&&this.ranges[t].length<=r;)r-=this.ranges[t].length,t++;return this.ranges[t].low+r}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new e(this)}numbers(){return this.ranges.reduce((r,t)=>{for(var n=t.low;n<=t.high;)r.push(n),n++;return r},[])}subranges(){return this.ranges.map(r=>({low:r.low,high:r.high,length:1+r.high-r.low}))}};Sr.exports=Ce});var Or=u((pm,Er)=>{"use strict";var de=xr(),X=vr(),C=de.types;Er.exports=class Y{constructor(r,t){if(this._setDefaults(r),r instanceof RegExp)this.ignoreCase=r.ignoreCase,this.multiline=r.multiline,r=r.source;else if(typeof r=="string")this.ignoreCase=t&&t.indexOf("i")!==-1,this.multiline=t&&t.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=de(r)}_setDefaults(r){this.max=r.max!=null?r.max:Y.prototype.max!=null?Y.prototype.max:100,this.defaultRange=r.defaultRange?r.defaultRange:this.defaultRange.clone(),r.randInt&&(this.randInt=r.randInt)}gen(){return this._gen(this.tokens,[])}_gen(r,t){var n,i,o,a,s;switch(r.type){case C.ROOT:case C.GROUP:if(r.followedBy||r.notFollowedBy)return"";for(r.remember&&r.groupNumber===void 0&&(r.groupNumber=t.push(null)-1),n=r.options?this._randSelect(r.options):r.stack,i="",a=0,s=n.length;a<s;a++)i+=this._gen(n[a],t);return r.remember&&(t[r.groupNumber]=i),i;case C.POSITION:return"";case C.SET:var l=this._expand(r);return l.length?String.fromCharCode(this._randSelect(l)):"";case C.REPETITION:for(o=this.randInt(r.min,r.max===1/0?r.min+this.max:r.max),i="",a=0;a<o;a++)i+=this._gen(r.value,t);return i;case C.REFERENCE:return t[r.value-1]||"";case C.CHAR:var f=this.ignoreCase&&this._randBool()?this._toOtherCase(r.value):r.value;return String.fromCharCode(f)}}_toOtherCase(r){return r+(97<=r&&r<=122?-32:65<=r&&r<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(r){return r instanceof X?r.index(this.randInt(0,r.length-1)):r[this.randInt(0,r.length-1)]}_expand(r){if(r.type===de.types.CHAR)return new X(r.value);if(r.type===de.types.RANGE)return new X(r.from,r.to);{let t=new X;for(let n=0;n<r.set.length;n++){let i=this._expand(r.set[n]);if(t.add(i),this.ignoreCase)for(let o=0;o<i.length;o++){let a=i.index(o),s=this._toOtherCase(a);a!==s&&t.add(s)}}return r.not?this.defaultRange.clone().subtract(t):this.defaultRange.clone().intersect(t)}}randInt(r,t){return r+Math.floor(Math.random()*(1+t-r))}get defaultRange(){return this._range=this._range||new X(32,126)}set defaultRange(r){this._range=r}static randexp(r,t){var n;return typeof r=="string"&&(r=new RegExp(r,t)),r._randexp===void 0?(n=new Y(r,t),r._randexp=n):(n=r._randexp,n._setDefaults(r)),n.gen()}static sugar(){RegExp.prototype.gen=function(){return Y.randexp(this)}}}});var Le=u((Sg,Yr)=>{"use strict";var As=typeof global=="object"&&global&&global.Object===Object&&global;Yr.exports=As});var R=u((vg,Zr)=>{"use strict";var Vs=Le(),Cs=typeof self=="object"&&self&&self.Object===Object&&self,Rs=Vs||Cs||Function("return this")();Zr.exports=Rs});var Q=u((Eg,Qr)=>{"use strict";var js=R(),Ns=js.Symbol;Qr.exports=Ns});var nt=u((Og,tt)=>{"use strict";var et=Q(),rt=Object.prototype,Fs=rt.hasOwnProperty,Js=rt.toString,ee=et?et.toStringTag:void 0;function Ps(e){var r=Fs.call(e,ee),t=e[ee];try{e[ee]=void 0;var n=!0}catch{}var i=Js.call(e);return n&&(r?e[ee]=t:delete e[ee]),i}tt.exports=Ps});var ot=u((Tg,it)=>{"use strict";var Ms=Object.prototype,Ls=Ms.toString;function Ds(e){return Ls.call(e)}it.exports=Ds});var M=u((qg,ut)=>{"use strict";var at=Q(),Bs=nt(),$s=ot(),Us="[object Null]",Hs="[object Undefined]",st=at?at.toStringTag:void 0;function zs(e){return e==null?e===void 0?Hs:Us:st&&st in Object(e)?Bs(e):$s(e)}ut.exports=zs});var T=u((Ig,lt)=>{"use strict";function Gs(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}lt.exports=Gs});var me=u((wg,ft)=>{"use strict";var Ws=M(),ks=T(),Ks="[object AsyncFunction]",Xs="[object Function]",Ys="[object GeneratorFunction]",Zs="[object Proxy]";function Qs(e){if(!ks(e))return!1;var r=Ws(e);return r==Xs||r==Ys||r==Ks||r==Zs}ft.exports=Qs});var pt=u((_g,ct)=>{"use strict";var eu=R(),ru=eu["__core-js_shared__"];ct.exports=ru});var mt=u((Ag,ht)=>{"use strict";var De=pt(),dt=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function tu(e){return!!dt&&dt in e}ht.exports=tu});var yt=u((Vg,gt)=>{"use strict";var nu=Function.prototype,iu=nu.toString;function ou(e){if(e!=null){try{return iu.call(e)}catch{}try{return e+""}catch{}}return""}gt.exports=ou});var xt=u((Cg,bt)=>{"use strict";var au=me(),su=mt(),uu=T(),lu=yt(),fu=/[\\^$.*+?()[\]{}|]/g,cu=/^\[object .+?Constructor\]$/,pu=Function.prototype,du=Object.prototype,hu=pu.toString,mu=du.hasOwnProperty,gu=RegExp("^"+hu.call(mu).replace(fu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function yu(e){if(!uu(e)||su(e))return!1;var r=au(e)?gu:cu;return r.test(lu(e))}bt.exports=yu});var vt=u((Rg,St)=>{"use strict";function bu(e,r){return e?.[r]}St.exports=bu});var ge=u((jg,Et)=>{"use strict";var xu=xt(),Su=vt();function vu(e,r){var t=Su(e,r);return xu(t)?t:void 0}Et.exports=vu});var re=u((Ng,Ot)=>{"use strict";var Eu=ge(),Ou=Eu(Object,"create");Ot.exports=Ou});var It=u((Fg,qt)=>{"use strict";var Tt=re();function Tu(){this.__data__=Tt?Tt(null):{},this.size=0}qt.exports=Tu});var _t=u((Jg,wt)=>{"use strict";function qu(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}wt.exports=qu});var Vt=u((Pg,At)=>{"use strict";var Iu=re(),wu="__lodash_hash_undefined__",_u=Object.prototype,Au=_u.hasOwnProperty;function Vu(e){var r=this.__data__;if(Iu){var t=r[e];return t===wu?void 0:t}return Au.call(r,e)?r[e]:void 0}At.exports=Vu});var Rt=u((Mg,Ct)=>{"use strict";var Cu=re(),Ru=Object.prototype,ju=Ru.hasOwnProperty;function Nu(e){var r=this.__data__;return Cu?r[e]!==void 0:ju.call(r,e)}Ct.exports=Nu});var Nt=u((Lg,jt)=>{"use strict";var Fu=re(),Ju="__lodash_hash_undefined__";function Pu(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=Fu&&r===void 0?Ju:r,this}jt.exports=Pu});var Jt=u((Dg,Ft)=>{"use strict";var Mu=It(),Lu=_t(),Du=Vt(),Bu=Rt(),$u=Nt();function L(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}L.prototype.clear=Mu;L.prototype.delete=Lu;L.prototype.get=Du;L.prototype.has=Bu;L.prototype.set=$u;Ft.exports=L});var Mt=u((Bg,Pt)=>{"use strict";function Uu(){this.__data__=[],this.size=0}Pt.exports=Uu});var te=u(($g,Lt)=>{"use strict";function Hu(e,r){return e===r||e!==e&&r!==r}Lt.exports=Hu});var ne=u((Ug,Dt)=>{"use strict";var zu=te();function Gu(e,r){for(var t=e.length;t--;)if(zu(e[t][0],r))return t;return-1}Dt.exports=Gu});var $t=u((Hg,Bt)=>{"use strict";var Wu=ne(),ku=Array.prototype,Ku=ku.splice;function Xu(e){var r=this.__data__,t=Wu(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():Ku.call(r,t,1),--this.size,!0}Bt.exports=Xu});var Ht=u((zg,Ut)=>{"use strict";var Yu=ne();function Zu(e){var r=this.__data__,t=Yu(r,e);return t<0?void 0:r[t][1]}Ut.exports=Zu});var Gt=u((Gg,zt)=>{"use strict";var Qu=ne();function el(e){return Qu(this.__data__,e)>-1}zt.exports=el});var kt=u((Wg,Wt)=>{"use strict";var rl=ne();function tl(e,r){var t=this.__data__,n=rl(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}Wt.exports=tl});var ie=u((kg,Kt)=>{"use strict";var nl=Mt(),il=$t(),ol=Ht(),al=Gt(),sl=kt();function D(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}D.prototype.clear=nl;D.prototype.delete=il;D.prototype.get=ol;D.prototype.has=al;D.prototype.set=sl;Kt.exports=D});var Be=u((Kg,Xt)=>{"use strict";var ul=ge(),ll=R(),fl=ul(ll,"Map");Xt.exports=fl});var Qt=u((Xg,Zt)=>{"use strict";var Yt=Jt(),cl=ie(),pl=Be();function dl(){this.size=0,this.__data__={hash:new Yt,map:new(pl||cl),string:new Yt}}Zt.exports=dl});var rn=u((Yg,en)=>{"use strict";function hl(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}en.exports=hl});var oe=u((Zg,tn)=>{"use strict";var ml=rn();function gl(e,r){var t=e.__data__;return ml(r)?t[typeof r=="string"?"string":"hash"]:t.map}tn.exports=gl});var on=u((Qg,nn)=>{"use strict";var yl=oe();function bl(e){var r=yl(this,e).delete(e);return this.size-=r?1:0,r}nn.exports=bl});var sn=u((ey,an)=>{"use strict";var xl=oe();function Sl(e){return xl(this,e).get(e)}an.exports=Sl});var ln=u((ry,un)=>{"use strict";var vl=oe();function El(e){return vl(this,e).has(e)}un.exports=El});var cn=u((ty,fn)=>{"use strict";var Ol=oe();function Tl(e,r){var t=Ol(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}fn.exports=Tl});var ye=u((ny,pn)=>{"use strict";var ql=Qt(),Il=on(),wl=sn(),_l=ln(),Al=cn();function B(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}B.prototype.clear=ql;B.prototype.delete=Il;B.prototype.get=wl;B.prototype.has=_l;B.prototype.set=Al;pn.exports=B});var hn=u((iy,dn)=>{"use strict";var Vl="__lodash_hash_undefined__";function Cl(e){return this.__data__.set(e,Vl),this}dn.exports=Cl});var gn=u((oy,mn)=>{"use strict";function Rl(e){return this.__data__.has(e)}mn.exports=Rl});var $e=u((ay,yn)=>{"use strict";var jl=ye(),Nl=hn(),Fl=gn();function be(e){var r=-1,t=e==null?0:e.length;for(this.__data__=new jl;++r<t;)this.add(e[r])}be.prototype.add=be.prototype.push=Nl;be.prototype.has=Fl;yn.exports=be});var xn=u((sy,bn)=>{"use strict";function Jl(e,r,t,n){for(var i=e.length,o=t+(n?1:-1);n?o--:++o<i;)if(r(e[o],o,e))return o;return-1}bn.exports=Jl});var vn=u((uy,Sn)=>{"use strict";function Pl(e){return e!==e}Sn.exports=Pl});var On=u((ly,En)=>{"use strict";function Ml(e,r,t){for(var n=t-1,i=e.length;++n<i;)if(e[n]===r)return n;return-1}En.exports=Ml});var qn=u((fy,Tn)=>{"use strict";var Ll=xn(),Dl=vn(),Bl=On();function $l(e,r,t){return r===r?Bl(e,r,t):Ll(e,Dl,t)}Tn.exports=$l});var Ue=u((cy,In)=>{"use strict";var Ul=qn();function Hl(e,r){var t=e==null?0:e.length;return!!t&&Ul(e,r,0)>-1}In.exports=Hl});var He=u((py,wn)=>{"use strict";function zl(e,r,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(r,e[n]))return!0;return!1}wn.exports=zl});var ae=u((dy,_n)=>{"use strict";function Gl(e,r){for(var t=-1,n=e==null?0:e.length,i=Array(n);++t<n;)i[t]=r(e[t],t,e);return i}_n.exports=Gl});var xe=u((hy,An)=>{"use strict";function Wl(e){return function(r){return e(r)}}An.exports=Wl});var ze=u((my,Vn)=>{"use strict";function kl(e,r){return e.has(r)}Vn.exports=kl});var Rn=u((gy,Cn)=>{"use strict";var Kl=$e(),Xl=Ue(),Yl=He(),Zl=ae(),Ql=xe(),ef=ze(),rf=200;function tf(e,r,t,n){var i=-1,o=Xl,a=!0,s=e.length,l=[],f=r.length;if(!s)return l;t&&(r=Zl(r,Ql(t))),n?(o=Yl,a=!1):r.length>=rf&&(o=ef,a=!1,r=new Kl(r));e:for(;++i<s;){var c=e[i],p=t==null?c:t(c);if(c=n||c!==0?c:0,a&&p===p){for(var d=f;d--;)if(r[d]===p)continue e;l.push(c)}else o(r,p,n)||l.push(c)}return l}Cn.exports=tf});var Nn=u((yy,jn)=>{"use strict";function nf(e,r){for(var t=-1,n=r.length,i=e.length;++t<n;)e[i+t]=r[t];return e}jn.exports=nf});var j=u((by,Fn)=>{"use strict";function of(e){return e!=null&&typeof e=="object"}Fn.exports=of});var Pn=u((xy,Jn)=>{"use strict";var af=M(),sf=j(),uf="[object Arguments]";function lf(e){return sf(e)&&af(e)==uf}Jn.exports=lf});var Se=u((Sy,Dn)=>{"use strict";var Mn=Pn(),ff=j(),Ln=Object.prototype,cf=Ln.hasOwnProperty,pf=Ln.propertyIsEnumerable,df=Mn(function(){return arguments}())?Mn:function(e){return ff(e)&&cf.call(e,"callee")&&!pf.call(e,"callee")};Dn.exports=df});var N=u((vy,Bn)=>{"use strict";var hf=Array.isArray;Bn.exports=hf});var zn=u((Ey,Hn)=>{"use strict";var $n=Q(),mf=Se(),gf=N(),Un=$n?$n.isConcatSpreadable:void 0;function yf(e){return gf(e)||mf(e)||!!(Un&&e&&e[Un])}Hn.exports=yf});var kn=u((Oy,Wn)=>{"use strict";var bf=Nn(),xf=zn();function Gn(e,r,t,n,i){var o=-1,a=e.length;for(t||(t=xf),i||(i=[]);++o<a;){var s=e[o];r>0&&t(s)?r>1?Gn(s,r-1,t,n,i):bf(i,s):n||(i[i.length]=s)}return i}Wn.exports=Gn});var Ge=u((Ty,Kn)=>{"use strict";function Sf(e){return e}Kn.exports=Sf});var Yn=u((qy,Xn)=>{"use strict";function vf(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}Xn.exports=vf});var ei=u((Iy,Qn)=>{"use strict";var Ef=Yn(),Zn=Math.max;function Of(e,r,t){return r=Zn(r===void 0?e.length-1:r,0),function(){for(var n=arguments,i=-1,o=Zn(n.length-r,0),a=Array(o);++i<o;)a[i]=n[r+i];i=-1;for(var s=Array(r+1);++i<r;)s[i]=n[i];return s[r]=t(a),Ef(e,this,s)}}Qn.exports=Of});var ti=u((wy,ri)=>{"use strict";function Tf(e){return function(){return e}}ri.exports=Tf});var We=u((_y,ni)=>{"use strict";var qf=ge(),If=function(){try{var e=qf(Object,"defineProperty");return e({},"",{}),e}catch{}}();ni.exports=If});var ai=u((Ay,oi)=>{"use strict";var wf=ti(),ii=We(),_f=Ge(),Af=ii?function(e,r){return ii(e,"toString",{configurable:!0,enumerable:!1,value:wf(r),writable:!0})}:_f;oi.exports=Af});var ui=u((Vy,si)=>{"use strict";var Vf=800,Cf=16,Rf=Date.now;function jf(e){var r=0,t=0;return function(){var n=Rf(),i=Cf-(n-t);if(t=n,i>0){if(++r>=Vf)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}si.exports=jf});var fi=u((Cy,li)=>{"use strict";var Nf=ai(),Ff=ui(),Jf=Ff(Nf);li.exports=Jf});var ve=u((Ry,ci)=>{"use strict";var Pf=Ge(),Mf=ei(),Lf=fi();function Df(e,r){return Lf(Mf(e,r,Pf),e+"")}ci.exports=Df});var ke=u((jy,pi)=>{"use strict";var Bf=9007199254740991;function $f(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Bf}pi.exports=$f});var Ee=u((Ny,di)=>{"use strict";var Uf=me(),Hf=ke();function zf(e){return e!=null&&Hf(e.length)&&!Uf(e)}di.exports=zf});var Oe=u((Fy,hi)=>{"use strict";var Gf=Ee(),Wf=j();function kf(e){return Wf(e)&&Gf(e)}hi.exports=kf});var yi=u((Jy,gi)=>{"use strict";var Kf=Rn(),Xf=kn(),Yf=ve(),mi=Oe(),Zf=Yf(function(e,r){return mi(e)?Kf(e,Xf(r,1,mi,!0)):[]});gi.exports=Zf});var Te=u((Py,bi)=>{"use strict";var Qf=M(),ec=j(),rc="[object Symbol]";function tc(e){return typeof e=="symbol"||ec(e)&&Qf(e)==rc}bi.exports=tc});var Si=u((My,xi)=>{"use strict";var nc=N(),ic=Te(),oc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ac=/^\w*$/;function sc(e,r){if(nc(e))return!1;var t=typeof e;return t=="number"||t=="symbol"||t=="boolean"||e==null||ic(e)?!0:ac.test(e)||!oc.test(e)||r!=null&&e in Object(r)}xi.exports=sc});var Oi=u((Ly,Ei)=>{"use strict";var vi=ye(),uc="Expected a function";function Ke(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new TypeError(uc);var t=function(){var n=arguments,i=r?r.apply(this,n):n[0],o=t.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return t.cache=o.set(i,a)||o,a};return t.cache=new(Ke.Cache||vi),t}Ke.Cache=vi;Ei.exports=Ke});var qi=u((Dy,Ti)=>{"use strict";var lc=Oi(),fc=500;function cc(e){var r=lc(e,function(n){return t.size===fc&&t.clear(),n}),t=r.cache;return r}Ti.exports=cc});var wi=u((By,Ii)=>{"use strict";var pc=qi(),dc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hc=/\\(\\)?/g,mc=pc(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(dc,function(t,n,i,o){r.push(i?o.replace(hc,"$1"):n||t)}),r});Ii.exports=mc});var ji=u(($y,Ri)=>{"use strict";var _i=Q(),gc=ae(),yc=N(),bc=Te(),xc=1/0,Ai=_i?_i.prototype:void 0,Vi=Ai?Ai.toString:void 0;function Ci(e){if(typeof e=="string")return e;if(yc(e))return gc(e,Ci)+"";if(bc(e))return Vi?Vi.call(e):"";var r=e+"";return r=="0"&&1/e==-xc?"-0":r}Ri.exports=Ci});var Fi=u((Uy,Ni)=>{"use strict";var Sc=ji();function vc(e){return e==null?"":Sc(e)}Ni.exports=vc});var Xe=u((Hy,Ji)=>{"use strict";var Ec=N(),Oc=Si(),Tc=wi(),qc=Fi();function Ic(e,r){return Ec(e)?e:Oc(e,r)?[e]:Tc(qc(e))}Ji.exports=Ic});var Ye=u((zy,Pi)=>{"use strict";var wc=Te(),_c=1/0;function Ac(e){if(typeof e=="string"||wc(e))return e;var r=e+"";return r=="0"&&1/e==-_c?"-0":r}Pi.exports=Ac});var Li=u((Gy,Mi)=>{"use strict";var Vc=Xe(),Cc=Ye();function Rc(e,r){r=Vc(r,e);for(var t=0,n=r.length;e!=null&&t<n;)e=e[Cc(r[t++])];return t&&t==n?e:void 0}Mi.exports=Rc});var Bi=u((Wy,Di)=>{"use strict";var jc=Li();function Nc(e,r,t){var n=e==null?void 0:jc(e,r);return n===void 0?t:n}Di.exports=Nc});var Hi=u((ky,Ui)=>{"use strict";var Fc=$e(),Jc=Ue(),Pc=He(),Mc=ae(),Lc=xe(),$i=ze(),Dc=Math.min;function Bc(e,r,t){for(var n=t?Pc:Jc,i=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,f=[];a--;){var c=e[a];a&&r&&(c=Mc(c,Lc(r))),l=Dc(c.length,l),s[a]=!t&&(r||i>=120&&c.length>=120)?new Fc(a&&c):void 0}c=e[0];var p=-1,d=s[0];e:for(;++p<i&&f.length<l;){var g=c[p],x=r?r(g):g;if(g=t||g!==0?g:0,!(d?$i(d,x):n(f,x,t))){for(a=o;--a;){var _=s[a];if(!(_?$i(_,x):n(e[a],x,t)))continue e}d&&d.push(x),f.push(g)}}return f}Ui.exports=Bc});var Gi=u((Ky,zi)=>{"use strict";var $c=Oe();function Uc(e){return $c(e)?e:[]}zi.exports=Uc});var ki=u((Xy,Wi)=>{"use strict";var Hc=ae(),zc=Hi(),Gc=ve(),Wc=Gi(),kc=Gc(function(e){var r=Hc(e,Wc);return r.length&&r[0]===e[0]?zc(r):[]});Wi.exports=kc});var Xi=u((Yy,Ki)=>{"use strict";var Kc=ie();function Xc(){this.__data__=new Kc,this.size=0}Ki.exports=Xc});var Zi=u((Zy,Yi)=>{"use strict";function Yc(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}Yi.exports=Yc});var eo=u((Qy,Qi)=>{"use strict";function Zc(e){return this.__data__.get(e)}Qi.exports=Zc});var to=u((eb,ro)=>{"use strict";function Qc(e){return this.__data__.has(e)}ro.exports=Qc});var io=u((rb,no)=>{"use strict";var ep=ie(),rp=Be(),tp=ye(),np=200;function ip(e,r){var t=this.__data__;if(t instanceof ep){var n=t.__data__;if(!rp||n.length<np-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new tp(n)}return t.set(e,r),this.size=t.size,this}no.exports=ip});var ao=u((tb,oo)=>{"use strict";var op=ie(),ap=Xi(),sp=Zi(),up=eo(),lp=to(),fp=io();function $(e){var r=this.__data__=new op(e);this.size=r.size}$.prototype.clear=ap;$.prototype.delete=sp;$.prototype.get=up;$.prototype.has=lp;$.prototype.set=fp;oo.exports=$});var qe=u((nb,uo)=>{"use strict";var so=We();function cp(e,r,t){r=="__proto__"&&so?so(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}uo.exports=cp});var Ze=u((ib,lo)=>{"use strict";var pp=qe(),dp=te();function hp(e,r,t){(t!==void 0&&!dp(e[r],t)||t===void 0&&!(r in e))&&pp(e,r,t)}lo.exports=hp});var co=u((ob,fo)=>{"use strict";function mp(e){return function(r,t,n){for(var i=-1,o=Object(r),a=n(r),s=a.length;s--;){var l=a[e?s:++i];if(t(o[l],l,o)===!1)break}return r}}fo.exports=mp});var ho=u((ab,po)=>{"use strict";var gp=co(),yp=gp();po.exports=yp});var xo=u((se,U)=>{"use strict";var bp=R(),bo=typeof se=="object"&&se&&!se.nodeType&&se,mo=bo&&typeof U=="object"&&U&&!U.nodeType&&U,xp=mo&&mo.exports===bo,go=xp?bp.Buffer:void 0,yo=go?go.allocUnsafe:void 0;function Sp(e,r){if(r)return e.slice();var t=e.length,n=yo?yo(t):new e.constructor(t);return e.copy(n),n}U.exports=Sp});var vo=u((sb,So)=>{"use strict";var vp=R(),Ep=vp.Uint8Array;So.exports=Ep});var To=u((ub,Oo)=>{"use strict";var Eo=vo();function Op(e){var r=new e.constructor(e.byteLength);return new Eo(r).set(new Eo(e)),r}Oo.exports=Op});var Io=u((lb,qo)=>{"use strict";var Tp=To();function qp(e,r){var t=r?Tp(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}qo.exports=qp});var _o=u((fb,wo)=>{"use strict";function Ip(e,r){var t=-1,n=e.length;for(r||(r=Array(n));++t<n;)r[t]=e[t];return r}wo.exports=Ip});var Co=u((cb,Vo)=>{"use strict";var wp=T(),Ao=Object.create,_p=function(){function e(){}return function(r){if(!wp(r))return{};if(Ao)return Ao(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();Vo.exports=_p});var jo=u((pb,Ro)=>{"use strict";function Ap(e,r){return function(t){return e(r(t))}}Ro.exports=Ap});var Qe=u((db,No)=>{"use strict";var Vp=jo(),Cp=Vp(Object.getPrototypeOf,Object);No.exports=Cp});var er=u((hb,Fo)=>{"use strict";var Rp=Object.prototype;function jp(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Rp;return e===t}Fo.exports=jp});var Po=u((mb,Jo)=>{"use strict";var Np=Co(),Fp=Qe(),Jp=er();function Pp(e){return typeof e.constructor=="function"&&!Jp(e)?Np(Fp(e)):{}}Jo.exports=Pp});var Lo=u((gb,Mo)=>{"use strict";function Mp(){return!1}Mo.exports=Mp});var rr=u((ue,H)=>{"use strict";var Lp=R(),Dp=Lo(),$o=typeof ue=="object"&&ue&&!ue.nodeType&&ue,Do=$o&&typeof H=="object"&&H&&!H.nodeType&&H,Bp=Do&&Do.exports===$o,Bo=Bp?Lp.Buffer:void 0,$p=Bo?Bo.isBuffer:void 0,Up=$p||Dp;H.exports=Up});var zo=u((yb,Ho)=>{"use strict";var Hp=M(),zp=Qe(),Gp=j(),Wp="[object Object]",kp=Function.prototype,Kp=Object.prototype,Uo=kp.toString,Xp=Kp.hasOwnProperty,Yp=Uo.call(Object);function Zp(e){if(!Gp(e)||Hp(e)!=Wp)return!1;var r=zp(e);if(r===null)return!0;var t=Xp.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Uo.call(t)==Yp}Ho.exports=Zp});var Wo=u((bb,Go)=>{"use strict";var Qp=M(),ed=ke(),rd=j(),td="[object Arguments]",nd="[object Array]",id="[object Boolean]",od="[object Date]",ad="[object Error]",sd="[object Function]",ud="[object Map]",ld="[object Number]",fd="[object Object]",cd="[object RegExp]",pd="[object Set]",dd="[object String]",hd="[object WeakMap]",md="[object ArrayBuffer]",gd="[object DataView]",yd="[object Float32Array]",bd="[object Float64Array]",xd="[object Int8Array]",Sd="[object Int16Array]",vd="[object Int32Array]",Ed="[object Uint8Array]",Od="[object Uint8ClampedArray]",Td="[object Uint16Array]",qd="[object Uint32Array]",m={};m[yd]=m[bd]=m[xd]=m[Sd]=m[vd]=m[Ed]=m[Od]=m[Td]=m[qd]=!0;m[td]=m[nd]=m[md]=m[id]=m[gd]=m[od]=m[ad]=m[sd]=m[ud]=m[ld]=m[fd]=m[cd]=m[pd]=m[dd]=m[hd]=!1;function Id(e){return rd(e)&&ed(e.length)&&!!m[Qp(e)]}Go.exports=Id});var Ko=u((le,z)=>{"use strict";var wd=Le(),ko=typeof le=="object"&&le&&!le.nodeType&&le,fe=ko&&typeof z=="object"&&z&&!z.nodeType&&z,_d=fe&&fe.exports===ko,tr=_d&&wd.process,Ad=function(){try{var e=fe&&fe.require&&fe.require("util").types;return e||tr&&tr.binding&&tr.binding("util")}catch{}}();z.exports=Ad});var nr=u((xb,Zo)=>{"use strict";var Vd=Wo(),Cd=xe(),Xo=Ko(),Yo=Xo&&Xo.isTypedArray,Rd=Yo?Cd(Yo):Vd;Zo.exports=Rd});var ir=u((Sb,Qo)=>{"use strict";function jd(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}Qo.exports=jd});var or=u((vb,ea)=>{"use strict";var Nd=qe(),Fd=te(),Jd=Object.prototype,Pd=Jd.hasOwnProperty;function Md(e,r,t){var n=e[r];(!(Pd.call(e,r)&&Fd(n,t))||t===void 0&&!(r in e))&&Nd(e,r,t)}ea.exports=Md});var ta=u((Eb,ra)=>{"use strict";var Ld=or(),Dd=qe();function Bd(e,r,t,n){var i=!t;t||(t={});for(var o=-1,a=r.length;++o<a;){var s=r[o],l=n?n(t[s],e[s],s,t,e):void 0;l===void 0&&(l=e[s]),i?Dd(t,s,l):Ld(t,s,l)}return t}ra.exports=Bd});var ia=u((Ob,na)=>{"use strict";function $d(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}na.exports=$d});var Ie=u((Tb,oa)=>{"use strict";var Ud=9007199254740991,Hd=/^(?:0|[1-9]\d*)$/;function zd(e,r){var t=typeof e;return r=r??Ud,!!r&&(t=="number"||t!="symbol"&&Hd.test(e))&&e>-1&&e%1==0&&e<r}oa.exports=zd});var sa=u((qb,aa)=>{"use strict";var Gd=ia(),Wd=Se(),kd=N(),Kd=rr(),Xd=Ie(),Yd=nr(),Zd=Object.prototype,Qd=Zd.hasOwnProperty;function eh(e,r){var t=kd(e),n=!t&&Wd(e),i=!t&&!n&&Kd(e),o=!t&&!n&&!i&&Yd(e),a=t||n||i||o,s=a?Gd(e.length,String):[],l=s.length;for(var f in e)(r||Qd.call(e,f))&&!(a&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Xd(f,l)))&&s.push(f);return s}aa.exports=eh});var la=u((Ib,ua)=>{"use strict";function rh(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}ua.exports=rh});var ca=u((wb,fa)=>{"use strict";var th=T(),nh=er(),ih=la(),oh=Object.prototype,ah=oh.hasOwnProperty;function sh(e){if(!th(e))return ih(e);var r=nh(e),t=[];for(var n in e)n=="constructor"&&(r||!ah.call(e,n))||t.push(n);return t}fa.exports=sh});var ar=u((_b,pa)=>{"use strict";var uh=sa(),lh=ca(),fh=Ee();function ch(e){return fh(e)?uh(e,!0):lh(e)}pa.exports=ch});var ha=u((Ab,da)=>{"use strict";var ph=ta(),dh=ar();function hh(e){return ph(e,dh(e))}da.exports=hh});var Sa=u((Vb,xa)=>{"use strict";var ma=Ze(),mh=xo(),gh=Io(),yh=_o(),bh=Po(),ga=Se(),ya=N(),xh=Oe(),Sh=rr(),vh=me(),Eh=T(),Oh=zo(),Th=nr(),ba=ir(),qh=ha();function Ih(e,r,t,n,i,o,a){var s=ba(e,t),l=ba(r,t),f=a.get(l);if(f){ma(e,t,f);return}var c=o?o(s,l,t+"",e,r,a):void 0,p=c===void 0;if(p){var d=ya(l),g=!d&&Sh(l),x=!d&&!g&&Th(l);c=l,d||g||x?ya(s)?c=s:xh(s)?c=yh(s):g?(p=!1,c=mh(l,!0)):x?(p=!1,c=gh(l,!0)):c=[]:Oh(l)||ga(l)?(c=s,ga(s)?c=qh(s):(!Eh(s)||vh(s))&&(c=bh(l))):p=!1}p&&(a.set(l,c),i(c,l,n,o,a),a.delete(l)),ma(e,t,c)}xa.exports=Ih});var sr=u((Cb,Ea)=>{"use strict";var wh=ao(),_h=Ze(),Ah=ho(),Vh=Sa(),Ch=T(),Rh=ar(),jh=ir();function va(e,r,t,n,i){e!==r&&Ah(r,function(o,a){if(i||(i=new wh),Ch(o))Vh(e,r,a,t,va,n,i);else{var s=n?n(jh(e,a),o,a+"",e,r,i):void 0;s===void 0&&(s=o),_h(e,a,s)}},Rh)}Ea.exports=va});var Ta=u((Rb,Oa)=>{"use strict";var Nh=te(),Fh=Ee(),Jh=Ie(),Ph=T();function Mh(e,r,t){if(!Ph(t))return!1;var n=typeof r;return(n=="number"?Fh(t)&&Jh(r,t.length):n=="string"&&r in t)?Nh(t[r],e):!1}Oa.exports=Mh});var ur=u((jb,qa)=>{"use strict";var Lh=ve(),Dh=Ta();function Bh(e){return Lh(function(r,t){var n=-1,i=t.length,o=i>1?t[i-1]:void 0,a=i>2?t[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&Dh(t[0],t[1],a)&&(o=i<3?void 0:o,i=1),r=Object(r);++n<i;){var s=t[n];s&&e(r,s,n,o)}return r})}qa.exports=Bh});var wa=u((Nb,Ia)=>{"use strict";var $h=sr(),Uh=ur(),Hh=Uh(function(e,r,t){$h(e,r,t)});Ia.exports=Hh});var Aa=u((Fb,_a)=>{"use strict";var zh=sr(),Gh=ur(),Wh=Gh(function(e,r,t,n){zh(e,r,t,n)});_a.exports=Wh});var Ra=u((Jb,Ca)=>{"use strict";var kh=or(),Kh=Xe(),Xh=Ie(),Va=T(),Yh=Ye();function Zh(e,r,t,n){if(!Va(e))return e;r=Kh(r,e);for(var i=-1,o=r.length,a=o-1,s=e;s!=null&&++i<o;){var l=Yh(r[i]),f=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=a){var c=s[l];f=n?n(c,l,s):void 0,f===void 0&&(f=Va(c)?c:Xh(r[i+1])?[]:{})}kh(s,l,f),s=s[l]}return e}Ca.exports=Zh});var Na=u((Pb,ja)=>{"use strict";var Qh=Ra();function em(e,r,t){return e==null?e:Qh(e,r,t)}ja.exports=em});var _r=A(Or(),1);function Tr(e){if(e===0)return 0;let r=e/1024;return Number.parseFloat(r.toFixed(2))}var qr="yyyy-MM-dd";function Ir(e,r){let t=new Date(e).getTime(),n=new Date(r).getTime();return t<n?"LESSER":t>n?"GREATER":"EQUAL"}function Za(e,r){let t=Ir(e,r);return t==="GREATER"||t==="EQUAL"}function Qa(e,r){let t=Ir(e,r);return t==="LESSER"||t==="EQUAL"}function wr(e,r,t,n=[]){let i=typeof e=="string",o=e==="",a=e===void 0||e===null&&t.treatNullAsUndefined,s=o||a,l=[];if(!i||s||r["x-jsf-presentation"]===void 0)return l;let{minDate:f,maxDate:c}=r["x-jsf-presentation"];return f&&!Za(e,f)&&l.push({path:n,validation:"minDate",schema:r,value:e}),c&&!Qa(e,c)&&l.push({path:n,validation:"maxDate",schema:r,value:e}),l}function Ar(e,r,t,n){let i=e["x-jsf-presentation"];switch(t){case"type":return es(e.type);case"required":return e["x-jsf-presentation"]?.inputType==="checkbox"?"Please acknowledge this field":"Required field";case"forbidden":return"Not allowed";case"const":return`The only accepted value is ${JSON.stringify(e.const)}.`;case"enum":return`The option "${Re(r)}" is not valid.`;case"anyOf":return`The option "${Re(r)}" is not valid.`;case"oneOf":return`The option "${Re(r)}" is not valid.`;case"not":return"The value must not satisfy the provided schema";case"minLength":return`Please insert at least ${e.minLength} characters`;case"maxLength":return`Please insert up to ${e.maxLength} characters`;case"pattern":return`Must have a valid format. E.g. ${(0,_r.randexp)(e.pattern||"")}`;case"format":if(e.format==="email")return"Please enter a valid email address";if(e.format==="date"){let o=new Date().toISOString().split("T")[0];return`Must be a valid date in ${qr.toLowerCase()} format. e.g. ${o}`}return`Must be a valid ${e.format} format`;case"multipleOf":return`Must be a multiple of ${e.multipleOf}`;case"maximum":return`Must be smaller or equal to ${e.maximum}`;case"exclusiveMaximum":return`Must be smaller than ${e.exclusiveMaximum}`;case"minimum":return`Must be greater or equal to ${e.minimum}`;case"exclusiveMinimum":return`Must be greater than ${e.exclusiveMinimum}`;case"minDate":return`The date must be ${i?.minDate} or after.`;case"maxDate":return`The date must be ${i?.maxDate} or before.`;case"fileStructure":return"Not a valid file.";case"maxFileSize":{let o=i?.maxFileSize,a=typeof o=="number"?Tr(o):void 0;return`File size too large.${a?` The limit is ${a} MB.`:""}`}case"accept":{let o=i?.accept;return`Unsupported file format.${o?` The acceptable formats are ${o}.`:""}`}case"minItems":{let o=e.minItems===1?"item":"items";return`Must have at least ${e.minItems} ${o}`}case"maxItems":{let o=e.maxItems===1?"item":"items";return`Must have at most ${e.maxItems} ${o}`}case"uniqueItems":return"Items must be unique";case"contains":throw new Error('"contains" is not implemented yet');case"minContains":throw new Error('"minContains" is not implemented yet');case"maxContains":throw new Error('"maxContains" is not implemented yet');case"json-logic":return n||"The value is not valid"}}function es(e){if(Array.isArray(e))return`The value must be a ${e.map(t=>t==="integer"?"number":t).join(" or ")}`;switch(e){case"number":case"integer":return"The value must be a number";case"boolean":return"The value must be a boolean";case"null":return"The value must be null";case"string":return"The value must be a string";case"object":return"The value must be an object";case"array":return"The value must be an array";default:return e?`The value must be ${e}`:"Invalid value"}}function Re(e){return typeof e=="string"?e:JSON.stringify(e)}function rs(e,r){let t={};return r.forEach((i,o)=>{t[i]=o}),e.sort((i,o)=>{let a=t[i.name]??1/0,s=t[o.name]??1/0;return a!==s?a-s:e.indexOf(i)-e.indexOf(o)})}function je(e,r){if(typeof e=="boolean")throw new Error("Schema must be an object");return e["x-jsf-order"]!==void 0?rs(r,e["x-jsf-order"]):r}function ts(e,r,t){r.checkboxValue=t.const,t.type==="boolean"&&(r.checkboxValue=!0)}function ns(e,r){if(e.options===void 0){let t=as(r);t&&(e.options=t,r.type==="array"&&(e.multiple=!0))}}function is(e,r,t){if(e.options===void 0){let n=ls(r,t);n&&(e.fields=n)}}function os(e,r){if(!e)return"text";switch(e){case"string":{let{oneOf:t,format:n}=r;return n==="email"?"email":n==="date"?"date":n==="data-url"?"file":t?"radio":"text"}case"number":case"integer":return"number";case"object":return"fieldset";case"array":{let{items:t}=r;return t?.properties?"group-array":"select"}case"boolean":return"checkbox";default:return"text"}}function Vr(e,r,t,n){let i=t["x-jsf-presentation"];if(i?.inputType)return i.inputType;if(n&&r!=="root")throw new Error(`Strict error: Missing inputType to field "${t.title}".
|
|
2
|
-
You can fix the json schema or skip this error by calling createHeadlessForm(schema, { strictInputType: false })`);if(!t.type){if(t.items?.properties)return"group-array";if(t.properties)return"select"}return os(e||t.type||"string",t)}function he(e){return e.filter(r=>r!==null&&typeof r=="object"&&r.const!==null).map(r=>{let t=r.title,n=r.const,o=r["x-jsf-presentation"]?.meta,a={label:t||"",value:n};o&&(a.meta=o);let{title:s,const:l,"x-jsf-presentation":f,...c}=r;return{...a,...c}})}function as(e){if(e.oneOf)return he(e.oneOf||[]);if(e.items?.anyOf)return he(e.items.anyOf);if(e.anyOf)return he(e.anyOf);if(e.enum){let r=e.enum?.map(t=>({title:typeof t=="string"?t:JSON.stringify(t),const:t}))||[];return he(r)}return null}function ss(e,r){let t=[];for(let i in e.properties){let o=e.required?.includes(i)||!1,a=I(e.properties[i],i,o,r);a&&t.push(a)}return je(e,t)}function us(e,r){let t=[];if(typeof e.items!="object"||e.items===null)return[];if(e.items?.type==="object"){let i=e.items;for(let o in i.properties){let a=i.required?.includes(o)||!1,s=I(i.properties[o],o,a,r);s&&(s.nameKey=o,t.push(s))}}else{let i=I(e.items,"item",!1,r);i&&t.push(i)}return je(e.items,t)}function ls(e,r){return typeof e.properties=="object"&&e.properties!==null?ss(e,r):typeof e.items=="object"&&e.items!==null?us(e,r):null}var fs=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","properties"];function I(e,r,t=!1,n=!1,i=void 0){if(e===!1){let f=Vr(i,r,e,n);return{type:f,name:r,inputType:f,jsonType:"boolean",required:t,isVisible:!1}}if(typeof e=="boolean")return null;let o=e["x-jsf-presentation"]||{},a=e["x-jsf-errorMessage"],s=Vr(i,r,e,n),l={...Object.entries(e).filter(([f])=>!fs.includes(f)).reduce((f,[c,p])=>({...f,[c]:p}),{}),name:r,inputType:s,type:s,jsonType:i||e.type,required:t,isVisible:!0,...a&&{errorMessage:a}};return s==="checkbox"&&ts(s,l,e),e.title&&(l.label=e.title),Object.keys(o).length>0&&Object.entries(o).forEach(([f,c])=>{f!=="inputType"&&(l[f]=c)}),ns(l,e),is(l,e),l}function E(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e,r){if(typeof e!=typeof r)return!1;if(e===r)return!0;if(e===null||r===null)return!1;if(Array.isArray(e)&&Array.isArray(r))return e.length!==r.length?!1:e.every((t,n)=>O(t,r[n]));if(E(e)&&E(r)){let t=Object.keys(e).sort(),n=Object.keys(r).sort();return t.length!==n.length||!O(t,n)?!1:t.every(i=>O(e[i],r[i]))}return!1}function Cr(e){if(typeof structuredClone=="function")try{return structuredClone(e)}catch(r){console.warn("structuredClone failed, falling back to JSON method:",r)}try{return JSON.parse(JSON.stringify(e))}catch{throw new Error("Deep clone failed: Object may contain circular references or non-serializable values")}}function Rr(e,r,t,n,i){return Array.isArray(e)?[...cs(r,e,i),...ms(r,e,i),...hs(e,r,t,n,i),...ds(r,e,t,n,i),...ps(r,e,t,n,i)]:[]}function cs(e,r,t){let n=[],i=r.length;return e.maxItems!==void 0&&i>e.maxItems&&n.push({path:t,validation:"maxItems",schema:e,value:r}),e.minItems!==void 0&&i<e.minItems&&n.push({path:t,validation:"minItems",schema:e,value:r}),n}function ps(e,r,t,n,i){if(e.items===void 0)return[];let o=[],a=Array.isArray(e.prefixItems)?e.prefixItems.length:0;for(let[s,l]of r.slice(a).entries())o.push(...y(l,e.items,t,[...i,"items",s+a],n));return o}function ds(e,r,t,n,i){if(!Array.isArray(e.prefixItems))return[];let o=[];for(let[a,s]of r.entries())a<e.prefixItems.length&&o.push(...y(s,e.prefixItems[a],t,[...i,"prefixItems",a],n));return o}function hs(e,r,t,n,i){if(!("contains"in r))return[];let o=[],a=e.filter(s=>y(s,r.contains,t,[...i,"contains"],n).length===0).length;return r.minContains===void 0&&r.maxContains===void 0?a<1&&o.push({path:i,validation:"contains",schema:r,value:e}):(r.minContains!==void 0&&a<r.minContains&&o.push({path:i,validation:"minContains",schema:r,value:e}),r.maxContains!==void 0&&a>r.maxContains&&o.push({path:i,validation:"maxContains",schema:r,value:e})),o}function ms(e,r,t){if(e.uniqueItems!==!0)return[];let n=new Map;for(let i=0;i<r.length;i++){for(let o of n.values())if(O(r[i],o))return[{path:t,validation:"uniqueItems",schema:e,value:r[i]}];n.set(i,r[i])}return[]}function jr(e,r,t,n,i=[]){if(!r.allOf)return[];for(let o=0;o<r.allOf.length;o++){let a=r.allOf[o],s=y(e,a,t,[...i,"allOf",o],n);if(s.length>0)return s}return[]}function Nr(e,r,t,n,i=[]){if(!r.anyOf)return[];for(let o of r.anyOf)if(y(e,o,t,i,n).length===0)return[];return[{path:i,validation:"anyOf",schema:r,value:e}]}function Fr(e,r,t,n,i=[]){if(!r.oneOf)return[];let o=0;for(let a=0;a<r.oneOf.length&&!(y(e,r.oneOf[a],t,i,n).length===0&&(o++,o>1));a++);return o===0?[{path:i,validation:"oneOf",schema:r,value:e}]:o>1?[{path:i,validation:"oneOf",schema:r,value:e}]:[]}function Jr(e,r,t,n,i=[]){return r.not===void 0?[]:typeof r.not=="boolean"?r.not?[{path:i,validation:"not",schema:r,value:e}]:[]:y(e,r.not,t,i,n).length===0?[{path:i,validation:"not",schema:r,value:e}]:[]}function Pr(e,r,t,n,i=[]){if(r.if===void 0)return[];let o=y(e,r.if,t,i,n).length===0;return o&&r.then!==void 0?y(e,r.then,t,[...i,"then"],n):!o&&r.else!==void 0?y(e,r.else,t,[...i,"else"],n):[]}function Mr(e,r,t=[]){return r.const===void 0?[]:O(r.const,e)?[]:[{path:t,validation:"const",schema:r,value:e}]}function Lr(e,r,t=[]){return r.enum===void 0?[]:r.enum.some(n=>O(n,e))?[]:[{path:t,validation:"enum",schema:r,value:e}]}function Dr(e,r,t=[]){let n=r["x-jsf-presentation"],i=n?.inputType==="file",o=typeof n?.maxFileSize=="number"||typeof n?.accept=="string";if(!(i||o))return[];if(!Array.isArray(e))return[];if(e.length===0)return[];if(!e.every(f=>E(f)&&typeof f.name=="string"&&typeof f.size=="number"))return[{path:t,validation:"fileStructure",schema:r,value:e}];let l=e;if(typeof n?.maxFileSize=="number"){let f=n.maxFileSize*1024;if(l.some(p=>p.size>f))return[{path:t,validation:"maxFileSize",schema:r,value:e}]}if(typeof n?.accept=="string"&&n.accept.trim()!==""){let f=n.accept.toLowerCase().split(",").map(c=>c.trim()).filter(c=>c).map(c=>c.startsWith(".")?c:`.${c}`);if(f.length>0&&!l.some(p=>{let d=p.name.toLowerCase(),g=d.includes(".")?`.${d.split(".").pop()}`:"";return g!==""&&f.includes(g)}))return[{path:t,validation:"accept",schema:r,value:e}]}return[]}import Ne from"json-logic-js";function gs(e){return/\{\{.*?\}\}/.test(e)}function Fe(e={}){return Object.entries(e).reduce((r,[t,n])=>({...r,[t]:n??Number.NaN}),{})}function Br(e,r,t=[]){let n=e["x-jsf-logic-validations"];return!n||n.length===0?[]:n.map(i=>{let o=r?.schema?.validations?.[i],a=r?.value;if(!o)throw new Error(`[json-schema-form] json-logic error: "${e.title}" required validation "${i}" doesn't exist.`);return Ne.apply(o.rule,Fe(a))===!1?[{path:t,validation:"json-logic",customErrorMessage:o.errorMessage,schema:e,value:a}]:[]}).flat()}function $r(e,r,t={},n,i=[]){let o=r["x-jsf-logic-computedAttrs"];if(!o||Object.keys(o).length===0)return[];let a=Cr(r);return delete a["x-jsf-logic-computedAttrs"],Object.entries(o).forEach(([s,l])=>{if(s==="x-jsf-errorMessage"){let f=bs(l,n);f&&(a["x-jsf-errorMessage"]=f)}else{let f=l,c=n?.schema?.computedValues?.[f]?.rule,p=n?.value;if(!c)throw new Error(`[json-schema-form] json-logic error: Computed value "${f}" has missing rule.`);let d=Ne.apply(c,Fe(p));if(d===null)return;a[s]=d}}),y(e,a,t,i,n)}function ys(e,r){return r?.schema?.computedValues?e.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let i=n.trim(),o=r.schema.computedValues?.[i]?.rule;if(!o)throw new Error(`[json-schema-form] json-logic error: Computed value "${i}" doesn't exist`);return Ne.apply(o,Fe(r.value))?.toString()??`{{${i}}}`}):(console.warn("No computed values found in the JSON Logic context"),e)}function bs(e,r){if(!e)return;let t={};return Object.entries(e).forEach(([n,i])=>{let o=i;gs(i)&&(o=ys(i,r)),t[n]=o}),t}function Ur(e,r,t=[]){let n=[],i=Z(r);return typeof e!="number"?[]:i!==void 0&&!["number","integer"].includes(i)?[]:(r.multipleOf!==void 0&&e%r.multipleOf!==0&&n.push({path:t,validation:"multipleOf",schema:r,value:e}),r.maximum!==void 0&&e>r.maximum&&n.push({path:t,validation:"maximum",schema:r,value:e}),r.exclusiveMaximum!==void 0&&e>=r.exclusiveMaximum&&n.push({path:t,validation:"exclusiveMaximum",schema:r,value:e}),r.minimum!==void 0&&e<r.minimum&&n.push({path:t,validation:"minimum",schema:r,value:e}),r.exclusiveMinimum!==void 0&&e<=r.exclusiveMinimum&&n.push({path:t,validation:"exclusiveMinimum",schema:r,value:e}),n)}function Hr(e,r,t,n,i=[]){if(typeof r=="object"&&r.properties&&E(e)){let o=[];for(let[a,s]of Object.entries(r.properties))o.push(...y(e[a],s,t,[...i,a],n));return o}return[]}var zr;(function(e){e["7bit"]="7bit",e["8bit"]="8bit",e.Base64="base64",e.Binary="binary",e.IETFToken="ietf-token",e.QuotedPrintable="quoted-printable",e.XToken="x-token"})(zr||(zr={}));var b;(function(e){e.Date="date",e.DateTime="date-time",e.Duration="duration",e.Email="email",e.Hostname="hostname",e.IDNEmail="idn-email",e.IDNHostname="idn-hostname",e.IPv4="ipv4",e.IPv6="ipv6",e.IRI="iri",e.IRIReference="iri-reference",e.JSONPointer="json-pointer",e.JSONPointerURIFragment="json-pointer-uri-fragment",e.RegEx="regex",e.RelativeJSONPointer="relative-json-pointer",e.Time="time",e.URI="uri",e.URIReference="uri-reference",e.URITemplate="uri-template",e.UUID="uuid"})(b||(b={}));var Gr;(function(e){e.Array="array",e.Boolean="boolean",e.Integer="integer",e.Null="null",e.Number="number",e.Object="object",e.String="string"})(Gr||(Gr={}));var S={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},xs={[b.DateTime]:e=>S.DATE_TIME.test(e),[b.Date]:e=>S.DATE.test(e),[b.Time]:e=>S.TIME.test(e),[b.Duration]:e=>S.DURATION.test(e),[b.Email]:e=>e.length<=254&&S.EMAIL.test(e),[b.IDNEmail]:e=>e.length<=254&&S.IDN_EMAIL.test(e),[b.Hostname]:e=>e.length>255?!1:e.split(".").every(t=>S.HOSTNAME.test(t)),[b.IDNHostname]:e=>e.length>255?!1:e.split(".").every(t=>t.length<=63&&S.IDN_HOSTNAME.test(t)),[b.IPv4]:e=>{let r=e.split(".");return r.length!==4?!1:r.every(t=>{let n=Number.parseInt(t,10);return n>=0&&n<=255&&t===n.toString()})},[b.IPv6]:e=>{let r=e.split(":");if(r.length>8)return!1;let t=!1;return r.every(n=>n===""?t?!1:(t=!0,!0):S.IPV6_PART.test(n))},[b.URI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[b.URIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[b.IRI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[b.IRIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[b.RegEx]:e=>{try{return new RegExp(e,"u"),!0}catch{return!1}},[b.UUID]:e=>S.UUID.test(e),[b.JSONPointer]:e=>S.JSON_POINTER.test(e),[b.JSONPointerURIFragment]:e=>S.JSON_POINTER_URI_FRAGMENT.test(e),[b.RelativeJSONPointer]:e=>S.RELATIVE_JSON_POINTER.test(e),[b.URITemplate]:e=>S.URI_TEMPLATE.test(e)};function Wr(e,r,t=[]){let n=[];if(typeof e!="string")return n;let i=xs[r.format];return i&&!i(e)&&n.push({path:t,validation:"format",schema:r,value:e}),n}function kr(e,r,t=[]){let n=[],i=Z(r);if(typeof e!="string")return[];if(i!==void 0&&i!=="string")return[];let o=[...new Intl.Segmenter().segment(e)].length;if(r.minLength!==void 0&&o<r.minLength&&n.push({path:t,validation:"minLength",schema:r,value:e}),r.maxLength!==void 0&&o>r.maxLength&&n.push({path:t,validation:"maxLength",schema:r,value:e}),r.pattern!==void 0&&(new RegExp(r.pattern).test(e)||n.push({path:t,validation:"pattern",schema:r,value:e})),r.format!==void 0){let a=Wr(e,r,t);n.push(...a)}return n}function Z(e){if(typeof e=="boolean")return"boolean";if(e.type!==void 0)return e.type}function Ss(e,r,t=[]){let n=Z(r);if(n===void 0)return[];if(n==="null"&&e===null)return[];let i=e===null?"null":Array.isArray(e)?"array":typeof e;if(Array.isArray(n)){if(e===null&&n.includes("null"))return[];for(let o of n){if(o==="array"&&Array.isArray(e))return[];if(i==="number"&&o==="integer"&&Number.isInteger(e))return[];if(i===o||o==="null"&&e===null)return[]}}else{if(n==="array"&&Array.isArray(e))return[];if(i==="number"&&n==="integer"&&Number.isInteger(e))return[];if(i===n)return[]}return[{path:t,validation:"type",schema:r,value:e}]}function vs(e,r,t={},n=[],i){return r?y(e,r,t,n,i):[]}function y(e,r,t={},n=[],i){let o=i,a;if(!i&&r["x-jsf-logic"]){let{validations:d,computedValues:g,...x}=r["x-jsf-logic"];o={schema:{validations:d,computedValues:g},value:e},a=x}let s=e===void 0||e===null&&t.treatNullAsUndefined,l=[];if(s)return[];if(typeof r=="boolean")return r?[]:[{path:n,validation:"forbidden",schema:r,value:e}];let c=r["x-jsf-presentation"]?.inputType==="file",p=[];if(!c&&(p=Ss(e,r,n),p.length>0))return p;if(r.required&&E(e)){let d=r.required.filter(g=>{let x=e[g];return x===void 0||x===null&&t.treatNullAsUndefined});for(let g of d)l.push({path:[...n,g],validation:"required",schema:r?.properties?.[g]||r,value:e})}return[...l,...Mr(e,r,n),...Lr(e,r,n),...Hr(e,r,t,o,n),...Rr(e,r,t,o,n),...kr(e,r,n),...Ur(e,r,n),...Dr(e,r,n),...Jr(e,r,t,o,n),...jr(e,r,t,o,n),...Nr(e,r,t,o,n),...Fr(e,r,t,o,n),...Pr(e,r,t,o,n),...wr(e,r,t,n),...vs(e,a,t,n,o),...$r(e,r,t,o,n),...Br(r,o,n)]}function Me(e,r,t,n={}){if(E(r)){Je(e,r,t,n);for(let i in t.properties){let o=t.properties[i],a=e.find(s=>s.name===i);a?.fields&&Je(a.fields,r[i],o,n)}}}function Kr(e,r,t,n={}){let o=y(e,t.if,n).length===0,a=!1;return o&&t.if?.required&&(a=t.if.required.some(l=>{if(!r.properties||!r.properties[l])return!1;let f=r.properties[l],c=e[l];return y(c,f,n).some(d=>d.validation==="type")})),{rule:t,matches:o&&!a}}function Je(e,r,t,n={}){if(!E(r))return;let i=[];t.if&&i.push(Kr(r,t,t,n)),(t.allOf??[]).filter(o=>typeof o.if<"u").forEach(o=>{let a=Kr(r,t,o,n);i.push(a)});for(let{rule:o,matches:a}of i)a&&o.then?Pe(e,r,o.then,n):!a&&o.else&&Pe(e,r,o.else,n)}function Pe(e,r,t,n={}){if(t.properties)for(let i in t.properties){let o=t.properties[i],a=e.find(s=>s.name===i);if(a){o===!1?a.isVisible=!1:a?.fields&&Pe(a.fields,r,o);let s=I(o,i,!1);for(let l in s)["type"].includes(l)||(a[l]=s[l])}}Array.isArray(t.required)&&e.forEach(i=>{t.required.includes(i.name)&&(i.required=!0)}),Je(e,r,t,n)}function Es(e){let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(["allOf","anyOf","oneOf"].includes(n)){t+1<e.length&&typeof e[t+1]=="number"&&t++;continue}n==="then"||n==="else"||(n==="items"&&typeof e[t+1]=="number"?(t++,r.push(e[t])):r.push(n))}return r}function Os(e){if(e.length===0)return null;let r={};for(let t of e){let{path:n}=t;if(n.length===0){r[""]=t.message;continue}let i=Es(n),o=r;for(let a=0;a<i.length-1;a++){let s=i[a];if(typeof s=="number"){if(!Array.isArray(o))throw new TypeError(`Expected an array at path: ${i.slice(0,a).join(".")}`);o[s]||(o[s]={}),o=o[s]}else typeof i[a+1]=="number"?s in o||(o[s]=[]):(!(s in o)||typeof o[s]=="string")&&(o[s]={}),o=o[s]}if(i.length>0){let a=i[i.length-1];o[a]=t.message}}return r}function Ts(e){return e.map(r=>{let{schema:t,value:n,validation:i,customErrorMessage:o}=r;return{...r,message:Ar(t,n,i,o)}})}function qs(e,r){return typeof r!="object"||!r||!e.length?e:e.map(t=>{let n=t.schema,i=n["x-jsf-errorMessage"]?.[t.validation];return n&&i?{...t,message:i}:t})}function Is(e,r,t={}){let n={},i=y(e,r,t),o=Ts(i),a=qs(o,r),s=Os(a);return s&&(n.formErrors=s),n}function ws(e){let{schema:r,strictInputType:t}=e;return I(r,"root",!0,t,"object")?.fields||[]}function _s(e,r={}){let t=r.initialValues||{},n=r.strictInputType||!1,i=ws({schema:e,strictInputType:n});return Me(i,t,e),{fields:i,isError:!1,error:null,handleValidation:s=>{let l=Is(s,e,r.validationOptions);return Xr(i,e),Me(i,s,e,r.validationOptions),l}}}function Xr(e,r){e.length=0;let t=I(r,"root",!0,!1,"object")?.fields||[];e.push(...t);for(let n of e)n.fields&&r.properties?.[n.name]?.type==="object"&&Xr(n.fields,r.properties[n.name])}var Fa=A(yi(),1),w=A(Bi(),1),G=A(ki(),1),Ja=A(wa(),1),fr=A(Aa(),1),we=A(Na(),1);function Pa(e){return e.replace(".",".properties.")}function Ma(e,r){return Array.isArray(r)?r:void 0}function rm(e,r){let{if:t,then:n,else:i}=e;return(0,G.default)(t?.required||[],r).length>0||((0,G.default)(n?.required||[],r)||(0,G.default)(Object.keys(n?.properties||{}),r)).length>0||((0,G.default)(i?.required||[],r)||(0,G.default)(Object.keys(i?.properties||{}),r)).length>0}function La(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([i,o])=>{let a=Pa(i);if(!(0,w.default)(e.properties,a)){t.push({type:"FIELD_TO_CHANGE_NOT_FOUND",message:`Changing field "${i}" was ignored because it does not exist.`});return}let s=(0,w.default)(e.properties,a);if(!s)return{warnings:null};let l=typeof o=="function"?o(s):o,{properties:f,...c}=l;if((0,fr.default)((0,w.default)(e.properties,a),{...s,...c},Ma),l.properties){let p=La((0,w.default)(e.properties,a),l.properties);p.warnings&&t.push(...p.warnings)}}),{warnings:t.flat()}}function Da(e,r,t){if(!r||typeof e!="object"||e===null)return{warnings:null};let n=t?.parent;return typeof e=="object"&&e.properties&&Object.entries(e.properties).forEach(([i,o])=>{let a=n?`${n}.${i}`:i;(0,fr.default)((0,w.default)(e.properties,i),{...o,...r(a,o)},Ma),o.properties&&Da(o,r,{parent:i})}),{warnings:null}}function tm(e,r){if(!r)return{warnings:null};let t=[],n=e["x-jsf-order"]||[],i=typeof r=="function"?r(n):r,o=(0,Fa.default)(n,i);return o.length>0&&t.push({type:"ORDER_MISSING_FIELDS",message:`Some fields got forgotten in the new order. They were automatically appended: ${o.join(", ")}`}),e["x-jsf-order"]=[...i,...o],{warnings:t}}function Ba(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([i,o])=>{let a=Pa(i);if(!o)return{warnings:null};if(o.properties){let f=(0,w.default)(e.properties,a);if(!f)return{warnings:null};let c=Ba(f,o.properties);c.warnings&&t.push(...c.warnings)}if((0,w.default)(e.properties,a)){t.push({type:"FIELD_TO_CREATE_EXISTS",message:`Creating field "${i}" was ignored because it already exists.`});return}let l=(0,we.default)({},a,o);(0,Ja.default)(e.properties,l)}),{warnings:t.flat()}}function nm(e,r){if(!r)return{schema:e,warnings:null};let t={properties:{}};Object.entries(e).forEach(([o,a])=>{switch(o){case"properties":r.forEach(s=>{(0,we.default)(t.properties,s,a[s])});break;case"x-jsf-order":case"required":t[o]=a.filter(s=>r.includes(s));break;case"allOf":{let s=e[o]?.filter(l=>rm(l,r));t[o]=s;break}case"x-jsf-logic":t[o]=a;break}});let n={};t.allOf?.length&&t.allOf.forEach(o=>{let{if:a,then:s,else:l}=o,f=e.allOf?.indexOf(o);n={...n,...lr(a,{fields:r,path:`allOf[${f}].if`}),...lr(s,{fields:r,path:`allOf[${f}].then`}),...lr(l,{fields:r,path:`allOf[${f}].else`})}});let i=[];return Object.keys(n).length>0&&(Object.entries(n).forEach(([o])=>{(0,we.default)(t.properties,o,e.properties?.[o])}),i.push({type:"PICK_MISSED_FIELD",message:`The picked fields are in conditionals that refeer other fields. They added automatically: ${Object.keys(n).map(o=>`"${o}"`).join(", ")}. Check "meta" for more details.`,meta:n})),{schema:t,warnings:i}}function lr(e,{fields:r,path:t}){if(!e)return null;let n={};return e.required?.forEach(i=>{r.includes(i)||(n[i]={path:t})}),Object.entries(e.properties||[]).forEach(([i])=>{r.includes(i)||(n[i]={path:t})}),n}function im(e,r){let t=JSON.parse(JSON.stringify(e)),n=La(t,r.fields),i=Da(t,r.allFields),o=Ba(t,r.create),a=nm(t,r.pick),s=a.schema,l=tm(s,r.orderRoot);r.muteLogging||console.warn("json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteLogging: true` to the config.");let f=[n.warnings,i.warnings,o.warnings,a.warnings,l.warnings].flat().filter(Boolean);return{schema:s,warnings:f}}export{_s as createHeadlessForm,im as modify};
|
|
1
|
+
var ra=Object.create;var gr=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var na=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,oa=Object.prototype.hasOwnProperty;var u=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var sa=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of na(r))!oa.call(e,o)&&o!==t&&gr(e,o,{get:()=>r[o],enumerable:!(n=ta(r,o))||n.enumerable});return e};var I=(e,r,t)=>(t=e!=null?ra(ia(e)):{},sa(r||!e||!e.__esModule?gr(t,"default",{value:e,enumerable:!0}):t,e));var W=u((xm,yr)=>{"use strict";yr.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var Fe=u(q=>{"use strict";var h=W(),Je=()=>[{type:h.RANGE,from:48,to:57}],br=()=>[{type:h.CHAR,value:95},{type:h.RANGE,from:97,to:122},{type:h.RANGE,from:65,to:90}].concat(Je()),xr=()=>[{type:h.CHAR,value:9},{type:h.CHAR,value:10},{type:h.CHAR,value:11},{type:h.CHAR,value:12},{type:h.CHAR,value:13},{type:h.CHAR,value:32},{type:h.CHAR,value:160},{type:h.CHAR,value:5760},{type:h.RANGE,from:8192,to:8202},{type:h.CHAR,value:8232},{type:h.CHAR,value:8233},{type:h.CHAR,value:8239},{type:h.CHAR,value:8287},{type:h.CHAR,value:12288},{type:h.CHAR,value:65279}],aa=()=>[{type:h.CHAR,value:10},{type:h.CHAR,value:13},{type:h.CHAR,value:8232},{type:h.CHAR,value:8233}];q.words=()=>({type:h.SET,set:br(),not:!1});q.notWords=()=>({type:h.SET,set:br(),not:!0});q.ints=()=>({type:h.SET,set:Je(),not:!1});q.notInts=()=>({type:h.SET,set:Je(),not:!0});q.whitespace=()=>({type:h.SET,set:xr(),not:!1});q.notWhitespace=()=>({type:h.SET,set:xr(),not:!0});q.anyChar=()=>({type:h.SET,set:aa(),not:!0})});var Or=u(K=>{"use strict";var Sr=W(),J=Fe(),ua="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",fa={0:0,t:9,n:10,v:11,f:12,r:13};K.strToChars=function(e){var r=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return e=e.replace(r,function(t,n,o,i,s,a,f,l){if(o)return t;var c=n?8:i?parseInt(i,16):s?parseInt(s,16):a?parseInt(a,8):f?ua.indexOf(f):fa[l],p=String.fromCharCode(c);return/[[\]{}^$.|?*+()]/.test(p)&&(p="\\"+p),p}),e};K.tokenizeClass=(e,r)=>{for(var t=[],n=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,o,i;(o=n.exec(e))!=null;)if(o[1])t.push(J.words());else if(o[2])t.push(J.ints());else if(o[3])t.push(J.whitespace());else if(o[4])t.push(J.notWords());else if(o[5])t.push(J.notInts());else if(o[6])t.push(J.notWhitespace());else if(o[7])t.push({type:Sr.RANGE,from:(o[8]||o[9]).charCodeAt(0),to:o[10].charCodeAt(0)});else if(i=o[12])t.push({type:Sr.CHAR,value:i.charCodeAt(0)});else return[t,n.lastIndex];K.error(r,"Unterminated character class")};K.error=(e,r)=>{throw new SyntaxError("Invalid regular expression: /"+e+"/: "+r)}});var vr=u(X=>{"use strict";var me=W();X.wordBoundary=()=>({type:me.POSITION,value:"b"});X.nonWordBoundary=()=>({type:me.POSITION,value:"B"});X.begin=()=>({type:me.POSITION,value:"^"});X.end=()=>({type:me.POSITION,value:"$"})});var Er=u((Em,Ne)=>{"use strict";var F=Or(),O=W(),A=Fe(),ge=vr();Ne.exports=e=>{var r=0,t,n,o={type:O.ROOT,stack:[]},i=o,s=o.stack,a=[],f=ea=>{F.error(e,`Nothing to repeat at column ${ea-1}`)},l=F.strToChars(e);for(t=l.length;r<t;)switch(n=l[r++],n){case"\\":switch(n=l[r++],n){case"b":s.push(ge.wordBoundary());break;case"B":s.push(ge.nonWordBoundary());break;case"w":s.push(A.words());break;case"W":s.push(A.notWords());break;case"d":s.push(A.ints());break;case"D":s.push(A.notInts());break;case"s":s.push(A.whitespace());break;case"S":s.push(A.notWhitespace());break;default:/\d/.test(n)?s.push({type:O.REFERENCE,value:parseInt(n,10)}):s.push({type:O.CHAR,value:n.charCodeAt(0)})}break;case"^":s.push(ge.begin());break;case"$":s.push(ge.end());break;case"[":var c;l[r]==="^"?(c=!0,r++):c=!1;var p=F.tokenizeClass(l.slice(r),e);r+=p[1],s.push({type:O.SET,set:p[0],not:c});break;case".":s.push(A.anyChar());break;case"(":var d={type:O.GROUP,stack:[],remember:!0};n=l[r],n==="?"&&(n=l[r+1],r+=2,n==="="?d.followedBy=!0:n==="!"?d.notFollowedBy=!0:n!==":"&&F.error(e,`Invalid group, character '${n}' after '?' at column ${r-1}`),d.remember=!1),s.push(d),a.push(i),i=d,s=d.stack;break;case")":a.length===0&&F.error(e,`Unmatched ) at column ${r-1}`),i=a.pop(),s=i.options?i.options[i.options.length-1]:i.stack;break;case"|":i.options||(i.options=[i.stack],delete i.stack);var b=[];i.options.push(b),s=b;break;case"{":var g=/^(\d+)(,(\d+)?)?\}/.exec(l.slice(r)),V,mr;g!==null?(s.length===0&&f(r),V=parseInt(g[1],10),mr=g[2]?g[3]?parseInt(g[3],10):1/0:V,r+=g[0].length,s.push({type:O.REPETITION,min:V,max:mr,value:s.pop()})):s.push({type:O.CHAR,value:123});break;case"?":s.length===0&&f(r),s.push({type:O.REPETITION,min:0,max:1,value:s.pop()});break;case"+":s.length===0&&f(r),s.push({type:O.REPETITION,min:1,max:1/0,value:s.pop()});break;case"*":s.length===0&&f(r),s.push({type:O.REPETITION,min:0,max:1/0,value:s.pop()});break;default:s.push({type:O.CHAR,value:n.charCodeAt(0)})}return a.length!==0&&F.error(e,"Unterminated group"),o};Ne.exports.types=O});var qr=u((Tm,Tr)=>{"use strict";var N=class e{constructor(r,t){this.low=r,this.high=t,this.length=1+t-r}overlaps(r){return!(this.high<r.low||this.low>r.high)}touches(r){return!(this.high+1<r.low||this.low-1>r.high)}add(r){return new e(Math.min(this.low,r.low),Math.max(this.high,r.high))}subtract(r){return r.low<=this.low&&r.high>=this.high?[]:r.low>this.low&&r.high<this.high?[new e(this.low,r.low-1),new e(r.high+1,this.high)]:r.low<=this.low?[new e(r.high+1,this.high)]:[new e(this.low,r.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},Pe=class e{constructor(r,t){this.ranges=[],this.length=0,r!=null&&this.add(r,t)}_update_length(){this.length=this.ranges.reduce((r,t)=>r+t.length,0)}add(r,t){var n=o=>{for(var i=0;i<this.ranges.length&&!o.touches(this.ranges[i]);)i++;for(var s=this.ranges.slice(0,i);i<this.ranges.length&&o.touches(this.ranges[i]);)o=o.add(this.ranges[i]),i++;s.push(o),this.ranges=s.concat(this.ranges.slice(i)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new N(r,t))),this}subtract(r,t){var n=o=>{for(var i=0;i<this.ranges.length&&!o.overlaps(this.ranges[i]);)i++;for(var s=this.ranges.slice(0,i);i<this.ranges.length&&o.overlaps(this.ranges[i]);)s=s.concat(this.ranges[i].subtract(o)),i++;this.ranges=s.concat(this.ranges.slice(i)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new N(r,t))),this}intersect(r,t){var n=[],o=i=>{for(var s=0;s<this.ranges.length&&!i.overlaps(this.ranges[s]);)s++;for(;s<this.ranges.length&&i.overlaps(this.ranges[s]);){var a=Math.max(this.ranges[s].low,i.low),f=Math.min(this.ranges[s].high,i.high);n.push(new N(a,f)),s++}};return r instanceof e?r.ranges.forEach(o):(t==null&&(t=r),o(new N(r,t))),this.ranges=n,this._update_length(),this}index(r){for(var t=0;t<this.ranges.length&&this.ranges[t].length<=r;)r-=this.ranges[t].length,t++;return this.ranges[t].low+r}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new e(this)}numbers(){return this.ranges.reduce((r,t)=>{for(var n=t.low;n<=t.high;)r.push(n),n++;return r},[])}subranges(){return this.ranges.map(r=>({low:r.low,high:r.high,length:1+r.high-r.low}))}};Tr.exports=Pe});var Ar=u((qm,Ir)=>{"use strict";var ye=Er(),Y=qr(),C=ye.types;Ir.exports=class Z{constructor(r,t){if(this._setDefaults(r),r instanceof RegExp)this.ignoreCase=r.ignoreCase,this.multiline=r.multiline,r=r.source;else if(typeof r=="string")this.ignoreCase=t&&t.indexOf("i")!==-1,this.multiline=t&&t.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=ye(r)}_setDefaults(r){this.max=r.max!=null?r.max:Z.prototype.max!=null?Z.prototype.max:100,this.defaultRange=r.defaultRange?r.defaultRange:this.defaultRange.clone(),r.randInt&&(this.randInt=r.randInt)}gen(){return this._gen(this.tokens,[])}_gen(r,t){var n,o,i,s,a;switch(r.type){case C.ROOT:case C.GROUP:if(r.followedBy||r.notFollowedBy)return"";for(r.remember&&r.groupNumber===void 0&&(r.groupNumber=t.push(null)-1),n=r.options?this._randSelect(r.options):r.stack,o="",s=0,a=n.length;s<a;s++)o+=this._gen(n[s],t);return r.remember&&(t[r.groupNumber]=o),o;case C.POSITION:return"";case C.SET:var f=this._expand(r);return f.length?String.fromCharCode(this._randSelect(f)):"";case C.REPETITION:for(i=this.randInt(r.min,r.max===1/0?r.min+this.max:r.max),o="",s=0;s<i;s++)o+=this._gen(r.value,t);return o;case C.REFERENCE:return t[r.value-1]||"";case C.CHAR:var l=this.ignoreCase&&this._randBool()?this._toOtherCase(r.value):r.value;return String.fromCharCode(l)}}_toOtherCase(r){return r+(97<=r&&r<=122?-32:65<=r&&r<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(r){return r instanceof Y?r.index(this.randInt(0,r.length-1)):r[this.randInt(0,r.length-1)]}_expand(r){if(r.type===ye.types.CHAR)return new Y(r.value);if(r.type===ye.types.RANGE)return new Y(r.from,r.to);{let t=new Y;for(let n=0;n<r.set.length;n++){let o=this._expand(r.set[n]);if(t.add(o),this.ignoreCase)for(let i=0;i<o.length;i++){let s=o.index(i),a=this._toOtherCase(s);s!==a&&t.add(a)}}return r.not?this.defaultRange.clone().subtract(t):this.defaultRange.clone().intersect(t)}}randInt(r,t){return r+Math.floor(Math.random()*(1+t-r))}get defaultRange(){return this._range=this._range||new Y(32,126)}set defaultRange(r){this._range=r}static randexp(r,t){var n;return typeof r=="string"&&(r=new RegExp(r,t)),r._randexp===void 0?(n=new Z(r,t),r._randexp=n):(n=r._randexp,n._setDefaults(r)),n.gen()}static sugar(){RegExp.prototype.gen=function(){return Z.randexp(this)}}}});var Ue=u((Fg,ut)=>{"use strict";var $a=typeof global=="object"&&global&&global.Object===Object&&global;ut.exports=$a});var w=u((Ng,ft)=>{"use strict";var Ua=Ue(),Ha=typeof self=="object"&&self&&self.Object===Object&&self,za=Ua||Ha||Function("return this")();ft.exports=za});var ne=u((Pg,lt)=>{"use strict";var Ga=w(),ka=Ga.Symbol;lt.exports=ka});var ht=u((Lg,dt)=>{"use strict";var ct=ne(),pt=Object.prototype,Wa=pt.hasOwnProperty,Ka=pt.toString,ie=ct?ct.toStringTag:void 0;function Xa(e){var r=Wa.call(e,ie),t=e[ie];try{e[ie]=void 0;var n=!0}catch{}var o=Ka.call(e);return n&&(r?e[ie]=t:delete e[ie]),o}dt.exports=Xa});var gt=u((Mg,mt)=>{"use strict";var Ya=Object.prototype,Za=Ya.toString;function Qa(e){return Za.call(e)}mt.exports=Qa});var L=u((Dg,xt)=>{"use strict";var yt=ne(),eu=ht(),ru=gt(),tu="[object Null]",nu="[object Undefined]",bt=yt?yt.toStringTag:void 0;function iu(e){return e==null?e===void 0?nu:tu:bt&&bt in Object(e)?eu(e):ru(e)}xt.exports=iu});var T=u((Bg,St)=>{"use strict";function ou(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}St.exports=ou});var Oe=u(($g,Ot)=>{"use strict";var su=L(),au=T(),uu="[object AsyncFunction]",fu="[object Function]",lu="[object GeneratorFunction]",cu="[object Proxy]";function pu(e){if(!au(e))return!1;var r=su(e);return r==fu||r==lu||r==uu||r==cu}Ot.exports=pu});var Et=u((Ug,vt)=>{"use strict";var du=w(),hu=du["__core-js_shared__"];vt.exports=hu});var It=u((Hg,qt)=>{"use strict";var He=Et(),Tt=function(){var e=/[^.]+$/.exec(He&&He.keys&&He.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function mu(e){return!!Tt&&Tt in e}qt.exports=mu});var Ct=u((zg,At)=>{"use strict";var gu=Function.prototype,yu=gu.toString;function bu(e){if(e!=null){try{return yu.call(e)}catch{}try{return e+""}catch{}}return""}At.exports=bu});var wt=u((Gg,_t)=>{"use strict";var xu=Oe(),Su=It(),Ou=T(),vu=Ct(),Eu=/[\\^$.*+?()[\]{}|]/g,Tu=/^\[object .+?Constructor\]$/,qu=Function.prototype,Iu=Object.prototype,Au=qu.toString,Cu=Iu.hasOwnProperty,_u=RegExp("^"+Au.call(Cu).replace(Eu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wu(e){if(!Ou(e)||Su(e))return!1;var r=xu(e)?_u:Tu;return r.test(vu(e))}_t.exports=wu});var jt=u((kg,Rt)=>{"use strict";function Ru(e,r){return e?.[r]}Rt.exports=Ru});var ve=u((Wg,Vt)=>{"use strict";var ju=wt(),Vu=jt();function Ju(e,r){var t=Vu(e,r);return ju(t)?t:void 0}Vt.exports=Ju});var oe=u((Kg,Jt)=>{"use strict";var Fu=ve(),Nu=Fu(Object,"create");Jt.exports=Nu});var Pt=u((Xg,Nt)=>{"use strict";var Ft=oe();function Pu(){this.__data__=Ft?Ft(null):{},this.size=0}Nt.exports=Pu});var Mt=u((Yg,Lt)=>{"use strict";function Lu(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}Lt.exports=Lu});var Bt=u((Zg,Dt)=>{"use strict";var Mu=oe(),Du="__lodash_hash_undefined__",Bu=Object.prototype,$u=Bu.hasOwnProperty;function Uu(e){var r=this.__data__;if(Mu){var t=r[e];return t===Du?void 0:t}return $u.call(r,e)?r[e]:void 0}Dt.exports=Uu});var Ut=u((Qg,$t)=>{"use strict";var Hu=oe(),zu=Object.prototype,Gu=zu.hasOwnProperty;function ku(e){var r=this.__data__;return Hu?r[e]!==void 0:Gu.call(r,e)}$t.exports=ku});var zt=u((ey,Ht)=>{"use strict";var Wu=oe(),Ku="__lodash_hash_undefined__";function Xu(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=Wu&&r===void 0?Ku:r,this}Ht.exports=Xu});var kt=u((ry,Gt)=>{"use strict";var Yu=Pt(),Zu=Mt(),Qu=Bt(),ef=Ut(),rf=zt();function M(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}M.prototype.clear=Yu;M.prototype.delete=Zu;M.prototype.get=Qu;M.prototype.has=ef;M.prototype.set=rf;Gt.exports=M});var Kt=u((ty,Wt)=>{"use strict";function tf(){this.__data__=[],this.size=0}Wt.exports=tf});var se=u((ny,Xt)=>{"use strict";function nf(e,r){return e===r||e!==e&&r!==r}Xt.exports=nf});var ae=u((iy,Yt)=>{"use strict";var of=se();function sf(e,r){for(var t=e.length;t--;)if(of(e[t][0],r))return t;return-1}Yt.exports=sf});var Qt=u((oy,Zt)=>{"use strict";var af=ae(),uf=Array.prototype,ff=uf.splice;function lf(e){var r=this.__data__,t=af(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():ff.call(r,t,1),--this.size,!0}Zt.exports=lf});var rn=u((sy,en)=>{"use strict";var cf=ae();function pf(e){var r=this.__data__,t=cf(r,e);return t<0?void 0:r[t][1]}en.exports=pf});var nn=u((ay,tn)=>{"use strict";var df=ae();function hf(e){return df(this.__data__,e)>-1}tn.exports=hf});var sn=u((uy,on)=>{"use strict";var mf=ae();function gf(e,r){var t=this.__data__,n=mf(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}on.exports=gf});var ue=u((fy,an)=>{"use strict";var yf=Kt(),bf=Qt(),xf=rn(),Sf=nn(),Of=sn();function D(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}D.prototype.clear=yf;D.prototype.delete=bf;D.prototype.get=xf;D.prototype.has=Sf;D.prototype.set=Of;an.exports=D});var ze=u((ly,un)=>{"use strict";var vf=ve(),Ef=w(),Tf=vf(Ef,"Map");un.exports=Tf});var cn=u((cy,ln)=>{"use strict";var fn=kt(),qf=ue(),If=ze();function Af(){this.size=0,this.__data__={hash:new fn,map:new(If||qf),string:new fn}}ln.exports=Af});var dn=u((py,pn)=>{"use strict";function Cf(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}pn.exports=Cf});var fe=u((dy,hn)=>{"use strict";var _f=dn();function wf(e,r){var t=e.__data__;return _f(r)?t[typeof r=="string"?"string":"hash"]:t.map}hn.exports=wf});var gn=u((hy,mn)=>{"use strict";var Rf=fe();function jf(e){var r=Rf(this,e).delete(e);return this.size-=r?1:0,r}mn.exports=jf});var bn=u((my,yn)=>{"use strict";var Vf=fe();function Jf(e){return Vf(this,e).get(e)}yn.exports=Jf});var Sn=u((gy,xn)=>{"use strict";var Ff=fe();function Nf(e){return Ff(this,e).has(e)}xn.exports=Nf});var vn=u((yy,On)=>{"use strict";var Pf=fe();function Lf(e,r){var t=Pf(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}On.exports=Lf});var Ee=u((by,En)=>{"use strict";var Mf=cn(),Df=gn(),Bf=bn(),$f=Sn(),Uf=vn();function B(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}B.prototype.clear=Mf;B.prototype.delete=Df;B.prototype.get=Bf;B.prototype.has=$f;B.prototype.set=Uf;En.exports=B});var qn=u((xy,Tn)=>{"use strict";var Hf="__lodash_hash_undefined__";function zf(e){return this.__data__.set(e,Hf),this}Tn.exports=zf});var An=u((Sy,In)=>{"use strict";function Gf(e){return this.__data__.has(e)}In.exports=Gf});var Ge=u((Oy,Cn)=>{"use strict";var kf=Ee(),Wf=qn(),Kf=An();function Te(e){var r=-1,t=e==null?0:e.length;for(this.__data__=new kf;++r<t;)this.add(e[r])}Te.prototype.add=Te.prototype.push=Wf;Te.prototype.has=Kf;Cn.exports=Te});var wn=u((vy,_n)=>{"use strict";function Xf(e,r,t,n){for(var o=e.length,i=t+(n?1:-1);n?i--:++i<o;)if(r(e[i],i,e))return i;return-1}_n.exports=Xf});var jn=u((Ey,Rn)=>{"use strict";function Yf(e){return e!==e}Rn.exports=Yf});var Jn=u((Ty,Vn)=>{"use strict";function Zf(e,r,t){for(var n=t-1,o=e.length;++n<o;)if(e[n]===r)return n;return-1}Vn.exports=Zf});var Nn=u((qy,Fn)=>{"use strict";var Qf=wn(),el=jn(),rl=Jn();function tl(e,r,t){return r===r?rl(e,r,t):Qf(e,el,t)}Fn.exports=tl});var ke=u((Iy,Pn)=>{"use strict";var nl=Nn();function il(e,r){var t=e==null?0:e.length;return!!t&&nl(e,r,0)>-1}Pn.exports=il});var We=u((Ay,Ln)=>{"use strict";function ol(e,r,t){for(var n=-1,o=e==null?0:e.length;++n<o;)if(t(r,e[n]))return!0;return!1}Ln.exports=ol});var le=u((Cy,Mn)=>{"use strict";function sl(e,r){for(var t=-1,n=e==null?0:e.length,o=Array(n);++t<n;)o[t]=r(e[t],t,e);return o}Mn.exports=sl});var qe=u((_y,Dn)=>{"use strict";function al(e){return function(r){return e(r)}}Dn.exports=al});var Ke=u((wy,Bn)=>{"use strict";function ul(e,r){return e.has(r)}Bn.exports=ul});var Un=u((Ry,$n)=>{"use strict";var fl=Ge(),ll=ke(),cl=We(),pl=le(),dl=qe(),hl=Ke(),ml=200;function gl(e,r,t,n){var o=-1,i=ll,s=!0,a=e.length,f=[],l=r.length;if(!a)return f;t&&(r=pl(r,dl(t))),n?(i=cl,s=!1):r.length>=ml&&(i=hl,s=!1,r=new fl(r));e:for(;++o<a;){var c=e[o],p=t==null?c:t(c);if(c=n||c!==0?c:0,s&&p===p){for(var d=l;d--;)if(r[d]===p)continue e;f.push(c)}else i(r,p,n)||f.push(c)}return f}$n.exports=gl});var zn=u((jy,Hn)=>{"use strict";function yl(e,r){for(var t=-1,n=r.length,o=e.length;++t<n;)e[o+t]=r[t];return e}Hn.exports=yl});var R=u((Vy,Gn)=>{"use strict";function bl(e){return e!=null&&typeof e=="object"}Gn.exports=bl});var Wn=u((Jy,kn)=>{"use strict";var xl=L(),Sl=R(),Ol="[object Arguments]";function vl(e){return Sl(e)&&xl(e)==Ol}kn.exports=vl});var Ie=u((Fy,Yn)=>{"use strict";var Kn=Wn(),El=R(),Xn=Object.prototype,Tl=Xn.hasOwnProperty,ql=Xn.propertyIsEnumerable,Il=Kn(function(){return arguments}())?Kn:function(e){return El(e)&&Tl.call(e,"callee")&&!ql.call(e,"callee")};Yn.exports=Il});var j=u((Ny,Zn)=>{"use strict";var Al=Array.isArray;Zn.exports=Al});var ti=u((Py,ri)=>{"use strict";var Qn=ne(),Cl=Ie(),_l=j(),ei=Qn?Qn.isConcatSpreadable:void 0;function wl(e){return _l(e)||Cl(e)||!!(ei&&e&&e[ei])}ri.exports=wl});var oi=u((Ly,ii)=>{"use strict";var Rl=zn(),jl=ti();function ni(e,r,t,n,o){var i=-1,s=e.length;for(t||(t=jl),o||(o=[]);++i<s;){var a=e[i];r>0&&t(a)?r>1?ni(a,r-1,t,n,o):Rl(o,a):n||(o[o.length]=a)}return o}ii.exports=ni});var Xe=u((My,si)=>{"use strict";function Vl(e){return e}si.exports=Vl});var ui=u((Dy,ai)=>{"use strict";function Jl(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}ai.exports=Jl});var ci=u((By,li)=>{"use strict";var Fl=ui(),fi=Math.max;function Nl(e,r,t){return r=fi(r===void 0?e.length-1:r,0),function(){for(var n=arguments,o=-1,i=fi(n.length-r,0),s=Array(i);++o<i;)s[o]=n[r+o];o=-1;for(var a=Array(r+1);++o<r;)a[o]=n[o];return a[r]=t(s),Fl(e,this,a)}}li.exports=Nl});var di=u(($y,pi)=>{"use strict";function Pl(e){return function(){return e}}pi.exports=Pl});var Ye=u((Uy,hi)=>{"use strict";var Ll=ve(),Ml=function(){try{var e=Ll(Object,"defineProperty");return e({},"",{}),e}catch{}}();hi.exports=Ml});var yi=u((Hy,gi)=>{"use strict";var Dl=di(),mi=Ye(),Bl=Xe(),$l=mi?function(e,r){return mi(e,"toString",{configurable:!0,enumerable:!1,value:Dl(r),writable:!0})}:Bl;gi.exports=$l});var xi=u((zy,bi)=>{"use strict";var Ul=800,Hl=16,zl=Date.now;function Gl(e){var r=0,t=0;return function(){var n=zl(),o=Hl-(n-t);if(t=n,o>0){if(++r>=Ul)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}bi.exports=Gl});var Oi=u((Gy,Si)=>{"use strict";var kl=yi(),Wl=xi(),Kl=Wl(kl);Si.exports=Kl});var Ae=u((ky,vi)=>{"use strict";var Xl=Xe(),Yl=ci(),Zl=Oi();function Ql(e,r){return Zl(Yl(e,r,Xl),e+"")}vi.exports=Ql});var Ze=u((Wy,Ei)=>{"use strict";var ec=9007199254740991;function rc(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ec}Ei.exports=rc});var Ce=u((Ky,Ti)=>{"use strict";var tc=Oe(),nc=Ze();function ic(e){return e!=null&&nc(e.length)&&!tc(e)}Ti.exports=ic});var _e=u((Xy,qi)=>{"use strict";var oc=Ce(),sc=R();function ac(e){return sc(e)&&oc(e)}qi.exports=ac});var Ci=u((Yy,Ai)=>{"use strict";var uc=Un(),fc=oi(),lc=Ae(),Ii=_e(),cc=lc(function(e,r){return Ii(e)?uc(e,fc(r,1,Ii,!0)):[]});Ai.exports=cc});var we=u((Zy,_i)=>{"use strict";var pc=L(),dc=R(),hc="[object Symbol]";function mc(e){return typeof e=="symbol"||dc(e)&&pc(e)==hc}_i.exports=mc});var Ri=u((Qy,wi)=>{"use strict";var gc=j(),yc=we(),bc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xc=/^\w*$/;function Sc(e,r){if(gc(e))return!1;var t=typeof e;return t=="number"||t=="symbol"||t=="boolean"||e==null||yc(e)?!0:xc.test(e)||!bc.test(e)||r!=null&&e in Object(r)}wi.exports=Sc});var Ji=u((eb,Vi)=>{"use strict";var ji=Ee(),Oc="Expected a function";function Qe(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new TypeError(Oc);var t=function(){var n=arguments,o=r?r.apply(this,n):n[0],i=t.cache;if(i.has(o))return i.get(o);var s=e.apply(this,n);return t.cache=i.set(o,s)||i,s};return t.cache=new(Qe.Cache||ji),t}Qe.Cache=ji;Vi.exports=Qe});var Ni=u((rb,Fi)=>{"use strict";var vc=Ji(),Ec=500;function Tc(e){var r=vc(e,function(n){return t.size===Ec&&t.clear(),n}),t=r.cache;return r}Fi.exports=Tc});var Li=u((tb,Pi)=>{"use strict";var qc=Ni(),Ic=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ac=/\\(\\)?/g,Cc=qc(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(Ic,function(t,n,o,i){r.push(o?i.replace(Ac,"$1"):n||t)}),r});Pi.exports=Cc});var Hi=u((nb,Ui)=>{"use strict";var Mi=ne(),_c=le(),wc=j(),Rc=we(),jc=1/0,Di=Mi?Mi.prototype:void 0,Bi=Di?Di.toString:void 0;function $i(e){if(typeof e=="string")return e;if(wc(e))return _c(e,$i)+"";if(Rc(e))return Bi?Bi.call(e):"";var r=e+"";return r=="0"&&1/e==-jc?"-0":r}Ui.exports=$i});var Gi=u((ib,zi)=>{"use strict";var Vc=Hi();function Jc(e){return e==null?"":Vc(e)}zi.exports=Jc});var er=u((ob,ki)=>{"use strict";var Fc=j(),Nc=Ri(),Pc=Li(),Lc=Gi();function Mc(e,r){return Fc(e)?e:Nc(e,r)?[e]:Pc(Lc(e))}ki.exports=Mc});var rr=u((sb,Wi)=>{"use strict";var Dc=we(),Bc=1/0;function $c(e){if(typeof e=="string"||Dc(e))return e;var r=e+"";return r=="0"&&1/e==-Bc?"-0":r}Wi.exports=$c});var Xi=u((ab,Ki)=>{"use strict";var Uc=er(),Hc=rr();function zc(e,r){r=Uc(r,e);for(var t=0,n=r.length;e!=null&&t<n;)e=e[Hc(r[t++])];return t&&t==n?e:void 0}Ki.exports=zc});var Zi=u((ub,Yi)=>{"use strict";var Gc=Xi();function kc(e,r,t){var n=e==null?void 0:Gc(e,r);return n===void 0?t:n}Yi.exports=kc});var ro=u((fb,eo)=>{"use strict";var Wc=Ge(),Kc=ke(),Xc=We(),Yc=le(),Zc=qe(),Qi=Ke(),Qc=Math.min;function ep(e,r,t){for(var n=t?Xc:Kc,o=e[0].length,i=e.length,s=i,a=Array(i),f=1/0,l=[];s--;){var c=e[s];s&&r&&(c=Yc(c,Zc(r))),f=Qc(c.length,f),a[s]=!t&&(r||o>=120&&c.length>=120)?new Wc(s&&c):void 0}c=e[0];var p=-1,d=a[0];e:for(;++p<o&&l.length<f;){var b=c[p],g=r?r(b):b;if(b=t||b!==0?b:0,!(d?Qi(d,g):n(l,g,t))){for(s=i;--s;){var V=a[s];if(!(V?Qi(V,g):n(e[s],g,t)))continue e}d&&d.push(g),l.push(b)}}return l}eo.exports=ep});var no=u((lb,to)=>{"use strict";var rp=_e();function tp(e){return rp(e)?e:[]}to.exports=tp});var oo=u((cb,io)=>{"use strict";var np=le(),ip=ro(),op=Ae(),sp=no(),ap=op(function(e){var r=np(e,sp);return r.length&&r[0]===e[0]?ip(r):[]});io.exports=ap});var ao=u((pb,so)=>{"use strict";var up=ue();function fp(){this.__data__=new up,this.size=0}so.exports=fp});var fo=u((db,uo)=>{"use strict";function lp(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}uo.exports=lp});var co=u((hb,lo)=>{"use strict";function cp(e){return this.__data__.get(e)}lo.exports=cp});var ho=u((mb,po)=>{"use strict";function pp(e){return this.__data__.has(e)}po.exports=pp});var go=u((gb,mo)=>{"use strict";var dp=ue(),hp=ze(),mp=Ee(),gp=200;function yp(e,r){var t=this.__data__;if(t instanceof dp){var n=t.__data__;if(!hp||n.length<gp-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new mp(n)}return t.set(e,r),this.size=t.size,this}mo.exports=yp});var bo=u((yb,yo)=>{"use strict";var bp=ue(),xp=ao(),Sp=fo(),Op=co(),vp=ho(),Ep=go();function $(e){var r=this.__data__=new bp(e);this.size=r.size}$.prototype.clear=xp;$.prototype.delete=Sp;$.prototype.get=Op;$.prototype.has=vp;$.prototype.set=Ep;yo.exports=$});var Re=u((bb,So)=>{"use strict";var xo=Ye();function Tp(e,r,t){r=="__proto__"&&xo?xo(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}So.exports=Tp});var tr=u((xb,Oo)=>{"use strict";var qp=Re(),Ip=se();function Ap(e,r,t){(t!==void 0&&!Ip(e[r],t)||t===void 0&&!(r in e))&&qp(e,r,t)}Oo.exports=Ap});var Eo=u((Sb,vo)=>{"use strict";function Cp(e){return function(r,t,n){for(var o=-1,i=Object(r),s=n(r),a=s.length;a--;){var f=s[e?a:++o];if(t(i[f],f,i)===!1)break}return r}}vo.exports=Cp});var qo=u((Ob,To)=>{"use strict";var _p=Eo(),wp=_p();To.exports=wp});var wo=u((ce,U)=>{"use strict";var Rp=w(),_o=typeof ce=="object"&&ce&&!ce.nodeType&&ce,Io=_o&&typeof U=="object"&&U&&!U.nodeType&&U,jp=Io&&Io.exports===_o,Ao=jp?Rp.Buffer:void 0,Co=Ao?Ao.allocUnsafe:void 0;function Vp(e,r){if(r)return e.slice();var t=e.length,n=Co?Co(t):new e.constructor(t);return e.copy(n),n}U.exports=Vp});var jo=u((vb,Ro)=>{"use strict";var Jp=w(),Fp=Jp.Uint8Array;Ro.exports=Fp});var Fo=u((Eb,Jo)=>{"use strict";var Vo=jo();function Np(e){var r=new e.constructor(e.byteLength);return new Vo(r).set(new Vo(e)),r}Jo.exports=Np});var Po=u((Tb,No)=>{"use strict";var Pp=Fo();function Lp(e,r){var t=r?Pp(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}No.exports=Lp});var Mo=u((qb,Lo)=>{"use strict";function Mp(e,r){var t=-1,n=e.length;for(r||(r=Array(n));++t<n;)r[t]=e[t];return r}Lo.exports=Mp});var $o=u((Ib,Bo)=>{"use strict";var Dp=T(),Do=Object.create,Bp=function(){function e(){}return function(r){if(!Dp(r))return{};if(Do)return Do(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();Bo.exports=Bp});var Ho=u((Ab,Uo)=>{"use strict";function $p(e,r){return function(t){return e(r(t))}}Uo.exports=$p});var nr=u((Cb,zo)=>{"use strict";var Up=Ho(),Hp=Up(Object.getPrototypeOf,Object);zo.exports=Hp});var ir=u((_b,Go)=>{"use strict";var zp=Object.prototype;function Gp(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||zp;return e===t}Go.exports=Gp});var Wo=u((wb,ko)=>{"use strict";var kp=$o(),Wp=nr(),Kp=ir();function Xp(e){return typeof e.constructor=="function"&&!Kp(e)?kp(Wp(e)):{}}ko.exports=Xp});var Xo=u((Rb,Ko)=>{"use strict";function Yp(){return!1}Ko.exports=Yp});var or=u((pe,H)=>{"use strict";var Zp=w(),Qp=Xo(),Qo=typeof pe=="object"&&pe&&!pe.nodeType&&pe,Yo=Qo&&typeof H=="object"&&H&&!H.nodeType&&H,ed=Yo&&Yo.exports===Qo,Zo=ed?Zp.Buffer:void 0,rd=Zo?Zo.isBuffer:void 0,td=rd||Qp;H.exports=td});var ts=u((jb,rs)=>{"use strict";var nd=L(),id=nr(),od=R(),sd="[object Object]",ad=Function.prototype,ud=Object.prototype,es=ad.toString,fd=ud.hasOwnProperty,ld=es.call(Object);function cd(e){if(!od(e)||nd(e)!=sd)return!1;var r=id(e);if(r===null)return!0;var t=fd.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&es.call(t)==ld}rs.exports=cd});var is=u((Vb,ns)=>{"use strict";var pd=L(),dd=Ze(),hd=R(),md="[object Arguments]",gd="[object Array]",yd="[object Boolean]",bd="[object Date]",xd="[object Error]",Sd="[object Function]",Od="[object Map]",vd="[object Number]",Ed="[object Object]",Td="[object RegExp]",qd="[object Set]",Id="[object String]",Ad="[object WeakMap]",Cd="[object ArrayBuffer]",_d="[object DataView]",wd="[object Float32Array]",Rd="[object Float64Array]",jd="[object Int8Array]",Vd="[object Int16Array]",Jd="[object Int32Array]",Fd="[object Uint8Array]",Nd="[object Uint8ClampedArray]",Pd="[object Uint16Array]",Ld="[object Uint32Array]",m={};m[wd]=m[Rd]=m[jd]=m[Vd]=m[Jd]=m[Fd]=m[Nd]=m[Pd]=m[Ld]=!0;m[md]=m[gd]=m[Cd]=m[yd]=m[_d]=m[bd]=m[xd]=m[Sd]=m[Od]=m[vd]=m[Ed]=m[Td]=m[qd]=m[Id]=m[Ad]=!1;function Md(e){return hd(e)&&dd(e.length)&&!!m[pd(e)]}ns.exports=Md});var ss=u((de,z)=>{"use strict";var Dd=Ue(),os=typeof de=="object"&&de&&!de.nodeType&&de,he=os&&typeof z=="object"&&z&&!z.nodeType&&z,Bd=he&&he.exports===os,sr=Bd&&Dd.process,$d=function(){try{var e=he&&he.require&&he.require("util").types;return e||sr&&sr.binding&&sr.binding("util")}catch{}}();z.exports=$d});var ar=u((Jb,fs)=>{"use strict";var Ud=is(),Hd=qe(),as=ss(),us=as&&as.isTypedArray,zd=us?Hd(us):Ud;fs.exports=zd});var ur=u((Fb,ls)=>{"use strict";function Gd(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}ls.exports=Gd});var fr=u((Nb,cs)=>{"use strict";var kd=Re(),Wd=se(),Kd=Object.prototype,Xd=Kd.hasOwnProperty;function Yd(e,r,t){var n=e[r];(!(Xd.call(e,r)&&Wd(n,t))||t===void 0&&!(r in e))&&kd(e,r,t)}cs.exports=Yd});var ds=u((Pb,ps)=>{"use strict";var Zd=fr(),Qd=Re();function eh(e,r,t,n){var o=!t;t||(t={});for(var i=-1,s=r.length;++i<s;){var a=r[i],f=n?n(t[a],e[a],a,t,e):void 0;f===void 0&&(f=e[a]),o?Qd(t,a,f):Zd(t,a,f)}return t}ps.exports=eh});var ms=u((Lb,hs)=>{"use strict";function rh(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}hs.exports=rh});var je=u((Mb,gs)=>{"use strict";var th=9007199254740991,nh=/^(?:0|[1-9]\d*)$/;function ih(e,r){var t=typeof e;return r=r??th,!!r&&(t=="number"||t!="symbol"&&nh.test(e))&&e>-1&&e%1==0&&e<r}gs.exports=ih});var bs=u((Db,ys)=>{"use strict";var oh=ms(),sh=Ie(),ah=j(),uh=or(),fh=je(),lh=ar(),ch=Object.prototype,ph=ch.hasOwnProperty;function dh(e,r){var t=ah(e),n=!t&&sh(e),o=!t&&!n&&uh(e),i=!t&&!n&&!o&&lh(e),s=t||n||o||i,a=s?oh(e.length,String):[],f=a.length;for(var l in e)(r||ph.call(e,l))&&!(s&&(l=="length"||o&&(l=="offset"||l=="parent")||i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||fh(l,f)))&&a.push(l);return a}ys.exports=dh});var Ss=u((Bb,xs)=>{"use strict";function hh(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}xs.exports=hh});var vs=u(($b,Os)=>{"use strict";var mh=T(),gh=ir(),yh=Ss(),bh=Object.prototype,xh=bh.hasOwnProperty;function Sh(e){if(!mh(e))return yh(e);var r=gh(e),t=[];for(var n in e)n=="constructor"&&(r||!xh.call(e,n))||t.push(n);return t}Os.exports=Sh});var lr=u((Ub,Es)=>{"use strict";var Oh=bs(),vh=vs(),Eh=Ce();function Th(e){return Eh(e)?Oh(e,!0):vh(e)}Es.exports=Th});var qs=u((Hb,Ts)=>{"use strict";var qh=ds(),Ih=lr();function Ah(e){return qh(e,Ih(e))}Ts.exports=Ah});var Rs=u((zb,ws)=>{"use strict";var Is=tr(),Ch=wo(),_h=Po(),wh=Mo(),Rh=Wo(),As=Ie(),Cs=j(),jh=_e(),Vh=or(),Jh=Oe(),Fh=T(),Nh=ts(),Ph=ar(),_s=ur(),Lh=qs();function Mh(e,r,t,n,o,i,s){var a=_s(e,t),f=_s(r,t),l=s.get(f);if(l){Is(e,t,l);return}var c=i?i(a,f,t+"",e,r,s):void 0,p=c===void 0;if(p){var d=Cs(f),b=!d&&Vh(f),g=!d&&!b&&Ph(f);c=f,d||b||g?Cs(a)?c=a:jh(a)?c=wh(a):b?(p=!1,c=Ch(f,!0)):g?(p=!1,c=_h(f,!0)):c=[]:Nh(f)||As(f)?(c=a,As(a)?c=Lh(a):(!Fh(a)||Jh(a))&&(c=Rh(f))):p=!1}p&&(s.set(f,c),o(c,f,n,i,s),s.delete(f)),Is(e,t,c)}ws.exports=Mh});var cr=u((Gb,Vs)=>{"use strict";var Dh=bo(),Bh=tr(),$h=qo(),Uh=Rs(),Hh=T(),zh=lr(),Gh=ur();function js(e,r,t,n,o){e!==r&&$h(r,function(i,s){if(o||(o=new Dh),Hh(i))Uh(e,r,s,t,js,n,o);else{var a=n?n(Gh(e,s),i,s+"",e,r,o):void 0;a===void 0&&(a=i),Bh(e,s,a)}},zh)}Vs.exports=js});var Fs=u((kb,Js)=>{"use strict";var kh=se(),Wh=Ce(),Kh=je(),Xh=T();function Yh(e,r,t){if(!Xh(t))return!1;var n=typeof r;return(n=="number"?Wh(t)&&Kh(r,t.length):n=="string"&&r in t)?kh(t[r],e):!1}Js.exports=Yh});var pr=u((Wb,Ns)=>{"use strict";var Zh=Ae(),Qh=Fs();function em(e){return Zh(function(r,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,s=o>2?t[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&Qh(t[0],t[1],s)&&(i=o<3?void 0:i,o=1),r=Object(r);++n<o;){var a=t[n];a&&e(r,a,n,i)}return r})}Ns.exports=em});var Ls=u((Kb,Ps)=>{"use strict";var rm=cr(),tm=pr(),nm=tm(function(e,r,t){rm(e,r,t)});Ps.exports=nm});var Ds=u((Xb,Ms)=>{"use strict";var im=cr(),om=pr(),sm=om(function(e,r,t,n){im(e,r,t,n)});Ms.exports=sm});var Us=u((Yb,$s)=>{"use strict";var am=fr(),um=er(),fm=je(),Bs=T(),lm=rr();function cm(e,r,t,n){if(!Bs(e))return e;r=um(r,e);for(var o=-1,i=r.length,s=i-1,a=e;a!=null&&++o<i;){var f=lm(r[o]),l=t;if(f==="__proto__"||f==="constructor"||f==="prototype")return e;if(o!=s){var c=a[f];l=n?n(c,f,a):void 0,l===void 0&&(l=Bs(c)?c:fm(r[o+1])?[]:{})}am(a,f,l),a=a[f]}return e}$s.exports=cm});var zs=u((Zb,Hs)=>{"use strict";var pm=Us();function dm(e,r,t){return e==null?e:pm(e,r,t)}Hs.exports=dm});var Fr=I(Ar(),1);function _r(e){if(e===0)return 0;let r=e/1024;return Number.parseFloat(r.toFixed(2))}var la=["if","then","else"];function Cr(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Q(e,r){if(!(!e||!r)&&!(typeof e!="object"||typeof r!="object"))for(let[t,n]of Object.entries(r)){if(la.includes(t))continue;let o=e[t];if(Cr(n))Cr(o)?Q(o,n):o!==n&&(e[t]=n);else if(o&&Array.isArray(n)){let i=o;for(let s of n)s&&typeof s=="object"?Q(i,n):t==="required"?i.find(a=>a===s)||i.push(s):e[t]=n}else e[t]!==n&&(e[t]=n)}}var wr="yyyy-MM-dd";function Rr(e,r){let t=new Date(e).getTime(),n=new Date(r).getTime();return t<n?"LESSER":t>n?"GREATER":"EQUAL"}function ca(e,r){let t=Rr(e,r);return t==="GREATER"||t==="EQUAL"}function pa(e,r){let t=Rr(e,r);return t==="LESSER"||t==="EQUAL"}function jr(e,r,t,n=[]){let o=typeof e=="string",i=e==="",s=e===void 0||e===null&&t.treatNullAsUndefined,a=i||s,f=[];if(!o||a||r["x-jsf-presentation"]===void 0)return f;let{minDate:l,maxDate:c}=r["x-jsf-presentation"];return l&&!ca(e,l)&&f.push({path:n,validation:"minDate",schema:r,value:e}),c&&!pa(e,c)&&f.push({path:n,validation:"maxDate",schema:r,value:e}),f}function Vr(e){return e["x-jsf-presentation"]?.inputType==="checkbox"}var Jr="Please acknowledge this field";function Nr(e,r,t,n){let o=e["x-jsf-presentation"];switch(t){case"type":return da(e.type);case"required":return Vr(e)?Jr:"Required field";case"forbidden":return"Not allowed";case"const":return Vr(e)&&r===!1?Jr:`The only accepted value is ${JSON.stringify(e.const)}.`;case"enum":return`The option "${Le(r)}" is not valid.`;case"oneOf":return`The option "${Le(r)}" is not valid.`;case"anyOf":return`The option "${Le(r)}" is not valid.`;case"not":return"The value must not satisfy the provided schema";case"minLength":return`Please insert at least ${e.minLength} characters`;case"maxLength":return`Please insert up to ${e.maxLength} characters`;case"pattern":return`Must have a valid format. E.g. ${(0,Fr.randexp)(e.pattern||"")}`;case"format":if(e.format==="email")return"Please enter a valid email address";if(e.format==="date"){let i=new Date().toISOString().split("T")[0];return`Must be a valid date in ${wr.toLowerCase()} format. e.g. ${i}`}return`Must be a valid ${e.format} format`;case"multipleOf":return`Must be a multiple of ${e.multipleOf}`;case"maximum":return`Must be smaller or equal to ${e.maximum}`;case"exclusiveMaximum":return`Must be smaller than ${e.exclusiveMaximum}`;case"minimum":return`Must be greater or equal to ${e.minimum}`;case"exclusiveMinimum":return`Must be greater than ${e.exclusiveMinimum}`;case"minDate":return`The date must be ${o?.minDate} or after.`;case"maxDate":return`The date must be ${o?.maxDate} or before.`;case"fileStructure":return"Not a valid file.";case"maxFileSize":{let i=o?.maxFileSize,s=typeof i=="number"?_r(i):void 0;return`File size too large.${s?` The limit is ${s} MB.`:""}`}case"accept":{let i=o?.accept;return`Unsupported file format.${i?` The acceptable formats are ${i}.`:""}`}case"minItems":{let i=e.minItems===1?"item":"items";return`Must have at least ${e.minItems} ${i}`}case"maxItems":{let i=e.maxItems===1?"item":"items";return`Must have at most ${e.maxItems} ${i}`}case"uniqueItems":return"Items must be unique";case"contains":throw new Error('"contains" is not implemented yet');case"minContains":throw new Error('"minContains" is not implemented yet');case"maxContains":throw new Error('"maxContains" is not implemented yet');case"json-logic":return n||"The value is not valid"}}function da(e){if(Array.isArray(e))return`The value must be a ${e.map(t=>t==="integer"?"number":t).join(" or ")}`;switch(e){case"number":case"integer":return"The value must be a number";case"boolean":return"The value must be a boolean";case"null":return"The value must be null";case"string":return"The value must be a string";case"object":return"The value must be an object";case"array":return"The value must be an array";default:return e?`The value must be ${e}`:"Invalid value"}}function Le(e){return typeof e=="string"?e:JSON.stringify(e)}function ha(e,r){let t={};return r.forEach((o,i)=>{t[o]=i}),e.sort((o,i)=>{let s=t[o.name]??1/0,a=t[i.name]??1/0;return s!==a?s-a:e.indexOf(o)-e.indexOf(i)})}function Me(e,r){if(typeof e=="boolean")throw new TypeError("Schema must be an object");return e["x-jsf-order"]!==void 0?ha(r,e["x-jsf-order"]):r}function ma(e,r,t){r.checkboxValue=t.const,t.type==="boolean"&&(r.checkboxValue=!0)}function ga(e,r){if(e.options===void 0){let t=xa(r);t&&(e.options=t,r.type==="array"&&(e.multiple=!0))}}function ya(e,r,t,n){if(e.options===void 0){let o=va(r,t,n);o&&(e.fields=o)}}function ba(e,r){if(!e)return"text";switch(e){case"string":{let{oneOf:t,format:n}=r;return n==="email"?"email":n==="date"?"date":n==="data-url"?"file":t?"radio":"text"}case"number":case"integer":return"number";case"object":return"fieldset";case"array":{let{items:t}=r;return t?.properties?"group-array":"select"}case"boolean":return"checkbox";default:return"text"}}function Pr(e,r,t,n){let o=t["x-jsf-presentation"];if(o?.inputType)return o.inputType;if(n&&r!=="root")throw new Error(`Strict error: Missing inputType to field "${t.title}".
|
|
2
|
+
You can fix the json schema or skip this error by calling createHeadlessForm(schema, { strictInputType: false })`);if(!t.type){if(t.items?.properties)return"group-array";if(t.properties)return"select"}return ba(e||t.type||"string",t)}function be(e){return e.filter(r=>r!==null&&typeof r=="object"&&r.const!==null).map(r=>{let t=r.title,n=r.const,i=r["x-jsf-presentation"]?.meta,s={label:t||"",value:n};i&&(s.meta=i);let{title:a,const:f,"x-jsf-presentation":l,...c}=r;return{...s,...c}})}function xa(e){if(e.oneOf)return be(e.oneOf||[]);if(e.items?.anyOf)return be(e.items.anyOf);if(e.anyOf)return be(e.anyOf);if(e.enum){let r=e.enum?.map(t=>({title:typeof t=="string"?t:JSON.stringify(t),const:t}))||[];return be(r)}return null}function Sa(e,r,t){let n=[];for(let i in e.properties){let s=e.required?.includes(i)||!1,a=_({schema:e.properties[i],name:i,required:s,originalSchema:r.properties?.[i]||e.properties[i],strictInputType:t});a&&n.push(a)}return Me(e,n)}function Oa(e,r,t){let n=[];if(typeof e.items!="object"||e.items===null)return[];if(e.items?.type==="object"){let i=e.items;for(let s in i.properties){let a=i.required?.includes(s)||!1,f=_({schema:i.properties[s],name:s,required:a,originalSchema:r,strictInputType:t});f&&(f.nameKey=s,n.push(f))}}else{let i=_({schema:e.items,name:"item",required:!1,originalSchema:r,strictInputType:t});i&&n.push(i)}return Me(e.items,n)}function va(e,r,t){return typeof e.properties=="object"&&e.properties!==null?Sa(e,r,t):typeof e.items=="object"&&e.items!==null?Oa(e,r,t):null}var Ea=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","properties"];function _({schema:e,name:r,required:t=!1,originalSchema:n,strictInputType:o=!1,type:i=void 0}){if(e===!1){let c=Pr(i,r,n,o),p=["fieldset","group-array"].includes(c);return{type:c,name:r,inputType:c,jsonType:"boolean",required:t,isVisible:!1,...p&&{fields:[]}}}if(typeof e=="boolean")return null;let s={...n["x-jsf-presentation"]||{},...e["x-jsf-presentation"]||{}},a=e["x-jsf-errorMessage"],f=Pr(i,r,e,o),l={...Object.entries(e).filter(([c])=>!Ea.includes(c)).reduce((c,[p,d])=>({...c,[p]:d}),{}),name:r,inputType:f,type:f,jsonType:i||e.type,required:t,isVisible:!0,...a&&{errorMessage:a}};return f==="checkbox"&&ma(f,l,e),e.title&&(l.label=e.title),Object.keys(s).length>0&&Object.entries(s).forEach(([c,p])=>{c!=="inputType"&&(l[c]=p)}),r!=="root"&&ga(l,e),ya(l,e,n),l}function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e,r){if(typeof e!=typeof r)return!1;if(e===r)return!0;if(e===null||r===null)return!1;if(Array.isArray(e)&&Array.isArray(r))return e.length!==r.length?!1:e.every((t,n)=>E(t,r[n]));if(v(e)&&v(r)){let t=Object.keys(e).sort(),n=Object.keys(r).sort();return t.length!==n.length||!E(t,n)?!1:t.every(o=>E(e[o],r[o]))}return!1}function Lr(e){if(typeof structuredClone=="function")try{return structuredClone(e)}catch(r){console.warn("structuredClone failed, falling back to JSON method:",r)}try{return JSON.parse(JSON.stringify(e))}catch{throw new Error("Deep clone failed: Object may contain circular references or non-serializable values")}}function Mr(e,r,t,n,o){return Array.isArray(e)?[...Ta(r,e,o),...Ca(r,e,o),...Aa(e,r,t,n,o),...Ia(r,e,t,n,o),...qa(r,e,t,n,o)]:[]}function Ta(e,r,t){let n=[],o=r.length;return e.maxItems!==void 0&&o>e.maxItems&&n.push({path:t,validation:"maxItems",schema:e,value:r}),e.minItems!==void 0&&o<e.minItems&&n.push({path:t,validation:"minItems",schema:e,value:r}),n}function qa(e,r,t,n,o){if(e.items===void 0)return[];let i=[],s=Array.isArray(e.prefixItems)?e.prefixItems.length:0;for(let[a,f]of r.slice(s).entries())i.push(...x(f,e.items,t,[...o,"items",a+s],n));return i}function Ia(e,r,t,n,o){if(!Array.isArray(e.prefixItems))return[];let i=[];for(let[s,a]of r.entries())s<e.prefixItems.length&&i.push(...x(a,e.prefixItems[s],t,[...o,"prefixItems",s],n));return i}function Aa(e,r,t,n,o){if(!("contains"in r))return[];let i=[],s=e.filter(a=>x(a,r.contains,t,[...o,"contains"],n).length===0).length;return r.minContains===void 0&&r.maxContains===void 0?s<1&&i.push({path:o,validation:"contains",schema:r,value:e}):(r.minContains!==void 0&&s<r.minContains&&i.push({path:o,validation:"minContains",schema:r,value:e}),r.maxContains!==void 0&&s>r.maxContains&&i.push({path:o,validation:"maxContains",schema:r,value:e})),i}function Ca(e,r,t){if(e.uniqueItems!==!0)return[];let n=new Map;for(let o=0;o<r.length;o++){for(let i of n.values())if(E(r[o],i))return[{path:t,validation:"uniqueItems",schema:e,value:r[o]}];n.set(o,r[o])}return[]}function Dr(e,r,t,n,o=[]){if(!r.allOf)return[];for(let i=0;i<r.allOf.length;i++){let s=r.allOf[i],a=x(e,s,t,[...o,"allOf",i],n);if(a.length>0)return a}return[]}function Br(e,r,t,n,o=[]){if(!r.anyOf)return[];if(o.length!==0){for(let a of r.anyOf)if(x(e,a,t,o,n).length===0)return[];return[{path:o,validation:"anyOf",schema:r,value:e}]}let i=[];for(let a of r.anyOf){let f=x(e,a,t,o,n);f.length!==0&&i.push(f)}return i.length<r.anyOf.length?[]:i.flat().reverse()}function $r(e,r,t,n,o=[]){if(!r.oneOf)return[];if(r.oneOf.length===0)return[];let i=0;for(let s=0;s<r.oneOf.length&&!(x(e,r.oneOf[s],t,o,n).length===0&&(i++,i>1));s++);return i===0?[{path:o,validation:"oneOf",schema:r,value:e}]:i>1?[{path:o,validation:"oneOf",schema:r,value:e}]:[]}function Ur(e,r,t,n,o=[]){return r.not===void 0?[]:typeof r.not=="boolean"?r.not?[{path:o,validation:"not",schema:r,value:e}]:[]:x(e,r.not,t,o,n).length===0?[{path:o,validation:"not",schema:r,value:e}]:[]}function Hr(e,r,t=[]){let n=typeof r.const<"u"?r.const:r.value;return n===void 0?[]:E(n,e)?[]:[{path:t,validation:"const",schema:r,value:e}]}function zr(e,r,t=[]){return r.enum===void 0?[]:r.enum.some(n=>E(n,e))?[]:[{path:t,validation:"enum",schema:r,value:e}]}function Gr(e,r,t=[]){let n=r["x-jsf-presentation"],o=n?.inputType==="file",i=typeof n?.maxFileSize=="number"||typeof n?.accept=="string";if(!(o||i))return[];if(!Array.isArray(e))return[];if(e.length===0)return[];if(!e.every(l=>v(l)&&typeof l.name=="string"&&typeof l.size=="number"))return[{path:t,validation:"fileStructure",schema:r,value:e}];let f=e;if(typeof n?.maxFileSize=="number"){let l=n.maxFileSize*1024;if(f.some(p=>p.size>l))return[{path:t,validation:"maxFileSize",schema:r,value:e}]}if(typeof n?.accept=="string"&&n.accept.trim()!==""){let l=n.accept.toLowerCase().split(",").map(c=>c.trim()).filter(c=>c).map(c=>c.startsWith(".")?c:`.${c}`);if(l.length>0&&!f.some(p=>{let d=p.name.toLowerCase(),b=d.includes(".")?`.${d.split(".").pop()}`:"";return b!==""&&l.includes(b)}))return[{path:t,validation:"accept",schema:r,value:e}]}return[]}import P from"json-logic-js";function Se(e,r){let{validations:t,computedValues:n}=e;return{schema:{validations:t,computedValues:n},value:r}}function kr(e){return/\{\{.*?\}\}/.test(e)}function xe(e={}){return Object.entries(e).reduce((r,[t,n])=>({...r,[t]:n??Number.NaN}),{})}function Wr(e,r,t=[]){let n=e["x-jsf-logic-validations"];return!n||n.length===0?[]:n.map(o=>{let i=r?.schema?.validations?.[o],s=r?.value;if(!i)throw new Error(`[json-schema-form] json-logic error: "${e.title}" required validation "${o}" doesn't exist.`);if(P.apply(i.rule,xe(s))===!1){let f=i.errorMessage;return f&&kr(f)&&(f=f.replace(/\{\{(.*?)\}\}/g,(l,c)=>{let p=c.trim(),d=r.schema.computedValues?.[p];return d?P.apply(d.rule,xe(s)):P.apply({var:p},xe(s))})),[{path:t,validation:"json-logic",customErrorMessage:f,schema:e,value:s}]}return[]}).flat()}function _a(e,r,t){if(!r)throw new Error(`[json-schema-form] json-logic error: Computed value "${e}" doesn't exist`);return P.apply(r,xe(t))}function Kr(e,r,t){if(r){let n={};Object.entries(r).forEach(([o,i])=>{let s=_a(o,i.rule,t);n[o]=s}),ee(e,n)}return e}function ee(e,r){function t(n){if(typeof n!="object")return;let o=n["x-jsf-logic-computedAttrs"];if(o&&wa(n,r,o),typeof n.properties=="object")for(let i in n.properties)t(n.properties[i]);if(typeof n.if=="object"&&ee(n.if,r),n.allOf&&n.allOf.length>0)for(let i of n.allOf)ee(i,r);if(n.anyOf&&n.anyOf.length>0)for(let i of n.anyOf)ee(i,r);if(n.oneOf&&n.oneOf.length>0)for(let i of n.oneOf)ee(i,r);delete n["x-jsf-logic-computedAttrs"]}t(e)}function wa(e,r,t){if(typeof e!="object")return;function n(i){return kr(i)?i.replace(/\{\{(.*?)\}\}/g,(s,a)=>{let f=a.trim();return r[f]||`{{${f}}}`}):r[i]}function o(i,s,a,f){if(typeof i!="object")return;let l=s;i[l]||(i[l]={}),Object.entries(a).forEach(([c,p])=>{typeof p=="string"?i[l][c]=n(p):o(i[l],c,p,f)})}for(let i in t){let s=i,a=t[i];typeof a=="string"?e[s]=n(a):typeof e=="object"&&o(e,s,a,r)}}function Xr(e){if(e)for(let[r,t]of Object.entries(e))P.add_operation(r,t)}function Yr(e){if(e)for(let r of Object.keys(e))P.rm_operation(r)}function Zr(e,r,t=[]){let n=[],o=re(r);return typeof e!="number"?[]:o!==void 0&&!["number","integer"].includes(o)?[]:(r.multipleOf!==void 0&&e%r.multipleOf!==0&&n.push({path:t,validation:"multipleOf",schema:r,value:e}),r.maximum!==void 0&&e>r.maximum&&n.push({path:t,validation:"maximum",schema:r,value:e}),r.exclusiveMaximum!==void 0&&e>=r.exclusiveMaximum&&n.push({path:t,validation:"exclusiveMaximum",schema:r,value:e}),r.minimum!==void 0&&e<r.minimum&&n.push({path:t,validation:"minimum",schema:r,value:e}),r.exclusiveMinimum!==void 0&&e<=r.exclusiveMinimum&&n.push({path:t,validation:"exclusiveMinimum",schema:r,value:e}),n)}function Qr(e,r,t,n,o=[]){if(typeof r=="object"&&r.properties&&v(e)){let i=[];for(let[s,a]of Object.entries(r.properties))i.push(...x(e[s],a,t,[...o,s],n));return i}return[]}var et;(function(e){e["7bit"]="7bit",e["8bit"]="8bit",e.Base64="base64",e.Binary="binary",e.IETFToken="ietf-token",e.QuotedPrintable="quoted-printable",e.XToken="x-token"})(et||(et={}));var y;(function(e){e.Date="date",e.DateTime="date-time",e.Duration="duration",e.Email="email",e.Hostname="hostname",e.IDNEmail="idn-email",e.IDNHostname="idn-hostname",e.IPv4="ipv4",e.IPv6="ipv6",e.IRI="iri",e.IRIReference="iri-reference",e.JSONPointer="json-pointer",e.JSONPointerURIFragment="json-pointer-uri-fragment",e.RegEx="regex",e.RelativeJSONPointer="relative-json-pointer",e.Time="time",e.URI="uri",e.URIReference="uri-reference",e.URITemplate="uri-template",e.UUID="uuid"})(y||(y={}));var rt;(function(e){e.Array="array",e.Boolean="boolean",e.Integer="integer",e.Null="null",e.Number="number",e.Object="object",e.String="string"})(rt||(rt={}));var S={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},Ra={[y.DateTime]:e=>S.DATE_TIME.test(e),[y.Date]:e=>S.DATE.test(e),[y.Time]:e=>S.TIME.test(e),[y.Duration]:e=>S.DURATION.test(e),[y.Email]:e=>e.length<=254&&S.EMAIL.test(e),[y.IDNEmail]:e=>e.length<=254&&S.IDN_EMAIL.test(e),[y.Hostname]:e=>e.length>255?!1:e.split(".").every(t=>S.HOSTNAME.test(t)),[y.IDNHostname]:e=>e.length>255?!1:e.split(".").every(t=>t.length<=63&&S.IDN_HOSTNAME.test(t)),[y.IPv4]:e=>{let r=e.split(".");return r.length!==4?!1:r.every(t=>{let n=Number.parseInt(t,10);return n>=0&&n<=255&&t===n.toString()})},[y.IPv6]:e=>{let r=e.split(":");if(r.length>8)return!1;let t=!1;return r.every(n=>n===""?t?!1:(t=!0,!0):S.IPV6_PART.test(n))},[y.URI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.URIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.IRI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.IRIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.RegEx]:e=>{try{return new RegExp(e,"u"),!0}catch{return!1}},[y.UUID]:e=>S.UUID.test(e),[y.JSONPointer]:e=>S.JSON_POINTER.test(e),[y.JSONPointerURIFragment]:e=>S.JSON_POINTER_URI_FRAGMENT.test(e),[y.RelativeJSONPointer]:e=>S.RELATIVE_JSON_POINTER.test(e),[y.URITemplate]:e=>S.URI_TEMPLATE.test(e)};function tt(e,r,t=[]){let n=[];if(typeof e!="string")return n;let o=Ra[r.format];return o&&!o(e)&&n.push({path:t,validation:"format",schema:r,value:e}),n}function nt(e,r,t=[]){let n=[],o=re(r);if(typeof e!="string")return[];if(o!==void 0&&o!=="string")return[];let i=[...new Intl.Segmenter().segment(e)].length;if(r.minLength!==void 0&&i<r.minLength&&n.push({path:t,validation:"minLength",schema:r,value:e}),r.maxLength!==void 0&&i>r.maxLength&&n.push({path:t,validation:"maxLength",schema:r,value:e}),r.pattern!==void 0&&(new RegExp(r.pattern).test(e)||n.push({path:t,validation:"pattern",schema:r,value:e})),r.format!==void 0){let s=tt(e,r,t);n.push(...s)}return n}function re(e){if(typeof e=="boolean")return"boolean";if(e.type!==void 0)return e.type}function ja(e,r,t=[]){let n=re(r);if(n===void 0)return[];if(n==="null"&&e===null)return[];let o=e===null?"null":Array.isArray(e)?"array":typeof e;if(Array.isArray(n)){if(e===null&&n.includes("null"))return[];for(let i of n){if(i==="array"&&Array.isArray(e))return[];if(o==="number"&&i==="integer"&&Number.isInteger(e))return[];if(o===i||i==="null"&&e===null)return[]}}else{if(n==="array"&&Array.isArray(e))return[];if(o==="number"&&n==="integer"&&Number.isInteger(e))return[];if(o===n)return[]}return[{path:t,validation:"type",schema:r,value:e}]}function Va(e,r,t={},n=[],o){return r?x(e,r,t,n,o):[]}function x(e,r,t={},n=[],o){let i=o,s;if(!o&&r["x-jsf-logic"]){i=Se(r["x-jsf-logic"],e);let{validations:d,computedValues:b,...g}=r["x-jsf-logic"];s=g}let a=e===void 0||e===null&&t.treatNullAsUndefined,f=[];if(a)return[];if(typeof r=="boolean")return!r&&!t.allowForbiddenValues?[{path:n,validation:"forbidden",schema:r,value:e}]:[];let c=r["x-jsf-presentation"]?.inputType==="file",p=[];if(!c&&(p=ja(e,r,n),p.length>0))return p;if(r.required&&v(e)){let d=r.required.filter(b=>{let g=e[b];return Array.isArray(g)?g.length===0:v(g)?Object.keys(g).length===0:g===void 0||g===null&&t.treatNullAsUndefined});for(let b of d)f.push({path:[...n,b],validation:"required",schema:r?.properties?.[b]||r,value:e})}return[...f,...Hr(e,r,n),...zr(e,r,n),...Qr(e,r,t,i,n),...Mr(e,r,t,i,n),...nt(e,r,n),...Zr(e,r,n),...Gr(e,r,n),...Ur(e,r,t,i,n),...Dr(e,r,t,i,n),...Br(e,r,t,i,n),...$r(e,r,t,i,n),...it(e,r,t,i,n),...jr(e,r,t,n),...Va(e,s,t,n,i),...Wr(r,i,n)]}function De(e,r,t,n,o=[]){return x(e,r,{...t,...typeof r=="boolean"?{allowForbiddenValues:!1}:{}},o,n).length===0}function it(e,r,t,n,o=[]){if(r.if===void 0)return[];let i=De(e,r.if,t,n,o);return i&&r.then!==void 0?x(e,r.then,t,[...o,"then"],n):!i&&r.else!==void 0?x(e,r.else,t,[...o,"else"],n):[]}function Be({schema:e,values:r,options:t={}}){let n=e["x-jsf-logic"]?Se(e["x-jsf-logic"],r):void 0,o=Lr(e);return te(o,r,t,n),n?.schema.computedValues&&(Kr(o,n.schema.computedValues,r),te(o,r,t,n)),o}function ot(e,r,t,n={},o){let i=De(e,t.if,n,o),s=!1;return i&&t.if?.required&&(s=t.if.required.some(f=>{if(!r.properties||!r.properties[f])return!1;let l=r.properties[f],c=e[f];return x(c,l,n).some(d=>d.validation==="type")})),{rule:t,matches:i&&!s}}function te(e,r={},t={},n){if(!v(r))return;let o=[];typeof e.if<"u"&&o.push(ot(r,e,e,t,n)),(e.allOf??[]).filter(i=>typeof i.if<"u").forEach(i=>{let s=ot(r,e,i,t,n);o.push(s)});for(let{rule:i,matches:s}of o)s&&i.then?(st(e,r,i.then,t,n),delete i.then):!s&&i.else&&(st(e,r,i.else,t,n),delete i.else);if(e.properties){for(let[i,s]of Object.entries(e.properties))if(typeof s=="object"){let a=s;a.type==="object"&&te(a,r[i],t,n),a.items&&te(a.items,r[i],t,n)}}}function st(e,r,t,n={},o){let i=t;te(i,r,n,o),Q(e,i)}function $e(e,r,t){let n=_({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:!1})?.fields||[];for(let o of e){let i=n.find(s=>s.name===o.name);if(i){at(o,i),Q(o,i);let s=r.properties?.[o.name];s&&typeof s=="object"&&o.fields&&s.type==="object"&&$e(o.fields,s,t)}}}function at(e,r){for(let[t]of Object.entries(e))r[t]?e[t]&&typeof e[t]=="object"&&!Array.isArray(e[t])&&r[t]&&typeof r[t]=="object"&&!Array.isArray(r[t])&&at(e[t],r[t]):delete e[t]}function Ja(e){let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(["allOf","anyOf","oneOf"].includes(n)){t+1<e.length&&typeof e[t+1]=="number"&&t++;continue}n==="then"||n==="else"||(n==="items"&&typeof e[t+1]=="number"?(t++,r.push(e[t])):r.push(n))}return r}function Fa(e){if(e.length===0)return null;let r={};for(let t of e){let{path:n}=t;if(n.length===0){r[""]=t.message;continue}let o=Ja(n),i=r;for(let s=0;s<o.length-1;s++){let a=o[s];if(typeof a=="number"){if(!Array.isArray(i))throw new TypeError(`Expected an array at path: ${o.slice(0,s).join(".")}`);i[a]||(i[a]={}),i=i[a]}else typeof o[s+1]=="number"?a in i||(i[a]=[]):(!(a in i)||typeof i[a]=="string")&&(i[a]={}),i=i[a]}if(o.length>0){let s=o[o.length-1];i[s]=t.message}}return r}function Na(e){return e.map(r=>{let{schema:t,value:n,validation:o,customErrorMessage:i}=r;return{...r,message:Nr(t,n,o,i)}})}function Pa(e,r){return typeof r!="object"||!r||!e.length?e:e.map(t=>{let n=t.schema,o=n["x-jsf-errorMessage"]?.[t.validation];return n&&o?{...t,message:o}:t})}function La(e,r,t={}){let n={},o=x(e,r,t),i=Na(o),s=Pa(i,r),a=Fa(s);return a&&(n.formErrors=a),n}function Ma(e){let{schema:r,originalSchema:t,strictInputType:n}=e;return _({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:n})?.fields||[]}function Da(e){if(Object.prototype.hasOwnProperty.call(e,"customProperties")&&console.error("[json-schema-form] `customProperties` is a deprecated option and it's not supported on json-schema-form v1"),e.customJsonLogicOps){if(typeof e.customJsonLogicOps!="object"||e.customJsonLogicOps===null)throw new TypeError("validationOptions.customJsonLogicOps must be an object.");for(let[r,t]of Object.entries(e.customJsonLogicOps))if(typeof t!="function")throw new TypeError(`Custom JSON Logic operator '${r}' must be a function, but received type '${typeof t}'.`)}}function Ba(e,r={}){Da(r);let t=r.initialValues||{},n=r.strictInputType||!1,o=Be({schema:e,values:t,options:r.legacyOptions}),i=Ma({schema:o,originalSchema:e,strictInputType:n});return{fields:i,isError:!1,error:null,handleValidation:f=>{let l=r?.customJsonLogicOps;try{Xr(l);let c=Be({schema:e,values:f,options:r.legacyOptions}),p=La(f,c,r.legacyOptions);return $e(i,c,e),p}finally{Yr(l)}}}}var Gs=I(Ci(),1),k=I(Zi(),1),G=I(oo(),1),ks=I(Ls(),1),hr=I(Ds(),1),Ve=I(zs(),1);function Ws(e){return e.replace(".",".properties.")}function Ks(e){let{errorMessage:r,presentation:t,properties:n,...o}=e;return{...o,...t?{"x-jsf-presentation":t}:{},...r?{"x-jsf-errorMessage":r}:{}}}function Xs(e,r){return Array.isArray(r)?r:void 0}function hm(e,r){let{if:t,then:n,else:o}=e;return(0,G.default)(t?.required||[],r).length>0||((0,G.default)(n?.required||[],r)||(0,G.default)(Object.keys(n?.properties||{}),r)).length>0||((0,G.default)(o?.required||[],r)||(0,G.default)(Object.keys(o?.properties||{}),r)).length>0}function Ys(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let s=Ws(o),a=(0,k.default)(e.properties,s);if(!a){t.push({type:"FIELD_TO_CHANGE_NOT_FOUND",message:`Changing field "${o}" was ignored because it does not exist.`});return}let f=typeof i=="function"?i(a):i;if((0,hr.default)(a,{...Ks(f)},Xs),f.properties){let l=Ys((0,k.default)(e.properties,s),f.properties);l.warnings&&t.push(...l.warnings)}}),{warnings:t.flat()}}function Zs(e,r,t){if(!r||typeof e!="object"||e===null)return{warnings:null};let n=t?.parent;return typeof e=="object"&&e.properties&&Object.entries(e.properties).forEach(([o,i])=>{let s=n?`${n}.${o}`:o,a=r(s,i),f=Ks(a);(0,hr.default)((0,k.default)(e.properties,o),{...i,...f},Xs),i.properties&&Zs(i,r,{parent:o})}),{warnings:null}}function mm(e,r){if(!r)return{warnings:null};let t=[],n=e["x-jsf-order"]||[],o=typeof r=="function"?r(n):r,i=(0,Gs.default)(n,o);return i.length>0&&t.push({type:"ORDER_MISSING_FIELDS",message:`Some fields got forgotten in the new order. They were automatically appended: ${i.join(", ")}`}),e["x-jsf-order"]=[...o,...i],{warnings:t}}function Qs(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let s=Ws(o);if(!i)return{warnings:null};if(i.properties){let l=(0,k.default)(e.properties,s);if(!l)return{warnings:null};let c=Qs(l,i.properties);c.warnings&&t.push(...c.warnings)}if((0,k.default)(e.properties,s)){t.push({type:"FIELD_TO_CREATE_EXISTS",message:`Creating field "${o}" was ignored because it already exists.`});return}let f=(0,Ve.default)({},s,i);(0,ks.default)(e.properties,f)}),{warnings:t.flat()}}function gm(e,r){if(!r)return{schema:e,warnings:null};let t={properties:{}};Object.entries(e).forEach(([i,s])=>{switch(i){case"properties":r.forEach(a=>{(0,Ve.default)(t.properties,a,s[a])});break;case"x-jsf-order":case"required":t[i]=s.filter(a=>r.includes(a));break;case"allOf":{let a=e[i]?.filter(f=>hm(f,r));t[i]=a;break}case"x-jsf-logic":t[i]=s;break}});let n={};t.allOf?.length&&t.allOf.forEach(i=>{let{if:s,then:a,else:f}=i,l=e.allOf?.indexOf(i);n={...n,...dr(s,{fields:r,path:`allOf[${l}].if`}),...dr(a,{fields:r,path:`allOf[${l}].then`}),...dr(f,{fields:r,path:`allOf[${l}].else`})}});let o=[];return Object.keys(n).length>0&&(Object.entries(n).forEach(([i])=>{(0,Ve.default)(t.properties,i,e.properties?.[i])}),o.push({type:"PICK_MISSED_FIELD",message:`The picked fields are in conditionals that refeer other fields. They added automatically: ${Object.keys(n).map(i=>`"${i}"`).join(", ")}. Check "meta" for more details.`,meta:n})),{schema:t,warnings:o}}function dr(e,{fields:r,path:t}){if(!e)return null;let n={};return e.required?.forEach(o=>{r.includes(o)||(n[o]={path:t})}),Object.entries(e.properties||[]).forEach(([o])=>{r.includes(o)||(n[o]={path:t})}),n}function ym(e,r){let t=JSON.parse(JSON.stringify(e)),n=Ys(t,r.fields),o=Zs(t,r.allFields),i=Qs(t,r.create),s=gm(t,r.pick),a=s.schema,f=mm(a,r.orderRoot);r.muteLogging||console.warn("json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteLogging: true` to the config.");let l=[n.warnings,o.warnings,i.warnings,s.warnings,f.warnings].flat().filter(Boolean);return{schema:a,warnings:l}}export{Ba as createHeadlessForm,ym as modify};
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|