@calenderjs/event-dsl 0.0.2 → 0.3.1

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/README.md CHANGED
@@ -3,12 +3,14 @@
3
3
  Event DSL - 领域特定语言,用于定义事件类型和业务规则。
4
4
 
5
5
  **架构说明**:
6
+
6
7
  - Event DSL 编译成 Data Model (Event 对象,包含规则和数据)
7
8
  - Event Data Model 是 SSOT,定义了 Event 接口结构(在 @calenderjs/event-model 中)
8
9
  - DSL 通过 EventDSLCompiler 编译成 Data Model (Event 对象,包含规则和数据)
9
10
 
10
11
  **包职责**:
11
12
  本包包含以下组件:
13
+
12
14
  1. **DSL 定义**(核心):
13
15
  - DSL 语法定义(`.pegjs` 文件)
14
16
  - DSL 解析器(将文本解析为 AST)
@@ -19,6 +21,7 @@ Event DSL - 领域特定语言,用于定义事件类型和业务规则。
19
21
  - **运行时引擎**(`EventRuntime`):使用编译后的 Data Model 进行验证、渲染和行为检查(**应用层使用**,在 `@calenderjs/event-runtime` 包中)
20
22
 
21
23
  **验证架构**:
24
+
22
25
  1. **编译时验证**(EventDSLCompiler,在 `@calenderjs/event-dsl` 包中):
23
26
  - 验证 DSL 语法是否正确
24
27
  - 如果编译失败,返回错误
@@ -38,11 +41,13 @@ Event DSL - 领域特定语言,用于定义事件类型和业务规则。
38
41
  - 无法通过 JSON Schema 验证(JSON Schema 只能验证结构,不能验证业务逻辑)
39
42
 
40
43
  **重要**:
44
+
41
45
  - 运行时**不在**数据模型包中(`@calenderjs/event-model`)
42
46
  - 运行时在 DSL 包中(`@calenderjs/event-dsl`)
43
47
  - 但运行时验证的是 Event 数据模型的数据
44
48
 
45
49
  **重要说明**:
50
+
46
51
  - **DSL 的主要用途**:编译成 Data Model (Event 对象,包含规则和数据)
47
52
  - **Calendar 组件**:直接使用 Event 对象(event.color, event.icon, event.title),**不需要运行时**
48
53
  - **运行时的用途**(应用层):
@@ -51,14 +56,15 @@ Event DSL - 领域特定语言,用于定义事件类型和业务规则。
51
56
  3. **动态渲染**(可选):根据 DSL 规则动态生成显示属性(但 Event 已有 color/icon)
52
57
 
53
58
  **数据流程**:
59
+
54
60
  ```
55
- DSL 文本
56
- → Peggy 解析器
57
- → AST
58
- → EventDSLCompiler
61
+ DSL 文本
62
+ → Peggy 解析器
63
+ → AST
64
+ → EventDSLCompiler
59
65
  → Data Model (Event 对象,包含规则和数据)
60
66
  → Calendar 组件(直接使用)
61
-
67
+
62
68
  验证流程:
63
69
  1. 编译时验证(EventDSLCompiler):验证 DSL 语法,编译成 Data Model
64
70
  2. JSON Schema 验证(EventValidator):使用 Data Model 中的标准 JSON Schema 验证 Event 结构
@@ -76,52 +82,52 @@ pnpm add @calenderjs/event-dsl
76
82
  ### 1. 定义事件类型
77
83
 
78
84
  ```typescript
79
- import { EventTypeDefinition } from '@calenderjs/event-dsl';
85
+ import { EventTypeDefinition } from "@calenderjs/event-dsl";
80
86
 
81
87
  const meetingType: EventTypeDefinition = {
82
- id: 'meeting',
83
- name: '会议',
88
+ id: "meeting",
89
+ name: "会议",
84
90
  fields: [
85
91
  {
86
- name: 'title',
87
- type: 'string',
92
+ name: "title",
93
+ type: "string",
88
94
  required: true,
89
95
  validation: [
90
- { type: 'minLength', value: 1, errorMessage: '标题不能为空' }
91
- ]
96
+ { type: "minLength", value: 1, errorMessage: "标题不能为空" },
97
+ ],
92
98
  },
93
99
  {
94
- name: 'attendees',
95
- type: 'array',
96
- items: { type: 'string' }
97
- }
100
+ name: "attendees",
101
+ type: "array",
102
+ items: { type: "string" },
103
+ },
98
104
  ],
99
105
  display: {
100
- color: '#4285f4',
101
- titleTemplate: '${title}',
102
- descriptionTemplate: '${attendees.length} 人'
106
+ color: "#4285f4",
107
+ titleTemplate: "${title}",
108
+ descriptionTemplate: "${attendees.length} 人",
103
109
  },
104
110
  behavior: {
105
111
  draggable: true,
106
112
  minDuration: 15,
107
113
  timeConstraints: [
108
114
  {
109
- type: 'workingHours',
110
- value: { start: '09:00', end: '18:00' },
111
- errorMessage: '会议只能在工作时间内安排'
112
- }
113
- ]
114
- }
115
+ type: "workingHours",
116
+ value: { start: "09:00", end: "18:00" },
117
+ errorMessage: "会议只能在工作时间内安排",
118
+ },
119
+ ],
120
+ },
115
121
  };
116
122
  ```
117
123
 
118
124
  ### 2. 编译 DSL
119
125
 
120
126
  ```typescript
121
- import { EventDSLCompiler } from '@calenderjs/event-dsl';
127
+ import { EventDSLCompiler } from "@calenderjs/event-dsl";
122
128
 
123
129
  const dsl: EventDSL = {
124
- types: [meetingType]
130
+ types: [meetingType],
125
131
  };
126
132
 
127
133
  const compiler = new EventDSLCompiler();
@@ -131,7 +137,7 @@ const compiled = compiler.compile(dsl);
131
137
  ### 3. 使用编译后的 Data Model
132
138
 
133
139
  ```typescript
134
- import type { Event } from '@calenderjs/event-model';
140
+ import type { Event } from "@calenderjs/event-model";
135
141
 
136
142
  // Data Model 是 Event 对象,包含规则和数据
137
143
  // compiled.types[0] 是 CompiledType (Data Model)
@@ -146,9 +152,9 @@ const dataModel = compiled.types[0];
146
152
  ### 4. 验证 Event 对象
147
153
 
148
154
  ```typescript
149
- import { EventValidator } from '@calenderjs/event-model';
150
- import { EventRuntime } from '@calenderjs/event-runtime';
151
- import { EventDSLCompiler } from '@calenderjs/event-dsl';
155
+ import { EventValidator } from "@calenderjs/event-model";
156
+ import { EventRuntime } from "@calenderjs/event-runtime";
157
+ import { EventDSLCompiler } from "@calenderjs/event-dsl";
152
158
 
153
159
  // 使用 Event Data Model 验证器验证基础结构
154
160
  const eventValidator = new EventValidator();
