jsf.js_next_gen 1.0.0-beta-13 → 1.0.0-beta-14
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/dist/window/jsf-development.js +3521 -38
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/webpack.config.js +7 -3
- package/webpack.config.js.map +1 -1
- package/webpack.config.ts +8 -7
- package/dist/window/tmp +0 -0
|
@@ -1,14 +1,3515 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
2
3
|
/******/ var __webpack_modules__ = ({
|
|
3
4
|
|
|
4
|
-
/***/ "./node_modules/mona-dish/
|
|
5
|
-
|
|
6
|
-
!*** ./node_modules/mona-dish/
|
|
7
|
-
|
|
8
|
-
/***/ ((__unused_webpack_module, exports)
|
|
5
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts":
|
|
6
|
+
/*!****************************************************************!*\
|
|
7
|
+
!*** ./node_modules/mona-dish/src/main/typescript/DomQuery.ts ***!
|
|
8
|
+
\****************************************************************/
|
|
9
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
13
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
14
|
+
* this work for additional information regarding copyright ownership.
|
|
15
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
16
|
+
* (the "License"); you may not use this file except in compliance with
|
|
17
|
+
* the License. You may obtain a copy of the License at
|
|
18
|
+
*
|
|
19
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
22
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
|
+
* See the License for the specific language governing permissions and
|
|
25
|
+
* limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
var __extends = (this && this.__extends) || (function () {
|
|
28
|
+
var extendStatics = function (d, b) {
|
|
29
|
+
extendStatics = Object.setPrototypeOf ||
|
|
30
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
32
|
+
return extendStatics(d, b);
|
|
33
|
+
};
|
|
34
|
+
return function (d, b) {
|
|
35
|
+
if (typeof b !== "function" && b !== null)
|
|
36
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
37
|
+
extendStatics(d, b);
|
|
38
|
+
function __() { this.constructor = d; }
|
|
39
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __assign = (this && this.__assign) || function () {
|
|
43
|
+
__assign = Object.assign || function(t) {
|
|
44
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
45
|
+
s = arguments[i];
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
};
|
|
51
|
+
return __assign.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
54
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
55
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
56
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
57
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
58
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
59
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
63
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
64
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
65
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
66
|
+
function step(op) {
|
|
67
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
+
while (_) try {
|
|
69
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
70
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
71
|
+
switch (op[0]) {
|
|
72
|
+
case 0: case 1: t = op; break;
|
|
73
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
74
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
75
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
76
|
+
default:
|
|
77
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
78
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
79
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
80
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
81
|
+
if (t[2]) _.ops.pop();
|
|
82
|
+
_.trys.pop(); continue;
|
|
83
|
+
}
|
|
84
|
+
op = body.call(thisArg, _);
|
|
85
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
86
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
90
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
91
|
+
if (ar || !(i in from)) {
|
|
92
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
93
|
+
ar[i] = from[i];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
97
|
+
};
|
|
98
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
99
|
+
exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.ElementAttribute = void 0;
|
|
100
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
101
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
102
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
103
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
104
|
+
var trim = Lang_1.Lang.trim;
|
|
105
|
+
var objToArray = Lang_1.Lang.objToArray;
|
|
106
|
+
var isString = Lang_1.Lang.isString;
|
|
107
|
+
var equalsIgnoreCase = Lang_1.Lang.equalsIgnoreCase;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* // - submit checkboxes and radio inputs only if checked
|
|
111
|
+
if ((tagName != "select" && elemType != "button"
|
|
112
|
+
&& elemType != "reset" && elemType != "submit" && elemType != "image")
|
|
113
|
+
&& ((elemType != "checkbox" && elemType != "radio"
|
|
114
|
+
*/
|
|
115
|
+
var Submittables;
|
|
116
|
+
(function (Submittables) {
|
|
117
|
+
Submittables["SELECT"] = "select";
|
|
118
|
+
Submittables["BUTTON"] = "button";
|
|
119
|
+
Submittables["SUBMIT"] = "submit";
|
|
120
|
+
Submittables["RESET"] = "reset";
|
|
121
|
+
Submittables["IMAGE"] = "image";
|
|
122
|
+
Submittables["RADIO"] = "radio";
|
|
123
|
+
Submittables["CHECKBOX"] = "checkbox";
|
|
124
|
+
})(Submittables || (Submittables = {}));
|
|
125
|
+
/**
|
|
126
|
+
* helper to fix a common problem that a system has to wait until a certain condition is reached
|
|
127
|
+
* depening on the browser this uses either the mutation observer or a semi compatible interval as fallback
|
|
128
|
+
* @param condition
|
|
129
|
+
*/
|
|
130
|
+
function waitUntilDom(root, condition, options) {
|
|
131
|
+
if (options === void 0) { options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }; }
|
|
132
|
+
var ret = new Promise(function (success, error) {
|
|
133
|
+
var MUT_ERROR = new Error("Mutation observer timeout");
|
|
134
|
+
if ('undefined' != typeof window.MutationObserver) {
|
|
135
|
+
var mutTimeout_1 = setTimeout(function () {
|
|
136
|
+
return error(MUT_ERROR);
|
|
137
|
+
}, options.timeout);
|
|
138
|
+
var callback = function (mutationList, observer) {
|
|
139
|
+
var found = new DomQuery(mutationList.map(function (mut) { return mut.target; })).first(condition);
|
|
140
|
+
if (found.isPresent()) {
|
|
141
|
+
clearTimeout(mutTimeout_1);
|
|
142
|
+
success(found);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var observer_1 = new window.MutationObserver(callback);
|
|
146
|
+
// browsers might ignore it, but we cannot break the api in the case
|
|
147
|
+
// hence no timeout is passed
|
|
148
|
+
var observableOpts_1 = __assign({}, options);
|
|
149
|
+
delete observableOpts_1.timeout;
|
|
150
|
+
root.eachElem(function (item) {
|
|
151
|
+
observer_1.observe(item, observableOpts_1);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else { //fallback for legacy browsers without mutation observer
|
|
155
|
+
//we do the same but for now ignore the options on the dom query
|
|
156
|
+
var interval_1 = setInterval(function () {
|
|
157
|
+
var found = null;
|
|
158
|
+
if (options.childList) {
|
|
159
|
+
found = (condition(root)) ? root : root.childNodes.first(condition);
|
|
160
|
+
}
|
|
161
|
+
else if (options.subtree) {
|
|
162
|
+
found = (condition(root)) ? root : root.querySelectorAll(" * ").first(condition);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
found = (condition(root)) ? root : DomQuery.absent;
|
|
166
|
+
}
|
|
167
|
+
if (found.isPresent()) {
|
|
168
|
+
if (timeout_1) {
|
|
169
|
+
clearTimeout(timeout_1);
|
|
170
|
+
clearInterval(interval_1);
|
|
171
|
+
interval_1 = null;
|
|
172
|
+
success(found);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, options.interval);
|
|
176
|
+
var timeout_1 = setTimeout(function () {
|
|
177
|
+
if (interval_1) {
|
|
178
|
+
clearInterval(interval_1);
|
|
179
|
+
error(MUT_ERROR);
|
|
180
|
+
}
|
|
181
|
+
}, options.timeout);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
return ret;
|
|
185
|
+
}
|
|
186
|
+
var ElementAttribute = /** @class */ (function (_super) {
|
|
187
|
+
__extends(ElementAttribute, _super);
|
|
188
|
+
function ElementAttribute(element, name, defaultVal) {
|
|
189
|
+
if (defaultVal === void 0) { defaultVal = null; }
|
|
190
|
+
var _this = _super.call(this, element, name) || this;
|
|
191
|
+
_this.element = element;
|
|
192
|
+
_this.name = name;
|
|
193
|
+
_this.defaultVal = defaultVal;
|
|
194
|
+
return _this;
|
|
195
|
+
}
|
|
196
|
+
Object.defineProperty(ElementAttribute.prototype, "value", {
|
|
197
|
+
get: function () {
|
|
198
|
+
var _a;
|
|
199
|
+
var val = (_a = this.element.get(0)).orElse.apply(_a, []).values;
|
|
200
|
+
if (!val.length) {
|
|
201
|
+
return this.defaultVal;
|
|
202
|
+
}
|
|
203
|
+
return val[0].getAttribute(this.name);
|
|
204
|
+
},
|
|
205
|
+
set: function (value) {
|
|
206
|
+
var _a;
|
|
207
|
+
var val = (_a = this.element.get(0)).orElse.apply(_a, []).values;
|
|
208
|
+
for (var cnt = 0; cnt < val.length; cnt++) {
|
|
209
|
+
val[cnt].setAttribute(this.name, value);
|
|
210
|
+
}
|
|
211
|
+
val[0].setAttribute(this.name, value);
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
ElementAttribute.prototype.getClass = function () {
|
|
217
|
+
return ElementAttribute;
|
|
218
|
+
};
|
|
219
|
+
ElementAttribute.fromNullable = function (value, valueKey) {
|
|
220
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
221
|
+
return new ElementAttribute(value, valueKey);
|
|
222
|
+
};
|
|
223
|
+
return ElementAttribute;
|
|
224
|
+
}(Monad_1.ValueEmbedder));
|
|
225
|
+
exports.ElementAttribute = ElementAttribute;
|
|
226
|
+
/**
|
|
227
|
+
* small helper for the specialized jsf case
|
|
228
|
+
* @param src
|
|
229
|
+
* @constructor
|
|
230
|
+
*/
|
|
231
|
+
var DEFAULT_WHITELIST = function (src) {
|
|
232
|
+
return true;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Monadic DomNode representation, ala jquery
|
|
236
|
+
* This is a thin wrapper over querySelectorAll
|
|
237
|
+
* to get slim monadic support
|
|
238
|
+
* to reduce implementation code on the users side.
|
|
239
|
+
* This is vital for frameworks which want to rely on
|
|
240
|
+
* plain dom but still do not want to lose
|
|
241
|
+
* the reduced code footprint of querying dom trees and traversing
|
|
242
|
+
* by using functional patterns.
|
|
243
|
+
*
|
|
244
|
+
* Also a few convenience methods are added to reduce
|
|
245
|
+
* the code footprint of standard dom processing
|
|
246
|
+
* operations like eval
|
|
247
|
+
*
|
|
248
|
+
* TODO add jquery fallback support, since it is supported
|
|
249
|
+
* in most older systems
|
|
250
|
+
* Note parts of this code still stem from the Dom.js I have written 10 years
|
|
251
|
+
* ago, those parts look a little bit ancient and will be replaced over time.
|
|
252
|
+
*
|
|
253
|
+
*/
|
|
254
|
+
var DomQuery = /** @class */ (function () {
|
|
255
|
+
function DomQuery() {
|
|
256
|
+
var _a;
|
|
257
|
+
var rootNode = [];
|
|
258
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
259
|
+
rootNode[_i] = arguments[_i];
|
|
260
|
+
}
|
|
261
|
+
this.rootNode = [];
|
|
262
|
+
this.pos = -1;
|
|
263
|
+
//TODO this part probably will be removed
|
|
264
|
+
//because we can stream from an array stream directly into the dom query
|
|
265
|
+
this._limits = -1;
|
|
266
|
+
if (Monad_1.Optional.fromNullable(rootNode).isAbsent() || !rootNode.length) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
//we need to flatten out the arrays
|
|
271
|
+
for (var cnt = 0; cnt < rootNode.length; cnt++) {
|
|
272
|
+
if (!rootNode[cnt]) {
|
|
273
|
+
//we skip possible null entries which can happen in
|
|
274
|
+
//certain corner conditions due to the constructor re-wrapping single elements into arrays.
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
else if (isString(rootNode[cnt])) {
|
|
278
|
+
var foundElement = DomQuery.querySelectorAll(rootNode[cnt]);
|
|
279
|
+
if (!foundElement.isAbsent()) {
|
|
280
|
+
rootNode.push.apply(rootNode, foundElement.values);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else if (rootNode[cnt] instanceof DomQuery) {
|
|
284
|
+
(_a = this.rootNode).push.apply(_a, rootNode[cnt].values);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
this.rootNode.push(rootNode[cnt]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
Object.defineProperty(DomQuery.prototype, "value", {
|
|
293
|
+
/**
|
|
294
|
+
* returns the first element
|
|
295
|
+
*/
|
|
296
|
+
get: function () {
|
|
297
|
+
return this.getAsElem(0);
|
|
298
|
+
},
|
|
299
|
+
enumerable: false,
|
|
300
|
+
configurable: true
|
|
301
|
+
});
|
|
302
|
+
Object.defineProperty(DomQuery.prototype, "values", {
|
|
303
|
+
get: function () {
|
|
304
|
+
return this.allElems();
|
|
305
|
+
},
|
|
306
|
+
enumerable: false,
|
|
307
|
+
configurable: true
|
|
308
|
+
});
|
|
309
|
+
Object.defineProperty(DomQuery.prototype, "id", {
|
|
310
|
+
/**
|
|
311
|
+
* returns the id of the first element
|
|
312
|
+
*/
|
|
313
|
+
get: function () {
|
|
314
|
+
return new ElementAttribute(this.get(0), "id");
|
|
315
|
+
},
|
|
316
|
+
enumerable: false,
|
|
317
|
+
configurable: true
|
|
318
|
+
});
|
|
319
|
+
Object.defineProperty(DomQuery.prototype, "length", {
|
|
320
|
+
/**
|
|
321
|
+
* length of the entire query set
|
|
322
|
+
*/
|
|
323
|
+
get: function () {
|
|
324
|
+
return this.rootNode.length;
|
|
325
|
+
},
|
|
326
|
+
enumerable: false,
|
|
327
|
+
configurable: true
|
|
328
|
+
});
|
|
329
|
+
Object.defineProperty(DomQuery.prototype, "tagName", {
|
|
330
|
+
/**
|
|
331
|
+
* convenience method for tagName
|
|
332
|
+
*/
|
|
333
|
+
get: function () {
|
|
334
|
+
return this.getAsElem(0).getIf("tagName");
|
|
335
|
+
},
|
|
336
|
+
enumerable: false,
|
|
337
|
+
configurable: true
|
|
338
|
+
});
|
|
339
|
+
Object.defineProperty(DomQuery.prototype, "nodeName", {
|
|
340
|
+
/**
|
|
341
|
+
* convenience method for nodeName
|
|
342
|
+
*/
|
|
343
|
+
get: function () {
|
|
344
|
+
return this.getAsElem(0).getIf("nodeName");
|
|
345
|
+
},
|
|
346
|
+
enumerable: false,
|
|
347
|
+
configurable: true
|
|
348
|
+
});
|
|
349
|
+
DomQuery.prototype.isTag = function (tagName) {
|
|
350
|
+
return !this.isAbsent()
|
|
351
|
+
&& (this.nodeName.orElse("__none___")
|
|
352
|
+
.value.toLowerCase() == tagName.toLowerCase()
|
|
353
|
+
|| this.tagName.orElse("__none___")
|
|
354
|
+
.value.toLowerCase() == tagName.toLowerCase());
|
|
355
|
+
};
|
|
356
|
+
Object.defineProperty(DomQuery.prototype, "type", {
|
|
357
|
+
/**
|
|
358
|
+
* convenience property for type
|
|
359
|
+
*
|
|
360
|
+
* returns null in case of no type existing otherwise
|
|
361
|
+
* the type of the first element
|
|
362
|
+
*/
|
|
363
|
+
get: function () {
|
|
364
|
+
return this.getAsElem(0).getIf("type");
|
|
365
|
+
},
|
|
366
|
+
enumerable: false,
|
|
367
|
+
configurable: true
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(DomQuery.prototype, "name", {
|
|
370
|
+
/**
|
|
371
|
+
* convenience property for name
|
|
372
|
+
*
|
|
373
|
+
* returns null in case of no type existing otherwise
|
|
374
|
+
* the name of the first element
|
|
375
|
+
*/
|
|
376
|
+
get: function () {
|
|
377
|
+
return new Monad_1.ValueEmbedder(this.getAsElem(0).value, "name");
|
|
378
|
+
},
|
|
379
|
+
enumerable: false,
|
|
380
|
+
configurable: true
|
|
381
|
+
});
|
|
382
|
+
Object.defineProperty(DomQuery.prototype, "inputValue", {
|
|
383
|
+
/**
|
|
384
|
+
* convenience property for value
|
|
385
|
+
*
|
|
386
|
+
* returns null in case of no type existing otherwise
|
|
387
|
+
* the value of the first element
|
|
388
|
+
*/
|
|
389
|
+
get: function () {
|
|
390
|
+
if (this.getAsElem(0).getIf("value").isPresent()) {
|
|
391
|
+
return new Monad_1.ValueEmbedder(this.getAsElem(0).value);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
return Monad_1.ValueEmbedder.absent;
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
enumerable: false,
|
|
398
|
+
configurable: true
|
|
399
|
+
});
|
|
400
|
+
Object.defineProperty(DomQuery.prototype, "checked", {
|
|
401
|
+
get: function () {
|
|
402
|
+
return Stream_1.Stream.of.apply(Stream_1.Stream, this.values).allMatch(function (el) { return !!el.checked; });
|
|
403
|
+
},
|
|
404
|
+
set: function (newChecked) {
|
|
405
|
+
this.eachElem(function (el) { return el.checked = newChecked; });
|
|
406
|
+
},
|
|
407
|
+
enumerable: false,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
410
|
+
Object.defineProperty(DomQuery.prototype, "elements", {
|
|
411
|
+
get: function () {
|
|
412
|
+
//a simple querySelectorAll should suffice
|
|
413
|
+
return this.querySelectorAll("input, checkbox, select, textarea, fieldset");
|
|
414
|
+
},
|
|
415
|
+
enumerable: false,
|
|
416
|
+
configurable: true
|
|
417
|
+
});
|
|
418
|
+
Object.defineProperty(DomQuery.prototype, "deepElements", {
|
|
419
|
+
get: function () {
|
|
420
|
+
var elemStr = "input, select, textarea, checkbox, fieldset";
|
|
421
|
+
return this.querySelectorAllDeep(elemStr);
|
|
422
|
+
},
|
|
423
|
+
enumerable: false,
|
|
424
|
+
configurable: true
|
|
425
|
+
});
|
|
426
|
+
/**
|
|
427
|
+
* a deep search which treats the single isolated shadow doms
|
|
428
|
+
* separately and runs the query on earch shadow dom
|
|
429
|
+
* @param queryStr
|
|
430
|
+
*/
|
|
431
|
+
DomQuery.prototype.querySelectorAllDeep = function (queryStr) {
|
|
432
|
+
var found = [];
|
|
433
|
+
var queryRes = this.querySelectorAll(queryStr);
|
|
434
|
+
if (queryRes.length) {
|
|
435
|
+
found.push(queryRes);
|
|
436
|
+
}
|
|
437
|
+
var shadowRoots = this.querySelectorAll("*").shadowRoot;
|
|
438
|
+
if (shadowRoots.length) {
|
|
439
|
+
var shadowRes = shadowRoots.querySelectorAllDeep(queryStr);
|
|
440
|
+
if (shadowRes.length) {
|
|
441
|
+
found.push(shadowRes);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], found, false)))();
|
|
445
|
+
};
|
|
446
|
+
Object.defineProperty(DomQuery.prototype, "disabled", {
|
|
447
|
+
/**
|
|
448
|
+
* todo align this api with the rest of the apis
|
|
449
|
+
*/
|
|
450
|
+
get: function () {
|
|
451
|
+
return this.attr("disabled").isPresent();
|
|
452
|
+
},
|
|
453
|
+
set: function (disabled) {
|
|
454
|
+
// this.attr("disabled").value = disabled + "";
|
|
455
|
+
if (!disabled) {
|
|
456
|
+
this.removeAttribute("disabled");
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.attr("disabled").value = "disabled";
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
enumerable: false,
|
|
463
|
+
configurable: true
|
|
464
|
+
});
|
|
465
|
+
DomQuery.prototype.removeAttribute = function (name) {
|
|
466
|
+
this.eachElem(function (item) { return item.removeAttribute(name); });
|
|
467
|
+
};
|
|
468
|
+
Object.defineProperty(DomQuery.prototype, "childNodes", {
|
|
469
|
+
get: function () {
|
|
470
|
+
var childNodeArr = [];
|
|
471
|
+
this.eachElem(function (item) {
|
|
472
|
+
childNodeArr = childNodeArr.concat(objToArray(item.childNodes));
|
|
473
|
+
});
|
|
474
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], childNodeArr, false)))();
|
|
475
|
+
},
|
|
476
|
+
enumerable: false,
|
|
477
|
+
configurable: true
|
|
478
|
+
});
|
|
479
|
+
Object.defineProperty(DomQuery.prototype, "stream", {
|
|
480
|
+
/**
|
|
481
|
+
* binding into stream
|
|
482
|
+
*/
|
|
483
|
+
get: function () {
|
|
484
|
+
return new (Stream_1.Stream.bind.apply(Stream_1.Stream, __spreadArray([void 0], this.asArray, false)))();
|
|
485
|
+
},
|
|
486
|
+
enumerable: false,
|
|
487
|
+
configurable: true
|
|
488
|
+
});
|
|
489
|
+
Object.defineProperty(DomQuery.prototype, "lazyStream", {
|
|
490
|
+
/**
|
|
491
|
+
* fetches a lazy stream representation
|
|
492
|
+
* lazy should be applied if you have some filters etc
|
|
493
|
+
* in between, this can reduce the number of post filter operations
|
|
494
|
+
* and ram usage
|
|
495
|
+
* significantly because the operations are done lazily and stop
|
|
496
|
+
* once they hit a dead end.
|
|
497
|
+
*/
|
|
498
|
+
get: function () {
|
|
499
|
+
return Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.asArray);
|
|
500
|
+
},
|
|
501
|
+
enumerable: false,
|
|
502
|
+
configurable: true
|
|
503
|
+
});
|
|
504
|
+
Object.defineProperty(DomQuery.prototype, "asArray", {
|
|
505
|
+
get: function () {
|
|
506
|
+
//filter not supported by IE11
|
|
507
|
+
return [].concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.rootNode).filter(function (item) { return item != null; })
|
|
508
|
+
.map(function (item) { return DomQuery.byId(item); }).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
509
|
+
},
|
|
510
|
+
enumerable: false,
|
|
511
|
+
configurable: true
|
|
512
|
+
});
|
|
513
|
+
Object.defineProperty(DomQuery.prototype, "asNodeArray", {
|
|
514
|
+
get: function () {
|
|
515
|
+
return [].concat(Stream_1.Stream.of(this.rootNode).filter(function (item) { return item != null; }).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
516
|
+
},
|
|
517
|
+
enumerable: false,
|
|
518
|
+
configurable: true
|
|
519
|
+
});
|
|
520
|
+
DomQuery.querySelectorAllDeep = function (selector) {
|
|
521
|
+
return new DomQuery(document).querySelectorAllDeep(selector);
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* easy query selector all producer
|
|
525
|
+
*
|
|
526
|
+
* @param selector the selector
|
|
527
|
+
* @returns a results dom query object
|
|
528
|
+
*/
|
|
529
|
+
DomQuery.querySelectorAll = function (selector) {
|
|
530
|
+
if (selector.indexOf("/shadow/") != -1) {
|
|
531
|
+
return new DomQuery(document)._querySelectorAllDeep(selector);
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
return new DomQuery(document)._querySelectorAll(selector);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* byId producer
|
|
539
|
+
*
|
|
540
|
+
* @param selector id
|
|
541
|
+
* @return a DomQuery containing the found elements
|
|
542
|
+
*/
|
|
543
|
+
DomQuery.byId = function (selector, deep) {
|
|
544
|
+
if (deep === void 0) { deep = false; }
|
|
545
|
+
if (isString(selector)) {
|
|
546
|
+
return (!deep) ? new DomQuery(document).byId(selector) : new DomQuery(document).byIdDeep(selector);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
return new DomQuery(selector);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* byTagName producer
|
|
554
|
+
*
|
|
555
|
+
* @param selector name
|
|
556
|
+
* @return a DomQuery containing the found elements
|
|
557
|
+
*/
|
|
558
|
+
DomQuery.byTagName = function (selector) {
|
|
559
|
+
if (isString(selector)) {
|
|
560
|
+
return new DomQuery(document).byTagName(selector);
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
return new DomQuery(selector);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
DomQuery.globalEval = function (code, nonce) {
|
|
567
|
+
return new DomQuery(document).globalEval(code, nonce);
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* builds the ie nodes properly in a placeholder
|
|
571
|
+
* and bypasses a non script insert bug that way
|
|
572
|
+
* @param markup the marku code
|
|
573
|
+
*/
|
|
574
|
+
DomQuery.fromMarkup = function (markup) {
|
|
575
|
+
//https://developer.mozilla.org/de/docs/Web/API/DOMParser license creative commons
|
|
576
|
+
var doc = document.implementation.createHTMLDocument("");
|
|
577
|
+
markup = trim(markup);
|
|
578
|
+
var lowerMarkup = markup.toLowerCase();
|
|
579
|
+
if (lowerMarkup.indexOf('<!doctype') != -1 ||
|
|
580
|
+
lowerMarkup.indexOf('<html') != -1 ||
|
|
581
|
+
lowerMarkup.indexOf('<head') != -1 || //TODO proper regexps here to avoid embedded tags with same element names to be triggered
|
|
582
|
+
lowerMarkup.indexOf('<body') != -1) {
|
|
583
|
+
doc.documentElement.innerHTML = markup;
|
|
584
|
+
return new DomQuery(doc.documentElement);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
var startsWithTag = function (str, tagName) {
|
|
588
|
+
var tag1 = ["<", tagName, ">"].join("");
|
|
589
|
+
var tag2 = ["<", tagName, " "].join("");
|
|
590
|
+
return (str.indexOf(tag1) == 0) || (str.indexOf(tag2) == 0);
|
|
591
|
+
};
|
|
592
|
+
var dummyPlaceHolder = new DomQuery(document.createElement("div"));
|
|
593
|
+
//table needs special treatment due to the browsers auto creation
|
|
594
|
+
if (startsWithTag(lowerMarkup, "thead") || startsWithTag(lowerMarkup, "tbody")) {
|
|
595
|
+
dummyPlaceHolder.html("<table>".concat(markup, "</table>"));
|
|
596
|
+
return dummyPlaceHolder.querySelectorAll("table").get(0).childNodes.detach();
|
|
597
|
+
}
|
|
598
|
+
else if (startsWithTag(lowerMarkup, "tfoot")) {
|
|
599
|
+
dummyPlaceHolder.html("<table><thead></thead><tbody><tbody".concat(markup, "</table>"));
|
|
600
|
+
return dummyPlaceHolder.querySelectorAll("table").get(2).childNodes.detach();
|
|
601
|
+
}
|
|
602
|
+
else if (startsWithTag(lowerMarkup, "tr")) {
|
|
603
|
+
dummyPlaceHolder.html("<table><tbody>".concat(markup, "</tbody></table>"));
|
|
604
|
+
return dummyPlaceHolder.querySelectorAll("tbody").get(0).childNodes.detach();
|
|
605
|
+
}
|
|
606
|
+
else if (startsWithTag(lowerMarkup, "td")) {
|
|
607
|
+
dummyPlaceHolder.html("<table><tbody><tr>".concat(markup, "</tr></tbody></table>"));
|
|
608
|
+
return dummyPlaceHolder.querySelectorAll("tr").get(0).childNodes.detach();
|
|
609
|
+
}
|
|
610
|
+
dummyPlaceHolder.html(markup);
|
|
611
|
+
return dummyPlaceHolder.childNodes.detach();
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* returns the nth element as domquery
|
|
616
|
+
* from the internal elements
|
|
617
|
+
* note if you try to reach a non existing element position
|
|
618
|
+
* you will get back an absent entry
|
|
619
|
+
*
|
|
620
|
+
* @param index the nth index
|
|
621
|
+
*/
|
|
622
|
+
DomQuery.prototype.get = function (index) {
|
|
623
|
+
return (index < this.rootNode.length) ? new DomQuery(this.rootNode[index]) : DomQuery.absent;
|
|
624
|
+
};
|
|
625
|
+
/**
|
|
626
|
+
* returns the nth element as optional of an Element object
|
|
627
|
+
* @param index the number from the index
|
|
628
|
+
* @param defaults the default value if the index is overrun default Optional.absent
|
|
629
|
+
*/
|
|
630
|
+
DomQuery.prototype.getAsElem = function (index, defaults) {
|
|
631
|
+
if (defaults === void 0) { defaults = Monad_1.Optional.absent; }
|
|
632
|
+
return (index < this.rootNode.length) ? Monad_1.Optional.fromNullable(this.rootNode[index]) : defaults;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* returns the files from a given elmement
|
|
636
|
+
* @param index
|
|
637
|
+
*/
|
|
638
|
+
DomQuery.prototype.filesFromElem = function (index) {
|
|
639
|
+
var _a;
|
|
640
|
+
return (index < this.rootNode.length) ? ((_a = this.rootNode[index]) === null || _a === void 0 ? void 0 : _a.files) ? this.rootNode[index].files : [] : [];
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* returns the value array< of all elements
|
|
644
|
+
*/
|
|
645
|
+
DomQuery.prototype.allElems = function () {
|
|
646
|
+
return this.rootNode;
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* absent no values reached?
|
|
650
|
+
*/
|
|
651
|
+
DomQuery.prototype.isAbsent = function () {
|
|
652
|
+
return this.length == 0;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* should make the code clearer
|
|
656
|
+
* note if you pass a function
|
|
657
|
+
* this refers to the active dopmquery object
|
|
658
|
+
*/
|
|
659
|
+
DomQuery.prototype.isPresent = function (presentRunnable) {
|
|
660
|
+
var absent = this.isAbsent();
|
|
661
|
+
if (!absent && presentRunnable) {
|
|
662
|
+
presentRunnable.call(this, this);
|
|
663
|
+
}
|
|
664
|
+
return !absent;
|
|
665
|
+
};
|
|
666
|
+
/**
|
|
667
|
+
* should make the code clearer
|
|
668
|
+
* note if you pass a function
|
|
669
|
+
* this refers to the active dopmquery object
|
|
670
|
+
*
|
|
671
|
+
*
|
|
672
|
+
* @param presentRunnable
|
|
673
|
+
*/
|
|
674
|
+
DomQuery.prototype.ifPresentLazy = function (presentRunnable) {
|
|
675
|
+
if (presentRunnable === void 0) { presentRunnable = function () {
|
|
676
|
+
}; }
|
|
677
|
+
this.isPresent.call(this, presentRunnable);
|
|
678
|
+
return this;
|
|
679
|
+
};
|
|
680
|
+
/**
|
|
681
|
+
* remove all affected nodes from this query object from the dom tree
|
|
682
|
+
*/
|
|
683
|
+
DomQuery.prototype.delete = function () {
|
|
684
|
+
this.eachElem(function (node) {
|
|
685
|
+
if (node.parentNode) {
|
|
686
|
+
node.parentNode.removeChild(node);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
DomQuery.prototype.querySelectorAll = function (selector) {
|
|
691
|
+
//We could merge both methods, but for now this is more readable
|
|
692
|
+
if (selector.indexOf("/shadow/") != -1) {
|
|
693
|
+
return this._querySelectorAllDeep(selector);
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
return this._querySelectorAll(selector);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* query selector all on the existing dom queryX object
|
|
701
|
+
*
|
|
702
|
+
* @param selector the standard selector
|
|
703
|
+
* @return a DomQuery with the results
|
|
704
|
+
*/
|
|
705
|
+
DomQuery.prototype._querySelectorAll = function (selector) {
|
|
706
|
+
var _a, _b;
|
|
707
|
+
if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
708
|
+
return this;
|
|
709
|
+
}
|
|
710
|
+
var nodes = [];
|
|
711
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
712
|
+
if (!((_b = this.rootNode[cnt]) === null || _b === void 0 ? void 0 : _b.querySelectorAll)) {
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
var res = this.rootNode[cnt].querySelectorAll(selector);
|
|
716
|
+
nodes = nodes.concat(objToArray(res));
|
|
717
|
+
}
|
|
718
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], nodes, false)))();
|
|
719
|
+
};
|
|
720
|
+
/*deep with a selector and a peudo /shadow/ marker to break into the next level*/
|
|
721
|
+
DomQuery.prototype._querySelectorAllDeep = function (selector) {
|
|
722
|
+
var _a;
|
|
723
|
+
if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
var nodes = [];
|
|
727
|
+
var foundNodes = new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.rootNode, false)))();
|
|
728
|
+
var selectors = selector.split(/\/shadow\//);
|
|
729
|
+
for (var cnt2 = 0; cnt2 < selectors.length; cnt2++) {
|
|
730
|
+
if (selectors[cnt2] == "") {
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
var levelSelector = selectors[cnt2];
|
|
734
|
+
foundNodes = foundNodes.querySelectorAll(levelSelector);
|
|
735
|
+
if (cnt2 < selectors.length - 1) {
|
|
736
|
+
foundNodes = foundNodes.shadowRoot;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return foundNodes;
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* core byId method
|
|
743
|
+
* @param id the id to search for
|
|
744
|
+
* @param includeRoot also match the root element?
|
|
745
|
+
*/
|
|
746
|
+
DomQuery.prototype.byId = function (id, includeRoot) {
|
|
747
|
+
var res = [];
|
|
748
|
+
if (includeRoot) {
|
|
749
|
+
res = res.concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((this === null || this === void 0 ? void 0 : this.rootNode) || [])).filter(function (item) { return id == item.id; })
|
|
750
|
+
.map(function (item) { return new DomQuery(item); })
|
|
751
|
+
.collect(new SourcesCollectors_1.ArrayCollector()));
|
|
752
|
+
}
|
|
753
|
+
//for some strange kind of reason the # selector fails
|
|
754
|
+
//on hidden elements we use the attributes match selector
|
|
755
|
+
//that works
|
|
756
|
+
res = res.concat(this.querySelectorAll("[id=\"".concat(id, "\"]")));
|
|
757
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
758
|
+
};
|
|
759
|
+
DomQuery.prototype.byIdDeep = function (id, includeRoot) {
|
|
760
|
+
var res = [];
|
|
761
|
+
if (includeRoot) {
|
|
762
|
+
res = res.concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((this === null || this === void 0 ? void 0 : this.rootNode) || [])).filter(function (item) { return id == item.id; })
|
|
763
|
+
.map(function (item) { return new DomQuery(item); })
|
|
764
|
+
.collect(new SourcesCollectors_1.ArrayCollector()));
|
|
765
|
+
}
|
|
766
|
+
var subItems = this.querySelectorAllDeep("[id=\"".concat(id, "\"]"));
|
|
767
|
+
if (subItems.length) {
|
|
768
|
+
res.push(subItems);
|
|
769
|
+
}
|
|
770
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
773
|
+
* same as byId just for the tag name
|
|
774
|
+
* @param tagName
|
|
775
|
+
* @param includeRoot
|
|
776
|
+
*/
|
|
777
|
+
DomQuery.prototype.byTagName = function (tagName, includeRoot, deep) {
|
|
778
|
+
var _a;
|
|
779
|
+
var res = [];
|
|
780
|
+
if (includeRoot) {
|
|
781
|
+
res = Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : [])).filter(function (element) { return (element === null || element === void 0 ? void 0 : element.tagName) == tagName; })
|
|
782
|
+
.reduce(function (reduction, item) { return reduction.concat([item]); }, res)
|
|
783
|
+
.orElse(res).value;
|
|
784
|
+
}
|
|
785
|
+
(deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));
|
|
786
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* attr accessor, usage myQuery.attr("class").value = "bla"
|
|
790
|
+
* or let value myQuery.attr("class").value
|
|
791
|
+
* @param attr the attribute to set
|
|
792
|
+
* @param defaultValue the default value in case nothing is presented (defaults to null)
|
|
793
|
+
*/
|
|
794
|
+
DomQuery.prototype.attr = function (attr, defaultValue) {
|
|
795
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
796
|
+
return new ElementAttribute(this, attr, defaultValue);
|
|
797
|
+
};
|
|
798
|
+
/**
|
|
799
|
+
* hasclass, checks for an existing class in the class attributes
|
|
800
|
+
*
|
|
801
|
+
* @param clazz the class to search for
|
|
802
|
+
*/
|
|
803
|
+
DomQuery.prototype.hasClass = function (clazz) {
|
|
804
|
+
var hasIt = false;
|
|
805
|
+
this.eachElem(function (node) {
|
|
806
|
+
hasIt = node.classList.contains(clazz);
|
|
807
|
+
if (hasIt) {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
return hasIt;
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* appends a class string if not already in the element(s)
|
|
815
|
+
*
|
|
816
|
+
* @param clazz the style class to append
|
|
817
|
+
*/
|
|
818
|
+
DomQuery.prototype.addClass = function (clazz) {
|
|
819
|
+
this.eachElem(function (item) { return item.classList.add(clazz); });
|
|
820
|
+
return this;
|
|
821
|
+
};
|
|
822
|
+
/**
|
|
823
|
+
* remove the style class if in the class definitions
|
|
824
|
+
*
|
|
825
|
+
* @param clazz
|
|
826
|
+
*/
|
|
827
|
+
DomQuery.prototype.removeClass = function (clazz) {
|
|
828
|
+
this.eachElem(function (item) { return item.classList.remove(clazz); });
|
|
829
|
+
return this;
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* checks whether we have a multipart element in our children
|
|
833
|
+
* or are one
|
|
834
|
+
*/
|
|
835
|
+
DomQuery.prototype.isMultipartCandidate = function (deep) {
|
|
836
|
+
var _this = this;
|
|
837
|
+
if (deep === void 0) { deep = false; }
|
|
838
|
+
var isCandidate = function (item) {
|
|
839
|
+
var _a;
|
|
840
|
+
if (item.length == 0) {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
if (item.length == 1) {
|
|
844
|
+
if (item.tagName.get("booga").value.toLowerCase() == "input" &&
|
|
845
|
+
(((_a = item.attr("type")) === null || _a === void 0 ? void 0 : _a.value) || "").toLowerCase() == "file") {
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
if (deep) {
|
|
849
|
+
return _this.querySelectorAllDeep("input[type='file']").firstElem().isPresent();
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
return _this.querySelectorAll("input[type='file']").firstElem().isPresent();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return item.isMultipartCandidate(deep);
|
|
856
|
+
};
|
|
857
|
+
var ret = this.stream.filter(function (item) { return isCandidate(item); }).first().isPresent();
|
|
858
|
+
return ret;
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* innerHtml equivalkent
|
|
862
|
+
* equivalent to jqueries html
|
|
863
|
+
* as setter the html is set and the
|
|
864
|
+
* DomQuery is given back
|
|
865
|
+
* as getter the html string is returned
|
|
866
|
+
*
|
|
867
|
+
* @param inval
|
|
868
|
+
*/
|
|
869
|
+
DomQuery.prototype.html = function (inval) {
|
|
870
|
+
if (Monad_1.Optional.fromNullable(inval).isAbsent()) {
|
|
871
|
+
return this.isPresent() ? Monad_1.Optional.fromNullable(this.innerHtml) : Monad_1.Optional.absent;
|
|
872
|
+
}
|
|
873
|
+
this.innerHtml = inval;
|
|
874
|
+
return this;
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* Standard dispatch event method, delegated from node
|
|
878
|
+
*/
|
|
879
|
+
DomQuery.prototype.dispatchEvent = function (evt) {
|
|
880
|
+
this.eachElem(function (elem) { return elem.dispatchEvent(evt); });
|
|
881
|
+
return this;
|
|
882
|
+
};
|
|
883
|
+
Object.defineProperty(DomQuery.prototype, "innerHtml", {
|
|
884
|
+
get: function () {
|
|
885
|
+
var retArr = [];
|
|
886
|
+
this.eachElem(function (elem) { return retArr.push(elem.innerHTML); });
|
|
887
|
+
return retArr.join("");
|
|
888
|
+
},
|
|
889
|
+
set: function (inVal) {
|
|
890
|
+
this.eachElem(function (elem) { return elem.innerHTML = inVal; });
|
|
891
|
+
},
|
|
892
|
+
enumerable: false,
|
|
893
|
+
configurable: true
|
|
894
|
+
});
|
|
895
|
+
//source: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
896
|
+
//code snippet license: https://creativecommons.org/licenses/by-sa/2.5/
|
|
897
|
+
DomQuery.prototype._mozMatchesSelector = function (toMatch, selector) {
|
|
898
|
+
var prot = toMatch;
|
|
899
|
+
var matchesSelector = prot.matchesSelector ||
|
|
900
|
+
prot.mozMatchesSelector ||
|
|
901
|
+
prot.msMatchesSelector ||
|
|
902
|
+
prot.oMatchesSelector ||
|
|
903
|
+
prot.webkitMatchesSelector ||
|
|
904
|
+
function (s) {
|
|
905
|
+
var matches = (document || window.ownerDocument).querySelectorAll(s), i = matches.length;
|
|
906
|
+
while (--i >= 0 && matches.item(i) !== toMatch) {
|
|
907
|
+
}
|
|
908
|
+
return i > -1;
|
|
909
|
+
};
|
|
910
|
+
return matchesSelector.call(toMatch, selector);
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* filters the current dom query elements
|
|
914
|
+
* upon a given selector
|
|
915
|
+
*
|
|
916
|
+
* @param selector
|
|
917
|
+
*/
|
|
918
|
+
DomQuery.prototype.filterSelector = function (selector) {
|
|
919
|
+
var _this = this;
|
|
920
|
+
var matched = [];
|
|
921
|
+
this.eachElem(function (item) {
|
|
922
|
+
if (_this._mozMatchesSelector(item, selector)) {
|
|
923
|
+
matched.push(item);
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], matched, false)))();
|
|
927
|
+
};
|
|
928
|
+
DomQuery.prototype.matchesSelector = function (selector) {
|
|
929
|
+
var _this = this;
|
|
930
|
+
this.eachElem(function (item) {
|
|
931
|
+
if (!_this._mozMatchesSelector(item, selector)) {
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
return true;
|
|
936
|
+
};
|
|
937
|
+
/**
|
|
938
|
+
* easy node traversal, you can pass
|
|
939
|
+
* a set of node selectors which are joined as direct childs
|
|
940
|
+
*
|
|
941
|
+
* not the rootnodes are not in the getIf, those are always the child nodes
|
|
942
|
+
*
|
|
943
|
+
* @param nodeSelector
|
|
944
|
+
*/
|
|
945
|
+
DomQuery.prototype.getIf = function () {
|
|
946
|
+
var nodeSelector = [];
|
|
947
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
948
|
+
nodeSelector[_i] = arguments[_i];
|
|
949
|
+
}
|
|
950
|
+
var selectorStage = this.childNodes;
|
|
951
|
+
for (var cnt = 0; cnt < nodeSelector.length; cnt++) {
|
|
952
|
+
selectorStage = selectorStage.filterSelector(nodeSelector[cnt]);
|
|
953
|
+
if (selectorStage.isAbsent()) {
|
|
954
|
+
return selectorStage;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return selectorStage;
|
|
958
|
+
};
|
|
959
|
+
DomQuery.prototype.eachElem = function (func) {
|
|
960
|
+
for (var cnt = 0, len = this.rootNode.length; cnt < len; cnt++) {
|
|
961
|
+
if (func(this.rootNode[cnt], cnt) === false) {
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
return this;
|
|
966
|
+
};
|
|
967
|
+
DomQuery.prototype.firstElem = function (func) {
|
|
968
|
+
if (func === void 0) { func = function (item) { return item; }; }
|
|
969
|
+
if (this.rootNode.length > 1) {
|
|
970
|
+
func(this.rootNode[0], 0);
|
|
971
|
+
}
|
|
972
|
+
return this;
|
|
973
|
+
};
|
|
974
|
+
DomQuery.prototype.each = function (func) {
|
|
975
|
+
Stream_1.Stream.of.apply(Stream_1.Stream, this.rootNode).each(function (item, cnt) {
|
|
976
|
+
//we could use a filter, but for the best performance we dont
|
|
977
|
+
if (item == null) {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
return func(DomQuery.byId(item), cnt);
|
|
981
|
+
});
|
|
982
|
+
return this;
|
|
983
|
+
};
|
|
984
|
+
/**
|
|
985
|
+
* returns a new dom query containing only the first element max
|
|
986
|
+
*
|
|
987
|
+
* @param func a an optional callback function to perform an operation on the first element
|
|
988
|
+
*/
|
|
989
|
+
DomQuery.prototype.first = function (func) {
|
|
990
|
+
if (func === void 0) { func = function (item) { return item; }; }
|
|
991
|
+
if (this.rootNode.length >= 1) {
|
|
992
|
+
func(this.get(0), 0);
|
|
993
|
+
return this.get(0);
|
|
994
|
+
}
|
|
995
|
+
return this;
|
|
996
|
+
};
|
|
997
|
+
/**
|
|
998
|
+
* filter function which filters a subset
|
|
999
|
+
*
|
|
1000
|
+
* @param func
|
|
1001
|
+
*/
|
|
1002
|
+
DomQuery.prototype.filter = function (func) {
|
|
1003
|
+
var reArr = [];
|
|
1004
|
+
this.each(function (item) {
|
|
1005
|
+
func(item) ? reArr.push(item) : null;
|
|
1006
|
+
});
|
|
1007
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], reArr, false)))();
|
|
1008
|
+
};
|
|
1009
|
+
//TODO append prepend
|
|
1010
|
+
/**
|
|
1011
|
+
* global eval head appendix method
|
|
1012
|
+
* no other methods are supported anymore
|
|
1013
|
+
* @param code the code to be evaled
|
|
1014
|
+
* @param nonce optional nonce key for higher security
|
|
1015
|
+
*/
|
|
1016
|
+
DomQuery.prototype.globalEval = function (code, nonce) {
|
|
1017
|
+
var head = document.getElementsByTagName("head")[0] || document.documentElement;
|
|
1018
|
+
var script = document.createElement("script");
|
|
1019
|
+
if (nonce) {
|
|
1020
|
+
script.setAttribute("nonce", nonce);
|
|
1021
|
+
}
|
|
1022
|
+
script.type = "text/javascript";
|
|
1023
|
+
script.innerHTML = code;
|
|
1024
|
+
var newScriptElement = head.appendChild(script);
|
|
1025
|
+
head.removeChild(newScriptElement);
|
|
1026
|
+
return this;
|
|
1027
|
+
};
|
|
1028
|
+
/**
|
|
1029
|
+
* detaches a set of nodes from their parent elements
|
|
1030
|
+
* in a browser independend manner
|
|
1031
|
+
* @param {Object} items the items which need to be detached
|
|
1032
|
+
* @return {Array} an array of nodes with the detached dom nodes
|
|
1033
|
+
*/
|
|
1034
|
+
DomQuery.prototype.detach = function () {
|
|
1035
|
+
this.eachElem(function (item) {
|
|
1036
|
+
item.parentNode.removeChild(item);
|
|
1037
|
+
});
|
|
1038
|
+
return this;
|
|
1039
|
+
};
|
|
1040
|
+
/**
|
|
1041
|
+
* appends the current set of elements
|
|
1042
|
+
* to the element or first element passed via elem
|
|
1043
|
+
* @param elem
|
|
1044
|
+
*/
|
|
1045
|
+
DomQuery.prototype.appendTo = function (elem) {
|
|
1046
|
+
this.eachElem(function (item) {
|
|
1047
|
+
var value1 = elem.getAsElem(0).orElseLazy(function () {
|
|
1048
|
+
return {
|
|
1049
|
+
appendChild: function (theItem) {
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}).value;
|
|
1053
|
+
value1.appendChild(item);
|
|
1054
|
+
});
|
|
1055
|
+
};
|
|
1056
|
+
/**
|
|
1057
|
+
* loads and evals a script from a source uri
|
|
1058
|
+
*
|
|
1059
|
+
* @param src the source to be loaded and evaled
|
|
1060
|
+
* @param defer in miliseconds execution default (0 == no defer)
|
|
1061
|
+
* @param charSet
|
|
1062
|
+
*/
|
|
1063
|
+
DomQuery.prototype.loadScriptEval = function (src, defer, charSet) {
|
|
1064
|
+
var _this = this;
|
|
1065
|
+
if (defer === void 0) { defer = 0; }
|
|
1066
|
+
if (charSet === void 0) { charSet = "utf-8"; }
|
|
1067
|
+
var xhr = new XMLHttpRequest();
|
|
1068
|
+
xhr.open("GET", src, false);
|
|
1069
|
+
if (charSet) {
|
|
1070
|
+
xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
|
|
1071
|
+
}
|
|
1072
|
+
xhr.send(null);
|
|
1073
|
+
xhr.onload = function (responseData) {
|
|
1074
|
+
//defer also means we have to process after the ajax response
|
|
1075
|
+
//has been processed
|
|
1076
|
+
//we can achieve that with a small timeout, the timeout
|
|
1077
|
+
//triggers after the processing is done!
|
|
1078
|
+
if (!defer) {
|
|
1079
|
+
_this.globalEval(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src);
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
//TODO not ideal we maybe ought to move to something else here
|
|
1083
|
+
//but since it is not in use yet, it is ok
|
|
1084
|
+
setTimeout(function () {
|
|
1085
|
+
_this.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
|
|
1086
|
+
}, defer);
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
xhr.onerror = function (data) {
|
|
1090
|
+
throw Error(data);
|
|
1091
|
+
};
|
|
1092
|
+
//since we are synchronous we do it after not with onReadyStateChange
|
|
1093
|
+
return this;
|
|
1094
|
+
};
|
|
1095
|
+
DomQuery.prototype.insertAfter = function () {
|
|
1096
|
+
var toInsertParams = [];
|
|
1097
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1098
|
+
toInsertParams[_i] = arguments[_i];
|
|
1099
|
+
}
|
|
1100
|
+
this.each(function (existingItem) {
|
|
1101
|
+
var existingElement = existingItem.getAsElem(0).value;
|
|
1102
|
+
var rootNode = existingElement.parentNode;
|
|
1103
|
+
var _loop_1 = function (cnt) {
|
|
1104
|
+
var nextSibling = existingElement.nextSibling;
|
|
1105
|
+
toInsertParams[cnt].eachElem(function (insertElem) {
|
|
1106
|
+
if (nextSibling) {
|
|
1107
|
+
rootNode.insertBefore(insertElem, nextSibling);
|
|
1108
|
+
existingElement = nextSibling;
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
rootNode.appendChild(insertElem);
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
};
|
|
1115
|
+
for (var cnt = 0; cnt < toInsertParams.length; cnt++) {
|
|
1116
|
+
_loop_1(cnt);
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
var res = [];
|
|
1120
|
+
res.push(this);
|
|
1121
|
+
res = res.concat(toInsertParams);
|
|
1122
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
1123
|
+
};
|
|
1124
|
+
DomQuery.prototype.insertBefore = function () {
|
|
1125
|
+
var toInsertParams = [];
|
|
1126
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1127
|
+
toInsertParams[_i] = arguments[_i];
|
|
1128
|
+
}
|
|
1129
|
+
this.each(function (existingItem) {
|
|
1130
|
+
var existingElement = existingItem.getAsElem(0).value;
|
|
1131
|
+
var rootNode = existingElement.parentNode;
|
|
1132
|
+
for (var cnt = 0; cnt < toInsertParams.length; cnt++) {
|
|
1133
|
+
toInsertParams[cnt].eachElem(function (insertElem) {
|
|
1134
|
+
rootNode.insertBefore(insertElem, existingElement);
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
var res = [];
|
|
1139
|
+
res.push(this);
|
|
1140
|
+
res = res.concat(toInsertParams);
|
|
1141
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
1142
|
+
};
|
|
1143
|
+
DomQuery.prototype.orElse = function () {
|
|
1144
|
+
var elseValue = [];
|
|
1145
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1146
|
+
elseValue[_i] = arguments[_i];
|
|
1147
|
+
}
|
|
1148
|
+
if (this.isPresent()) {
|
|
1149
|
+
return this;
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], elseValue, false)))();
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
DomQuery.prototype.orElseLazy = function (func) {
|
|
1156
|
+
if (this.isPresent()) {
|
|
1157
|
+
return this;
|
|
1158
|
+
}
|
|
1159
|
+
else {
|
|
1160
|
+
return new DomQuery(func());
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
DomQuery.prototype.parents = function (tagName) {
|
|
1164
|
+
var retSet = new Set();
|
|
1165
|
+
var retArr = [];
|
|
1166
|
+
var lowerTagName = tagName.toLowerCase();
|
|
1167
|
+
var resolveItem = function (item) {
|
|
1168
|
+
if ((item.tagName || "").toLowerCase() == lowerTagName && !retSet.has(item)) {
|
|
1169
|
+
retSet.add(item);
|
|
1170
|
+
retArr.push(item);
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
this.eachElem(function (item) {
|
|
1174
|
+
var _a;
|
|
1175
|
+
while (item.parentNode || item.host) {
|
|
1176
|
+
item = (_a = item === null || item === void 0 ? void 0 : item.parentNode) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.host;
|
|
1177
|
+
resolveItem(item);
|
|
1178
|
+
//nested forms not possible, performance shortcut
|
|
1179
|
+
if (tagName == "form" && retArr.length) {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], retArr, false)))();
|
|
1185
|
+
};
|
|
1186
|
+
DomQuery.prototype.copyAttrs = function (sourceItem) {
|
|
1187
|
+
var _this = this;
|
|
1188
|
+
sourceItem.eachElem(function (sourceNode) {
|
|
1189
|
+
var attrs = objToArray(sourceNode.attributes);
|
|
1190
|
+
for (var _i = 0, attrs_1 = attrs; _i < attrs_1.length; _i++) {
|
|
1191
|
+
var item = attrs_1[_i];
|
|
1192
|
+
var value = item.value;
|
|
1193
|
+
var name_1 = item.name;
|
|
1194
|
+
switch (name_1) {
|
|
1195
|
+
case "id":
|
|
1196
|
+
_this.id.value = value;
|
|
1197
|
+
break;
|
|
1198
|
+
case "disabled":
|
|
1199
|
+
_this.resolveAttributeHolder("disabled").disabled = value;
|
|
1200
|
+
break;
|
|
1201
|
+
case "checked":
|
|
1202
|
+
_this.resolveAttributeHolder("checked").checked = value;
|
|
1203
|
+
break;
|
|
1204
|
+
default:
|
|
1205
|
+
_this.attr(name_1).value = value;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
return this;
|
|
1210
|
+
};
|
|
1211
|
+
/**
|
|
1212
|
+
* resolves an attribute holder compared
|
|
1213
|
+
* @param attrName the attribute name
|
|
1214
|
+
*/
|
|
1215
|
+
DomQuery.prototype.resolveAttributeHolder = function (attrName) {
|
|
1216
|
+
if (attrName === void 0) { attrName = "value"; }
|
|
1217
|
+
var ret = [];
|
|
1218
|
+
ret[attrName] = null;
|
|
1219
|
+
return (attrName in this.getAsElem(0).value) ?
|
|
1220
|
+
this.getAsElem(0).value :
|
|
1221
|
+
ret;
|
|
1222
|
+
};
|
|
1223
|
+
/**
|
|
1224
|
+
* outerhtml convenience method
|
|
1225
|
+
* browsers only support innerHTML but
|
|
1226
|
+
* for instance for your jsf.js we have a full
|
|
1227
|
+
* replace pattern which needs outerHTML processing
|
|
1228
|
+
*
|
|
1229
|
+
* @param markup
|
|
1230
|
+
* @param runEmbeddedScripts
|
|
1231
|
+
* @param runEmbeddedCss
|
|
1232
|
+
*/
|
|
1233
|
+
DomQuery.prototype.outerHTML = function (markup, runEmbeddedScripts, runEmbeddedCss, deep) {
|
|
1234
|
+
var _a;
|
|
1235
|
+
if (deep === void 0) { deep = false; }
|
|
1236
|
+
if (this.isAbsent()) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
var focusElementId = (_a = document === null || document === void 0 ? void 0 : document.activeElement) === null || _a === void 0 ? void 0 : _a.id;
|
|
1240
|
+
var caretPosition = (focusElementId) ? DomQuery.getCaretPosition(document.activeElement) : null;
|
|
1241
|
+
var nodes = DomQuery.fromMarkup(markup);
|
|
1242
|
+
var res = [];
|
|
1243
|
+
var toReplace = this.getAsElem(0).value;
|
|
1244
|
+
var firstInsert = nodes.get(0);
|
|
1245
|
+
var parentNode = toReplace.parentNode;
|
|
1246
|
+
var replaced = firstInsert.getAsElem(0).value;
|
|
1247
|
+
parentNode.replaceChild(replaced, toReplace);
|
|
1248
|
+
res.push(new DomQuery(replaced));
|
|
1249
|
+
//no replacement possible
|
|
1250
|
+
if (this.isAbsent()) {
|
|
1251
|
+
return this;
|
|
1252
|
+
}
|
|
1253
|
+
var insertAdditionalItems = [];
|
|
1254
|
+
if (nodes.length > 1) {
|
|
1255
|
+
insertAdditionalItems = insertAdditionalItems.concat.apply(insertAdditionalItems, nodes.values.slice(1));
|
|
1256
|
+
res.push(DomQuery.byId(replaced).insertAfter(new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], insertAdditionalItems, false)))()));
|
|
1257
|
+
}
|
|
1258
|
+
if (runEmbeddedScripts) {
|
|
1259
|
+
this.runScripts();
|
|
1260
|
+
}
|
|
1261
|
+
if (runEmbeddedCss) {
|
|
1262
|
+
this.runCss();
|
|
1263
|
+
}
|
|
1264
|
+
var focusElement = DomQuery.byId(focusElementId);
|
|
1265
|
+
if (focusElementId && focusElement.isPresent() &&
|
|
1266
|
+
caretPosition != null && "undefined" != typeof caretPosition) {
|
|
1267
|
+
focusElement.eachElem(function (item) { return DomQuery.setCaretPosition(item, caretPosition); });
|
|
1268
|
+
}
|
|
1269
|
+
return nodes;
|
|
1270
|
+
};
|
|
1271
|
+
/**
|
|
1272
|
+
* Run through the given nodes in the DomQuery execute the inline scripts
|
|
1273
|
+
* @param whilteListed: optional whitelist function which can filter out script tags which are not processed
|
|
1274
|
+
* defaults to the standard jsf.js exclusion (we use this code for myfaces)
|
|
1275
|
+
*/
|
|
1276
|
+
DomQuery.prototype.runScripts = function (whilteListed) {
|
|
1277
|
+
var _this = this;
|
|
1278
|
+
if (whilteListed === void 0) { whilteListed = DEFAULT_WHITELIST; }
|
|
1279
|
+
var finalScripts = [], equi = equalsIgnoreCase, execScrpt = function (item) {
|
|
1280
|
+
var tagName = item.tagName;
|
|
1281
|
+
var itemType = item.type || "";
|
|
1282
|
+
if (tagName && equi(tagName, "script") &&
|
|
1283
|
+
(itemType === "" || equi(itemType, "text/javascript") ||
|
|
1284
|
+
equi(itemType, "javascript") ||
|
|
1285
|
+
equi(itemType, "text/ecmascript") ||
|
|
1286
|
+
equi(itemType, "ecmascript"))) {
|
|
1287
|
+
var src = item.getAttribute('src');
|
|
1288
|
+
if ('undefined' != typeof src
|
|
1289
|
+
&& null != src
|
|
1290
|
+
&& src.length > 0) {
|
|
1291
|
+
//we have to move this into an inner if because chrome otherwise chokes
|
|
1292
|
+
//due to changing the and order instead of relying on left to right
|
|
1293
|
+
//if jsf.js is already registered we do not replace it anymore
|
|
1294
|
+
if (whilteListed(src)) {
|
|
1295
|
+
if (finalScripts.length) {
|
|
1296
|
+
//script source means we have to eval the existing
|
|
1297
|
+
//scripts before running the include
|
|
1298
|
+
_this.globalEval(finalScripts.join("\n"));
|
|
1299
|
+
finalScripts = [];
|
|
1300
|
+
}
|
|
1301
|
+
_this.loadScriptEval(src, 0, "UTF-8");
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
else {
|
|
1305
|
+
// embedded script auto eval
|
|
1306
|
+
//TODO this probably needs to be changed due to our new parsing structures
|
|
1307
|
+
//probably not needed anymore
|
|
1308
|
+
var evalText = trim(item.text || item.innerText || item.innerHTML);
|
|
1309
|
+
var go = true;
|
|
1310
|
+
while (go) {
|
|
1311
|
+
go = false;
|
|
1312
|
+
if (evalText.substring(0, 4) == "<!--") {
|
|
1313
|
+
evalText = evalText.substring(4);
|
|
1314
|
+
go = true;
|
|
1315
|
+
}
|
|
1316
|
+
if (evalText.substring(0, 4) == "//<!--") {
|
|
1317
|
+
evalText = evalText.substring(6);
|
|
1318
|
+
go = true;
|
|
1319
|
+
}
|
|
1320
|
+
if (evalText.substring(0, 11) == "//<![CDATA[") {
|
|
1321
|
+
evalText = evalText.substring(11);
|
|
1322
|
+
go = true;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
// we have to run the script under a global context
|
|
1326
|
+
//we store the script for less calls to eval
|
|
1327
|
+
finalScripts.push(evalText);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
try {
|
|
1332
|
+
var scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
|
|
1333
|
+
//script execution order by relative pos in their dom tree
|
|
1334
|
+
scriptElements.stream
|
|
1335
|
+
.flatMap(function (item) { return Stream_1.Stream.of(item.values); })
|
|
1336
|
+
.sort(function (node1, node2) { return node1.compareDocumentPosition(node2) - 3; }) //preceding 2, following == 4)
|
|
1337
|
+
.each(function (item) { return execScrpt(item); });
|
|
1338
|
+
if (finalScripts.length) {
|
|
1339
|
+
this.globalEval(finalScripts.join("\n"));
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
catch (e) {
|
|
1343
|
+
if (window.console && window.console.error) {
|
|
1344
|
+
//not sure if we
|
|
1345
|
+
//should use our standard
|
|
1346
|
+
//error mechanisms here
|
|
1347
|
+
//because in the head appendix
|
|
1348
|
+
//method only a console
|
|
1349
|
+
//error would be raised as well
|
|
1350
|
+
console.error(e.message || e.description);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
finally {
|
|
1354
|
+
//the usual ie6 fix code
|
|
1355
|
+
//the IE6 garbage collector is broken
|
|
1356
|
+
//nulling closures helps somewhat to reduce
|
|
1357
|
+
//mem leaks, which are impossible to avoid
|
|
1358
|
+
//at this browser
|
|
1359
|
+
execScrpt = null;
|
|
1360
|
+
}
|
|
1361
|
+
return this;
|
|
1362
|
+
};
|
|
1363
|
+
DomQuery.prototype.runCss = function () {
|
|
1364
|
+
var applyStyle = function (item, style) {
|
|
1365
|
+
var _a, _b, _c, _d;
|
|
1366
|
+
var newSS = document.createElement("style");
|
|
1367
|
+
document.getElementsByTagName("head")[0].appendChild(newSS);
|
|
1368
|
+
var styleSheet = (_a = newSS.sheet) !== null && _a !== void 0 ? _a : newSS.styleSheet;
|
|
1369
|
+
newSS.setAttribute("rel", (_b = item.getAttribute("rel")) !== null && _b !== void 0 ? _b : "stylesheet");
|
|
1370
|
+
newSS.setAttribute("type", (_c = item.getAttribute("type")) !== null && _c !== void 0 ? _c : "text/css");
|
|
1371
|
+
if ((_d = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssText) !== null && _d !== void 0 ? _d : false) {
|
|
1372
|
+
styleSheet.cssText = style;
|
|
1373
|
+
}
|
|
1374
|
+
else {
|
|
1375
|
+
newSS.appendChild(document.createTextNode(style));
|
|
1376
|
+
}
|
|
1377
|
+
}, execCss = function (item) {
|
|
1378
|
+
var tagName = item.tagName;
|
|
1379
|
+
if (tagName && equalsIgnoreCase(tagName, "link") && equalsIgnoreCase(item.getAttribute("type"), "text/css")) {
|
|
1380
|
+
applyStyle(item, "@import url('" + item.getAttribute("href") + "');");
|
|
1381
|
+
}
|
|
1382
|
+
else if (tagName && equalsIgnoreCase(tagName, "style") && equalsIgnoreCase(item.getAttribute("type"), "text/css")) {
|
|
1383
|
+
var innerText_1 = [];
|
|
1384
|
+
//compliant browsers know child nodes
|
|
1385
|
+
var childNodes = Array.prototype.slice.call(item.childNodes);
|
|
1386
|
+
if (childNodes) {
|
|
1387
|
+
childNodes.forEach(function (child) { return innerText_1.push(child.innerHTML || child.data); });
|
|
1388
|
+
//non compliant ones innerHTML
|
|
1389
|
+
}
|
|
1390
|
+
else if (item.innerHTML) {
|
|
1391
|
+
innerText_1.push(item.innerHTML);
|
|
1392
|
+
}
|
|
1393
|
+
applyStyle(item, innerText_1.join(""));
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
var scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
|
|
1397
|
+
scriptElements.stream
|
|
1398
|
+
.flatMap(function (item) { return Stream_1.Stream.of(item.values); })
|
|
1399
|
+
.sort(function (node1, node2) { return node1.compareDocumentPosition(node2) - 3; })
|
|
1400
|
+
.each(function (item) { return execCss(item); });
|
|
1401
|
+
return this;
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* fires a click event on the underlying dom elements
|
|
1405
|
+
*/
|
|
1406
|
+
DomQuery.prototype.click = function () {
|
|
1407
|
+
this.fireEvent("click");
|
|
1408
|
+
return this;
|
|
1409
|
+
};
|
|
1410
|
+
DomQuery.prototype.addEventListener = function (type, listener, options) {
|
|
1411
|
+
this.eachElem(function (node) { return node.addEventListener(type, listener, options); });
|
|
1412
|
+
return this;
|
|
1413
|
+
};
|
|
1414
|
+
DomQuery.prototype.removeEventListener = function (type, listener, options) {
|
|
1415
|
+
this.eachElem(function (node) { return node.removeEventListener(type, listener, options); });
|
|
1416
|
+
return this;
|
|
1417
|
+
};
|
|
1418
|
+
/**
|
|
1419
|
+
* fires an event
|
|
1420
|
+
*/
|
|
1421
|
+
DomQuery.prototype.fireEvent = function (eventName) {
|
|
1422
|
+
this.eachElem(function (node) {
|
|
1423
|
+
var doc;
|
|
1424
|
+
if (node.ownerDocument) {
|
|
1425
|
+
doc = node.ownerDocument;
|
|
1426
|
+
}
|
|
1427
|
+
else if (node.nodeType == 9) {
|
|
1428
|
+
// the node may be the document itself, nodeType 9 = DOCUMENT_NODE
|
|
1429
|
+
doc = node;
|
|
1430
|
+
}
|
|
1431
|
+
else {
|
|
1432
|
+
throw new Error("Invalid node passed to fireEvent: " + node.id);
|
|
1433
|
+
}
|
|
1434
|
+
if (node.dispatchEvent) {
|
|
1435
|
+
// Gecko-style approach (now the standard) takes more work
|
|
1436
|
+
var eventClass = "";
|
|
1437
|
+
// Different events have different event classes.
|
|
1438
|
+
// If this switch statement can't map an eventName to an eventClass,
|
|
1439
|
+
// the event firing is going to fail.
|
|
1440
|
+
switch (eventName) {
|
|
1441
|
+
case "click": // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.
|
|
1442
|
+
case "mousedown":
|
|
1443
|
+
case "mouseup":
|
|
1444
|
+
eventClass = "MouseEvents";
|
|
1445
|
+
break;
|
|
1446
|
+
case "focus":
|
|
1447
|
+
case "change":
|
|
1448
|
+
case "blur":
|
|
1449
|
+
case "select":
|
|
1450
|
+
eventClass = "HTMLEvents";
|
|
1451
|
+
break;
|
|
1452
|
+
default:
|
|
1453
|
+
throw "fireEvent: Couldn't find an event class for event '" + eventName + "'.";
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
var event_1 = doc.createEvent(eventClass);
|
|
1457
|
+
event_1.initEvent(eventName, true, true); // All events created as bubbling and cancelable.
|
|
1458
|
+
event_1.synthetic = true; // allow detection of synthetic events
|
|
1459
|
+
// The second parameter says go ahead with the default action
|
|
1460
|
+
node.dispatchEvent(event_1);
|
|
1461
|
+
}
|
|
1462
|
+
else if (node.fireEvent) {
|
|
1463
|
+
// IE-old school style, you can drop this if you don't need to support IE8 and lower
|
|
1464
|
+
var event_2 = doc.createEventObject();
|
|
1465
|
+
event_2.synthetic = true; // allow detection of synthetic events
|
|
1466
|
+
node.fireEvent("on" + eventName, event_2);
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
};
|
|
1470
|
+
DomQuery.prototype.textContent = function (joinstr) {
|
|
1471
|
+
if (joinstr === void 0) { joinstr = ""; }
|
|
1472
|
+
return this.stream
|
|
1473
|
+
.map(function (value) {
|
|
1474
|
+
var item = value.getAsElem(0).orElseLazy(function () {
|
|
1475
|
+
return {
|
|
1476
|
+
textContent: ""
|
|
1477
|
+
};
|
|
1478
|
+
}).value;
|
|
1479
|
+
return item.textContent || "";
|
|
1480
|
+
})
|
|
1481
|
+
.reduce(function (text1, text2) { return text1 + joinstr + text2; }, "").value;
|
|
1482
|
+
};
|
|
1483
|
+
DomQuery.prototype.innerText = function (joinstr) {
|
|
1484
|
+
if (joinstr === void 0) { joinstr = ""; }
|
|
1485
|
+
return this.stream
|
|
1486
|
+
.map(function (value) {
|
|
1487
|
+
var item = value.getAsElem(0).orElseLazy(function () {
|
|
1488
|
+
return {
|
|
1489
|
+
innerText: ""
|
|
1490
|
+
};
|
|
1491
|
+
}).value;
|
|
1492
|
+
return item.innerText || "";
|
|
1493
|
+
})
|
|
1494
|
+
.reduce(function (text1, text2) { return [text1, text2].join(joinstr); }, "").value;
|
|
1495
|
+
};
|
|
1496
|
+
/**
|
|
1497
|
+
* encodes all input elements properly into respective
|
|
1498
|
+
* config entries, this can be used
|
|
1499
|
+
* for legacy systems, for newer usecases, use the
|
|
1500
|
+
* HTML5 Form class which all newer browsers provide
|
|
1501
|
+
*
|
|
1502
|
+
* @param toMerge optional config which can be merged in
|
|
1503
|
+
* @return a copy pf
|
|
1504
|
+
*/
|
|
1505
|
+
DomQuery.prototype.encodeFormElement = function (toMerge) {
|
|
1506
|
+
if (toMerge === void 0) { toMerge = new Monad_1.Config({}); }
|
|
1507
|
+
//browser behavior no element name no encoding (normal submit fails in that case)
|
|
1508
|
+
//https://issues.apache.org/jira/browse/MYFACES-2847
|
|
1509
|
+
if (this.name.isAbsent()) {
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
//lets keep it sideffects free
|
|
1513
|
+
var target = toMerge.shallowCopy;
|
|
1514
|
+
this.each(function (element) {
|
|
1515
|
+
var _a, _b;
|
|
1516
|
+
if (element.name.isAbsent()) { //no name, no encoding
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
var name = element.name.value;
|
|
1520
|
+
var tagName = element.tagName.orElse("__none__").value.toLowerCase();
|
|
1521
|
+
var elemType = element.type.orElse("__none__").value.toLowerCase();
|
|
1522
|
+
elemType = elemType.toLowerCase();
|
|
1523
|
+
// routine for all elements
|
|
1524
|
+
// rules:
|
|
1525
|
+
// - process only inputs, textareas and selects
|
|
1526
|
+
// - elements muest have attribute "name"
|
|
1527
|
+
// - elements must not be disabled
|
|
1528
|
+
if (((tagName == "input" || tagName == "textarea" || tagName == "select") &&
|
|
1529
|
+
(name != null && name != "")) && !element.disabled) {
|
|
1530
|
+
// routine for select elements
|
|
1531
|
+
// rules:
|
|
1532
|
+
// - if select-one and value-Attribute exist => "name=value"
|
|
1533
|
+
// (also if value empty => "name=")
|
|
1534
|
+
// - if select-one and value-Attribute don't exist =>
|
|
1535
|
+
// "name=DisplayValue"
|
|
1536
|
+
// - if select multi and multple selected => "name=value1&name=value2"
|
|
1537
|
+
// - if select and selectedIndex=-1 don't submit
|
|
1538
|
+
if (tagName == "select") {
|
|
1539
|
+
// selectedIndex must be >= 0 sein to be submittet
|
|
1540
|
+
var selectElem = element.getAsElem(0).value;
|
|
1541
|
+
if (selectElem.selectedIndex >= 0) {
|
|
1542
|
+
var uLen = selectElem.options.length;
|
|
1543
|
+
for (var u = 0; u < uLen; u++) {
|
|
1544
|
+
// find all selected options
|
|
1545
|
+
//let subBuf = [];
|
|
1546
|
+
if (selectElem.options[u].selected) {
|
|
1547
|
+
var elementOption = selectElem.options[u];
|
|
1548
|
+
target.append(name).value = (elementOption.getAttribute("value") != null) ?
|
|
1549
|
+
elementOption.value : elementOption.text;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
// routine for remaining elements
|
|
1555
|
+
// rules:
|
|
1556
|
+
// - don't submit no selects (processed above), buttons, reset buttons, submit buttons,
|
|
1557
|
+
// - submit checkboxes and radio inputs only if checked
|
|
1558
|
+
if ((tagName != Submittables.SELECT &&
|
|
1559
|
+
elemType != Submittables.BUTTON &&
|
|
1560
|
+
elemType != Submittables.RESET &&
|
|
1561
|
+
elemType != Submittables.SUBMIT &&
|
|
1562
|
+
elemType != Submittables.IMAGE) && ((elemType != Submittables.CHECKBOX && elemType != Submittables.RADIO) ||
|
|
1563
|
+
element.checked)) {
|
|
1564
|
+
var files = (_b = (_a = element.value.value) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : [];
|
|
1565
|
+
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
1566
|
+
//xhr level2
|
|
1567
|
+
target.append(name).value = files[0];
|
|
1568
|
+
}
|
|
1569
|
+
else {
|
|
1570
|
+
target.append(name).value = element.inputValue.value;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
return target;
|
|
1576
|
+
};
|
|
1577
|
+
Object.defineProperty(DomQuery.prototype, "cDATAAsString", {
|
|
1578
|
+
get: function () {
|
|
1579
|
+
var cDataBlock = [];
|
|
1580
|
+
var TYPE_CDATA_BLOCK = 4;
|
|
1581
|
+
var res = this.lazyStream.flatMap(function (item) {
|
|
1582
|
+
return item.childNodes.stream;
|
|
1583
|
+
}).filter(function (item) {
|
|
1584
|
+
var _a, _b;
|
|
1585
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.nodeType) == TYPE_CDATA_BLOCK;
|
|
1586
|
+
}).reduce(function (reduced, item) {
|
|
1587
|
+
var _a, _b, _c;
|
|
1588
|
+
reduced.push((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : "");
|
|
1589
|
+
return reduced;
|
|
1590
|
+
}, []).value;
|
|
1591
|
+
// response may contain several blocks
|
|
1592
|
+
return res.join("");
|
|
1593
|
+
},
|
|
1594
|
+
enumerable: false,
|
|
1595
|
+
configurable: true
|
|
1596
|
+
});
|
|
1597
|
+
DomQuery.prototype.subNodes = function (from, to) {
|
|
1598
|
+
if (Monad_1.Optional.fromNullable(to).isAbsent()) {
|
|
1599
|
+
to = this.length;
|
|
1600
|
+
}
|
|
1601
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.rootNode.slice(from, Math.min(to, this.length)), false)))();
|
|
1602
|
+
};
|
|
1603
|
+
DomQuery.prototype.limits = function (end) {
|
|
1604
|
+
this._limits = end;
|
|
1605
|
+
return this;
|
|
1606
|
+
};
|
|
1607
|
+
//-- internally exposed methods needed for the interconnectivity
|
|
1608
|
+
DomQuery.prototype.hasNext = function () {
|
|
1609
|
+
var isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
|
|
1610
|
+
var isEndOfArray = this.pos >= this.values.length - 1;
|
|
1611
|
+
return !(isLimitsReached ||
|
|
1612
|
+
isEndOfArray);
|
|
1613
|
+
};
|
|
1614
|
+
DomQuery.prototype.next = function () {
|
|
1615
|
+
if (!this.hasNext()) {
|
|
1616
|
+
return null;
|
|
1617
|
+
}
|
|
1618
|
+
this.pos++;
|
|
1619
|
+
return new DomQuery(this.values[this.pos]);
|
|
1620
|
+
};
|
|
1621
|
+
DomQuery.prototype.reset = function () {
|
|
1622
|
+
this.pos = -1;
|
|
1623
|
+
};
|
|
1624
|
+
DomQuery.prototype.attachShadow = function (params) {
|
|
1625
|
+
if (params === void 0) { params = { mode: "open" }; }
|
|
1626
|
+
var shadowRoots = [];
|
|
1627
|
+
this.eachElem(function (item) {
|
|
1628
|
+
var shadowElement;
|
|
1629
|
+
if (item === null || item === void 0 ? void 0 : item.attachShadow) {
|
|
1630
|
+
shadowElement = DomQuery.byId(item.attachShadow(params));
|
|
1631
|
+
shadowRoots.push(shadowElement);
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
throw new Error("Shadow dom creation not supported by the browser, please use a shim, to gain this functionality");
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], shadowRoots, false)))();
|
|
1638
|
+
};
|
|
1639
|
+
/**
|
|
1640
|
+
* helper to fix a common dom problem
|
|
1641
|
+
* we have to wait until a certain condition is met, in most of the cases we just want to know whether an element is present in the subdome before being able to proceed
|
|
1642
|
+
* @param condition
|
|
1643
|
+
* @param options
|
|
1644
|
+
*/
|
|
1645
|
+
DomQuery.prototype.waitUntilDom = function (condition, options) {
|
|
1646
|
+
if (options === void 0) { options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }; }
|
|
1647
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1648
|
+
return __generator(this, function (_a) {
|
|
1649
|
+
return [2 /*return*/, waitUntilDom(this, condition, options)];
|
|
1650
|
+
});
|
|
1651
|
+
});
|
|
1652
|
+
};
|
|
1653
|
+
Object.defineProperty(DomQuery.prototype, "shadowElements", {
|
|
1654
|
+
/**
|
|
1655
|
+
* returns the embedded shadow elements
|
|
1656
|
+
*/
|
|
1657
|
+
get: function () {
|
|
1658
|
+
var shadowElements = this.querySelectorAll("*")
|
|
1659
|
+
.filter(function (item) { return item.hasShadow; });
|
|
1660
|
+
var mapped = (shadowElements.allElems() || []).map(function (element) { return element.shadowRoot; });
|
|
1661
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], mapped, false)))();
|
|
1662
|
+
},
|
|
1663
|
+
enumerable: false,
|
|
1664
|
+
configurable: true
|
|
1665
|
+
});
|
|
1666
|
+
Object.defineProperty(DomQuery.prototype, "shadowRoot", {
|
|
1667
|
+
get: function () {
|
|
1668
|
+
var shadowRoots = [];
|
|
1669
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
1670
|
+
if (this.rootNode[cnt].shadowRoot) {
|
|
1671
|
+
shadowRoots.push(this.rootNode[cnt].shadowRoot);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], shadowRoots, false)))();
|
|
1675
|
+
},
|
|
1676
|
+
enumerable: false,
|
|
1677
|
+
configurable: true
|
|
1678
|
+
});
|
|
1679
|
+
Object.defineProperty(DomQuery.prototype, "hasShadow", {
|
|
1680
|
+
get: function () {
|
|
1681
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
1682
|
+
if (this.rootNode[cnt].shadowRoot) {
|
|
1683
|
+
return true;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
return false;
|
|
1687
|
+
},
|
|
1688
|
+
enumerable: false,
|
|
1689
|
+
configurable: true
|
|
1690
|
+
});
|
|
1691
|
+
//from
|
|
1692
|
+
// http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/
|
|
1693
|
+
DomQuery.getCaretPosition = function (ctrl) {
|
|
1694
|
+
var caretPos = 0;
|
|
1695
|
+
try {
|
|
1696
|
+
if (document === null || document === void 0 ? void 0 : document.selection) {
|
|
1697
|
+
ctrl.focus();
|
|
1698
|
+
var selection = document.selection.createRange();
|
|
1699
|
+
//the selection now is start zero
|
|
1700
|
+
selection.moveStart('character', -ctrl.value.length);
|
|
1701
|
+
//the caretposition is the selection start
|
|
1702
|
+
caretPos = selection.text.length;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
catch (e) {
|
|
1706
|
+
//now this is ugly, but not supported input types throw errors for selectionStart
|
|
1707
|
+
//just in case someone dumps this code onto unsupported browsers
|
|
1708
|
+
}
|
|
1709
|
+
return caretPos;
|
|
1710
|
+
};
|
|
1711
|
+
/**
|
|
1712
|
+
* sets the caret position
|
|
1713
|
+
*
|
|
1714
|
+
* @param ctrl the control to set the caret position to
|
|
1715
|
+
* @param pos the position to set
|
|
1716
|
+
*
|
|
1717
|
+
* note if the control does not have any selectable and focusable behavior
|
|
1718
|
+
* calling this method does nothing (silent fail)
|
|
1719
|
+
*
|
|
1720
|
+
*/
|
|
1721
|
+
DomQuery.setCaretPosition = function (ctrl, pos) {
|
|
1722
|
+
(ctrl === null || ctrl === void 0 ? void 0 : ctrl.focus) ? ctrl === null || ctrl === void 0 ? void 0 : ctrl.focus() : null;
|
|
1723
|
+
//the selection range is our caret position
|
|
1724
|
+
(ctrl === null || ctrl === void 0 ? void 0 : ctrl.setSelectiongRange) ? ctrl === null || ctrl === void 0 ? void 0 : ctrl.setSelectiongRange(pos, pos) : null;
|
|
1725
|
+
};
|
|
1726
|
+
/**
|
|
1727
|
+
* Implementation of an iterator
|
|
1728
|
+
* to allow loops over dom query collections
|
|
1729
|
+
*/
|
|
1730
|
+
DomQuery.prototype[Symbol.iterator] = function () {
|
|
1731
|
+
var _this = this;
|
|
1732
|
+
return {
|
|
1733
|
+
next: function () {
|
|
1734
|
+
var done = !_this.hasNext();
|
|
1735
|
+
var val = _this.next();
|
|
1736
|
+
return {
|
|
1737
|
+
done: done,
|
|
1738
|
+
value: val
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
};
|
|
1743
|
+
DomQuery.absent = new DomQuery();
|
|
1744
|
+
return DomQuery;
|
|
1745
|
+
}());
|
|
1746
|
+
exports.DomQuery = DomQuery;
|
|
1747
|
+
/**
|
|
1748
|
+
* Various collectors
|
|
1749
|
+
* which can be used in conjunction with Streams
|
|
1750
|
+
*/
|
|
1751
|
+
/**
|
|
1752
|
+
* A collector which bundles a full dom query stream into a single dom query element
|
|
1753
|
+
*
|
|
1754
|
+
* This connects basically our stream back into DomQuery
|
|
1755
|
+
*/
|
|
1756
|
+
var DomQueryCollector = /** @class */ (function () {
|
|
1757
|
+
function DomQueryCollector() {
|
|
1758
|
+
this.data = [];
|
|
1759
|
+
}
|
|
1760
|
+
DomQueryCollector.prototype.collect = function (element) {
|
|
1761
|
+
this.data.push(element);
|
|
1762
|
+
};
|
|
1763
|
+
Object.defineProperty(DomQueryCollector.prototype, "finalValue", {
|
|
1764
|
+
get: function () {
|
|
1765
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.data, false)))();
|
|
1766
|
+
},
|
|
1767
|
+
enumerable: false,
|
|
1768
|
+
configurable: true
|
|
1769
|
+
});
|
|
1770
|
+
return DomQueryCollector;
|
|
1771
|
+
}());
|
|
1772
|
+
exports.DomQueryCollector = DomQueryCollector;
|
|
1773
|
+
/**
|
|
1774
|
+
* abbreviation for DomQuery
|
|
1775
|
+
*/
|
|
1776
|
+
exports.DQ = DomQuery;
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
/***/ }),
|
|
1780
|
+
|
|
1781
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Lang.ts":
|
|
1782
|
+
/*!************************************************************!*\
|
|
1783
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Lang.ts ***!
|
|
1784
|
+
\************************************************************/
|
|
1785
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1789
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
1790
|
+
* this work for additional information regarding copyright ownership.
|
|
1791
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
1792
|
+
* (the "License"); you may not use this file except in compliance with
|
|
1793
|
+
* the License. You may obtain a copy of the License at
|
|
1794
|
+
*
|
|
1795
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1796
|
+
*
|
|
1797
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1798
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1799
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1800
|
+
* See the License for the specific language governing permissions and
|
|
1801
|
+
* limitations under the License.
|
|
1802
|
+
*/
|
|
1803
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1804
|
+
exports.Lang = void 0;
|
|
1805
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
1806
|
+
/**
|
|
1807
|
+
* Lang helpers crossported from the apache myfaces project
|
|
1808
|
+
*/
|
|
1809
|
+
var Lang;
|
|
1810
|
+
(function (Lang) {
|
|
1811
|
+
//should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
|
|
1812
|
+
/**
|
|
1813
|
+
* helper function to savely resolve anything
|
|
1814
|
+
* this is not an elvis operator, it resolves
|
|
1815
|
+
* a value without exception in a tree and if
|
|
1816
|
+
* it is not resolvable then an optional of
|
|
1817
|
+
* a default value is restored or Optional.empty
|
|
1818
|
+
* if none is given
|
|
1819
|
+
*
|
|
1820
|
+
* usage
|
|
1821
|
+
* <code>
|
|
1822
|
+
* let var: Optiona<string> = saveResolve(() => a.b.c.d.e, "foobaz")
|
|
1823
|
+
* </code>
|
|
1824
|
+
*
|
|
1825
|
+
* @param resolverProducer a lambda which can produce the value
|
|
1826
|
+
* @param defaultValue an optional default value if the producer failes to produce anything
|
|
1827
|
+
* @returns an Optional of the produced value
|
|
1828
|
+
*/
|
|
1829
|
+
function saveResolve(resolverProducer, defaultValue) {
|
|
1830
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1831
|
+
try {
|
|
1832
|
+
var result = resolverProducer();
|
|
1833
|
+
return Monad_1.Optional.fromNullable(result !== null && result !== void 0 ? result : defaultValue);
|
|
1834
|
+
}
|
|
1835
|
+
catch (e) {
|
|
1836
|
+
return Monad_1.Optional.absent;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
Lang.saveResolve = saveResolve;
|
|
1840
|
+
function saveResolveLazy(resolverProducer, defaultValue) {
|
|
1841
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1842
|
+
try {
|
|
1843
|
+
var result = resolverProducer();
|
|
1844
|
+
return Monad_1.Optional.fromNullable(result !== null && result !== void 0 ? result : defaultValue());
|
|
1845
|
+
}
|
|
1846
|
+
catch (e) {
|
|
1847
|
+
return Monad_1.Optional.absent;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
Lang.saveResolveLazy = saveResolveLazy;
|
|
1851
|
+
/**
|
|
1852
|
+
* String to array function performs a string to array transformation
|
|
1853
|
+
* @param {String} it the string which has to be changed into an array
|
|
1854
|
+
* @param {RegExp} splitter our splitter reglar expression
|
|
1855
|
+
* @return a trimmed array of the splitted string
|
|
1856
|
+
*/
|
|
1857
|
+
function strToArray(it, splitter) {
|
|
1858
|
+
if (splitter === void 0) { splitter = /\./gi; }
|
|
1859
|
+
var ret = [];
|
|
1860
|
+
it.split(splitter).forEach((function (element) {
|
|
1861
|
+
ret.push(trim(element));
|
|
1862
|
+
}));
|
|
1863
|
+
return ret;
|
|
1864
|
+
}
|
|
1865
|
+
Lang.strToArray = strToArray;
|
|
1866
|
+
/**
|
|
1867
|
+
* hyperfast trim
|
|
1868
|
+
* http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
|
1869
|
+
* crossported from dojo
|
|
1870
|
+
*/
|
|
1871
|
+
function trim(str) {
|
|
1872
|
+
str = str.replace(/^\s\s*/, '');
|
|
1873
|
+
var ws = /\s/, i = str.length;
|
|
1874
|
+
while (ws.test(str.charAt(--i))) {
|
|
1875
|
+
//do nothing
|
|
1876
|
+
}
|
|
1877
|
+
return str.slice(0, i + 1);
|
|
1878
|
+
}
|
|
1879
|
+
Lang.trim = trim;
|
|
1880
|
+
/**
|
|
1881
|
+
* generic object arrays like dom definitions to array conversion method which
|
|
1882
|
+
* transforms any object to something array like
|
|
1883
|
+
* @param obj
|
|
1884
|
+
* @param offset
|
|
1885
|
+
* @param pack
|
|
1886
|
+
* @returns an array converted from the object
|
|
1887
|
+
*/
|
|
1888
|
+
function objToArray(obj, offset, pack) {
|
|
1889
|
+
if (offset === void 0) { offset = 0; }
|
|
1890
|
+
if (pack === void 0) { pack = []; }
|
|
1891
|
+
if ((obj !== null && obj !== void 0 ? obj : "__undefined__") == "__undefined__") {
|
|
1892
|
+
return pack !== null && pack !== void 0 ? pack : null;
|
|
1893
|
+
}
|
|
1894
|
+
//since offset is numeric we cannot use the shortcut due to 0 being false
|
|
1895
|
+
//special condition array delivered no offset no pack
|
|
1896
|
+
if (obj instanceof Array && !offset && !pack)
|
|
1897
|
+
return obj;
|
|
1898
|
+
return pack.concat(Array.prototype.slice.call(obj, offset));
|
|
1899
|
+
}
|
|
1900
|
+
Lang.objToArray = objToArray;
|
|
1901
|
+
/**
|
|
1902
|
+
* equalsIgnoreCase, case insensitive comparison of two strings
|
|
1903
|
+
*
|
|
1904
|
+
* @param source
|
|
1905
|
+
* @param destination
|
|
1906
|
+
*/
|
|
1907
|
+
function equalsIgnoreCase(source, destination) {
|
|
1908
|
+
var finalSource = source !== null && source !== void 0 ? source : "___no_value__";
|
|
1909
|
+
var finalDest = destination !== null && destination !== void 0 ? destination : "___no_value__";
|
|
1910
|
+
//in any other case we do a strong string comparison
|
|
1911
|
+
return finalSource.toLowerCase() === finalDest.toLowerCase();
|
|
1912
|
+
}
|
|
1913
|
+
Lang.equalsIgnoreCase = equalsIgnoreCase;
|
|
1914
|
+
/**
|
|
1915
|
+
* runtime type assertion
|
|
1916
|
+
*
|
|
1917
|
+
* @param probe the probe to be tested for a type
|
|
1918
|
+
* @param theType the type to be tested for
|
|
1919
|
+
*/
|
|
1920
|
+
function assertType(probe, theType) {
|
|
1921
|
+
return isString(theType) ? typeof probe == theType : probe instanceof theType;
|
|
1922
|
+
}
|
|
1923
|
+
Lang.assertType = assertType;
|
|
1924
|
+
/**
|
|
1925
|
+
* Backported from dojo
|
|
1926
|
+
* a failsafe string determination method
|
|
1927
|
+
* (since in javascript String != "" typeof alone fails!)
|
|
1928
|
+
* @param it {|Object|} the object to be checked for being a string
|
|
1929
|
+
* @return true in case of being a string false otherwise
|
|
1930
|
+
*/
|
|
1931
|
+
function isString(it) {
|
|
1932
|
+
// summary:
|
|
1933
|
+
// Return true if it is a String
|
|
1934
|
+
return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
|
|
1935
|
+
}
|
|
1936
|
+
Lang.isString = isString;
|
|
1937
|
+
function isFunc(it) {
|
|
1938
|
+
return it instanceof Function || typeof it === "function";
|
|
1939
|
+
}
|
|
1940
|
+
Lang.isFunc = isFunc;
|
|
1941
|
+
// code from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
1942
|
+
// license https://creativecommons.org/licenses/by-sa/2.5/
|
|
1943
|
+
function objAssign(target) {
|
|
1944
|
+
var theArgs = [];
|
|
1945
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1946
|
+
theArgs[_i - 1] = arguments[_i];
|
|
1947
|
+
}
|
|
1948
|
+
if (target == null) { // TypeError if undefined or null
|
|
1949
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
1950
|
+
}
|
|
1951
|
+
var to = Object(target);
|
|
1952
|
+
if (Object.assign) {
|
|
1953
|
+
theArgs.forEach(function (item) { return Object.assign(to, item); });
|
|
1954
|
+
return to;
|
|
1955
|
+
}
|
|
1956
|
+
theArgs.filter(function (item) { return item != null; }).forEach(function (item) {
|
|
1957
|
+
var nextSource = item;
|
|
1958
|
+
Object.keys(nextSource)
|
|
1959
|
+
.filter(function (nextKey) { return Object.prototype.hasOwnProperty.call(nextSource, nextKey); })
|
|
1960
|
+
.forEach(function (nextKey) { return to[nextKey] = nextSource[nextKey]; });
|
|
1961
|
+
});
|
|
1962
|
+
return to;
|
|
1963
|
+
}
|
|
1964
|
+
Lang.objAssign = objAssign;
|
|
1965
|
+
})(Lang = exports.Lang || (exports.Lang = {}));
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
/***/ }),
|
|
1969
|
+
|
|
1970
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Monad.ts":
|
|
1971
|
+
/*!*************************************************************!*\
|
|
1972
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Monad.ts ***!
|
|
1973
|
+
\*************************************************************/
|
|
1974
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1978
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
1979
|
+
* this work for additional information regarding copyright ownership.
|
|
1980
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
1981
|
+
* (the "License"); you may not use this file except in compliance with
|
|
1982
|
+
* the License. You may obtain a copy of the License at
|
|
1983
|
+
*
|
|
1984
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1985
|
+
*
|
|
1986
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1987
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1988
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1989
|
+
* See the License for the specific language governing permissions and
|
|
1990
|
+
* limitations under the License.
|
|
1991
|
+
*/
|
|
1992
|
+
var __extends = (this && this.__extends) || (function () {
|
|
1993
|
+
var extendStatics = function (d, b) {
|
|
1994
|
+
extendStatics = Object.setPrototypeOf ||
|
|
1995
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1996
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1997
|
+
return extendStatics(d, b);
|
|
1998
|
+
};
|
|
1999
|
+
return function (d, b) {
|
|
2000
|
+
if (typeof b !== "function" && b !== null)
|
|
2001
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2002
|
+
extendStatics(d, b);
|
|
2003
|
+
function __() { this.constructor = d; }
|
|
2004
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2005
|
+
};
|
|
2006
|
+
})();
|
|
2007
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2008
|
+
exports.Config = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
|
|
2009
|
+
/**
|
|
2010
|
+
* A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
|
|
2011
|
+
* Useful if you need the functions in another library to keep its dependencies down
|
|
2012
|
+
*/
|
|
2013
|
+
/*IMonad definitions*/
|
|
2014
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
2015
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
2016
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2017
|
+
var objAssign = Lang_1.Lang.objAssign;
|
|
2018
|
+
/**
|
|
2019
|
+
* Implementation of a monad
|
|
2020
|
+
* (Sideffect free), no write allowed directly on the monads
|
|
2021
|
+
* value state
|
|
2022
|
+
*/
|
|
2023
|
+
var Monad = /** @class */ (function () {
|
|
2024
|
+
function Monad(value) {
|
|
2025
|
+
this._value = value;
|
|
2026
|
+
}
|
|
2027
|
+
Object.defineProperty(Monad.prototype, "value", {
|
|
2028
|
+
get: function () {
|
|
2029
|
+
return this._value;
|
|
2030
|
+
},
|
|
2031
|
+
enumerable: false,
|
|
2032
|
+
configurable: true
|
|
2033
|
+
});
|
|
2034
|
+
Monad.prototype.map = function (fn) {
|
|
2035
|
+
if (!fn) {
|
|
2036
|
+
fn = function (inval) { return inval; };
|
|
2037
|
+
}
|
|
2038
|
+
var result = fn(this.value);
|
|
2039
|
+
return new Monad(result);
|
|
2040
|
+
};
|
|
2041
|
+
Monad.prototype.flatMap = function (fn) {
|
|
2042
|
+
var mapped = this.map(fn);
|
|
2043
|
+
while ((mapped === null || mapped === void 0 ? void 0 : mapped.value) instanceof Monad) {
|
|
2044
|
+
mapped = mapped.value;
|
|
2045
|
+
}
|
|
2046
|
+
return mapped;
|
|
2047
|
+
};
|
|
2048
|
+
return Monad;
|
|
2049
|
+
}());
|
|
2050
|
+
exports.Monad = Monad;
|
|
2051
|
+
/**
|
|
2052
|
+
* optional implementation, an optional is basically an implementation of a Monad with additional syntactic
|
|
2053
|
+
* sugar on top
|
|
2054
|
+
* (Sideeffect free, since value assignment is not allowed)
|
|
2055
|
+
* */
|
|
2056
|
+
var Optional = /** @class */ (function (_super) {
|
|
2057
|
+
__extends(Optional, _super);
|
|
2058
|
+
function Optional(value) {
|
|
2059
|
+
return _super.call(this, value) || this;
|
|
2060
|
+
}
|
|
2061
|
+
Object.defineProperty(Optional.prototype, "value", {
|
|
2062
|
+
get: function () {
|
|
2063
|
+
if (this._value instanceof Monad) {
|
|
2064
|
+
return this._value.flatMap().value;
|
|
2065
|
+
}
|
|
2066
|
+
return this._value;
|
|
2067
|
+
},
|
|
2068
|
+
enumerable: false,
|
|
2069
|
+
configurable: true
|
|
2070
|
+
});
|
|
2071
|
+
Optional.fromNullable = function (value) {
|
|
2072
|
+
return new Optional(value);
|
|
2073
|
+
};
|
|
2074
|
+
/*syntactic sugar for absent and present checks*/
|
|
2075
|
+
Optional.prototype.isAbsent = function () {
|
|
2076
|
+
return "undefined" == typeof this.value || null == this.value;
|
|
2077
|
+
};
|
|
2078
|
+
/**
|
|
2079
|
+
* any value present
|
|
2080
|
+
*/
|
|
2081
|
+
Optional.prototype.isPresent = function (presentRunnable) {
|
|
2082
|
+
var absent = this.isAbsent();
|
|
2083
|
+
if (!absent && presentRunnable) {
|
|
2084
|
+
presentRunnable.call(this, this);
|
|
2085
|
+
}
|
|
2086
|
+
return !absent;
|
|
2087
|
+
};
|
|
2088
|
+
Optional.prototype.ifPresentLazy = function (presentRunnable) {
|
|
2089
|
+
if (presentRunnable === void 0) { presentRunnable = function () {
|
|
2090
|
+
}; }
|
|
2091
|
+
this.isPresent.call(this, presentRunnable);
|
|
2092
|
+
return this;
|
|
2093
|
+
};
|
|
2094
|
+
Optional.prototype.orElse = function (elseValue) {
|
|
2095
|
+
if (this.isPresent()) {
|
|
2096
|
+
return this;
|
|
2097
|
+
}
|
|
2098
|
+
else {
|
|
2099
|
+
//shortcut
|
|
2100
|
+
if (elseValue == null) {
|
|
2101
|
+
return Optional.absent;
|
|
2102
|
+
}
|
|
2103
|
+
return this.flatMap(function () { return elseValue; });
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
/**
|
|
2107
|
+
* lazy, passes a function which then is lazily evaluated
|
|
2108
|
+
* instead of a direct value
|
|
2109
|
+
* @param func
|
|
2110
|
+
*/
|
|
2111
|
+
Optional.prototype.orElseLazy = function (func) {
|
|
2112
|
+
if (this.isPresent()) {
|
|
2113
|
+
return this;
|
|
2114
|
+
}
|
|
2115
|
+
else {
|
|
2116
|
+
return this.flatMap(func);
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
/*
|
|
2120
|
+
* we need to implement it to fullfill the contract, although it is used only internally
|
|
2121
|
+
* all values are flattened when accessed anyway, so there is no need to call this methiod
|
|
2122
|
+
*/
|
|
2123
|
+
Optional.prototype.flatMap = function (fn) {
|
|
2124
|
+
var val = _super.prototype.flatMap.call(this, fn);
|
|
2125
|
+
if (!(val instanceof Optional)) {
|
|
2126
|
+
return Optional.fromNullable(val.value);
|
|
2127
|
+
}
|
|
2128
|
+
return val.flatMap();
|
|
2129
|
+
};
|
|
2130
|
+
/*
|
|
2131
|
+
* elvis operation, take care, if you use this you lose typesafety and refactoring
|
|
2132
|
+
* capabilites, unfortunately typesceript does not allow to have its own elvis operator
|
|
2133
|
+
* this is some syntactic sugar however which is quite useful*/
|
|
2134
|
+
Optional.prototype.getIf = function () {
|
|
2135
|
+
var key = [];
|
|
2136
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2137
|
+
key[_i] = arguments[_i];
|
|
2138
|
+
}
|
|
2139
|
+
var currentPos = this;
|
|
2140
|
+
for (var cnt = 0; cnt < key.length; cnt++) {
|
|
2141
|
+
var currKey = this.keyVal(key[cnt]);
|
|
2142
|
+
var arrPos = this.arrayIndex(key[cnt]);
|
|
2143
|
+
if (currKey === "" && arrPos >= 0) {
|
|
2144
|
+
currentPos = this.getClass().fromNullable(!(currentPos.value instanceof Array) ? null : (currentPos.value.length < arrPos ? null : currentPos.value[arrPos]));
|
|
2145
|
+
if (currentPos.isAbsent()) {
|
|
2146
|
+
return currentPos;
|
|
2147
|
+
}
|
|
2148
|
+
continue;
|
|
2149
|
+
}
|
|
2150
|
+
else if (currKey && arrPos >= 0) {
|
|
2151
|
+
if (currentPos.getIfPresent(currKey).isAbsent()) {
|
|
2152
|
+
return currentPos;
|
|
2153
|
+
}
|
|
2154
|
+
currentPos = (currentPos.getIfPresent(currKey).value instanceof Array) ? this.getClass().fromNullable(currentPos.getIfPresent(currKey).value[arrPos]) : this.getClass().absent;
|
|
2155
|
+
if (currentPos.isAbsent()) {
|
|
2156
|
+
return currentPos;
|
|
2157
|
+
}
|
|
2158
|
+
continue;
|
|
2159
|
+
}
|
|
2160
|
+
else {
|
|
2161
|
+
currentPos = currentPos.getIfPresent(currKey);
|
|
2162
|
+
}
|
|
2163
|
+
if (currentPos.isAbsent()) {
|
|
2164
|
+
return currentPos;
|
|
2165
|
+
}
|
|
2166
|
+
else if (arrPos > -1) {
|
|
2167
|
+
currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
var retVal = currentPos;
|
|
2171
|
+
return retVal;
|
|
2172
|
+
};
|
|
2173
|
+
/**
|
|
2174
|
+
* simple match, if the first order function call returns
|
|
2175
|
+
* true then there is a match, if the value is not present
|
|
2176
|
+
* it never matches
|
|
2177
|
+
*
|
|
2178
|
+
* @param fn the first order function performing the match
|
|
2179
|
+
*/
|
|
2180
|
+
Optional.prototype.match = function (fn) {
|
|
2181
|
+
if (this.isAbsent()) {
|
|
2182
|
+
return false;
|
|
2183
|
+
}
|
|
2184
|
+
return fn(this.value);
|
|
2185
|
+
};
|
|
2186
|
+
/**
|
|
2187
|
+
* convenience function to flatmap the internal value
|
|
2188
|
+
* and replace it with a default in case of being absent
|
|
2189
|
+
*
|
|
2190
|
+
* @param defaultVal
|
|
2191
|
+
* @returns {Optional<any>}
|
|
2192
|
+
*/
|
|
2193
|
+
Optional.prototype.get = function (defaultVal) {
|
|
2194
|
+
if (defaultVal === void 0) { defaultVal = Optional.absent; }
|
|
2195
|
+
if (this.isAbsent()) {
|
|
2196
|
+
return this.getClass().fromNullable(defaultVal).flatMap();
|
|
2197
|
+
}
|
|
2198
|
+
return this.getClass().fromNullable(this.value).flatMap();
|
|
2199
|
+
};
|
|
2200
|
+
Optional.prototype.toJson = function () {
|
|
2201
|
+
return JSON.stringify(this.value);
|
|
2202
|
+
};
|
|
2203
|
+
/**
|
|
2204
|
+
* helper to override several implementations in a more fluent way
|
|
2205
|
+
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
2206
|
+
* static methods and do not have to implement several methods which rely on the type
|
|
2207
|
+
* of "this"
|
|
2208
|
+
* @returns {Monadish.Optional}
|
|
2209
|
+
*/
|
|
2210
|
+
Optional.prototype.getClass = function () {
|
|
2211
|
+
return Optional;
|
|
2212
|
+
};
|
|
2213
|
+
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
2214
|
+
Optional.prototype.arrayIndex = function (key) {
|
|
2215
|
+
var start = key.indexOf("[");
|
|
2216
|
+
var end = key.indexOf("]");
|
|
2217
|
+
if (start >= 0 && end > 0 && start < end) {
|
|
2218
|
+
return parseInt(key.substring(start + 1, end));
|
|
2219
|
+
}
|
|
2220
|
+
else {
|
|
2221
|
+
return -1;
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
2225
|
+
Optional.prototype.keyVal = function (key) {
|
|
2226
|
+
var start = key.indexOf("[");
|
|
2227
|
+
if (start >= 0) {
|
|
2228
|
+
return key.substring(0, start);
|
|
2229
|
+
}
|
|
2230
|
+
else {
|
|
2231
|
+
return key;
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
/**
|
|
2235
|
+
* additional syntactic sugar which is not part of the usual optional implementation
|
|
2236
|
+
* but makes life easier, if you want to sacrifice typesafety and refactoring
|
|
2237
|
+
* capabilities in typescript
|
|
2238
|
+
*/
|
|
2239
|
+
Optional.prototype.getIfPresent = function (key) {
|
|
2240
|
+
if (this.isAbsent()) {
|
|
2241
|
+
return this.getClass().absent;
|
|
2242
|
+
}
|
|
2243
|
+
return this.getClass().fromNullable(this.value[key]).flatMap();
|
|
2244
|
+
};
|
|
2245
|
+
/**
|
|
2246
|
+
* elvis like typesafe functional save resolver
|
|
2247
|
+
* a typesafe option for getIfPresent
|
|
2248
|
+
*
|
|
2249
|
+
* usage myOptional.resolve(value => value.subAttr.subAttr2).orElseLazy(....)
|
|
2250
|
+
* if this is resolvable without any errors an Optional with the value is returned
|
|
2251
|
+
* if not, then an Optional absent is returned, also if you return Optional absent
|
|
2252
|
+
* it is flatmapped into absent
|
|
2253
|
+
*
|
|
2254
|
+
* @param resolver the resolver function, can throw any arbitrary errors, int the error case
|
|
2255
|
+
* the resolution goes towards absent
|
|
2256
|
+
*/
|
|
2257
|
+
Optional.prototype.resolve = function (resolver) {
|
|
2258
|
+
if (this.isAbsent()) {
|
|
2259
|
+
return Optional.absent;
|
|
2260
|
+
}
|
|
2261
|
+
try {
|
|
2262
|
+
return Optional.fromNullable(resolver(this.value));
|
|
2263
|
+
}
|
|
2264
|
+
catch (e) {
|
|
2265
|
+
return Optional.absent;
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
/*default value for absent*/
|
|
2269
|
+
Optional.absent = Optional.fromNullable(null);
|
|
2270
|
+
return Optional;
|
|
2271
|
+
}(Monad));
|
|
2272
|
+
exports.Optional = Optional;
|
|
2273
|
+
// --------------------- From here onwards we break out the sideffects free limits ------------
|
|
2274
|
+
/**
|
|
2275
|
+
* ValueEmbedder is the writeable version
|
|
2276
|
+
* of optional, it basically is a wrappber
|
|
2277
|
+
* around a construct which has a state
|
|
2278
|
+
* and can be written to.
|
|
2279
|
+
*
|
|
2280
|
+
* For the readonly version see Optional
|
|
2281
|
+
*/
|
|
2282
|
+
var ValueEmbedder = /** @class */ (function (_super) {
|
|
2283
|
+
__extends(ValueEmbedder, _super);
|
|
2284
|
+
function ValueEmbedder(rootElem, valueKey) {
|
|
2285
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
2286
|
+
var _this = _super.call(this, rootElem) || this;
|
|
2287
|
+
_this.key = valueKey;
|
|
2288
|
+
return _this;
|
|
2289
|
+
}
|
|
2290
|
+
Object.defineProperty(ValueEmbedder.prototype, "value", {
|
|
2291
|
+
get: function () {
|
|
2292
|
+
return this._value ? this._value[this.key] : null;
|
|
2293
|
+
},
|
|
2294
|
+
set: function (newVal) {
|
|
2295
|
+
if (!this._value) {
|
|
2296
|
+
return;
|
|
2297
|
+
}
|
|
2298
|
+
this._value[this.key] = newVal;
|
|
2299
|
+
},
|
|
2300
|
+
enumerable: false,
|
|
2301
|
+
configurable: true
|
|
2302
|
+
});
|
|
2303
|
+
ValueEmbedder.prototype.orElse = function (elseValue) {
|
|
2304
|
+
var alternative = {};
|
|
2305
|
+
alternative[this.key] = elseValue;
|
|
2306
|
+
return this.isPresent() ? this : new ValueEmbedder(alternative, this.key);
|
|
2307
|
+
};
|
|
2308
|
+
ValueEmbedder.prototype.orElseLazy = function (func) {
|
|
2309
|
+
if (this.isPresent()) {
|
|
2310
|
+
return this;
|
|
2311
|
+
}
|
|
2312
|
+
else {
|
|
2313
|
+
var alternative = {};
|
|
2314
|
+
alternative[this.key] = func();
|
|
2315
|
+
return new ValueEmbedder(alternative, this.key);
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
/**
|
|
2319
|
+
* helper to override several implementations in a more fluent way
|
|
2320
|
+
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
2321
|
+
* static methods and do not have to implement several methods which rely on the type
|
|
2322
|
+
* of "this"
|
|
2323
|
+
* @returns {Monadish.Optional}
|
|
2324
|
+
*/
|
|
2325
|
+
ValueEmbedder.prototype.getClass = function () {
|
|
2326
|
+
return ValueEmbedder;
|
|
2327
|
+
};
|
|
2328
|
+
ValueEmbedder.fromNullable = function (value, valueKey) {
|
|
2329
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
2330
|
+
return new ValueEmbedder(value, valueKey);
|
|
2331
|
+
};
|
|
2332
|
+
/*default value for absent*/
|
|
2333
|
+
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
2334
|
+
return ValueEmbedder;
|
|
2335
|
+
}(Optional));
|
|
2336
|
+
exports.ValueEmbedder = ValueEmbedder;
|
|
2337
|
+
/**
|
|
2338
|
+
* specialized value embedder
|
|
2339
|
+
* for our Configuration
|
|
2340
|
+
*/
|
|
2341
|
+
var ConfigEntry = /** @class */ (function (_super) {
|
|
2342
|
+
__extends(ConfigEntry, _super);
|
|
2343
|
+
function ConfigEntry(rootElem, key, arrPos) {
|
|
2344
|
+
var _this = _super.call(this, rootElem, key) || this;
|
|
2345
|
+
_this.arrPos = arrPos !== null && arrPos !== void 0 ? arrPos : -1;
|
|
2346
|
+
return _this;
|
|
2347
|
+
}
|
|
2348
|
+
Object.defineProperty(ConfigEntry.prototype, "value", {
|
|
2349
|
+
get: function () {
|
|
2350
|
+
if (this.key == "" && this.arrPos >= 0) {
|
|
2351
|
+
return this._value[this.arrPos];
|
|
2352
|
+
}
|
|
2353
|
+
else if (this.key && this.arrPos >= 0) {
|
|
2354
|
+
return this._value[this.key][this.arrPos];
|
|
2355
|
+
}
|
|
2356
|
+
return this._value[this.key];
|
|
2357
|
+
},
|
|
2358
|
+
set: function (val) {
|
|
2359
|
+
if (this.key == "" && this.arrPos >= 0) {
|
|
2360
|
+
this._value[this.arrPos] = val;
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
else if (this.key && this.arrPos >= 0) {
|
|
2364
|
+
this._value[this.key][this.arrPos] = val;
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
this._value[this.key] = val;
|
|
2368
|
+
},
|
|
2369
|
+
enumerable: false,
|
|
2370
|
+
configurable: true
|
|
2371
|
+
});
|
|
2372
|
+
/*default value for absent*/
|
|
2373
|
+
ConfigEntry.absent = ConfigEntry.fromNullable(null);
|
|
2374
|
+
return ConfigEntry;
|
|
2375
|
+
}(ValueEmbedder));
|
|
2376
|
+
/**
|
|
2377
|
+
* Config, basically an optional wrapper for a json structure
|
|
2378
|
+
* (not sideeffect free, since we can alter the internal config state
|
|
2379
|
+
* without generating a new config), not sure if we should make it sideffect free
|
|
2380
|
+
* since this would swallow a lot of performane and ram
|
|
2381
|
+
*/
|
|
2382
|
+
var Config = /** @class */ (function (_super) {
|
|
2383
|
+
__extends(Config, _super);
|
|
2384
|
+
function Config(root) {
|
|
2385
|
+
return _super.call(this, root) || this;
|
|
2386
|
+
}
|
|
2387
|
+
Object.defineProperty(Config.prototype, "shallowCopy", {
|
|
2388
|
+
get: function () {
|
|
2389
|
+
return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
|
|
2390
|
+
},
|
|
2391
|
+
enumerable: false,
|
|
2392
|
+
configurable: true
|
|
2393
|
+
});
|
|
2394
|
+
Object.defineProperty(Config.prototype, "deepCopy", {
|
|
2395
|
+
get: function () {
|
|
2396
|
+
return new Config(objAssign({}, this.value));
|
|
2397
|
+
},
|
|
2398
|
+
enumerable: false,
|
|
2399
|
+
configurable: true
|
|
2400
|
+
});
|
|
2401
|
+
Config.fromNullable = function (value) {
|
|
2402
|
+
return new Config(value);
|
|
2403
|
+
};
|
|
2404
|
+
/**
|
|
2405
|
+
* simple merge for the root configs
|
|
2406
|
+
*/
|
|
2407
|
+
Config.prototype.shallowMerge = function (other, overwrite, withAppend) {
|
|
2408
|
+
var _this = this;
|
|
2409
|
+
if (overwrite === void 0) { overwrite = true; }
|
|
2410
|
+
if (withAppend === void 0) { withAppend = false; }
|
|
2411
|
+
var _loop_1 = function (key) {
|
|
2412
|
+
if (overwrite || !(key in this_1.value)) {
|
|
2413
|
+
if (!withAppend) {
|
|
2414
|
+
this_1.assign(key).value = other.getIf(key).value;
|
|
2415
|
+
}
|
|
2416
|
+
else {
|
|
2417
|
+
if (Array.isArray(other.getIf(key).value)) {
|
|
2418
|
+
Stream_1.Stream.of.apply(Stream_1.Stream, other.getIf(key).value).each(function (item) { return _this.append(key).value = item; });
|
|
2419
|
+
}
|
|
2420
|
+
else {
|
|
2421
|
+
this_1.append(key).value = other.getIf(key).value;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
var this_1 = this;
|
|
2427
|
+
for (var key in other.value) {
|
|
2428
|
+
_loop_1(key);
|
|
2429
|
+
}
|
|
2430
|
+
};
|
|
2431
|
+
/**
|
|
2432
|
+
* assigns a single value as array, or appends it
|
|
2433
|
+
* to an existing value mapping a single value to array
|
|
2434
|
+
*
|
|
2435
|
+
*
|
|
2436
|
+
* usage myConfig.append("foobaz").value = "newValue"
|
|
2437
|
+
* myConfig.append("foobaz").value = "newValue2"
|
|
2438
|
+
*
|
|
2439
|
+
* resulting in myConfig.foobaz == ["newValue, newValue2"]
|
|
2440
|
+
*
|
|
2441
|
+
* @param keys
|
|
2442
|
+
*/
|
|
2443
|
+
Config.prototype.append = function () {
|
|
2444
|
+
var keys = [];
|
|
2445
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2446
|
+
keys[_i] = arguments[_i];
|
|
2447
|
+
}
|
|
2448
|
+
var noKeys = keys.length < 1;
|
|
2449
|
+
if (noKeys) {
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2452
|
+
var lastKey = keys[keys.length - 1];
|
|
2453
|
+
var currKey, finalKey = this.keyVal(lastKey);
|
|
2454
|
+
var pathExists = this.getIf.apply(this, keys).isPresent();
|
|
2455
|
+
this.buildPath(keys);
|
|
2456
|
+
var finalKeyArrPos = this.arrayIndex(lastKey);
|
|
2457
|
+
if (finalKeyArrPos > -1) {
|
|
2458
|
+
throw Error("Append only possible on non array properties, use assign on indexed data");
|
|
2459
|
+
}
|
|
2460
|
+
var value = this.getIf.apply(this, keys).value;
|
|
2461
|
+
if (!Array.isArray(value)) {
|
|
2462
|
+
value = this.assign.apply(this, keys).value = [value];
|
|
2463
|
+
}
|
|
2464
|
+
if (pathExists) {
|
|
2465
|
+
value.push({});
|
|
2466
|
+
}
|
|
2467
|
+
finalKeyArrPos = value.length - 1;
|
|
2468
|
+
var retVal = new ConfigEntry(keys.length == 1 ? this.value : this.getIf.apply(this, keys.slice(0, keys.length - 1)).value, lastKey, finalKeyArrPos);
|
|
2469
|
+
return retVal;
|
|
2470
|
+
};
|
|
2471
|
+
Config.prototype.appendIf = function (condition) {
|
|
2472
|
+
var keys = [];
|
|
2473
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2474
|
+
keys[_i - 1] = arguments[_i];
|
|
2475
|
+
}
|
|
2476
|
+
if (!condition) {
|
|
2477
|
+
return { value: null };
|
|
2478
|
+
}
|
|
2479
|
+
return this.append.apply(this, keys);
|
|
2480
|
+
};
|
|
2481
|
+
Config.prototype.assign = function () {
|
|
2482
|
+
var keys = [];
|
|
2483
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2484
|
+
keys[_i] = arguments[_i];
|
|
2485
|
+
}
|
|
2486
|
+
if (keys.length < 1) {
|
|
2487
|
+
return;
|
|
2488
|
+
}
|
|
2489
|
+
this.buildPath(keys);
|
|
2490
|
+
var currKey = this.keyVal(keys[keys.length - 1]);
|
|
2491
|
+
var arrPos = this.arrayIndex(keys[keys.length - 1]);
|
|
2492
|
+
var retVal = new ConfigEntry(keys.length == 1 ? this.value : this.getIf.apply(this, keys.slice(0, keys.length - 1)).value, currKey, arrPos);
|
|
2493
|
+
return retVal;
|
|
2494
|
+
};
|
|
2495
|
+
Config.prototype.assignIf = function (condition) {
|
|
2496
|
+
var keys = [];
|
|
2497
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2498
|
+
keys[_i - 1] = arguments[_i];
|
|
2499
|
+
}
|
|
2500
|
+
return condition ? this.assign.apply(this, keys) : { value: null };
|
|
2501
|
+
};
|
|
2502
|
+
Config.prototype.getIf = function () {
|
|
2503
|
+
var keys = [];
|
|
2504
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2505
|
+
keys[_i] = arguments[_i];
|
|
2506
|
+
}
|
|
2507
|
+
return this.getClass().fromNullable(_super.prototype.getIf.apply(this, keys).value);
|
|
2508
|
+
};
|
|
2509
|
+
Config.prototype.get = function (defaultVal) {
|
|
2510
|
+
return this.getClass().fromNullable(_super.prototype.get.call(this, defaultVal).value);
|
|
2511
|
+
};
|
|
2512
|
+
//empties the current config entry
|
|
2513
|
+
Config.prototype.delete = function (key) {
|
|
2514
|
+
if (key in this.value) {
|
|
2515
|
+
delete this.value[key];
|
|
2516
|
+
}
|
|
2517
|
+
return this;
|
|
2518
|
+
};
|
|
2519
|
+
Config.prototype.toJson = function () {
|
|
2520
|
+
return JSON.stringify(this.value);
|
|
2521
|
+
};
|
|
2522
|
+
Config.prototype.getClass = function () {
|
|
2523
|
+
return Config;
|
|
2524
|
+
};
|
|
2525
|
+
Config.prototype.setVal = function (val) {
|
|
2526
|
+
this._value = val;
|
|
2527
|
+
};
|
|
2528
|
+
/**
|
|
2529
|
+
* builds the config path
|
|
2530
|
+
*
|
|
2531
|
+
* @param keys a sequential array of keys containing either a key name or an array reference name[<index>]
|
|
2532
|
+
*/
|
|
2533
|
+
Config.prototype.buildPath = function (keys) {
|
|
2534
|
+
var val = this;
|
|
2535
|
+
var parentVal = this.getClass().fromNullable(null);
|
|
2536
|
+
var parentPos = -1;
|
|
2537
|
+
var alloc = function (arr, length) {
|
|
2538
|
+
var length1 = arr.length;
|
|
2539
|
+
var length2 = length1 + length;
|
|
2540
|
+
for (var cnt = length1; cnt < length2; cnt++) {
|
|
2541
|
+
arr.push({});
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
for (var cnt = 0; cnt < keys.length; cnt++) {
|
|
2545
|
+
var currKey = this.keyVal(keys[cnt]);
|
|
2546
|
+
var arrPos = this.arrayIndex(keys[cnt]);
|
|
2547
|
+
if (currKey === "" && arrPos >= 0) {
|
|
2548
|
+
val.setVal((val.value instanceof Array) ? val.value : []);
|
|
2549
|
+
alloc(val.value, arrPos + 1);
|
|
2550
|
+
if (parentPos >= 0) {
|
|
2551
|
+
parentVal.value[parentPos] = val.value;
|
|
2552
|
+
}
|
|
2553
|
+
parentVal = val;
|
|
2554
|
+
parentPos = arrPos;
|
|
2555
|
+
val = this.getClass().fromNullable(val.value[arrPos]);
|
|
2556
|
+
continue;
|
|
2557
|
+
}
|
|
2558
|
+
var tempVal = val.getIf(currKey);
|
|
2559
|
+
if (arrPos == -1) {
|
|
2560
|
+
if (tempVal.isAbsent()) {
|
|
2561
|
+
tempVal = this.getClass().fromNullable(val.value[currKey] = {});
|
|
2562
|
+
}
|
|
2563
|
+
else {
|
|
2564
|
+
val = tempVal;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
else {
|
|
2568
|
+
var arr = (tempVal.value instanceof Array) ? tempVal.value : [];
|
|
2569
|
+
alloc(arr, arrPos + 1);
|
|
2570
|
+
val.value[currKey] = arr;
|
|
2571
|
+
tempVal = this.getClass().fromNullable(arr[arrPos]);
|
|
2572
|
+
}
|
|
2573
|
+
parentVal = val;
|
|
2574
|
+
parentPos = arrPos;
|
|
2575
|
+
val = tempVal;
|
|
2576
|
+
}
|
|
2577
|
+
return this;
|
|
2578
|
+
};
|
|
2579
|
+
return Config;
|
|
2580
|
+
}(Optional));
|
|
2581
|
+
exports.Config = Config;
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
/***/ }),
|
|
2585
|
+
|
|
2586
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts":
|
|
2587
|
+
/*!*************************************************************************!*\
|
|
2588
|
+
!*** ./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts ***!
|
|
2589
|
+
\*************************************************************************/
|
|
2590
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2594
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
2595
|
+
* this work for additional information regarding copyright ownership.
|
|
2596
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
2597
|
+
* (the "License"); you may not use this file except in compliance with
|
|
2598
|
+
* the License. You may obtain a copy of the License at
|
|
2599
|
+
*
|
|
2600
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2601
|
+
*
|
|
2602
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2603
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2604
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2605
|
+
* See the License for the specific language governing permissions and
|
|
2606
|
+
* limitations under the License.
|
|
2607
|
+
*/
|
|
2608
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2609
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2610
|
+
if (ar || !(i in from)) {
|
|
2611
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2612
|
+
ar[i] = from[i];
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2616
|
+
};
|
|
2617
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2618
|
+
exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = void 0;
|
|
2619
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2620
|
+
/**
|
|
2621
|
+
* defines a sequence of numbers for our stream input
|
|
2622
|
+
*/
|
|
2623
|
+
var SequenceDataSource = /** @class */ (function () {
|
|
2624
|
+
function SequenceDataSource(start, total) {
|
|
2625
|
+
this.total = total;
|
|
2626
|
+
this.start = start;
|
|
2627
|
+
this.value = start;
|
|
2628
|
+
}
|
|
2629
|
+
SequenceDataSource.prototype.hasNext = function () {
|
|
2630
|
+
return this.value < this.total;
|
|
2631
|
+
};
|
|
2632
|
+
SequenceDataSource.prototype.next = function () {
|
|
2633
|
+
return Math.min(this.value++, this.total - 1);
|
|
2634
|
+
};
|
|
2635
|
+
SequenceDataSource.prototype.reset = function () {
|
|
2636
|
+
this.value = 0;
|
|
2637
|
+
};
|
|
2638
|
+
return SequenceDataSource;
|
|
2639
|
+
}());
|
|
2640
|
+
exports.SequenceDataSource = SequenceDataSource;
|
|
2641
|
+
/**
|
|
2642
|
+
* implementation of iteratable on top of array
|
|
2643
|
+
*/
|
|
2644
|
+
var ArrayStreamDataSource = /** @class */ (function () {
|
|
2645
|
+
function ArrayStreamDataSource() {
|
|
2646
|
+
var value = [];
|
|
2647
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2648
|
+
value[_i] = arguments[_i];
|
|
2649
|
+
}
|
|
2650
|
+
this.dataPos = -1;
|
|
2651
|
+
this.value = value;
|
|
2652
|
+
}
|
|
2653
|
+
ArrayStreamDataSource.prototype.hasNext = function () {
|
|
2654
|
+
return this.value.length - 1 > this.dataPos;
|
|
2655
|
+
};
|
|
2656
|
+
ArrayStreamDataSource.prototype.next = function () {
|
|
2657
|
+
this.dataPos++;
|
|
2658
|
+
return this.value[this.dataPos];
|
|
2659
|
+
};
|
|
2660
|
+
ArrayStreamDataSource.prototype.reset = function () {
|
|
2661
|
+
this.dataPos = -1;
|
|
2662
|
+
};
|
|
2663
|
+
return ArrayStreamDataSource;
|
|
2664
|
+
}());
|
|
2665
|
+
exports.ArrayStreamDataSource = ArrayStreamDataSource;
|
|
2666
|
+
/**
|
|
2667
|
+
* an intermediate data source which prefilters
|
|
2668
|
+
* incoming stream data
|
|
2669
|
+
* and lets only the data out which
|
|
2670
|
+
* passes the filter function check
|
|
2671
|
+
*/
|
|
2672
|
+
var FilteredStreamDatasource = /** @class */ (function () {
|
|
2673
|
+
function FilteredStreamDatasource(filterFunc, parent) {
|
|
2674
|
+
this.filteredNext = null;
|
|
2675
|
+
this.filterFunc = filterFunc;
|
|
2676
|
+
this.inputDataSource = parent;
|
|
2677
|
+
}
|
|
2678
|
+
/**
|
|
2679
|
+
* in order to filter we have to make a look ahead until the
|
|
2680
|
+
* first next allowed element
|
|
2681
|
+
* hence we prefetch the element and then
|
|
2682
|
+
* serve it via next
|
|
2683
|
+
*/
|
|
2684
|
+
FilteredStreamDatasource.prototype.hasNext = function () {
|
|
2685
|
+
while (this.filteredNext == null && this.inputDataSource.hasNext()) {
|
|
2686
|
+
var next = this.inputDataSource.next();
|
|
2687
|
+
if (this.filterFunc(next)) {
|
|
2688
|
+
this.filteredNext = next;
|
|
2689
|
+
return true;
|
|
2690
|
+
}
|
|
2691
|
+
else {
|
|
2692
|
+
this.filteredNext = null;
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
return this.filteredNext != null;
|
|
2696
|
+
};
|
|
2697
|
+
/**
|
|
2698
|
+
* serve the next element
|
|
2699
|
+
*/
|
|
2700
|
+
FilteredStreamDatasource.prototype.next = function () {
|
|
2701
|
+
var ret = this.filteredNext;
|
|
2702
|
+
this.filteredNext = null;
|
|
2703
|
+
//We have to call hasNext, to roll another
|
|
2704
|
+
//prefetch in case someone runs next
|
|
2705
|
+
//sequentially without calling hasNext
|
|
2706
|
+
this.hasNext();
|
|
2707
|
+
return ret;
|
|
2708
|
+
};
|
|
2709
|
+
FilteredStreamDatasource.prototype.reset = function () {
|
|
2710
|
+
this.filteredNext = null;
|
|
2711
|
+
this.inputDataSource.reset();
|
|
2712
|
+
};
|
|
2713
|
+
return FilteredStreamDatasource;
|
|
2714
|
+
}());
|
|
2715
|
+
exports.FilteredStreamDatasource = FilteredStreamDatasource;
|
|
2716
|
+
/**
|
|
2717
|
+
* an intermediate datasource which maps the items from
|
|
2718
|
+
* one into another
|
|
2719
|
+
*/
|
|
2720
|
+
var MappedStreamDataSource = /** @class */ (function () {
|
|
2721
|
+
function MappedStreamDataSource(mapFunc, parent) {
|
|
2722
|
+
this.mapFunc = mapFunc;
|
|
2723
|
+
this.inputDataSource = parent;
|
|
2724
|
+
}
|
|
2725
|
+
MappedStreamDataSource.prototype.hasNext = function () {
|
|
2726
|
+
return this.inputDataSource.hasNext();
|
|
2727
|
+
};
|
|
2728
|
+
MappedStreamDataSource.prototype.next = function () {
|
|
2729
|
+
return this.mapFunc(this.inputDataSource.next());
|
|
2730
|
+
};
|
|
2731
|
+
MappedStreamDataSource.prototype.reset = function () {
|
|
2732
|
+
this.inputDataSource.reset();
|
|
2733
|
+
};
|
|
2734
|
+
return MappedStreamDataSource;
|
|
2735
|
+
}());
|
|
2736
|
+
exports.MappedStreamDataSource = MappedStreamDataSource;
|
|
2737
|
+
/**
|
|
2738
|
+
* Same for flatmap to deal with element -> stream mappings
|
|
2739
|
+
*/
|
|
2740
|
+
var FlatMapStreamDataSource = /** @class */ (function () {
|
|
2741
|
+
function FlatMapStreamDataSource(func, parent) {
|
|
2742
|
+
this.mapFunc = func;
|
|
2743
|
+
this.inputDataSource = parent;
|
|
2744
|
+
}
|
|
2745
|
+
FlatMapStreamDataSource.prototype.hasNext = function () {
|
|
2746
|
+
return this.resolveCurrentNext() || this.resolveNextNext();
|
|
2747
|
+
};
|
|
2748
|
+
FlatMapStreamDataSource.prototype.resolveCurrentNext = function () {
|
|
2749
|
+
var next = false;
|
|
2750
|
+
if (this.activeDataSource) {
|
|
2751
|
+
next = this.activeDataSource.hasNext();
|
|
2752
|
+
}
|
|
2753
|
+
return next;
|
|
2754
|
+
};
|
|
2755
|
+
FlatMapStreamDataSource.prototype.resolveNextNext = function () {
|
|
2756
|
+
var next = false;
|
|
2757
|
+
while (!next && this.inputDataSource.hasNext()) {
|
|
2758
|
+
var mapped = this.mapFunc(this.inputDataSource.next());
|
|
2759
|
+
if (Array.isArray(mapped)) {
|
|
2760
|
+
this.activeDataSource = new (ArrayStreamDataSource.bind.apply(ArrayStreamDataSource, __spreadArray([void 0], mapped, false)))();
|
|
2761
|
+
}
|
|
2762
|
+
else {
|
|
2763
|
+
this.activeDataSource = mapped;
|
|
2764
|
+
}
|
|
2765
|
+
next = this.activeDataSource.hasNext();
|
|
2766
|
+
}
|
|
2767
|
+
return next;
|
|
2768
|
+
};
|
|
2769
|
+
FlatMapStreamDataSource.prototype.next = function () {
|
|
2770
|
+
return this.activeDataSource.next();
|
|
2771
|
+
};
|
|
2772
|
+
FlatMapStreamDataSource.prototype.reset = function () {
|
|
2773
|
+
this.inputDataSource.reset();
|
|
2774
|
+
};
|
|
2775
|
+
return FlatMapStreamDataSource;
|
|
2776
|
+
}());
|
|
2777
|
+
exports.FlatMapStreamDataSource = FlatMapStreamDataSource;
|
|
2778
|
+
/**
|
|
2779
|
+
* For the time being we only need one collector
|
|
2780
|
+
* a collector which collects a stream back into arrays
|
|
2781
|
+
*/
|
|
2782
|
+
var ArrayCollector = /** @class */ (function () {
|
|
2783
|
+
function ArrayCollector() {
|
|
2784
|
+
this.data = [];
|
|
2785
|
+
}
|
|
2786
|
+
ArrayCollector.prototype.collect = function (element) {
|
|
2787
|
+
this.data.push(element);
|
|
2788
|
+
};
|
|
2789
|
+
Object.defineProperty(ArrayCollector.prototype, "finalValue", {
|
|
2790
|
+
get: function () {
|
|
2791
|
+
return this.data;
|
|
2792
|
+
},
|
|
2793
|
+
enumerable: false,
|
|
2794
|
+
configurable: true
|
|
2795
|
+
});
|
|
2796
|
+
return ArrayCollector;
|
|
2797
|
+
}());
|
|
2798
|
+
exports.ArrayCollector = ArrayCollector;
|
|
2799
|
+
/**
|
|
2800
|
+
* collects an tuple array stream into an assoc array with elements being collected into arrays
|
|
2801
|
+
*
|
|
2802
|
+
*/
|
|
2803
|
+
var ArrayAssocArrayCollector = /** @class */ (function () {
|
|
2804
|
+
function ArrayAssocArrayCollector() {
|
|
2805
|
+
this.finalValue = {};
|
|
2806
|
+
}
|
|
2807
|
+
ArrayAssocArrayCollector.prototype.collect = function (element) {
|
|
2808
|
+
var _a, _b, _c, _d;
|
|
2809
|
+
var key = (_a = element === null || element === void 0 ? void 0 : element[0]) !== null && _a !== void 0 ? _a : element;
|
|
2810
|
+
this.finalValue[key] = (_c = (_b = this.finalValue) === null || _b === void 0 ? void 0 : _b[key]) !== null && _c !== void 0 ? _c : [];
|
|
2811
|
+
this.finalValue[key].push((_d = element === null || element === void 0 ? void 0 : element[1]) !== null && _d !== void 0 ? _d : true);
|
|
2812
|
+
};
|
|
2813
|
+
return ArrayAssocArrayCollector;
|
|
2814
|
+
}());
|
|
2815
|
+
exports.ArrayAssocArrayCollector = ArrayAssocArrayCollector;
|
|
2816
|
+
/**
|
|
2817
|
+
* dummy collector which just triggers a run
|
|
2818
|
+
* on lazy streams without collecting anything
|
|
2819
|
+
*/
|
|
2820
|
+
var Run = /** @class */ (function () {
|
|
2821
|
+
function Run() {
|
|
2822
|
+
}
|
|
2823
|
+
Run.prototype.collect = function (element) {
|
|
2824
|
+
};
|
|
2825
|
+
Object.defineProperty(Run.prototype, "finalValue", {
|
|
2826
|
+
get: function () {
|
|
2827
|
+
return null;
|
|
2828
|
+
},
|
|
2829
|
+
enumerable: false,
|
|
2830
|
+
configurable: true
|
|
2831
|
+
});
|
|
2832
|
+
return Run;
|
|
2833
|
+
}());
|
|
2834
|
+
exports.Run = Run;
|
|
2835
|
+
/**
|
|
2836
|
+
* collects an assoc stream back to an assoc array
|
|
2837
|
+
*/
|
|
2838
|
+
var AssocArrayCollector = /** @class */ (function () {
|
|
2839
|
+
function AssocArrayCollector() {
|
|
2840
|
+
this.finalValue = {};
|
|
2841
|
+
}
|
|
2842
|
+
AssocArrayCollector.prototype.collect = function (element) {
|
|
2843
|
+
var _a, _b;
|
|
2844
|
+
this.finalValue[(_a = element[0]) !== null && _a !== void 0 ? _a : element] = (_b = element[1]) !== null && _b !== void 0 ? _b : true;
|
|
2845
|
+
};
|
|
2846
|
+
return AssocArrayCollector;
|
|
2847
|
+
}());
|
|
2848
|
+
exports.AssocArrayCollector = AssocArrayCollector;
|
|
2849
|
+
/**
|
|
2850
|
+
* Form data collector for key value pair streams
|
|
2851
|
+
*/
|
|
2852
|
+
var FormDataCollector = /** @class */ (function () {
|
|
2853
|
+
function FormDataCollector() {
|
|
2854
|
+
this.finalValue = new FormData();
|
|
2855
|
+
}
|
|
2856
|
+
FormDataCollector.prototype.collect = function (element) {
|
|
2857
|
+
this.finalValue.append(element.key, element.value);
|
|
2858
|
+
};
|
|
2859
|
+
return FormDataCollector;
|
|
2860
|
+
}());
|
|
2861
|
+
exports.FormDataCollector = FormDataCollector;
|
|
2862
|
+
/**
|
|
2863
|
+
* Form data collector for DomQuery streams
|
|
2864
|
+
*/
|
|
2865
|
+
var QueryFormDataCollector = /** @class */ (function () {
|
|
2866
|
+
function QueryFormDataCollector() {
|
|
2867
|
+
this.finalValue = new FormData();
|
|
2868
|
+
}
|
|
2869
|
+
QueryFormDataCollector.prototype.collect = function (element) {
|
|
2870
|
+
var toMerge = element.encodeFormElement();
|
|
2871
|
+
if (toMerge.isPresent()) {
|
|
2872
|
+
this.finalValue.append(element.name.value, toMerge.get(element.name).value);
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
return QueryFormDataCollector;
|
|
2876
|
+
}());
|
|
2877
|
+
exports.QueryFormDataCollector = QueryFormDataCollector;
|
|
2878
|
+
/**
|
|
2879
|
+
* Encoded String collector from dom query streams
|
|
2880
|
+
*/
|
|
2881
|
+
var QueryFormStringCollector = /** @class */ (function () {
|
|
2882
|
+
function QueryFormStringCollector() {
|
|
2883
|
+
this.formData = [];
|
|
2884
|
+
}
|
|
2885
|
+
QueryFormStringCollector.prototype.collect = function (element) {
|
|
2886
|
+
var toMerge = element.encodeFormElement();
|
|
2887
|
+
if (toMerge.isPresent()) {
|
|
2888
|
+
this.formData.push([element.name.value, toMerge.get(element.name).value]);
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
Object.defineProperty(QueryFormStringCollector.prototype, "finalValue", {
|
|
2892
|
+
get: function () {
|
|
2893
|
+
return Stream_1.Stream.of.apply(Stream_1.Stream, this.formData).map(function (keyVal) { return keyVal.join("="); })
|
|
2894
|
+
.reduce(function (item1, item2) { return [item1, item2].join("&"); })
|
|
2895
|
+
.orElse("").value;
|
|
2896
|
+
},
|
|
2897
|
+
enumerable: false,
|
|
2898
|
+
configurable: true
|
|
2899
|
+
});
|
|
2900
|
+
return QueryFormStringCollector;
|
|
2901
|
+
}());
|
|
2902
|
+
exports.QueryFormStringCollector = QueryFormStringCollector;
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
/***/ }),
|
|
2906
|
+
|
|
2907
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Stream.ts":
|
|
2908
|
+
/*!**************************************************************!*\
|
|
2909
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Stream.ts ***!
|
|
2910
|
+
\**************************************************************/
|
|
2911
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2912
|
+
|
|
2913
|
+
|
|
2914
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2915
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
2916
|
+
* this work for additional information regarding copyright ownership.
|
|
2917
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
2918
|
+
* (the "License"); you may not use this file except in compliance with
|
|
2919
|
+
* the License. You may obtain a copy of the License at
|
|
2920
|
+
*
|
|
2921
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2922
|
+
*
|
|
2923
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2924
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2925
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2926
|
+
* See the License for the specific language governing permissions and
|
|
2927
|
+
* limitations under the License.
|
|
2928
|
+
*/
|
|
2929
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2930
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2931
|
+
if (ar || !(i in from)) {
|
|
2932
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2933
|
+
ar[i] = from[i];
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2937
|
+
};
|
|
2938
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2939
|
+
exports.LazyStream = exports.Stream = void 0;
|
|
2940
|
+
/*
|
|
2941
|
+
* A small stream implementation
|
|
2942
|
+
*/
|
|
2943
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
2944
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
2945
|
+
/**
|
|
2946
|
+
* A simple typescript based reimplementation of streams
|
|
2947
|
+
*
|
|
2948
|
+
* This is the early eval version
|
|
2949
|
+
* for a lazy eval version check, LazyStream, which is api compatible
|
|
2950
|
+
* to this implementation, however with the benefit of being able
|
|
2951
|
+
* to provide infinite data sources and generic data providers, the downside
|
|
2952
|
+
* is, it might be a tad slower in some situations
|
|
2953
|
+
*/
|
|
2954
|
+
var Stream = /** @class */ (function () {
|
|
2955
|
+
function Stream() {
|
|
2956
|
+
var value = [];
|
|
2957
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2958
|
+
value[_i] = arguments[_i];
|
|
2959
|
+
}
|
|
2960
|
+
this._limits = -1;
|
|
2961
|
+
this.pos = -1;
|
|
2962
|
+
this.value = value;
|
|
2963
|
+
}
|
|
2964
|
+
Stream.of = function () {
|
|
2965
|
+
var data = [];
|
|
2966
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2967
|
+
data[_i] = arguments[_i];
|
|
2968
|
+
}
|
|
2969
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], data, false)))();
|
|
2970
|
+
};
|
|
2971
|
+
Stream.ofAssoc = function (data) {
|
|
2972
|
+
return this.of.apply(this, Object.keys(data)).map(function (key) { return [key, data[key]]; });
|
|
2973
|
+
};
|
|
2974
|
+
Stream.ofDataSource = function (dataSource) {
|
|
2975
|
+
var value = [];
|
|
2976
|
+
while (dataSource.hasNext()) {
|
|
2977
|
+
value.push(dataSource.next());
|
|
2978
|
+
}
|
|
2979
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], value, false)))();
|
|
2980
|
+
};
|
|
2981
|
+
Stream.prototype.limits = function (end) {
|
|
2982
|
+
this._limits = end;
|
|
2983
|
+
return this;
|
|
2984
|
+
};
|
|
2985
|
+
/**
|
|
2986
|
+
* concat for streams, so that you can concat two streams together
|
|
2987
|
+
* @param toAppend
|
|
2988
|
+
*/
|
|
2989
|
+
Stream.prototype.concat = function () {
|
|
2990
|
+
//let dataSource = new MultiStreamDatasource<T>(this, ...toAppend);
|
|
2991
|
+
//return Stream.ofDataSource<T>(dataSource);
|
|
2992
|
+
var toAppend = [];
|
|
2993
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2994
|
+
toAppend[_i] = arguments[_i];
|
|
2995
|
+
}
|
|
2996
|
+
return Stream.of.apply(Stream, __spreadArray([this], toAppend, false)).flatMap(function (item) { return item; });
|
|
2997
|
+
};
|
|
2998
|
+
Stream.prototype.onElem = function (fn) {
|
|
2999
|
+
for (var cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3000
|
+
if (fn(this.value[cnt], cnt) === false) {
|
|
3001
|
+
break;
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
return this;
|
|
3005
|
+
};
|
|
3006
|
+
Stream.prototype.each = function (fn) {
|
|
3007
|
+
this.onElem(fn);
|
|
3008
|
+
};
|
|
3009
|
+
Stream.prototype.map = function (fn) {
|
|
3010
|
+
if (!fn) {
|
|
3011
|
+
fn = function (inval) { return inval; };
|
|
3012
|
+
}
|
|
3013
|
+
var res = [];
|
|
3014
|
+
this.each(function (item, cnt) {
|
|
3015
|
+
res.push(fn(item));
|
|
3016
|
+
});
|
|
3017
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], res, false)))();
|
|
3018
|
+
};
|
|
3019
|
+
/*
|
|
3020
|
+
* we need to implement it to fullfill the contract, although it is used only internally
|
|
3021
|
+
* all values are flattened when accessed anyway, so there is no need to call this methiod
|
|
3022
|
+
*/
|
|
3023
|
+
Stream.prototype.flatMap = function (fn) {
|
|
3024
|
+
var ret = [];
|
|
3025
|
+
this.each(function (item) {
|
|
3026
|
+
var strmR = fn(item);
|
|
3027
|
+
ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat.apply(ret, strmR.value);
|
|
3028
|
+
});
|
|
3029
|
+
return Stream.of.apply(Stream, ret);
|
|
3030
|
+
};
|
|
3031
|
+
Stream.prototype.filter = function (fn) {
|
|
3032
|
+
var res = [];
|
|
3033
|
+
this.each(function (data) {
|
|
3034
|
+
if (fn(data)) {
|
|
3035
|
+
res.push(data);
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], res, false)))();
|
|
3039
|
+
};
|
|
3040
|
+
Stream.prototype.reduce = function (fn, startVal) {
|
|
3041
|
+
if (startVal === void 0) { startVal = null; }
|
|
3042
|
+
var offset = startVal != null ? 0 : 1;
|
|
3043
|
+
var val1 = startVal != null ? startVal : this.value.length ? this.value[0] : null;
|
|
3044
|
+
for (var cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3045
|
+
val1 = fn(val1, this.value[cnt]);
|
|
3046
|
+
}
|
|
3047
|
+
return Monad_1.Optional.fromNullable(val1);
|
|
3048
|
+
};
|
|
3049
|
+
Stream.prototype.first = function () {
|
|
3050
|
+
return this.value && this.value.length ? Monad_1.Optional.fromNullable(this.value[0]) : Monad_1.Optional.absent;
|
|
3051
|
+
};
|
|
3052
|
+
Stream.prototype.last = function () {
|
|
3053
|
+
//could be done via reduce, but is faster this way
|
|
3054
|
+
var length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;
|
|
3055
|
+
return Monad_1.Optional.fromNullable(length ? this.value[length - 1] : null);
|
|
3056
|
+
};
|
|
3057
|
+
Stream.prototype.anyMatch = function (fn) {
|
|
3058
|
+
for (var cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3059
|
+
if (fn(this.value[cnt])) {
|
|
3060
|
+
return true;
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
return false;
|
|
3064
|
+
};
|
|
3065
|
+
Stream.prototype.allMatch = function (fn) {
|
|
3066
|
+
if (!this.value.length) {
|
|
3067
|
+
return false;
|
|
3068
|
+
}
|
|
3069
|
+
var matches = 0;
|
|
3070
|
+
for (var cnt = 0; cnt < this.value.length; cnt++) {
|
|
3071
|
+
if (fn(this.value[cnt])) {
|
|
3072
|
+
matches++;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
return matches == this.value.length;
|
|
3076
|
+
};
|
|
3077
|
+
Stream.prototype.noneMatch = function (fn) {
|
|
3078
|
+
var matches = 0;
|
|
3079
|
+
for (var cnt = 0; cnt < this.value.length; cnt++) {
|
|
3080
|
+
if (!fn(this.value[cnt])) {
|
|
3081
|
+
matches++;
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
return matches == this.value.length;
|
|
3085
|
+
};
|
|
3086
|
+
Stream.prototype.sort = function (comparator) {
|
|
3087
|
+
var newArr = this.value.slice().sort(comparator);
|
|
3088
|
+
return Stream.of.apply(Stream, newArr);
|
|
3089
|
+
};
|
|
3090
|
+
Stream.prototype.collect = function (collector) {
|
|
3091
|
+
this.each(function (data) { return collector.collect(data); });
|
|
3092
|
+
return collector.finalValue;
|
|
3093
|
+
};
|
|
3094
|
+
//-- internally exposed methods needed for the interconnectivity
|
|
3095
|
+
Stream.prototype.hasNext = function () {
|
|
3096
|
+
var isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
|
|
3097
|
+
var isEndOfArray = this.pos >= this.value.length - 1;
|
|
3098
|
+
return !(isLimitsReached || isEndOfArray);
|
|
3099
|
+
};
|
|
3100
|
+
Stream.prototype.next = function () {
|
|
3101
|
+
if (!this.hasNext()) {
|
|
3102
|
+
return null;
|
|
3103
|
+
}
|
|
3104
|
+
this.pos++;
|
|
3105
|
+
return this.value[this.pos];
|
|
3106
|
+
};
|
|
3107
|
+
Stream.prototype[Symbol.iterator] = function () {
|
|
3108
|
+
var _this = this;
|
|
3109
|
+
return {
|
|
3110
|
+
next: function () {
|
|
3111
|
+
var done = !_this.hasNext();
|
|
3112
|
+
var val = _this.next();
|
|
3113
|
+
return {
|
|
3114
|
+
done: done,
|
|
3115
|
+
value: val
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
};
|
|
3119
|
+
};
|
|
3120
|
+
/*get observable(): Observable<T> {
|
|
3121
|
+
return from(this);
|
|
3122
|
+
}*/
|
|
3123
|
+
Stream.prototype.reset = function () {
|
|
3124
|
+
this.pos = -1;
|
|
3125
|
+
};
|
|
3126
|
+
return Stream;
|
|
3127
|
+
}());
|
|
3128
|
+
exports.Stream = Stream;
|
|
3129
|
+
/**
|
|
3130
|
+
* Lazy implementation of a Stream
|
|
3131
|
+
* The idea is to connect the intermediate
|
|
3132
|
+
* streams as datasources like a linked list
|
|
3133
|
+
* with reverse referencing and for special
|
|
3134
|
+
* operations like filtering flatmapping
|
|
3135
|
+
* have intermediate datasources in the list
|
|
3136
|
+
* with specialized functions.
|
|
3137
|
+
*
|
|
3138
|
+
* Sort of a modified pipe valve pattern
|
|
3139
|
+
* the streams are the pipes the intermediate
|
|
3140
|
+
* data sources are the valves
|
|
3141
|
+
*
|
|
3142
|
+
* We then can use passed in functions to control
|
|
3143
|
+
* the flow in the valves
|
|
3144
|
+
*
|
|
3145
|
+
* That way we can have a lazy evaluating stream
|
|
3146
|
+
*
|
|
3147
|
+
* So if an endpoint requests data
|
|
3148
|
+
* a callback trace goes back the stream list
|
|
3149
|
+
* which triggers an operation upwards
|
|
3150
|
+
* which sends data down the drain which then is processed
|
|
3151
|
+
* and filtered until one element hits the endpoint.
|
|
3152
|
+
*
|
|
3153
|
+
* That is repeated, until all elements are processed
|
|
3154
|
+
* or an internal limit is hit.
|
|
3155
|
+
*
|
|
3156
|
+
*/
|
|
3157
|
+
var LazyStream = /** @class */ (function () {
|
|
3158
|
+
function LazyStream(parent) {
|
|
3159
|
+
this._limits = -1;
|
|
3160
|
+
/*
|
|
3161
|
+
* needed to have the limits check working
|
|
3162
|
+
* we need to keep track of the current position
|
|
3163
|
+
* in the stream
|
|
3164
|
+
*/
|
|
3165
|
+
this.pos = -1;
|
|
3166
|
+
this.dataSource = parent;
|
|
3167
|
+
}
|
|
3168
|
+
LazyStream.of = function () {
|
|
3169
|
+
var values = [];
|
|
3170
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3171
|
+
values[_i] = arguments[_i];
|
|
3172
|
+
}
|
|
3173
|
+
return new LazyStream(new (SourcesCollectors_1.ArrayStreamDataSource.bind.apply(SourcesCollectors_1.ArrayStreamDataSource, __spreadArray([void 0], values, false)))());
|
|
3174
|
+
};
|
|
3175
|
+
LazyStream.ofAssoc = function (data) {
|
|
3176
|
+
return this.of.apply(this, Object.keys(data)).map(function (key) { return [key, data[key]]; });
|
|
3177
|
+
};
|
|
3178
|
+
LazyStream.ofStreamDataSource = function (value) {
|
|
3179
|
+
return new LazyStream(value);
|
|
3180
|
+
};
|
|
3181
|
+
LazyStream.prototype.hasNext = function () {
|
|
3182
|
+
if (this.isOverLimits()) {
|
|
3183
|
+
return false;
|
|
3184
|
+
}
|
|
3185
|
+
return this.dataSource.hasNext();
|
|
3186
|
+
};
|
|
3187
|
+
LazyStream.prototype.next = function () {
|
|
3188
|
+
var next = this.dataSource.next();
|
|
3189
|
+
// @ts-ignore
|
|
3190
|
+
this.pos++;
|
|
3191
|
+
return next;
|
|
3192
|
+
};
|
|
3193
|
+
LazyStream.prototype.reset = function () {
|
|
3194
|
+
this.dataSource.reset();
|
|
3195
|
+
this.pos = 0;
|
|
3196
|
+
this._limits = -1;
|
|
3197
|
+
};
|
|
3198
|
+
/**
|
|
3199
|
+
* concat for streams, so that you can concat two streams together
|
|
3200
|
+
* @param toAppend
|
|
3201
|
+
*/
|
|
3202
|
+
LazyStream.prototype.concat = function () {
|
|
3203
|
+
var toAppend = [];
|
|
3204
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3205
|
+
toAppend[_i] = arguments[_i];
|
|
3206
|
+
}
|
|
3207
|
+
//this.dataSource = new MultiStreamDatasource<T>(this, ... toAppend);
|
|
3208
|
+
//return this;
|
|
3209
|
+
return LazyStream.of.apply(LazyStream, __spreadArray([this], toAppend, false)).flatMap(function (item) { return item; });
|
|
3210
|
+
};
|
|
3211
|
+
LazyStream.prototype.nextFilter = function (fn) {
|
|
3212
|
+
if (this.hasNext()) {
|
|
3213
|
+
var newVal = this.next();
|
|
3214
|
+
if (!fn(newVal)) {
|
|
3215
|
+
return this.nextFilter(fn);
|
|
3216
|
+
}
|
|
3217
|
+
return newVal;
|
|
3218
|
+
}
|
|
3219
|
+
return null;
|
|
3220
|
+
};
|
|
3221
|
+
LazyStream.prototype.limits = function (max) {
|
|
3222
|
+
this._limits = max;
|
|
3223
|
+
return this;
|
|
3224
|
+
};
|
|
3225
|
+
//main stream methods
|
|
3226
|
+
LazyStream.prototype.collect = function (collector) {
|
|
3227
|
+
while (this.hasNext()) {
|
|
3228
|
+
var t = this.next();
|
|
3229
|
+
collector.collect(t);
|
|
3230
|
+
}
|
|
3231
|
+
return collector.finalValue;
|
|
3232
|
+
};
|
|
3233
|
+
LazyStream.prototype.onElem = function (fn) {
|
|
3234
|
+
var _this = this;
|
|
3235
|
+
return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource(function (el) {
|
|
3236
|
+
if (fn(el, _this.pos) === false) {
|
|
3237
|
+
_this.stop();
|
|
3238
|
+
}
|
|
3239
|
+
return el;
|
|
3240
|
+
}, this));
|
|
3241
|
+
};
|
|
3242
|
+
LazyStream.prototype.filter = function (fn) {
|
|
3243
|
+
return new LazyStream(new SourcesCollectors_1.FilteredStreamDatasource(fn, this));
|
|
3244
|
+
};
|
|
3245
|
+
LazyStream.prototype.map = function (fn) {
|
|
3246
|
+
return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource(fn, this));
|
|
3247
|
+
};
|
|
3248
|
+
LazyStream.prototype.flatMap = function (fn) {
|
|
3249
|
+
return new LazyStream(new SourcesCollectors_1.FlatMapStreamDataSource(fn, this));
|
|
3250
|
+
};
|
|
3251
|
+
//endpoint
|
|
3252
|
+
LazyStream.prototype.each = function (fn) {
|
|
3253
|
+
while (this.hasNext()) {
|
|
3254
|
+
if (fn(this.next()) === false) {
|
|
3255
|
+
this.stop();
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
LazyStream.prototype.reduce = function (fn, startVal) {
|
|
3260
|
+
if (startVal === void 0) { startVal = null; }
|
|
3261
|
+
if (!this.hasNext()) {
|
|
3262
|
+
return Monad_1.Optional.absent;
|
|
3263
|
+
}
|
|
3264
|
+
var value1 = null;
|
|
3265
|
+
var value2 = null;
|
|
3266
|
+
if (startVal != null) {
|
|
3267
|
+
value1 = startVal;
|
|
3268
|
+
value2 = this.next();
|
|
3269
|
+
}
|
|
3270
|
+
else {
|
|
3271
|
+
value1 = this.next();
|
|
3272
|
+
if (!this.hasNext()) {
|
|
3273
|
+
return Monad_1.Optional.fromNullable(value1);
|
|
3274
|
+
}
|
|
3275
|
+
value2 = this.next();
|
|
3276
|
+
}
|
|
3277
|
+
value1 = fn(value1, value2);
|
|
3278
|
+
while (this.hasNext()) {
|
|
3279
|
+
value2 = this.next();
|
|
3280
|
+
value1 = fn(value1, value2);
|
|
3281
|
+
}
|
|
3282
|
+
return Monad_1.Optional.fromNullable(value1);
|
|
3283
|
+
};
|
|
3284
|
+
LazyStream.prototype.last = function () {
|
|
3285
|
+
if (!this.hasNext()) {
|
|
3286
|
+
return Monad_1.Optional.absent;
|
|
3287
|
+
}
|
|
3288
|
+
return this.reduce(function (el1, el2) { return el2; });
|
|
3289
|
+
};
|
|
3290
|
+
LazyStream.prototype.first = function () {
|
|
3291
|
+
this.reset();
|
|
3292
|
+
if (!this.hasNext()) {
|
|
3293
|
+
return Monad_1.Optional.absent;
|
|
3294
|
+
}
|
|
3295
|
+
return Monad_1.Optional.fromNullable(this.next());
|
|
3296
|
+
};
|
|
3297
|
+
LazyStream.prototype.anyMatch = function (fn) {
|
|
3298
|
+
while (this.hasNext()) {
|
|
3299
|
+
if (fn(this.next())) {
|
|
3300
|
+
return true;
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
return false;
|
|
3304
|
+
};
|
|
3305
|
+
LazyStream.prototype.allMatch = function (fn) {
|
|
3306
|
+
while (this.hasNext()) {
|
|
3307
|
+
if (!fn(this.next())) {
|
|
3308
|
+
return false;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
return true;
|
|
3312
|
+
};
|
|
3313
|
+
LazyStream.prototype.noneMatch = function (fn) {
|
|
3314
|
+
while (this.hasNext()) {
|
|
3315
|
+
if (fn(this.next())) {
|
|
3316
|
+
return false;
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
return true;
|
|
3320
|
+
};
|
|
3321
|
+
LazyStream.prototype.sort = function (comparator) {
|
|
3322
|
+
var arr = this.collect(new SourcesCollectors_1.ArrayCollector());
|
|
3323
|
+
arr = arr.sort(comparator);
|
|
3324
|
+
return LazyStream.of.apply(LazyStream, arr);
|
|
3325
|
+
};
|
|
3326
|
+
Object.defineProperty(LazyStream.prototype, "value", {
|
|
3327
|
+
get: function () {
|
|
3328
|
+
return this.collect(new SourcesCollectors_1.ArrayCollector());
|
|
3329
|
+
},
|
|
3330
|
+
enumerable: false,
|
|
3331
|
+
configurable: true
|
|
3332
|
+
});
|
|
3333
|
+
LazyStream.prototype[Symbol.iterator] = function () {
|
|
3334
|
+
var _this = this;
|
|
3335
|
+
return {
|
|
3336
|
+
next: function () {
|
|
3337
|
+
var done = !_this.hasNext();
|
|
3338
|
+
var val = _this.next();
|
|
3339
|
+
return {
|
|
3340
|
+
done: done,
|
|
3341
|
+
value: val
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3345
|
+
};
|
|
3346
|
+
/*get observable(): Observable<T> {
|
|
3347
|
+
return from(this);
|
|
3348
|
+
}*/
|
|
3349
|
+
LazyStream.prototype.stop = function () {
|
|
3350
|
+
this.pos = this._limits + 1000000000;
|
|
3351
|
+
};
|
|
3352
|
+
LazyStream.prototype.isOverLimits = function () {
|
|
3353
|
+
return this._limits != -1 && this.pos >= this._limits - 1;
|
|
3354
|
+
};
|
|
3355
|
+
return LazyStream;
|
|
3356
|
+
}());
|
|
3357
|
+
exports.LazyStream = LazyStream;
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
/***/ }),
|
|
3361
|
+
|
|
3362
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts":
|
|
3363
|
+
/*!****************************************************************!*\
|
|
3364
|
+
!*** ./node_modules/mona-dish/src/main/typescript/XmlQuery.ts ***!
|
|
3365
|
+
\****************************************************************/
|
|
3366
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3367
|
+
|
|
3368
|
+
|
|
3369
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3370
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3371
|
+
* this work for additional information regarding copyright ownership.
|
|
3372
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
3373
|
+
* (the "License"); you may not use this file except in compliance with
|
|
3374
|
+
* the License. You may obtain a copy of the License at
|
|
3375
|
+
*
|
|
3376
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3377
|
+
*
|
|
3378
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3379
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3380
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3381
|
+
* See the License for the specific language governing permissions and
|
|
3382
|
+
* limitations under the License.
|
|
3383
|
+
*/
|
|
3384
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3385
|
+
var extendStatics = function (d, b) {
|
|
3386
|
+
extendStatics = Object.setPrototypeOf ||
|
|
3387
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3388
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3389
|
+
return extendStatics(d, b);
|
|
3390
|
+
};
|
|
3391
|
+
return function (d, b) {
|
|
3392
|
+
if (typeof b !== "function" && b !== null)
|
|
3393
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3394
|
+
extendStatics(d, b);
|
|
3395
|
+
function __() { this.constructor = d; }
|
|
3396
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3397
|
+
};
|
|
3398
|
+
})();
|
|
3399
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3400
|
+
exports.XQ = exports.XMLQuery = void 0;
|
|
3401
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3402
|
+
var DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
|
|
3403
|
+
var isString = Lang_1.Lang.isString;
|
|
3404
|
+
/**
|
|
3405
|
+
* xml query as specialized case for DomQuery
|
|
3406
|
+
*/
|
|
3407
|
+
var XMLQuery = /** @class */ (function (_super) {
|
|
3408
|
+
__extends(XMLQuery, _super);
|
|
3409
|
+
function XMLQuery(rootNode, docType) {
|
|
3410
|
+
if (docType === void 0) { docType = "text/xml"; }
|
|
3411
|
+
var _this = this;
|
|
3412
|
+
var createIe11DomQueryShim = function () {
|
|
3413
|
+
//at the time if wroting ie11 is the only relevant browser
|
|
3414
|
+
//left withut any DomQuery support
|
|
3415
|
+
var parser = new ActiveXObject("Microsoft.XMLDOM");
|
|
3416
|
+
parser.async = false;
|
|
3417
|
+
//we shim th dom parser from ie in
|
|
3418
|
+
return {
|
|
3419
|
+
parseFromString: function (text, contentType) {
|
|
3420
|
+
return parser.loadXML(text);
|
|
3421
|
+
}
|
|
3422
|
+
};
|
|
3423
|
+
};
|
|
3424
|
+
var parseXML = function (xml) {
|
|
3425
|
+
if (xml == null) {
|
|
3426
|
+
return null;
|
|
3427
|
+
}
|
|
3428
|
+
var domParser = Lang_1.Lang.saveResolveLazy(function () { return new window.DOMParser(); }, function () { return createIe11DomQueryShim(); }).value;
|
|
3429
|
+
return domParser.parseFromString(xml, docType);
|
|
3430
|
+
};
|
|
3431
|
+
if (isString(rootNode)) {
|
|
3432
|
+
_this = _super.call(this, parseXML(rootNode)) || this;
|
|
3433
|
+
}
|
|
3434
|
+
else {
|
|
3435
|
+
_this = _super.call(this, rootNode) || this;
|
|
3436
|
+
}
|
|
3437
|
+
return _this;
|
|
3438
|
+
}
|
|
3439
|
+
XMLQuery.prototype.isXMLParserError = function () {
|
|
3440
|
+
return this.querySelectorAll("parsererror").isPresent();
|
|
3441
|
+
};
|
|
3442
|
+
XMLQuery.prototype.toString = function () {
|
|
3443
|
+
var ret = [];
|
|
3444
|
+
this.eachElem(function (node) {
|
|
3445
|
+
var _a, _b, _c;
|
|
3446
|
+
var serialized = (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.XMLSerializer) === null || _a === void 0 ? void 0 : _a.constructor()) === null || _b === void 0 ? void 0 : _b.serializeToString(node)) !== null && _c !== void 0 ? _c : node === null || node === void 0 ? void 0 : node.xml;
|
|
3447
|
+
if (!!serialized) {
|
|
3448
|
+
ret.push(serialized);
|
|
3449
|
+
}
|
|
3450
|
+
});
|
|
3451
|
+
return ret.join("");
|
|
3452
|
+
};
|
|
3453
|
+
XMLQuery.prototype.parserErrorText = function (joinstr) {
|
|
3454
|
+
return this.querySelectorAll("parsererror").textContent(joinstr);
|
|
3455
|
+
};
|
|
3456
|
+
XMLQuery.parseXML = function (txt) {
|
|
3457
|
+
return new XMLQuery(txt);
|
|
3458
|
+
};
|
|
3459
|
+
XMLQuery.parseHTML = function (txt) {
|
|
3460
|
+
return new XMLQuery(txt, "text/html");
|
|
3461
|
+
};
|
|
3462
|
+
XMLQuery.fromString = function (txt, parseType) {
|
|
3463
|
+
if (parseType === void 0) { parseType = "text/xml"; }
|
|
3464
|
+
return new XMLQuery(txt, parseType);
|
|
3465
|
+
};
|
|
3466
|
+
return XMLQuery;
|
|
3467
|
+
}(DomQuery_1.DomQuery));
|
|
3468
|
+
exports.XMLQuery = XMLQuery;
|
|
3469
|
+
exports.XQ = XMLQuery;
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
/***/ }),
|
|
3473
|
+
|
|
3474
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/index_core.ts":
|
|
3475
|
+
/*!******************************************************************!*\
|
|
3476
|
+
!*** ./node_modules/mona-dish/src/main/typescript/index_core.ts ***!
|
|
3477
|
+
\******************************************************************/
|
|
3478
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3482
|
+
exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Config = exports.Lang = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
|
|
3483
|
+
var DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
|
|
3484
|
+
Object.defineProperty(exports, "DomQuery", ({ enumerable: true, get: function () { return DomQuery_1.DomQuery; } }));
|
|
3485
|
+
Object.defineProperty(exports, "ElementAttribute", ({ enumerable: true, get: function () { return DomQuery_1.ElementAttribute; } }));
|
|
3486
|
+
Object.defineProperty(exports, "DomQueryCollector", ({ enumerable: true, get: function () { return DomQuery_1.DomQueryCollector; } }));
|
|
3487
|
+
Object.defineProperty(exports, "DQ", ({ enumerable: true, get: function () { return DomQuery_1.DQ; } }));
|
|
3488
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3489
|
+
Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
|
|
3490
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
3491
|
+
Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
|
|
3492
|
+
Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
|
|
3493
|
+
Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
|
|
3494
|
+
Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
|
|
3495
|
+
var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
|
|
3496
|
+
Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
|
|
3497
|
+
Object.defineProperty(exports, "XQ", ({ enumerable: true, get: function () { return XmlQuery_1.XQ; } }));
|
|
3498
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
3499
|
+
Object.defineProperty(exports, "Stream", ({ enumerable: true, get: function () { return Stream_1.Stream; } }));
|
|
3500
|
+
Object.defineProperty(exports, "LazyStream", ({ enumerable: true, get: function () { return Stream_1.LazyStream; } }));
|
|
3501
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
3502
|
+
Object.defineProperty(exports, "ArrayStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayStreamDataSource; } }));
|
|
3503
|
+
Object.defineProperty(exports, "MappedStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.MappedStreamDataSource; } }));
|
|
3504
|
+
Object.defineProperty(exports, "FilteredStreamDatasource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FilteredStreamDatasource; } }));
|
|
3505
|
+
Object.defineProperty(exports, "FlatMapStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FlatMapStreamDataSource; } }));
|
|
3506
|
+
Object.defineProperty(exports, "SequenceDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.SequenceDataSource; } }));
|
|
3507
|
+
Object.defineProperty(exports, "QueryFormStringCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormStringCollector; } }));
|
|
3508
|
+
Object.defineProperty(exports, "ArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayCollector; } }));
|
|
3509
|
+
Object.defineProperty(exports, "AssocArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.AssocArrayCollector; } }));
|
|
3510
|
+
Object.defineProperty(exports, "FormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.FormDataCollector; } }));
|
|
3511
|
+
Object.defineProperty(exports, "QueryFormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormDataCollector; } }));
|
|
9
3512
|
|
|
10
|
-
!function(){"use strict";var t={585:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function l(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,l)}u((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.DQ=e.DomQueryCollector=e.DomQuery=e.ElementAttribute=void 0;var f,p=r(152),h=r(551),y=r(255),v=r(805),d=v.Lang.trim,m=v.Lang.objToArray,b=v.Lang.isString,g=v.Lang.equalsIgnoreCase;function S(t,e,r){return void 0===r&&(r={attributes:!0,childList:!0,subtree:!0,timeout:500,interval:100}),new Promise((function(n,o){var a=new Error("Mutation observer timeout");if(void 0!==window.MutationObserver){var l=setTimeout((function(){return o(a)}),r.timeout),u=new window.MutationObserver((function(t,r){var o=new x(t.map((function(t){return t.target}))).first(e);o.isPresent()&&(clearTimeout(l),n(o))})),s=i({},r);delete s.timeout,t.eachElem((function(t){u.observe(t,s)}))}else var c=setInterval((function(){var o=null;(o=r.childList?e(t)?t:t.childNodes.first(e):r.subtree?e(t)?t:t.querySelectorAll(" * ").first(e):e(t)?t:x.absent).isPresent()&&f&&(clearTimeout(f),clearInterval(c),c=null,n(o))}),r.interval),f=setTimeout((function(){c&&(clearInterval(c),o(a))}),r.timeout)}))}!function(t){t.SELECT="select",t.BUTTON="button",t.SUBMIT="submit",t.RESET="reset",t.IMAGE="image",t.RADIO="radio",t.CHECKBOX="checkbox"}(f||(f={}));var A=function(t){function e(e,r,n){void 0===n&&(n=null);var o=t.call(this,e,r)||this;return o.element=e,o.name=r,o.defaultVal=n,o}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){var t,e=(t=this.element.get(0)).orElse.apply(t,[]).values;return e.length?e[0].getAttribute(this.name):this.defaultVal},set:function(t){for(var e,r=(e=this.element.get(0)).orElse.apply(e,[]).values,n=0;n<r.length;n++)r[n].setAttribute(this.name,t);r[0].setAttribute(this.name,t)},enumerable:!1,configurable:!0}),e.prototype.getClass=function(){return e},e.fromNullable=function(t,r){return void 0===r&&(r="value"),new e(t,r)},e}(p.ValueEmbedder);e.ElementAttribute=A;var w=function(t){return!0},x=function(){function t(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(this.rootNode=[],this.pos=-1,this._limits=-1,!p.Optional.fromNullable(r).isAbsent()&&r.length)for(var o=0;o<r.length;o++)if(r[o])if(b(r[o])){var i=t.querySelectorAll(r[o]);i.isAbsent()||r.push.apply(r,s([],u(i.values),!1))}else r[o]instanceof t?(e=this.rootNode).push.apply(e,s([],u(r[o].values),!1)):this.rootNode.push(r[o])}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getAsElem(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this.allElems()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return new A(this.get(0),"id")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.rootNode.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.getAsElem(0).getIf("tagName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return this.getAsElem(0).getIf("nodeName")},enumerable:!1,configurable:!0}),t.prototype.isTag=function(t){return!this.isAbsent()&&(this.nodeName.orElse("__none___").value.toLowerCase()==t.toLowerCase()||this.tagName.orElse("__none___").value.toLowerCase()==t.toLowerCase())},Object.defineProperty(t.prototype,"type",{get:function(){return this.getAsElem(0).getIf("type")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return new p.ValueEmbedder(this.getAsElem(0).value,"name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputValue",{get:function(){return this.getAsElem(0).getIf("value").isPresent()?new p.ValueEmbedder(this.getAsElem(0).value):p.ValueEmbedder.absent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checked",{get:function(){return h.Stream.of.apply(h.Stream,s([],u(this.values),!1)).allMatch((function(t){return!!t.checked}))},set:function(t){this.eachElem((function(e){return e.checked=t}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"elements",{get:function(){return this.querySelectorAll("input, checkbox, select, textarea, fieldset")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deepElements",{get:function(){return this.querySelectorAllDeep("input, select, textarea, checkbox, fieldset")},enumerable:!1,configurable:!0}),t.prototype.querySelectorAllDeep=function(e){var r=[],n=this.querySelectorAll(e);n.length&&r.push(n);var o=this.querySelectorAll("*").shadowRoot;if(o.length){var i=o.querySelectorAllDeep(e);i.length&&r.push(i)}return new(t.bind.apply(t,s([void 0],u(r),!1)))},Object.defineProperty(t.prototype,"disabled",{get:function(){return this.attr("disabled").isPresent()},set:function(t){t?this.attr("disabled").value="disabled":this.removeAttribute("disabled")},enumerable:!1,configurable:!0}),t.prototype.removeAttribute=function(t){this.eachElem((function(e){return e.removeAttribute(t)}))},Object.defineProperty(t.prototype,"childNodes",{get:function(){var e=[];return this.eachElem((function(t){e=e.concat(m(t.childNodes))})),new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stream",{get:function(){return new(h.Stream.bind.apply(h.Stream,s([void 0],u(this.asArray),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lazyStream",{get:function(){return h.LazyStream.of.apply(h.LazyStream,s([],u(this.asArray),!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asArray",{get:function(){return[].concat(h.LazyStream.of.apply(h.LazyStream,s([],u(this.rootNode),!1)).filter((function(t){return null!=t})).map((function(e){return t.byId(e)})).collect(new y.ArrayCollector))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asNodeArray",{get:function(){return[].concat(h.Stream.of(this.rootNode).filter((function(t){return null!=t})).collect(new y.ArrayCollector))},enumerable:!1,configurable:!0}),t.querySelectorAllDeep=function(e){return new t(document).querySelectorAllDeep(e)},t.querySelectorAll=function(e){return-1!=e.indexOf("/shadow/")?new t(document)._querySelectorAllDeep(e):new t(document)._querySelectorAll(e)},t.byId=function(e,r){return void 0===r&&(r=!1),b(e)?r?new t(document).byIdDeep(e):new t(document).byId(e):new t(e)},t.byTagName=function(e){return b(e)?new t(document).byTagName(e):new t(e)},t.globalEval=function(e,r){return new t(document).globalEval(e,r)},t.fromMarkup=function(e){var r=document.implementation.createHTMLDocument(""),n=(e=d(e)).toLowerCase();if(-1!=n.indexOf("<!doctype")||-1!=n.indexOf("<html")||-1!=n.indexOf("<head")||-1!=n.indexOf("<body"))return r.documentElement.innerHTML=e,new t(r.documentElement);var o=function(t,e){var r=["<",e,">"].join(""),n=["<",e," "].join("");return 0==t.indexOf(r)||0==t.indexOf(n)},i=new t(document.createElement("div"));return o(n,"thead")||o(n,"tbody")?(i.html("<table>".concat(e,"</table>")),i.querySelectorAll("table").get(0).childNodes.detach()):o(n,"tfoot")?(i.html("<table><thead></thead><tbody><tbody".concat(e,"</table>")),i.querySelectorAll("table").get(2).childNodes.detach()):o(n,"tr")?(i.html("<table><tbody>".concat(e,"</tbody></table>")),i.querySelectorAll("tbody").get(0).childNodes.detach()):o(n,"td")?(i.html("<table><tbody><tr>".concat(e,"</tr></tbody></table>")),i.querySelectorAll("tr").get(0).childNodes.detach()):(i.html(e),i.childNodes.detach())},t.prototype.get=function(e){return e<this.rootNode.length?new t(this.rootNode[e]):t.absent},t.prototype.getAsElem=function(t,e){return void 0===e&&(e=p.Optional.absent),t<this.rootNode.length?p.Optional.fromNullable(this.rootNode[t]):e},t.prototype.filesFromElem=function(t){var e;return t<this.rootNode.length&&(null===(e=this.rootNode[t])||void 0===e?void 0:e.files)?this.rootNode[t].files:[]},t.prototype.allElems=function(){return this.rootNode},t.prototype.isAbsent=function(){return 0==this.length},t.prototype.isPresent=function(t){var e=this.isAbsent();return!e&&t&&t.call(this,this),!e},t.prototype.ifPresentLazy=function(t){return void 0===t&&(t=function(){}),this.isPresent.call(this,t),this},t.prototype.delete=function(){this.eachElem((function(t){t.parentNode&&t.parentNode.removeChild(t)}))},t.prototype.querySelectorAll=function(t){return-1!=t.indexOf("/shadow/")?this._querySelectorAllDeep(t):this._querySelectorAll(t)},t.prototype._querySelectorAll=function(e){var r,n;if(!(null===(r=null==this?void 0:this.rootNode)||void 0===r?void 0:r.length))return this;for(var o=[],i=0;i<this.rootNode.length;i++)if(null===(n=this.rootNode[i])||void 0===n?void 0:n.querySelectorAll){var a=this.rootNode[i].querySelectorAll(e);o=o.concat(m(a))}return new(t.bind.apply(t,s([void 0],u(o),!1)))},t.prototype._querySelectorAllDeep=function(e){var r;if(!(null===(r=null==this?void 0:this.rootNode)||void 0===r?void 0:r.length))return this;for(var n=new(t.bind.apply(t,s([void 0],u(this.rootNode),!1))),o=e.split(/\/shadow\//),i=0;i<o.length;i++)if(""!=o[i]){var a=o[i];n=n.querySelectorAll(a),i<o.length-1&&(n=n.shadowRoot)}return n},t.prototype.byId=function(e,r){var n=[];return r&&(n=n.concat(h.LazyStream.of.apply(h.LazyStream,s([],u((null==this?void 0:this.rootNode)||[]),!1)).filter((function(t){return e==t.id})).map((function(e){return new t(e)})).collect(new y.ArrayCollector))),n=n.concat(this.querySelectorAll('[id="'.concat(e,'"]'))),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.byIdDeep=function(e,r){var n=[];r&&(n=n.concat(h.LazyStream.of.apply(h.LazyStream,s([],u((null==this?void 0:this.rootNode)||[]),!1)).filter((function(t){return e==t.id})).map((function(e){return new t(e)})).collect(new y.ArrayCollector)));var o=this.querySelectorAllDeep('[id="'.concat(e,'"]'));return o.length&&n.push(o),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.byTagName=function(e,r,n){var o,i=[];return r&&(i=h.LazyStream.of.apply(h.LazyStream,s([],u(null!==(o=null==this?void 0:this.rootNode)&&void 0!==o?o:[]),!1)).filter((function(t){return(null==t?void 0:t.tagName)==e})).reduce((function(t,e){return t.concat([e])}),i).orElse(i).value),n?i.push(this.querySelectorAllDeep(e)):i.push(this.querySelectorAll(e)),new(t.bind.apply(t,s([void 0],u(i),!1)))},t.prototype.attr=function(t,e){return void 0===e&&(e=null),new A(this,t,e)},t.prototype.hasClass=function(t){var e=!1;return this.eachElem((function(r){if(e=r.classList.contains(t))return!1})),e},t.prototype.addClass=function(t){return this.eachElem((function(e){return e.classList.add(t)})),this},t.prototype.removeClass=function(t){return this.eachElem((function(e){return e.classList.remove(t)})),this},t.prototype.isMultipartCandidate=function(t){var e=this;void 0===t&&(t=!1);return this.stream.filter((function(r){return function(r){var n;return 0!=r.length&&(1==r.length?"input"==r.tagName.get("booga").value.toLowerCase()&&"file"==((null===(n=r.attr("type"))||void 0===n?void 0:n.value)||"").toLowerCase()||(t?e.querySelectorAllDeep("input[type='file']").firstElem().isPresent():e.querySelectorAll("input[type='file']").firstElem().isPresent()):r.isMultipartCandidate(t))}(r)})).first().isPresent()},t.prototype.html=function(t){return p.Optional.fromNullable(t).isAbsent()?this.isPresent()?p.Optional.fromNullable(this.innerHtml):p.Optional.absent:(this.innerHtml=t,this)},t.prototype.dispatchEvent=function(t){return this.eachElem((function(e){return e.dispatchEvent(t)})),this},Object.defineProperty(t.prototype,"innerHtml",{get:function(){var t=[];return this.eachElem((function(e){return t.push(e.innerHTML)})),t.join("")},set:function(t){this.eachElem((function(e){return e.innerHTML=t}))},enumerable:!1,configurable:!0}),t.prototype._mozMatchesSelector=function(t,e){var r=t,n=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector||function(e){for(var r=(document||window.ownerDocument).querySelectorAll(e),n=r.length;--n>=0&&r.item(n)!==t;);return n>-1};return n.call(t,e)},t.prototype.filterSelector=function(e){var r=this,n=[];return this.eachElem((function(t){r._mozMatchesSelector(t,e)&&n.push(t)})),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.matchesSelector=function(t){var e=this;return this.eachElem((function(r){if(!e._mozMatchesSelector(r,t))return!1})),!0},t.prototype.getIf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this.childNodes,n=0;n<t.length;n++)if((r=r.filterSelector(t[n])).isAbsent())return r;return r},t.prototype.eachElem=function(t){for(var e=0,r=this.rootNode.length;e<r&&!1!==t(this.rootNode[e],e);e++);return this},t.prototype.firstElem=function(t){return void 0===t&&(t=function(t){return t}),this.rootNode.length>1&&t(this.rootNode[0],0),this},t.prototype.each=function(e){return h.Stream.of.apply(h.Stream,s([],u(this.rootNode),!1)).each((function(r,n){if(null!=r)return e(t.byId(r),n)})),this},t.prototype.first=function(t){return void 0===t&&(t=function(t){return t}),this.rootNode.length>=1?(t(this.get(0),0),this.get(0)):this},t.prototype.filter=function(e){var r=[];return this.each((function(t){e(t)&&r.push(t)})),new(t.bind.apply(t,s([void 0],u(r),!1)))},t.prototype.globalEval=function(t,e){var r=document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("script");e&&n.setAttribute("nonce",e),n.type="text/javascript",n.innerHTML=t;var o=r.appendChild(n);return r.removeChild(o),this},t.prototype.detach=function(){return this.eachElem((function(t){t.parentNode.removeChild(t)})),this},t.prototype.appendTo=function(t){this.eachElem((function(e){t.getAsElem(0).orElseLazy((function(){return{appendChild:function(t){}}})).value.appendChild(e)}))},t.prototype.loadScriptEval=function(t,e,r){var n=this;void 0===e&&(e=0),void 0===r&&(r="utf-8");var o=new XMLHttpRequest;return o.open("GET",t,!1),r&&o.setRequestHeader("Content-Type","application/x-javascript; charset:"+r),o.send(null),o.onload=function(r){e?setTimeout((function(){n.globalEval(o.responseText+"\r\n//@ sourceURL="+t)}),e):n.globalEval(o.responseText.replace(/\n/g,"\r\n")+"\r\n//@ sourceURL="+t)},o.onerror=function(t){throw Error(t)},this},t.prototype.insertAfter=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.each((function(t){for(var r=t.getAsElem(0).value,n=r.parentNode,o=function(t){var o=r.nextSibling;e[t].eachElem((function(t){o?(n.insertBefore(t,o),r=o):n.appendChild(t)}))},i=0;i<e.length;i++)o(i)}));var n=[];return n.push(this),n=n.concat(e),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.insertBefore=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.each((function(t){for(var r=t.getAsElem(0).value,n=r.parentNode,o=0;o<e.length;o++)e[o].eachElem((function(t){n.insertBefore(t,r)}))}));var n=[];return n.push(this),n=n.concat(e),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.orElse=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.isPresent()?this:new(t.bind.apply(t,s([void 0],u(e),!1)))},t.prototype.orElseLazy=function(e){return this.isPresent()?this:new t(e())},t.prototype.parents=function(e){var r=new Set,n=[],o=e.toLowerCase(),i=function(t){(t.tagName||"").toLowerCase()!=o||r.has(t)||(r.add(t),n.push(t))};return this.eachElem((function(t){for(var r;t.parentNode||t.host;)if(t=null!==(r=null==t?void 0:t.parentNode)&&void 0!==r?r:null==t?void 0:t.host,i(t),"form"==e&&n.length)return!1})),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.copyAttrs=function(t){var e=this;return t.eachElem((function(t){var r,n,o=m(t.attributes);try{for(var i=c(o),a=i.next();!a.done;a=i.next()){var l=a.value,u=l.value,s=l.name;switch(s){case"id":e.id.value=u;break;case"disabled":e.resolveAttributeHolder("disabled").disabled=u;break;case"checked":e.resolveAttributeHolder("checked").checked=u;break;default:e.attr(s).value=u}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}})),this},t.prototype.resolveAttributeHolder=function(t){void 0===t&&(t="value");var e=[];return e[t]=null,t in this.getAsElem(0).value?this.getAsElem(0).value:e},t.prototype.outerHTML=function(e,r,n,o){var i;if(void 0===o&&(o=!1),!this.isAbsent()){var a=null===(i=null===document||void 0===document?void 0:document.activeElement)||void 0===i?void 0:i.id,l=a?t.getCaretPosition(document.activeElement):null,c=t.fromMarkup(e),f=[],p=this.getAsElem(0).value,h=c.get(0),y=p.parentNode,v=h.getAsElem(0).value;if(y.replaceChild(v,p),f.push(new t(v)),this.isAbsent())return this;var d=[];c.length>1&&(d=d.concat.apply(d,s([],u(c.values.slice(1)),!1)),f.push(t.byId(v).insertAfter(new(t.bind.apply(t,s([void 0],u(d),!1)))))),r&&this.runScripts(),n&&this.runCss();var m=t.byId(a);return a&&m.isPresent()&&null!=l&&void 0!==l&&m.eachElem((function(e){return t.setCaretPosition(e,l)})),c}},t.prototype.runScripts=function(e){var r=this;void 0===e&&(e=w);var n=[],o=g,i=function(t){var i=t.tagName,a=t.type||"";if(i&&o(i,"script")&&(""===a||o(a,"text/javascript")||o(a,"javascript")||o(a,"text/ecmascript")||o(a,"ecmascript"))){var l=t.getAttribute("src");if(void 0!==l&&null!=l&&l.length>0)e(l)&&(n.length&&(r.globalEval(n.join("\n")),n=[]),r.loadScriptEval(l,0,"UTF-8"));else{for(var u=d(t.text||t.innerText||t.innerHTML),s=!0;s;)s=!1,"\x3c!--"==u.substring(0,4)&&(u=u.substring(4),s=!0),"//\x3c!--"==u.substring(0,4)&&(u=u.substring(6),s=!0),"//<![CDATA["==u.substring(0,11)&&(u=u.substring(11),s=!0);n.push(u)}}};try{new t(this.filterSelector("script"),this.querySelectorAll("script")).stream.flatMap((function(t){return h.Stream.of(t.values)})).sort((function(t,e){return t.compareDocumentPosition(e)-3})).each((function(t){return i(t)})),n.length&&this.globalEval(n.join("\n"))}catch(t){window.console&&window.console.error&&console.error(t.message||t.description)}finally{i=null}return this},t.prototype.runCss=function(){var e=function(t,e){var r,n,o,i,a=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(a);var l=null!==(r=a.sheet)&&void 0!==r?r:a.styleSheet;a.setAttribute("rel",null!==(n=t.getAttribute("rel"))&&void 0!==n?n:"stylesheet"),a.setAttribute("type",null!==(o=t.getAttribute("type"))&&void 0!==o?o:"text/css"),null!==(i=null==l?void 0:l.cssText)&&void 0!==i&&i?l.cssText=e:a.appendChild(document.createTextNode(e))};return new t(this.filterSelector("link, style"),this.querySelectorAll("link, style")).stream.flatMap((function(t){return h.Stream.of(t.values)})).sort((function(t,e){return t.compareDocumentPosition(e)-3})).each((function(t){return function(t){var r=t.tagName;if(r&&g(r,"link")&&g(t.getAttribute("type"),"text/css"))e(t,"@import url('"+t.getAttribute("href")+"');");else if(r&&g(r,"style")&&g(t.getAttribute("type"),"text/css")){var n=[],o=Array.prototype.slice.call(t.childNodes);o?o.forEach((function(t){return n.push(t.innerHTML||t.data)})):t.innerHTML&&n.push(t.innerHTML),e(t,n.join(""))}}(t)})),this},t.prototype.click=function(){return this.fireEvent("click"),this},t.prototype.addEventListener=function(t,e,r){return this.eachElem((function(n){return n.addEventListener(t,e,r)})),this},t.prototype.removeEventListener=function(t,e,r){return this.eachElem((function(n){return n.removeEventListener(t,e,r)})),this},t.prototype.fireEvent=function(t){this.eachElem((function(e){var r;if(e.ownerDocument)r=e.ownerDocument;else{if(9!=e.nodeType)throw new Error("Invalid node passed to fireEvent: "+e.id);r=e}if(e.dispatchEvent){var n="";switch(t){case"click":case"mousedown":case"mouseup":n="MouseEvents";break;case"focus":case"change":case"blur":case"select":n="HTMLEvents";break;default:throw"fireEvent: Couldn't find an event class for event '"+t+"'."}var o=r.createEvent(n);o.initEvent(t,!0,!0),o.synthetic=!0,e.dispatchEvent(o)}else if(e.fireEvent){var i=r.createEventObject();i.synthetic=!0,e.fireEvent("on"+t,i)}}))},t.prototype.textContent=function(t){return void 0===t&&(t=""),this.stream.map((function(t){return t.getAsElem(0).orElseLazy((function(){return{textContent:""}})).value.textContent||""})).reduce((function(e,r){return e+t+r}),"").value},t.prototype.innerText=function(t){return void 0===t&&(t=""),this.stream.map((function(t){return t.getAsElem(0).orElseLazy((function(){return{innerText:""}})).value.innerText||""})).reduce((function(e,r){return[e,r].join(t)}),"").value},t.prototype.encodeFormElement=function(t){if(void 0===t&&(t=new p.Config({})),!this.name.isAbsent()){var e=t.shallowCopy;return this.each((function(t){var r,n;if(!t.name.isAbsent()){var o=t.name.value,i=t.tagName.orElse("__none__").value.toLowerCase(),a=t.type.orElse("__none__").value.toLowerCase();if(a=a.toLowerCase(),("input"==i||"textarea"==i||"select"==i)&&null!=o&&""!=o&&!t.disabled){if("select"==i){var l=t.getAsElem(0).value;if(l.selectedIndex>=0)for(var u=l.options.length,s=0;s<u;s++)if(l.options[s].selected){var c=l.options[s];e.append(o).value=null!=c.getAttribute("value")?c.value:c.text}}if(i!=f.SELECT&&a!=f.BUTTON&&a!=f.RESET&&a!=f.SUBMIT&&a!=f.IMAGE&&(a!=f.CHECKBOX&&a!=f.RADIO||t.checked)){var p=null!==(n=null===(r=t.value.value)||void 0===r?void 0:r.files)&&void 0!==n?n:[];(null==p?void 0:p.length)?e.append(o).value=p[0]:e.append(o).value=t.inputValue.value}}}})),e}},Object.defineProperty(t.prototype,"cDATAAsString",{get:function(){return this.lazyStream.flatMap((function(t){return t.childNodes.stream})).filter((function(t){var e,r;return 4==(null===(r=null===(e=null==t?void 0:t.value)||void 0===e?void 0:e.value)||void 0===r?void 0:r.nodeType)})).reduce((function(t,e){var r,n,o;return t.push(null!==(o=null===(n=null===(r=null==e?void 0:e.value)||void 0===r?void 0:r.value)||void 0===n?void 0:n.data)&&void 0!==o?o:""),t}),[]).value.join("")},enumerable:!1,configurable:!0}),t.prototype.subNodes=function(e,r){return p.Optional.fromNullable(r).isAbsent()&&(r=this.length),new(t.bind.apply(t,s([void 0],u(this.rootNode.slice(e,Math.min(r,this.length))),!1)))},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.hasNext=function(){var t=-1!=this._limits&&this.pos>=this._limits-1,e=this.pos>=this.values.length-1;return!(t||e)},t.prototype.next=function(){return this.hasNext()?(this.pos++,new t(this.values[this.pos])):null},t.prototype.reset=function(){this.pos=-1},t.prototype.attachShadow=function(e){void 0===e&&(e={mode:"open"});var r=[];return this.eachElem((function(n){var o;if(!(null==n?void 0:n.attachShadow))throw new Error("Shadow dom creation not supported by the browser, please use a shim, to gain this functionality");o=t.byId(n.attachShadow(e)),r.push(o)})),new(t.bind.apply(t,s([void 0],u(r),!1)))},t.prototype.waitUntilDom=function(t,e){return void 0===e&&(e={attributes:!0,childList:!0,subtree:!0,timeout:500,interval:100}),a(this,void 0,void 0,(function(){return l(this,(function(r){return[2,S(this,t,e)]}))}))},Object.defineProperty(t.prototype,"shadowElements",{get:function(){var e=(this.querySelectorAll("*").filter((function(t){return t.hasShadow})).allElems()||[]).map((function(t){return t.shadowRoot}));return new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowRoot",{get:function(){for(var e=[],r=0;r<this.rootNode.length;r++)this.rootNode[r].shadowRoot&&e.push(this.rootNode[r].shadowRoot);return new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasShadow",{get:function(){for(var t=0;t<this.rootNode.length;t++)if(this.rootNode[t].shadowRoot)return!0;return!1},enumerable:!1,configurable:!0}),t.getCaretPosition=function(t){var e=0;try{if(null===document||void 0===document?void 0:document.selection){t.focus();var r=document.selection.createRange();r.moveStart("character",-t.value.length),e=r.text.length}}catch(t){}return e},t.setCaretPosition=function(t,e){(null==t?void 0:t.focus)&&(null==t||t.focus()),(null==t?void 0:t.setSelectiongRange)&&(null==t||t.setSelectiongRange(e,e))},t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.absent=new t,t}();e.DomQuery=x;var E=function(){function t(){this.data=[]}return t.prototype.collect=function(t){this.data.push(t)},Object.defineProperty(t.prototype,"finalValue",{get:function(){return new(x.bind.apply(x,s([void 0],u(this.data),!1)))},enumerable:!1,configurable:!0}),t}();e.DomQueryCollector=E,e.DQ=x},805:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Lang=void 0;var n=r(152);!function(t){function e(t){for(var e=/\s/,r=(t=t.replace(/^\s\s*/,"")).length;e.test(t.charAt(--r)););return t.slice(0,r+1)}function r(t){return!!arguments.length&&null!=t&&("string"==typeof t||t instanceof String)}t.saveResolve=function(t,e){void 0===e&&(e=null);try{var r=t();return n.Optional.fromNullable(null!=r?r:e)}catch(t){return n.Optional.absent}},t.saveResolveLazy=function(t,e){void 0===e&&(e=null);try{var r=t();return n.Optional.fromNullable(null!=r?r:e())}catch(t){return n.Optional.absent}},t.strToArray=function(t,r){void 0===r&&(r=/\./gi);var n=[];return t.split(r).forEach((function(t){n.push(e(t))})),n},t.trim=e,t.objToArray=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=[]),"__undefined__"==(null!=t?t:"__undefined__")?null!=r?r:null:t instanceof Array&&!e&&!r?t:r.concat(Array.prototype.slice.call(t,e))},t.equalsIgnoreCase=function(t,e){var r=null!=e?e:"___no_value__";return(null!=t?t:"___no_value__").toLowerCase()===r.toLowerCase()},t.assertType=function(t,e){return r(e)?typeof t==e:t instanceof e},t.isString=r,t.isFunc=function(t){return t instanceof Function||"function"==typeof t},t.objAssign=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(null==t)throw new TypeError("Cannot convert undefined or null to object");var n=Object(t);return Object.assign?(e.forEach((function(t){return Object.assign(n,t)})),n):(e.filter((function(t){return null!=t})).forEach((function(t){var e=t;Object.keys(e).filter((function(t){return Object.prototype.hasOwnProperty.call(e,t)})).forEach((function(t){return n[t]=e[t]}))})),n)}}(e.Lang||(e.Lang={}))},152:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.Config=e.ValueEmbedder=e.Optional=e.Monad=void 0;var l=r(805),u=r(255),s=r(551),c=l.Lang.objAssign,f=function(){function t(t){this._value=t}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.map=function(e){return e||(e=function(t){return t}),new t(e(this.value))},t.prototype.flatMap=function(e){for(var r=this.map(e);(null==r?void 0:r.value)instanceof t;)r=r.value;return r},t}();e.Monad=f;var p=function(t){function e(e){return t.call(this,e)||this}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value instanceof f?this._value.flatMap().value:this._value},enumerable:!1,configurable:!0}),e.fromNullable=function(t){return new e(t)},e.prototype.isAbsent=function(){return void 0===this.value||null==this.value},e.prototype.isPresent=function(t){var e=this.isAbsent();return!e&&t&&t.call(this,this),!e},e.prototype.ifPresentLazy=function(t){return void 0===t&&(t=function(){}),this.isPresent.call(this,t),this},e.prototype.orElse=function(t){return this.isPresent()?this:null==t?e.absent:this.flatMap((function(){return t}))},e.prototype.orElseLazy=function(t){return this.isPresent()?this:this.flatMap(t)},e.prototype.flatMap=function(r){var n=t.prototype.flatMap.call(this,r);return n instanceof e?n.flatMap():e.fromNullable(n.value)},e.prototype.getIf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this,n=0;n<t.length;n++){var o=this.keyVal(t[n]),i=this.arrayIndex(t[n]);if(""===o&&i>=0){if((r=this.getClass().fromNullable(r.value instanceof Array?r.value.length<i?null:r.value[i]:null)).isAbsent())return r}else if(o&&i>=0){if(r.getIfPresent(o).isAbsent())return r;if((r=r.getIfPresent(o).value instanceof Array?this.getClass().fromNullable(r.getIfPresent(o).value[i]):this.getClass().absent).isAbsent())return r}else{if((r=r.getIfPresent(o)).isAbsent())return r;i>-1&&(r=this.getClass().fromNullable(r.value[i]))}}return r},e.prototype.match=function(t){return!this.isAbsent()&&t(this.value)},e.prototype.get=function(t){return void 0===t&&(t=e.absent),this.isAbsent()?this.getClass().fromNullable(t).flatMap():this.getClass().fromNullable(this.value).flatMap()},e.prototype.toJson=function(){return JSON.stringify(this.value)},e.prototype.getClass=function(){return e},e.prototype.arrayIndex=function(t){var e=t.indexOf("["),r=t.indexOf("]");return e>=0&&r>0&&e<r?parseInt(t.substring(e+1,r)):-1},e.prototype.keyVal=function(t){var e=t.indexOf("[");return e>=0?t.substring(0,e):t},e.prototype.getIfPresent=function(t){return this.isAbsent()?this.getClass().absent:this.getClass().fromNullable(this.value[t]).flatMap()},e.prototype.resolve=function(t){if(this.isAbsent())return e.absent;try{return e.fromNullable(t(this.value))}catch(t){return e.absent}},e.absent=e.fromNullable(null),e}(f);e.Optional=p;var h=function(t){function e(e,r){void 0===r&&(r="value");var n=t.call(this,e)||this;return n.key=r,n}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value?this._value[this.key]:null},set:function(t){this._value&&(this._value[this.key]=t)},enumerable:!1,configurable:!0}),e.prototype.orElse=function(t){var r={};return r[this.key]=t,this.isPresent()?this:new e(r,this.key)},e.prototype.orElseLazy=function(t){if(this.isPresent())return this;var r={};return r[this.key]=t(),new e(r,this.key)},e.prototype.getClass=function(){return e},e.fromNullable=function(t,r){return void 0===r&&(r="value"),new e(t,r)},e.absent=e.fromNullable(null),e}(p);e.ValueEmbedder=h;var y=function(t){function e(e,r,n){var o=t.call(this,e,r)||this;return o.arrPos=null!=n?n:-1,o}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return""==this.key&&this.arrPos>=0?this._value[this.arrPos]:this.key&&this.arrPos>=0?this._value[this.key][this.arrPos]:this._value[this.key]},set:function(t){""==this.key&&this.arrPos>=0?this._value[this.arrPos]=t:this.key&&this.arrPos>=0?this._value[this.key][this.arrPos]=t:this._value[this.key]=t},enumerable:!1,configurable:!0}),e.absent=e.fromNullable(null),e}(h),v=function(t){function e(e){return t.call(this,e)||this}return o(e,t),Object.defineProperty(e.prototype,"shallowCopy",{get:function(){return new e(s.Stream.ofAssoc(this.value).collect(new u.AssocArrayCollector))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deepCopy",{get:function(){return new e(c({},this.value))},enumerable:!1,configurable:!0}),e.fromNullable=function(t){return new e(t)},e.prototype.shallowMerge=function(t,e,r){var n=this;void 0===e&&(e=!0),void 0===r&&(r=!1);var o=function(o){!e&&o in l.value||(r?Array.isArray(t.getIf(o).value)?s.Stream.of.apply(s.Stream,a([],i(t.getIf(o).value),!1)).each((function(t){return n.append(o).value=t})):l.append(o).value=t.getIf(o).value:l.assign(o).value=t.getIf(o).value)},l=this;for(var u in t.value)o(u)},e.prototype.append=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.length<1;if(!r){var n=t[t.length-1],o=(this.keyVal(n),this.getIf.apply(this,a([],i(t),!1)).isPresent());this.buildPath(t);var l=this.arrayIndex(n);if(l>-1)throw Error("Append only possible on non array properties, use assign on indexed data");var u=this.getIf.apply(this,a([],i(t),!1)).value;Array.isArray(u)||(u=this.assign.apply(this,a([],i(t),!1)).value=[u]),o&&u.push({}),l=u.length-1;var s=new y(1==t.length?this.value:this.getIf.apply(this,t.slice(0,t.length-1)).value,n,l);return s}},e.prototype.appendIf=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t?this.append.apply(this,a([],i(e),!1)):{value:null}},e.prototype.assign=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!(t.length<1)){this.buildPath(t);var r=this.keyVal(t[t.length-1]),n=this.arrayIndex(t[t.length-1]),o=new y(1==t.length?this.value:this.getIf.apply(this,t.slice(0,t.length-1)).value,r,n);return o}},e.prototype.assignIf=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t?this.assign.apply(this,a([],i(e),!1)):{value:null}},e.prototype.getIf=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.getClass().fromNullable(t.prototype.getIf.apply(this,e).value)},e.prototype.get=function(e){return this.getClass().fromNullable(t.prototype.get.call(this,e).value)},e.prototype.delete=function(t){return t in this.value&&delete this.value[t],this},e.prototype.toJson=function(){return JSON.stringify(this.value)},e.prototype.getClass=function(){return e},e.prototype.setVal=function(t){this._value=t},e.prototype.buildPath=function(t){for(var e=this,r=this.getClass().fromNullable(null),n=-1,o=function(t,e){for(var r=t.length,n=r+e,o=r;o<n;o++)t.push({})},i=0;i<t.length;i++){var a=this.keyVal(t[i]),l=this.arrayIndex(t[i]);if(""===a&&l>=0)e.setVal(e.value instanceof Array?e.value:[]),o(e.value,l+1),n>=0&&(r.value[n]=e.value),r=e,n=l,e=this.getClass().fromNullable(e.value[l]);else{var u=e.getIf(a);if(-1==l)u.isAbsent()?u=this.getClass().fromNullable(e.value[a]={}):e=u;else{var s=u.value instanceof Array?u.value:[];o(s,l+1),e.value[a]=s,u=this.getClass().fromNullable(s[l])}r=e,n=l,e=u}}return this},e}(p);e.Config=v},255:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryFormStringCollector=e.QueryFormDataCollector=e.FormDataCollector=e.AssocArrayCollector=e.Run=e.ArrayAssocArrayCollector=e.ArrayCollector=e.FlatMapStreamDataSource=e.MappedStreamDataSource=e.FilteredStreamDatasource=e.ArrayStreamDataSource=e.SequenceDataSource=void 0;var i=r(551),a=function(){function t(t,e){this.total=e,this.start=t,this.value=t}return t.prototype.hasNext=function(){return this.value<this.total},t.prototype.next=function(){return Math.min(this.value++,this.total-1)},t.prototype.reset=function(){this.value=0},t}();e.SequenceDataSource=a;var l=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.dataPos=-1,this.value=t}return t.prototype.hasNext=function(){return this.value.length-1>this.dataPos},t.prototype.next=function(){return this.dataPos++,this.value[this.dataPos]},t.prototype.reset=function(){this.dataPos=-1},t}();e.ArrayStreamDataSource=l;var u=function(){function t(t,e){this.filteredNext=null,this.filterFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){for(;null==this.filteredNext&&this.inputDataSource.hasNext();){var t=this.inputDataSource.next();if(this.filterFunc(t))return this.filteredNext=t,!0;this.filteredNext=null}return null!=this.filteredNext},t.prototype.next=function(){var t=this.filteredNext;return this.filteredNext=null,this.hasNext(),t},t.prototype.reset=function(){this.filteredNext=null,this.inputDataSource.reset()},t}();e.FilteredStreamDatasource=u;var s=function(){function t(t,e){this.mapFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){return this.inputDataSource.hasNext()},t.prototype.next=function(){return this.mapFunc(this.inputDataSource.next())},t.prototype.reset=function(){this.inputDataSource.reset()},t}();e.MappedStreamDataSource=s;var c=function(){function t(t,e){this.mapFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){return this.resolveCurrentNext()||this.resolveNextNext()},t.prototype.resolveCurrentNext=function(){var t=!1;return this.activeDataSource&&(t=this.activeDataSource.hasNext()),t},t.prototype.resolveNextNext=function(){for(var t=!1;!t&&this.inputDataSource.hasNext();){var e=this.mapFunc(this.inputDataSource.next());Array.isArray(e)?this.activeDataSource=new(l.bind.apply(l,o([void 0],n(e),!1))):this.activeDataSource=e,t=this.activeDataSource.hasNext()}return t},t.prototype.next=function(){return this.activeDataSource.next()},t.prototype.reset=function(){this.inputDataSource.reset()},t}();e.FlatMapStreamDataSource=c;var f=function(){function t(){this.data=[]}return t.prototype.collect=function(t){this.data.push(t)},Object.defineProperty(t.prototype,"finalValue",{get:function(){return this.data},enumerable:!1,configurable:!0}),t}();e.ArrayCollector=f;var p=function(){function t(){this.finalValue={}}return t.prototype.collect=function(t){var e,r,n,o,i=null!==(e=null==t?void 0:t[0])&&void 0!==e?e:t;this.finalValue[i]=null!==(n=null===(r=this.finalValue)||void 0===r?void 0:r[i])&&void 0!==n?n:[],this.finalValue[i].push(null===(o=null==t?void 0:t[1])||void 0===o||o)},t}();e.ArrayAssocArrayCollector=p;var h=function(){function t(){}return t.prototype.collect=function(t){},Object.defineProperty(t.prototype,"finalValue",{get:function(){return null},enumerable:!1,configurable:!0}),t}();e.Run=h;var y=function(){function t(){this.finalValue={}}return t.prototype.collect=function(t){var e,r;this.finalValue[null!==(e=t[0])&&void 0!==e?e:t]=null===(r=t[1])||void 0===r||r},t}();e.AssocArrayCollector=y;var v=function(){function t(){this.finalValue=new FormData}return t.prototype.collect=function(t){this.finalValue.append(t.key,t.value)},t}();e.FormDataCollector=v;var d=function(){function t(){this.finalValue=new FormData}return t.prototype.collect=function(t){var e=t.encodeFormElement();e.isPresent()&&this.finalValue.append(t.name.value,e.get(t.name).value)},t}();e.QueryFormDataCollector=d;var m=function(){function t(){this.formData=[]}return t.prototype.collect=function(t){var e=t.encodeFormElement();e.isPresent()&&this.formData.push([t.name.value,e.get(t.name).value])},Object.defineProperty(t.prototype,"finalValue",{get:function(){return i.Stream.of.apply(i.Stream,o([],n(this.formData),!1)).map((function(t){return t.join("=")})).reduce((function(t,e){return[t,e].join("&")})).orElse("").value},enumerable:!1,configurable:!0}),t}();e.QueryFormStringCollector=m},551:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.LazyStream=e.Stream=void 0;var i=r(152),a=r(255),l=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._limits=-1,this.pos=-1,this.value=t}return t.of=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new(t.bind.apply(t,o([void 0],n(e),!1)))},t.ofAssoc=function(t){return this.of.apply(this,o([],n(Object.keys(t)),!1)).map((function(e){return[e,t[e]]}))},t.ofDataSource=function(e){for(var r=[];e.hasNext();)r.push(e.next());return new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.concat=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.of.apply(t,o([this],n(e),!1)).flatMap((function(t){return t}))},t.prototype.onElem=function(t){for(var e=0;e<this.value.length&&(-1==this._limits||e<this._limits)&&!1!==t(this.value[e],e);e++);return this},t.prototype.each=function(t){this.onElem(t)},t.prototype.map=function(e){e||(e=function(t){return t});var r=[];return this.each((function(t,n){r.push(e(t))})),new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.flatMap=function(e){var r=[];return this.each((function(t){var i=e(t);r=Array.isArray(i)?r.concat(i):r.concat.apply(r,o([],n(i.value),!1))})),t.of.apply(t,o([],n(r),!1))},t.prototype.filter=function(e){var r=[];return this.each((function(t){e(t)&&r.push(t)})),new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.reduce=function(t,e){void 0===e&&(e=null);for(var r=null!=e?0:1,n=null!=e?e:this.value.length?this.value[0]:null,o=r;o<this.value.length&&(-1==this._limits||o<this._limits);o++)n=t(n,this.value[o]);return i.Optional.fromNullable(n)},t.prototype.first=function(){return this.value&&this.value.length?i.Optional.fromNullable(this.value[0]):i.Optional.absent},t.prototype.last=function(){var t=this._limits>0?Math.min(this._limits,this.value.length):this.value.length;return i.Optional.fromNullable(t?this.value[t-1]:null)},t.prototype.anyMatch=function(t){for(var e=0;e<this.value.length&&(-1==this._limits||e<this._limits);e++)if(t(this.value[e]))return!0;return!1},t.prototype.allMatch=function(t){if(!this.value.length)return!1;for(var e=0,r=0;r<this.value.length;r++)t(this.value[r])&&e++;return e==this.value.length},t.prototype.noneMatch=function(t){for(var e=0,r=0;r<this.value.length;r++)t(this.value[r])||e++;return e==this.value.length},t.prototype.sort=function(e){var r=this.value.slice().sort(e);return t.of.apply(t,o([],n(r),!1))},t.prototype.collect=function(t){return this.each((function(e){return t.collect(e)})),t.finalValue},t.prototype.hasNext=function(){var t=-1!=this._limits&&this.pos>=this._limits-1,e=this.pos>=this.value.length-1;return!(t||e)},t.prototype.next=function(){return this.hasNext()?(this.pos++,this.value[this.pos]):null},t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.prototype.reset=function(){this.pos=-1},t}();e.Stream=l;var u=function(){function t(t){this._limits=-1,this.pos=-1,this.dataSource=t}return t.of=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new t(new(a.ArrayStreamDataSource.bind.apply(a.ArrayStreamDataSource,o([void 0],n(e),!1))))},t.ofAssoc=function(t){return this.of.apply(this,o([],n(Object.keys(t)),!1)).map((function(e){return[e,t[e]]}))},t.ofStreamDataSource=function(e){return new t(e)},t.prototype.hasNext=function(){return!this.isOverLimits()&&this.dataSource.hasNext()},t.prototype.next=function(){var t=this.dataSource.next();return this.pos++,t},t.prototype.reset=function(){this.dataSource.reset(),this.pos=0,this._limits=-1},t.prototype.concat=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.of.apply(t,o([this],n(e),!1)).flatMap((function(t){return t}))},t.prototype.nextFilter=function(t){if(this.hasNext()){var e=this.next();return t(e)?e:this.nextFilter(t)}return null},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.collect=function(t){for(;this.hasNext();){var e=this.next();t.collect(e)}return t.finalValue},t.prototype.onElem=function(e){var r=this;return new t(new a.MappedStreamDataSource((function(t){return!1===e(t,r.pos)&&r.stop(),t}),this))},t.prototype.filter=function(e){return new t(new a.FilteredStreamDatasource(e,this))},t.prototype.map=function(e){return new t(new a.MappedStreamDataSource(e,this))},t.prototype.flatMap=function(e){return new t(new a.FlatMapStreamDataSource(e,this))},t.prototype.each=function(t){for(;this.hasNext();)!1===t(this.next())&&this.stop()},t.prototype.reduce=function(t,e){if(void 0===e&&(e=null),!this.hasNext())return i.Optional.absent;var r=null,n=null;if(null!=e)r=e,n=this.next();else{if(r=this.next(),!this.hasNext())return i.Optional.fromNullable(r);n=this.next()}for(r=t(r,n);this.hasNext();)r=t(r,n=this.next());return i.Optional.fromNullable(r)},t.prototype.last=function(){return this.hasNext()?this.reduce((function(t,e){return e})):i.Optional.absent},t.prototype.first=function(){return this.reset(),this.hasNext()?i.Optional.fromNullable(this.next()):i.Optional.absent},t.prototype.anyMatch=function(t){for(;this.hasNext();)if(t(this.next()))return!0;return!1},t.prototype.allMatch=function(t){for(;this.hasNext();)if(!t(this.next()))return!1;return!0},t.prototype.noneMatch=function(t){for(;this.hasNext();)if(t(this.next()))return!1;return!0},t.prototype.sort=function(e){var r=this.collect(new a.ArrayCollector);return r=r.sort(e),t.of.apply(t,o([],n(r),!1))},Object.defineProperty(t.prototype,"value",{get:function(){return this.collect(new a.ArrayCollector)},enumerable:!1,configurable:!0}),t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.prototype.stop=function(){this.pos=this._limits+1e9},t.prototype.isOverLimits=function(){return-1!=this._limits&&this.pos>=this._limits-1},t}();e.LazyStream=u},121:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.XQ=e.XMLQuery=void 0;var i=r(805),a=r(585),l=i.Lang.isString,u=function(t){function e(e,r){void 0===r&&(r="text/xml");var n;return l(e)?t.call(this,null==(n=e)?null:i.Lang.saveResolveLazy((function(){return new window.DOMParser}),(function(){return(t=new ActiveXObject("Microsoft.XMLDOM")).async=!1,{parseFromString:function(e,r){return t.loadXML(e)}};var t})).value.parseFromString(n,r))||this:t.call(this,e)||this}return o(e,t),e.prototype.isXMLParserError=function(){return this.querySelectorAll("parsererror").isPresent()},e.prototype.toString=function(){var t=[];return this.eachElem((function(e){var r,n,o,i=null!==(o=null===(n=null===(r=null===window||void 0===window?void 0:window.XMLSerializer)||void 0===r?void 0:r.constructor())||void 0===n?void 0:n.serializeToString(e))&&void 0!==o?o:null==e?void 0:e.xml;i&&t.push(i)})),t.join("")},e.prototype.parserErrorText=function(t){return this.querySelectorAll("parsererror").textContent(t)},e.parseXML=function(t){return new e(t)},e.parseHTML=function(t){return new e(t,"text/html")},e.fromString=function(t,r){return void 0===r&&(r="text/xml"),new e(t,r)},e}(a.DomQuery);e.XMLQuery=u,e.XQ=u}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}var n={};!function(){var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.QueryFormDataCollector=t.FormDataCollector=t.AssocArrayCollector=t.ArrayCollector=t.QueryFormStringCollector=t.SequenceDataSource=t.FlatMapStreamDataSource=t.FilteredStreamDatasource=t.MappedStreamDataSource=t.ArrayStreamDataSource=t.LazyStream=t.Stream=t.XQ=t.XMLQuery=t.ValueEmbedder=t.Optional=t.Monad=t.Config=t.Lang=t.DQ=t.DomQueryCollector=t.ElementAttribute=t.DomQuery=void 0;var e=r(585);Object.defineProperty(t,"DomQuery",{enumerable:!0,get:function(){return e.DomQuery}}),Object.defineProperty(t,"ElementAttribute",{enumerable:!0,get:function(){return e.ElementAttribute}}),Object.defineProperty(t,"DomQueryCollector",{enumerable:!0,get:function(){return e.DomQueryCollector}}),Object.defineProperty(t,"DQ",{enumerable:!0,get:function(){return e.DQ}});var o=r(805);Object.defineProperty(t,"Lang",{enumerable:!0,get:function(){return o.Lang}});var i=r(152);Object.defineProperty(t,"Config",{enumerable:!0,get:function(){return i.Config}}),Object.defineProperty(t,"Monad",{enumerable:!0,get:function(){return i.Monad}}),Object.defineProperty(t,"Optional",{enumerable:!0,get:function(){return i.Optional}}),Object.defineProperty(t,"ValueEmbedder",{enumerable:!0,get:function(){return i.ValueEmbedder}});var a=r(121);Object.defineProperty(t,"XMLQuery",{enumerable:!0,get:function(){return a.XMLQuery}}),Object.defineProperty(t,"XQ",{enumerable:!0,get:function(){return a.XQ}});var l=r(551);Object.defineProperty(t,"Stream",{enumerable:!0,get:function(){return l.Stream}}),Object.defineProperty(t,"LazyStream",{enumerable:!0,get:function(){return l.LazyStream}});var u=r(255);Object.defineProperty(t,"ArrayStreamDataSource",{enumerable:!0,get:function(){return u.ArrayStreamDataSource}}),Object.defineProperty(t,"MappedStreamDataSource",{enumerable:!0,get:function(){return u.MappedStreamDataSource}}),Object.defineProperty(t,"FilteredStreamDatasource",{enumerable:!0,get:function(){return u.FilteredStreamDatasource}}),Object.defineProperty(t,"FlatMapStreamDataSource",{enumerable:!0,get:function(){return u.FlatMapStreamDataSource}}),Object.defineProperty(t,"SequenceDataSource",{enumerable:!0,get:function(){return u.SequenceDataSource}}),Object.defineProperty(t,"QueryFormStringCollector",{enumerable:!0,get:function(){return u.QueryFormStringCollector}}),Object.defineProperty(t,"ArrayCollector",{enumerable:!0,get:function(){return u.ArrayCollector}}),Object.defineProperty(t,"AssocArrayCollector",{enumerable:!0,get:function(){return u.AssocArrayCollector}}),Object.defineProperty(t,"FormDataCollector",{enumerable:!0,get:function(){return u.FormDataCollector}}),Object.defineProperty(t,"QueryFormDataCollector",{enumerable:!0,get:function(){return u.QueryFormDataCollector}})}();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})}();
|
|
11
|
-
//# sourceMappingURL=index_core.js.map
|
|
12
3513
|
|
|
13
3514
|
/***/ }),
|
|
14
3515
|
|
|
@@ -18,7 +3519,6 @@
|
|
|
18
3519
|
\****************************************/
|
|
19
3520
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
20
3521
|
|
|
21
|
-
"use strict";
|
|
22
3522
|
|
|
23
3523
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
24
3524
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -286,7 +3786,6 @@ var myfaces;
|
|
|
286
3786
|
\**********************************************/
|
|
287
3787
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
288
3788
|
|
|
289
|
-
"use strict";
|
|
290
3789
|
|
|
291
3790
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
292
3791
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -308,7 +3807,7 @@ exports.Implementation = void 0;
|
|
|
308
3807
|
var Response_1 = __webpack_require__(/*! ./xhrCore/Response */ "./src/main/typescript/impl/xhrCore/Response.ts");
|
|
309
3808
|
var XhrRequest_1 = __webpack_require__(/*! ./xhrCore/XhrRequest */ "./src/main/typescript/impl/xhrCore/XhrRequest.ts");
|
|
310
3809
|
var AsyncQueue_1 = __webpack_require__(/*! ./util/AsyncQueue */ "./src/main/typescript/impl/util/AsyncQueue.ts");
|
|
311
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
3810
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
312
3811
|
var Assertions_1 = __webpack_require__(/*! ./util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
313
3812
|
var XhrFormData_1 = __webpack_require__(/*! ./xhrCore/XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
314
3813
|
var ExtDomQuery_1 = __webpack_require__(/*! ./util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
@@ -865,7 +4364,6 @@ var Implementation;
|
|
|
865
4364
|
\**********************************************/
|
|
866
4365
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
867
4366
|
|
|
868
|
-
"use strict";
|
|
869
4367
|
|
|
870
4368
|
/**
|
|
871
4369
|
* Typescript port of the jsf.push part in the myfaces implementation
|
|
@@ -1090,7 +4588,6 @@ var PushImpl;
|
|
|
1090
4588
|
\************************************************/
|
|
1091
4589
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1092
4590
|
|
|
1093
|
-
"use strict";
|
|
1094
4591
|
|
|
1095
4592
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1096
4593
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1235,7 +4732,6 @@ exports.UNKNOWN = "UNKNOWN";
|
|
|
1235
4732
|
\****************************************************/
|
|
1236
4733
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1237
4734
|
|
|
1238
|
-
"use strict";
|
|
1239
4735
|
|
|
1240
4736
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1241
4737
|
exports.StateHolder = void 0;
|
|
@@ -1288,7 +4784,6 @@ exports.StateHolder = StateHolder;
|
|
|
1288
4784
|
\***************************************************/
|
|
1289
4785
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1290
4786
|
|
|
1291
|
-
"use strict";
|
|
1292
4787
|
|
|
1293
4788
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1294
4789
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1412,11 +4907,10 @@ exports.Messages = Messages;
|
|
|
1412
4907
|
\*****************************************************/
|
|
1413
4908
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1414
4909
|
|
|
1415
|
-
"use strict";
|
|
1416
4910
|
|
|
1417
4911
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1418
4912
|
exports.Assertions = void 0;
|
|
1419
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
4913
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1420
4914
|
var Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
1421
4915
|
var getMessage = Lang_1.ExtLang.getMessage;
|
|
1422
4916
|
var makeException = Lang_1.ExtLang.makeException;
|
|
@@ -1512,7 +5006,6 @@ var Assertions;
|
|
|
1512
5006
|
\*****************************************************/
|
|
1513
5007
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1514
5008
|
|
|
1515
|
-
"use strict";
|
|
1516
5009
|
|
|
1517
5010
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1518
5011
|
exports.AsynchronousQueue = void 0;
|
|
@@ -1626,7 +5119,6 @@ exports.AsynchronousQueue = AsynchronousQueue;
|
|
|
1626
5119
|
\******************************************************/
|
|
1627
5120
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1628
5121
|
|
|
1629
|
-
"use strict";
|
|
1630
5122
|
|
|
1631
5123
|
var __extends = (this && this.__extends) || (function () {
|
|
1632
5124
|
var extendStatics = function (d, b) {
|
|
@@ -1645,7 +5137,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
1645
5137
|
})();
|
|
1646
5138
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1647
5139
|
exports.ExtDQ = exports.ExtDomquery = void 0;
|
|
1648
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5140
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1649
5141
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
1650
5142
|
/**
|
|
1651
5143
|
* detects whether a source is a jsf.js request
|
|
@@ -1819,7 +5311,6 @@ exports.ExtDQ = mona_dish_1.DQ;
|
|
|
1819
5311
|
\***********************************************/
|
|
1820
5312
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1821
5313
|
|
|
1822
|
-
"use strict";
|
|
1823
5314
|
|
|
1824
5315
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1825
5316
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1841,7 +5332,7 @@ exports.ExtDQ = mona_dish_1.DQ;
|
|
|
1841
5332
|
*/
|
|
1842
5333
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1843
5334
|
exports.ExtLang = void 0;
|
|
1844
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5335
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1845
5336
|
var Messages_1 = __webpack_require__(/*! ../i18n/Messages */ "./src/main/typescript/impl/i18n/Messages.ts");
|
|
1846
5337
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
1847
5338
|
var RequestDataResolver_1 = __webpack_require__(/*! ../xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
|
|
@@ -2044,7 +5535,6 @@ var ExtLang;
|
|
|
2044
5535
|
\*******************************************************/
|
|
2045
5536
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2046
5537
|
|
|
2047
|
-
"use strict";
|
|
2048
5538
|
|
|
2049
5539
|
var __extends = (this && this.__extends) || (function () {
|
|
2050
5540
|
var extendStatics = function (d, b) {
|
|
@@ -2145,11 +5635,10 @@ exports.ErrorData = ErrorData;
|
|
|
2145
5635
|
\*******************************************************/
|
|
2146
5636
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2147
5637
|
|
|
2148
|
-
"use strict";
|
|
2149
5638
|
|
|
2150
5639
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2151
5640
|
exports.EventData = void 0;
|
|
2152
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5641
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2153
5642
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2154
5643
|
var EventData = /** @class */ (function () {
|
|
2155
5644
|
function EventData() {
|
|
@@ -2185,7 +5674,6 @@ exports.EventData = EventData;
|
|
|
2185
5674
|
\*****************************************************************/
|
|
2186
5675
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2187
5676
|
|
|
2188
|
-
"use strict";
|
|
2189
5677
|
|
|
2190
5678
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2191
5679
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2204,7 +5692,7 @@ exports.EventData = EventData;
|
|
|
2204
5692
|
*/
|
|
2205
5693
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2206
5694
|
exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
|
|
2207
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5695
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2208
5696
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2209
5697
|
var Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
2210
5698
|
var ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
@@ -2338,7 +5826,6 @@ exports.resolveDefaults = resolveDefaults;
|
|
|
2338
5826
|
\*****************************************************************/
|
|
2339
5827
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2340
5828
|
|
|
2341
|
-
"use strict";
|
|
2342
5829
|
|
|
2343
5830
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2344
5831
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2357,9 +5844,9 @@ exports.resolveDefaults = resolveDefaults;
|
|
|
2357
5844
|
*/
|
|
2358
5845
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2359
5846
|
exports.resolveSourceForm = exports.resolveSourceElement = exports.resolveContexts = exports.resolveResponseXML = void 0;
|
|
2360
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5847
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2361
5848
|
var Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
2362
|
-
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5849
|
+
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2363
5850
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2364
5851
|
/**
|
|
2365
5852
|
* Resolver functions for various aspects of the response data
|
|
@@ -2451,7 +5938,6 @@ function resolveSourceElementId(context, internalContext) {
|
|
|
2451
5938
|
\******************************************************/
|
|
2452
5939
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2453
5940
|
|
|
2454
|
-
"use strict";
|
|
2455
5941
|
|
|
2456
5942
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2457
5943
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2470,7 +5956,7 @@ function resolveSourceElementId(context, internalContext) {
|
|
|
2470
5956
|
*/
|
|
2471
5957
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2472
5958
|
exports.Response = void 0;
|
|
2473
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5959
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2474
5960
|
var ResponseProcessor_1 = __webpack_require__(/*! ./ResponseProcessor */ "./src/main/typescript/impl/xhrCore/ResponseProcessor.ts");
|
|
2475
5961
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2476
5962
|
var ResonseDataResolver_1 = __webpack_require__(/*! ./ResonseDataResolver */ "./src/main/typescript/impl/xhrCore/ResonseDataResolver.ts");
|
|
@@ -2628,7 +6114,6 @@ var Response;
|
|
|
2628
6114
|
\***************************************************************/
|
|
2629
6115
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2630
6116
|
|
|
2631
|
-
"use strict";
|
|
2632
6117
|
|
|
2633
6118
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2634
6119
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2656,7 +6141,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2656
6141
|
};
|
|
2657
6142
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2658
6143
|
exports.ResponseProcessor = void 0;
|
|
2659
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6144
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2660
6145
|
var AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
2661
6146
|
var Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
2662
6147
|
var ErrorData_1 = __webpack_require__(/*! ./ErrorData */ "./src/main/typescript/impl/xhrCore/ErrorData.ts");
|
|
@@ -3015,7 +6500,6 @@ exports.ResponseProcessor = ResponseProcessor;
|
|
|
3015
6500
|
\*********************************************************/
|
|
3016
6501
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3017
6502
|
|
|
3018
|
-
"use strict";
|
|
3019
6503
|
|
|
3020
6504
|
var __extends = (this && this.__extends) || (function () {
|
|
3021
6505
|
var extendStatics = function (d, b) {
|
|
@@ -3058,8 +6542,8 @@ exports.XhrFormData = void 0;
|
|
|
3058
6542
|
* See the License for the specific language governing permissions and
|
|
3059
6543
|
* limitations under the License.
|
|
3060
6544
|
*/
|
|
3061
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
3062
|
-
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6545
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6546
|
+
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
3063
6547
|
var isString = mona_dish_1.Lang.isString;
|
|
3064
6548
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
3065
6549
|
/**
|
|
@@ -3298,7 +6782,6 @@ exports.XhrFormData = XhrFormData;
|
|
|
3298
6782
|
\********************************************************/
|
|
3299
6783
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3300
6784
|
|
|
3301
|
-
"use strict";
|
|
3302
6785
|
|
|
3303
6786
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3304
6787
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -3317,7 +6800,7 @@ exports.XhrFormData = XhrFormData;
|
|
|
3317
6800
|
*/
|
|
3318
6801
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3319
6802
|
exports.XhrRequest = void 0;
|
|
3320
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6803
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
3321
6804
|
var AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
3322
6805
|
var XhrFormData_1 = __webpack_require__(/*! ./XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
3323
6806
|
var ErrorData_1 = __webpack_require__(/*! ./ErrorData */ "./src/main/typescript/impl/xhrCore/ErrorData.ts");
|