webgal-parser 4.3.13 → 4.4.4
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/build/cjs/config/scriptConfig.d.ts +1 -1
- package/build/cjs/configParser/configParser.d.ts +1 -0
- package/build/cjs/index.d.ts +5 -2
- package/build/cjs/index.js +1148 -17042
- package/build/cjs/interface/sceneInterface.d.ts +3 -1
- package/build/cjs/parser4/index.d.ts +1 -0
- package/build/cjs/scriptParser/subSceneScanner.d.ts +1 -1
- package/build/es/config/scriptConfig.d.ts +1 -1
- package/build/es/configParser/configParser.d.ts +1 -0
- package/build/es/index.d.ts +5 -2
- package/build/es/index.js +1147 -17043
- package/build/es/interface/sceneInterface.d.ts +3 -1
- package/build/es/parser4/index.d.ts +1 -0
- package/build/es/scriptParser/subSceneScanner.d.ts +1 -1
- package/build/types/config/scriptConfig.d.ts +6 -0
- package/build/types/configParser/configParser.d.ts +1 -0
- package/build/types/index.d.ts +13 -0
- package/build/types/interface/assets.d.ts +12 -0
- package/build/types/interface/runtimeInterface.d.ts +9 -0
- package/build/types/interface/sceneInterface.d.ts +96 -0
- package/build/types/parser4/index.d.ts +1 -0
- package/build/types/sceneParser.d.ts +14 -0
- package/build/types/scriptParser/argsParser.d.ts +9 -0
- package/build/types/scriptParser/assetsScanner.d.ts +9 -0
- package/build/types/scriptParser/commandParser.d.ts +9 -0
- package/build/types/scriptParser/contentParser.d.ts +9 -0
- package/build/types/scriptParser/scriptParser.d.ts +9 -0
- package/build/types/scriptParser/subSceneScanner.d.ts +7 -0
- package/build/umd/index.global.js +1776 -0
- package/package.json +40 -35
- package/src/config/scriptConfig.ts +46 -44
- package/src/configParser/configParser.ts +60 -0
- package/src/index.ts +42 -25
- package/src/interface/assets.ts +12 -12
- package/src/interface/runtimeInterface.ts +9 -9
- package/src/interface/sceneInterface.ts +103 -101
- package/src/parser4/index.ts +158 -0
- package/src/sceneParser.ts +47 -47
- package/src/scriptParser/argsParser.ts +68 -62
- package/src/scriptParser/assetsScanner.ts +72 -72
- package/src/scriptParser/commandParser.ts +57 -57
- package/src/scriptParser/contentParser.ts +66 -66
- package/src/scriptParser/scriptParser.ts +87 -87
- package/src/scriptParser/subSceneScanner.ts +23 -23
- package/.babelrc +0 -14
- package/build/cjs/index.js.map +0 -1
- package/build/es/index.js.map +0 -1
- package/rollup.config.js +0 -48
- package/test/parser.test.ts +0 -130
- package/tsconfig.json +0 -29
- package/tsconfig.node.json +0 -10
|
@@ -0,0 +1,1776 @@
|
|
|
1
|
+
var webgalParser = (function (exports) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var commandType;
|
|
5
|
+
(function (commandType) {
|
|
6
|
+
commandType[commandType["say"] = 0] = "say";
|
|
7
|
+
commandType[commandType["changeBg"] = 1] = "changeBg";
|
|
8
|
+
commandType[commandType["changeFigure"] = 2] = "changeFigure";
|
|
9
|
+
commandType[commandType["bgm"] = 3] = "bgm";
|
|
10
|
+
commandType[commandType["video"] = 4] = "video";
|
|
11
|
+
commandType[commandType["pixi"] = 5] = "pixi";
|
|
12
|
+
commandType[commandType["pixiInit"] = 6] = "pixiInit";
|
|
13
|
+
commandType[commandType["intro"] = 7] = "intro";
|
|
14
|
+
commandType[commandType["miniAvatar"] = 8] = "miniAvatar";
|
|
15
|
+
commandType[commandType["changeScene"] = 9] = "changeScene";
|
|
16
|
+
commandType[commandType["choose"] = 10] = "choose";
|
|
17
|
+
commandType[commandType["end"] = 11] = "end";
|
|
18
|
+
commandType[commandType["setComplexAnimation"] = 12] = "setComplexAnimation";
|
|
19
|
+
commandType[commandType["setFilter"] = 13] = "setFilter";
|
|
20
|
+
commandType[commandType["label"] = 14] = "label";
|
|
21
|
+
commandType[commandType["jumpLabel"] = 15] = "jumpLabel";
|
|
22
|
+
commandType[commandType["chooseLabel"] = 16] = "chooseLabel";
|
|
23
|
+
commandType[commandType["setVar"] = 17] = "setVar";
|
|
24
|
+
commandType[commandType["if"] = 18] = "if";
|
|
25
|
+
commandType[commandType["callScene"] = 19] = "callScene";
|
|
26
|
+
commandType[commandType["showVars"] = 20] = "showVars";
|
|
27
|
+
commandType[commandType["unlockCg"] = 21] = "unlockCg";
|
|
28
|
+
commandType[commandType["unlockBgm"] = 22] = "unlockBgm";
|
|
29
|
+
commandType[commandType["filmMode"] = 23] = "filmMode";
|
|
30
|
+
commandType[commandType["setTextbox"] = 24] = "setTextbox";
|
|
31
|
+
commandType[commandType["setAnimation"] = 25] = "setAnimation";
|
|
32
|
+
commandType[commandType["playEffect"] = 26] = "playEffect";
|
|
33
|
+
commandType[commandType["setTempAnimation"] = 27] = "setTempAnimation";
|
|
34
|
+
commandType[commandType["comment"] = 28] = "comment";
|
|
35
|
+
commandType[commandType["setTransform"] = 29] = "setTransform";
|
|
36
|
+
commandType[commandType["setTransition"] = 30] = "setTransition";
|
|
37
|
+
})(commandType || (commandType = {}));
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 处理命令
|
|
41
|
+
* @param commandRaw
|
|
42
|
+
* @param ADD_NEXT_ARG_LIST
|
|
43
|
+
* @param SCRIPT_CONFIG
|
|
44
|
+
* @return {parsedCommand} 处理后的命令
|
|
45
|
+
*/
|
|
46
|
+
const commandParser = (commandRaw, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) => {
|
|
47
|
+
let returnCommand = {
|
|
48
|
+
type: commandType.say,
|
|
49
|
+
additionalArgs: []
|
|
50
|
+
};
|
|
51
|
+
// 开始处理命令内容
|
|
52
|
+
const type = getCommandType(commandRaw, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);
|
|
53
|
+
returnCommand.type = type;
|
|
54
|
+
// 如果是对话,加上额外的参数
|
|
55
|
+
if (type === commandType.say) {
|
|
56
|
+
returnCommand.additionalArgs.push({
|
|
57
|
+
key: "speaker",
|
|
58
|
+
value: commandRaw
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
returnCommand = addNextArg(returnCommand, type, ADD_NEXT_ARG_LIST);
|
|
62
|
+
return returnCommand;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 根据command原始值判断是什么命令
|
|
66
|
+
* @param command command原始值
|
|
67
|
+
* @param ADD_NEXT_ARG_LIST
|
|
68
|
+
* @param SCRIPT_CONFIG
|
|
69
|
+
* @return {commandType} 得到的command类型
|
|
70
|
+
*/
|
|
71
|
+
function getCommandType(command, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) {
|
|
72
|
+
// if (command.match(/if/)) {
|
|
73
|
+
// return commandType.if;
|
|
74
|
+
// }
|
|
75
|
+
const commandMap = new Map();
|
|
76
|
+
SCRIPT_CONFIG.forEach((e) => {
|
|
77
|
+
commandMap.set(e.scriptString, e.scriptType);
|
|
78
|
+
});
|
|
79
|
+
if (commandMap.has(command)) {
|
|
80
|
+
return commandMap.get(command);
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
return commandType.say;
|
|
84
|
+
}
|
|
85
|
+
function addNextArg(commandToParse, thisCommandType, ADD_NEXT_ARG_LIST) {
|
|
86
|
+
if (ADD_NEXT_ARG_LIST.includes(thisCommandType)) {
|
|
87
|
+
commandToParse.additionalArgs.push({
|
|
88
|
+
key: "next",
|
|
89
|
+
value: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return commandToParse;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 内置资源类型的枚举
|
|
97
|
+
*/
|
|
98
|
+
var fileType;
|
|
99
|
+
(function (fileType) {
|
|
100
|
+
fileType[fileType["background"] = 0] = "background";
|
|
101
|
+
fileType[fileType["bgm"] = 1] = "bgm";
|
|
102
|
+
fileType[fileType["figure"] = 2] = "figure";
|
|
103
|
+
fileType[fileType["scene"] = 3] = "scene";
|
|
104
|
+
fileType[fileType["tex"] = 4] = "tex";
|
|
105
|
+
fileType[fileType["vocal"] = 5] = "vocal";
|
|
106
|
+
fileType[fileType["video"] = 6] = "video";
|
|
107
|
+
})(fileType || (fileType = {}));
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 参数解析器
|
|
111
|
+
* @param argsRaw 原始参数字符串
|
|
112
|
+
* @param assetSetter
|
|
113
|
+
* @return {Array<arg>} 解析后的参数列表
|
|
114
|
+
*/
|
|
115
|
+
function argsParser(argsRaw, assetSetter) {
|
|
116
|
+
const returnArrayList = [];
|
|
117
|
+
// 处理参数
|
|
118
|
+
// 不要去空格
|
|
119
|
+
let newArgsRaw = argsRaw.replace(/ /g, " ");
|
|
120
|
+
// 分割参数列表
|
|
121
|
+
let rawArgsList = newArgsRaw.split(" -");
|
|
122
|
+
// 去除空字符串
|
|
123
|
+
rawArgsList = rawArgsList.filter((e) => {
|
|
124
|
+
return e !== "";
|
|
125
|
+
});
|
|
126
|
+
rawArgsList.forEach((e) => {
|
|
127
|
+
const equalSignIndex = e.indexOf('=');
|
|
128
|
+
let argName = e.slice(0, equalSignIndex);
|
|
129
|
+
let argValue = e.slice(equalSignIndex + 1);
|
|
130
|
+
if (equalSignIndex < 0) {
|
|
131
|
+
argName = e;
|
|
132
|
+
argValue = undefined;
|
|
133
|
+
}
|
|
134
|
+
// 判断是不是语音参数
|
|
135
|
+
if (e.match(/.ogg|.mp3|.wav/)) {
|
|
136
|
+
returnArrayList.push({
|
|
137
|
+
key: "vocal",
|
|
138
|
+
value: assetSetter(e, fileType.vocal)
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// 判断是不是省略参数
|
|
143
|
+
if (argValue === undefined) {
|
|
144
|
+
returnArrayList.push({
|
|
145
|
+
key: argName,
|
|
146
|
+
value: true
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
// 是字符串描述的布尔值
|
|
151
|
+
if (argValue === "true" || argValue === "false") {
|
|
152
|
+
returnArrayList.push({
|
|
153
|
+
key: argName,
|
|
154
|
+
value: argValue === "true"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
// 是数字
|
|
159
|
+
if (!isNaN(Number(argValue))) {
|
|
160
|
+
returnArrayList.push({
|
|
161
|
+
key: argName,
|
|
162
|
+
value: Number(argValue)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// 是普通参数
|
|
167
|
+
returnArrayList.push({
|
|
168
|
+
key: argName,
|
|
169
|
+
value: argValue
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return returnArrayList;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 解析语句内容的函数,主要作用是把文件名改为绝对地址或相对地址(根据使用情况而定)
|
|
181
|
+
* @param contentRaw 原始语句内容
|
|
182
|
+
* @param type 语句类型
|
|
183
|
+
* @param assetSetter
|
|
184
|
+
* @return {string} 解析后的语句内容
|
|
185
|
+
*/
|
|
186
|
+
const contentParser = (contentRaw, type, assetSetter) => {
|
|
187
|
+
if (contentRaw === "none" || contentRaw === "") {
|
|
188
|
+
return "";
|
|
189
|
+
}
|
|
190
|
+
switch (type) {
|
|
191
|
+
case commandType.playEffect:
|
|
192
|
+
return assetSetter(contentRaw, fileType.vocal);
|
|
193
|
+
case commandType.changeBg:
|
|
194
|
+
return assetSetter(contentRaw, fileType.background);
|
|
195
|
+
case commandType.changeFigure:
|
|
196
|
+
return assetSetter(contentRaw, fileType.figure);
|
|
197
|
+
case commandType.bgm:
|
|
198
|
+
return assetSetter(contentRaw, fileType.bgm);
|
|
199
|
+
case commandType.callScene:
|
|
200
|
+
return assetSetter(contentRaw, fileType.scene);
|
|
201
|
+
case commandType.changeScene:
|
|
202
|
+
return assetSetter(contentRaw, fileType.scene);
|
|
203
|
+
case commandType.miniAvatar:
|
|
204
|
+
return assetSetter(contentRaw, fileType.figure);
|
|
205
|
+
case commandType.video:
|
|
206
|
+
return assetSetter(contentRaw, fileType.video);
|
|
207
|
+
case commandType.choose:
|
|
208
|
+
return getChooseContent(contentRaw, assetSetter);
|
|
209
|
+
case commandType.unlockBgm:
|
|
210
|
+
return assetSetter(contentRaw, fileType.bgm);
|
|
211
|
+
case commandType.unlockCg:
|
|
212
|
+
return assetSetter(contentRaw, fileType.background);
|
|
213
|
+
default:
|
|
214
|
+
return contentRaw;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
function getChooseContent(contentRaw, assetSetter) {
|
|
218
|
+
const chooseList = contentRaw.split("|");
|
|
219
|
+
const chooseKeyList = [];
|
|
220
|
+
const chooseValueList = [];
|
|
221
|
+
for (const e of chooseList) {
|
|
222
|
+
chooseKeyList.push(e.split(":")[0] ?? "");
|
|
223
|
+
chooseValueList.push(e.split(":")[1] ?? "");
|
|
224
|
+
}
|
|
225
|
+
const parsedChooseList = chooseValueList.map((e) => {
|
|
226
|
+
if (e.match(/\./)) {
|
|
227
|
+
return assetSetter(e, fileType.scene);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return e;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
let ret = "";
|
|
234
|
+
for (let i = 0; i < chooseKeyList.length; i++) {
|
|
235
|
+
if (i !== 0) {
|
|
236
|
+
ret = ret + "|";
|
|
237
|
+
}
|
|
238
|
+
ret = ret + `${chooseKeyList[i]}:${parsedChooseList[i]}`;
|
|
239
|
+
}
|
|
240
|
+
return ret;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 根据语句类型、语句内容、参数列表,扫描该语句可能携带的资源
|
|
245
|
+
* @param command 语句类型
|
|
246
|
+
* @param content 语句内容
|
|
247
|
+
* @param args 参数列表
|
|
248
|
+
* @return {Array<IAsset>} 语句携带的参数列表
|
|
249
|
+
*/
|
|
250
|
+
const assetsScanner = (command, content, args) => {
|
|
251
|
+
const returnAssetsList = [];
|
|
252
|
+
if (command === commandType.say) {
|
|
253
|
+
args.forEach((e) => {
|
|
254
|
+
if (e.key === 'vocal') {
|
|
255
|
+
returnAssetsList.push({
|
|
256
|
+
name: e.value,
|
|
257
|
+
url: e.value,
|
|
258
|
+
lineNumber: 0,
|
|
259
|
+
type: fileType.vocal,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
if (content === 'none' || content === '') {
|
|
265
|
+
return returnAssetsList;
|
|
266
|
+
}
|
|
267
|
+
// 处理语句携带的资源
|
|
268
|
+
if (command === commandType.changeBg) {
|
|
269
|
+
returnAssetsList.push({
|
|
270
|
+
name: content,
|
|
271
|
+
url: content,
|
|
272
|
+
lineNumber: 0,
|
|
273
|
+
type: fileType.background,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (command === commandType.changeFigure) {
|
|
277
|
+
returnAssetsList.push({
|
|
278
|
+
name: content,
|
|
279
|
+
url: content,
|
|
280
|
+
lineNumber: 0,
|
|
281
|
+
type: fileType.figure,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (command === commandType.miniAvatar) {
|
|
285
|
+
returnAssetsList.push({
|
|
286
|
+
name: content,
|
|
287
|
+
url: content,
|
|
288
|
+
lineNumber: 0,
|
|
289
|
+
type: fileType.figure,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
if (command === commandType.video) {
|
|
293
|
+
returnAssetsList.push({
|
|
294
|
+
name: content,
|
|
295
|
+
url: content,
|
|
296
|
+
lineNumber: 0,
|
|
297
|
+
type: fileType.video,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (command === commandType.bgm) {
|
|
301
|
+
returnAssetsList.push({
|
|
302
|
+
name: content,
|
|
303
|
+
url: content,
|
|
304
|
+
lineNumber: 0,
|
|
305
|
+
type: fileType.bgm,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return returnAssetsList;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* 扫描子场景
|
|
313
|
+
* @param content 语句内容
|
|
314
|
+
* @return {Array<string>} 子场景列表
|
|
315
|
+
*/
|
|
316
|
+
const subSceneScanner = (command, content) => {
|
|
317
|
+
const subSceneList = [];
|
|
318
|
+
if (command === commandType.changeScene || command === commandType.callScene) {
|
|
319
|
+
subSceneList.push(content);
|
|
320
|
+
}
|
|
321
|
+
if (command === commandType.choose) {
|
|
322
|
+
const chooseList = content.split("|");
|
|
323
|
+
const chooseValue = chooseList.map((e) => e.split(":")[1] ?? "");
|
|
324
|
+
chooseValue.forEach((e) => {
|
|
325
|
+
if (e.match(/\./)) {
|
|
326
|
+
subSceneList.push(e);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return subSceneList;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* 语句解析器
|
|
335
|
+
* @param sentenceRaw 原始语句
|
|
336
|
+
* @param assetSetter
|
|
337
|
+
* @param ADD_NEXT_ARG_LIST
|
|
338
|
+
* @param SCRIPT_CONFIG
|
|
339
|
+
*/
|
|
340
|
+
const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) => {
|
|
341
|
+
let command; // 默认为对话
|
|
342
|
+
let content; // 语句内容
|
|
343
|
+
let subScene; // 语句携带的子场景(可能没有)
|
|
344
|
+
const args = []; // 语句参数列表
|
|
345
|
+
let sentenceAssets; // 语句携带的资源列表
|
|
346
|
+
let parsedCommand; // 解析后的命令
|
|
347
|
+
let commandRaw;
|
|
348
|
+
// 正式开始解析
|
|
349
|
+
// 去分号,前面已做,这里不再需要
|
|
350
|
+
let newSentenceRaw = sentenceRaw.split(";")[0];
|
|
351
|
+
if (newSentenceRaw === "") {
|
|
352
|
+
// 注释提前返回
|
|
353
|
+
return {
|
|
354
|
+
command: commandType.comment,
|
|
355
|
+
commandRaw: "comment",
|
|
356
|
+
content: sentenceRaw.split(";")[1] ?? "",
|
|
357
|
+
args: [{ key: "next", value: true }],
|
|
358
|
+
sentenceAssets: [],
|
|
359
|
+
subScene: [] // 语句携带的子场景
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
// 截取命令
|
|
363
|
+
const getCommandResult = /:/.exec(newSentenceRaw);
|
|
364
|
+
/**
|
|
365
|
+
* 拆分命令和语句,同时处理连续对话。
|
|
366
|
+
*/
|
|
367
|
+
// 没有command,说明这是一条连续对话或单条语句
|
|
368
|
+
if (getCommandResult === null) {
|
|
369
|
+
commandRaw = newSentenceRaw;
|
|
370
|
+
parsedCommand = commandParser(commandRaw, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);
|
|
371
|
+
command = parsedCommand.type;
|
|
372
|
+
for (const e of parsedCommand.additionalArgs) {
|
|
373
|
+
// 由于是连续对话,所以我们去除 speaker 参数。
|
|
374
|
+
if (command === commandType.say && e.key === "speaker") {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
args.push(e);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
commandRaw = newSentenceRaw.substring(0, getCommandResult.index);
|
|
382
|
+
// 划分命令区域和content区域
|
|
383
|
+
newSentenceRaw = newSentenceRaw.substring(getCommandResult.index + 1, newSentenceRaw.length);
|
|
384
|
+
parsedCommand = commandParser(commandRaw, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);
|
|
385
|
+
command = parsedCommand.type;
|
|
386
|
+
for (const e of parsedCommand.additionalArgs) {
|
|
387
|
+
args.push(e);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// 截取参数区域
|
|
391
|
+
const getArgsResult = / -/.exec(newSentenceRaw);
|
|
392
|
+
// 获取到参数
|
|
393
|
+
if (getArgsResult) {
|
|
394
|
+
const argsRaw = newSentenceRaw.substring(getArgsResult.index, sentenceRaw.length);
|
|
395
|
+
newSentenceRaw = newSentenceRaw.substring(0, getArgsResult.index);
|
|
396
|
+
for (const e of argsParser(argsRaw, assetSetter)) {
|
|
397
|
+
args.push(e);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
content = contentParser(newSentenceRaw, command, assetSetter); // 将语句内容里的文件名转为相对或绝对路径
|
|
401
|
+
sentenceAssets = assetsScanner(command, content, args); // 扫描语句携带资源
|
|
402
|
+
subScene = subSceneScanner(command, content); // 扫描语句携带子场景
|
|
403
|
+
return {
|
|
404
|
+
command: command,
|
|
405
|
+
commandRaw: commandRaw,
|
|
406
|
+
content: content,
|
|
407
|
+
args: args,
|
|
408
|
+
sentenceAssets: sentenceAssets,
|
|
409
|
+
subScene: subScene // 语句携带的子场景
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
414
|
+
|
|
415
|
+
/** Detect free variable `global` from Node.js. */
|
|
416
|
+
|
|
417
|
+
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
418
|
+
|
|
419
|
+
var _freeGlobal = freeGlobal$1;
|
|
420
|
+
|
|
421
|
+
var freeGlobal = _freeGlobal;
|
|
422
|
+
|
|
423
|
+
/** Detect free variable `self`. */
|
|
424
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
425
|
+
|
|
426
|
+
/** Used as a reference to the global object. */
|
|
427
|
+
var root$4 = freeGlobal || freeSelf || Function('return this')();
|
|
428
|
+
|
|
429
|
+
var _root = root$4;
|
|
430
|
+
|
|
431
|
+
var root$3 = _root;
|
|
432
|
+
|
|
433
|
+
/** Built-in value references. */
|
|
434
|
+
var Symbol$2 = root$3.Symbol;
|
|
435
|
+
|
|
436
|
+
var _Symbol = Symbol$2;
|
|
437
|
+
|
|
438
|
+
var Symbol$1 = _Symbol;
|
|
439
|
+
|
|
440
|
+
/** Used for built-in method references. */
|
|
441
|
+
var objectProto$4 = Object.prototype;
|
|
442
|
+
|
|
443
|
+
/** Used to check objects for own properties. */
|
|
444
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Used to resolve the
|
|
448
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
449
|
+
* of values.
|
|
450
|
+
*/
|
|
451
|
+
var nativeObjectToString$1 = objectProto$4.toString;
|
|
452
|
+
|
|
453
|
+
/** Built-in value references. */
|
|
454
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
458
|
+
*
|
|
459
|
+
* @private
|
|
460
|
+
* @param {*} value The value to query.
|
|
461
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
462
|
+
*/
|
|
463
|
+
function getRawTag$1(value) {
|
|
464
|
+
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
|
|
465
|
+
tag = value[symToStringTag$1];
|
|
466
|
+
|
|
467
|
+
try {
|
|
468
|
+
value[symToStringTag$1] = undefined;
|
|
469
|
+
var unmasked = true;
|
|
470
|
+
} catch (e) {}
|
|
471
|
+
|
|
472
|
+
var result = nativeObjectToString$1.call(value);
|
|
473
|
+
if (unmasked) {
|
|
474
|
+
if (isOwn) {
|
|
475
|
+
value[symToStringTag$1] = tag;
|
|
476
|
+
} else {
|
|
477
|
+
delete value[symToStringTag$1];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
var _getRawTag = getRawTag$1;
|
|
484
|
+
|
|
485
|
+
/** Used for built-in method references. */
|
|
486
|
+
|
|
487
|
+
var objectProto$3 = Object.prototype;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Used to resolve the
|
|
491
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
492
|
+
* of values.
|
|
493
|
+
*/
|
|
494
|
+
var nativeObjectToString = objectProto$3.toString;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
498
|
+
*
|
|
499
|
+
* @private
|
|
500
|
+
* @param {*} value The value to convert.
|
|
501
|
+
* @returns {string} Returns the converted string.
|
|
502
|
+
*/
|
|
503
|
+
function objectToString$1(value) {
|
|
504
|
+
return nativeObjectToString.call(value);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
var _objectToString = objectToString$1;
|
|
508
|
+
|
|
509
|
+
var Symbol = _Symbol,
|
|
510
|
+
getRawTag = _getRawTag,
|
|
511
|
+
objectToString = _objectToString;
|
|
512
|
+
|
|
513
|
+
/** `Object#toString` result references. */
|
|
514
|
+
var nullTag = '[object Null]',
|
|
515
|
+
undefinedTag = '[object Undefined]';
|
|
516
|
+
|
|
517
|
+
/** Built-in value references. */
|
|
518
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
522
|
+
*
|
|
523
|
+
* @private
|
|
524
|
+
* @param {*} value The value to query.
|
|
525
|
+
* @returns {string} Returns the `toStringTag`.
|
|
526
|
+
*/
|
|
527
|
+
function baseGetTag$1(value) {
|
|
528
|
+
if (value == null) {
|
|
529
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
530
|
+
}
|
|
531
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
532
|
+
? getRawTag(value)
|
|
533
|
+
: objectToString(value);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
var _baseGetTag = baseGetTag$1;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Checks if `value` is the
|
|
540
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
541
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
542
|
+
*
|
|
543
|
+
* @static
|
|
544
|
+
* @memberOf _
|
|
545
|
+
* @since 0.1.0
|
|
546
|
+
* @category Lang
|
|
547
|
+
* @param {*} value The value to check.
|
|
548
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
549
|
+
* @example
|
|
550
|
+
*
|
|
551
|
+
* _.isObject({});
|
|
552
|
+
* // => true
|
|
553
|
+
*
|
|
554
|
+
* _.isObject([1, 2, 3]);
|
|
555
|
+
* // => true
|
|
556
|
+
*
|
|
557
|
+
* _.isObject(_.noop);
|
|
558
|
+
* // => true
|
|
559
|
+
*
|
|
560
|
+
* _.isObject(null);
|
|
561
|
+
* // => false
|
|
562
|
+
*/
|
|
563
|
+
|
|
564
|
+
function isObject$2(value) {
|
|
565
|
+
var type = typeof value;
|
|
566
|
+
return value != null && (type == 'object' || type == 'function');
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
var isObject_1 = isObject$2;
|
|
570
|
+
|
|
571
|
+
var baseGetTag = _baseGetTag,
|
|
572
|
+
isObject$1 = isObject_1;
|
|
573
|
+
|
|
574
|
+
/** `Object#toString` result references. */
|
|
575
|
+
var asyncTag = '[object AsyncFunction]',
|
|
576
|
+
funcTag = '[object Function]',
|
|
577
|
+
genTag = '[object GeneratorFunction]',
|
|
578
|
+
proxyTag = '[object Proxy]';
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Checks if `value` is classified as a `Function` object.
|
|
582
|
+
*
|
|
583
|
+
* @static
|
|
584
|
+
* @memberOf _
|
|
585
|
+
* @since 0.1.0
|
|
586
|
+
* @category Lang
|
|
587
|
+
* @param {*} value The value to check.
|
|
588
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
589
|
+
* @example
|
|
590
|
+
*
|
|
591
|
+
* _.isFunction(_);
|
|
592
|
+
* // => true
|
|
593
|
+
*
|
|
594
|
+
* _.isFunction(/abc/);
|
|
595
|
+
* // => false
|
|
596
|
+
*/
|
|
597
|
+
function isFunction$1(value) {
|
|
598
|
+
if (!isObject$1(value)) {
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
602
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
603
|
+
var tag = baseGetTag(value);
|
|
604
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
var isFunction_1 = isFunction$1;
|
|
608
|
+
|
|
609
|
+
var root$2 = _root;
|
|
610
|
+
|
|
611
|
+
/** Used to detect overreaching core-js shims. */
|
|
612
|
+
var coreJsData$1 = root$2['__core-js_shared__'];
|
|
613
|
+
|
|
614
|
+
var _coreJsData = coreJsData$1;
|
|
615
|
+
|
|
616
|
+
var coreJsData = _coreJsData;
|
|
617
|
+
|
|
618
|
+
/** Used to detect methods masquerading as native. */
|
|
619
|
+
var maskSrcKey = (function() {
|
|
620
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
621
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
622
|
+
}());
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Checks if `func` has its source masked.
|
|
626
|
+
*
|
|
627
|
+
* @private
|
|
628
|
+
* @param {Function} func The function to check.
|
|
629
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
630
|
+
*/
|
|
631
|
+
function isMasked$1(func) {
|
|
632
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
var _isMasked = isMasked$1;
|
|
636
|
+
|
|
637
|
+
/** Used for built-in method references. */
|
|
638
|
+
|
|
639
|
+
var funcProto$1 = Function.prototype;
|
|
640
|
+
|
|
641
|
+
/** Used to resolve the decompiled source of functions. */
|
|
642
|
+
var funcToString$1 = funcProto$1.toString;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Converts `func` to its source code.
|
|
646
|
+
*
|
|
647
|
+
* @private
|
|
648
|
+
* @param {Function} func The function to convert.
|
|
649
|
+
* @returns {string} Returns the source code.
|
|
650
|
+
*/
|
|
651
|
+
function toSource$1(func) {
|
|
652
|
+
if (func != null) {
|
|
653
|
+
try {
|
|
654
|
+
return funcToString$1.call(func);
|
|
655
|
+
} catch (e) {}
|
|
656
|
+
try {
|
|
657
|
+
return (func + '');
|
|
658
|
+
} catch (e) {}
|
|
659
|
+
}
|
|
660
|
+
return '';
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
var _toSource = toSource$1;
|
|
664
|
+
|
|
665
|
+
var isFunction = isFunction_1,
|
|
666
|
+
isMasked = _isMasked,
|
|
667
|
+
isObject = isObject_1,
|
|
668
|
+
toSource = _toSource;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Used to match `RegExp`
|
|
672
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
673
|
+
*/
|
|
674
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
675
|
+
|
|
676
|
+
/** Used to detect host constructors (Safari). */
|
|
677
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
678
|
+
|
|
679
|
+
/** Used for built-in method references. */
|
|
680
|
+
var funcProto = Function.prototype,
|
|
681
|
+
objectProto$2 = Object.prototype;
|
|
682
|
+
|
|
683
|
+
/** Used to resolve the decompiled source of functions. */
|
|
684
|
+
var funcToString = funcProto.toString;
|
|
685
|
+
|
|
686
|
+
/** Used to check objects for own properties. */
|
|
687
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
688
|
+
|
|
689
|
+
/** Used to detect if a method is native. */
|
|
690
|
+
var reIsNative = RegExp('^' +
|
|
691
|
+
funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
|
|
692
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
697
|
+
*
|
|
698
|
+
* @private
|
|
699
|
+
* @param {*} value The value to check.
|
|
700
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
701
|
+
* else `false`.
|
|
702
|
+
*/
|
|
703
|
+
function baseIsNative$1(value) {
|
|
704
|
+
if (!isObject(value) || isMasked(value)) {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
708
|
+
return pattern.test(toSource(value));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
var _baseIsNative = baseIsNative$1;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Gets the value at `key` of `object`.
|
|
715
|
+
*
|
|
716
|
+
* @private
|
|
717
|
+
* @param {Object} [object] The object to query.
|
|
718
|
+
* @param {string} key The key of the property to get.
|
|
719
|
+
* @returns {*} Returns the property value.
|
|
720
|
+
*/
|
|
721
|
+
|
|
722
|
+
function getValue$1(object, key) {
|
|
723
|
+
return object == null ? undefined : object[key];
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
var _getValue = getValue$1;
|
|
727
|
+
|
|
728
|
+
var baseIsNative = _baseIsNative,
|
|
729
|
+
getValue = _getValue;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Gets the native function at `key` of `object`.
|
|
733
|
+
*
|
|
734
|
+
* @private
|
|
735
|
+
* @param {Object} object The object to query.
|
|
736
|
+
* @param {string} key The key of the method to get.
|
|
737
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
738
|
+
*/
|
|
739
|
+
function getNative$3(object, key) {
|
|
740
|
+
var value = getValue(object, key);
|
|
741
|
+
return baseIsNative(value) ? value : undefined;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
var _getNative = getNative$3;
|
|
745
|
+
|
|
746
|
+
var getNative$2 = _getNative;
|
|
747
|
+
|
|
748
|
+
/* Built-in method references that are verified to be native. */
|
|
749
|
+
var nativeCreate$4 = getNative$2(Object, 'create');
|
|
750
|
+
|
|
751
|
+
var _nativeCreate = nativeCreate$4;
|
|
752
|
+
|
|
753
|
+
var nativeCreate$3 = _nativeCreate;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Removes all key-value entries from the hash.
|
|
757
|
+
*
|
|
758
|
+
* @private
|
|
759
|
+
* @name clear
|
|
760
|
+
* @memberOf Hash
|
|
761
|
+
*/
|
|
762
|
+
function hashClear$1() {
|
|
763
|
+
this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
|
|
764
|
+
this.size = 0;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
var _hashClear = hashClear$1;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Removes `key` and its value from the hash.
|
|
771
|
+
*
|
|
772
|
+
* @private
|
|
773
|
+
* @name delete
|
|
774
|
+
* @memberOf Hash
|
|
775
|
+
* @param {Object} hash The hash to modify.
|
|
776
|
+
* @param {string} key The key of the value to remove.
|
|
777
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
778
|
+
*/
|
|
779
|
+
|
|
780
|
+
function hashDelete$1(key) {
|
|
781
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
782
|
+
this.size -= result ? 1 : 0;
|
|
783
|
+
return result;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
var _hashDelete = hashDelete$1;
|
|
787
|
+
|
|
788
|
+
var nativeCreate$2 = _nativeCreate;
|
|
789
|
+
|
|
790
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
791
|
+
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
792
|
+
|
|
793
|
+
/** Used for built-in method references. */
|
|
794
|
+
var objectProto$1 = Object.prototype;
|
|
795
|
+
|
|
796
|
+
/** Used to check objects for own properties. */
|
|
797
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Gets the hash value for `key`.
|
|
801
|
+
*
|
|
802
|
+
* @private
|
|
803
|
+
* @name get
|
|
804
|
+
* @memberOf Hash
|
|
805
|
+
* @param {string} key The key of the value to get.
|
|
806
|
+
* @returns {*} Returns the entry value.
|
|
807
|
+
*/
|
|
808
|
+
function hashGet$1(key) {
|
|
809
|
+
var data = this.__data__;
|
|
810
|
+
if (nativeCreate$2) {
|
|
811
|
+
var result = data[key];
|
|
812
|
+
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
813
|
+
}
|
|
814
|
+
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
var _hashGet = hashGet$1;
|
|
818
|
+
|
|
819
|
+
var nativeCreate$1 = _nativeCreate;
|
|
820
|
+
|
|
821
|
+
/** Used for built-in method references. */
|
|
822
|
+
var objectProto = Object.prototype;
|
|
823
|
+
|
|
824
|
+
/** Used to check objects for own properties. */
|
|
825
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Checks if a hash value for `key` exists.
|
|
829
|
+
*
|
|
830
|
+
* @private
|
|
831
|
+
* @name has
|
|
832
|
+
* @memberOf Hash
|
|
833
|
+
* @param {string} key The key of the entry to check.
|
|
834
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
835
|
+
*/
|
|
836
|
+
function hashHas$1(key) {
|
|
837
|
+
var data = this.__data__;
|
|
838
|
+
return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
var _hashHas = hashHas$1;
|
|
842
|
+
|
|
843
|
+
var nativeCreate = _nativeCreate;
|
|
844
|
+
|
|
845
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
846
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Sets the hash `key` to `value`.
|
|
850
|
+
*
|
|
851
|
+
* @private
|
|
852
|
+
* @name set
|
|
853
|
+
* @memberOf Hash
|
|
854
|
+
* @param {string} key The key of the value to set.
|
|
855
|
+
* @param {*} value The value to set.
|
|
856
|
+
* @returns {Object} Returns the hash instance.
|
|
857
|
+
*/
|
|
858
|
+
function hashSet$1(key, value) {
|
|
859
|
+
var data = this.__data__;
|
|
860
|
+
this.size += this.has(key) ? 0 : 1;
|
|
861
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
862
|
+
return this;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
var _hashSet = hashSet$1;
|
|
866
|
+
|
|
867
|
+
var hashClear = _hashClear,
|
|
868
|
+
hashDelete = _hashDelete,
|
|
869
|
+
hashGet = _hashGet,
|
|
870
|
+
hashHas = _hashHas,
|
|
871
|
+
hashSet = _hashSet;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Creates a hash object.
|
|
875
|
+
*
|
|
876
|
+
* @private
|
|
877
|
+
* @constructor
|
|
878
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
879
|
+
*/
|
|
880
|
+
function Hash$1(entries) {
|
|
881
|
+
var index = -1,
|
|
882
|
+
length = entries == null ? 0 : entries.length;
|
|
883
|
+
|
|
884
|
+
this.clear();
|
|
885
|
+
while (++index < length) {
|
|
886
|
+
var entry = entries[index];
|
|
887
|
+
this.set(entry[0], entry[1]);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// Add methods to `Hash`.
|
|
892
|
+
Hash$1.prototype.clear = hashClear;
|
|
893
|
+
Hash$1.prototype['delete'] = hashDelete;
|
|
894
|
+
Hash$1.prototype.get = hashGet;
|
|
895
|
+
Hash$1.prototype.has = hashHas;
|
|
896
|
+
Hash$1.prototype.set = hashSet;
|
|
897
|
+
|
|
898
|
+
var _Hash = Hash$1;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Removes all key-value entries from the list cache.
|
|
902
|
+
*
|
|
903
|
+
* @private
|
|
904
|
+
* @name clear
|
|
905
|
+
* @memberOf ListCache
|
|
906
|
+
*/
|
|
907
|
+
|
|
908
|
+
function listCacheClear$1() {
|
|
909
|
+
this.__data__ = [];
|
|
910
|
+
this.size = 0;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
var _listCacheClear = listCacheClear$1;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Performs a
|
|
917
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
918
|
+
* comparison between two values to determine if they are equivalent.
|
|
919
|
+
*
|
|
920
|
+
* @static
|
|
921
|
+
* @memberOf _
|
|
922
|
+
* @since 4.0.0
|
|
923
|
+
* @category Lang
|
|
924
|
+
* @param {*} value The value to compare.
|
|
925
|
+
* @param {*} other The other value to compare.
|
|
926
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
927
|
+
* @example
|
|
928
|
+
*
|
|
929
|
+
* var object = { 'a': 1 };
|
|
930
|
+
* var other = { 'a': 1 };
|
|
931
|
+
*
|
|
932
|
+
* _.eq(object, object);
|
|
933
|
+
* // => true
|
|
934
|
+
*
|
|
935
|
+
* _.eq(object, other);
|
|
936
|
+
* // => false
|
|
937
|
+
*
|
|
938
|
+
* _.eq('a', 'a');
|
|
939
|
+
* // => true
|
|
940
|
+
*
|
|
941
|
+
* _.eq('a', Object('a'));
|
|
942
|
+
* // => false
|
|
943
|
+
*
|
|
944
|
+
* _.eq(NaN, NaN);
|
|
945
|
+
* // => true
|
|
946
|
+
*/
|
|
947
|
+
|
|
948
|
+
function eq$1(value, other) {
|
|
949
|
+
return value === other || (value !== value && other !== other);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
var eq_1 = eq$1;
|
|
953
|
+
|
|
954
|
+
var eq = eq_1;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
958
|
+
*
|
|
959
|
+
* @private
|
|
960
|
+
* @param {Array} array The array to inspect.
|
|
961
|
+
* @param {*} key The key to search for.
|
|
962
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
963
|
+
*/
|
|
964
|
+
function assocIndexOf$4(array, key) {
|
|
965
|
+
var length = array.length;
|
|
966
|
+
while (length--) {
|
|
967
|
+
if (eq(array[length][0], key)) {
|
|
968
|
+
return length;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return -1;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
var _assocIndexOf = assocIndexOf$4;
|
|
975
|
+
|
|
976
|
+
var assocIndexOf$3 = _assocIndexOf;
|
|
977
|
+
|
|
978
|
+
/** Used for built-in method references. */
|
|
979
|
+
var arrayProto = Array.prototype;
|
|
980
|
+
|
|
981
|
+
/** Built-in value references. */
|
|
982
|
+
var splice = arrayProto.splice;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Removes `key` and its value from the list cache.
|
|
986
|
+
*
|
|
987
|
+
* @private
|
|
988
|
+
* @name delete
|
|
989
|
+
* @memberOf ListCache
|
|
990
|
+
* @param {string} key The key of the value to remove.
|
|
991
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
992
|
+
*/
|
|
993
|
+
function listCacheDelete$1(key) {
|
|
994
|
+
var data = this.__data__,
|
|
995
|
+
index = assocIndexOf$3(data, key);
|
|
996
|
+
|
|
997
|
+
if (index < 0) {
|
|
998
|
+
return false;
|
|
999
|
+
}
|
|
1000
|
+
var lastIndex = data.length - 1;
|
|
1001
|
+
if (index == lastIndex) {
|
|
1002
|
+
data.pop();
|
|
1003
|
+
} else {
|
|
1004
|
+
splice.call(data, index, 1);
|
|
1005
|
+
}
|
|
1006
|
+
--this.size;
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
var _listCacheDelete = listCacheDelete$1;
|
|
1011
|
+
|
|
1012
|
+
var assocIndexOf$2 = _assocIndexOf;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Gets the list cache value for `key`.
|
|
1016
|
+
*
|
|
1017
|
+
* @private
|
|
1018
|
+
* @name get
|
|
1019
|
+
* @memberOf ListCache
|
|
1020
|
+
* @param {string} key The key of the value to get.
|
|
1021
|
+
* @returns {*} Returns the entry value.
|
|
1022
|
+
*/
|
|
1023
|
+
function listCacheGet$1(key) {
|
|
1024
|
+
var data = this.__data__,
|
|
1025
|
+
index = assocIndexOf$2(data, key);
|
|
1026
|
+
|
|
1027
|
+
return index < 0 ? undefined : data[index][1];
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
var _listCacheGet = listCacheGet$1;
|
|
1031
|
+
|
|
1032
|
+
var assocIndexOf$1 = _assocIndexOf;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Checks if a list cache value for `key` exists.
|
|
1036
|
+
*
|
|
1037
|
+
* @private
|
|
1038
|
+
* @name has
|
|
1039
|
+
* @memberOf ListCache
|
|
1040
|
+
* @param {string} key The key of the entry to check.
|
|
1041
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1042
|
+
*/
|
|
1043
|
+
function listCacheHas$1(key) {
|
|
1044
|
+
return assocIndexOf$1(this.__data__, key) > -1;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
var _listCacheHas = listCacheHas$1;
|
|
1048
|
+
|
|
1049
|
+
var assocIndexOf = _assocIndexOf;
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Sets the list cache `key` to `value`.
|
|
1053
|
+
*
|
|
1054
|
+
* @private
|
|
1055
|
+
* @name set
|
|
1056
|
+
* @memberOf ListCache
|
|
1057
|
+
* @param {string} key The key of the value to set.
|
|
1058
|
+
* @param {*} value The value to set.
|
|
1059
|
+
* @returns {Object} Returns the list cache instance.
|
|
1060
|
+
*/
|
|
1061
|
+
function listCacheSet$1(key, value) {
|
|
1062
|
+
var data = this.__data__,
|
|
1063
|
+
index = assocIndexOf(data, key);
|
|
1064
|
+
|
|
1065
|
+
if (index < 0) {
|
|
1066
|
+
++this.size;
|
|
1067
|
+
data.push([key, value]);
|
|
1068
|
+
} else {
|
|
1069
|
+
data[index][1] = value;
|
|
1070
|
+
}
|
|
1071
|
+
return this;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
var _listCacheSet = listCacheSet$1;
|
|
1075
|
+
|
|
1076
|
+
var listCacheClear = _listCacheClear,
|
|
1077
|
+
listCacheDelete = _listCacheDelete,
|
|
1078
|
+
listCacheGet = _listCacheGet,
|
|
1079
|
+
listCacheHas = _listCacheHas,
|
|
1080
|
+
listCacheSet = _listCacheSet;
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Creates an list cache object.
|
|
1084
|
+
*
|
|
1085
|
+
* @private
|
|
1086
|
+
* @constructor
|
|
1087
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1088
|
+
*/
|
|
1089
|
+
function ListCache$1(entries) {
|
|
1090
|
+
var index = -1,
|
|
1091
|
+
length = entries == null ? 0 : entries.length;
|
|
1092
|
+
|
|
1093
|
+
this.clear();
|
|
1094
|
+
while (++index < length) {
|
|
1095
|
+
var entry = entries[index];
|
|
1096
|
+
this.set(entry[0], entry[1]);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// Add methods to `ListCache`.
|
|
1101
|
+
ListCache$1.prototype.clear = listCacheClear;
|
|
1102
|
+
ListCache$1.prototype['delete'] = listCacheDelete;
|
|
1103
|
+
ListCache$1.prototype.get = listCacheGet;
|
|
1104
|
+
ListCache$1.prototype.has = listCacheHas;
|
|
1105
|
+
ListCache$1.prototype.set = listCacheSet;
|
|
1106
|
+
|
|
1107
|
+
var _ListCache = ListCache$1;
|
|
1108
|
+
|
|
1109
|
+
var getNative$1 = _getNative,
|
|
1110
|
+
root$1 = _root;
|
|
1111
|
+
|
|
1112
|
+
/* Built-in method references that are verified to be native. */
|
|
1113
|
+
var Map$2 = getNative$1(root$1, 'Map');
|
|
1114
|
+
|
|
1115
|
+
var _Map = Map$2;
|
|
1116
|
+
|
|
1117
|
+
var Hash = _Hash,
|
|
1118
|
+
ListCache = _ListCache,
|
|
1119
|
+
Map$1 = _Map;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Removes all key-value entries from the map.
|
|
1123
|
+
*
|
|
1124
|
+
* @private
|
|
1125
|
+
* @name clear
|
|
1126
|
+
* @memberOf MapCache
|
|
1127
|
+
*/
|
|
1128
|
+
function mapCacheClear$1() {
|
|
1129
|
+
this.size = 0;
|
|
1130
|
+
this.__data__ = {
|
|
1131
|
+
'hash': new Hash,
|
|
1132
|
+
'map': new (Map$1 || ListCache),
|
|
1133
|
+
'string': new Hash
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
var _mapCacheClear = mapCacheClear$1;
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1141
|
+
*
|
|
1142
|
+
* @private
|
|
1143
|
+
* @param {*} value The value to check.
|
|
1144
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1145
|
+
*/
|
|
1146
|
+
|
|
1147
|
+
function isKeyable$1(value) {
|
|
1148
|
+
var type = typeof value;
|
|
1149
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1150
|
+
? (value !== '__proto__')
|
|
1151
|
+
: (value === null);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
var _isKeyable = isKeyable$1;
|
|
1155
|
+
|
|
1156
|
+
var isKeyable = _isKeyable;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Gets the data for `map`.
|
|
1160
|
+
*
|
|
1161
|
+
* @private
|
|
1162
|
+
* @param {Object} map The map to query.
|
|
1163
|
+
* @param {string} key The reference key.
|
|
1164
|
+
* @returns {*} Returns the map data.
|
|
1165
|
+
*/
|
|
1166
|
+
function getMapData$4(map, key) {
|
|
1167
|
+
var data = map.__data__;
|
|
1168
|
+
return isKeyable(key)
|
|
1169
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1170
|
+
: data.map;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
var _getMapData = getMapData$4;
|
|
1174
|
+
|
|
1175
|
+
var getMapData$3 = _getMapData;
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Removes `key` and its value from the map.
|
|
1179
|
+
*
|
|
1180
|
+
* @private
|
|
1181
|
+
* @name delete
|
|
1182
|
+
* @memberOf MapCache
|
|
1183
|
+
* @param {string} key The key of the value to remove.
|
|
1184
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1185
|
+
*/
|
|
1186
|
+
function mapCacheDelete$1(key) {
|
|
1187
|
+
var result = getMapData$3(this, key)['delete'](key);
|
|
1188
|
+
this.size -= result ? 1 : 0;
|
|
1189
|
+
return result;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
var _mapCacheDelete = mapCacheDelete$1;
|
|
1193
|
+
|
|
1194
|
+
var getMapData$2 = _getMapData;
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* Gets the map value for `key`.
|
|
1198
|
+
*
|
|
1199
|
+
* @private
|
|
1200
|
+
* @name get
|
|
1201
|
+
* @memberOf MapCache
|
|
1202
|
+
* @param {string} key The key of the value to get.
|
|
1203
|
+
* @returns {*} Returns the entry value.
|
|
1204
|
+
*/
|
|
1205
|
+
function mapCacheGet$1(key) {
|
|
1206
|
+
return getMapData$2(this, key).get(key);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
var _mapCacheGet = mapCacheGet$1;
|
|
1210
|
+
|
|
1211
|
+
var getMapData$1 = _getMapData;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Checks if a map value for `key` exists.
|
|
1215
|
+
*
|
|
1216
|
+
* @private
|
|
1217
|
+
* @name has
|
|
1218
|
+
* @memberOf MapCache
|
|
1219
|
+
* @param {string} key The key of the entry to check.
|
|
1220
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1221
|
+
*/
|
|
1222
|
+
function mapCacheHas$1(key) {
|
|
1223
|
+
return getMapData$1(this, key).has(key);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
var _mapCacheHas = mapCacheHas$1;
|
|
1227
|
+
|
|
1228
|
+
var getMapData = _getMapData;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Sets the map `key` to `value`.
|
|
1232
|
+
*
|
|
1233
|
+
* @private
|
|
1234
|
+
* @name set
|
|
1235
|
+
* @memberOf MapCache
|
|
1236
|
+
* @param {string} key The key of the value to set.
|
|
1237
|
+
* @param {*} value The value to set.
|
|
1238
|
+
* @returns {Object} Returns the map cache instance.
|
|
1239
|
+
*/
|
|
1240
|
+
function mapCacheSet$1(key, value) {
|
|
1241
|
+
var data = getMapData(this, key),
|
|
1242
|
+
size = data.size;
|
|
1243
|
+
|
|
1244
|
+
data.set(key, value);
|
|
1245
|
+
this.size += data.size == size ? 0 : 1;
|
|
1246
|
+
return this;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
var _mapCacheSet = mapCacheSet$1;
|
|
1250
|
+
|
|
1251
|
+
var mapCacheClear = _mapCacheClear,
|
|
1252
|
+
mapCacheDelete = _mapCacheDelete,
|
|
1253
|
+
mapCacheGet = _mapCacheGet,
|
|
1254
|
+
mapCacheHas = _mapCacheHas,
|
|
1255
|
+
mapCacheSet = _mapCacheSet;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Creates a map cache object to store key-value pairs.
|
|
1259
|
+
*
|
|
1260
|
+
* @private
|
|
1261
|
+
* @constructor
|
|
1262
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1263
|
+
*/
|
|
1264
|
+
function MapCache$1(entries) {
|
|
1265
|
+
var index = -1,
|
|
1266
|
+
length = entries == null ? 0 : entries.length;
|
|
1267
|
+
|
|
1268
|
+
this.clear();
|
|
1269
|
+
while (++index < length) {
|
|
1270
|
+
var entry = entries[index];
|
|
1271
|
+
this.set(entry[0], entry[1]);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
// Add methods to `MapCache`.
|
|
1276
|
+
MapCache$1.prototype.clear = mapCacheClear;
|
|
1277
|
+
MapCache$1.prototype['delete'] = mapCacheDelete;
|
|
1278
|
+
MapCache$1.prototype.get = mapCacheGet;
|
|
1279
|
+
MapCache$1.prototype.has = mapCacheHas;
|
|
1280
|
+
MapCache$1.prototype.set = mapCacheSet;
|
|
1281
|
+
|
|
1282
|
+
var _MapCache = MapCache$1;
|
|
1283
|
+
|
|
1284
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1285
|
+
|
|
1286
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Adds `value` to the array cache.
|
|
1290
|
+
*
|
|
1291
|
+
* @private
|
|
1292
|
+
* @name add
|
|
1293
|
+
* @memberOf SetCache
|
|
1294
|
+
* @alias push
|
|
1295
|
+
* @param {*} value The value to cache.
|
|
1296
|
+
* @returns {Object} Returns the cache instance.
|
|
1297
|
+
*/
|
|
1298
|
+
function setCacheAdd$1(value) {
|
|
1299
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
1300
|
+
return this;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
var _setCacheAdd = setCacheAdd$1;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Checks if `value` is in the array cache.
|
|
1307
|
+
*
|
|
1308
|
+
* @private
|
|
1309
|
+
* @name has
|
|
1310
|
+
* @memberOf SetCache
|
|
1311
|
+
* @param {*} value The value to search for.
|
|
1312
|
+
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
1313
|
+
*/
|
|
1314
|
+
|
|
1315
|
+
function setCacheHas$1(value) {
|
|
1316
|
+
return this.__data__.has(value);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
var _setCacheHas = setCacheHas$1;
|
|
1320
|
+
|
|
1321
|
+
var MapCache = _MapCache,
|
|
1322
|
+
setCacheAdd = _setCacheAdd,
|
|
1323
|
+
setCacheHas = _setCacheHas;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
*
|
|
1327
|
+
* Creates an array cache object to store unique values.
|
|
1328
|
+
*
|
|
1329
|
+
* @private
|
|
1330
|
+
* @constructor
|
|
1331
|
+
* @param {Array} [values] The values to cache.
|
|
1332
|
+
*/
|
|
1333
|
+
function SetCache$1(values) {
|
|
1334
|
+
var index = -1,
|
|
1335
|
+
length = values == null ? 0 : values.length;
|
|
1336
|
+
|
|
1337
|
+
this.__data__ = new MapCache;
|
|
1338
|
+
while (++index < length) {
|
|
1339
|
+
this.add(values[index]);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// Add methods to `SetCache`.
|
|
1344
|
+
SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
|
|
1345
|
+
SetCache$1.prototype.has = setCacheHas;
|
|
1346
|
+
|
|
1347
|
+
var _SetCache = SetCache$1;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
1351
|
+
* support for iteratee shorthands.
|
|
1352
|
+
*
|
|
1353
|
+
* @private
|
|
1354
|
+
* @param {Array} array The array to inspect.
|
|
1355
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1356
|
+
* @param {number} fromIndex The index to search from.
|
|
1357
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
1358
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1359
|
+
*/
|
|
1360
|
+
|
|
1361
|
+
function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
|
|
1362
|
+
var length = array.length,
|
|
1363
|
+
index = fromIndex + (fromRight ? 1 : -1);
|
|
1364
|
+
|
|
1365
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
1366
|
+
if (predicate(array[index], index, array)) {
|
|
1367
|
+
return index;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
return -1;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
var _baseFindIndex = baseFindIndex$1;
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* The base implementation of `_.isNaN` without support for number objects.
|
|
1377
|
+
*
|
|
1378
|
+
* @private
|
|
1379
|
+
* @param {*} value The value to check.
|
|
1380
|
+
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
function baseIsNaN$1(value) {
|
|
1384
|
+
return value !== value;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
var _baseIsNaN = baseIsNaN$1;
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* A specialized version of `_.indexOf` which performs strict equality
|
|
1391
|
+
* comparisons of values, i.e. `===`.
|
|
1392
|
+
*
|
|
1393
|
+
* @private
|
|
1394
|
+
* @param {Array} array The array to inspect.
|
|
1395
|
+
* @param {*} value The value to search for.
|
|
1396
|
+
* @param {number} fromIndex The index to search from.
|
|
1397
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1398
|
+
*/
|
|
1399
|
+
|
|
1400
|
+
function strictIndexOf$1(array, value, fromIndex) {
|
|
1401
|
+
var index = fromIndex - 1,
|
|
1402
|
+
length = array.length;
|
|
1403
|
+
|
|
1404
|
+
while (++index < length) {
|
|
1405
|
+
if (array[index] === value) {
|
|
1406
|
+
return index;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
return -1;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
var _strictIndexOf = strictIndexOf$1;
|
|
1413
|
+
|
|
1414
|
+
var baseFindIndex = _baseFindIndex,
|
|
1415
|
+
baseIsNaN = _baseIsNaN,
|
|
1416
|
+
strictIndexOf = _strictIndexOf;
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
|
1420
|
+
*
|
|
1421
|
+
* @private
|
|
1422
|
+
* @param {Array} array The array to inspect.
|
|
1423
|
+
* @param {*} value The value to search for.
|
|
1424
|
+
* @param {number} fromIndex The index to search from.
|
|
1425
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1426
|
+
*/
|
|
1427
|
+
function baseIndexOf$1(array, value, fromIndex) {
|
|
1428
|
+
return value === value
|
|
1429
|
+
? strictIndexOf(array, value, fromIndex)
|
|
1430
|
+
: baseFindIndex(array, baseIsNaN, fromIndex);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
var _baseIndexOf = baseIndexOf$1;
|
|
1434
|
+
|
|
1435
|
+
var baseIndexOf = _baseIndexOf;
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* A specialized version of `_.includes` for arrays without support for
|
|
1439
|
+
* specifying an index to search from.
|
|
1440
|
+
*
|
|
1441
|
+
* @private
|
|
1442
|
+
* @param {Array} [array] The array to inspect.
|
|
1443
|
+
* @param {*} target The value to search for.
|
|
1444
|
+
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
1445
|
+
*/
|
|
1446
|
+
function arrayIncludes$1(array, value) {
|
|
1447
|
+
var length = array == null ? 0 : array.length;
|
|
1448
|
+
return !!length && baseIndexOf(array, value, 0) > -1;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
var _arrayIncludes = arrayIncludes$1;
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* This function is like `arrayIncludes` except that it accepts a comparator.
|
|
1455
|
+
*
|
|
1456
|
+
* @private
|
|
1457
|
+
* @param {Array} [array] The array to inspect.
|
|
1458
|
+
* @param {*} target The value to search for.
|
|
1459
|
+
* @param {Function} comparator The comparator invoked per element.
|
|
1460
|
+
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
1461
|
+
*/
|
|
1462
|
+
|
|
1463
|
+
function arrayIncludesWith$1(array, value, comparator) {
|
|
1464
|
+
var index = -1,
|
|
1465
|
+
length = array == null ? 0 : array.length;
|
|
1466
|
+
|
|
1467
|
+
while (++index < length) {
|
|
1468
|
+
if (comparator(value, array[index])) {
|
|
1469
|
+
return true;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
return false;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
var _arrayIncludesWith = arrayIncludesWith$1;
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* Checks if a `cache` value for `key` exists.
|
|
1479
|
+
*
|
|
1480
|
+
* @private
|
|
1481
|
+
* @param {Object} cache The cache to query.
|
|
1482
|
+
* @param {string} key The key of the entry to check.
|
|
1483
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1484
|
+
*/
|
|
1485
|
+
|
|
1486
|
+
function cacheHas$1(cache, key) {
|
|
1487
|
+
return cache.has(key);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
var _cacheHas = cacheHas$1;
|
|
1491
|
+
|
|
1492
|
+
var getNative = _getNative,
|
|
1493
|
+
root = _root;
|
|
1494
|
+
|
|
1495
|
+
/* Built-in method references that are verified to be native. */
|
|
1496
|
+
var Set$1 = getNative(root, 'Set');
|
|
1497
|
+
|
|
1498
|
+
var _Set = Set$1;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* This method returns `undefined`.
|
|
1502
|
+
*
|
|
1503
|
+
* @static
|
|
1504
|
+
* @memberOf _
|
|
1505
|
+
* @since 2.3.0
|
|
1506
|
+
* @category Util
|
|
1507
|
+
* @example
|
|
1508
|
+
*
|
|
1509
|
+
* _.times(2, _.noop);
|
|
1510
|
+
* // => [undefined, undefined]
|
|
1511
|
+
*/
|
|
1512
|
+
|
|
1513
|
+
function noop$1() {
|
|
1514
|
+
// No operation performed.
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
var noop_1 = noop$1;
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Converts `set` to an array of its values.
|
|
1521
|
+
*
|
|
1522
|
+
* @private
|
|
1523
|
+
* @param {Object} set The set to convert.
|
|
1524
|
+
* @returns {Array} Returns the values.
|
|
1525
|
+
*/
|
|
1526
|
+
|
|
1527
|
+
function setToArray$2(set) {
|
|
1528
|
+
var index = -1,
|
|
1529
|
+
result = Array(set.size);
|
|
1530
|
+
|
|
1531
|
+
set.forEach(function(value) {
|
|
1532
|
+
result[++index] = value;
|
|
1533
|
+
});
|
|
1534
|
+
return result;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
var _setToArray = setToArray$2;
|
|
1538
|
+
|
|
1539
|
+
var Set = _Set,
|
|
1540
|
+
noop = noop_1,
|
|
1541
|
+
setToArray$1 = _setToArray;
|
|
1542
|
+
|
|
1543
|
+
/** Used as references for various `Number` constants. */
|
|
1544
|
+
var INFINITY = 1 / 0;
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* Creates a set object of `values`.
|
|
1548
|
+
*
|
|
1549
|
+
* @private
|
|
1550
|
+
* @param {Array} values The values to add to the set.
|
|
1551
|
+
* @returns {Object} Returns the new set.
|
|
1552
|
+
*/
|
|
1553
|
+
var createSet$1 = !(Set && (1 / setToArray$1(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
|
|
1554
|
+
return new Set(values);
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
var _createSet = createSet$1;
|
|
1558
|
+
|
|
1559
|
+
var SetCache = _SetCache,
|
|
1560
|
+
arrayIncludes = _arrayIncludes,
|
|
1561
|
+
arrayIncludesWith = _arrayIncludesWith,
|
|
1562
|
+
cacheHas = _cacheHas,
|
|
1563
|
+
createSet = _createSet,
|
|
1564
|
+
setToArray = _setToArray;
|
|
1565
|
+
|
|
1566
|
+
/** Used as the size to enable large array optimizations. */
|
|
1567
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
|
|
1571
|
+
*
|
|
1572
|
+
* @private
|
|
1573
|
+
* @param {Array} array The array to inspect.
|
|
1574
|
+
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
1575
|
+
* @param {Function} [comparator] The comparator invoked per element.
|
|
1576
|
+
* @returns {Array} Returns the new duplicate free array.
|
|
1577
|
+
*/
|
|
1578
|
+
function baseUniq$1(array, iteratee, comparator) {
|
|
1579
|
+
var index = -1,
|
|
1580
|
+
includes = arrayIncludes,
|
|
1581
|
+
length = array.length,
|
|
1582
|
+
isCommon = true,
|
|
1583
|
+
result = [],
|
|
1584
|
+
seen = result;
|
|
1585
|
+
|
|
1586
|
+
if (comparator) {
|
|
1587
|
+
isCommon = false;
|
|
1588
|
+
includes = arrayIncludesWith;
|
|
1589
|
+
}
|
|
1590
|
+
else if (length >= LARGE_ARRAY_SIZE) {
|
|
1591
|
+
var set = iteratee ? null : createSet(array);
|
|
1592
|
+
if (set) {
|
|
1593
|
+
return setToArray(set);
|
|
1594
|
+
}
|
|
1595
|
+
isCommon = false;
|
|
1596
|
+
includes = cacheHas;
|
|
1597
|
+
seen = new SetCache;
|
|
1598
|
+
}
|
|
1599
|
+
else {
|
|
1600
|
+
seen = iteratee ? [] : result;
|
|
1601
|
+
}
|
|
1602
|
+
outer:
|
|
1603
|
+
while (++index < length) {
|
|
1604
|
+
var value = array[index],
|
|
1605
|
+
computed = iteratee ? iteratee(value) : value;
|
|
1606
|
+
|
|
1607
|
+
value = (comparator || value !== 0) ? value : 0;
|
|
1608
|
+
if (isCommon && computed === computed) {
|
|
1609
|
+
var seenIndex = seen.length;
|
|
1610
|
+
while (seenIndex--) {
|
|
1611
|
+
if (seen[seenIndex] === computed) {
|
|
1612
|
+
continue outer;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
if (iteratee) {
|
|
1616
|
+
seen.push(computed);
|
|
1617
|
+
}
|
|
1618
|
+
result.push(value);
|
|
1619
|
+
}
|
|
1620
|
+
else if (!includes(seen, computed, comparator)) {
|
|
1621
|
+
if (seen !== result) {
|
|
1622
|
+
seen.push(computed);
|
|
1623
|
+
}
|
|
1624
|
+
result.push(value);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
return result;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
var _baseUniq = baseUniq$1;
|
|
1631
|
+
|
|
1632
|
+
var baseUniq = _baseUniq;
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* This method is like `_.uniq` except that it accepts `comparator` which
|
|
1636
|
+
* is invoked to compare elements of `array`. The order of result values is
|
|
1637
|
+
* determined by the order they occur in the array.The comparator is invoked
|
|
1638
|
+
* with two arguments: (arrVal, othVal).
|
|
1639
|
+
*
|
|
1640
|
+
* @static
|
|
1641
|
+
* @memberOf _
|
|
1642
|
+
* @since 4.0.0
|
|
1643
|
+
* @category Array
|
|
1644
|
+
* @param {Array} array The array to inspect.
|
|
1645
|
+
* @param {Function} [comparator] The comparator invoked per element.
|
|
1646
|
+
* @returns {Array} Returns the new duplicate free array.
|
|
1647
|
+
* @example
|
|
1648
|
+
*
|
|
1649
|
+
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
1650
|
+
*
|
|
1651
|
+
* _.uniqWith(objects, _.isEqual);
|
|
1652
|
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
|
1653
|
+
*/
|
|
1654
|
+
function uniqWith(array, comparator) {
|
|
1655
|
+
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
1656
|
+
return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
var uniqWith_1 = uniqWith;
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* 场景解析器
|
|
1663
|
+
* @param rawScene 原始场景
|
|
1664
|
+
* @param sceneName 场景名称
|
|
1665
|
+
* @param sceneUrl 场景url
|
|
1666
|
+
* @param assetsPrefetcher
|
|
1667
|
+
* @param assetSetter
|
|
1668
|
+
* @param ADD_NEXT_ARG_LIST
|
|
1669
|
+
* @param SCRIPT_CONFIG
|
|
1670
|
+
* @return {IScene} 解析后的场景
|
|
1671
|
+
*/
|
|
1672
|
+
const sceneParser = (rawScene, sceneName, sceneUrl, assetsPrefetcher, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) => {
|
|
1673
|
+
const rawSentenceList = rawScene.split("\n"); // 原始句子列表
|
|
1674
|
+
// 去分号留到后面去做了,现在注释要单独处理
|
|
1675
|
+
const rawSentenceListWithoutEmpty = rawSentenceList;
|
|
1676
|
+
// .map((sentence) => sentence.split(";")[0])
|
|
1677
|
+
// .filter((sentence) => sentence.trim() !== "");
|
|
1678
|
+
let assetsList = []; // 场景资源列表
|
|
1679
|
+
let subSceneList = []; // 子场景列表
|
|
1680
|
+
const sentenceList = rawSentenceListWithoutEmpty.map((sentence) => {
|
|
1681
|
+
const returnSentence = scriptParser(sentence, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);
|
|
1682
|
+
// 在这里解析出语句可能携带的资源和场景,合并到 assetsList 和 subSceneList
|
|
1683
|
+
assetsList = [...assetsList, ...returnSentence.sentenceAssets];
|
|
1684
|
+
subSceneList = [...subSceneList, ...returnSentence.subScene];
|
|
1685
|
+
return returnSentence;
|
|
1686
|
+
});
|
|
1687
|
+
// 开始资源的预加载
|
|
1688
|
+
assetsList = uniqWith_1(assetsList); // 去重
|
|
1689
|
+
assetsPrefetcher(assetsList);
|
|
1690
|
+
return {
|
|
1691
|
+
sceneName: sceneName,
|
|
1692
|
+
sceneUrl: sceneUrl,
|
|
1693
|
+
sentenceList: sentenceList,
|
|
1694
|
+
assetsList: assetsList,
|
|
1695
|
+
subSceneList: subSceneList // 子场景列表
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
const SCRIPT_CONFIG = [
|
|
1700
|
+
{ scriptString: 'intro', scriptType: commandType.intro },
|
|
1701
|
+
{ scriptString: 'changeBg', scriptType: commandType.changeBg },
|
|
1702
|
+
{ scriptString: 'changeFigure', scriptType: commandType.changeFigure },
|
|
1703
|
+
{ scriptString: 'miniAvatar', scriptType: commandType.miniAvatar },
|
|
1704
|
+
{ scriptString: 'changeScene', scriptType: commandType.changeScene },
|
|
1705
|
+
{ scriptString: 'choose', scriptType: commandType.choose },
|
|
1706
|
+
{ scriptString: 'end', scriptType: commandType.end },
|
|
1707
|
+
{ scriptString: 'bgm', scriptType: commandType.bgm },
|
|
1708
|
+
{ scriptString: 'playVideo', scriptType: commandType.video },
|
|
1709
|
+
{
|
|
1710
|
+
scriptString: 'setComplexAnimation',
|
|
1711
|
+
scriptType: commandType.setComplexAnimation,
|
|
1712
|
+
},
|
|
1713
|
+
{ scriptString: 'setFilter', scriptType: commandType.setFilter },
|
|
1714
|
+
{ scriptString: 'pixiInit', scriptType: commandType.pixiInit },
|
|
1715
|
+
{ scriptString: 'pixiPerform', scriptType: commandType.pixi },
|
|
1716
|
+
{ scriptString: 'label', scriptType: commandType.label },
|
|
1717
|
+
{ scriptString: 'jumpLabel', scriptType: commandType.jumpLabel },
|
|
1718
|
+
{ scriptString: 'setVar', scriptType: commandType.setVar },
|
|
1719
|
+
{ scriptString: 'callScene', scriptType: commandType.callScene },
|
|
1720
|
+
{ scriptString: 'showVars', scriptType: commandType.showVars },
|
|
1721
|
+
{ scriptString: 'unlockCg', scriptType: commandType.unlockCg },
|
|
1722
|
+
{ scriptString: 'unlockBgm', scriptType: commandType.unlockBgm },
|
|
1723
|
+
{ scriptString: 'say', scriptType: commandType.say },
|
|
1724
|
+
{ scriptString: 'filmMode', scriptType: commandType.filmMode },
|
|
1725
|
+
{ scriptString: 'callScene', scriptType: commandType.callScene },
|
|
1726
|
+
{ scriptString: 'setTextbox', scriptType: commandType.setTextbox },
|
|
1727
|
+
{ scriptString: 'setAnimation', scriptType: commandType.setAnimation },
|
|
1728
|
+
{ scriptString: 'playEffect', scriptType: commandType.playEffect },
|
|
1729
|
+
];
|
|
1730
|
+
const ADD_NEXT_ARG_LIST = [
|
|
1731
|
+
commandType.bgm,
|
|
1732
|
+
commandType.pixi,
|
|
1733
|
+
commandType.pixiInit,
|
|
1734
|
+
commandType.label,
|
|
1735
|
+
commandType.if,
|
|
1736
|
+
commandType.miniAvatar,
|
|
1737
|
+
commandType.setVar,
|
|
1738
|
+
commandType.unlockBgm,
|
|
1739
|
+
commandType.unlockCg,
|
|
1740
|
+
commandType.filmMode,
|
|
1741
|
+
commandType.playEffect,
|
|
1742
|
+
];
|
|
1743
|
+
|
|
1744
|
+
function configParser(configText) {
|
|
1745
|
+
// TODO
|
|
1746
|
+
return configText;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
class SceneParser {
|
|
1750
|
+
assetsPrefetcher;
|
|
1751
|
+
assetSetter;
|
|
1752
|
+
ADD_NEXT_ARG_LIST;
|
|
1753
|
+
SCRIPT_CONFIG;
|
|
1754
|
+
constructor(assetsPrefetcher, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) {
|
|
1755
|
+
this.assetsPrefetcher = assetsPrefetcher;
|
|
1756
|
+
this.assetSetter = assetSetter;
|
|
1757
|
+
this.ADD_NEXT_ARG_LIST = ADD_NEXT_ARG_LIST;
|
|
1758
|
+
this.SCRIPT_CONFIG = SCRIPT_CONFIG;
|
|
1759
|
+
}
|
|
1760
|
+
parse(rawScene, sceneName, sceneUrl) {
|
|
1761
|
+
return sceneParser(rawScene, sceneName, sceneUrl, this.assetsPrefetcher, this.assetSetter, this.ADD_NEXT_ARG_LIST, this.SCRIPT_CONFIG);
|
|
1762
|
+
}
|
|
1763
|
+
parseConfig(configText) {
|
|
1764
|
+
return configParser(configText);
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
exports.ADD_NEXT_ARG_LIST = ADD_NEXT_ARG_LIST;
|
|
1769
|
+
exports.SCRIPT_CONFIG = SCRIPT_CONFIG;
|
|
1770
|
+
exports.default = SceneParser;
|
|
1771
|
+
|
|
1772
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1773
|
+
|
|
1774
|
+
return exports;
|
|
1775
|
+
|
|
1776
|
+
})({});
|