@calenderjs/event-dsl 0.3.1 → 0.4.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CalenderJS Contributors
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.
@@ -0,0 +1,74 @@
1
+ import { Event } from '@calenderjs/event-model';
2
+ import { EventTypeAST } from '../ast/types';
3
+ import { EventTypeDefinition } from '../types';
4
+ /**
5
+ * EventDataGenerator 选项
6
+ */
7
+ export interface EventDataGeneratorOptions {
8
+ /** 默认时区,未指定时为 undefined(保持 UTC 或由外部指定) */
9
+ timeZone?: string;
10
+ /** 默认事件时长(分钟),默认为 60 */
11
+ defaultDurationMinutes?: number;
12
+ }
13
+ /**
14
+ * 接受的 DSL 输入类型:EventTypeAST、EventTypeDefinition 或 DSL 文本字符串
15
+ */
16
+ export type EventDefinitionInput = EventTypeAST | EventTypeDefinition | string;
17
+ export declare class EventDataGenerator {
18
+ private defaultDurationMinutes;
19
+ private timeZone?;
20
+ constructor(options?: EventDataGeneratorOptions);
21
+ /**
22
+ * 从 DSL 定义生成符合 Event Data Model 的 Event 对象
23
+ *
24
+ * @param definition DSL 定义(EventTypeAST、EventTypeDefinition 或 DSL 文本)
25
+ * @param overrides 用户自定义的字段覆盖
26
+ * @returns 符合 Event 接口的实例
27
+ */
28
+ generateEvent(definition: EventDefinitionInput, overrides?: Partial<Event>): Event;
29
+ /**
30
+ * 批量生成 Event
31
+ */
32
+ generateEvents(definition: EventDefinitionInput, count: number, overridesFactory?: (index: number) => Partial<Event>): Event[];
33
+ /**
34
+ * 将不同形式的定义规范化为 EventTypeAST 结构
35
+ */
36
+ private normalizeDefinition;
37
+ /**
38
+ * 映射 EventTypeDefinition 的字段类型到 AST 字段类型
39
+ */
40
+ private mapDSLFieldType;
41
+ /**
42
+ * 生成单个字段的默认值
43
+ */
44
+ private generateFieldValue;
45
+ /**
46
+ * 生成事件标题
47
+ */
48
+ private generateTitle;
49
+ /**
50
+ * 提取事件显示配置(color, icon)
51
+ */
52
+ private resolveDisplay;
53
+ /**
54
+ * 解析默认时长(分钟)
55
+ */
56
+ private resolveDurationMinutes;
57
+ /**
58
+ * 解析 recurring 规则
59
+ */
60
+ private resolveRecurring;
61
+ /**
62
+ * 模板插值:${fieldName}
63
+ */
64
+ private interpolateTemplate;
65
+ /**
66
+ * 读取对象嵌套路径
67
+ */
68
+ private resolvePath;
69
+ /**
70
+ * 生成唯一 ID
71
+ */
72
+ private generateId;
73
+ }
74
+ //# sourceMappingURL=EventDataGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventDataGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/EventDataGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,KAAK,EAGN,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAE/E,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAS;gBAEd,OAAO,GAAE,yBAA8B;IAKnD;;;;;;OAMG;IACH,aAAa,CACX,UAAU,EAAE,oBAAoB,EAChC,SAAS,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GACzB,KAAK;IA2FR;;OAEG;IACH,cAAc,CACZ,UAAU,EAAE,oBAAoB,EAChC,KAAK,EAAE,MAAM,EACb,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,GACnD,KAAK,EAAE;IASV;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyC3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAmC1B;;OAEG;IACH,OAAO,CAAC,aAAa;IA0CrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACH,OAAO,CAAC,UAAU;CAGnB"}
@@ -5,4 +5,5 @@
5
5
  */
6
6
  export * from './json-schema';
7
7
  export * from './typescript';