@@ -31,11 +31,11 @@ export interface FieldDefinition {
31
31
  /**
32
32
  * 字段类型
33
33
  */
34
- export type FieldType = 'string' | 'number' | 'boolean' | 'email' | 'text' | {
35
- type: 'list';
34
+ export type FieldType = "string" | "number" | "boolean" | "email" | "text" | {
35
+ type: "list";
36
36
  itemType: FieldType;
37
37
  } | {
38
- type: 'enum';
38
+ type: "enum";
39
39
  values: string[];
40
40
  };
41
41
  /**
@@ -46,7 +46,7 @@ export type ValidationRule = BetweenRule | ComparisonRule | ConflictRule | WhenR
46
46
  * Between 规则
47
47
  */
48
48
  export interface BetweenRule {
49
- type: 'Between';
49
+ type: "Between";
50
50
  field: FieldAccess;
51
51
  min: any;
52
52
  max: any;
@@ -55,7 +55,7 @@ export interface BetweenRule {
55
55
  * Comparison 规则
56
56
  */
57
57
  export interface ComparisonRule {
58
- type: 'Comparison';
58
+ type: "Comparison";
59
59
  operator: string;
60
60
  left: FieldAccess | Expression;
61
61
  right: any;
@@ -64,7 +64,7 @@ export interface ComparisonRule {
64
64
  * ModComparison 规则(用于 startTime.minute mod 15 is 0 等)
65
65
  */
66
66
  export interface ModComparisonRule {
67
- type: 'ModComparison';
67
+ type: "ModComparison";
68
68
  left: FieldAccess;
69
69
  modValue: any;
70
70
  operator: string;
@@ -74,7 +74,7 @@ export interface ModComparisonRule {
74
74
  * In 规则(用于 dayOfWeek in [1,2,3,4,5] 等)
75
75
  */
76
76
  export interface InRule {
77
- type: 'In';
77
+ type: "In";
78
78
  field: FieldAccess;
79
79
  values: any[];
80
80
  }
@@ -82,13 +82,13 @@ export interface InRule {
82
82
  * Conflict 规则
83
83
  */
84
84
  export interface ConflictRule {
85
- type: 'NoConflict' | 'Conflict';
85
+ type: "NoConflict" | "Conflict";
86
86
  }
87
87
  /**
88
88
  * When 规则
89
89
  */
90
90
  export interface WhenRule {
91
- type: 'When';
91
+ type: "When";
92
92
  condition: Expression;
93
93
  rules: ValidationRule[];
94
94
  }
@@ -96,8 +96,8 @@ export interface WhenRule {
96
96
  * 逻辑规则
97
97
  */
98
98
  export interface LogicalRule {
99
- type: 'BinaryExpression' | 'UnaryExpression';
100
- operator: 'and' | 'or' | 'not';
99
+ type: "BinaryExpression" | "UnaryExpression";
100
+ operator: "and" | "or" | "not";
101
101
  left?: Expression;
102
102
  right?: Expression;
103
103
  argument?: Expression;
@@ -106,7 +106,7 @@ export interface LogicalRule {
106
106
  * 字段访问
107
107
  */
108
108
  export interface FieldAccess {
109
- type: 'FieldAccess';
109
+ type: "FieldAccess";
110
110
  path: string[];
111
111
  }
112
112
  /**
@@ -117,14 +117,14 @@ export type Expression = FieldAccess | ComparisonRule | LogicalRule | InRule | M
117
117
  * 显示规则
118
118
  */
119
119
  export interface DisplayRule {
120
- name: 'color' | 'icon' | 'title' | 'description';
120
+ name: "color" | "icon" | "title" | "description";
121
121
  value: string | ConditionalValue | TemplateValue;
122
122
  }
123
123
  /**
124
124
  * 条件值
125
125
  */
126
126
  export interface ConditionalValue {
127
- type: 'Conditional';
127
+ type: "Conditional";
128
128
  condition: Expression;
129
129
  consequent: any;
130
130
  alternate?: any;
@@ -133,14 +133,14 @@ export interface ConditionalValue {
133
133
  * 模板值
134
134
  */
135
135
  export interface TemplateValue {
136
- type: 'Template';
136
+ type: "Template";
137
137
  parts: Array<string | FieldAccess>;
138
138
  }
139
139
  /**
140
140
  * 行为规则
141
141
  */
142
142
  export interface BehaviorRule {
143
- name: 'draggable' | 'resizable' | 'editable' | 'deletable';
143
+ name: "draggable" | "resizable" | "editable" | "deletable";
144
144
  value: boolean | Expression;
145
145
  }
146
146
  /**
@@ -154,7 +154,7 @@ export interface ConstraintRule {
154
154
  * 重复事件定义
155
155
  */
156
156
  export interface RecurringDefinition {
157
- frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
157
+ frequency: "daily" | "weekly" | "monthly" | "yearly";
158
158
  interval: number;
159
159
  endDate?: string;
160
160
  count?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ast/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,O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sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAQV,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAMjC;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAK9C;;;;;OAKG;IACH,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,iBAAiB;IAOvD;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IA2CnB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA2BxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAQ1B"}
@@ -16,7 +16,7 @@ export interface JSONSchemaGeneratorOptions {
16
16
  *
17
17
  * @param ast - Event DSL AST
18
18
  * @param options - 生成器选项
19
- * @returns JSON Schema(用于验证 Event.extra 字段)
19
+ * @returns JSON Schema(用于验证 Event.data 字段)
20
20
  */
21
21
  export declare function generateJSONSchema(ast: EventTypeAST, options?: JSONSchemaGeneratorOptions): JSONSchema;
22
22
  //# sourceMappingURL=json-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,cAAc,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,GAAG,EAAE,YAAY,EACjB,OAAO,GAAE,0BAA+B,GACzC,MAAM,CAkER"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/generators/typescript.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,cAAc,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,YAAY,EACjB,OAAO,GAAE,0BAA+B,GACvC,MAAM,CAkER"}
package/dist/index.cjs CHANGED
@@ -5,6 +5,6 @@
5
5
  `+C+" | "+Ee("",h.column-1," ")+Ee("",A,"^")}else p+=`
6
6
  at `+x}return p};U.buildMessage=function(f,p){var r={literal:function($){return'"'+h($.text)+'"'},class:function($){var m=$.parts.map(function(A){return Array.isArray(A)?d(A[0])+"-"+d(A[1]):d(A)});return"["+($.inverted?"^":"")+m.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function v($){return $.charCodeAt(0).toString(16).toUpperCase()}function h($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+v(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+v(m)})}function d($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+v(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+v(m)})}function x($){return r[$.type]($)}function b($){var m=$.map(x),A,O;if(m.sort(),m.length>0){for(A=1,O=1;A<m.length;A++)m[A-1]!==m[A]&&(m[O]=m[A],O++);m.length=O}switch(m.length){case 1:return m[0];case 2:return m[0]+" or "+m[1];default:return m.slice(0,-1).join(", ")+", or "+m[m.length-1]}}function C($){return $?'"'+h($)+'"':"end of input"}return"Expected "+b(f)+" but "+C(p)+" found."};function Xf(f,p){p=p!==void 0?p:{};var r={},v=p.grammarSource,h={EventTypeDefinition:gs},d=gs,x="type:",b="name:",C="description:",$="fields:",m="-",A=":",O="string",q="number",J="boolean",De="email",Se="text",Fe="list of ",Te="enum(",Ls=")",D=",",Re="required",je="default:",Oe="min:",qe="max:",Le="validate:",H="display:",K="behavior:",X="constraints:",G="recurring:",Q="when",Pe="in",Y="[",ee="]",Ve="between",V="and",ze="no",re="conflict",se="with",ie="other",ae="events",fe="or",Ne="not",z="is",N="equals",B="is not",Z="not equals",Be=">",k=">=",Ze="<",I="<=",te="mod",ke="color",Ie="icon",Me="title",We="description",Ue="else:",_e="draggable",Je="resizable",He="editable",Ke="deletable",ne="true",le="false",Xe="timeZone",Ge="allowedTimeZones",Qe="timePrecision",Ye="minAdvanceTime",er="maxAdvanceTime",rr="allowCrossDay",sr="maxCrossDayDuration",ir="minDuration",ar="maxDuration",fr="allowedHours",tr="allowedDays",nr="to",lr="frequency:",or="interval:",cr="endDate:",ur="count:",pr="daysOfWeek:",gr="dayOfMonth:",vr="excludeDates:",$r="timeZone:",hr="daily",mr="weekly",dr="monthly",br="yearly",yr=".",Ar="minutes",xr="minute",Cr="hours",wr="hour",Er="days",Dr="day",Sr="weeks",Fr="week",oe='"',Ps="{",Vs="}",zs="#",Tr=/^[0-9]/,Rr=/^[^"]/,jr=/^[^{}]/,Ns=/^[a-zA-Z_]/,Or=/^[a-zA-Z0-9_]/,Bs=/^[<>]/,Zs=/^[ \t\n\r]/,qr=/^[^\n]/,Lr=u("type:",!1),Pr=u("name:",!1),Vr=u("description:",!1),zr=u("fields:",!1),ks=u("-",!1),M=u(":",!1),Is=u("string",!1),Ms=u("number",!1),Ws=u("boolean",!1),Us=u("email",!1),_s=u("text",!1),Js=u("list of ",!1),Hs=u("enum(",!1),Ks=u(")",!1),S=u(",",!1),Xs=u("required",!1),Gs=u("default:",!1),Qs=u("min:",!1),Ys=u("max:",!1),ei=u("validate:",!1),Nr=u("display:",!1),Br=u("behavior:",!1),Zr=u("constraints:",!1),kr=u("recurring:",!1),Ir=u("when",!1),ri=u("in",!1),ce=u("[",!1),ue=u("]",!1),si=u("between",!1),he=u("and",!1),ii=u("no",!1),Mr=u("conflict",!1),Wr=u("with",!1),Ur=u("other",!1),_r=u("events",!1),Jr=u("or",!1),ai=u("not",!1),me=u("is",!1),de=u("equals",!1),be=u("is not",!1),ye=u("not equals",!1),Hr=u(">",!1),Ae=u(">=",!1),Kr=u("<",!1),xe=u("<=",!1),Xr=u("mod",!1),fi=u("color",!1),ti=u("icon",!1),ni=u("title",!1),li=u("description",!1),oi=u("else:",!1),ci=u("draggable",!1),ui=u("resizable",!1),pi=u("editable",!1),gi=u("deletable",!1),Gr=u("true",!1),Qr=u("false",!1),vi=u("timeZone",!1),$i=u("allowedTimeZones",!1),hi=u("timePrecision",!1),mi=u("minAdvanceTime",!1),di=u("maxAdvanceTime",!1),bi=u("allowCrossDay",!1),yi=u("maxCrossDayDuration",!1),Ai=u("minDuration",!1),xi=u("maxDuration",!1),Ci=u("allowedHours",!1),wi=u("allowedDays",!1),Ei=u("to",!1),Di=u("frequency:",!1),Si=u("interval:",!1),Fi=u("endDate:",!1),Ti=u("count:",!1),Ri=u("daysOfWeek:",!1),ji=u("dayOfMonth:",!1),Oi=u("excludeDates:",!1),qi=u("timeZone:",!1),Li=u("daily",!1),Pi=u("weekly",!1),Vi=u("monthly",!1),zi=u("yearly",!1),Yr=u(".",!1),Ni=u("minutes",!1),Bi=u("minute",!1),Zi=u("hours",!1),ki=u("hour",!1),Ii=u("days",!1),Mi=u("day",!1),Wi=u("weeks",!1),Ui=u("week",!1),es=L([["0","9"]],!1,!1),pe=u('"',!1),rs=L(['"'],!0,!1),_i=u("{",!1),Ji=u("}",!1),ss=L(["{","}"],!0,!1),Hi=L([["a","z"],["A","Z"],"_"],!1,!1),is=L([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Ki=L(["<",">"],!1,!1),Xi=L([" "," ",`
7
7
  `,"\r"],!1,!1),Gi=u("#",!1),as=L([`
8
- `],!0,!1),Qi=function(e){const i={};return e.forEach(a=>{i[a.name]=a.value}),i},Yi=function(e){return{name:"type",value:e}},ea=function(e){return{name:"name",value:e}},ra=function(e){return{name:"description",value:e}},sa=function(e){return{name:"fields",value:e}},ia=function(e,i,a){return{name:e,type:i,...Object.assign({},...a)}},aa=function(e){return{type:"list",itemType:e}},fa=function(e){return{type:"enum",values:e}},fs=function(e,i){return i},ta=function(e,i){return[e,...i]},na=function(){return{required:!0}},la=function(e){return{default:e}},oa=function(e){return{min:e}},ca=function(e){return{max:e}},ua=function(e){return{name:"validate",value:e}},pa=function(e){return e},ga=function(e,i){return{type:"When",condition:e,rules:i}},va=function(e,i){return{type:"In",field:e,values:i}},ts=function(e,i){return i},$a=function(e,i){return[e,...i]},ha=function(e,i,a){return{type:"Between",field:e,min:i,max:a}},ma=function(e,i,a){return{type:"Comparison",operator:i,left:e,right:a}},da=function(){return{type:"NoConflict"}},ba=function(){return{type:"Conflict"}},ns=function(e,i,a){return[i,a]},ya=function(e,i){return Hf(e,i)},Aa=function(e){return{type:"UnaryExpression",operator:"not",argument:e}},xa=function(e,i,a){return{type:"Comparison",operator:i,left:e,right:a}},Ca=function(e,i,a,t){return{type:"ModComparison",left:e,modValue:i,operator:a,right:t}},wa=function(e){return{name:"display",value:e}},Ea=function(e,i){return{name:e,value:i}},Da=function(e,i,a){return a},Sa=function(e,i,a){return{type:"Conditional",condition:e,consequent:i,alternate:a}},Fa=function(e){return{name:"behavior",value:e}},Ta=function(e,i){return{name:e,value:i}},Ra=function(){return!0},ja=function(){return!1},Oa=function(e){return{name:"constraints",value:e}},qa=function(e,i){return{name:e,value:i}},La=function(){return"timeZone"},Pa=function(){return"allowedTimeZones"},Va=function(){return"timePrecision"},za=function(){return"minAdvanceTime"},Na=function(){return"maxAdvanceTime"},Ba=function(){return"allowCrossDay"},Za=function(){return"maxCrossDayDuration"},ka=function(){return"minDuration"},Ia=function(){return"maxDuration"},Ma=function(){return"allowedHours"},Wa=function(){return"allowedDays"},Ua=function(e,i){return{type:"Range",min:e,max:i}},_a=function(e){return{name:"recurring",value:Object.assign({},...e)}},Ja=function(e){return{frequency:e}},Ha=function(e){return{interval:e}},Ka=function(e){return{endDate:e}},Xa=function(e){return{count:e}},Ga=function(e){return{daysOfWeek:e}},Qa=function(e){return{dayOfMonth:e}},Ya=function(e){return{excludeDates:e}},ef=function(e){return{timeZone:e}},rf=function(){return"daily"},sf=function(){return"weekly"},af=function(){return"monthly"},ff=function(){return"yearly"},ls=function(e,i){return i},tf=function(e,i){return[e,...i]},os=function(e,i){return i},nf=function(e,i){return[e,...i]},cs=function(e,i){return i},lf=function(e,i){return{type:"FieldAccess",path:[e,...i]}},of=function(e){return e},cf=function(e,i){return{type:"Duration",value:e,unit:i==="minute"?"minutes":i==="hour"?"hours":i==="day"?"days":i==="week"?"weeks":i}},uf=function(e){return parseInt(e.join(""),10)},pf=function(e){return e.join("")},gf=function(e){return{type:"Template",parts:e}},vf=function(e){return e},$f=function(e){return e.join("")},hf=function(){return!0},mf=function(){return!1},df=function(e,i){return e+i.join("")},s=p.peg$currPos|0,W=[{line:1,column:1}],F=s,ge=p.peg$maxFailExpected||[],n=p.peg$silentFails|0,_;if(p.startRule){if(!(p.startRule in h))throw new Error(`Can't start parsing from rule "`+p.startRule+'".');d=h[p.startRule]}function u(e,i){return{type:"literal",text:e,ignoreCase:i}}function L(e,i,a){return{type:"class",parts:e,inverted:i,ignoreCase:a}}function bf(){return{type:"end"}}function us(e){var i=W[e],a;if(i)return i;if(e>=W.length)a=W.length-1;else for(a=e;!W[--a];);for(i=W[a],i={line:i.line,column:i.column};a<e;)f.charCodeAt(a)===10?(i.line++,i.column=1):i.column++,a++;return W[e]=i,i}function ps(e,i,a){var t=us(e),o=us(i),g={source:v,start:{offset:e,line:t.line,column:t.column},end:{offset:i,line:o.line,column:o.column}};return g}function l(e){s<F||(s>F&&(F=s,ge=[]),ge.push(e))}function yf(e,i,a){return new U(U.buildMessage(e,i),e,i,a)}function gs(){var e,i,a;for(e=s,c(),i=[],a=vs();a!==r;)i.push(a),a=vs();return a=c(),e=Qi(i),e}function vs(){var e;return e=Af(),e===r&&(e=xf(),e===r&&(e=Cf(),e===r&&(e=wf(),e===r&&(e=Df(),e===r&&(e=Lf(),e===r&&(e=Vf(),e===r&&(e=Nf(),e===r&&(e=If())))))))),e}function Af(){var e,i,a;return e=s,f.substr(s,5)===x?(i=x,s+=5):(i=r,n===0&&l(Lr)),i!==r?(c(),a=T(),a!==r?(c(),e=Yi(a)):(s=e,e=r)):(s=e,e=r),e}function xf(){var e,i,a;return e=s,f.substr(s,5)===b?(i=b,s+=5):(i=r,n===0&&l(Pr)),i!==r?(c(),a=j(),a!==r?(c(),e=ea(a)):(s=e,e=r)):(s=e,e=r),e}function Cf(){var e,i,a;return e=s,f.substr(s,12)===C?(i=C,s+=12):(i=r,n===0&&l(Vr)),i!==r?(c(),a=j(),a!==r?(c(),e=ra(a)):(s=e,e=r)):(s=e,e=r),e}function wf(){var e,i,a,t;if(e=s,f.substr(s,7)===$?(i=$,s+=7):(i=r,n===0&&l(zr)),i!==r){if(c(),a=[],t=$s(),t!==r)for(;t!==r;)a.push(t),t=$s();else a=r;a!==r?e=sa(a):(s=e,e=r)}else s=e,e=r;return e}function $s(){var e,i,a,t,o,g,y;if(e=s,c(),f.charCodeAt(s)===45?(i=m,s++):(i=r,n===0&&l(ks)),i!==r)if(c(),a=T(),a!==r)if(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r)if(c(),o=hs(),o!==r){for(g=[],y=ms();y!==r;)g.push(y),y=ms();y=c(),e=ia(a,o,g)}else s=e,e=r;else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function hs(){var e,i,a,t;return f.substr(s,6)===O?(e=O,s+=6):(e=r,n===0&&l(Is)),e===r&&(f.substr(s,6)===q?(e=q,s+=6):(e=r,n===0&&l(Ms)),e===r&&(f.substr(s,7)===J?(e=J,s+=7):(e=r,n===0&&l(Ws)),e===r&&(f.substr(s,5)===De?(e=De,s+=5):(e=r,n===0&&l(Us)),e===r&&(f.substr(s,4)===Se?(e=Se,s+=4):(e=r,n===0&&l(_s)),e===r&&(e=s,f.substr(s,8)===Fe?(i=Fe,s+=8):(i=r,n===0&&l(Js)),i!==r?(a=hs(),a!==r?e=aa(a):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.substr(s,5)===Te?(i=Te,s+=5):(i=r,n===0&&l(Hs)),i!==r?(a=Ef(),a!==r?(f.charCodeAt(s)===41?(t=Ls,s++):(t=r,n===0&&l(Ks)),t!==r?e=fa(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r))))))),e}function Ef(){var e,i,a,t,o,g;if(e=s,i=T(),i!==r){for(a=[],t=s,f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=T(),g!==r?t=fs(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=T(),g!==r?t=fs(i,g):(s=t,t=r)):(s=t,t=r);e=ta(i,a)}else s=e,e=r;return e}function ms(){var e,i,a,t;return e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,8)===Re?(a=Re,s+=8):(a=r,n===0&&l(Xs)),a!==r?e=na():(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,8)===je?(a=je,s+=8):(a=r,n===0&&l(Gs)),a!==r?(c(),t=R(),t!==r?e=la(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,4)===Oe?(a=Oe,s+=4):(a=r,n===0&&l(Qs)),a!==r?(c(),t=E(),t!==r?e=oa(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,4)===qe?(a=qe,s+=4):(a=r,n===0&&l(Ys)),a!==r?(c(),t=E(),t!==r?e=ca(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)))),e}function Df(){var e,i,a,t;if(e=s,f.substr(s,9)===Le?(i=Le,s+=9):(i=r,n===0&&l(ei)),i!==r){for(c(),a=[],t=ve();t!==r;)a.push(t),t=ve();e=ua(a)}else s=e,e=r;return e}function ve(){var e,i,a;return e=s,c(),i=s,n++,f.substr(s,8)===H?(a=H,s+=8):(a=r,n===0&&l(Nr)),a===r&&(f.substr(s,9)===K?(a=K,s+=9):(a=r,n===0&&l(Br)),a===r&&(f.substr(s,12)===X?(a=X,s+=12):(a=r,n===0&&l(Zr)),a===r&&(f.substr(s,10)===G?(a=G,s+=10):(a=r,n===0&&l(kr)),a===r&&(f.substr(s,5)===x?(a=x,s+=5):(a=r,n===0&&l(Lr)),a===r&&(f.substr(s,5)===b?(a=b,s+=5):(a=r,n===0&&l(Pr)),a===r&&(f.substr(s,12)===C?(a=C,s+=12):(a=r,n===0&&l(Vr)),a===r&&(f.substr(s,7)===$?(a=$,s+=7):(a=r,n===0&&l(zr))))))))),n--,a===r?i=void 0:(s=i,i=r),i!==r?(a=Sf(),a===r&&(a=Ff()),a!==r?e=pa(a):(s=e,e=r)):(s=e,e=r),e}function Sf(){var e,i,a,t,o,g;if(e=s,f.substr(s,4)===Q?(i=Q,s+=4):(i=r,n===0&&l(Ir)),i!==r)if(c(),a=$e(),a!==r)if(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r){if(c(),o=[],g=ve(),g!==r)for(;g!==r;)o.push(g),g=ve();else o=r;o!==r?e=ga(a,o):(s=e,e=r)}else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function Ff(){var e;return e=Tf(),e===r&&(e=Rf(),e===r&&(e=jf(),e===r&&(e=Of(),e===r&&(e=$e())))),e}function Tf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,2)===Pe?(a=Pe,s+=2):(a=r,n===0&&l(ri)),a!==r?(c(),f.charCodeAt(s)===91?(t=Y,s++):(t=r,n===0&&l(ce)),t!==r?(c(),o=ds(),o!==r?(c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?(c(),e=va(i,o)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function ds(){var e,i,a,t,o,g;if(e=s,i=R(),i!==r){for(a=[],t=s,c(),f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=R(),g!==r?t=ts(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,c(),f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=R(),g!==r?t=ts(i,g):(s=t,t=r)):(s=t,t=r);e=$a(i,a)}else s=e,e=r;return e}function Rf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,7)===Ve?(a=Ve,s+=7):(a=r,n===0&&l(si)),a!==r?(c(),t=R(),t!==r?(c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o!==r?(c(),g=R(),g!==r?(c(),e=ha(i,t,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function jf(){var e,i,a,t;return e=s,i=P(),i!==r?(c(),a=Jf(),a!==r?(c(),t=R(),t!==r?(c(),e=ma(i,a,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Of(){var e,i,a,t,o,g;return e=s,f.substr(s,2)===ze?(i=ze,s+=2):(i=r,n===0&&l(ii)),i!==r?(c(),f.substr(s,8)===re?(a=re,s+=8):(a=r,n===0&&l(Mr)),a!==r?(c(),f.substr(s,4)===se?(t=se,s+=4):(t=r,n===0&&l(Wr)),t!==r?(c(),f.substr(s,5)===ie?(o=ie,s+=5):(o=r,n===0&&l(Ur)),o!==r?(c(),f.substr(s,6)===ae?(g=ae,s+=6):(g=r,n===0&&l(_r)),g!==r?(c(),e=da()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.substr(s,8)===re?(i=re,s+=8):(i=r,n===0&&l(Mr)),i!==r?(c(),f.substr(s,4)===se?(a=se,s+=4):(a=r,n===0&&l(Wr)),a!==r?(c(),f.substr(s,5)===ie?(t=ie,s+=5):(t=r,n===0&&l(Ur)),t!==r?(c(),f.substr(s,6)===ae?(o=ae,s+=6):(o=r,n===0&&l(_r)),o!==r?(c(),e=ba()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)),e}function $e(){var e,i,a,t,o,g;if(e=s,i=Ce(),i!==r){for(a=[],t=s,c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o===r&&(f.substr(s,2)===fe?(o=fe,s+=2):(o=r,n===0&&l(Jr))),o!==r?(c(),g=Ce(),g!==r?t=ns(i,o,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o===r&&(f.substr(s,2)===fe?(o=fe,s+=2):(o=r,n===0&&l(Jr))),o!==r?(c(),g=Ce(),g!==r?t=ns(i,o,g):(s=t,t=r)):(s=t,t=r);e=ya(i,a)}else s=e,e=r;return e}function Ce(){var e,i,a;return e=s,f.substr(s,3)===Ne?(i=Ne,s+=3):(i=r,n===0&&l(ai)),i!==r?(c(),a=bs(),a!==r?e=Aa(a):(s=e,e=r)):(s=e,e=r),e===r&&(e=bs()),e}function bs(){var e,i,a,t,o;return e=qf(),e===r&&(e=s,i=P(),i!==r?(a=c(),f.substr(s,2)===z?(t=z,s+=2):(t=r,n===0&&l(me)),t===r&&(f.substr(s,6)===N?(t=N,s+=6):(t=r,n===0&&l(de)),t===r&&(f.substr(s,6)===B?(t=B,s+=6):(t=r,n===0&&l(be)),t===r&&(f.substr(s,10)===Z?(t=Z,s+=10):(t=r,n===0&&l(ye)),t===r&&(f.charCodeAt(s)===62?(t=Be,s++):(t=r,n===0&&l(Hr)),t===r&&(f.substr(s,2)===k?(t=k,s+=2):(t=r,n===0&&l(Ae)),t===r&&(f.charCodeAt(s)===60?(t=Ze,s++):(t=r,n===0&&l(Kr)),t===r&&(f.substr(s,2)===I?(t=I,s+=2):(t=r,n===0&&l(xe))))))))),t!==r?(c(),o=R(),o!==r?(c(),e=xa(i,t,o)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,i=P(),i!==r?(a=c(),i=[i,a],e=i):(s=e,e=r))),e}function qf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,3)===te?(a=te,s+=3):(a=r,n===0&&l(Xr)),a!==r?(c(),t=R(),t!==r?(c(),f.substr(s,2)===z?(o=z,s+=2):(o=r,n===0&&l(me)),o===r&&(f.substr(s,6)===N?(o=N,s+=6):(o=r,n===0&&l(de)),o===r&&(f.substr(s,6)===B?(o=B,s+=6):(o=r,n===0&&l(be)),o===r&&(f.substr(s,10)===Z?(o=Z,s+=10):(o=r,n===0&&l(ye)),o===r&&(f.charCodeAt(s)===62?(o=Be,s++):(o=r,n===0&&l(Hr)),o===r&&(f.substr(s,2)===k?(o=k,s+=2):(o=r,n===0&&l(Ae)),o===r&&(f.charCodeAt(s)===60?(o=Ze,s++):(o=r,n===0&&l(Kr)),o===r&&(f.substr(s,2)===I?(o=I,s+=2):(o=r,n===0&&l(xe))))))))),o!==r?(c(),g=R(),g!==r?(c(),e=Ca(i,t,o,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Lf(){var e,i,a,t;if(e=s,f.substr(s,8)===H?(i=H,s+=8):(i=r,n===0&&l(Nr)),i!==r){if(c(),a=[],t=ys(),t!==r)for(;t!==r;)a.push(t),t=ys();else a=r;a!==r?e=wa(a):(s=e,e=r)}else s=e,e=r;return e}function ys(){var e,i,a,t;return e=s,c(),f.substr(s,5)===ke?(i=ke,s+=5):(i=r,n===0&&l(fi)),i===r&&(f.substr(s,4)===Ie?(i=Ie,s+=4):(i=r,n===0&&l(ti)),i===r&&(f.substr(s,5)===Me?(i=Me,s+=5):(i=r,n===0&&l(ni)),i===r&&(f.substr(s,11)===We?(i=We,s+=11):(i=r,n===0&&l(li))))),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=we(),t!==r?(c(),e=Ea(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function we(){var e;return e=Pf(),e===r&&(e=_f(),e===r&&(e=j())),e}function Pf(){var e,i,a,t,o,g,y,w;return e=s,f.substr(s,4)===Q?(i=Q,s+=4):(i=r,n===0&&l(Ir)),i!==r?(c(),a=$e(),a!==r?(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r?(c(),o=we(),o!==r?(g=s,c(),f.substr(s,5)===Ue?(y=Ue,s+=5):(y=r,n===0&&l(oi)),y!==r?(c(),w=we(),w!==r?g=Da(a,o,w):(s=g,g=r)):(s=g,g=r),g===r&&(g=null),e=Sa(a,o,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Vf(){var e,i,a,t;if(e=s,f.substr(s,9)===K?(i=K,s+=9):(i=r,n===0&&l(Br)),i!==r){if(c(),a=[],t=As(),t!==r)for(;t!==r;)a.push(t),t=As();else a=r;a!==r?e=Fa(a):(s=e,e=r)}else s=e,e=r;return e}function As(){var e,i,a,t;return e=s,c(),f.substr(s,9)===_e?(i=_e,s+=9):(i=r,n===0&&l(ci)),i===r&&(f.substr(s,9)===Je?(i=Je,s+=9):(i=r,n===0&&l(ui)),i===r&&(f.substr(s,8)===He?(i=He,s+=8):(i=r,n===0&&l(pi)),i===r&&(f.substr(s,9)===Ke?(i=Ke,s+=9):(i=r,n===0&&l(gi))))),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=zf(),t!==r?(c(),e=Ta(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function zf(){var e,i;return e=s,f.substr(s,4)===ne?(i=ne,s+=4):(i=r,n===0&&l(Gr)),i!==r&&(i=Ra()),e=i,e===r&&(e=s,f.substr(s,5)===le?(i=le,s+=5):(i=r,n===0&&l(Qr)),i!==r&&(i=ja()),e=i,e===r&&(e=$e())),e}function Nf(){var e,i,a,t;if(e=s,f.substr(s,12)===X?(i=X,s+=12):(i=r,n===0&&l(Zr)),i!==r){if(c(),a=[],t=xs(),t!==r)for(;t!==r;)a.push(t),t=xs();else a=r;a!==r?e=Oa(a):(s=e,e=r)}else s=e,e=r;return e}function xs(){var e,i,a,t;return e=s,c(),i=Bf(),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=Zf(),t!==r?(c(),e=qa(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Bf(){var e,i;return e=s,f.substr(s,8)===Xe?(i=Xe,s+=8):(i=r,n===0&&l(vi)),i!==r&&(i=La()),e=i,e===r&&(e=s,f.substr(s,16)===Ge?(i=Ge,s+=16):(i=r,n===0&&l($i)),i!==r&&(i=Pa()),e=i,e===r&&(e=s,f.substr(s,13)===Qe?(i=Qe,s+=13):(i=r,n===0&&l(hi)),i!==r&&(i=Va()),e=i,e===r&&(e=s,f.substr(s,14)===Ye?(i=Ye,s+=14):(i=r,n===0&&l(mi)),i!==r&&(i=za()),e=i,e===r&&(e=s,f.substr(s,14)===er?(i=er,s+=14):(i=r,n===0&&l(di)),i!==r&&(i=Na()),e=i,e===r&&(e=s,f.substr(s,13)===rr?(i=rr,s+=13):(i=r,n===0&&l(bi)),i!==r&&(i=Ba()),e=i,e===r&&(e=s,f.substr(s,19)===sr?(i=sr,s+=19):(i=r,n===0&&l(yi)),i!==r&&(i=Za()),e=i,e===r&&(e=s,f.substr(s,11)===ir?(i=ir,s+=11):(i=r,n===0&&l(Ai)),i!==r&&(i=ka()),e=i,e===r&&(e=s,f.substr(s,11)===ar?(i=ar,s+=11):(i=r,n===0&&l(xi)),i!==r&&(i=Ia()),e=i,e===r&&(e=s,f.substr(s,12)===fr?(i=fr,s+=12):(i=r,n===0&&l(Ci)),i!==r&&(i=Ma()),e=i,e===r&&(e=s,f.substr(s,11)===tr?(i=tr,s+=11):(i=r,n===0&&l(wi)),i!==r&&(i=Wa()),e=i,e===r&&(e=T()))))))))))),e}function Zf(){var e;return e=ws(),e===r&&(e=kf(),e===r&&(e=Es(),e===r&&(e=j(),e===r&&(e=E(),e===r&&(e=Ss(),e===r&&(e=T())))))),e}function kf(){var e,i,a,t;return e=s,i=E(),i!==r?(c(),f.substr(s,2)===nr?(a=nr,s+=2):(a=r,n===0&&l(Ei)),a!==r?(c(),t=E(),t!==r?e=Ua(i,t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function If(){var e,i,a,t;if(e=s,f.substr(s,10)===G?(i=G,s+=10):(i=r,n===0&&l(kr)),i!==r){if(c(),a=[],t=Cs(),t!==r)for(;t!==r;)a.push(t),t=Cs();else a=r;a!==r?e=_a(a):(s=e,e=r)}else s=e,e=r;return e}function Cs(){var e,i,a;return e=s,c(),f.substr(s,10)===lr?(i=lr,s+=10):(i=r,n===0&&l(Di)),i!==r?(c(),a=Mf(),a!==r?(c(),e=Ja(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,9)===or?(i=or,s+=9):(i=r,n===0&&l(Si)),i!==r?(c(),a=E(),a!==r?(c(),e=Ha(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,8)===cr?(i=cr,s+=8):(i=r,n===0&&l(Fi)),i!==r?(c(),a=j(),a!==r?(c(),e=Ka(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,6)===ur?(i=ur,s+=6):(i=r,n===0&&l(Ti)),i!==r?(c(),a=E(),a!==r?(c(),e=Xa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,11)===pr?(i=pr,s+=11):(i=r,n===0&&l(Ri)),i!==r?(c(),a=Wf(),a!==r?(c(),e=Ga(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,11)===gr?(i=gr,s+=11):(i=r,n===0&&l(ji)),i!==r?(c(),a=E(),a!==r?(c(),e=Qa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,13)===vr?(i=vr,s+=13):(i=r,n===0&&l(Oi)),i!==r?(c(),a=Uf(),a!==r?(c(),e=Ya(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,9)===$r?(i=$r,s+=9):(i=r,n===0&&l(qi)),i!==r?(c(),a=j(),a!==r?(c(),e=ef(a)):(s=e,e=r)):(s=e,e=r)))))))),e}function Mf(){var e,i;return e=s,f.substr(s,5)===hr?(i=hr,s+=5):(i=r,n===0&&l(Li)),i!==r&&(i=rf()),e=i,e===r&&(e=s,f.substr(s,6)===mr?(i=mr,s+=6):(i=r,n===0&&l(Pi)),i!==r&&(i=sf()),e=i,e===r&&(e=s,f.substr(s,7)===dr?(i=dr,s+=7):(i=r,n===0&&l(Vi)),i!==r&&(i=af()),e=i,e===r&&(e=s,f.substr(s,6)===br?(i=br,s+=6):(i=r,n===0&&l(zi)),i!==r&&(i=ff()),e=i))),e}function Wf(){var e,i,a,t,o,g,y,w;if(e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r)if(c(),a=E(),a!==r){for(t=[],o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=E(),w!==r?o=ls(a,w):(s=o,o=r)):(s=o,o=r);o!==r;)t.push(o),o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=E(),w!==r?o=ls(a,w):(s=o,o=r)):(s=o,o=r);o=c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?e=tf(a,t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function Uf(){var e,i,a,t,o,g,y,w;if(e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r)if(c(),a=j(),a!==r){for(t=[],o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=j(),w!==r?o=os(a,w):(s=o,o=r)):(s=o,o=r);o!==r;)t.push(o),o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=j(),w!==r?o=os(a,w):(s=o,o=r)):(s=o,o=r);o=c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?e=nf(a,t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function P(){var e,i,a,t,o,g;if(e=s,i=T(),i!==r){for(a=[],t=s,f.charCodeAt(s)===46?(o=yr,s++):(o=r,n===0&&l(Yr)),o!==r?(g=T(),g!==r?t=cs(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,f.charCodeAt(s)===46?(o=yr,s++):(o=r,n===0&&l(Yr)),o!==r?(g=T(),g!==r?t=cs(i,g):(s=t,t=r)):(s=t,t=r);e=lf(i,a)}else s=e,e=r;return e}function R(){var e;return e=ws(),e===r&&(e=Es(),e===r&&(e=E(),e===r&&(e=j(),e===r&&(e=Ss(),e===r&&(e=T()))))),e}function ws(){var e,i,a,t;return e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r?(c(),a=ds(),a!==r?(c(),f.charCodeAt(s)===93?(t=ee,s++):(t=r,n===0&&l(ue)),t!==r?e=of(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Es(){var e,i,a;return e=s,i=E(),i!==r?(c(),f.substr(s,7)===Ar?(a=Ar,s+=7):(a=r,n===0&&l(Ni)),a===r&&(f.substr(s,6)===xr?(a=xr,s+=6):(a=r,n===0&&l(Bi)),a===r&&(f.substr(s,5)===Cr?(a=Cr,s+=5):(a=r,n===0&&l(Zi)),a===r&&(f.substr(s,4)===wr?(a=wr,s+=4):(a=r,n===0&&l(ki)),a===r&&(f.substr(s,4)===Er?(a=Er,s+=4):(a=r,n===0&&l(Ii)),a===r&&(f.substr(s,3)===Dr?(a=Dr,s+=3):(a=r,n===0&&l(Mi)),a===r&&(f.substr(s,5)===Sr?(a=Sr,s+=5):(a=r,n===0&&l(Wi)),a===r&&(f.substr(s,4)===Fr?(a=Fr,s+=4):(a=r,n===0&&l(Ui))))))))),a!==r?e=cf(i,a):(s=e,e=r)):(s=e,e=r),e}function E(){var e,i,a;if(e=s,i=[],a=f.charAt(s),Tr.test(a)?s++:(a=r,n===0&&l(es)),a!==r)for(;a!==r;)i.push(a),a=f.charAt(s),Tr.test(a)?s++:(a=r,n===0&&l(es));else i=r;return i!==r&&(i=uf(i)),e=i,e}function j(){var e,i,a,t;if(e=s,f.charCodeAt(s)===34?(i=oe,s++):(i=r,n===0&&l(pe)),i!==r){for(a=[],t=f.charAt(s),Rr.test(t)?s++:(t=r,n===0&&l(rs));t!==r;)a.push(t),t=f.charAt(s),Rr.test(t)?s++:(t=r,n===0&&l(rs));f.charCodeAt(s)===34?(t=oe,s++):(t=r,n===0&&l(pe)),t!==r?e=pf(a):(s=e,e=r)}else s=e,e=r;return e}function _f(){var e,i,a,t;if(e=s,f.charCodeAt(s)===34?(i=oe,s++):(i=r,n===0&&l(pe)),i!==r){if(a=[],t=Ds(),t!==r)for(;t!==r;)a.push(t),t=Ds();else a=r;a!==r?(f.charCodeAt(s)===34?(t=oe,s++):(t=r,n===0&&l(pe)),t!==r?e=gf(a):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;return e}function Ds(){var e,i,a,t;if(e=s,f.charCodeAt(s)===123?(i=Ps,s++):(i=r,n===0&&l(_i)),i!==r?(a=P(),a!==r?(f.charCodeAt(s)===125?(t=Vs,s++):(t=r,n===0&&l(Ji)),t!==r?e=vf(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r){if(e=s,i=[],a=f.charAt(s),jr.test(a)?s++:(a=r,n===0&&l(ss)),a!==r)for(;a!==r;)i.push(a),a=f.charAt(s),jr.test(a)?s++:(a=r,n===0&&l(ss));else i=r;i!==r&&(i=$f(i)),e=i}return e}function Ss(){var e,i;return e=s,f.substr(s,4)===ne?(i=ne,s+=4):(i=r,n===0&&l(Gr)),i!==r&&(i=hf()),e=i,e===r&&(e=s,f.substr(s,5)===le?(i=le,s+=5):(i=r,n===0&&l(Qr)),i!==r&&(i=mf()),e=i),e}function T(){var e,i,a,t;if(e=s,i=f.charAt(s),Ns.test(i)?s++:(i=r,n===0&&l(Hi)),i!==r){for(a=[],t=f.charAt(s),Or.test(t)?s++:(t=r,n===0&&l(is));t!==r;)a.push(t),t=f.charAt(s),Or.test(t)?s++:(t=r,n===0&&l(is));e=df(i,a)}else s=e,e=r;return e}function Jf(){var e;return f.substr(s,2)===k?(e=k,s+=2):(e=r,n===0&&l(Ae)),e===r&&(f.substr(s,2)===I?(e=I,s+=2):(e=r,n===0&&l(xe)),e===r&&(e=f.charAt(s),Bs.test(e)?s++:(e=r,n===0&&l(Ki)),e===r&&(f.substr(s,2)===z?(e=z,s+=2):(e=r,n===0&&l(me)),e===r&&(f.substr(s,6)===N?(e=N,s+=6):(e=r,n===0&&l(de)),e===r&&(f.substr(s,6)===B?(e=B,s+=6):(e=r,n===0&&l(be)),e===r&&(f.substr(s,10)===Z?(e=Z,s+=10):(e=r,n===0&&l(ye)),e===r&&(f.substr(s,3)===te?(e=te,s+=3):(e=r,n===0&&l(Xr))))))))),e}function c(){var e,i;for(e=[],i=Fs(),i===r&&(i=Ts());i!==r;)e.push(i),i=Fs(),i===r&&(i=Ts());return e}function Fs(){var e;return e=f.charAt(s),Zs.test(e)?s++:(e=r,n===0&&l(Xi)),e}function Ts(){var e,i,a,t;if(e=s,f.charCodeAt(s)===35?(i=zs,s++):(i=r,n===0&&l(Gi)),i!==r){for(a=[],t=f.charAt(s),qr.test(t)?s++:(t=r,n===0&&l(as));t!==r;)a.push(t),t=f.charAt(s),qr.test(t)?s++:(t=r,n===0&&l(as));i=[i,a],e=i}else s=e,e=r;return e}function Hf(e,i){return i.reduce((a,[t,o])=>({type:"BinaryExpression",operator:t,left:a,right:o}),e)}if(_=d(),p.peg$library)return{peg$result:_,peg$currPos:s,peg$FAILED:r,peg$maxFailExpected:ge,peg$maxFailPos:F};if(_!==r&&s===f.length)return _;throw _!==r&&s<f.length&&l(bf()),yf(ge,F<f.length?f.charAt(F):null,F<f.length?ps(F,F+1):ps(F,F))}function Rs(f){try{const p=Xf(f);return Gf(p)}catch(p){throw new Error(`Failed to parse Event DSL: ${p.message}`)}}function Gf(f){const p=(f.validate||[]).map(v=>Array.isArray(v)&&v.length===2&&Array.isArray(v[0])?v[1]:v),r=(f.behavior||[]).map(v=>{if(v&&typeof v=="object"&&"value"in v){const h=v.value;if(Array.isArray(h)&&h.length===2){const d=h[0],x=h[1];if(d?.type==="FieldAccess"&&Array.isArray(d.path)&&d.path.length===1){const b=d.path[0];if(b==="true"&&(!x||x.length===0))return{...v,value:!0};if(b==="false"&&(!x||x.length===0))return{...v,value:!1}}}}return v});return{type:f.type||"",name:f.name||"",description:f.description,fields:f.fields||[],validate:p,display:f.display||[],behavior:r,constraints:f.constraints||[],recurring:f.recurring}}function js(f,p={}){const{includeSchema:r=!0,includeTitle:v=!0,includeDescription:h=!0}=p,d={type:"object"};r&&(d.$schema="http://json-schema.org/draft-07/schema#"),v&&f.name&&(d.title=f.name),h&&f.description&&(d.description=f.description);const x={},b=[];return f.fields.forEach(C=>{const $=Qf(C);x[C.name]=$,C.required&&b.push(C.name)}),d.properties=x,b.length>0&&(d.required=b),d.additionalProperties=!1,d}function Qf(f){const p={},r=Os(f.type);return Object.assign(p,r),f.default!==void 0&&(p.default=f.default),f.min!==void 0&&(p.type==="array"?p.minItems=f.min:p.type==="number"?p.minimum=f.min:p.type==="string"&&(p.minLength=f.min)),f.max!==void 0&&(p.type==="array"?p.maxItems=f.max:p.type==="number"?p.maximum=f.max:p.type==="string"&&(p.maxLength=f.max)),p}function Os(f){return f==="string"?{type:"string"}:f==="number"?{type:"number"}:f==="boolean"?{type:"boolean"}:f==="email"?{type:"string",format:"email"}:f==="text"?{type:"string"}:typeof f=="object"&&f.type==="list"?{type:"array",items:Os(f.itemType)}:typeof f=="object"&&f.type==="enum"?{type:"string",enum:f.values}:{type:"string"}}class Yf{compileDSL(p){const r=Rs(p);return this.compileFromAST([r])}compileFromAST(p){return{types:p.map(r=>this.compileType(r)),validators:[]}}compileType(p){const r=js(p),v=p.validate||[],h=p.display||[],d=p.behavior||[],x=p.constraints||[],b=p.recurring,C=this.generateValidator(p),$=this.generateRenderer(p),m=this.generateBehavior(p);return{id:p.type,name:p.name,extraSchema:r,validationRules:v,displayRules:h,behaviorRules:d,constraints:x,recurring:b,validator:C,renderer:$,behavior:m}}generateValidator(p){return r=>{const v=[];return p.fields.forEach(h=>{const d=r.extra?.[h.name];h.required&&(d==null||d==="")&&v.push(`${h.name} 是必填字段`)}),{valid:v.length===0,errors:v.length>0?v:void 0}}}generateRenderer(p){return r=>{const v={title:r.title||p.name,color:r.color||"#4285f4",description:""};return(p.display||[]).forEach(h=>{h.name==="color"&&typeof h.value=="string"&&(v.color=h.value),h.name==="icon"&&typeof h.value=="string"&&(v.icon=h.value)}),v}}generateBehavior(p){const r={draggable:!0,resizable:!1,editable:!0,deletable:!0};return(p.behavior||[]).forEach(v=>{v.name==="draggable"&&typeof v.value=="boolean"&&(r.draggable=v.value),v.name==="resizable"&&typeof v.value=="boolean"&&(r.resizable=v.value),v.name==="editable"&&typeof v.value=="boolean"&&(r.editable=v.value),v.name==="deletable"&&typeof v.value=="boolean"&&(r.deletable=v.value)}),r}compileValidators(p){return p.map(r=>({name:r.name,validate:r.validate}))}}function et(f,p={}){const{includeJSDoc:r=!0,exportType:v=!0,typeNamePrefix:h="",typeNameSuffix:d="Extra"}=p,x=`${h}${st(f.type)}${d}`,b=[];r&&(b.push("/**"),f.name&&b.push(` * ${f.name}`),f.description&&b.push(` * ${f.description}`),b.push(" *"),b.push(" * 从 Event DSL 自动生成"),b.push(" */"));const C=v?"export ":"";return b.push(`${C}interface ${x} {`),f.fields.forEach($=>{const m=rt($),A=$.required?"":"?",O=$.name;if(r){const q=[];$.default!==void 0&&q.push(`@default ${JSON.stringify($.default)}`),$.min!==void 0&&q.push(`@min ${$.min}`),$.max!==void 0&&q.push(`@max ${$.max}`),q.length>0&&(b.push(" /**"),q.forEach(J=>{b.push(` * ${J}`)}),b.push(" */"))}b.push(` ${O}${A}: ${m};`)}),b.push("}"),b.join(`
8
+ `],!0,!1),Qi=function(e){const i={};return e.forEach(a=>{i[a.name]=a.value}),i},Yi=function(e){return{name:"type",value:e}},ea=function(e){return{name:"name",value:e}},ra=function(e){return{name:"description",value:e}},sa=function(e){return{name:"fields",value:e}},ia=function(e,i,a){return{name:e,type:i,...Object.assign({},...a)}},aa=function(e){return{type:"list",itemType:e}},fa=function(e){return{type:"enum",values:e}},fs=function(e,i){return i},ta=function(e,i){return[e,...i]},na=function(){return{required:!0}},la=function(e){return{default:e}},oa=function(e){return{min:e}},ca=function(e){return{max:e}},ua=function(e){return{name:"validate",value:e}},pa=function(e){return e},ga=function(e,i){return{type:"When",condition:e,rules:i}},va=function(e,i){return{type:"In",field:e,values:i}},ts=function(e,i){return i},$a=function(e,i){return[e,...i]},ha=function(e,i,a){return{type:"Between",field:e,min:i,max:a}},ma=function(e,i,a){return{type:"Comparison",operator:i,left:e,right:a}},da=function(){return{type:"NoConflict"}},ba=function(){return{type:"Conflict"}},ns=function(e,i,a){return[i,a]},ya=function(e,i){return Hf(e,i)},Aa=function(e){return{type:"UnaryExpression",operator:"not",argument:e}},xa=function(e,i,a){return{type:"Comparison",operator:i,left:e,right:a}},Ca=function(e,i,a,t){return{type:"ModComparison",left:e,modValue:i,operator:a,right:t}},wa=function(e){return{name:"display",value:e}},Ea=function(e,i){return{name:e,value:i}},Da=function(e,i,a){return a},Sa=function(e,i,a){return{type:"Conditional",condition:e,consequent:i,alternate:a}},Fa=function(e){return{name:"behavior",value:e}},Ta=function(e,i){return{name:e,value:i}},Ra=function(){return!0},ja=function(){return!1},Oa=function(e){return{name:"constraints",value:e}},qa=function(e,i){return{name:e,value:i}},La=function(){return"timeZone"},Pa=function(){return"allowedTimeZones"},Va=function(){return"timePrecision"},za=function(){return"minAdvanceTime"},Na=function(){return"maxAdvanceTime"},Ba=function(){return"allowCrossDay"},Za=function(){return"maxCrossDayDuration"},ka=function(){return"minDuration"},Ia=function(){return"maxDuration"},Ma=function(){return"allowedHours"},Wa=function(){return"allowedDays"},Ua=function(e,i){return{type:"Range",min:e,max:i}},_a=function(e){return{name:"recurring",value:Object.assign({},...e)}},Ja=function(e){return{frequency:e}},Ha=function(e){return{interval:e}},Ka=function(e){return{endDate:e}},Xa=function(e){return{count:e}},Ga=function(e){return{daysOfWeek:e}},Qa=function(e){return{dayOfMonth:e}},Ya=function(e){return{excludeDates:e}},ef=function(e){return{timeZone:e}},rf=function(){return"daily"},sf=function(){return"weekly"},af=function(){return"monthly"},ff=function(){return"yearly"},ls=function(e,i){return i},tf=function(e,i){return[e,...i]},os=function(e,i){return i},nf=function(e,i){return[e,...i]},cs=function(e,i){return i},lf=function(e,i){return{type:"FieldAccess",path:[e,...i]}},of=function(e){return e},cf=function(e,i){return{type:"Duration",value:e,unit:i==="minute"?"minutes":i==="hour"?"hours":i==="day"?"days":i==="week"?"weeks":i}},uf=function(e){return parseInt(e.join(""),10)},pf=function(e){return e.join("")},gf=function(e){return{type:"Template",parts:e}},vf=function(e){return e},$f=function(e){return e.join("")},hf=function(){return!0},mf=function(){return!1},df=function(e,i){return e+i.join("")},s=p.peg$currPos|0,W=[{line:1,column:1}],F=s,ge=p.peg$maxFailExpected||[],n=p.peg$silentFails|0,_;if(p.startRule){if(!(p.startRule in h))throw new Error(`Can't start parsing from rule "`+p.startRule+'".');d=h[p.startRule]}function u(e,i){return{type:"literal",text:e,ignoreCase:i}}function L(e,i,a){return{type:"class",parts:e,inverted:i,ignoreCase:a}}function bf(){return{type:"end"}}function us(e){var i=W[e],a;if(i)return i;if(e>=W.length)a=W.length-1;else for(a=e;!W[--a];);for(i=W[a],i={line:i.line,column:i.column};a<e;)f.charCodeAt(a)===10?(i.line++,i.column=1):i.column++,a++;return W[e]=i,i}function ps(e,i,a){var t=us(e),o=us(i),g={source:v,start:{offset:e,line:t.line,column:t.column},end:{offset:i,line:o.line,column:o.column}};return g}function l(e){s<F||(s>F&&(F=s,ge=[]),ge.push(e))}function yf(e,i,a){return new U(U.buildMessage(e,i),e,i,a)}function gs(){var e,i,a;for(e=s,c(),i=[],a=vs();a!==r;)i.push(a),a=vs();return a=c(),e=Qi(i),e}function vs(){var e;return e=Af(),e===r&&(e=xf(),e===r&&(e=Cf(),e===r&&(e=wf(),e===r&&(e=Df(),e===r&&(e=Lf(),e===r&&(e=Vf(),e===r&&(e=Nf(),e===r&&(e=If())))))))),e}function Af(){var e,i,a;return e=s,f.substr(s,5)===x?(i=x,s+=5):(i=r,n===0&&l(Lr)),i!==r?(c(),a=T(),a!==r?(c(),e=Yi(a)):(s=e,e=r)):(s=e,e=r),e}function xf(){var e,i,a;return e=s,f.substr(s,5)===b?(i=b,s+=5):(i=r,n===0&&l(Pr)),i!==r?(c(),a=j(),a!==r?(c(),e=ea(a)):(s=e,e=r)):(s=e,e=r),e}function Cf(){var e,i,a;return e=s,f.substr(s,12)===C?(i=C,s+=12):(i=r,n===0&&l(Vr)),i!==r?(c(),a=j(),a!==r?(c(),e=ra(a)):(s=e,e=r)):(s=e,e=r),e}function wf(){var e,i,a,t;if(e=s,f.substr(s,7)===$?(i=$,s+=7):(i=r,n===0&&l(zr)),i!==r){if(c(),a=[],t=$s(),t!==r)for(;t!==r;)a.push(t),t=$s();else a=r;a!==r?e=sa(a):(s=e,e=r)}else s=e,e=r;return e}function $s(){var e,i,a,t,o,g,y;if(e=s,c(),f.charCodeAt(s)===45?(i=m,s++):(i=r,n===0&&l(ks)),i!==r)if(c(),a=T(),a!==r)if(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r)if(c(),o=hs(),o!==r){for(g=[],y=ms();y!==r;)g.push(y),y=ms();y=c(),e=ia(a,o,g)}else s=e,e=r;else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function hs(){var e,i,a,t;return f.substr(s,6)===O?(e=O,s+=6):(e=r,n===0&&l(Is)),e===r&&(f.substr(s,6)===q?(e=q,s+=6):(e=r,n===0&&l(Ms)),e===r&&(f.substr(s,7)===J?(e=J,s+=7):(e=r,n===0&&l(Ws)),e===r&&(f.substr(s,5)===De?(e=De,s+=5):(e=r,n===0&&l(Us)),e===r&&(f.substr(s,4)===Se?(e=Se,s+=4):(e=r,n===0&&l(_s)),e===r&&(e=s,f.substr(s,8)===Fe?(i=Fe,s+=8):(i=r,n===0&&l(Js)),i!==r?(a=hs(),a!==r?e=aa(a):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.substr(s,5)===Te?(i=Te,s+=5):(i=r,n===0&&l(Hs)),i!==r?(a=Ef(),a!==r?(f.charCodeAt(s)===41?(t=Ls,s++):(t=r,n===0&&l(Ks)),t!==r?e=fa(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r))))))),e}function Ef(){var e,i,a,t,o,g;if(e=s,i=T(),i!==r){for(a=[],t=s,f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=T(),g!==r?t=fs(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=T(),g!==r?t=fs(i,g):(s=t,t=r)):(s=t,t=r);e=ta(i,a)}else s=e,e=r;return e}function ms(){var e,i,a,t;return e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,8)===Re?(a=Re,s+=8):(a=r,n===0&&l(Xs)),a!==r?e=na():(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,8)===je?(a=je,s+=8):(a=r,n===0&&l(Gs)),a!==r?(c(),t=R(),t!==r?e=la(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,4)===Oe?(a=Oe,s+=4):(a=r,n===0&&l(Qs)),a!==r?(c(),t=E(),t!==r?e=oa(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.charCodeAt(s)===44?(i=D,s++):(i=r,n===0&&l(S)),i!==r?(c(),f.substr(s,4)===qe?(a=qe,s+=4):(a=r,n===0&&l(Ys)),a!==r?(c(),t=E(),t!==r?e=ca(t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)))),e}function Df(){var e,i,a,t;if(e=s,f.substr(s,9)===Le?(i=Le,s+=9):(i=r,n===0&&l(ei)),i!==r){for(c(),a=[],t=ve();t!==r;)a.push(t),t=ve();e=ua(a)}else s=e,e=r;return e}function ve(){var e,i,a;return e=s,c(),i=s,n++,f.substr(s,8)===H?(a=H,s+=8):(a=r,n===0&&l(Nr)),a===r&&(f.substr(s,9)===K?(a=K,s+=9):(a=r,n===0&&l(Br)),a===r&&(f.substr(s,12)===X?(a=X,s+=12):(a=r,n===0&&l(Zr)),a===r&&(f.substr(s,10)===G?(a=G,s+=10):(a=r,n===0&&l(kr)),a===r&&(f.substr(s,5)===x?(a=x,s+=5):(a=r,n===0&&l(Lr)),a===r&&(f.substr(s,5)===b?(a=b,s+=5):(a=r,n===0&&l(Pr)),a===r&&(f.substr(s,12)===C?(a=C,s+=12):(a=r,n===0&&l(Vr)),a===r&&(f.substr(s,7)===$?(a=$,s+=7):(a=r,n===0&&l(zr))))))))),n--,a===r?i=void 0:(s=i,i=r),i!==r?(a=Sf(),a===r&&(a=Ff()),a!==r?e=pa(a):(s=e,e=r)):(s=e,e=r),e}function Sf(){var e,i,a,t,o,g;if(e=s,f.substr(s,4)===Q?(i=Q,s+=4):(i=r,n===0&&l(Ir)),i!==r)if(c(),a=$e(),a!==r)if(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r){if(c(),o=[],g=ve(),g!==r)for(;g!==r;)o.push(g),g=ve();else o=r;o!==r?e=ga(a,o):(s=e,e=r)}else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function Ff(){var e;return e=Tf(),e===r&&(e=Rf(),e===r&&(e=jf(),e===r&&(e=Of(),e===r&&(e=$e())))),e}function Tf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,2)===Pe?(a=Pe,s+=2):(a=r,n===0&&l(ri)),a!==r?(c(),f.charCodeAt(s)===91?(t=Y,s++):(t=r,n===0&&l(ce)),t!==r?(c(),o=ds(),o!==r?(c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?(c(),e=va(i,o)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function ds(){var e,i,a,t,o,g;if(e=s,i=R(),i!==r){for(a=[],t=s,c(),f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=R(),g!==r?t=ts(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,c(),f.charCodeAt(s)===44?(o=D,s++):(o=r,n===0&&l(S)),o!==r?(c(),g=R(),g!==r?t=ts(i,g):(s=t,t=r)):(s=t,t=r);e=$a(i,a)}else s=e,e=r;return e}function Rf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,7)===Ve?(a=Ve,s+=7):(a=r,n===0&&l(si)),a!==r?(c(),t=R(),t!==r?(c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o!==r?(c(),g=R(),g!==r?(c(),e=ha(i,t,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function jf(){var e,i,a,t;return e=s,i=P(),i!==r?(c(),a=Jf(),a!==r?(c(),t=R(),t!==r?(c(),e=ma(i,a,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Of(){var e,i,a,t,o,g;return e=s,f.substr(s,2)===ze?(i=ze,s+=2):(i=r,n===0&&l(ii)),i!==r?(c(),f.substr(s,8)===re?(a=re,s+=8):(a=r,n===0&&l(Mr)),a!==r?(c(),f.substr(s,4)===se?(t=se,s+=4):(t=r,n===0&&l(Wr)),t!==r?(c(),f.substr(s,5)===ie?(o=ie,s+=5):(o=r,n===0&&l(Ur)),o!==r?(c(),f.substr(s,6)===ae?(g=ae,s+=6):(g=r,n===0&&l(_r)),g!==r?(c(),e=da()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,f.substr(s,8)===re?(i=re,s+=8):(i=r,n===0&&l(Mr)),i!==r?(c(),f.substr(s,4)===se?(a=se,s+=4):(a=r,n===0&&l(Wr)),a!==r?(c(),f.substr(s,5)===ie?(t=ie,s+=5):(t=r,n===0&&l(Ur)),t!==r?(c(),f.substr(s,6)===ae?(o=ae,s+=6):(o=r,n===0&&l(_r)),o!==r?(c(),e=ba()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)),e}function $e(){var e,i,a,t,o,g;if(e=s,i=Ce(),i!==r){for(a=[],t=s,c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o===r&&(f.substr(s,2)===fe?(o=fe,s+=2):(o=r,n===0&&l(Jr))),o!==r?(c(),g=Ce(),g!==r?t=ns(i,o,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,c(),f.substr(s,3)===V?(o=V,s+=3):(o=r,n===0&&l(he)),o===r&&(f.substr(s,2)===fe?(o=fe,s+=2):(o=r,n===0&&l(Jr))),o!==r?(c(),g=Ce(),g!==r?t=ns(i,o,g):(s=t,t=r)):(s=t,t=r);e=ya(i,a)}else s=e,e=r;return e}function Ce(){var e,i,a;return e=s,f.substr(s,3)===Ne?(i=Ne,s+=3):(i=r,n===0&&l(ai)),i!==r?(c(),a=bs(),a!==r?e=Aa(a):(s=e,e=r)):(s=e,e=r),e===r&&(e=bs()),e}function bs(){var e,i,a,t,o;return e=qf(),e===r&&(e=s,i=P(),i!==r?(a=c(),f.substr(s,2)===z?(t=z,s+=2):(t=r,n===0&&l(me)),t===r&&(f.substr(s,6)===N?(t=N,s+=6):(t=r,n===0&&l(de)),t===r&&(f.substr(s,6)===B?(t=B,s+=6):(t=r,n===0&&l(be)),t===r&&(f.substr(s,10)===Z?(t=Z,s+=10):(t=r,n===0&&l(ye)),t===r&&(f.charCodeAt(s)===62?(t=Be,s++):(t=r,n===0&&l(Hr)),t===r&&(f.substr(s,2)===k?(t=k,s+=2):(t=r,n===0&&l(Ae)),t===r&&(f.charCodeAt(s)===60?(t=Ze,s++):(t=r,n===0&&l(Kr)),t===r&&(f.substr(s,2)===I?(t=I,s+=2):(t=r,n===0&&l(xe))))))))),t!==r?(c(),o=R(),o!==r?(c(),e=xa(i,t,o)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,i=P(),i!==r?(a=c(),i=[i,a],e=i):(s=e,e=r))),e}function qf(){var e,i,a,t,o,g;return e=s,i=P(),i!==r?(c(),f.substr(s,3)===te?(a=te,s+=3):(a=r,n===0&&l(Xr)),a!==r?(c(),t=R(),t!==r?(c(),f.substr(s,2)===z?(o=z,s+=2):(o=r,n===0&&l(me)),o===r&&(f.substr(s,6)===N?(o=N,s+=6):(o=r,n===0&&l(de)),o===r&&(f.substr(s,6)===B?(o=B,s+=6):(o=r,n===0&&l(be)),o===r&&(f.substr(s,10)===Z?(o=Z,s+=10):(o=r,n===0&&l(ye)),o===r&&(f.charCodeAt(s)===62?(o=Be,s++):(o=r,n===0&&l(Hr)),o===r&&(f.substr(s,2)===k?(o=k,s+=2):(o=r,n===0&&l(Ae)),o===r&&(f.charCodeAt(s)===60?(o=Ze,s++):(o=r,n===0&&l(Kr)),o===r&&(f.substr(s,2)===I?(o=I,s+=2):(o=r,n===0&&l(xe))))))))),o!==r?(c(),g=R(),g!==r?(c(),e=Ca(i,t,o,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Lf(){var e,i,a,t;if(e=s,f.substr(s,8)===H?(i=H,s+=8):(i=r,n===0&&l(Nr)),i!==r){if(c(),a=[],t=ys(),t!==r)for(;t!==r;)a.push(t),t=ys();else a=r;a!==r?e=wa(a):(s=e,e=r)}else s=e,e=r;return e}function ys(){var e,i,a,t;return e=s,c(),f.substr(s,5)===ke?(i=ke,s+=5):(i=r,n===0&&l(fi)),i===r&&(f.substr(s,4)===Ie?(i=Ie,s+=4):(i=r,n===0&&l(ti)),i===r&&(f.substr(s,5)===Me?(i=Me,s+=5):(i=r,n===0&&l(ni)),i===r&&(f.substr(s,11)===We?(i=We,s+=11):(i=r,n===0&&l(li))))),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=we(),t!==r?(c(),e=Ea(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function we(){var e;return e=Pf(),e===r&&(e=_f(),e===r&&(e=j())),e}function Pf(){var e,i,a,t,o,g,y,w;return e=s,f.substr(s,4)===Q?(i=Q,s+=4):(i=r,n===0&&l(Ir)),i!==r?(c(),a=$e(),a!==r?(f.charCodeAt(s)===58?(t=A,s++):(t=r,n===0&&l(M)),t!==r?(c(),o=we(),o!==r?(g=s,c(),f.substr(s,5)===Ue?(y=Ue,s+=5):(y=r,n===0&&l(oi)),y!==r?(c(),w=we(),w!==r?g=Da(a,o,w):(s=g,g=r)):(s=g,g=r),g===r&&(g=null),e=Sa(a,o,g)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Vf(){var e,i,a,t;if(e=s,f.substr(s,9)===K?(i=K,s+=9):(i=r,n===0&&l(Br)),i!==r){if(c(),a=[],t=As(),t!==r)for(;t!==r;)a.push(t),t=As();else a=r;a!==r?e=Fa(a):(s=e,e=r)}else s=e,e=r;return e}function As(){var e,i,a,t;return e=s,c(),f.substr(s,9)===_e?(i=_e,s+=9):(i=r,n===0&&l(ci)),i===r&&(f.substr(s,9)===Je?(i=Je,s+=9):(i=r,n===0&&l(ui)),i===r&&(f.substr(s,8)===He?(i=He,s+=8):(i=r,n===0&&l(pi)),i===r&&(f.substr(s,9)===Ke?(i=Ke,s+=9):(i=r,n===0&&l(gi))))),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=zf(),t!==r?(c(),e=Ta(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function zf(){var e,i;return e=s,f.substr(s,4)===ne?(i=ne,s+=4):(i=r,n===0&&l(Gr)),i!==r&&(i=Ra()),e=i,e===r&&(e=s,f.substr(s,5)===le?(i=le,s+=5):(i=r,n===0&&l(Qr)),i!==r&&(i=ja()),e=i,e===r&&(e=$e())),e}function Nf(){var e,i,a,t;if(e=s,f.substr(s,12)===X?(i=X,s+=12):(i=r,n===0&&l(Zr)),i!==r){if(c(),a=[],t=xs(),t!==r)for(;t!==r;)a.push(t),t=xs();else a=r;a!==r?e=Oa(a):(s=e,e=r)}else s=e,e=r;return e}function xs(){var e,i,a,t;return e=s,c(),i=Bf(),i!==r?(f.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(M)),a!==r?(c(),t=Zf(),t!==r?(c(),e=qa(i,t)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Bf(){var e,i;return e=s,f.substr(s,8)===Xe?(i=Xe,s+=8):(i=r,n===0&&l(vi)),i!==r&&(i=La()),e=i,e===r&&(e=s,f.substr(s,16)===Ge?(i=Ge,s+=16):(i=r,n===0&&l($i)),i!==r&&(i=Pa()),e=i,e===r&&(e=s,f.substr(s,13)===Qe?(i=Qe,s+=13):(i=r,n===0&&l(hi)),i!==r&&(i=Va()),e=i,e===r&&(e=s,f.substr(s,14)===Ye?(i=Ye,s+=14):(i=r,n===0&&l(mi)),i!==r&&(i=za()),e=i,e===r&&(e=s,f.substr(s,14)===er?(i=er,s+=14):(i=r,n===0&&l(di)),i!==r&&(i=Na()),e=i,e===r&&(e=s,f.substr(s,13)===rr?(i=rr,s+=13):(i=r,n===0&&l(bi)),i!==r&&(i=Ba()),e=i,e===r&&(e=s,f.substr(s,19)===sr?(i=sr,s+=19):(i=r,n===0&&l(yi)),i!==r&&(i=Za()),e=i,e===r&&(e=s,f.substr(s,11)===ir?(i=ir,s+=11):(i=r,n===0&&l(Ai)),i!==r&&(i=ka()),e=i,e===r&&(e=s,f.substr(s,11)===ar?(i=ar,s+=11):(i=r,n===0&&l(xi)),i!==r&&(i=Ia()),e=i,e===r&&(e=s,f.substr(s,12)===fr?(i=fr,s+=12):(i=r,n===0&&l(Ci)),i!==r&&(i=Ma()),e=i,e===r&&(e=s,f.substr(s,11)===tr?(i=tr,s+=11):(i=r,n===0&&l(wi)),i!==r&&(i=Wa()),e=i,e===r&&(e=T()))))))))))),e}function Zf(){var e;return e=ws(),e===r&&(e=kf(),e===r&&(e=Es(),e===r&&(e=j(),e===r&&(e=E(),e===r&&(e=Ss(),e===r&&(e=T())))))),e}function kf(){var e,i,a,t;return e=s,i=E(),i!==r?(c(),f.substr(s,2)===nr?(a=nr,s+=2):(a=r,n===0&&l(Ei)),a!==r?(c(),t=E(),t!==r?e=Ua(i,t):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function If(){var e,i,a,t;if(e=s,f.substr(s,10)===G?(i=G,s+=10):(i=r,n===0&&l(kr)),i!==r){if(c(),a=[],t=Cs(),t!==r)for(;t!==r;)a.push(t),t=Cs();else a=r;a!==r?e=_a(a):(s=e,e=r)}else s=e,e=r;return e}function Cs(){var e,i,a;return e=s,c(),f.substr(s,10)===lr?(i=lr,s+=10):(i=r,n===0&&l(Di)),i!==r?(c(),a=Mf(),a!==r?(c(),e=Ja(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,9)===or?(i=or,s+=9):(i=r,n===0&&l(Si)),i!==r?(c(),a=E(),a!==r?(c(),e=Ha(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,8)===cr?(i=cr,s+=8):(i=r,n===0&&l(Fi)),i!==r?(c(),a=j(),a!==r?(c(),e=Ka(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,6)===ur?(i=ur,s+=6):(i=r,n===0&&l(Ti)),i!==r?(c(),a=E(),a!==r?(c(),e=Xa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,11)===pr?(i=pr,s+=11):(i=r,n===0&&l(Ri)),i!==r?(c(),a=Wf(),a!==r?(c(),e=Ga(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,11)===gr?(i=gr,s+=11):(i=r,n===0&&l(ji)),i!==r?(c(),a=E(),a!==r?(c(),e=Qa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,13)===vr?(i=vr,s+=13):(i=r,n===0&&l(Oi)),i!==r?(c(),a=Uf(),a!==r?(c(),e=Ya(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,c(),f.substr(s,9)===$r?(i=$r,s+=9):(i=r,n===0&&l(qi)),i!==r?(c(),a=j(),a!==r?(c(),e=ef(a)):(s=e,e=r)):(s=e,e=r)))))))),e}function Mf(){var e,i;return e=s,f.substr(s,5)===hr?(i=hr,s+=5):(i=r,n===0&&l(Li)),i!==r&&(i=rf()),e=i,e===r&&(e=s,f.substr(s,6)===mr?(i=mr,s+=6):(i=r,n===0&&l(Pi)),i!==r&&(i=sf()),e=i,e===r&&(e=s,f.substr(s,7)===dr?(i=dr,s+=7):(i=r,n===0&&l(Vi)),i!==r&&(i=af()),e=i,e===r&&(e=s,f.substr(s,6)===br?(i=br,s+=6):(i=r,n===0&&l(zi)),i!==r&&(i=ff()),e=i))),e}function Wf(){var e,i,a,t,o,g,y,w;if(e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r)if(c(),a=E(),a!==r){for(t=[],o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=E(),w!==r?o=ls(a,w):(s=o,o=r)):(s=o,o=r);o!==r;)t.push(o),o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=E(),w!==r?o=ls(a,w):(s=o,o=r)):(s=o,o=r);o=c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?e=tf(a,t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function Uf(){var e,i,a,t,o,g,y,w;if(e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r)if(c(),a=j(),a!==r){for(t=[],o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=j(),w!==r?o=os(a,w):(s=o,o=r)):(s=o,o=r);o!==r;)t.push(o),o=s,g=c(),f.charCodeAt(s)===44?(y=D,s++):(y=r,n===0&&l(S)),y!==r?(c(),w=j(),w!==r?o=os(a,w):(s=o,o=r)):(s=o,o=r);o=c(),f.charCodeAt(s)===93?(g=ee,s++):(g=r,n===0&&l(ue)),g!==r?e=nf(a,t):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function P(){var e,i,a,t,o,g;if(e=s,i=T(),i!==r){for(a=[],t=s,f.charCodeAt(s)===46?(o=yr,s++):(o=r,n===0&&l(Yr)),o!==r?(g=T(),g!==r?t=cs(i,g):(s=t,t=r)):(s=t,t=r);t!==r;)a.push(t),t=s,f.charCodeAt(s)===46?(o=yr,s++):(o=r,n===0&&l(Yr)),o!==r?(g=T(),g!==r?t=cs(i,g):(s=t,t=r)):(s=t,t=r);e=lf(i,a)}else s=e,e=r;return e}function R(){var e;return e=ws(),e===r&&(e=Es(),e===r&&(e=E(),e===r&&(e=j(),e===r&&(e=Ss(),e===r&&(e=T()))))),e}function ws(){var e,i,a,t;return e=s,f.charCodeAt(s)===91?(i=Y,s++):(i=r,n===0&&l(ce)),i!==r?(c(),a=ds(),a!==r?(c(),f.charCodeAt(s)===93?(t=ee,s++):(t=r,n===0&&l(ue)),t!==r?e=of(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Es(){var e,i,a;return e=s,i=E(),i!==r?(c(),f.substr(s,7)===Ar?(a=Ar,s+=7):(a=r,n===0&&l(Ni)),a===r&&(f.substr(s,6)===xr?(a=xr,s+=6):(a=r,n===0&&l(Bi)),a===r&&(f.substr(s,5)===Cr?(a=Cr,s+=5):(a=r,n===0&&l(Zi)),a===r&&(f.substr(s,4)===wr?(a=wr,s+=4):(a=r,n===0&&l(ki)),a===r&&(f.substr(s,4)===Er?(a=Er,s+=4):(a=r,n===0&&l(Ii)),a===r&&(f.substr(s,3)===Dr?(a=Dr,s+=3):(a=r,n===0&&l(Mi)),a===r&&(f.substr(s,5)===Sr?(a=Sr,s+=5):(a=r,n===0&&l(Wi)),a===r&&(f.substr(s,4)===Fr?(a=Fr,s+=4):(a=r,n===0&&l(Ui))))))))),a!==r?e=cf(i,a):(s=e,e=r)):(s=e,e=r),e}function E(){var e,i,a;if(e=s,i=[],a=f.charAt(s),Tr.test(a)?s++:(a=r,n===0&&l(es)),a!==r)for(;a!==r;)i.push(a),a=f.charAt(s),Tr.test(a)?s++:(a=r,n===0&&l(es));else i=r;return i!==r&&(i=uf(i)),e=i,e}function j(){var e,i,a,t;if(e=s,f.charCodeAt(s)===34?(i=oe,s++):(i=r,n===0&&l(pe)),i!==r){for(a=[],t=f.charAt(s),Rr.test(t)?s++:(t=r,n===0&&l(rs));t!==r;)a.push(t),t=f.charAt(s),Rr.test(t)?s++:(t=r,n===0&&l(rs));f.charCodeAt(s)===34?(t=oe,s++):(t=r,n===0&&l(pe)),t!==r?e=pf(a):(s=e,e=r)}else s=e,e=r;return e}function _f(){var e,i,a,t;if(e=s,f.charCodeAt(s)===34?(i=oe,s++):(i=r,n===0&&l(pe)),i!==r){if(a=[],t=Ds(),t!==r)for(;t!==r;)a.push(t),t=Ds();else a=r;a!==r?(f.charCodeAt(s)===34?(t=oe,s++):(t=r,n===0&&l(pe)),t!==r?e=gf(a):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;return e}function Ds(){var e,i,a,t;if(e=s,f.charCodeAt(s)===123?(i=Ps,s++):(i=r,n===0&&l(_i)),i!==r?(a=P(),a!==r?(f.charCodeAt(s)===125?(t=Vs,s++):(t=r,n===0&&l(Ji)),t!==r?e=vf(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r){if(e=s,i=[],a=f.charAt(s),jr.test(a)?s++:(a=r,n===0&&l(ss)),a!==r)for(;a!==r;)i.push(a),a=f.charAt(s),jr.test(a)?s++:(a=r,n===0&&l(ss));else i=r;i!==r&&(i=$f(i)),e=i}return e}function Ss(){var e,i;return e=s,f.substr(s,4)===ne?(i=ne,s+=4):(i=r,n===0&&l(Gr)),i!==r&&(i=hf()),e=i,e===r&&(e=s,f.substr(s,5)===le?(i=le,s+=5):(i=r,n===0&&l(Qr)),i!==r&&(i=mf()),e=i),e}function T(){var e,i,a,t;if(e=s,i=f.charAt(s),Ns.test(i)?s++:(i=r,n===0&&l(Hi)),i!==r){for(a=[],t=f.charAt(s),Or.test(t)?s++:(t=r,n===0&&l(is));t!==r;)a.push(t),t=f.charAt(s),Or.test(t)?s++:(t=r,n===0&&l(is));e=df(i,a)}else s=e,e=r;return e}function Jf(){var e;return f.substr(s,2)===k?(e=k,s+=2):(e=r,n===0&&l(Ae)),e===r&&(f.substr(s,2)===I?(e=I,s+=2):(e=r,n===0&&l(xe)),e===r&&(e=f.charAt(s),Bs.test(e)?s++:(e=r,n===0&&l(Ki)),e===r&&(f.substr(s,2)===z?(e=z,s+=2):(e=r,n===0&&l(me)),e===r&&(f.substr(s,6)===N?(e=N,s+=6):(e=r,n===0&&l(de)),e===r&&(f.substr(s,6)===B?(e=B,s+=6):(e=r,n===0&&l(be)),e===r&&(f.substr(s,10)===Z?(e=Z,s+=10):(e=r,n===0&&l(ye)),e===r&&(f.substr(s,3)===te?(e=te,s+=3):(e=r,n===0&&l(Xr))))))))),e}function c(){var e,i;for(e=[],i=Fs(),i===r&&(i=Ts());i!==r;)e.push(i),i=Fs(),i===r&&(i=Ts());return e}function Fs(){var e;return e=f.charAt(s),Zs.test(e)?s++:(e=r,n===0&&l(Xi)),e}function Ts(){var e,i,a,t;if(e=s,f.charCodeAt(s)===35?(i=zs,s++):(i=r,n===0&&l(Gi)),i!==r){for(a=[],t=f.charAt(s),qr.test(t)?s++:(t=r,n===0&&l(as));t!==r;)a.push(t),t=f.charAt(s),qr.test(t)?s++:(t=r,n===0&&l(as));i=[i,a],e=i}else s=e,e=r;return e}function Hf(e,i){return i.reduce((a,[t,o])=>({type:"BinaryExpression",operator:t,left:a,right:o}),e)}if(_=d(),p.peg$library)return{peg$result:_,peg$currPos:s,peg$FAILED:r,peg$maxFailExpected:ge,peg$maxFailPos:F};if(_!==r&&s===f.length)return _;throw _!==r&&s<f.length&&l(bf()),yf(ge,F<f.length?f.charAt(F):null,F<f.length?ps(F,F+1):ps(F,F))}function Rs(f){try{const p=Xf(f);return Gf(p)}catch(p){throw new Error(`Failed to parse Event DSL: ${p.message}`)}}function Gf(f){const p=(f.validate||[]).map(v=>Array.isArray(v)&&v.length===2&&Array.isArray(v[0])?v[1]:v),r=(f.behavior||[]).map(v=>{if(v&&typeof v=="object"&&"value"in v){const h=v.value;if(Array.isArray(h)&&h.length===2){const d=h[0],x=h[1];if(d?.type==="FieldAccess"&&Array.isArray(d.path)&&d.path.length===1){const b=d.path[0];if(b==="true"&&(!x||x.length===0))return{...v,value:!0};if(b==="false"&&(!x||x.length===0))return{...v,value:!1}}}}return v});return{type:f.type||"",name:f.name||"",description:f.description,fields:f.fields||[],validate:p,display:f.display||[],behavior:r,constraints:f.constraints||[],recurring:f.recurring}}function js(f,p={}){const{includeSchema:r=!0,includeTitle:v=!0,includeDescription:h=!0}=p,d={type:"object"};r&&(d.$schema="http://json-schema.org/draft-07/schema#"),v&&f.name&&(d.title=f.name),h&&f.description&&(d.description=f.description);const x={},b=[];return f.fields.forEach(C=>{const $=Qf(C);x[C.name]=$,C.required&&b.push(C.name)}),d.properties=x,b.length>0&&(d.required=b),d.additionalProperties=!1,d}function Qf(f){const p={},r=Os(f.type);return Object.assign(p,r),f.default!==void 0&&(p.default=f.default),f.min!==void 0&&(p.type==="array"?p.minItems=f.min:p.type==="number"?p.minimum=f.min:p.type==="string"&&(p.minLength=f.min)),f.max!==void 0&&(p.type==="array"?p.maxItems=f.max:p.type==="number"?p.maximum=f.max:p.type==="string"&&(p.maxLength=f.max)),p}function Os(f){return f==="string"?{type:"string"}:f==="number"?{type:"number"}:f==="boolean"?{type:"boolean"}:f==="email"?{type:"string",format:"email"}:f==="text"?{type:"string"}:typeof f=="object"&&f.type==="list"?{type:"array",items:Os(f.itemType)}:typeof f=="object"&&f.type==="enum"?{type:"string",enum:f.values}:{type:"string"}}class Yf{compileDSL(p){const r=Rs(p);return this.compileFromAST([r])}compileFromAST(p){return{types:p.map(r=>this.compileType(r)),validators:[]}}compileType(p){const r=js(p),v=p.validate||[],h=p.display||[],d=p.behavior||[],x=p.constraints||[],b=p.recurring,C=this.generateValidator(p),$=this.generateRenderer(p),m=this.generateBehavior(p);return{id:p.type,name:p.name,dataSchema:r,validationRules:v,displayRules:h,behaviorRules:d,constraints:x,recurring:b,validator:C,renderer:$,behavior:m}}generateValidator(p){return r=>{const v=[];return p.fields.forEach(h=>{const d=r.data?.[h.name];h.required&&(d==null||d==="")&&v.push(`${h.name} 是必填字段`)}),{valid:v.length===0,errors:v.length>0?v:void 0}}}generateRenderer(p){return r=>{const v={title:r.title||p.name,color:r.color||"#4285f4",description:""};return(p.display||[]).forEach(h=>{h.name==="color"&&typeof h.value=="string"&&(v.color=h.value),h.name==="icon"&&typeof h.value=="string"&&(v.icon=h.value)}),v}}generateBehavior(p){const r={draggable:!0,resizable:!1,editable:!0,deletable:!0};return(p.behavior||[]).forEach(v=>{v.name==="draggable"&&typeof v.value=="boolean"&&(r.draggable=v.value),v.name==="resizable"&&typeof v.value=="boolean"&&(r.resizable=v.value),v.name==="editable"&&typeof v.value=="boolean"&&(r.editable=v.value),v.name==="deletable"&&typeof v.value=="boolean"&&(r.deletable=v.value)}),r}compileValidators(p){return p.map(r=>({name:r.name,validate:r.validate}))}}function et(f,p={}){const{includeJSDoc:r=!0,exportType:v=!0,typeNamePrefix:h="",typeNameSuffix:d="Extra"}=p,x=`${h}${st(f.type)}${d}`,b=[];r&&(b.push("/**"),f.name&&b.push(` * ${f.name}`),f.description&&b.push(` * ${f.description}`),b.push(" *"),b.push(" * 从 Event DSL 自动生成"),b.push(" */"));const C=v?"export ":"";return b.push(`${C}interface ${x} {`),f.fields.forEach($=>{const m=rt($),A=$.required?"":"?",O=$.name;if(r){const q=[];$.default!==void 0&&q.push(`@default ${JSON.stringify($.default)}`),$.min!==void 0&&q.push(`@min ${$.min}`),$.max!==void 0&&q.push(`@max ${$.max}`),q.length>0&&(b.push(" /**"),q.forEach(J=>{b.push(` * ${J}`)}),b.push(" */"))}b.push(` ${O}${A}: ${m};`)}),b.push("}"),b.join(`
9
9
  `)}function rt(f){return qs(f.type)}function qs(f){if(typeof f=="string")switch(f){case"string":case"text":return"string";case"number":return"number";case"boolean":return"boolean";case"email":return"string";default:return"string"}if(typeof f=="object"){if(f.type==="list")return`${qs(f.itemType)}[]`;if(f.type==="enum")return f.values.map(r=>`'${r}'`).join(" | ")}return"unknown"}function st(f){return f.split(/[-_\s]/).map(p=>p.charAt(0).toUpperCase()+p.slice(1).toLowerCase()).join("")}exports.EventDSLCompiler=Yf;exports.generateJSONSchema=js;exports.generateTypeScript=et;exports.parseEventDSL=Rs;
10
10
  //# sourceMappingURL=index.cjs.map