1 | /**
|
---|
2 | * @license Angular v12.2.13
|
---|
3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
4 | * License: MIT
|
---|
5 | */
|
---|
6 |
|
---|
7 | (function (global, factory) {
|
---|
8 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core')) :
|
---|
9 | typeof define === 'function' && define.amd ? define('@angular/platform-browser', ['exports', '@angular/common', '@angular/core'], factory) :
|
---|
10 | (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowser = {}), global.ng.common, global.ng.core));
|
---|
11 | }(this, (function (exports, common, i0) { 'use strict';
|
---|
12 |
|
---|
13 | /*! *****************************************************************************
|
---|
14 | Copyright (c) Microsoft Corporation.
|
---|
15 |
|
---|
16 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
17 | purpose with or without fee is hereby granted.
|
---|
18 |
|
---|
19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
20 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
21 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
22 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
23 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
24 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
25 | PERFORMANCE OF THIS SOFTWARE.
|
---|
26 | ***************************************************************************** */
|
---|
27 | /* global Reflect, Promise */
|
---|
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)
|
---|
32 | if (Object.prototype.hasOwnProperty.call(b, p))
|
---|
33 | d[p] = b[p]; };
|
---|
34 | return extendStatics(d, b);
|
---|
35 | };
|
---|
36 | function __extends(d, b) {
|
---|
37 | if (typeof b !== "function" && b !== null)
|
---|
38 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
39 | extendStatics(d, b);
|
---|
40 | function __() { this.constructor = d; }
|
---|
41 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
42 | }
|
---|
43 | var __assign = function () {
|
---|
44 | __assign = Object.assign || function __assign(t) {
|
---|
45 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
46 | s = arguments[i];
|
---|
47 | for (var p in s)
|
---|
48 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
49 | t[p] = s[p];
|
---|
50 | }
|
---|
51 | return t;
|
---|
52 | };
|
---|
53 | return __assign.apply(this, arguments);
|
---|
54 | };
|
---|
55 | function __rest(s, e) {
|
---|
56 | var t = {};
|
---|
57 | for (var p in s)
|
---|
58 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
59 | t[p] = s[p];
|
---|
60 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
61 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
62 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
63 | t[p[i]] = s[p[i]];
|
---|
64 | }
|
---|
65 | return t;
|
---|
66 | }
|
---|
67 | function __decorate(decorators, target, key, desc) {
|
---|
68 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
69 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
70 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
71 | else
|
---|
72 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
73 | if (d = decorators[i])
|
---|
74 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
---|
75 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
---|
76 | }
|
---|
77 | function __param(paramIndex, decorator) {
|
---|
78 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
79 | }
|
---|
80 | function __metadata(metadataKey, metadataValue) {
|
---|
81 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
82 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
83 | }
|
---|
84 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
85 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
86 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
87 | function fulfilled(value) { try {
|
---|
88 | step(generator.next(value));
|
---|
89 | }
|
---|
90 | catch (e) {
|
---|
91 | reject(e);
|
---|
92 | } }
|
---|
93 | function rejected(value) { try {
|
---|
94 | step(generator["throw"](value));
|
---|
95 | }
|
---|
96 | catch (e) {
|
---|
97 | reject(e);
|
---|
98 | } }
|
---|
99 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
100 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
101 | });
|
---|
102 | }
|
---|
103 | function __generator(thisArg, body) {
|
---|
104 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
105 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
106 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
107 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
108 | function step(op) {
|
---|
109 | if (f)
|
---|
110 | throw new TypeError("Generator is already executing.");
|
---|
111 | while (_)
|
---|
112 | try {
|
---|
113 | 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)
|
---|
114 | return t;
|
---|
115 | if (y = 0, t)
|
---|
116 | op = [op[0] & 2, t.value];
|
---|
117 | switch (op[0]) {
|
---|
118 | case 0:
|
---|
119 | case 1:
|
---|
120 | t = op;
|
---|
121 | break;
|
---|
122 | case 4:
|
---|
123 | _.label++;
|
---|
124 | return { value: op[1], done: false };
|
---|
125 | case 5:
|
---|
126 | _.label++;
|
---|
127 | y = op[1];
|
---|
128 | op = [0];
|
---|
129 | continue;
|
---|
130 | case 7:
|
---|
131 | op = _.ops.pop();
|
---|
132 | _.trys.pop();
|
---|
133 | continue;
|
---|
134 | default:
|
---|
135 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
136 | _ = 0;
|
---|
137 | continue;
|
---|
138 | }
|
---|
139 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
140 | _.label = op[1];
|
---|
141 | break;
|
---|
142 | }
|
---|
143 | if (op[0] === 6 && _.label < t[1]) {
|
---|
144 | _.label = t[1];
|
---|
145 | t = op;
|
---|
146 | break;
|
---|
147 | }
|
---|
148 | if (t && _.label < t[2]) {
|
---|
149 | _.label = t[2];
|
---|
150 | _.ops.push(op);
|
---|
151 | break;
|
---|
152 | }
|
---|
153 | if (t[2])
|
---|
154 | _.ops.pop();
|
---|
155 | _.trys.pop();
|
---|
156 | continue;
|
---|
157 | }
|
---|
158 | op = body.call(thisArg, _);
|
---|
159 | }
|
---|
160 | catch (e) {
|
---|
161 | op = [6, e];
|
---|
162 | y = 0;
|
---|
163 | }
|
---|
164 | finally {
|
---|
165 | f = t = 0;
|
---|
166 | }
|
---|
167 | if (op[0] & 5)
|
---|
168 | throw op[1];
|
---|
169 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
170 | }
|
---|
171 | }
|
---|
172 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
173 | if (k2 === undefined)
|
---|
174 | k2 = k;
|
---|
175 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
176 | }) : (function (o, m, k, k2) {
|
---|
177 | if (k2 === undefined)
|
---|
178 | k2 = k;
|
---|
179 | o[k2] = m[k];
|
---|
180 | });
|
---|
181 | function __exportStar(m, o) {
|
---|
182 | for (var p in m)
|
---|
183 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
184 | __createBinding(o, m, p);
|
---|
185 | }
|
---|
186 | function __values(o) {
|
---|
187 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
188 | if (m)
|
---|
189 | return m.call(o);
|
---|
190 | if (o && typeof o.length === "number")
|
---|
191 | return {
|
---|
192 | next: function () {
|
---|
193 | if (o && i >= o.length)
|
---|
194 | o = void 0;
|
---|
195 | return { value: o && o[i++], done: !o };
|
---|
196 | }
|
---|
197 | };
|
---|
198 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
199 | }
|
---|
200 | function __read(o, n) {
|
---|
201 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
202 | if (!m)
|
---|
203 | return o;
|
---|
204 | var i = m.call(o), r, ar = [], e;
|
---|
205 | try {
|
---|
206 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
207 | ar.push(r.value);
|
---|
208 | }
|
---|
209 | catch (error) {
|
---|
210 | e = { error: error };
|
---|
211 | }
|
---|
212 | finally {
|
---|
213 | try {
|
---|
214 | if (r && !r.done && (m = i["return"]))
|
---|
215 | m.call(i);
|
---|
216 | }
|
---|
217 | finally {
|
---|
218 | if (e)
|
---|
219 | throw e.error;
|
---|
220 | }
|
---|
221 | }
|
---|
222 | return ar;
|
---|
223 | }
|
---|
224 | /** @deprecated */
|
---|
225 | function __spread() {
|
---|
226 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
227 | ar = ar.concat(__read(arguments[i]));
|
---|
228 | return ar;
|
---|
229 | }
|
---|
230 | /** @deprecated */
|
---|
231 | function __spreadArrays() {
|
---|
232 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
233 | s += arguments[i].length;
|
---|
234 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
235 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
236 | r[k] = a[j];
|
---|
237 | return r;
|
---|
238 | }
|
---|
239 | function __spreadArray(to, from, pack) {
|
---|
240 | if (pack || arguments.length === 2)
|
---|
241 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
242 | if (ar || !(i in from)) {
|
---|
243 | if (!ar)
|
---|
244 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
245 | ar[i] = from[i];
|
---|
246 | }
|
---|
247 | }
|
---|
248 | return to.concat(ar || Array.prototype.slice.call(from));
|
---|
249 | }
|
---|
250 | function __await(v) {
|
---|
251 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
252 | }
|
---|
253 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
254 | if (!Symbol.asyncIterator)
|
---|
255 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
256 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
257 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
258 | function verb(n) { if (g[n])
|
---|
259 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
260 | function resume(n, v) { try {
|
---|
261 | step(g[n](v));
|
---|
262 | }
|
---|
263 | catch (e) {
|
---|
264 | settle(q[0][3], e);
|
---|
265 | } }
|
---|
266 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
267 | function fulfill(value) { resume("next", value); }
|
---|
268 | function reject(value) { resume("throw", value); }
|
---|
269 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
270 | resume(q[0][0], q[0][1]); }
|
---|
271 | }
|
---|
272 | function __asyncDelegator(o) {
|
---|
273 | var i, p;
|
---|
274 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
275 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
---|
276 | }
|
---|
277 | function __asyncValues(o) {
|
---|
278 | if (!Symbol.asyncIterator)
|
---|
279 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
280 | var m = o[Symbol.asyncIterator], i;
|
---|
281 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
---|
282 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
---|
283 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
284 | }
|
---|
285 | function __makeTemplateObject(cooked, raw) {
|
---|
286 | if (Object.defineProperty) {
|
---|
287 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
288 | }
|
---|
289 | else {
|
---|
290 | cooked.raw = raw;
|
---|
291 | }
|
---|
292 | return cooked;
|
---|
293 | }
|
---|
294 | ;
|
---|
295 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
296 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
297 | }) : function (o, v) {
|
---|
298 | o["default"] = v;
|
---|
299 | };
|
---|
300 | function __importStar(mod) {
|
---|
301 | if (mod && mod.__esModule)
|
---|
302 | return mod;
|
---|
303 | var result = {};
|
---|
304 | if (mod != null)
|
---|
305 | for (var k in mod)
|
---|
306 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
307 | __createBinding(result, mod, k);
|
---|
308 | __setModuleDefault(result, mod);
|
---|
309 | return result;
|
---|
310 | }
|
---|
311 | function __importDefault(mod) {
|
---|
312 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
313 | }
|
---|
314 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
315 | if (kind === "a" && !f)
|
---|
316 | throw new TypeError("Private accessor was defined without a getter");
|
---|
317 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
318 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
319 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
320 | }
|
---|
321 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
322 | if (kind === "m")
|
---|
323 | throw new TypeError("Private method is not writable");
|
---|
324 | if (kind === "a" && !f)
|
---|
325 | throw new TypeError("Private accessor was defined without a setter");
|
---|
326 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
327 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
328 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
329 | }
|
---|
330 |
|
---|
331 | /**
|
---|
332 | * Provides DOM operations in any browser environment.
|
---|
333 | *
|
---|
334 | * @security Tread carefully! Interacting with the DOM directly is dangerous and
|
---|
335 | * can introduce XSS risks.
|
---|
336 | */
|
---|
337 | var GenericBrowserDomAdapter = /** @class */ (function (_super) {
|
---|
338 | __extends(GenericBrowserDomAdapter, _super);
|
---|
339 | function GenericBrowserDomAdapter() {
|
---|
340 | var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
---|
341 | _this.supportsDOMEvents = true;
|
---|
342 | return _this;
|
---|
343 | }
|
---|
344 | return GenericBrowserDomAdapter;
|
---|
345 | }(common.ɵDomAdapter));
|
---|
346 |
|
---|
347 | /**
|
---|
348 | * A `DomAdapter` powered by full browser DOM APIs.
|
---|
349 | *
|
---|
350 | * @security Tread carefully! Interacting with the DOM directly is dangerous and
|
---|
351 | * can introduce XSS risks.
|
---|
352 | */
|
---|
353 | /* tslint:disable:requireParameterType no-console */
|
---|
354 | var BrowserDomAdapter = /** @class */ (function (_super) {
|
---|
355 | __extends(BrowserDomAdapter, _super);
|
---|
356 | function BrowserDomAdapter() {
|
---|
357 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
358 | }
|
---|
359 | BrowserDomAdapter.makeCurrent = function () {
|
---|
360 | common.ɵsetRootDomAdapter(new BrowserDomAdapter());
|
---|
361 | };
|
---|
362 | BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
|
---|
363 | el.addEventListener(evt, listener, false);
|
---|
364 | // Needed to follow Dart's subscription semantic, until fix of
|
---|
365 | // https://code.google.com/p/dart/issues/detail?id=17406
|
---|
366 | return function () {
|
---|
367 | el.removeEventListener(evt, listener, false);
|
---|
368 | };
|
---|
369 | };
|
---|
370 | BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) {
|
---|
371 | el.dispatchEvent(evt);
|
---|
372 | };
|
---|
373 | BrowserDomAdapter.prototype.remove = function (node) {
|
---|
374 | if (node.parentNode) {
|
---|
375 | node.parentNode.removeChild(node);
|
---|
376 | }
|
---|
377 | };
|
---|
378 | BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
|
---|
379 | doc = doc || this.getDefaultDocument();
|
---|
380 | return doc.createElement(tagName);
|
---|
381 | };
|
---|
382 | BrowserDomAdapter.prototype.createHtmlDocument = function () {
|
---|
383 | return document.implementation.createHTMLDocument('fakeTitle');
|
---|
384 | };
|
---|
385 | BrowserDomAdapter.prototype.getDefaultDocument = function () {
|
---|
386 | return document;
|
---|
387 | };
|
---|
388 | BrowserDomAdapter.prototype.isElementNode = function (node) {
|
---|
389 | return node.nodeType === Node.ELEMENT_NODE;
|
---|
390 | };
|
---|
391 | BrowserDomAdapter.prototype.isShadowRoot = function (node) {
|
---|
392 | return node instanceof DocumentFragment;
|
---|
393 | };
|
---|
394 | /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
---|
395 | BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) {
|
---|
396 | if (target === 'window') {
|
---|
397 | return window;
|
---|
398 | }
|
---|
399 | if (target === 'document') {
|
---|
400 | return doc;
|
---|
401 | }
|
---|
402 | if (target === 'body') {
|
---|
403 | return doc.body;
|
---|
404 | }
|
---|
405 | return null;
|
---|
406 | };
|
---|
407 | BrowserDomAdapter.prototype.getBaseHref = function (doc) {
|
---|
408 | var href = getBaseElementHref();
|
---|
409 | return href == null ? null : relativePath(href);
|
---|
410 | };
|
---|
411 | BrowserDomAdapter.prototype.resetBaseElement = function () {
|
---|
412 | baseElement = null;
|
---|
413 | };
|
---|
414 | BrowserDomAdapter.prototype.getUserAgent = function () {
|
---|
415 | return window.navigator.userAgent;
|
---|
416 | };
|
---|
417 | BrowserDomAdapter.prototype.getCookie = function (name) {
|
---|
418 | return common.ɵparseCookieValue(document.cookie, name);
|
---|
419 | };
|
---|
420 | return BrowserDomAdapter;
|
---|
421 | }(GenericBrowserDomAdapter));
|
---|
422 | var baseElement = null;
|
---|
423 | function getBaseElementHref() {
|
---|
424 | baseElement = baseElement || document.querySelector('base');
|
---|
425 | return baseElement ? baseElement.getAttribute('href') : null;
|
---|
426 | }
|
---|
427 | // based on urlUtils.js in AngularJS 1
|
---|
428 | var urlParsingNode;
|
---|
429 | function relativePath(url) {
|
---|
430 | urlParsingNode = urlParsingNode || document.createElement('a');
|
---|
431 | urlParsingNode.setAttribute('href', url);
|
---|
432 | var pathName = urlParsingNode.pathname;
|
---|
433 | return pathName.charAt(0) === '/' ? pathName : "/" + pathName;
|
---|
434 | }
|
---|
435 |
|
---|
436 | /**
|
---|
437 | * @license
|
---|
438 | * Copyright Google LLC All Rights Reserved.
|
---|
439 | *
|
---|
440 | * Use of this source code is governed by an MIT-style license that can be
|
---|
441 | * found in the LICENSE file at https://angular.io/license
|
---|
442 | */
|
---|
443 | /**
|
---|
444 | * An id that identifies a particular application being bootstrapped, that should
|
---|
445 | * match across the client/server boundary.
|
---|
446 | */
|
---|
447 | var TRANSITION_ID = new i0.InjectionToken('TRANSITION_ID');
|
---|
448 | function appInitializerFactory(transitionId, document, injector) {
|
---|
449 | return function () {
|
---|
450 | // Wait for all application initializers to be completed before removing the styles set by
|
---|
451 | // the server.
|
---|
452 | injector.get(i0.ApplicationInitStatus).donePromise.then(function () {
|
---|
453 | var dom = common.ɵgetDOM();
|
---|
454 | var styles = document.querySelectorAll("style[ng-transition=\"" + transitionId + "\"]");
|
---|
455 | for (var i = 0; i < styles.length; i++) {
|
---|
456 | dom.remove(styles[i]);
|
---|
457 | }
|
---|
458 | });
|
---|
459 | };
|
---|
460 | }
|
---|
461 | var SERVER_TRANSITION_PROVIDERS = [
|
---|
462 | {
|
---|
463 | provide: i0.APP_INITIALIZER,
|
---|
464 | useFactory: appInitializerFactory,
|
---|
465 | deps: [TRANSITION_ID, common.DOCUMENT, i0.Injector],
|
---|
466 | multi: true
|
---|
467 | },
|
---|
468 | ];
|
---|
469 |
|
---|
470 | /**
|
---|
471 | * @license
|
---|
472 | * Copyright Google LLC All Rights Reserved.
|
---|
473 | *
|
---|
474 | * Use of this source code is governed by an MIT-style license that can be
|
---|
475 | * found in the LICENSE file at https://angular.io/license
|
---|
476 | */
|
---|
477 | var BrowserGetTestability = /** @class */ (function () {
|
---|
478 | function BrowserGetTestability() {
|
---|
479 | }
|
---|
480 | BrowserGetTestability.init = function () {
|
---|
481 | i0.setTestabilityGetter(new BrowserGetTestability());
|
---|
482 | };
|
---|
483 | BrowserGetTestability.prototype.addToWindow = function (registry) {
|
---|
484 | i0.ɵglobal['getAngularTestability'] = function (elem, findInAncestors) {
|
---|
485 | if (findInAncestors === void 0) { findInAncestors = true; }
|
---|
486 | var testability = registry.findTestabilityInTree(elem, findInAncestors);
|
---|
487 | if (testability == null) {
|
---|
488 | throw new Error('Could not find testability for element.');
|
---|
489 | }
|
---|
490 | return testability;
|
---|
491 | };
|
---|
492 | i0.ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
|
---|
493 | i0.ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
|
---|
494 | var whenAllStable = function (callback /** TODO #9100 */) {
|
---|
495 | var testabilities = i0.ɵglobal['getAllAngularTestabilities']();
|
---|
496 | var count = testabilities.length;
|
---|
497 | var didWork = false;
|
---|
498 | var decrement = function (didWork_ /** TODO #9100 */) {
|
---|
499 | didWork = didWork || didWork_;
|
---|
500 | count--;
|
---|
501 | if (count == 0) {
|
---|
502 | callback(didWork);
|
---|
503 | }
|
---|
504 | };
|
---|
505 | testabilities.forEach(function (testability /** TODO #9100 */) {
|
---|
506 | testability.whenStable(decrement);
|
---|
507 | });
|
---|
508 | };
|
---|
509 | if (!i0.ɵglobal['frameworkStabilizers']) {
|
---|
510 | i0.ɵglobal['frameworkStabilizers'] = [];
|
---|
511 | }
|
---|
512 | i0.ɵglobal['frameworkStabilizers'].push(whenAllStable);
|
---|
513 | };
|
---|
514 | BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
|
---|
515 | if (elem == null) {
|
---|
516 | return null;
|
---|
517 | }
|
---|
518 | var t = registry.getTestability(elem);
|
---|
519 | if (t != null) {
|
---|
520 | return t;
|
---|
521 | }
|
---|
522 | else if (!findInAncestors) {
|
---|
523 | return null;
|
---|
524 | }
|
---|
525 | if (common.ɵgetDOM().isShadowRoot(elem)) {
|
---|
526 | return this.findTestabilityInTree(registry, elem.host, true);
|
---|
527 | }
|
---|
528 | return this.findTestabilityInTree(registry, elem.parentElement, true);
|
---|
529 | };
|
---|
530 | return BrowserGetTestability;
|
---|
531 | }());
|
---|
532 |
|
---|
533 | /**
|
---|
534 | * @license
|
---|
535 | * Copyright Google LLC All Rights Reserved.
|
---|
536 | *
|
---|
537 | * Use of this source code is governed by an MIT-style license that can be
|
---|
538 | * found in the LICENSE file at https://angular.io/license
|
---|
539 | */
|
---|
540 | /**
|
---|
541 | * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
|
---|
542 | */
|
---|
543 | var BrowserXhr = /** @class */ (function () {
|
---|
544 | function BrowserXhr() {
|
---|
545 | }
|
---|
546 | BrowserXhr.prototype.build = function () {
|
---|
547 | return new XMLHttpRequest();
|
---|
548 | };
|
---|
549 | return BrowserXhr;
|
---|
550 | }());
|
---|
551 | BrowserXhr.decorators = [
|
---|
552 | { type: i0.Injectable }
|
---|
553 | ];
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * @license
|
---|
557 | * Copyright Google LLC All Rights Reserved.
|
---|
558 | *
|
---|
559 | * Use of this source code is governed by an MIT-style license that can be
|
---|
560 | * found in the LICENSE file at https://angular.io/license
|
---|
561 | */
|
---|
562 | var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
---|
563 | var DASH_CASE_REGEXP = /-([a-z])/g;
|
---|
564 | function camelCaseToDashCase(input) {
|
---|
565 | return input.replace(CAMEL_CASE_REGEXP, function () {
|
---|
566 | var m = [];
|
---|
567 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
568 | m[_i] = arguments[_i];
|
---|
569 | }
|
---|
570 | return '-' + m[1].toLowerCase();
|
---|
571 | });
|
---|
572 | }
|
---|
573 | function dashCaseToCamelCase(input) {
|
---|
574 | return input.replace(DASH_CASE_REGEXP, function () {
|
---|
575 | var m = [];
|
---|
576 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
577 | m[_i] = arguments[_i];
|
---|
578 | }
|
---|
579 | return m[1].toUpperCase();
|
---|
580 | });
|
---|
581 | }
|
---|
582 | /**
|
---|
583 | * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
|
---|
584 | * `name` is `'probe'`.
|
---|
585 | * @param name Name under which it will be exported. Keep in mind this will be a property of the
|
---|
586 | * global `ng` object.
|
---|
587 | * @param value The value to export.
|
---|
588 | */
|
---|
589 | function exportNgVar(name, value) {
|
---|
590 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
---|
591 | // Note: we can't export `ng` when using closure enhanced optimization as:
|
---|
592 | // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
|
---|
593 | // - we can't declare a closure extern as the namespace `ng` is already used within Google
|
---|
594 | // for typings for angularJS (via `goog.provide('ng....')`).
|
---|
595 | var ng = i0.ɵglobal['ng'] = i0.ɵglobal['ng'] || {};
|
---|
596 | ng[name] = value;
|
---|
597 | }
|
---|
598 | }
|
---|
599 |
|
---|
600 | /**
|
---|
601 | * @license
|
---|
602 | * Copyright Google LLC All Rights Reserved.
|
---|
603 | *
|
---|
604 | * Use of this source code is governed by an MIT-style license that can be
|
---|
605 | * found in the LICENSE file at https://angular.io/license
|
---|
606 | */
|
---|
607 | var ɵ0 = function () { return ({
|
---|
608 | 'ApplicationRef': i0.ApplicationRef,
|
---|
609 | 'NgZone': i0.NgZone,
|
---|
610 | }); };
|
---|
611 | var CORE_TOKENS = (ɵ0)();
|
---|
612 | var INSPECT_GLOBAL_NAME = 'probe';
|
---|
613 | var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
|
---|
614 | /**
|
---|
615 | * Returns a {@link DebugElement} for the given native DOM element, or
|
---|
616 | * null if the given native element does not have an Angular view associated
|
---|
617 | * with it.
|
---|
618 | */
|
---|
619 | function inspectNativeElementR2(element) {
|
---|
620 | return i0.ɵgetDebugNodeR2(element);
|
---|
621 | }
|
---|
622 | function _createNgProbeR2(coreTokens) {
|
---|
623 | exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElementR2);
|
---|
624 | exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign(Object.assign({}, CORE_TOKENS), _ngProbeTokensToMap(coreTokens || [])));
|
---|
625 | return function () { return inspectNativeElementR2; };
|
---|
626 | }
|
---|
627 | function _ngProbeTokensToMap(tokens) {
|
---|
628 | return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
|
---|
629 | }
|
---|
630 | /**
|
---|
631 | * In Ivy, we don't support NgProbe because we have our own set of testing utilities
|
---|
632 | * with more robust functionality.
|
---|
633 | *
|
---|
634 | * We shouldn't bring in NgProbe because it prevents DebugNode and friends from
|
---|
635 | * tree-shaking properly.
|
---|
636 | */
|
---|
637 | var ELEMENT_PROBE_PROVIDERS__POST_R3__ = [];
|
---|
638 | /**
|
---|
639 | * Providers which support debugging Angular applications (e.g. via `ng.probe`).
|
---|
640 | */
|
---|
641 | var ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [
|
---|
642 | {
|
---|
643 | provide: i0.APP_INITIALIZER,
|
---|
644 | useFactory: _createNgProbeR2,
|
---|
645 | deps: [
|
---|
646 | [i0.NgProbeToken, new i0.Optional()],
|
---|
647 | ],
|
---|
648 | multi: true,
|
---|
649 | },
|
---|
650 | ];
|
---|
651 | var ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
|
---|
652 |
|
---|
653 | /**
|
---|
654 | * @license
|
---|
655 | * Copyright Google LLC All Rights Reserved.
|
---|
656 | *
|
---|
657 | * Use of this source code is governed by an MIT-style license that can be
|
---|
658 | * found in the LICENSE file at https://angular.io/license
|
---|
659 | */
|
---|
660 | /**
|
---|
661 | * The injection token for the event-manager plug-in service.
|
---|
662 | *
|
---|
663 | * @publicApi
|
---|
664 | */
|
---|
665 | var EVENT_MANAGER_PLUGINS = new i0.InjectionToken('EventManagerPlugins');
|
---|
666 | /**
|
---|
667 | * An injectable service that provides event management for Angular
|
---|
668 | * through a browser plug-in.
|
---|
669 | *
|
---|
670 | * @publicApi
|
---|
671 | */
|
---|
672 | var EventManager = /** @class */ (function () {
|
---|
673 | /**
|
---|
674 | * Initializes an instance of the event-manager service.
|
---|
675 | */
|
---|
676 | function EventManager(plugins, _zone) {
|
---|
677 | var _this = this;
|
---|
678 | this._zone = _zone;
|
---|
679 | this._eventNameToPlugin = new Map();
|
---|
680 | plugins.forEach(function (p) { return p.manager = _this; });
|
---|
681 | this._plugins = plugins.slice().reverse();
|
---|
682 | }
|
---|
683 | /**
|
---|
684 | * Registers a handler for a specific element and event.
|
---|
685 | *
|
---|
686 | * @param element The HTML element to receive event notifications.
|
---|
687 | * @param eventName The name of the event to listen for.
|
---|
688 | * @param handler A function to call when the notification occurs. Receives the
|
---|
689 | * event object as an argument.
|
---|
690 | * @returns A callback function that can be used to remove the handler.
|
---|
691 | */
|
---|
692 | EventManager.prototype.addEventListener = function (element, eventName, handler) {
|
---|
693 | var plugin = this._findPluginFor(eventName);
|
---|
694 | return plugin.addEventListener(element, eventName, handler);
|
---|
695 | };
|
---|
696 | /**
|
---|
697 | * Registers a global handler for an event in a target view.
|
---|
698 | *
|
---|
699 | * @param target A target for global event notifications. One of "window", "document", or "body".
|
---|
700 | * @param eventName The name of the event to listen for.
|
---|
701 | * @param handler A function to call when the notification occurs. Receives the
|
---|
702 | * event object as an argument.
|
---|
703 | * @returns A callback function that can be used to remove the handler.
|
---|
704 | * @deprecated No longer being used in Ivy code. To be removed in version 14.
|
---|
705 | */
|
---|
706 | EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
|
---|
707 | var plugin = this._findPluginFor(eventName);
|
---|
708 | return plugin.addGlobalEventListener(target, eventName, handler);
|
---|
709 | };
|
---|
710 | /**
|
---|
711 | * Retrieves the compilation zone in which event listeners are registered.
|
---|
712 | */
|
---|
713 | EventManager.prototype.getZone = function () {
|
---|
714 | return this._zone;
|
---|
715 | };
|
---|
716 | /** @internal */
|
---|
717 | EventManager.prototype._findPluginFor = function (eventName) {
|
---|
718 | var plugin = this._eventNameToPlugin.get(eventName);
|
---|
719 | if (plugin) {
|
---|
720 | return plugin;
|
---|
721 | }
|
---|
722 | var plugins = this._plugins;
|
---|
723 | for (var i = 0; i < plugins.length; i++) {
|
---|
724 | var plugin_1 = plugins[i];
|
---|
725 | if (plugin_1.supports(eventName)) {
|
---|
726 | this._eventNameToPlugin.set(eventName, plugin_1);
|
---|
727 | return plugin_1;
|
---|
728 | }
|
---|
729 | }
|
---|
730 | throw new Error("No event manager plugin found for event " + eventName);
|
---|
731 | };
|
---|
732 | return EventManager;
|
---|
733 | }());
|
---|
734 | EventManager.decorators = [
|
---|
735 | { type: i0.Injectable }
|
---|
736 | ];
|
---|
737 | EventManager.ctorParameters = function () { return [
|
---|
738 | { type: Array, decorators: [{ type: i0.Inject, args: [EVENT_MANAGER_PLUGINS,] }] },
|
---|
739 | { type: i0.NgZone }
|
---|
740 | ]; };
|
---|
741 | var EventManagerPlugin = /** @class */ (function () {
|
---|
742 | function EventManagerPlugin(_doc) {
|
---|
743 | this._doc = _doc;
|
---|
744 | }
|
---|
745 | EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
|
---|
746 | var target = common.ɵgetDOM().getGlobalEventTarget(this._doc, element);
|
---|
747 | if (!target) {
|
---|
748 | throw new Error("Unsupported event target " + target + " for event " + eventName);
|
---|
749 | }
|
---|
750 | return this.addEventListener(target, eventName, handler);
|
---|
751 | };
|
---|
752 | return EventManagerPlugin;
|
---|
753 | }());
|
---|
754 |
|
---|
755 | var SharedStylesHost = /** @class */ (function () {
|
---|
756 | function SharedStylesHost() {
|
---|
757 | /** @internal */
|
---|
758 | this._stylesSet = new Set();
|
---|
759 | }
|
---|
760 | SharedStylesHost.prototype.addStyles = function (styles) {
|
---|
761 | var _this = this;
|
---|
762 | var additions = new Set();
|
---|
763 | styles.forEach(function (style) {
|
---|
764 | if (!_this._stylesSet.has(style)) {
|
---|
765 | _this._stylesSet.add(style);
|
---|
766 | additions.add(style);
|
---|
767 | }
|
---|
768 | });
|
---|
769 | this.onStylesAdded(additions);
|
---|
770 | };
|
---|
771 | SharedStylesHost.prototype.onStylesAdded = function (additions) { };
|
---|
772 | SharedStylesHost.prototype.getAllStyles = function () {
|
---|
773 | return Array.from(this._stylesSet);
|
---|
774 | };
|
---|
775 | return SharedStylesHost;
|
---|
776 | }());
|
---|
777 | SharedStylesHost.decorators = [
|
---|
778 | { type: i0.Injectable }
|
---|
779 | ];
|
---|
780 | var DomSharedStylesHost = /** @class */ (function (_super) {
|
---|
781 | __extends(DomSharedStylesHost, _super);
|
---|
782 | function DomSharedStylesHost(_doc) {
|
---|
783 | var _this = _super.call(this) || this;
|
---|
784 | _this._doc = _doc;
|
---|
785 | // Maps all registered host nodes to a list of style nodes that have been added to the host node.
|
---|
786 | _this._hostNodes = new Map();
|
---|
787 | _this._hostNodes.set(_doc.head, []);
|
---|
788 | return _this;
|
---|
789 | }
|
---|
790 | DomSharedStylesHost.prototype._addStylesToHost = function (styles, host, styleNodes) {
|
---|
791 | var _this = this;
|
---|
792 | styles.forEach(function (style) {
|
---|
793 | var styleEl = _this._doc.createElement('style');
|
---|
794 | styleEl.textContent = style;
|
---|
795 | styleNodes.push(host.appendChild(styleEl));
|
---|
796 | });
|
---|
797 | };
|
---|
798 | DomSharedStylesHost.prototype.addHost = function (hostNode) {
|
---|
799 | var styleNodes = [];
|
---|
800 | this._addStylesToHost(this._stylesSet, hostNode, styleNodes);
|
---|
801 | this._hostNodes.set(hostNode, styleNodes);
|
---|
802 | };
|
---|
803 | DomSharedStylesHost.prototype.removeHost = function (hostNode) {
|
---|
804 | var styleNodes = this._hostNodes.get(hostNode);
|
---|
805 | if (styleNodes) {
|
---|
806 | styleNodes.forEach(removeStyle);
|
---|
807 | }
|
---|
808 | this._hostNodes.delete(hostNode);
|
---|
809 | };
|
---|
810 | DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
|
---|
811 | var _this = this;
|
---|
812 | this._hostNodes.forEach(function (styleNodes, hostNode) {
|
---|
813 | _this._addStylesToHost(additions, hostNode, styleNodes);
|
---|
814 | });
|
---|
815 | };
|
---|
816 | DomSharedStylesHost.prototype.ngOnDestroy = function () {
|
---|
817 | this._hostNodes.forEach(function (styleNodes) { return styleNodes.forEach(removeStyle); });
|
---|
818 | };
|
---|
819 | return DomSharedStylesHost;
|
---|
820 | }(SharedStylesHost));
|
---|
821 | DomSharedStylesHost.decorators = [
|
---|
822 | { type: i0.Injectable }
|
---|
823 | ];
|
---|
824 | DomSharedStylesHost.ctorParameters = function () { return [
|
---|
825 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
826 | ]; };
|
---|
827 | function removeStyle(styleNode) {
|
---|
828 | common.ɵgetDOM().remove(styleNode);
|
---|
829 | }
|
---|
830 |
|
---|
831 | var NAMESPACE_URIS = {
|
---|
832 | 'svg': 'http://www.w3.org/2000/svg',
|
---|
833 | 'xhtml': 'http://www.w3.org/1999/xhtml',
|
---|
834 | 'xlink': 'http://www.w3.org/1999/xlink',
|
---|
835 | 'xml': 'http://www.w3.org/XML/1998/namespace',
|
---|
836 | 'xmlns': 'http://www.w3.org/2000/xmlns/',
|
---|
837 | };
|
---|
838 | var COMPONENT_REGEX = /%COMP%/g;
|
---|
839 | var NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
---|
840 | var COMPONENT_VARIABLE = '%COMP%';
|
---|
841 | var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
|
---|
842 | var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
|
---|
843 | function shimContentAttribute(componentShortId) {
|
---|
844 | return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
---|
845 | }
|
---|
846 | function shimHostAttribute(componentShortId) {
|
---|
847 | return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
---|
848 | }
|
---|
849 | function flattenStyles(compId, styles, target) {
|
---|
850 | for (var i = 0; i < styles.length; i++) {
|
---|
851 | var style = styles[i];
|
---|
852 | if (Array.isArray(style)) {
|
---|
853 | flattenStyles(compId, style, target);
|
---|
854 | }
|
---|
855 | else {
|
---|
856 | style = style.replace(COMPONENT_REGEX, compId);
|
---|
857 | target.push(style);
|
---|
858 | }
|
---|
859 | }
|
---|
860 | return target;
|
---|
861 | }
|
---|
862 | function decoratePreventDefault(eventHandler) {
|
---|
863 | // `DebugNode.triggerEventHandler` needs to know if the listener was created with
|
---|
864 | // decoratePreventDefault or is a listener added outside the Angular context so it can handle the
|
---|
865 | // two differently. In the first case, the special '__ngUnwrap__' token is passed to the unwrap
|
---|
866 | // the listener (see below).
|
---|
867 | return function (event) {
|
---|
868 | // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
|
---|
869 | // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The debug_node
|
---|
870 | // can inspect the listener toString contents for the existence of this special token. Because
|
---|
871 | // the token is a string literal, it is ensured to not be modified by compiled code.
|
---|
872 | if (event === '__ngUnwrap__') {
|
---|
873 | return eventHandler;
|
---|
874 | }
|
---|
875 | var allowDefaultBehavior = eventHandler(event);
|
---|
876 | if (allowDefaultBehavior === false) {
|
---|
877 | // TODO(tbosch): move preventDefault into event plugins...
|
---|
878 | event.preventDefault();
|
---|
879 | event.returnValue = false;
|
---|
880 | }
|
---|
881 | return undefined;
|
---|
882 | };
|
---|
883 | }
|
---|
884 | var hasLoggedNativeEncapsulationWarning = false;
|
---|
885 | var DomRendererFactory2 = /** @class */ (function () {
|
---|
886 | function DomRendererFactory2(eventManager, sharedStylesHost, appId) {
|
---|
887 | this.eventManager = eventManager;
|
---|
888 | this.sharedStylesHost = sharedStylesHost;
|
---|
889 | this.appId = appId;
|
---|
890 | this.rendererByCompId = new Map();
|
---|
891 | this.defaultRenderer = new DefaultDomRenderer2(eventManager);
|
---|
892 | }
|
---|
893 | DomRendererFactory2.prototype.createRenderer = function (element, type) {
|
---|
894 | if (!element || !type) {
|
---|
895 | return this.defaultRenderer;
|
---|
896 | }
|
---|
897 | switch (type.encapsulation) {
|
---|
898 | case i0.ViewEncapsulation.Emulated: {
|
---|
899 | var renderer = this.rendererByCompId.get(type.id);
|
---|
900 | if (!renderer) {
|
---|
901 | renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
|
---|
902 | this.rendererByCompId.set(type.id, renderer);
|
---|
903 | }
|
---|
904 | renderer.applyToHost(element);
|
---|
905 | return renderer;
|
---|
906 | }
|
---|
907 | // @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an enum
|
---|
908 | // value that is not known (but previously was the value for ViewEncapsulation.Native)
|
---|
909 | case 1:
|
---|
910 | case i0.ViewEncapsulation.ShadowDom:
|
---|
911 | // TODO(FW-2290): remove the `case 1:` fallback logic and the warning in v12.
|
---|
912 | if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
---|
913 | // @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an
|
---|
914 | // enum value that is not known (but previously was the value for
|
---|
915 | // ViewEncapsulation.Native)
|
---|
916 | !hasLoggedNativeEncapsulationWarning && type.encapsulation === 1) {
|
---|
917 | hasLoggedNativeEncapsulationWarning = true;
|
---|
918 | console.warn('ViewEncapsulation.Native is no longer supported. Falling back to ViewEncapsulation.ShadowDom. The fallback will be removed in v12.');
|
---|
919 | }
|
---|
920 | return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
|
---|
921 | default: {
|
---|
922 | if (!this.rendererByCompId.has(type.id)) {
|
---|
923 | var styles = flattenStyles(type.id, type.styles, []);
|
---|
924 | this.sharedStylesHost.addStyles(styles);
|
---|
925 | this.rendererByCompId.set(type.id, this.defaultRenderer);
|
---|
926 | }
|
---|
927 | return this.defaultRenderer;
|
---|
928 | }
|
---|
929 | }
|
---|
930 | };
|
---|
931 | DomRendererFactory2.prototype.begin = function () { };
|
---|
932 | DomRendererFactory2.prototype.end = function () { };
|
---|
933 | return DomRendererFactory2;
|
---|
934 | }());
|
---|
935 | DomRendererFactory2.decorators = [
|
---|
936 | { type: i0.Injectable }
|
---|
937 | ];
|
---|
938 | DomRendererFactory2.ctorParameters = function () { return [
|
---|
939 | { type: EventManager },
|
---|
940 | { type: DomSharedStylesHost },
|
---|
941 | { type: String, decorators: [{ type: i0.Inject, args: [i0.APP_ID,] }] }
|
---|
942 | ]; };
|
---|
943 | var DefaultDomRenderer2 = /** @class */ (function () {
|
---|
944 | function DefaultDomRenderer2(eventManager) {
|
---|
945 | this.eventManager = eventManager;
|
---|
946 | this.data = Object.create(null);
|
---|
947 | }
|
---|
948 | DefaultDomRenderer2.prototype.destroy = function () { };
|
---|
949 | DefaultDomRenderer2.prototype.createElement = function (name, namespace) {
|
---|
950 | if (namespace) {
|
---|
951 | // In cases where Ivy (not ViewEngine) is giving us the actual namespace, the look up by key
|
---|
952 | // will result in undefined, so we just return the namespace here.
|
---|
953 | return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
---|
954 | }
|
---|
955 | return document.createElement(name);
|
---|
956 | };
|
---|
957 | DefaultDomRenderer2.prototype.createComment = function (value) {
|
---|
958 | return document.createComment(value);
|
---|
959 | };
|
---|
960 | DefaultDomRenderer2.prototype.createText = function (value) {
|
---|
961 | return document.createTextNode(value);
|
---|
962 | };
|
---|
963 | DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) {
|
---|
964 | parent.appendChild(newChild);
|
---|
965 | };
|
---|
966 | DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
---|
967 | if (parent) {
|
---|
968 | parent.insertBefore(newChild, refChild);
|
---|
969 | }
|
---|
970 | };
|
---|
971 | DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) {
|
---|
972 | if (parent) {
|
---|
973 | parent.removeChild(oldChild);
|
---|
974 | }
|
---|
975 | };
|
---|
976 | DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
|
---|
977 | var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
|
---|
978 | selectorOrNode;
|
---|
979 | if (!el) {
|
---|
980 | throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
|
---|
981 | }
|
---|
982 | if (!preserveContent) {
|
---|
983 | el.textContent = '';
|
---|
984 | }
|
---|
985 | return el;
|
---|
986 | };
|
---|
987 | DefaultDomRenderer2.prototype.parentNode = function (node) {
|
---|
988 | return node.parentNode;
|
---|
989 | };
|
---|
990 | DefaultDomRenderer2.prototype.nextSibling = function (node) {
|
---|
991 | return node.nextSibling;
|
---|
992 | };
|
---|
993 | DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
---|
994 | if (namespace) {
|
---|
995 | name = namespace + ':' + name;
|
---|
996 | // TODO(FW-811): Ivy may cause issues here because it's passing around
|
---|
997 | // full URIs for namespaces, therefore this lookup will fail.
|
---|
998 | var namespaceUri = NAMESPACE_URIS[namespace];
|
---|
999 | if (namespaceUri) {
|
---|
1000 | el.setAttributeNS(namespaceUri, name, value);
|
---|
1001 | }
|
---|
1002 | else {
|
---|
1003 | el.setAttribute(name, value);
|
---|
1004 | }
|
---|
1005 | }
|
---|
1006 | else {
|
---|
1007 | el.setAttribute(name, value);
|
---|
1008 | }
|
---|
1009 | };
|
---|
1010 | DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
---|
1011 | if (namespace) {
|
---|
1012 | // TODO(FW-811): Ivy may cause issues here because it's passing around
|
---|
1013 | // full URIs for namespaces, therefore this lookup will fail.
|
---|
1014 | var namespaceUri = NAMESPACE_URIS[namespace];
|
---|
1015 | if (namespaceUri) {
|
---|
1016 | el.removeAttributeNS(namespaceUri, name);
|
---|
1017 | }
|
---|
1018 | else {
|
---|
1019 | // TODO(FW-811): Since ivy is passing around full URIs for namespaces
|
---|
1020 | // this could result in properties like `http://www.w3.org/2000/svg:cx="123"`,
|
---|
1021 | // which is wrong.
|
---|
1022 | el.removeAttribute(namespace + ":" + name);
|
---|
1023 | }
|
---|
1024 | }
|
---|
1025 | else {
|
---|
1026 | el.removeAttribute(name);
|
---|
1027 | }
|
---|
1028 | };
|
---|
1029 | DefaultDomRenderer2.prototype.addClass = function (el, name) {
|
---|
1030 | el.classList.add(name);
|
---|
1031 | };
|
---|
1032 | DefaultDomRenderer2.prototype.removeClass = function (el, name) {
|
---|
1033 | el.classList.remove(name);
|
---|
1034 | };
|
---|
1035 | DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
---|
1036 | if (flags & (i0.RendererStyleFlags2.DashCase | i0.RendererStyleFlags2.Important)) {
|
---|
1037 | el.style.setProperty(style, value, flags & i0.RendererStyleFlags2.Important ? 'important' : '');
|
---|
1038 | }
|
---|
1039 | else {
|
---|
1040 | el.style[style] = value;
|
---|
1041 | }
|
---|
1042 | };
|
---|
1043 | DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) {
|
---|
1044 | if (flags & i0.RendererStyleFlags2.DashCase) {
|
---|
1045 | el.style.removeProperty(style);
|
---|
1046 | }
|
---|
1047 | else {
|
---|
1048 | // IE requires '' instead of null
|
---|
1049 | // see https://github.com/angular/angular/issues/7916
|
---|
1050 | el.style[style] = '';
|
---|
1051 | }
|
---|
1052 | };
|
---|
1053 | DefaultDomRenderer2.prototype.setProperty = function (el, name, value) {
|
---|
1054 | NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
|
---|
1055 | el[name] = value;
|
---|
1056 | };
|
---|
1057 | DefaultDomRenderer2.prototype.setValue = function (node, value) {
|
---|
1058 | node.nodeValue = value;
|
---|
1059 | };
|
---|
1060 | DefaultDomRenderer2.prototype.listen = function (target, event, callback) {
|
---|
1061 | NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
|
---|
1062 | if (typeof target === 'string') {
|
---|
1063 | return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
|
---|
1064 | }
|
---|
1065 | return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
|
---|
1066 | };
|
---|
1067 | return DefaultDomRenderer2;
|
---|
1068 | }());
|
---|
1069 | var ɵ0$1 = function () { return '@'.charCodeAt(0); };
|
---|
1070 | var AT_CHARCODE = (ɵ0$1)();
|
---|
1071 | function checkNoSyntheticProp(name, nameKind) {
|
---|
1072 | if (name.charCodeAt(0) === AT_CHARCODE) {
|
---|
1073 | throw new Error("Unexpected synthetic " + nameKind + " " + name + " found. Please make sure that:\n - Either `BrowserAnimationsModule` or `NoopAnimationsModule` are imported in your application.\n - There is corresponding configuration for the animation named `" + name + "` defined in the `animations` field of the `@Component` decorator (see https://angular.io/api/core/Component#animations).");
|
---|
1074 | }
|
---|
1075 | }
|
---|
1076 | var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
|
---|
1077 | __extends(EmulatedEncapsulationDomRenderer2, _super);
|
---|
1078 | function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component, appId) {
|
---|
1079 | var _this = _super.call(this, eventManager) || this;
|
---|
1080 | _this.component = component;
|
---|
1081 | var styles = flattenStyles(appId + '-' + component.id, component.styles, []);
|
---|
1082 | sharedStylesHost.addStyles(styles);
|
---|
1083 | _this.contentAttr = shimContentAttribute(appId + '-' + component.id);
|
---|
1084 | _this.hostAttr = shimHostAttribute(appId + '-' + component.id);
|
---|
1085 | return _this;
|
---|
1086 | }
|
---|
1087 | EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) {
|
---|
1088 | _super.prototype.setAttribute.call(this, element, this.hostAttr, '');
|
---|
1089 | };
|
---|
1090 | EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) {
|
---|
1091 | var el = _super.prototype.createElement.call(this, parent, name);
|
---|
1092 | _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
|
---|
1093 | return el;
|
---|
1094 | };
|
---|
1095 | return EmulatedEncapsulationDomRenderer2;
|
---|
1096 | }(DefaultDomRenderer2));
|
---|
1097 | var ShadowDomRenderer = /** @class */ (function (_super) {
|
---|
1098 | __extends(ShadowDomRenderer, _super);
|
---|
1099 | function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
|
---|
1100 | var _this = _super.call(this, eventManager) || this;
|
---|
1101 | _this.sharedStylesHost = sharedStylesHost;
|
---|
1102 | _this.hostEl = hostEl;
|
---|
1103 | _this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
|
---|
1104 | _this.sharedStylesHost.addHost(_this.shadowRoot);
|
---|
1105 | var styles = flattenStyles(component.id, component.styles, []);
|
---|
1106 | for (var i = 0; i < styles.length; i++) {
|
---|
1107 | var styleEl = document.createElement('style');
|
---|
1108 | styleEl.textContent = styles[i];
|
---|
1109 | _this.shadowRoot.appendChild(styleEl);
|
---|
1110 | }
|
---|
1111 | return _this;
|
---|
1112 | }
|
---|
1113 | ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) {
|
---|
1114 | return node === this.hostEl ? this.shadowRoot : node;
|
---|
1115 | };
|
---|
1116 | ShadowDomRenderer.prototype.destroy = function () {
|
---|
1117 | this.sharedStylesHost.removeHost(this.shadowRoot);
|
---|
1118 | };
|
---|
1119 | ShadowDomRenderer.prototype.appendChild = function (parent, newChild) {
|
---|
1120 | return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
|
---|
1121 | };
|
---|
1122 | ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
|
---|
1123 | return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
|
---|
1124 | };
|
---|
1125 | ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) {
|
---|
1126 | return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
|
---|
1127 | };
|
---|
1128 | ShadowDomRenderer.prototype.parentNode = function (node) {
|
---|
1129 | return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
|
---|
1130 | };
|
---|
1131 | return ShadowDomRenderer;
|
---|
1132 | }(DefaultDomRenderer2));
|
---|
1133 |
|
---|
1134 | var DomEventsPlugin = /** @class */ (function (_super) {
|
---|
1135 | __extends(DomEventsPlugin, _super);
|
---|
1136 | function DomEventsPlugin(doc) {
|
---|
1137 | return _super.call(this, doc) || this;
|
---|
1138 | }
|
---|
1139 | // This plugin should come last in the list of plugins, because it accepts all
|
---|
1140 | // events.
|
---|
1141 | DomEventsPlugin.prototype.supports = function (eventName) {
|
---|
1142 | return true;
|
---|
1143 | };
|
---|
1144 | DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
---|
1145 | var _this = this;
|
---|
1146 | element.addEventListener(eventName, handler, false);
|
---|
1147 | return function () { return _this.removeEventListener(element, eventName, handler); };
|
---|
1148 | };
|
---|
1149 | DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) {
|
---|
1150 | return target.removeEventListener(eventName, callback);
|
---|
1151 | };
|
---|
1152 | return DomEventsPlugin;
|
---|
1153 | }(EventManagerPlugin));
|
---|
1154 | DomEventsPlugin.decorators = [
|
---|
1155 | { type: i0.Injectable }
|
---|
1156 | ];
|
---|
1157 | DomEventsPlugin.ctorParameters = function () { return [
|
---|
1158 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
1159 | ]; };
|
---|
1160 |
|
---|
1161 | /**
|
---|
1162 | * Supported HammerJS recognizer event names.
|
---|
1163 | */
|
---|
1164 | var EVENT_NAMES = {
|
---|
1165 | // pan
|
---|
1166 | 'pan': true,
|
---|
1167 | 'panstart': true,
|
---|
1168 | 'panmove': true,
|
---|
1169 | 'panend': true,
|
---|
1170 | 'pancancel': true,
|
---|
1171 | 'panleft': true,
|
---|
1172 | 'panright': true,
|
---|
1173 | 'panup': true,
|
---|
1174 | 'pandown': true,
|
---|
1175 | // pinch
|
---|
1176 | 'pinch': true,
|
---|
1177 | 'pinchstart': true,
|
---|
1178 | 'pinchmove': true,
|
---|
1179 | 'pinchend': true,
|
---|
1180 | 'pinchcancel': true,
|
---|
1181 | 'pinchin': true,
|
---|
1182 | 'pinchout': true,
|
---|
1183 | // press
|
---|
1184 | 'press': true,
|
---|
1185 | 'pressup': true,
|
---|
1186 | // rotate
|
---|
1187 | 'rotate': true,
|
---|
1188 | 'rotatestart': true,
|
---|
1189 | 'rotatemove': true,
|
---|
1190 | 'rotateend': true,
|
---|
1191 | 'rotatecancel': true,
|
---|
1192 | // swipe
|
---|
1193 | 'swipe': true,
|
---|
1194 | 'swipeleft': true,
|
---|
1195 | 'swiperight': true,
|
---|
1196 | 'swipeup': true,
|
---|
1197 | 'swipedown': true,
|
---|
1198 | // tap
|
---|
1199 | 'tap': true,
|
---|
1200 | 'doubletap': true
|
---|
1201 | };
|
---|
1202 | /**
|
---|
1203 | * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.
|
---|
1204 | * @see `HammerGestureConfig`
|
---|
1205 | *
|
---|
1206 | * @ngModule HammerModule
|
---|
1207 | * @publicApi
|
---|
1208 | */
|
---|
1209 | var HAMMER_GESTURE_CONFIG = new i0.InjectionToken('HammerGestureConfig');
|
---|
1210 | /**
|
---|
1211 | * Injection token used to provide a {@link HammerLoader} to Angular.
|
---|
1212 | *
|
---|
1213 | * @publicApi
|
---|
1214 | */
|
---|
1215 | var HAMMER_LOADER = new i0.InjectionToken('HammerLoader');
|
---|
1216 | /**
|
---|
1217 | * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
|
---|
1218 | * for gesture recognition. Configures specific event recognition.
|
---|
1219 | * @publicApi
|
---|
1220 | */
|
---|
1221 | var HammerGestureConfig = /** @class */ (function () {
|
---|
1222 | function HammerGestureConfig() {
|
---|
1223 | /**
|
---|
1224 | * A set of supported event names for gestures to be used in Angular.
|
---|
1225 | * Angular supports all built-in recognizers, as listed in
|
---|
1226 | * [HammerJS documentation](https://hammerjs.github.io/).
|
---|
1227 | */
|
---|
1228 | this.events = [];
|
---|
1229 | /**
|
---|
1230 | * Maps gesture event names to a set of configuration options
|
---|
1231 | * that specify overrides to the default values for specific properties.
|
---|
1232 | *
|
---|
1233 | * The key is a supported event name to be configured,
|
---|
1234 | * and the options object contains a set of properties, with override values
|
---|
1235 | * to be applied to the named recognizer event.
|
---|
1236 | * For example, to disable recognition of the rotate event, specify
|
---|
1237 | * `{"rotate": {"enable": false}}`.
|
---|
1238 | *
|
---|
1239 | * Properties that are not present take the HammerJS default values.
|
---|
1240 | * For information about which properties are supported for which events,
|
---|
1241 | * and their allowed and default values, see
|
---|
1242 | * [HammerJS documentation](https://hammerjs.github.io/).
|
---|
1243 | *
|
---|
1244 | */
|
---|
1245 | this.overrides = {};
|
---|
1246 | }
|
---|
1247 | /**
|
---|
1248 | * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
|
---|
1249 | * and attaches it to a given HTML element.
|
---|
1250 | * @param element The element that will recognize gestures.
|
---|
1251 | * @returns A HammerJS event-manager object.
|
---|
1252 | */
|
---|
1253 | HammerGestureConfig.prototype.buildHammer = function (element) {
|
---|
1254 | var mc = new Hammer(element, this.options);
|
---|
1255 | mc.get('pinch').set({ enable: true });
|
---|
1256 | mc.get('rotate').set({ enable: true });
|
---|
1257 | for (var eventName in this.overrides) {
|
---|
1258 | mc.get(eventName).set(this.overrides[eventName]);
|
---|
1259 | }
|
---|
1260 | return mc;
|
---|
1261 | };
|
---|
1262 | return HammerGestureConfig;
|
---|
1263 | }());
|
---|
1264 | HammerGestureConfig.decorators = [
|
---|
1265 | { type: i0.Injectable }
|
---|
1266 | ];
|
---|
1267 | /**
|
---|
1268 | * Event plugin that adds Hammer support to an application.
|
---|
1269 | *
|
---|
1270 | * @ngModule HammerModule
|
---|
1271 | */
|
---|
1272 | var HammerGesturesPlugin = /** @class */ (function (_super) {
|
---|
1273 | __extends(HammerGesturesPlugin, _super);
|
---|
1274 | function HammerGesturesPlugin(doc, _config, console, loader) {
|
---|
1275 | var _this = _super.call(this, doc) || this;
|
---|
1276 | _this._config = _config;
|
---|
1277 | _this.console = console;
|
---|
1278 | _this.loader = loader;
|
---|
1279 | _this._loaderPromise = null;
|
---|
1280 | return _this;
|
---|
1281 | }
|
---|
1282 | HammerGesturesPlugin.prototype.supports = function (eventName) {
|
---|
1283 | if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
|
---|
1284 | return false;
|
---|
1285 | }
|
---|
1286 | if (!window.Hammer && !this.loader) {
|
---|
1287 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
1288 | this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " +
|
---|
1289 | "loaded and no custom loader has been specified.");
|
---|
1290 | }
|
---|
1291 | return false;
|
---|
1292 | }
|
---|
1293 | return true;
|
---|
1294 | };
|
---|
1295 | HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
---|
1296 | var _this = this;
|
---|
1297 | var zone = this.manager.getZone();
|
---|
1298 | eventName = eventName.toLowerCase();
|
---|
1299 | // If Hammer is not present but a loader is specified, we defer adding the event listener
|
---|
1300 | // until Hammer is loaded.
|
---|
1301 | if (!window.Hammer && this.loader) {
|
---|
1302 | this._loaderPromise = this._loaderPromise || this.loader();
|
---|
1303 | // This `addEventListener` method returns a function to remove the added listener.
|
---|
1304 | // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
|
---|
1305 | // than remove anything.
|
---|
1306 | var cancelRegistration_1 = false;
|
---|
1307 | var deregister_1 = function () {
|
---|
1308 | cancelRegistration_1 = true;
|
---|
1309 | };
|
---|
1310 | this._loaderPromise
|
---|
1311 | .then(function () {
|
---|
1312 | // If Hammer isn't actually loaded when the custom loader resolves, give up.
|
---|
1313 | if (!window.Hammer) {
|
---|
1314 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
1315 | _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present.");
|
---|
1316 | }
|
---|
1317 | deregister_1 = function () { };
|
---|
1318 | return;
|
---|
1319 | }
|
---|
1320 | if (!cancelRegistration_1) {
|
---|
1321 | // Now that Hammer is loaded and the listener is being loaded for real,
|
---|
1322 | // the deregistration function changes from canceling registration to removal.
|
---|
1323 | deregister_1 = _this.addEventListener(element, eventName, handler);
|
---|
1324 | }
|
---|
1325 | })
|
---|
1326 | .catch(function () {
|
---|
1327 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
1328 | _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " +
|
---|
1329 | "Hammer.JS loader failed.");
|
---|
1330 | }
|
---|
1331 | deregister_1 = function () { };
|
---|
1332 | });
|
---|
1333 | // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
|
---|
1334 | // can change the behavior of `deregister` once the listener is added. Using a closure in
|
---|
1335 | // this way allows us to avoid any additional data structures to track listener removal.
|
---|
1336 | return function () {
|
---|
1337 | deregister_1();
|
---|
1338 | };
|
---|
1339 | }
|
---|
1340 | return zone.runOutsideAngular(function () {
|
---|
1341 | // Creating the manager bind events, must be done outside of angular
|
---|
1342 | var mc = _this._config.buildHammer(element);
|
---|
1343 | var callback = function (eventObj) {
|
---|
1344 | zone.runGuarded(function () {
|
---|
1345 | handler(eventObj);
|
---|
1346 | });
|
---|
1347 | };
|
---|
1348 | mc.on(eventName, callback);
|
---|
1349 | return function () {
|
---|
1350 | mc.off(eventName, callback);
|
---|
1351 | // destroy mc to prevent memory leak
|
---|
1352 | if (typeof mc.destroy === 'function') {
|
---|
1353 | mc.destroy();
|
---|
1354 | }
|
---|
1355 | };
|
---|
1356 | });
|
---|
1357 | };
|
---|
1358 | HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) {
|
---|
1359 | return this._config.events.indexOf(eventName) > -1;
|
---|
1360 | };
|
---|
1361 | return HammerGesturesPlugin;
|
---|
1362 | }(EventManagerPlugin));
|
---|
1363 | HammerGesturesPlugin.decorators = [
|
---|
1364 | { type: i0.Injectable }
|
---|
1365 | ];
|
---|
1366 | HammerGesturesPlugin.ctorParameters = function () { return [
|
---|
1367 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
|
---|
1368 | { type: HammerGestureConfig, decorators: [{ type: i0.Inject, args: [HAMMER_GESTURE_CONFIG,] }] },
|
---|
1369 | { type: i0.ɵConsole },
|
---|
1370 | { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [HAMMER_LOADER,] }] }
|
---|
1371 | ]; };
|
---|
1372 | /**
|
---|
1373 | * In Ivy, support for Hammer gestures is optional, so applications must
|
---|
1374 | * import the `HammerModule` at root to turn on support. This means that
|
---|
1375 | * Hammer-specific code can be tree-shaken away if not needed.
|
---|
1376 | */
|
---|
1377 | var HAMMER_PROVIDERS__POST_R3__ = [];
|
---|
1378 | /**
|
---|
1379 | * In View Engine, support for Hammer gestures is built-in by default.
|
---|
1380 | */
|
---|
1381 | var HAMMER_PROVIDERS__PRE_R3__ = [
|
---|
1382 | {
|
---|
1383 | provide: EVENT_MANAGER_PLUGINS,
|
---|
1384 | useClass: HammerGesturesPlugin,
|
---|
1385 | multi: true,
|
---|
1386 | deps: [common.DOCUMENT, HAMMER_GESTURE_CONFIG, i0.ɵConsole, [new i0.Optional(), HAMMER_LOADER]]
|
---|
1387 | },
|
---|
1388 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
---|
1389 | ];
|
---|
1390 | var HAMMER_PROVIDERS = HAMMER_PROVIDERS__PRE_R3__;
|
---|
1391 | /**
|
---|
1392 | * Adds support for HammerJS.
|
---|
1393 | *
|
---|
1394 | * Import this module at the root of your application so that Angular can work with
|
---|
1395 | * HammerJS to detect gesture events.
|
---|
1396 | *
|
---|
1397 | * Note that applications still need to include the HammerJS script itself. This module
|
---|
1398 | * simply sets up the coordination layer between HammerJS and Angular's EventManager.
|
---|
1399 | *
|
---|
1400 | * @publicApi
|
---|
1401 | */
|
---|
1402 | var HammerModule = /** @class */ (function () {
|
---|
1403 | function HammerModule() {
|
---|
1404 | }
|
---|
1405 | return HammerModule;
|
---|
1406 | }());
|
---|
1407 | HammerModule.decorators = [
|
---|
1408 | { type: i0.NgModule, args: [{ providers: HAMMER_PROVIDERS__PRE_R3__ },] }
|
---|
1409 | ];
|
---|
1410 |
|
---|
1411 | /**
|
---|
1412 | * Defines supported modifiers for key events.
|
---|
1413 | */
|
---|
1414 | var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
---|
1415 | var DOM_KEY_LOCATION_NUMPAD = 3;
|
---|
1416 | // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
|
---|
1417 | var _keyMap = {
|
---|
1418 | // The following values are here for cross-browser compatibility and to match the W3C standard
|
---|
1419 | // cf https://www.w3.org/TR/DOM-Level-3-Events-key/
|
---|
1420 | '\b': 'Backspace',
|
---|
1421 | '\t': 'Tab',
|
---|
1422 | '\x7F': 'Delete',
|
---|
1423 | '\x1B': 'Escape',
|
---|
1424 | 'Del': 'Delete',
|
---|
1425 | 'Esc': 'Escape',
|
---|
1426 | 'Left': 'ArrowLeft',
|
---|
1427 | 'Right': 'ArrowRight',
|
---|
1428 | 'Up': 'ArrowUp',
|
---|
1429 | 'Down': 'ArrowDown',
|
---|
1430 | 'Menu': 'ContextMenu',
|
---|
1431 | 'Scroll': 'ScrollLock',
|
---|
1432 | 'Win': 'OS'
|
---|
1433 | };
|
---|
1434 | // There is a bug in Chrome for numeric keypad keys:
|
---|
1435 | // https://code.google.com/p/chromium/issues/detail?id=155654
|
---|
1436 | // 1, 2, 3 ... are reported as A, B, C ...
|
---|
1437 | var _chromeNumKeyPadMap = {
|
---|
1438 | 'A': '1',
|
---|
1439 | 'B': '2',
|
---|
1440 | 'C': '3',
|
---|
1441 | 'D': '4',
|
---|
1442 | 'E': '5',
|
---|
1443 | 'F': '6',
|
---|
1444 | 'G': '7',
|
---|
1445 | 'H': '8',
|
---|
1446 | 'I': '9',
|
---|
1447 | 'J': '*',
|
---|
1448 | 'K': '+',
|
---|
1449 | 'M': '-',
|
---|
1450 | 'N': '.',
|
---|
1451 | 'O': '/',
|
---|
1452 | '\x60': '0',
|
---|
1453 | '\x90': 'NumLock'
|
---|
1454 | };
|
---|
1455 | var ɵ0$2 = function (event) { return event.altKey; }, ɵ1 = function (event) { return event.ctrlKey; }, ɵ2 = function (event) { return event.metaKey; }, ɵ3 = function (event) { return event.shiftKey; };
|
---|
1456 | /**
|
---|
1457 | * Retrieves modifiers from key-event objects.
|
---|
1458 | */
|
---|
1459 | var MODIFIER_KEY_GETTERS = {
|
---|
1460 | 'alt': ɵ0$2,
|
---|
1461 | 'control': ɵ1,
|
---|
1462 | 'meta': ɵ2,
|
---|
1463 | 'shift': ɵ3
|
---|
1464 | };
|
---|
1465 | /**
|
---|
1466 | * @publicApi
|
---|
1467 | * A browser plug-in that provides support for handling of key events in Angular.
|
---|
1468 | */
|
---|
1469 | var KeyEventsPlugin = /** @class */ (function (_super) {
|
---|
1470 | __extends(KeyEventsPlugin, _super);
|
---|
1471 | /**
|
---|
1472 | * Initializes an instance of the browser plug-in.
|
---|
1473 | * @param doc The document in which key events will be detected.
|
---|
1474 | */
|
---|
1475 | function KeyEventsPlugin(doc) {
|
---|
1476 | return _super.call(this, doc) || this;
|
---|
1477 | }
|
---|
1478 | /**
|
---|
1479 | * Reports whether a named key event is supported.
|
---|
1480 | * @param eventName The event name to query.
|
---|
1481 | * @return True if the named key event is supported.
|
---|
1482 | */
|
---|
1483 | KeyEventsPlugin.prototype.supports = function (eventName) {
|
---|
1484 | return KeyEventsPlugin.parseEventName(eventName) != null;
|
---|
1485 | };
|
---|
1486 | /**
|
---|
1487 | * Registers a handler for a specific element and key event.
|
---|
1488 | * @param element The HTML element to receive event notifications.
|
---|
1489 | * @param eventName The name of the key event to listen for.
|
---|
1490 | * @param handler A function to call when the notification occurs. Receives the
|
---|
1491 | * event object as an argument.
|
---|
1492 | * @returns The key event that was registered.
|
---|
1493 | */
|
---|
1494 | KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
---|
1495 | var parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
---|
1496 | var outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
---|
1497 | return this.manager.getZone().runOutsideAngular(function () {
|
---|
1498 | return common.ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
|
---|
1499 | });
|
---|
1500 | };
|
---|
1501 | KeyEventsPlugin.parseEventName = function (eventName) {
|
---|
1502 | var parts = eventName.toLowerCase().split('.');
|
---|
1503 | var domEventName = parts.shift();
|
---|
1504 | if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
---|
1505 | return null;
|
---|
1506 | }
|
---|
1507 | var key = KeyEventsPlugin._normalizeKey(parts.pop());
|
---|
1508 | var fullKey = '';
|
---|
1509 | MODIFIER_KEYS.forEach(function (modifierName) {
|
---|
1510 | var index = parts.indexOf(modifierName);
|
---|
1511 | if (index > -1) {
|
---|
1512 | parts.splice(index, 1);
|
---|
1513 | fullKey += modifierName + '.';
|
---|
1514 | }
|
---|
1515 | });
|
---|
1516 | fullKey += key;
|
---|
1517 | if (parts.length != 0 || key.length === 0) {
|
---|
1518 | // returning null instead of throwing to let another plugin process the event
|
---|
1519 | return null;
|
---|
1520 | }
|
---|
1521 | // NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.
|
---|
1522 | // The code must remain in the `result['domEventName']` form.
|
---|
1523 | // return {domEventName, fullKey};
|
---|
1524 | var result = {};
|
---|
1525 | result['domEventName'] = domEventName;
|
---|
1526 | result['fullKey'] = fullKey;
|
---|
1527 | return result;
|
---|
1528 | };
|
---|
1529 | KeyEventsPlugin.getEventFullKey = function (event) {
|
---|
1530 | var fullKey = '';
|
---|
1531 | var key = getEventKey(event);
|
---|
1532 | key = key.toLowerCase();
|
---|
1533 | if (key === ' ') {
|
---|
1534 | key = 'space'; // for readability
|
---|
1535 | }
|
---|
1536 | else if (key === '.') {
|
---|
1537 | key = 'dot'; // because '.' is used as a separator in event names
|
---|
1538 | }
|
---|
1539 | MODIFIER_KEYS.forEach(function (modifierName) {
|
---|
1540 | if (modifierName != key) {
|
---|
1541 | var modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
---|
1542 | if (modifierGetter(event)) {
|
---|
1543 | fullKey += modifierName + '.';
|
---|
1544 | }
|
---|
1545 | }
|
---|
1546 | });
|
---|
1547 | fullKey += key;
|
---|
1548 | return fullKey;
|
---|
1549 | };
|
---|
1550 | /**
|
---|
1551 | * Configures a handler callback for a key event.
|
---|
1552 | * @param fullKey The event name that combines all simultaneous keystrokes.
|
---|
1553 | * @param handler The function that responds to the key event.
|
---|
1554 | * @param zone The zone in which the event occurred.
|
---|
1555 | * @returns A callback function.
|
---|
1556 | */
|
---|
1557 | KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) {
|
---|
1558 | return function (event /** TODO #9100 */) {
|
---|
1559 | if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
|
---|
1560 | zone.runGuarded(function () { return handler(event); });
|
---|
1561 | }
|
---|
1562 | };
|
---|
1563 | };
|
---|
1564 | /** @internal */
|
---|
1565 | KeyEventsPlugin._normalizeKey = function (keyName) {
|
---|
1566 | // TODO: switch to a Map if the mapping grows too much
|
---|
1567 | switch (keyName) {
|
---|
1568 | case 'esc':
|
---|
1569 | return 'escape';
|
---|
1570 | default:
|
---|
1571 | return keyName;
|
---|
1572 | }
|
---|
1573 | };
|
---|
1574 | return KeyEventsPlugin;
|
---|
1575 | }(EventManagerPlugin));
|
---|
1576 | KeyEventsPlugin.decorators = [
|
---|
1577 | { type: i0.Injectable }
|
---|
1578 | ];
|
---|
1579 | KeyEventsPlugin.ctorParameters = function () { return [
|
---|
1580 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
1581 | ]; };
|
---|
1582 | function getEventKey(event) {
|
---|
1583 | var key = event.key;
|
---|
1584 | if (key == null) {
|
---|
1585 | key = event.keyIdentifier;
|
---|
1586 | // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
|
---|
1587 | // Safari cf
|
---|
1588 | // https://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
|
---|
1589 | if (key == null) {
|
---|
1590 | return 'Unidentified';
|
---|
1591 | }
|
---|
1592 | if (key.startsWith('U+')) {
|
---|
1593 | key = String.fromCharCode(parseInt(key.substring(2), 16));
|
---|
1594 | if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
|
---|
1595 | // There is a bug in Chrome for numeric keypad keys:
|
---|
1596 | // https://code.google.com/p/chromium/issues/detail?id=155654
|
---|
1597 | // 1, 2, 3 ... are reported as A, B, C ...
|
---|
1598 | key = _chromeNumKeyPadMap[key];
|
---|
1599 | }
|
---|
1600 | }
|
---|
1601 | }
|
---|
1602 | return _keyMap[key] || key;
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | /**
|
---|
1606 | * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
|
---|
1607 | * values to be safe to use in the different DOM contexts.
|
---|
1608 | *
|
---|
1609 | * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
|
---|
1610 | * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
|
---|
1611 | * the website.
|
---|
1612 | *
|
---|
1613 | * In specific situations, it might be necessary to disable sanitization, for example if the
|
---|
1614 | * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
|
---|
1615 | * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
|
---|
1616 | * methods, and then binding to that value from the template.
|
---|
1617 | *
|
---|
1618 | * These situations should be very rare, and extraordinary care must be taken to avoid creating a
|
---|
1619 | * Cross Site Scripting (XSS) security bug!
|
---|
1620 | *
|
---|
1621 | * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
|
---|
1622 | * close as possible to the source of the value, to make it easy to verify no security bug is
|
---|
1623 | * created by its use.
|
---|
1624 | *
|
---|
1625 | * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
|
---|
1626 | * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
|
---|
1627 | * code. The sanitizer leaves safe values intact.
|
---|
1628 | *
|
---|
1629 | * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
|
---|
1630 | * sanitization for the value passed in. Carefully check and audit all values and code paths going
|
---|
1631 | * into this call. Make sure any user data is appropriately escaped for this security context.
|
---|
1632 | * For more detail, see the [Security Guide](https://g.co/ng/security).
|
---|
1633 | *
|
---|
1634 | * @publicApi
|
---|
1635 | */
|
---|
1636 | var DomSanitizer = /** @class */ (function () {
|
---|
1637 | function DomSanitizer() {
|
---|
1638 | }
|
---|
1639 | return DomSanitizer;
|
---|
1640 | }());
|
---|
1641 | DomSanitizer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizer_Factory() { return i0.ɵɵinject(DomSanitizerImpl); }, token: DomSanitizer, providedIn: "root" });
|
---|
1642 | DomSanitizer.decorators = [
|
---|
1643 | { type: i0.Injectable, args: [{ providedIn: 'root', useExisting: i0.forwardRef(function () { return DomSanitizerImpl; }) },] }
|
---|
1644 | ];
|
---|
1645 | function domSanitizerImplFactory(injector) {
|
---|
1646 | return new DomSanitizerImpl(injector.get(common.DOCUMENT));
|
---|
1647 | }
|
---|
1648 | var DomSanitizerImpl = /** @class */ (function (_super) {
|
---|
1649 | __extends(DomSanitizerImpl, _super);
|
---|
1650 | function DomSanitizerImpl(_doc) {
|
---|
1651 | var _this = _super.call(this) || this;
|
---|
1652 | _this._doc = _doc;
|
---|
1653 | return _this;
|
---|
1654 | }
|
---|
1655 | DomSanitizerImpl.prototype.sanitize = function (ctx, value) {
|
---|
1656 | if (value == null)
|
---|
1657 | return null;
|
---|
1658 | switch (ctx) {
|
---|
1659 | case i0.SecurityContext.NONE:
|
---|
1660 | return value;
|
---|
1661 | case i0.SecurityContext.HTML:
|
---|
1662 | if (i0.ɵallowSanitizationBypassAndThrow(value, "HTML" /* Html */)) {
|
---|
1663 | return i0.ɵunwrapSafeValue(value);
|
---|
1664 | }
|
---|
1665 | return i0.ɵ_sanitizeHtml(this._doc, String(value)).toString();
|
---|
1666 | case i0.SecurityContext.STYLE:
|
---|
1667 | if (i0.ɵallowSanitizationBypassAndThrow(value, "Style" /* Style */)) {
|
---|
1668 | return i0.ɵunwrapSafeValue(value);
|
---|
1669 | }
|
---|
1670 | return value;
|
---|
1671 | case i0.SecurityContext.SCRIPT:
|
---|
1672 | if (i0.ɵallowSanitizationBypassAndThrow(value, "Script" /* Script */)) {
|
---|
1673 | return i0.ɵunwrapSafeValue(value);
|
---|
1674 | }
|
---|
1675 | throw new Error('unsafe value used in a script context');
|
---|
1676 | case i0.SecurityContext.URL:
|
---|
1677 | var type = i0.ɵgetSanitizationBypassType(value);
|
---|
1678 | if (i0.ɵallowSanitizationBypassAndThrow(value, "URL" /* Url */)) {
|
---|
1679 | return i0.ɵunwrapSafeValue(value);
|
---|
1680 | }
|
---|
1681 | return i0.ɵ_sanitizeUrl(String(value));
|
---|
1682 | case i0.SecurityContext.RESOURCE_URL:
|
---|
1683 | if (i0.ɵallowSanitizationBypassAndThrow(value, "ResourceURL" /* ResourceUrl */)) {
|
---|
1684 | return i0.ɵunwrapSafeValue(value);
|
---|
1685 | }
|
---|
1686 | throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
---|
1687 | default:
|
---|
1688 | throw new Error("Unexpected SecurityContext " + ctx + " (see https://g.co/ng/security#xss)");
|
---|
1689 | }
|
---|
1690 | };
|
---|
1691 | DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) {
|
---|
1692 | return i0.ɵbypassSanitizationTrustHtml(value);
|
---|
1693 | };
|
---|
1694 | DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) {
|
---|
1695 | return i0.ɵbypassSanitizationTrustStyle(value);
|
---|
1696 | };
|
---|
1697 | DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) {
|
---|
1698 | return i0.ɵbypassSanitizationTrustScript(value);
|
---|
1699 | };
|
---|
1700 | DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) {
|
---|
1701 | return i0.ɵbypassSanitizationTrustUrl(value);
|
---|
1702 | };
|
---|
1703 | DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
|
---|
1704 | return i0.ɵbypassSanitizationTrustResourceUrl(value);
|
---|
1705 | };
|
---|
1706 | return DomSanitizerImpl;
|
---|
1707 | }(DomSanitizer));
|
---|
1708 | DomSanitizerImpl.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizerImpl_Factory() { return domSanitizerImplFactory(i0.ɵɵinject(i0.INJECTOR)); }, token: DomSanitizerImpl, providedIn: "root" });
|
---|
1709 | DomSanitizerImpl.decorators = [
|
---|
1710 | { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [i0.Injector] },] }
|
---|
1711 | ];
|
---|
1712 | DomSanitizerImpl.ctorParameters = function () { return [
|
---|
1713 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
1714 | ]; };
|
---|
1715 |
|
---|
1716 | /**
|
---|
1717 | * @license
|
---|
1718 | * Copyright Google LLC All Rights Reserved.
|
---|
1719 | *
|
---|
1720 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1721 | * found in the LICENSE file at https://angular.io/license
|
---|
1722 | */
|
---|
1723 | function initDomAdapter() {
|
---|
1724 | BrowserDomAdapter.makeCurrent();
|
---|
1725 | BrowserGetTestability.init();
|
---|
1726 | }
|
---|
1727 | function errorHandler() {
|
---|
1728 | return new i0.ErrorHandler();
|
---|
1729 | }
|
---|
1730 | function _document() {
|
---|
1731 | // Tell ivy about the global document
|
---|
1732 | i0.ɵsetDocument(document);
|
---|
1733 | return document;
|
---|
1734 | }
|
---|
1735 | var ɵ0$3 = common.ɵPLATFORM_BROWSER_ID;
|
---|
1736 | var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
---|
1737 | { provide: i0.PLATFORM_ID, useValue: ɵ0$3 },
|
---|
1738 | { provide: i0.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
|
---|
1739 | { provide: common.DOCUMENT, useFactory: _document, deps: [] },
|
---|
1740 | ];
|
---|
1741 | var BROWSER_SANITIZATION_PROVIDERS__PRE_R3__ = [
|
---|
1742 | { provide: i0.Sanitizer, useExisting: DomSanitizer },
|
---|
1743 | { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [common.DOCUMENT] },
|
---|
1744 | ];
|
---|
1745 | var BROWSER_SANITIZATION_PROVIDERS__POST_R3__ = [];
|
---|
1746 | /**
|
---|
1747 | * @security Replacing built-in sanitization providers exposes the application to XSS risks.
|
---|
1748 | * Attacker-controlled data introduced by an unsanitized provider could expose your
|
---|
1749 | * application to XSS risks. For more detail, see the [Security Guide](https://g.co/ng/security).
|
---|
1750 | * @publicApi
|
---|
1751 | */
|
---|
1752 | var BROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS__PRE_R3__;
|
---|
1753 | /**
|
---|
1754 | * A factory function that returns a `PlatformRef` instance associated with browser service
|
---|
1755 | * providers.
|
---|
1756 | *
|
---|
1757 | * @publicApi
|
---|
1758 | */
|
---|
1759 | var platformBrowser = i0.createPlatformFactory(i0.platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
---|
1760 | var BROWSER_MODULE_PROVIDERS = [
|
---|
1761 | BROWSER_SANITIZATION_PROVIDERS,
|
---|
1762 | { provide: i0.ɵINJECTOR_SCOPE, useValue: 'root' },
|
---|
1763 | { provide: i0.ErrorHandler, useFactory: errorHandler, deps: [] },
|
---|
1764 | {
|
---|
1765 | provide: EVENT_MANAGER_PLUGINS,
|
---|
1766 | useClass: DomEventsPlugin,
|
---|
1767 | multi: true,
|
---|
1768 | deps: [common.DOCUMENT, i0.NgZone, i0.PLATFORM_ID]
|
---|
1769 | },
|
---|
1770 | { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [common.DOCUMENT] },
|
---|
1771 | HAMMER_PROVIDERS,
|
---|
1772 | {
|
---|
1773 | provide: DomRendererFactory2,
|
---|
1774 | useClass: DomRendererFactory2,
|
---|
1775 | deps: [EventManager, DomSharedStylesHost, i0.APP_ID]
|
---|
1776 | },
|
---|
1777 | { provide: i0.RendererFactory2, useExisting: DomRendererFactory2 },
|
---|
1778 | { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
|
---|
1779 | { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [common.DOCUMENT] },
|
---|
1780 | { provide: i0.Testability, useClass: i0.Testability, deps: [i0.NgZone] },
|
---|
1781 | { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, i0.NgZone] },
|
---|
1782 | { provide: common.XhrFactory, useClass: BrowserXhr, deps: [] },
|
---|
1783 | ELEMENT_PROBE_PROVIDERS,
|
---|
1784 | ];
|
---|
1785 | /**
|
---|
1786 | * Exports required infrastructure for all Angular apps.
|
---|
1787 | * Included by default in all Angular apps created with the CLI
|
---|
1788 | * `new` command.
|
---|
1789 | * Re-exports `CommonModule` and `ApplicationModule`, making their
|
---|
1790 | * exports and providers available to all apps.
|
---|
1791 | *
|
---|
1792 | * @publicApi
|
---|
1793 | */
|
---|
1794 | var BrowserModule = /** @class */ (function () {
|
---|
1795 | function BrowserModule(parentModule) {
|
---|
1796 | if (parentModule) {
|
---|
1797 | throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
|
---|
1798 | }
|
---|
1799 | }
|
---|
1800 | /**
|
---|
1801 | * Configures a browser-based app to transition from a server-rendered app, if
|
---|
1802 | * one is present on the page.
|
---|
1803 | *
|
---|
1804 | * @param params An object containing an identifier for the app to transition.
|
---|
1805 | * The ID must match between the client and server versions of the app.
|
---|
1806 | * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.
|
---|
1807 | */
|
---|
1808 | BrowserModule.withServerTransition = function (params) {
|
---|
1809 | return {
|
---|
1810 | ngModule: BrowserModule,
|
---|
1811 | providers: [
|
---|
1812 | { provide: i0.APP_ID, useValue: params.appId },
|
---|
1813 | { provide: TRANSITION_ID, useExisting: i0.APP_ID },
|
---|
1814 | SERVER_TRANSITION_PROVIDERS,
|
---|
1815 | ],
|
---|
1816 | };
|
---|
1817 | };
|
---|
1818 | return BrowserModule;
|
---|
1819 | }());
|
---|
1820 | BrowserModule.decorators = [
|
---|
1821 | { type: i0.NgModule, args: [{ providers: BROWSER_MODULE_PROVIDERS, exports: [common.CommonModule, i0.ApplicationModule] },] }
|
---|
1822 | ];
|
---|
1823 | BrowserModule.ctorParameters = function () { return [
|
---|
1824 | { type: BrowserModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [BrowserModule,] }] }
|
---|
1825 | ]; };
|
---|
1826 |
|
---|
1827 | /**
|
---|
1828 | * @license
|
---|
1829 | * Copyright Google LLC All Rights Reserved.
|
---|
1830 | *
|
---|
1831 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1832 | * found in the LICENSE file at https://angular.io/license
|
---|
1833 | */
|
---|
1834 | /**
|
---|
1835 | * Factory to create a `Meta` service instance for the current DOM document.
|
---|
1836 | */
|
---|
1837 | function createMeta() {
|
---|
1838 | return new Meta(i0.ɵɵinject(common.DOCUMENT));
|
---|
1839 | }
|
---|
1840 | /**
|
---|
1841 | * A service for managing HTML `<meta>` tags.
|
---|
1842 | *
|
---|
1843 | * Properties of the `MetaDefinition` object match the attributes of the
|
---|
1844 | * HTML `<meta>` tag. These tags define document metadata that is important for
|
---|
1845 | * things like configuring a Content Security Policy, defining browser compatibility
|
---|
1846 | * and security settings, setting HTTP Headers, defining rich content for social sharing,
|
---|
1847 | * and Search Engine Optimization (SEO).
|
---|
1848 | *
|
---|
1849 | * To identify specific `<meta>` tags in a document, use an attribute selection
|
---|
1850 | * string in the format `"tag_attribute='value string'"`.
|
---|
1851 | * For example, an `attrSelector` value of `"name='description'"` matches a tag
|
---|
1852 | * whose `name` attribute has the value `"description"`.
|
---|
1853 | * Selectors are used with the `querySelector()` Document method,
|
---|
1854 | * in the format `meta[{attrSelector}]`.
|
---|
1855 | *
|
---|
1856 | * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
|
---|
1857 | * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
|
---|
1858 | *
|
---|
1859 | *
|
---|
1860 | * @publicApi
|
---|
1861 | */
|
---|
1862 | var Meta = /** @class */ (function () {
|
---|
1863 | function Meta(_doc) {
|
---|
1864 | this._doc = _doc;
|
---|
1865 | this._dom = common.ɵgetDOM();
|
---|
1866 | }
|
---|
1867 | /**
|
---|
1868 | * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
|
---|
1869 | * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
|
---|
1870 | * values in the provided tag definition, and verifies that all other attribute values are equal.
|
---|
1871 | * If an existing element is found, it is returned and is not modified in any way.
|
---|
1872 | * @param tag The definition of a `<meta>` element to match or create.
|
---|
1873 | * @param forceCreation True to create a new element without checking whether one already exists.
|
---|
1874 | * @returns The existing element with the same attributes and values if found,
|
---|
1875 | * the new element if no match is found, or `null` if the tag parameter is not defined.
|
---|
1876 | */
|
---|
1877 | Meta.prototype.addTag = function (tag, forceCreation) {
|
---|
1878 | if (forceCreation === void 0) { forceCreation = false; }
|
---|
1879 | if (!tag)
|
---|
1880 | return null;
|
---|
1881 | return this._getOrCreateElement(tag, forceCreation);
|
---|
1882 | };
|
---|
1883 | /**
|
---|
1884 | * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
|
---|
1885 | * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
|
---|
1886 | * values in the provided tag definition, and verifies that all other attribute values are equal.
|
---|
1887 | * @param tags An array of tag definitions to match or create.
|
---|
1888 | * @param forceCreation True to create new elements without checking whether they already exist.
|
---|
1889 | * @returns The matching elements if found, or the new elements.
|
---|
1890 | */
|
---|
1891 | Meta.prototype.addTags = function (tags, forceCreation) {
|
---|
1892 | var _this = this;
|
---|
1893 | if (forceCreation === void 0) { forceCreation = false; }
|
---|
1894 | if (!tags)
|
---|
1895 | return [];
|
---|
1896 | return tags.reduce(function (result, tag) {
|
---|
1897 | if (tag) {
|
---|
1898 | result.push(_this._getOrCreateElement(tag, forceCreation));
|
---|
1899 | }
|
---|
1900 | return result;
|
---|
1901 | }, []);
|
---|
1902 | };
|
---|
1903 | /**
|
---|
1904 | * Retrieves a `<meta>` tag element in the current HTML document.
|
---|
1905 | * @param attrSelector The tag attribute and value to match against, in the format
|
---|
1906 | * `"tag_attribute='value string'"`.
|
---|
1907 | * @returns The matching element, if any.
|
---|
1908 | */
|
---|
1909 | Meta.prototype.getTag = function (attrSelector) {
|
---|
1910 | if (!attrSelector)
|
---|
1911 | return null;
|
---|
1912 | return this._doc.querySelector("meta[" + attrSelector + "]") || null;
|
---|
1913 | };
|
---|
1914 | /**
|
---|
1915 | * Retrieves a set of `<meta>` tag elements in the current HTML document.
|
---|
1916 | * @param attrSelector The tag attribute and value to match against, in the format
|
---|
1917 | * `"tag_attribute='value string'"`.
|
---|
1918 | * @returns The matching elements, if any.
|
---|
1919 | */
|
---|
1920 | Meta.prototype.getTags = function (attrSelector) {
|
---|
1921 | if (!attrSelector)
|
---|
1922 | return [];
|
---|
1923 | var list /*NodeList*/ = this._doc.querySelectorAll("meta[" + attrSelector + "]");
|
---|
1924 | return list ? [].slice.call(list) : [];
|
---|
1925 | };
|
---|
1926 | /**
|
---|
1927 | * Modifies an existing `<meta>` tag element in the current HTML document.
|
---|
1928 | * @param tag The tag description with which to replace the existing tag content.
|
---|
1929 | * @param selector A tag attribute and value to match against, to identify
|
---|
1930 | * an existing tag. A string in the format `"tag_attribute=`value string`"`.
|
---|
1931 | * If not supplied, matches a tag with the same `name` or `property` attribute value as the
|
---|
1932 | * replacement tag.
|
---|
1933 | * @return The modified element.
|
---|
1934 | */
|
---|
1935 | Meta.prototype.updateTag = function (tag, selector) {
|
---|
1936 | if (!tag)
|
---|
1937 | return null;
|
---|
1938 | selector = selector || this._parseSelector(tag);
|
---|
1939 | var meta = this.getTag(selector);
|
---|
1940 | if (meta) {
|
---|
1941 | return this._setMetaElementAttributes(tag, meta);
|
---|
1942 | }
|
---|
1943 | return this._getOrCreateElement(tag, true);
|
---|
1944 | };
|
---|
1945 | /**
|
---|
1946 | * Removes an existing `<meta>` tag element from the current HTML document.
|
---|
1947 | * @param attrSelector A tag attribute and value to match against, to identify
|
---|
1948 | * an existing tag. A string in the format `"tag_attribute=`value string`"`.
|
---|
1949 | */
|
---|
1950 | Meta.prototype.removeTag = function (attrSelector) {
|
---|
1951 | this.removeTagElement(this.getTag(attrSelector));
|
---|
1952 | };
|
---|
1953 | /**
|
---|
1954 | * Removes an existing `<meta>` tag element from the current HTML document.
|
---|
1955 | * @param meta The tag definition to match against to identify an existing tag.
|
---|
1956 | */
|
---|
1957 | Meta.prototype.removeTagElement = function (meta) {
|
---|
1958 | if (meta) {
|
---|
1959 | this._dom.remove(meta);
|
---|
1960 | }
|
---|
1961 | };
|
---|
1962 | Meta.prototype._getOrCreateElement = function (meta, forceCreation) {
|
---|
1963 | var _this = this;
|
---|
1964 | if (forceCreation === void 0) { forceCreation = false; }
|
---|
1965 | if (!forceCreation) {
|
---|
1966 | var selector = this._parseSelector(meta);
|
---|
1967 | // It's allowed to have multiple elements with the same name so it's not enough to
|
---|
1968 | // just check that element with the same name already present on the page. We also need to
|
---|
1969 | // check if element has tag attributes
|
---|
1970 | var elem = this.getTags(selector).filter(function (elem) { return _this._containsAttributes(meta, elem); })[0];
|
---|
1971 | if (elem !== undefined)
|
---|
1972 | return elem;
|
---|
1973 | }
|
---|
1974 | var element = this._dom.createElement('meta');
|
---|
1975 | this._setMetaElementAttributes(meta, element);
|
---|
1976 | var head = this._doc.getElementsByTagName('head')[0];
|
---|
1977 | head.appendChild(element);
|
---|
1978 | return element;
|
---|
1979 | };
|
---|
1980 | Meta.prototype._setMetaElementAttributes = function (tag, el) {
|
---|
1981 | var _this = this;
|
---|
1982 | Object.keys(tag).forEach(function (prop) { return el.setAttribute(_this._getMetaKeyMap(prop), tag[prop]); });
|
---|
1983 | return el;
|
---|
1984 | };
|
---|
1985 | Meta.prototype._parseSelector = function (tag) {
|
---|
1986 | var attr = tag.name ? 'name' : 'property';
|
---|
1987 | return attr + "=\"" + tag[attr] + "\"";
|
---|
1988 | };
|
---|
1989 | Meta.prototype._containsAttributes = function (tag, elem) {
|
---|
1990 | var _this = this;
|
---|
1991 | return Object.keys(tag).every(function (key) { return elem.getAttribute(_this._getMetaKeyMap(key)) === tag[key]; });
|
---|
1992 | };
|
---|
1993 | Meta.prototype._getMetaKeyMap = function (prop) {
|
---|
1994 | return META_KEYS_MAP[prop] || prop;
|
---|
1995 | };
|
---|
1996 | return Meta;
|
---|
1997 | }());
|
---|
1998 | Meta.ɵprov = i0.ɵɵdefineInjectable({ factory: createMeta, token: Meta, providedIn: "root" });
|
---|
1999 | Meta.decorators = [
|
---|
2000 | { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: createMeta, deps: [] },] }
|
---|
2001 | ];
|
---|
2002 | Meta.ctorParameters = function () { return [
|
---|
2003 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
2004 | ]; };
|
---|
2005 | /**
|
---|
2006 | * Mapping for MetaDefinition properties with their correct meta attribute names
|
---|
2007 | */
|
---|
2008 | var META_KEYS_MAP = {
|
---|
2009 | httpEquiv: 'http-equiv'
|
---|
2010 | };
|
---|
2011 |
|
---|
2012 | /**
|
---|
2013 | * @license
|
---|
2014 | * Copyright Google LLC All Rights Reserved.
|
---|
2015 | *
|
---|
2016 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2017 | * found in the LICENSE file at https://angular.io/license
|
---|
2018 | */
|
---|
2019 | /**
|
---|
2020 | * Factory to create Title service.
|
---|
2021 | */
|
---|
2022 | function createTitle() {
|
---|
2023 | return new Title(i0.ɵɵinject(common.DOCUMENT));
|
---|
2024 | }
|
---|
2025 | /**
|
---|
2026 | * A service that can be used to get and set the title of a current HTML document.
|
---|
2027 | *
|
---|
2028 | * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
|
---|
2029 | * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
|
---|
2030 | * (representing the `<title>` tag). Instead, this service can be used to set and get the current
|
---|
2031 | * title value.
|
---|
2032 | *
|
---|
2033 | * @publicApi
|
---|
2034 | */
|
---|
2035 | var Title = /** @class */ (function () {
|
---|
2036 | function Title(_doc) {
|
---|
2037 | this._doc = _doc;
|
---|
2038 | }
|
---|
2039 | /**
|
---|
2040 | * Get the title of the current HTML document.
|
---|
2041 | */
|
---|
2042 | Title.prototype.getTitle = function () {
|
---|
2043 | return this._doc.title;
|
---|
2044 | };
|
---|
2045 | /**
|
---|
2046 | * Set the title of the current HTML document.
|
---|
2047 | * @param newTitle
|
---|
2048 | */
|
---|
2049 | Title.prototype.setTitle = function (newTitle) {
|
---|
2050 | this._doc.title = newTitle || '';
|
---|
2051 | };
|
---|
2052 | return Title;
|
---|
2053 | }());
|
---|
2054 | Title.ɵprov = i0.ɵɵdefineInjectable({ factory: createTitle, token: Title, providedIn: "root" });
|
---|
2055 | Title.decorators = [
|
---|
2056 | { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: createTitle, deps: [] },] }
|
---|
2057 | ];
|
---|
2058 | Title.ctorParameters = function () { return [
|
---|
2059 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
2060 | ]; };
|
---|
2061 |
|
---|
2062 | /**
|
---|
2063 | * @license
|
---|
2064 | * Copyright Google LLC All Rights Reserved.
|
---|
2065 | *
|
---|
2066 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2067 | * found in the LICENSE file at https://angular.io/license
|
---|
2068 | */
|
---|
2069 | var win = typeof window !== 'undefined' && window || {};
|
---|
2070 |
|
---|
2071 | /**
|
---|
2072 | * @license
|
---|
2073 | * Copyright Google LLC All Rights Reserved.
|
---|
2074 | *
|
---|
2075 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2076 | * found in the LICENSE file at https://angular.io/license
|
---|
2077 | */
|
---|
2078 | var ChangeDetectionPerfRecord = /** @class */ (function () {
|
---|
2079 | function ChangeDetectionPerfRecord(msPerTick, numTicks) {
|
---|
2080 | this.msPerTick = msPerTick;
|
---|
2081 | this.numTicks = numTicks;
|
---|
2082 | }
|
---|
2083 | return ChangeDetectionPerfRecord;
|
---|
2084 | }());
|
---|
2085 | /**
|
---|
2086 | * Entry point for all Angular profiling-related debug tools. This object
|
---|
2087 | * corresponds to the `ng.profiler` in the dev console.
|
---|
2088 | */
|
---|
2089 | var AngularProfiler = /** @class */ (function () {
|
---|
2090 | function AngularProfiler(ref) {
|
---|
2091 | this.appRef = ref.injector.get(i0.ApplicationRef);
|
---|
2092 | }
|
---|
2093 | // tslint:disable:no-console
|
---|
2094 | /**
|
---|
2095 | * Exercises change detection in a loop and then prints the average amount of
|
---|
2096 | * time in milliseconds how long a single round of change detection takes for
|
---|
2097 | * the current state of the UI. It runs a minimum of 5 rounds for a minimum
|
---|
2098 | * of 500 milliseconds.
|
---|
2099 | *
|
---|
2100 | * Optionally, a user may pass a `config` parameter containing a map of
|
---|
2101 | * options. Supported options are:
|
---|
2102 | *
|
---|
2103 | * `record` (boolean) - causes the profiler to record a CPU profile while
|
---|
2104 | * it exercises the change detector. Example:
|
---|
2105 | *
|
---|
2106 | * ```
|
---|
2107 | * ng.profiler.timeChangeDetection({record: true})
|
---|
2108 | * ```
|
---|
2109 | */
|
---|
2110 | AngularProfiler.prototype.timeChangeDetection = function (config) {
|
---|
2111 | var record = config && config['record'];
|
---|
2112 | var profileName = 'Change Detection';
|
---|
2113 | // Profiler is not available in Android browsers without dev tools opened
|
---|
2114 | var isProfilerAvailable = win.console.profile != null;
|
---|
2115 | if (record && isProfilerAvailable) {
|
---|
2116 | win.console.profile(profileName);
|
---|
2117 | }
|
---|
2118 | var start = performanceNow();
|
---|
2119 | var numTicks = 0;
|
---|
2120 | while (numTicks < 5 || (performanceNow() - start) < 500) {
|
---|
2121 | this.appRef.tick();
|
---|
2122 | numTicks++;
|
---|
2123 | }
|
---|
2124 | var end = performanceNow();
|
---|
2125 | if (record && isProfilerAvailable) {
|
---|
2126 | win.console.profileEnd(profileName);
|
---|
2127 | }
|
---|
2128 | var msPerTick = (end - start) / numTicks;
|
---|
2129 | win.console.log("ran " + numTicks + " change detection cycles");
|
---|
2130 | win.console.log(msPerTick.toFixed(2) + " ms per check");
|
---|
2131 | return new ChangeDetectionPerfRecord(msPerTick, numTicks);
|
---|
2132 | };
|
---|
2133 | return AngularProfiler;
|
---|
2134 | }());
|
---|
2135 | function performanceNow() {
|
---|
2136 | return win.performance && win.performance.now ? win.performance.now() :
|
---|
2137 | new Date().getTime();
|
---|
2138 | }
|
---|
2139 |
|
---|
2140 | /**
|
---|
2141 | * @license
|
---|
2142 | * Copyright Google LLC All Rights Reserved.
|
---|
2143 | *
|
---|
2144 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2145 | * found in the LICENSE file at https://angular.io/license
|
---|
2146 | */
|
---|
2147 | var PROFILER_GLOBAL_NAME = 'profiler';
|
---|
2148 | /**
|
---|
2149 | * Enabled Angular debug tools that are accessible via your browser's
|
---|
2150 | * developer console.
|
---|
2151 | *
|
---|
2152 | * Usage:
|
---|
2153 | *
|
---|
2154 | * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
|
---|
2155 | * 1. Type `ng.` (usually the console will show auto-complete suggestion)
|
---|
2156 | * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
|
---|
2157 | * then hit Enter.
|
---|
2158 | *
|
---|
2159 | * @publicApi
|
---|
2160 | */
|
---|
2161 | function enableDebugTools(ref) {
|
---|
2162 | exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
---|
2163 | return ref;
|
---|
2164 | }
|
---|
2165 | /**
|
---|
2166 | * Disables Angular tools.
|
---|
2167 | *
|
---|
2168 | * @publicApi
|
---|
2169 | */
|
---|
2170 | function disableDebugTools() {
|
---|
2171 | exportNgVar(PROFILER_GLOBAL_NAME, null);
|
---|
2172 | }
|
---|
2173 |
|
---|
2174 | /**
|
---|
2175 | * @license
|
---|
2176 | * Copyright Google LLC All Rights Reserved.
|
---|
2177 | *
|
---|
2178 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2179 | * found in the LICENSE file at https://angular.io/license
|
---|
2180 | */
|
---|
2181 | function escapeHtml(text) {
|
---|
2182 | var escapedText = {
|
---|
2183 | '&': '&a;',
|
---|
2184 | '"': '&q;',
|
---|
2185 | '\'': '&s;',
|
---|
2186 | '<': '&l;',
|
---|
2187 | '>': '&g;',
|
---|
2188 | };
|
---|
2189 | return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
|
---|
2190 | }
|
---|
2191 | function unescapeHtml(text) {
|
---|
2192 | var unescapedText = {
|
---|
2193 | '&a;': '&',
|
---|
2194 | '&q;': '"',
|
---|
2195 | '&s;': '\'',
|
---|
2196 | '&l;': '<',
|
---|
2197 | '&g;': '>',
|
---|
2198 | };
|
---|
2199 | return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
|
---|
2200 | }
|
---|
2201 | /**
|
---|
2202 | * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
|
---|
2203 | *
|
---|
2204 | * Example:
|
---|
2205 | *
|
---|
2206 | * ```
|
---|
2207 | * const COUNTER_KEY = makeStateKey<number>('counter');
|
---|
2208 | * let value = 10;
|
---|
2209 | *
|
---|
2210 | * transferState.set(COUNTER_KEY, value);
|
---|
2211 | * ```
|
---|
2212 | *
|
---|
2213 | * @publicApi
|
---|
2214 | */
|
---|
2215 | function makeStateKey(key) {
|
---|
2216 | return key;
|
---|
2217 | }
|
---|
2218 | /**
|
---|
2219 | * A key value store that is transferred from the application on the server side to the application
|
---|
2220 | * on the client side.
|
---|
2221 | *
|
---|
2222 | * `TransferState` will be available as an injectable token. To use it import
|
---|
2223 | * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
|
---|
2224 | *
|
---|
2225 | * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
|
---|
2226 | * boolean, number, string, null and non-class objects will be serialized and deserialized in a
|
---|
2227 | * non-lossy manner.
|
---|
2228 | *
|
---|
2229 | * @publicApi
|
---|
2230 | */
|
---|
2231 | var TransferState = /** @class */ (function () {
|
---|
2232 | function TransferState() {
|
---|
2233 | this.store = {};
|
---|
2234 | this.onSerializeCallbacks = {};
|
---|
2235 | }
|
---|
2236 | /** @internal */
|
---|
2237 | TransferState.init = function (initState) {
|
---|
2238 | var transferState = new TransferState();
|
---|
2239 | transferState.store = initState;
|
---|
2240 | return transferState;
|
---|
2241 | };
|
---|
2242 | /**
|
---|
2243 | * Get the value corresponding to a key. Return `defaultValue` if key is not found.
|
---|
2244 | */
|
---|
2245 | TransferState.prototype.get = function (key, defaultValue) {
|
---|
2246 | return this.store[key] !== undefined ? this.store[key] : defaultValue;
|
---|
2247 | };
|
---|
2248 | /**
|
---|
2249 | * Set the value corresponding to a key.
|
---|
2250 | */
|
---|
2251 | TransferState.prototype.set = function (key, value) {
|
---|
2252 | this.store[key] = value;
|
---|
2253 | };
|
---|
2254 | /**
|
---|
2255 | * Remove a key from the store.
|
---|
2256 | */
|
---|
2257 | TransferState.prototype.remove = function (key) {
|
---|
2258 | delete this.store[key];
|
---|
2259 | };
|
---|
2260 | /**
|
---|
2261 | * Test whether a key exists in the store.
|
---|
2262 | */
|
---|
2263 | TransferState.prototype.hasKey = function (key) {
|
---|
2264 | return this.store.hasOwnProperty(key);
|
---|
2265 | };
|
---|
2266 | /**
|
---|
2267 | * Register a callback to provide the value for a key when `toJson` is called.
|
---|
2268 | */
|
---|
2269 | TransferState.prototype.onSerialize = function (key, callback) {
|
---|
2270 | this.onSerializeCallbacks[key] = callback;
|
---|
2271 | };
|
---|
2272 | /**
|
---|
2273 | * Serialize the current state of the store to JSON.
|
---|
2274 | */
|
---|
2275 | TransferState.prototype.toJson = function () {
|
---|
2276 | // Call the onSerialize callbacks and put those values into the store.
|
---|
2277 | for (var key in this.onSerializeCallbacks) {
|
---|
2278 | if (this.onSerializeCallbacks.hasOwnProperty(key)) {
|
---|
2279 | try {
|
---|
2280 | this.store[key] = this.onSerializeCallbacks[key]();
|
---|
2281 | }
|
---|
2282 | catch (e) {
|
---|
2283 | console.warn('Exception in onSerialize callback: ', e);
|
---|
2284 | }
|
---|
2285 | }
|
---|
2286 | }
|
---|
2287 | return JSON.stringify(this.store);
|
---|
2288 | };
|
---|
2289 | return TransferState;
|
---|
2290 | }());
|
---|
2291 | TransferState.decorators = [
|
---|
2292 | { type: i0.Injectable }
|
---|
2293 | ];
|
---|
2294 | function initTransferState(doc, appId) {
|
---|
2295 | // Locate the script tag with the JSON data transferred from the server.
|
---|
2296 | // The id of the script tag is set to the Angular appId + 'state'.
|
---|
2297 | var script = doc.getElementById(appId + '-state');
|
---|
2298 | var initialState = {};
|
---|
2299 | if (script && script.textContent) {
|
---|
2300 | try {
|
---|
2301 | // Avoid using any here as it triggers lint errors in google3 (any is not allowed).
|
---|
2302 | initialState = JSON.parse(unescapeHtml(script.textContent));
|
---|
2303 | }
|
---|
2304 | catch (e) {
|
---|
2305 | console.warn('Exception while restoring TransferState for app ' + appId, e);
|
---|
2306 | }
|
---|
2307 | }
|
---|
2308 | return TransferState.init(initialState);
|
---|
2309 | }
|
---|
2310 | /**
|
---|
2311 | * NgModule to install on the client side while using the `TransferState` to transfer state from
|
---|
2312 | * server to client.
|
---|
2313 | *
|
---|
2314 | * @publicApi
|
---|
2315 | */
|
---|
2316 | var BrowserTransferStateModule = /** @class */ (function () {
|
---|
2317 | function BrowserTransferStateModule() {
|
---|
2318 | }
|
---|
2319 | return BrowserTransferStateModule;
|
---|
2320 | }());
|
---|
2321 | BrowserTransferStateModule.decorators = [
|
---|
2322 | { type: i0.NgModule, args: [{
|
---|
2323 | providers: [{ provide: TransferState, useFactory: initTransferState, deps: [common.DOCUMENT, i0.APP_ID] }],
|
---|
2324 | },] }
|
---|
2325 | ];
|
---|
2326 |
|
---|
2327 | /**
|
---|
2328 | * @license
|
---|
2329 | * Copyright Google LLC All Rights Reserved.
|
---|
2330 | *
|
---|
2331 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2332 | * found in the LICENSE file at https://angular.io/license
|
---|
2333 | */
|
---|
2334 | /**
|
---|
2335 | * Predicates for use with {@link DebugElement}'s query functions.
|
---|
2336 | *
|
---|
2337 | * @publicApi
|
---|
2338 | */
|
---|
2339 | var By = /** @class */ (function () {
|
---|
2340 | function By() {
|
---|
2341 | }
|
---|
2342 | /**
|
---|
2343 | * Match all nodes.
|
---|
2344 | *
|
---|
2345 | * @usageNotes
|
---|
2346 | * ### Example
|
---|
2347 | *
|
---|
2348 | * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
|
---|
2349 | */
|
---|
2350 | By.all = function () {
|
---|
2351 | return function () { return true; };
|
---|
2352 | };
|
---|
2353 | /**
|
---|
2354 | * Match elements by the given CSS selector.
|
---|
2355 | *
|
---|
2356 | * @usageNotes
|
---|
2357 | * ### Example
|
---|
2358 | *
|
---|
2359 | * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
|
---|
2360 | */
|
---|
2361 | By.css = function (selector) {
|
---|
2362 | return function (debugElement) {
|
---|
2363 | return debugElement.nativeElement != null ?
|
---|
2364 | elementMatches(debugElement.nativeElement, selector) :
|
---|
2365 | false;
|
---|
2366 | };
|
---|
2367 | };
|
---|
2368 | /**
|
---|
2369 | * Match nodes that have the given directive present.
|
---|
2370 | *
|
---|
2371 | * @usageNotes
|
---|
2372 | * ### Example
|
---|
2373 | *
|
---|
2374 | * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
|
---|
2375 | */
|
---|
2376 | By.directive = function (type) {
|
---|
2377 | return function (debugNode) { return debugNode.providerTokens.indexOf(type) !== -1; };
|
---|
2378 | };
|
---|
2379 | return By;
|
---|
2380 | }());
|
---|
2381 | function elementMatches(n, selector) {
|
---|
2382 | if (common.ɵgetDOM().isElementNode(n)) {
|
---|
2383 | return n.matches && n.matches(selector) ||
|
---|
2384 | n.msMatchesSelector && n.msMatchesSelector(selector) ||
|
---|
2385 | n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
|
---|
2386 | }
|
---|
2387 | return false;
|
---|
2388 | }
|
---|
2389 |
|
---|
2390 | /**
|
---|
2391 | * @license
|
---|
2392 | * Copyright Google LLC All Rights Reserved.
|
---|
2393 | *
|
---|
2394 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2395 | * found in the LICENSE file at https://angular.io/license
|
---|
2396 | */
|
---|
2397 |
|
---|
2398 | /**
|
---|
2399 | * @license
|
---|
2400 | * Copyright Google LLC All Rights Reserved.
|
---|
2401 | *
|
---|
2402 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2403 | * found in the LICENSE file at https://angular.io/license
|
---|
2404 | */
|
---|
2405 | /**
|
---|
2406 | * @publicApi
|
---|
2407 | */
|
---|
2408 | var VERSION = new i0.Version('12.2.13');
|
---|
2409 |
|
---|
2410 | /**
|
---|
2411 | * @license
|
---|
2412 | * Copyright Google LLC All Rights Reserved.
|
---|
2413 | *
|
---|
2414 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2415 | * found in the LICENSE file at https://angular.io/license
|
---|
2416 | */
|
---|
2417 |
|
---|
2418 | /**
|
---|
2419 | * @license
|
---|
2420 | * Copyright Google LLC All Rights Reserved.
|
---|
2421 | *
|
---|
2422 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2423 | * found in the LICENSE file at https://angular.io/license
|
---|
2424 | */
|
---|
2425 | // This file only reexports content of the `src` folder. Keep it that way.
|
---|
2426 |
|
---|
2427 | /**
|
---|
2428 | * @license
|
---|
2429 | * Copyright Google LLC All Rights Reserved.
|
---|
2430 | *
|
---|
2431 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2432 | * found in the LICENSE file at https://angular.io/license
|
---|
2433 | */
|
---|
2434 |
|
---|
2435 | /**
|
---|
2436 | * Generated bundle index. Do not edit.
|
---|
2437 | */
|
---|
2438 |
|
---|
2439 | Object.defineProperty(exports, 'ɵgetDOM', {
|
---|
2440 | enumerable: true,
|
---|
2441 | get: function () {
|
---|
2442 | return common.ɵgetDOM;
|
---|
2443 | }
|
---|
2444 | });
|
---|
2445 | exports.BrowserModule = BrowserModule;
|
---|
2446 | exports.BrowserTransferStateModule = BrowserTransferStateModule;
|
---|
2447 | exports.By = By;
|
---|
2448 | exports.DomSanitizer = DomSanitizer;
|
---|
2449 | exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
|
---|
2450 | exports.EventManager = EventManager;
|
---|
2451 | exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
|
---|
2452 | exports.HAMMER_LOADER = HAMMER_LOADER;
|
---|
2453 | exports.HammerGestureConfig = HammerGestureConfig;
|
---|
2454 | exports.HammerModule = HammerModule;
|
---|
2455 | exports.Meta = Meta;
|
---|
2456 | exports.Title = Title;
|
---|
2457 | exports.TransferState = TransferState;
|
---|
2458 | exports.VERSION = VERSION;
|
---|
2459 | exports.disableDebugTools = disableDebugTools;
|
---|
2460 | exports.enableDebugTools = enableDebugTools;
|
---|
2461 | exports.makeStateKey = makeStateKey;
|
---|
2462 | exports.platformBrowser = platformBrowser;
|
---|
2463 | exports.ɵBROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS;
|
---|
2464 | exports.ɵBROWSER_SANITIZATION_PROVIDERS__POST_R3__ = BROWSER_SANITIZATION_PROVIDERS__POST_R3__;
|
---|
2465 | exports.ɵBrowserDomAdapter = BrowserDomAdapter;
|
---|
2466 | exports.ɵBrowserGetTestability = BrowserGetTestability;
|
---|
2467 | exports.ɵDomEventsPlugin = DomEventsPlugin;
|
---|
2468 | exports.ɵDomRendererFactory2 = DomRendererFactory2;
|
---|
2469 | exports.ɵDomSanitizerImpl = DomSanitizerImpl;
|
---|
2470 | exports.ɵDomSharedStylesHost = DomSharedStylesHost;
|
---|
2471 | exports.ɵELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
|
---|
2472 | exports.ɵELEMENT_PROBE_PROVIDERS__POST_R3__ = ELEMENT_PROBE_PROVIDERS__POST_R3__;
|
---|
2473 | exports.ɵHAMMER_PROVIDERS__POST_R3__ = HAMMER_PROVIDERS__POST_R3__;
|
---|
2474 | exports.ɵHammerGesturesPlugin = HammerGesturesPlugin;
|
---|
2475 | exports.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS = INTERNAL_BROWSER_PLATFORM_PROVIDERS;
|
---|
2476 | exports.ɵKeyEventsPlugin = KeyEventsPlugin;
|
---|
2477 | exports.ɵNAMESPACE_URIS = NAMESPACE_URIS;
|
---|
2478 | exports.ɵSharedStylesHost = SharedStylesHost;
|
---|
2479 | exports.ɵTRANSITION_ID = TRANSITION_ID;
|
---|
2480 | exports.ɵangular_packages_platform_browser_platform_browser_a = errorHandler;
|
---|
2481 | exports.ɵangular_packages_platform_browser_platform_browser_b = _document;
|
---|
2482 | exports.ɵangular_packages_platform_browser_platform_browser_c = BROWSER_MODULE_PROVIDERS;
|
---|
2483 | exports.ɵangular_packages_platform_browser_platform_browser_d = createMeta;
|
---|
2484 | exports.ɵangular_packages_platform_browser_platform_browser_e = createTitle;
|
---|
2485 | exports.ɵangular_packages_platform_browser_platform_browser_f = initTransferState;
|
---|
2486 | exports.ɵangular_packages_platform_browser_platform_browser_g = EventManagerPlugin;
|
---|
2487 | exports.ɵangular_packages_platform_browser_platform_browser_h = HAMMER_PROVIDERS__PRE_R3__;
|
---|
2488 | exports.ɵangular_packages_platform_browser_platform_browser_i = HAMMER_PROVIDERS;
|
---|
2489 | exports.ɵangular_packages_platform_browser_platform_browser_j = domSanitizerImplFactory;
|
---|
2490 | exports.ɵangular_packages_platform_browser_platform_browser_k = appInitializerFactory;
|
---|
2491 | exports.ɵangular_packages_platform_browser_platform_browser_l = SERVER_TRANSITION_PROVIDERS;
|
---|
2492 | exports.ɵangular_packages_platform_browser_platform_browser_m = _createNgProbeR2;
|
---|
2493 | exports.ɵangular_packages_platform_browser_platform_browser_n = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
|
---|
2494 | exports.ɵangular_packages_platform_browser_platform_browser_o = BrowserXhr;
|
---|
2495 | exports.ɵangular_packages_platform_browser_platform_browser_p = GenericBrowserDomAdapter;
|
---|
2496 | exports.ɵescapeHtml = escapeHtml;
|
---|
2497 | exports.ɵflattenStyles = flattenStyles;
|
---|
2498 | exports.ɵinitDomAdapter = initDomAdapter;
|
---|
2499 | exports.ɵshimContentAttribute = shimContentAttribute;
|
---|
2500 | exports.ɵshimHostAttribute = shimHostAttribute;
|
---|
2501 |
|
---|
2502 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
2503 |
|
---|
2504 | })));
|
---|
2505 | //# sourceMappingURL=platform-browser.umd.js.map
|
---|