8
+ export * from './EventDataGenerator';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Kf(f,p){function r(){this.constructor=f}r.prototype=p.prototype,f.prototype=new r}function U(f,p,r,v){var h=Error.call(this,f);return Object.setPrototypeOf&&Object.setPrototypeOf(h,U.prototype),h.expected=p,h.found=r,h.location=v,h.name="SyntaxError",h}Kf(U,Error);function Ee(f,p,r){return r=r||" ",f.length>p?f:(p-=f.length,r+=r.repeat(p),f+r.slice(0,p))}U.prototype.format=function(f){var p="Error: "+this.message;if(this.location){var r=null,v;for(v=0;v<f.length;v++)if(f[v].source===this.location.source){r=f[v].text.split(/\r\n|\n|\r/g);break}var h=this.location.start,d=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(h):h,x=this.location.source+":"+d.line+":"+d.column;if(r){var b=this.location.end,C=Ee("",d.line.toString().length," "),$=r[h.line-1],m=h.line===b.line?b.column:$.length+1,A=m-h.column||1;p+=`
2
- --> `+x+`
3
- `+C+` |
4
- `+d.line+" | "+$+`
5
- `+C+" | "+Ee("",h.column-1," ")+Ee("",A,"^")}else p+=`
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
- `,"\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,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
- `)}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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Ht(t,c){function r(){this.constructor=t}r.prototype=c.prototype,t.prototype=new r}function J(t,c,r,g){var $=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf($,J.prototype),$.expected=c,$.found=r,$.location=g,$.name="SyntaxError",$}Ht(J,Error);function Te(t,c,r){return r=r||" ",t.length>c?t:(c-=t.length,r+=r.repeat(c),t+r.slice(0,c))}J.prototype.format=function(t){var c="Error: "+this.message;if(this.location){var r=null,g;for(g=0;g<t.length;g++)if(t[g].source===this.location.source){r=t[g].text.split(/\r\n|\n|\r/g);break}var $=this.location.start,m=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset($):$,b=this.location.source+":"+m.line+":"+m.column;if(r){var h=this.location.end,x=Te("",m.line.toString().length," "),d=r[$.line-1],y=$.line===h.line?h.column:d.length+1,A=y-$.column||1;c+=`
2
+ --> `+b+`
3
+ `+x+` |
4
+ `+m.line+" | "+d+`
5
+ `+x+" | "+Te("",$.column-1," ")+Te("",A,"^")}else c+=`
6
+ at `+b}return c};J.buildMessage=function(t,c){var r={literal:function(d){return'"'+$(d.text)+'"'},class:function(d){var y=d.parts.map(function(A){return Array.isArray(A)?m(A[0])+"-"+m(A[1]):m(A)});return"["+(d.inverted?"^":"")+y.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(d){return d.description}};function g(d){return d.charCodeAt(0).toString(16).toUpperCase()}function $(d){return d.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(y){return"\\x0"+g(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+g(y)})}function m(d){return d.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(y){return"\\x0"+g(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+g(y)})}function b(d){return r[d.type](d)}function h(d){var y=d.map(b),A,S;if(y.sort(),y.length>0){for(A=1,S=1;A<y.length;A++)y[A-1]!==y[A]&&(y[S]=y[A],S++);y.length=S}switch(y.length){case 1:return y[0];case 2:return y[0]+" or "+y[1];default:return y.slice(0,-1).join(", ")+", or "+y[y.length-1]}}function x(d){return d?'"'+$(d)+'"':"end of input"}return"Expected "+h(t)+" but "+x(c)+" found."};function Gt(t,c){c=c!==void 0?c:{};var r={},g=c.grammarSource,$={EventTypeDefinition:vs},m=vs,b="type:",h="name:",x="description:",d="fields:",y="-",A=":",S="string",R="number",P="boolean",w="email",H="text",G="list of ",Re="enum(",Ls=")",T=",",je="required",Oe="default:",qe="min:",Le="max:",Me="validate:",X="display:",Q="behavior:",Y="constraints:",ee="recurring:",re="when",Ze="in",se="[",ie="]",Pe="between",I="and",Ie="no",ae="conflict",te="with",fe="other",ne="events",le="or",Ve="not",V="is",z="equals",N="is not",k="not equals",ze=">",B=">=",Ne="<",W="<=",oe="mod",ke="color",Be="icon",We="title",Ue="description",_e="else:",Je="draggable",He="resizable",Ge="editable",Ke="deletable",ce="true",ue="false",Xe="timeZone",Qe="allowedTimeZones",Ye="timePrecision",er="minAdvanceTime",rr="maxAdvanceTime",sr="allowCrossDay",ir="maxCrossDayDuration",ar="minDuration",tr="maxDuration",fr="allowedHours",nr="allowedDays",lr="to",or="frequency:",cr="interval:",ur="endDate:",pr="count:",gr="daysOfWeek:",vr="dayOfMonth:",$r="excludeDates:",mr="timeZone:",dr="daily",hr="weekly",yr="monthly",br="yearly",Ar=".",xr="minutes",Dr="minute",Cr="hours",wr="hour",Er="days",Sr="day",Tr="weeks",Fr="week",pe='"',Ms="{",Zs="}",Ps="#",Rr=/^[0-9]/,jr=/^[^"]/,Or=/^[^{}]/,Is=/^[a-zA-Z_]/,qr=/^[a-zA-Z0-9_]/,Vs=/^[<>]/,zs=/^[ \t\n\r]/,Lr=/^[^\n]/,Mr=p("type:",!1),Zr=p("name:",!1),Pr=p("description:",!1),Ir=p("fields:",!1),Ns=p("-",!1),U=p(":",!1),ks=p("string",!1),Bs=p("number",!1),Ws=p("boolean",!1),Us=p("email",!1),_s=p("text",!1),Js=p("list of ",!1),Hs=p("enum(",!1),Gs=p(")",!1),F=p(",",!1),Ks=p("required",!1),Xs=p("default:",!1),Qs=p("min:",!1),Ys=p("max:",!1),ei=p("validate:",!1),Vr=p("display:",!1),zr=p("behavior:",!1),Nr=p("constraints:",!1),kr=p("recurring:",!1),Br=p("when",!1),ri=p("in",!1),ge=p("[",!1),ve=p("]",!1),si=p("between",!1),ye=p("and",!1),ii=p("no",!1),Wr=p("conflict",!1),Ur=p("with",!1),_r=p("other",!1),Jr=p("events",!1),Hr=p("or",!1),ai=p("not",!1),be=p("is",!1),Ae=p("equals",!1),xe=p("is not",!1),De=p("not equals",!1),Gr=p(">",!1),Ce=p(">=",!1),Kr=p("<",!1),we=p("<=",!1),Xr=p("mod",!1),ti=p("color",!1),fi=p("icon",!1),ni=p("title",!1),li=p("description",!1),oi=p("else:",!1),ci=p("draggable",!1),ui=p("resizable",!1),pi=p("editable",!1),gi=p("deletable",!1),Qr=p("true",!1),Yr=p("false",!1),vi=p("timeZone",!1),$i=p("allowedTimeZones",!1),mi=p("timePrecision",!1),di=p("minAdvanceTime",!1),hi=p("maxAdvanceTime",!1),yi=p("allowCrossDay",!1),bi=p("maxCrossDayDuration",!1),Ai=p("minDuration",!1),xi=p("maxDuration",!1),Di=p("allowedHours",!1),Ci=p("allowedDays",!1),wi=p("to",!1),Ei=p("frequency:",!1),Si=p("interval:",!1),Ti=p("endDate:",!1),Fi=p("count:",!1),Ri=p("daysOfWeek:",!1),ji=p("dayOfMonth:",!1),Oi=p("excludeDates:",!1),qi=p("timeZone:",!1),Li=p("daily",!1),Mi=p("weekly",!1),Zi=p("monthly",!1),Pi=p("yearly",!1),es=p(".",!1),Ii=p("minutes",!1),Vi=p("minute",!1),zi=p("hours",!1),Ni=p("hour",!1),ki=p("days",!1),Bi=p("day",!1),Wi=p("weeks",!1),Ui=p("week",!1),rs=M([["0","9"]],!1,!1),$e=p('"',!1),ss=M(['"'],!0,!1),_i=p("{",!1),Ji=p("}",!1),is=M(["{","}"],!0,!1),Hi=M([["a","z"],["A","Z"],"_"],!1,!1),as=M([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Gi=M(["<",">"],!1,!1),Ki=M([" "," ",`
7
+ `,"\r"],!1,!1),Xi=p("#",!1),ts=M([`
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}},ta=function(e){return{type:"enum",values:e}},fs=function(e,i){return i},fa=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}},ns=function(e,i){return i},$a=function(e,i){return[e,...i]},ma=function(e,i,a){return{type:"Between",field:e,min:i,max:a}},da=function(e,i,a){return{type:"Comparison",operator:i,left:e,right:a}},ha=function(){return{type:"NoConflict"}},ya=function(){return{type:"Conflict"}},ls=function(e,i,a){return[i,a]},ba=function(e,i){return Jt(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}},Da=function(e,i,a,f){return{type:"ModComparison",left:e,modValue:i,operator:a,right:f}},Ca=function(e){return{name:"display",value:e}},wa=function(e,i){return{name:e,value:i}},Ea=function(e,i,a){return a},Sa=function(e,i,a){return{type:"Conditional",condition:e,consequent:i,alternate:a}},Ta=function(e){return{name:"behavior",value:e}},Fa=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"},Ma=function(){return"allowedTimeZones"},Za=function(){return"timePrecision"},Pa=function(){return"minAdvanceTime"},Ia=function(){return"maxAdvanceTime"},Va=function(){return"allowCrossDay"},za=function(){return"maxCrossDayDuration"},Na=function(){return"minDuration"},ka=function(){return"maxDuration"},Ba=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}},Ga=function(e){return{endDate:e}},Ka=function(e){return{count:e}},Xa=function(e){return{daysOfWeek:e}},Qa=function(e){return{dayOfMonth:e}},Ya=function(e){return{excludeDates:e}},et=function(e){return{timeZone:e}},rt=function(){return"daily"},st=function(){return"weekly"},it=function(){return"monthly"},at=function(){return"yearly"},os=function(e,i){return i},tt=function(e,i){return[e,...i]},cs=function(e,i){return i},ft=function(e,i){return[e,...i]},us=function(e,i){return i},nt=function(e,i){return{type:"FieldAccess",path:[e,...i]}},lt=function(e){return e},ot=function(e,i){return{type:"Duration",value:e,unit:i==="minute"?"minutes":i==="hour"?"hours":i==="day"?"days":i==="week"?"weeks":i}},ct=function(e){return parseInt(e.join(""),10)},ut=function(e){return e.join("")},pt=function(e){return{type:"Template",parts:e}},gt=function(e){return e},vt=function(e){return e.join("")},$t=function(){return!0},mt=function(){return!1},dt=function(e,i){return e+i.join("")},s=c.peg$currPos|0,_=[{line:1,column:1}],j=s,me=c.peg$maxFailExpected||[],n=c.peg$silentFails|0,K;if(c.startRule){if(!(c.startRule in $))throw new Error(`Can't start parsing from rule "`+c.startRule+'".');m=$[c.startRule]}function p(e,i){return{type:"literal",text:e,ignoreCase:i}}function M(e,i,a){return{type:"class",parts:e,inverted:i,ignoreCase:a}}function ht(){return{type:"end"}}function ps(e){var i=_[e],a;if(i)return i;if(e>=_.length)a=_.length-1;else for(a=e;!_[--a];);for(i=_[a],i={line:i.line,column:i.column};a<e;)t.charCodeAt(a)===10?(i.line++,i.column=1):i.column++,a++;return _[e]=i,i}function gs(e,i,a){var f=ps(e),o=ps(i),v={source:g,start:{offset:e,line:f.line,column:f.column},end:{offset:i,line:o.line,column:o.column}};return v}function l(e){s<j||(s>j&&(j=s,me=[]),me.push(e))}function yt(e,i,a){return new J(J.buildMessage(e,i),e,i,a)}function vs(){var e,i,a;for(e=s,u(),i=[],a=$s();a!==r;)i.push(a),a=$s();return a=u(),e=Qi(i),e}function $s(){var e;return e=bt(),e===r&&(e=At(),e===r&&(e=xt(),e===r&&(e=Dt(),e===r&&(e=wt(),e===r&&(e=qt(),e===r&&(e=Mt(),e===r&&(e=Pt(),e===r&&(e=Nt())))))))),e}function bt(){var e,i,a;return e=s,t.substr(s,5)===b?(i=b,s+=5):(i=r,n===0&&l(Mr)),i!==r?(u(),a=O(),a!==r?(u(),e=Yi(a)):(s=e,e=r)):(s=e,e=r),e}function At(){var e,i,a;return e=s,t.substr(s,5)===h?(i=h,s+=5):(i=r,n===0&&l(Zr)),i!==r?(u(),a=L(),a!==r?(u(),e=ea(a)):(s=e,e=r)):(s=e,e=r),e}function xt(){var e,i,a;return e=s,t.substr(s,12)===x?(i=x,s+=12):(i=r,n===0&&l(Pr)),i!==r?(u(),a=L(),a!==r?(u(),e=ra(a)):(s=e,e=r)):(s=e,e=r),e}function Dt(){var e,i,a,f;if(e=s,t.substr(s,7)===d?(i=d,s+=7):(i=r,n===0&&l(Ir)),i!==r){if(u(),a=[],f=ms(),f!==r)for(;f!==r;)a.push(f),f=ms();else a=r;a!==r?e=sa(a):(s=e,e=r)}else s=e,e=r;return e}function ms(){var e,i,a,f,o,v,D;if(e=s,u(),t.charCodeAt(s)===45?(i=y,s++):(i=r,n===0&&l(Ns)),i!==r)if(u(),a=O(),a!==r)if(t.charCodeAt(s)===58?(f=A,s++):(f=r,n===0&&l(U)),f!==r)if(u(),o=ds(),o!==r){for(v=[],D=hs();D!==r;)v.push(D),D=hs();D=u(),e=ia(a,o,v)}else s=e,e=r;else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function ds(){var e,i,a,f;return t.substr(s,6)===S?(e=S,s+=6):(e=r,n===0&&l(ks)),e===r&&(t.substr(s,6)===R?(e=R,s+=6):(e=r,n===0&&l(Bs)),e===r&&(t.substr(s,7)===P?(e=P,s+=7):(e=r,n===0&&l(Ws)),e===r&&(t.substr(s,5)===w?(e=w,s+=5):(e=r,n===0&&l(Us)),e===r&&(t.substr(s,4)===H?(e=H,s+=4):(e=r,n===0&&l(_s)),e===r&&(e=s,t.substr(s,8)===G?(i=G,s+=8):(i=r,n===0&&l(Js)),i!==r?(a=ds(),a!==r?e=aa(a):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t.substr(s,5)===Re?(i=Re,s+=5):(i=r,n===0&&l(Hs)),i!==r?(a=Ct(),a!==r?(t.charCodeAt(s)===41?(f=Ls,s++):(f=r,n===0&&l(Gs)),f!==r?e=ta(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r))))))),e}function Ct(){var e,i,a,f,o,v;if(e=s,i=O(),i!==r){for(a=[],f=s,t.charCodeAt(s)===44?(o=T,s++):(o=r,n===0&&l(F)),o!==r?(u(),v=O(),v!==r?f=fs(i,v):(s=f,f=r)):(s=f,f=r);f!==r;)a.push(f),f=s,t.charCodeAt(s)===44?(o=T,s++):(o=r,n===0&&l(F)),o!==r?(u(),v=O(),v!==r?f=fs(i,v):(s=f,f=r)):(s=f,f=r);e=fa(i,a)}else s=e,e=r;return e}function hs(){var e,i,a,f;return e=s,t.charCodeAt(s)===44?(i=T,s++):(i=r,n===0&&l(F)),i!==r?(u(),t.substr(s,8)===je?(a=je,s+=8):(a=r,n===0&&l(Ks)),a!==r?e=na():(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t.charCodeAt(s)===44?(i=T,s++):(i=r,n===0&&l(F)),i!==r?(u(),t.substr(s,8)===Oe?(a=Oe,s+=8):(a=r,n===0&&l(Xs)),a!==r?(u(),f=q(),f!==r?e=la(f):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t.charCodeAt(s)===44?(i=T,s++):(i=r,n===0&&l(F)),i!==r?(u(),t.substr(s,4)===qe?(a=qe,s+=4):(a=r,n===0&&l(Qs)),a!==r?(u(),f=E(),f!==r?e=oa(f):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t.charCodeAt(s)===44?(i=T,s++):(i=r,n===0&&l(F)),i!==r?(u(),t.substr(s,4)===Le?(a=Le,s+=4):(a=r,n===0&&l(Ys)),a!==r?(u(),f=E(),f!==r?e=ca(f):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)))),e}function wt(){var e,i,a,f;if(e=s,t.substr(s,9)===Me?(i=Me,s+=9):(i=r,n===0&&l(ei)),i!==r){for(u(),a=[],f=de();f!==r;)a.push(f),f=de();e=ua(a)}else s=e,e=r;return e}function de(){var e,i,a;return e=s,u(),i=s,n++,t.substr(s,8)===X?(a=X,s+=8):(a=r,n===0&&l(Vr)),a===r&&(t.substr(s,9)===Q?(a=Q,s+=9):(a=r,n===0&&l(zr)),a===r&&(t.substr(s,12)===Y?(a=Y,s+=12):(a=r,n===0&&l(Nr)),a===r&&(t.substr(s,10)===ee?(a=ee,s+=10):(a=r,n===0&&l(kr)),a===r&&(t.substr(s,5)===b?(a=b,s+=5):(a=r,n===0&&l(Mr)),a===r&&(t.substr(s,5)===h?(a=h,s+=5):(a=r,n===0&&l(Zr)),a===r&&(t.substr(s,12)===x?(a=x,s+=12):(a=r,n===0&&l(Pr)),a===r&&(t.substr(s,7)===d?(a=d,s+=7):(a=r,n===0&&l(Ir))))))))),n--,a===r?i=void 0:(s=i,i=r),i!==r?(a=Et(),a===r&&(a=St()),a!==r?e=pa(a):(s=e,e=r)):(s=e,e=r),e}function Et(){var e,i,a,f,o,v;if(e=s,t.substr(s,4)===re?(i=re,s+=4):(i=r,n===0&&l(Br)),i!==r)if(u(),a=he(),a!==r)if(t.charCodeAt(s)===58?(f=A,s++):(f=r,n===0&&l(U)),f!==r){if(u(),o=[],v=de(),v!==r)for(;v!==r;)o.push(v),v=de();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 St(){var e;return e=Tt(),e===r&&(e=Ft(),e===r&&(e=Rt(),e===r&&(e=jt(),e===r&&(e=he())))),e}function Tt(){var e,i,a,f,o,v;return e=s,i=Z(),i!==r?(u(),t.substr(s,2)===Ze?(a=Ze,s+=2):(a=r,n===0&&l(ri)),a!==r?(u(),t.charCodeAt(s)===91?(f=se,s++):(f=r,n===0&&l(ge)),f!==r?(u(),o=ys(),o!==r?(u(),t.charCodeAt(s)===93?(v=ie,s++):(v=r,n===0&&l(ve)),v!==r?(u(),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 ys(){var e,i,a,f,o,v;if(e=s,i=q(),i!==r){for(a=[],f=s,u(),t.charCodeAt(s)===44?(o=T,s++):(o=r,n===0&&l(F)),o!==r?(u(),v=q(),v!==r?f=ns(i,v):(s=f,f=r)):(s=f,f=r);f!==r;)a.push(f),f=s,u(),t.charCodeAt(s)===44?(o=T,s++):(o=r,n===0&&l(F)),o!==r?(u(),v=q(),v!==r?f=ns(i,v):(s=f,f=r)):(s=f,f=r);e=$a(i,a)}else s=e,e=r;return e}function Ft(){var e,i,a,f,o,v;return e=s,i=Z(),i!==r?(u(),t.substr(s,7)===Pe?(a=Pe,s+=7):(a=r,n===0&&l(si)),a!==r?(u(),f=q(),f!==r?(u(),t.substr(s,3)===I?(o=I,s+=3):(o=r,n===0&&l(ye)),o!==r?(u(),v=q(),v!==r?(u(),e=ma(i,f,v)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Rt(){var e,i,a,f;return e=s,i=Z(),i!==r?(u(),a=_t(),a!==r?(u(),f=q(),f!==r?(u(),e=da(i,a,f)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function jt(){var e,i,a,f,o,v;return e=s,t.substr(s,2)===Ie?(i=Ie,s+=2):(i=r,n===0&&l(ii)),i!==r?(u(),t.substr(s,8)===ae?(a=ae,s+=8):(a=r,n===0&&l(Wr)),a!==r?(u(),t.substr(s,4)===te?(f=te,s+=4):(f=r,n===0&&l(Ur)),f!==r?(u(),t.substr(s,5)===fe?(o=fe,s+=5):(o=r,n===0&&l(_r)),o!==r?(u(),t.substr(s,6)===ne?(v=ne,s+=6):(v=r,n===0&&l(Jr)),v!==r?(u(),e=ha()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,t.substr(s,8)===ae?(i=ae,s+=8):(i=r,n===0&&l(Wr)),i!==r?(u(),t.substr(s,4)===te?(a=te,s+=4):(a=r,n===0&&l(Ur)),a!==r?(u(),t.substr(s,5)===fe?(f=fe,s+=5):(f=r,n===0&&l(_r)),f!==r?(u(),t.substr(s,6)===ne?(o=ne,s+=6):(o=r,n===0&&l(Jr)),o!==r?(u(),e=ya()):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)),e}function he(){var e,i,a,f,o,v;if(e=s,i=Ee(),i!==r){for(a=[],f=s,u(),t.substr(s,3)===I?(o=I,s+=3):(o=r,n===0&&l(ye)),o===r&&(t.substr(s,2)===le?(o=le,s+=2):(o=r,n===0&&l(Hr))),o!==r?(u(),v=Ee(),v!==r?f=ls(i,o,v):(s=f,f=r)):(s=f,f=r);f!==r;)a.push(f),f=s,u(),t.substr(s,3)===I?(o=I,s+=3):(o=r,n===0&&l(ye)),o===r&&(t.substr(s,2)===le?(o=le,s+=2):(o=r,n===0&&l(Hr))),o!==r?(u(),v=Ee(),v!==r?f=ls(i,o,v):(s=f,f=r)):(s=f,f=r);e=ba(i,a)}else s=e,e=r;return e}function Ee(){var e,i,a;return e=s,t.substr(s,3)===Ve?(i=Ve,s+=3):(i=r,n===0&&l(ai)),i!==r?(u(),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,f,o;return e=Ot(),e===r&&(e=s,i=Z(),i!==r?(a=u(),t.substr(s,2)===V?(f=V,s+=2):(f=r,n===0&&l(be)),f===r&&(t.substr(s,6)===z?(f=z,s+=6):(f=r,n===0&&l(Ae)),f===r&&(t.substr(s,6)===N?(f=N,s+=6):(f=r,n===0&&l(xe)),f===r&&(t.substr(s,10)===k?(f=k,s+=10):(f=r,n===0&&l(De)),f===r&&(t.charCodeAt(s)===62?(f=ze,s++):(f=r,n===0&&l(Gr)),f===r&&(t.substr(s,2)===B?(f=B,s+=2):(f=r,n===0&&l(Ce)),f===r&&(t.charCodeAt(s)===60?(f=Ne,s++):(f=r,n===0&&l(Kr)),f===r&&(t.substr(s,2)===W?(f=W,s+=2):(f=r,n===0&&l(we))))))))),f!==r?(u(),o=q(),o!==r?(u(),e=xa(i,f,o)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,i=Z(),i!==r?(a=u(),i=[i,a],e=i):(s=e,e=r))),e}function Ot(){var e,i,a,f,o,v;return e=s,i=Z(),i!==r?(u(),t.substr(s,3)===oe?(a=oe,s+=3):(a=r,n===0&&l(Xr)),a!==r?(u(),f=q(),f!==r?(u(),t.substr(s,2)===V?(o=V,s+=2):(o=r,n===0&&l(be)),o===r&&(t.substr(s,6)===z?(o=z,s+=6):(o=r,n===0&&l(Ae)),o===r&&(t.substr(s,6)===N?(o=N,s+=6):(o=r,n===0&&l(xe)),o===r&&(t.substr(s,10)===k?(o=k,s+=10):(o=r,n===0&&l(De)),o===r&&(t.charCodeAt(s)===62?(o=ze,s++):(o=r,n===0&&l(Gr)),o===r&&(t.substr(s,2)===B?(o=B,s+=2):(o=r,n===0&&l(Ce)),o===r&&(t.charCodeAt(s)===60?(o=Ne,s++):(o=r,n===0&&l(Kr)),o===r&&(t.substr(s,2)===W?(o=W,s+=2):(o=r,n===0&&l(we))))))))),o!==r?(u(),v=q(),v!==r?(u(),e=Da(i,f,o,v)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function qt(){var e,i,a,f;if(e=s,t.substr(s,8)===X?(i=X,s+=8):(i=r,n===0&&l(Vr)),i!==r){if(u(),a=[],f=As(),f!==r)for(;f!==r;)a.push(f),f=As();else a=r;a!==r?e=Ca(a):(s=e,e=r)}else s=e,e=r;return e}function As(){var e,i,a,f;return e=s,u(),t.substr(s,5)===ke?(i=ke,s+=5):(i=r,n===0&&l(ti)),i===r&&(t.substr(s,4)===Be?(i=Be,s+=4):(i=r,n===0&&l(fi)),i===r&&(t.substr(s,5)===We?(i=We,s+=5):(i=r,n===0&&l(ni)),i===r&&(t.substr(s,11)===Ue?(i=Ue,s+=11):(i=r,n===0&&l(li))))),i!==r?(t.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(U)),a!==r?(u(),f=Se(),f!==r?(u(),e=wa(i,f)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Se(){var e;return e=Lt(),e===r&&(e=Ut(),e===r&&(e=L())),e}function Lt(){var e,i,a,f,o,v,D,C;return e=s,t.substr(s,4)===re?(i=re,s+=4):(i=r,n===0&&l(Br)),i!==r?(u(),a=he(),a!==r?(t.charCodeAt(s)===58?(f=A,s++):(f=r,n===0&&l(U)),f!==r?(u(),o=Se(),o!==r?(v=s,u(),t.substr(s,5)===_e?(D=_e,s+=5):(D=r,n===0&&l(oi)),D!==r?(u(),C=Se(),C!==r?v=Ea(a,o,C):(s=v,v=r)):(s=v,v=r),v===r&&(v=null),e=Sa(a,o,v)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Mt(){var e,i,a,f;if(e=s,t.substr(s,9)===Q?(i=Q,s+=9):(i=r,n===0&&l(zr)),i!==r){if(u(),a=[],f=xs(),f!==r)for(;f!==r;)a.push(f),f=xs();else a=r;a!==r?e=Ta(a):(s=e,e=r)}else s=e,e=r;return e}function xs(){var e,i,a,f;return e=s,u(),t.substr(s,9)===Je?(i=Je,s+=9):(i=r,n===0&&l(ci)),i===r&&(t.substr(s,9)===He?(i=He,s+=9):(i=r,n===0&&l(ui)),i===r&&(t.substr(s,8)===Ge?(i=Ge,s+=8):(i=r,n===0&&l(pi)),i===r&&(t.substr(s,9)===Ke?(i=Ke,s+=9):(i=r,n===0&&l(gi))))),i!==r?(t.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(U)),a!==r?(u(),f=Zt(),f!==r?(u(),e=Fa(i,f)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Zt(){var e,i;return e=s,t.substr(s,4)===ce?(i=ce,s+=4):(i=r,n===0&&l(Qr)),i!==r&&(i=Ra()),e=i,e===r&&(e=s,t.substr(s,5)===ue?(i=ue,s+=5):(i=r,n===0&&l(Yr)),i!==r&&(i=ja()),e=i,e===r&&(e=he())),e}function Pt(){var e,i,a,f;if(e=s,t.substr(s,12)===Y?(i=Y,s+=12):(i=r,n===0&&l(Nr)),i!==r){if(u(),a=[],f=Ds(),f!==r)for(;f!==r;)a.push(f),f=Ds();else a=r;a!==r?e=Oa(a):(s=e,e=r)}else s=e,e=r;return e}function Ds(){var e,i,a,f;return e=s,u(),i=It(),i!==r?(t.charCodeAt(s)===58?(a=A,s++):(a=r,n===0&&l(U)),a!==r?(u(),f=Vt(),f!==r?(u(),e=qa(i,f)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function It(){var e,i;return e=s,t.substr(s,8)===Xe?(i=Xe,s+=8):(i=r,n===0&&l(vi)),i!==r&&(i=La()),e=i,e===r&&(e=s,t.substr(s,16)===Qe?(i=Qe,s+=16):(i=r,n===0&&l($i)),i!==r&&(i=Ma()),e=i,e===r&&(e=s,t.substr(s,13)===Ye?(i=Ye,s+=13):(i=r,n===0&&l(mi)),i!==r&&(i=Za()),e=i,e===r&&(e=s,t.substr(s,14)===er?(i=er,s+=14):(i=r,n===0&&l(di)),i!==r&&(i=Pa()),e=i,e===r&&(e=s,t.substr(s,14)===rr?(i=rr,s+=14):(i=r,n===0&&l(hi)),i!==r&&(i=Ia()),e=i,e===r&&(e=s,t.substr(s,13)===sr?(i=sr,s+=13):(i=r,n===0&&l(yi)),i!==r&&(i=Va()),e=i,e===r&&(e=s,t.substr(s,19)===ir?(i=ir,s+=19):(i=r,n===0&&l(bi)),i!==r&&(i=za()),e=i,e===r&&(e=s,t.substr(s,11)===ar?(i=ar,s+=11):(i=r,n===0&&l(Ai)),i!==r&&(i=Na()),e=i,e===r&&(e=s,t.substr(s,11)===tr?(i=tr,s+=11):(i=r,n===0&&l(xi)),i!==r&&(i=ka()),e=i,e===r&&(e=s,t.substr(s,12)===fr?(i=fr,s+=12):(i=r,n===0&&l(Di)),i!==r&&(i=Ba()),e=i,e===r&&(e=s,t.substr(s,11)===nr?(i=nr,s+=11):(i=r,n===0&&l(Ci)),i!==r&&(i=Wa()),e=i,e===r&&(e=O()))))))))))),e}function Vt(){var e;return e=ws(),e===r&&(e=zt(),e===r&&(e=Es(),e===r&&(e=L(),e===r&&(e=E(),e===r&&(e=Ts(),e===r&&(e=O())))))),e}function zt(){var e,i,a,f;return e=s,i=E(),i!==r?(u(),t.substr(s,2)===lr?(a=lr,s+=2):(a=r,n===0&&l(wi)),a!==r?(u(),f=E(),f!==r?e=Ua(i,f):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Nt(){var e,i,a,f;if(e=s,t.substr(s,10)===ee?(i=ee,s+=10):(i=r,n===0&&l(kr)),i!==r){if(u(),a=[],f=Cs(),f!==r)for(;f!==r;)a.push(f),f=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,u(),t.substr(s,10)===or?(i=or,s+=10):(i=r,n===0&&l(Ei)),i!==r?(u(),a=kt(),a!==r?(u(),e=Ja(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,9)===cr?(i=cr,s+=9):(i=r,n===0&&l(Si)),i!==r?(u(),a=E(),a!==r?(u(),e=Ha(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,8)===ur?(i=ur,s+=8):(i=r,n===0&&l(Ti)),i!==r?(u(),a=L(),a!==r?(u(),e=Ga(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,6)===pr?(i=pr,s+=6):(i=r,n===0&&l(Fi)),i!==r?(u(),a=E(),a!==r?(u(),e=Ka(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,11)===gr?(i=gr,s+=11):(i=r,n===0&&l(Ri)),i!==r?(u(),a=Bt(),a!==r?(u(),e=Xa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,11)===vr?(i=vr,s+=11):(i=r,n===0&&l(ji)),i!==r?(u(),a=E(),a!==r?(u(),e=Qa(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,13)===$r?(i=$r,s+=13):(i=r,n===0&&l(Oi)),i!==r?(u(),a=Wt(),a!==r?(u(),e=Ya(a)):(s=e,e=r)):(s=e,e=r),e===r&&(e=s,u(),t.substr(s,9)===mr?(i=mr,s+=9):(i=r,n===0&&l(qi)),i!==r?(u(),a=L(),a!==r?(u(),e=et(a)):(s=e,e=r)):(s=e,e=r)))))))),e}function kt(){var e,i;return e=s,t.substr(s,5)===dr?(i=dr,s+=5):(i=r,n===0&&l(Li)),i!==r&&(i=rt()),e=i,e===r&&(e=s,t.substr(s,6)===hr?(i=hr,s+=6):(i=r,n===0&&l(Mi)),i!==r&&(i=st()),e=i,e===r&&(e=s,t.substr(s,7)===yr?(i=yr,s+=7):(i=r,n===0&&l(Zi)),i!==r&&(i=it()),e=i,e===r&&(e=s,t.substr(s,6)===br?(i=br,s+=6):(i=r,n===0&&l(Pi)),i!==r&&(i=at()),e=i))),e}function Bt(){var e,i,a,f,o,v,D,C;if(e=s,t.charCodeAt(s)===91?(i=se,s++):(i=r,n===0&&l(ge)),i!==r)if(u(),a=E(),a!==r){for(f=[],o=s,v=u(),t.charCodeAt(s)===44?(D=T,s++):(D=r,n===0&&l(F)),D!==r?(u(),C=E(),C!==r?o=os(a,C):(s=o,o=r)):(s=o,o=r);o!==r;)f.push(o),o=s,v=u(),t.charCodeAt(s)===44?(D=T,s++):(D=r,n===0&&l(F)),D!==r?(u(),C=E(),C!==r?o=os(a,C):(s=o,o=r)):(s=o,o=r);o=u(),t.charCodeAt(s)===93?(v=ie,s++):(v=r,n===0&&l(ve)),v!==r?e=tt(a,f):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function Wt(){var e,i,a,f,o,v,D,C;if(e=s,t.charCodeAt(s)===91?(i=se,s++):(i=r,n===0&&l(ge)),i!==r)if(u(),a=L(),a!==r){for(f=[],o=s,v=u(),t.charCodeAt(s)===44?(D=T,s++):(D=r,n===0&&l(F)),D!==r?(u(),C=L(),C!==r?o=cs(a,C):(s=o,o=r)):(s=o,o=r);o!==r;)f.push(o),o=s,v=u(),t.charCodeAt(s)===44?(D=T,s++):(D=r,n===0&&l(F)),D!==r?(u(),C=L(),C!==r?o=cs(a,C):(s=o,o=r)):(s=o,o=r);o=u(),t.charCodeAt(s)===93?(v=ie,s++):(v=r,n===0&&l(ve)),v!==r?e=ft(a,f):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function Z(){var e,i,a,f,o,v;if(e=s,i=O(),i!==r){for(a=[],f=s,t.charCodeAt(s)===46?(o=Ar,s++):(o=r,n===0&&l(es)),o!==r?(v=O(),v!==r?f=us(i,v):(s=f,f=r)):(s=f,f=r);f!==r;)a.push(f),f=s,t.charCodeAt(s)===46?(o=Ar,s++):(o=r,n===0&&l(es)),o!==r?(v=O(),v!==r?f=us(i,v):(s=f,f=r)):(s=f,f=r);e=nt(i,a)}else s=e,e=r;return e}function q(){var e;return e=ws(),e===r&&(e=Es(),e===r&&(e=E(),e===r&&(e=L(),e===r&&(e=Ts(),e===r&&(e=O()))))),e}function ws(){var e,i,a,f;return e=s,t.charCodeAt(s)===91?(i=se,s++):(i=r,n===0&&l(ge)),i!==r?(u(),a=ys(),a!==r?(u(),t.charCodeAt(s)===93?(f=ie,s++):(f=r,n===0&&l(ve)),f!==r?e=lt(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?(u(),t.substr(s,7)===xr?(a=xr,s+=7):(a=r,n===0&&l(Ii)),a===r&&(t.substr(s,6)===Dr?(a=Dr,s+=6):(a=r,n===0&&l(Vi)),a===r&&(t.substr(s,5)===Cr?(a=Cr,s+=5):(a=r,n===0&&l(zi)),a===r&&(t.substr(s,4)===wr?(a=wr,s+=4):(a=r,n===0&&l(Ni)),a===r&&(t.substr(s,4)===Er?(a=Er,s+=4):(a=r,n===0&&l(ki)),a===r&&(t.substr(s,3)===Sr?(a=Sr,s+=3):(a=r,n===0&&l(Bi)),a===r&&(t.substr(s,5)===Tr?(a=Tr,s+=5):(a=r,n===0&&l(Wi)),a===r&&(t.substr(s,4)===Fr?(a=Fr,s+=4):(a=r,n===0&&l(Ui))))))))),a!==r?e=ot(i,a):(s=e,e=r)):(s=e,e=r),e}function E(){var e,i,a;if(e=s,i=[],a=t.charAt(s),Rr.test(a)?s++:(a=r,n===0&&l(rs)),a!==r)for(;a!==r;)i.push(a),a=t.charAt(s),Rr.test(a)?s++:(a=r,n===0&&l(rs));else i=r;return i!==r&&(i=ct(i)),e=i,e}function L(){var e,i,a,f;if(e=s,t.charCodeAt(s)===34?(i=pe,s++):(i=r,n===0&&l($e)),i!==r){for(a=[],f=t.charAt(s),jr.test(f)?s++:(f=r,n===0&&l(ss));f!==r;)a.push(f),f=t.charAt(s),jr.test(f)?s++:(f=r,n===0&&l(ss));t.charCodeAt(s)===34?(f=pe,s++):(f=r,n===0&&l($e)),f!==r?e=ut(a):(s=e,e=r)}else s=e,e=r;return e}function Ut(){var e,i,a,f;if(e=s,t.charCodeAt(s)===34?(i=pe,s++):(i=r,n===0&&l($e)),i!==r){if(a=[],f=Ss(),f!==r)for(;f!==r;)a.push(f),f=Ss();else a=r;a!==r?(t.charCodeAt(s)===34?(f=pe,s++):(f=r,n===0&&l($e)),f!==r?e=pt(a):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;return e}function Ss(){var e,i,a,f;if(e=s,t.charCodeAt(s)===123?(i=Ms,s++):(i=r,n===0&&l(_i)),i!==r?(a=Z(),a!==r?(t.charCodeAt(s)===125?(f=Zs,s++):(f=r,n===0&&l(Ji)),f!==r?e=gt(a):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e===r){if(e=s,i=[],a=t.charAt(s),Or.test(a)?s++:(a=r,n===0&&l(is)),a!==r)for(;a!==r;)i.push(a),a=t.charAt(s),Or.test(a)?s++:(a=r,n===0&&l(is));else i=r;i!==r&&(i=vt(i)),e=i}return e}function Ts(){var e,i;return e=s,t.substr(s,4)===ce?(i=ce,s+=4):(i=r,n===0&&l(Qr)),i!==r&&(i=$t()),e=i,e===r&&(e=s,t.substr(s,5)===ue?(i=ue,s+=5):(i=r,n===0&&l(Yr)),i!==r&&(i=mt()),e=i),e}function O(){var e,i,a,f;if(e=s,i=t.charAt(s),Is.test(i)?s++:(i=r,n===0&&l(Hi)),i!==r){for(a=[],f=t.charAt(s),qr.test(f)?s++:(f=r,n===0&&l(as));f!==r;)a.push(f),f=t.charAt(s),qr.test(f)?s++:(f=r,n===0&&l(as));e=dt(i,a)}else s=e,e=r;return e}function _t(){var e;return t.substr(s,2)===B?(e=B,s+=2):(e=r,n===0&&l(Ce)),e===r&&(t.substr(s,2)===W?(e=W,s+=2):(e=r,n===0&&l(we)),e===r&&(e=t.charAt(s),Vs.test(e)?s++:(e=r,n===0&&l(Gi)),e===r&&(t.substr(s,2)===V?(e=V,s+=2):(e=r,n===0&&l(be)),e===r&&(t.substr(s,6)===z?(e=z,s+=6):(e=r,n===0&&l(Ae)),e===r&&(t.substr(s,6)===N?(e=N,s+=6):(e=r,n===0&&l(xe)),e===r&&(t.substr(s,10)===k?(e=k,s+=10):(e=r,n===0&&l(De)),e===r&&(t.substr(s,3)===oe?(e=oe,s+=3):(e=r,n===0&&l(Xr))))))))),e}function u(){var e,i;for(e=[],i=Fs(),i===r&&(i=Rs());i!==r;)e.push(i),i=Fs(),i===r&&(i=Rs());return e}function Fs(){var e;return e=t.charAt(s),zs.test(e)?s++:(e=r,n===0&&l(Ki)),e}function Rs(){var e,i,a,f;if(e=s,t.charCodeAt(s)===35?(i=Ps,s++):(i=r,n===0&&l(Xi)),i!==r){for(a=[],f=t.charAt(s),Lr.test(f)?s++:(f=r,n===0&&l(ts));f!==r;)a.push(f),f=t.charAt(s),Lr.test(f)?s++:(f=r,n===0&&l(ts));i=[i,a],e=i}else s=e,e=r;return e}function Jt(e,i){return i.reduce((a,[f,o])=>({type:"BinaryExpression",operator:f,left:a,right:o}),e)}if(K=m(),c.peg$library)return{peg$result:K,peg$currPos:s,peg$FAILED:r,peg$maxFailExpected:me,peg$maxFailPos:j};if(K!==r&&s===t.length)return K;throw K!==r&&s<t.length&&l(ht()),yt(me,j<t.length?t.charAt(j):null,j<t.length?gs(j,j+1):gs(j,j))}function Fe(t){try{const c=Gt(t);return Kt(c)}catch(c){throw new Error(`Failed to parse Event DSL: ${c.message}`)}}function Kt(t){const c=(t.validate||[]).map(g=>Array.isArray(g)&&g.length===2&&Array.isArray(g[0])?g[1]:g),r=(t.behavior||[]).map(g=>{if(g&&typeof g=="object"&&"value"in g){const $=g.value;if(Array.isArray($)&&$.length===2){const m=$[0],b=$[1];if(m?.type==="FieldAccess"&&Array.isArray(m.path)&&m.path.length===1){const h=m.path[0];if(h==="true"&&(!b||b.length===0))return{...g,value:!0};if(h==="false"&&(!b||b.length===0))return{...g,value:!1}}}}return g});return{type:t.type||"",name:t.name||"",description:t.description,fields:t.fields||[],validate:c,display:t.display||[],behavior:r,constraints:t.constraints||[],recurring:t.recurring}}function js(t,c={}){const{includeSchema:r=!0,includeTitle:g=!0,includeDescription:$=!0}=c,m={type:"object"};r&&(m.$schema="http://json-schema.org/draft-07/schema#"),g&&t.name&&(m.title=t.name),$&&t.description&&(m.description=t.description);const b={},h=[];return t.fields.forEach(x=>{const d=Xt(x);b[x.name]=d,x.required&&h.push(x.name)}),m.properties=b,h.length>0&&(m.required=h),m.additionalProperties=!1,m}function Xt(t){const c={},r=Os(t.type);return Object.assign(c,r),t.default!==void 0&&(c.default=t.default),t.min!==void 0&&(c.type==="array"?c.minItems=t.min:c.type==="number"?c.minimum=t.min:c.type==="string"&&(c.minLength=t.min)),t.max!==void 0&&(c.type==="array"?c.maxItems=t.max:c.type==="number"?c.maximum=t.max:c.type==="string"&&(c.maxLength=t.max)),c}function Os(t){return t==="string"?{type:"string"}:t==="number"?{type:"number"}:t==="boolean"?{type:"boolean"}:t==="email"?{type:"string",format:"email"}:t==="text"?{type:"string"}:typeof t=="object"&&t.type==="list"?{type:"array",items:Os(t.itemType)}:typeof t=="object"&&t.type==="enum"?{type:"string",enum:t.values}:{type:"string"}}class Qt{compileDSL(c){const r=Fe(c);return this.compileFromAST([r])}compileFromAST(c){return{types:c.map(r=>this.compileType(r)),validators:[]}}compileType(c){const r=js(c),g=c.validate||[],$=c.display||[],m=c.behavior||[],b=c.constraints||[],h=c.recurring,x=this.generateValidator(c),d=this.generateRenderer(c),y=this.generateBehavior(c);return{id:c.type,name:c.name,dataSchema:r,validationRules:g,displayRules:$,behaviorRules:m,constraints:b,recurring:h,validator:x,renderer:d,behavior:y}}generateValidator(c){return r=>{const g=[];return c.fields.forEach($=>{const m=r.data?.[$.name];$.required&&(m==null||m==="")&&g.push(`${$.name} 是必填字段`)}),{valid:g.length===0,errors:g.length>0?g:void 0}}}generateRenderer(c){return r=>{const g={title:r.title||c.name,color:r.color||"#4285f4",description:""};return(c.display||[]).forEach($=>{$.name==="color"&&typeof $.value=="string"&&(g.color=$.value),$.name==="icon"&&typeof $.value=="string"&&(g.icon=$.value)}),g}}generateBehavior(c){const r={draggable:!0,resizable:!1,editable:!0,deletable:!0};return(c.behavior||[]).forEach(g=>{g.name==="draggable"&&typeof g.value=="boolean"&&(r.draggable=g.value),g.name==="resizable"&&typeof g.value=="boolean"&&(r.resizable=g.value),g.name==="editable"&&typeof g.value=="boolean"&&(r.editable=g.value),g.name==="deletable"&&typeof g.value=="boolean"&&(r.deletable=g.value)}),r}compileValidators(c){return c.map(r=>({name:r.name,validate:r.validate}))}}function Yt(t,c={}){const{includeJSDoc:r=!0,exportType:g=!0,typeNamePrefix:$="",typeNameSuffix:m="Extra"}=c,b=`${$}${rf(t.type)}${m}`,h=[];r&&(h.push("/**"),t.name&&h.push(` * ${t.name}`),t.description&&h.push(` * ${t.description}`),h.push(" *"),h.push(" * 从 Event DSL 自动生成"),h.push(" */"));const x=g?"export ":"";return h.push(`${x}interface ${b} {`),t.fields.forEach(d=>{const y=ef(d),A=d.required?"":"?",S=d.name;if(r){const R=[];d.default!==void 0&&R.push(`@default ${JSON.stringify(d.default)}`),d.min!==void 0&&R.push(`@min ${d.min}`),d.max!==void 0&&R.push(`@max ${d.max}`),R.length>0&&(h.push(" /**"),R.forEach(P=>{h.push(` * ${P}`)}),h.push(" */"))}h.push(` ${S}${A}: ${y};`)}),h.push("}"),h.join(`
9
+ `)}function ef(t){return qs(t.type)}function qs(t){if(typeof t=="string")switch(t){case"string":case"text":return"string";case"number":return"number";case"boolean":return"boolean";case"email":return"string";default:return"string"}if(typeof t=="object"){if(t.type==="list")return`${qs(t.itemType)}[]`;if(t.type==="enum")return t.values.map(r=>`'${r}'`).join(" | ")}return"unknown"}function rf(t){return t.split(/[-_\s]/).map(c=>c.charAt(0).toUpperCase()+c.slice(1).toLowerCase()).join("")}class sf{constructor(c={}){this.defaultDurationMinutes=c.defaultDurationMinutes??60,this.timeZone=c.timeZone}generateEvent(c,r){const g=this.normalizeDefinition(c),$={};if(Array.isArray(g.fields))for(const G of g.fields)$[G.name]=this.generateFieldValue(G);const m=new Date,b=r?.startTime?new Date(r.startTime):m,h=this.resolveDurationMinutes(g)*60*1e3,x=r?.endTime?new Date(r.endTime):new Date(b.getTime()+h),d={...$,...r?.data||{}},y=this.generateTitle(g,d,r?.title),{color:A,icon:S}=this.resolveDisplay(g),R=this.resolveRecurring(g),P={createdAt:m,updatedAt:m,...r?.metadata||{}},w={id:r?.id||this.generateId(),type:g.type,title:y,startTime:b,endTime:x,data:d,metadata:P};r?.color!==void 0?w.color=r.color:A!==void 0&&(w.color=A),r?.icon!==void 0?w.icon=r.icon:S!==void 0&&(w.icon=S);const H=r?.timeZone||this.timeZone;return H&&(w.timeZone=H),r?.allDay!==void 0&&(w.allDay=r.allDay),r?.recurring!==void 0?w.recurring=r.recurring:R&&(w.recurring=R),r?.parentEventId&&(w.parentEventId=r.parentEventId),r?.recurrenceId&&(w.recurrenceId=r.recurrenceId),w}generateEvents(c,r,g){const $=[];for(let m=0;m<r;m++){const b=g?g(m):void 0;$.push(this.generateEvent(c,b))}return $}normalizeDefinition(c){if(typeof c=="string")return Fe(c);if("id"in c&&!("type"in c)){const r=c,g=r.fields.map(m=>({name:m.name,type:this.mapDSLFieldType(m),required:m.required,default:m.default})),$=[];return r.display&&(r.display.color&&$.push({name:"color",value:r.display.color}),r.display.icon&&$.push({name:"icon",value:r.display.icon}),r.display.titleTemplate&&$.push({name:"title",value:r.display.titleTemplate})),{type:r.id,name:r.name,description:r.description,fields:g,validate:[],display:$,behavior:[]}}return c}mapDSLFieldType(c){return c.type==="enum"?{type:"enum",values:c.enum||[]}:c.type==="array"?{type:"list",itemType:c.items?this.mapDSLFieldType(c.items):"string"}:c.type==="number"||c.type==="boolean"?c.type:"string"}generateFieldValue(c){if(c.default!==void 0)return c.default;const r=c.type;if(typeof r=="string")switch(r){case"string":case"text":return"";case"number":return 0;case"boolean":return!1;case"email":return"user@example.com";default:return""}if(typeof r=="object"){if(r.type==="list")return[];if(r.type==="enum")return r.values&&r.values.length>0?r.values[0]:""}return null}generateTitle(c,r,g){if(g!==void 0)return g;const $=c.display?.find(m=>m.name==="title");if($){if(typeof $.value=="string")return this.interpolateTemplate($.value,r,c.name);if($.value&&typeof $.value=="object"&&"type"in $.value&&$.value.type==="Template")return $.value.parts.map(m=>{if(typeof m=="string")return m;if(m&&typeof m=="object"&&m.type==="FieldAccess"){const b=this.resolvePath(r,m.path);return b!==void 0?String(b):""}return""}).join("")}return c.name||c.type||"Untitled Event"}resolveDisplay(c){let r,g;for(const $ of c.display||[])$.name==="color"&&typeof $.value=="string"&&(r=$.value),$.name==="icon"&&typeof $.value=="string"&&(g=$.value);return{color:r,icon:g}}resolveDurationMinutes(c){const r=c.behavior?.find(g=>g.name==="defaultDuration");return r&&typeof r.value=="number"?r.value:this.defaultDurationMinutes}resolveRecurring(c){if(!c.recurring)return;const r=c.recurring,g={frequency:r.frequency,interval:r.interval||1};return r.endDate&&(g.endDate=new Date(r.endDate)),r.count!==void 0&&(g.count=r.count),r.daysOfWeek&&(g.daysOfWeek=r.daysOfWeek),r.dayOfMonth&&(g.dayOfMonth=r.dayOfMonth),r.excludeDates&&(g.excludeDates=r.excludeDates.map($=>new Date($))),g}interpolateTemplate(c,r,g){return c.replace(/\$\{([^}]+)\}/g,(m,b)=>{const h=b.trim(),x=r[h];return x!==void 0?String(x):""})||g}resolvePath(c,r){let g=c;for(const $ of r){if(g==null)return;g=g[$]}return g}generateId(){return`event-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}}exports.EventDSLCompiler=Qt;exports.EventDataGenerator=sf;exports.generateJSONSchema=js;exports.generateTypeScript=Yt;exports.parseEventDSL=Fe;
10
10
  //# sourceMappingURL=index.cjs.map