Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/codegen/expect/core/core.js

Issue 968273002: Fixing layout in js output (use full paths rather than just the library name) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: address review comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen/expect/convert/convert.js ('k') | test/codegen/expect/dart/_foreign_helper.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 var core;
2 (function(exports) {
3 'use strict';
4 // Function _symbolToString: (Symbol) → String
5 function _symbolToString(symbol) {
6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol));
7 }
8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic
9 function _symbolMapToStringMap(map) {
10 if (map === null)
11 return null;
12 let result = new Map();
13 map.forEach((key, value) => {
14 result.set(_symbolToString(key), value);
15 });
16 return result;
17 }
18 class _ListConstructorSentinel extends _interceptors.JSInt {
19 _ListConstructorSentinel() {
20 super.JSInt();
21 }
22 }
23 class Deprecated extends dart.Object {
24 Deprecated(expires) {
25 this.expires = expires;
26 }
27 toString() {
28 return `Deprecated feature. Will be removed ${this.expires}`;
29 }
30 }
31 class _Override extends dart.Object {
32 _Override() {
33 }
34 }
35 let deprecated = new Deprecated("next release");
36 let override = new _Override();
37 class _Proxy extends dart.Object {
38 _Proxy() {
39 }
40 }
41 let proxy = new _Proxy();
42 class bool extends dart.Object {
43 bool$fromEnvironment(name, opt$) {
44 let defaultValue = opt$.defaultValue === void 0 ? false : opt$.defaultValu e;
45 throw new UnsupportedError('bool.fromEnvironment can only be used as a con st constructor');
46 }
47 toString() {
48 return this ? "true" : "false";
49 }
50 }
51 dart.defineNamedConstructor(bool, 'fromEnvironment');
52 let Comparable$ = dart.generic(function(T) {
53 class Comparable extends dart.Object {
54 static compare(a, b) {
55 return a.compareTo(b);
56 }
57 }
58 return Comparable;
59 });
60 let Comparable = Comparable$(dynamic);
61 class DateTime extends dart.Object {
62 DateTime(year, month, day, hour, minute, second, millisecond) {
63 if (month === void 0)
64 month = 1;
65 if (day === void 0)
66 day = 1;
67 if (hour === void 0)
68 hour = 0;
69 if (minute === void 0)
70 minute = 0;
71 if (second === void 0)
72 second = 0;
73 if (millisecond === void 0)
74 millisecond = 0;
75 this.DateTime$_internal(year, month, day, hour, minute, second, millisecon d, false);
76 }
77 DateTime$utc(year, month, day, hour, minute, second, millisecond) {
78 if (month === void 0)
79 month = 1;
80 if (day === void 0)
81 day = 1;
82 if (hour === void 0)
83 hour = 0;
84 if (minute === void 0)
85 minute = 0;
86 if (second === void 0)
87 second = 0;
88 if (millisecond === void 0)
89 millisecond = 0;
90 this.DateTime$_internal(year, month, day, hour, minute, second, millisecon d, true);
91 }
92 DateTime$now() {
93 this.DateTime$_now();
94 }
95 static parse(formattedString) {
96 let re = new RegExp('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\ \d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?( \\d\\d))?)?)?$');
97 let match = re.firstMatch(formattedString);
98 if (match !== null) {
99 // Function parseIntOrZero: (String) → int
100 function parseIntOrZero(matched) {
101 if (matched === null)
102 return 0;
103 return int.parse(matched);
104 }
105 // Function parseDoubleOrZero: (String) → double
106 function parseDoubleOrZero(matched) {
107 if (matched === null)
108 return 0.0;
109 return double.parse(matched);
110 }
111 let years = int.parse(match.get(1));
112 let month = int.parse(match.get(2));
113 let day = int.parse(match.get(3));
114 let hour = parseIntOrZero(match.get(4));
115 let minute = parseIntOrZero(match.get(5));
116 let second = parseIntOrZero(match.get(6));
117 let addOneMillisecond = false;
118 let millisecond = (parseDoubleOrZero(match.get(7)) * 1000).round();
119 if (millisecond === 1000) {
120 addOneMillisecond = true;
121 millisecond = 999;
122 }
123 let isUtc = false;
124 if (match.get(8) !== null) {
125 isUtc = true;
126 if (match.get(9) !== null) {
127 let sign = dart.equals(match.get(9), '-') ? -1 : 1;
128 let hourDifference = int.parse(match.get(10));
129 let minuteDifference = parseIntOrZero(match.get(11));
130 minuteDifference = 60 * hourDifference;
131 minute = sign * minuteDifference;
132 }
133 }
134 let millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(yea rs, month, day, hour, minute, second, millisecond, isUtc);
135 if (millisecondsSinceEpoch === null) {
136 throw new FormatException("Time out of range", formattedString);
137 }
138 if (addOneMillisecond)
139 millisecondsSinceEpoch++;
140 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc});
141 } else {
142 throw new FormatException("Invalid date format", formattedString);
143 }
144 }
145 DateTime$fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opt$) {
146 let isUtc = opt$.isUtc === void 0 ? false : opt$.isUtc;
147 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
148 this.isUtc = isUtc;
149 if (millisecondsSinceEpoch.abs() > _MAX_MILLISECONDS_SINCE_EPOCH) {
150 throw new ArgumentError(millisecondsSinceEpoch);
151 }
152 if (isUtc === null)
153 throw new ArgumentError(isUtc);
154 }
155 ['=='](other) {
156 if (!dart.notNull(dart.is(other, DateTime)))
157 return false;
158 return dart.notNull(this.millisecondsSinceEpoch === dart.dload(other, 'mil lisecondsSinceEpoch')) && dart.notNull(this.isUtc === dart.dload(other, 'isUtc') );
159 }
160 isBefore(other) {
161 return this.millisecondsSinceEpoch < other.millisecondsSinceEpoch;
162 }
163 isAfter(other) {
164 return this.millisecondsSinceEpoch > other.millisecondsSinceEpoch;
165 }
166 isAtSameMomentAs(other) {
167 return this.millisecondsSinceEpoch === other.millisecondsSinceEpoch;
168 }
169 compareTo(other) {
170 return this.millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch) ;
171 }
172 get hashCode() {
173 return this.millisecondsSinceEpoch;
174 }
175 toLocal() {
176 if (this.isUtc) {
177 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false});
178 }
179 return this;
180 }
181 toUtc() {
182 if (this.isUtc)
183 return this;
184 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch , {isUtc: true});
185 }
186 static _fourDigits(n) {
187 let absN = n.abs();
188 let sign = n < 0 ? "-" : "";
189 if (absN >= 1000)
190 return `${n}`;
191 if (absN >= 100)
192 return `${sign}0${absN}`;
193 if (absN >= 10)
194 return `${sign}00${absN}`;
195 return `${sign}000${absN}`;
196 }
197 static _sixDigits(n) {
198 dart.assert(dart.notNull(n < -9999) || dart.notNull(n > 9999));
199 let absN = n.abs();
200 let sign = n < 0 ? "-" : "+";
201 if (absN >= 100000)
202 return `${sign}${absN}`;
203 return `${sign}0${absN}`;
204 }
205 static _threeDigits(n) {
206 if (n >= 100)
207 return `${n}`;
208 if (n >= 10)
209 return `0${n}`;
210 return `00${n}`;
211 }
212 static _twoDigits(n) {
213 if (n >= 10)
214 return `${n}`;
215 return `0${n}`;
216 }
217 toString() {
218 let y = _fourDigits(this.year);
219 let m = _twoDigits(this.month);
220 let d = _twoDigits(this.day);
221 let h = _twoDigits(this.hour);
222 let min = _twoDigits(this.minute);
223 let sec = _twoDigits(this.second);
224 let ms = _threeDigits(this.millisecond);
225 if (this.isUtc) {
226 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`;
227 } else {
228 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`;
229 }
230 }
231 toIso8601String() {
232 let y = dart.notNull(this.year >= -9999) && dart.notNull(this.year <= 9999 ) ? _fourDigits(this.year) : _sixDigits(this.year);
233 let m = _twoDigits(this.month);
234 let d = _twoDigits(this.day);
235 let h = _twoDigits(this.hour);
236 let min = _twoDigits(this.minute);
237 let sec = _twoDigits(this.second);
238 let ms = _threeDigits(this.millisecond);
239 if (this.isUtc) {
240 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`;
241 } else {
242 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`;
243 }
244 }
245 add(duration) {
246 let ms = this.millisecondsSinceEpoch;
247 return new DateTime.fromMillisecondsSinceEpoch(ms + duration.inMillisecond s, {isUtc: this.isUtc});
248 }
249 subtract(duration) {
250 let ms = this.millisecondsSinceEpoch;
251 return new DateTime.fromMillisecondsSinceEpoch(ms - duration.inMillisecond s, {isUtc: this.isUtc});
252 }
253 difference(other) {
254 let ms = this.millisecondsSinceEpoch;
255 let otherMs = other.millisecondsSinceEpoch;
256 return new Duration({milliseconds: ms - otherMs});
257 }
258 DateTime$_internal(year, month, day, hour, minute, second, millisecond, isUt c) {
259 this.isUtc = dart.as(typeof isUtc == boolean ? isUtc : dart.throw_(new Arg umentError(isUtc)), bool);
260 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
261 }
262 DateTime$_now() {
263 this.isUtc = false;
264 this.millisecondsSinceEpoch = dart.notNull(_js_helper.Primitives.dateNow() );
265 }
266 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut e, second, millisecond, isUtc) {
267 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
268 }
269 get timeZoneName() {
270 if (this.isUtc)
271 return "UTC";
272 return _js_helper.Primitives.getTimeZoneName(this);
273 }
274 get timeZoneOffset() {
275 if (this.isUtc)
276 return new Duration();
277 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin utes(this)});
278 }
279 get year() {
280 return dart.as(_js_helper.Primitives.getYear(this), int);
281 }
282 get month() {
283 return dart.as(_js_helper.Primitives.getMonth(this), int);
284 }
285 get day() {
286 return dart.as(_js_helper.Primitives.getDay(this), int);
287 }
288 get hour() {
289 return dart.as(_js_helper.Primitives.getHours(this), int);
290 }
291 get minute() {
292 return dart.as(_js_helper.Primitives.getMinutes(this), int);
293 }
294 get second() {
295 return dart.as(_js_helper.Primitives.getSeconds(this), int);
296 }
297 get millisecond() {
298 return dart.as(_js_helper.Primitives.getMilliseconds(this), int);
299 }
300 get weekday() {
301 return dart.as(_js_helper.Primitives.getWeekday(this), int);
302 }
303 }
304 dart.defineNamedConstructor(DateTime, 'utc');
305 dart.defineNamedConstructor(DateTime, 'now');
306 dart.defineNamedConstructor(DateTime, 'fromMillisecondsSinceEpoch');
307 dart.defineNamedConstructor(DateTime, '_internal');
308 dart.defineNamedConstructor(DateTime, '_now');
309 DateTime.MONDAY = 1;
310 DateTime.TUESDAY = 2;
311 DateTime.WEDNESDAY = 3;
312 DateTime.THURSDAY = 4;
313 DateTime.FRIDAY = 5;
314 DateTime.SATURDAY = 6;
315 DateTime.SUNDAY = 7;
316 DateTime.DAYS_PER_WEEK = 7;
317 DateTime.JANUARY = 1;
318 DateTime.FEBRUARY = 2;
319 DateTime.MARCH = 3;
320 DateTime.APRIL = 4;
321 DateTime.MAY = 5;
322 DateTime.JUNE = 6;
323 DateTime.JULY = 7;
324 DateTime.AUGUST = 8;
325 DateTime.SEPTEMBER = 9;
326 DateTime.OCTOBER = 10;
327 DateTime.NOVEMBER = 11;
328 DateTime.DECEMBER = 12;
329 DateTime.MONTHS_PER_YEAR = 12;
330 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
331 class double extends num {
332 static parse(source, onError) {
333 if (onError === void 0)
334 onError = null;
335 return _js_helper.Primitives.parseDouble(source, onError);
336 }
337 }
338 double.NAN = 0.0 / 0.0;
339 double.INFINITY = 1.0 / 0.0;
340 double.NEGATIVE_INFINITY = -INFINITY;
341 double.MIN_POSITIVE = 5e-324;
342 double.MAX_FINITE = 1.7976931348623157e+308;
343 class Duration extends dart.Object {
344 Duration(opt$) {
345 let days = opt$.days === void 0 ? 0 : opt$.days;
346 let hours = opt$.hours === void 0 ? 0 : opt$.hours;
347 let minutes = opt$.minutes === void 0 ? 0 : opt$.minutes;
348 let seconds = opt$.seconds === void 0 ? 0 : opt$.seconds;
349 let milliseconds = opt$.milliseconds === void 0 ? 0 : opt$.milliseconds;
350 let microseconds = opt$.microseconds === void 0 ? 0 : opt$.microseconds;
351 this.Duration$_microseconds(days * MICROSECONDS_PER_DAY + hours * MICROSEC ONDS_PER_HOUR + minutes * MICROSECONDS_PER_MINUTE + seconds * MICROSECONDS_PER_S ECOND + milliseconds * MICROSECONDS_PER_MILLISECOND + microseconds);
352 }
353 Duration$_microseconds(_duration) {
354 this._duration = _duration;
355 }
356 ['+'](other) {
357 return new Duration._microseconds(this._duration + other._duration);
358 }
359 ['-'](other) {
360 return new Duration._microseconds(this._duration - other._duration);
361 }
362 ['*'](factor) {
363 return new Duration._microseconds((this._duration * dart.notNull(factor)). round());
364 }
365 ['~/'](quotient) {
366 if (quotient === 0)
367 throw new IntegerDivisionByZeroException();
368 return new Duration._microseconds((this._duration / quotient).truncate());
369 }
370 ['<'](other) {
371 return this._duration < other._duration;
372 }
373 ['>'](other) {
374 return this._duration > other._duration;
375 }
376 ['<='](other) {
377 return this._duration <= other._duration;
378 }
379 ['>='](other) {
380 return this._duration >= other._duration;
381 }
382 get inDays() {
383 return (this._duration / Duration.MICROSECONDS_PER_DAY).truncate();
384 }
385 get inHours() {
386 return (this._duration / Duration.MICROSECONDS_PER_HOUR).truncate();
387 }
388 get inMinutes() {
389 return (this._duration / Duration.MICROSECONDS_PER_MINUTE).truncate();
390 }
391 get inSeconds() {
392 return (this._duration / Duration.MICROSECONDS_PER_SECOND).truncate();
393 }
394 get inMilliseconds() {
395 return (this._duration / Duration.MICROSECONDS_PER_MILLISECOND).truncate() ;
396 }
397 get inMicroseconds() {
398 return this._duration;
399 }
400 ['=='](other) {
401 if (!dart.is(other, Duration))
402 return false;
403 return this._duration === dart.dload(other, '_duration');
404 }
405 get hashCode() {
406 return this._duration.hashCode;
407 }
408 compareTo(other) {
409 return this._duration.compareTo(other._duration);
410 }
411 toString() {
412 // Function sixDigits: (int) → String
413 function sixDigits(n) {
414 if (n >= 100000)
415 return `${n}`;
416 if (n >= 10000)
417 return `0${n}`;
418 if (n >= 1000)
419 return `00${n}`;
420 if (n >= 100)
421 return `000${n}`;
422 if (n >= 10)
423 return `0000${n}`;
424 return `00000${n}`;
425 }
426 // Function twoDigits: (int) → String
427 function twoDigits(n) {
428 if (n >= 10)
429 return `${n}`;
430 return `0${n}`;
431 }
432 if (this.inMicroseconds < 0) {
433 return `-${dart.throw_("Unimplemented PrefixExpression: -this")}`;
434 }
435 let twoDigitMinutes = twoDigits(dart.notNull(this.inMinutes.remainder(MINU TES_PER_HOUR)));
436 let twoDigitSeconds = twoDigits(dart.notNull(this.inSeconds.remainder(SECO NDS_PER_MINUTE)));
437 let sixDigitUs = sixDigits(dart.notNull(this.inMicroseconds.remainder(MICR OSECONDS_PER_SECOND)));
438 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs }`;
439 }
440 get isNegative() {
441 return this._duration < 0;
442 }
443 abs() {
444 return new Duration._microseconds(this._duration.abs());
445 }
446 ['-']() {
447 return new Duration._microseconds(-this._duration);
448 }
449 }
450 dart.defineNamedConstructor(Duration, '_microseconds');
451 Duration.MICROSECONDS_PER_MILLISECOND = 1000;
452 Duration.MILLISECONDS_PER_SECOND = 1000;
453 Duration.SECONDS_PER_MINUTE = 60;
454 Duration.MINUTES_PER_HOUR = 60;
455 Duration.HOURS_PER_DAY = 24;
456 Duration.MICROSECONDS_PER_SECOND = MICROSECONDS_PER_MILLISECOND * MILLISECONDS _PER_SECOND;
457 Duration.MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * SECONDS_PER_MINUT E;
458 Duration.MICROSECONDS_PER_HOUR = MICROSECONDS_PER_MINUTE * MINUTES_PER_HOUR;
459 Duration.MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY;
460 Duration.MILLISECONDS_PER_MINUTE = MILLISECONDS_PER_SECOND * SECONDS_PER_MINUT E;
461 Duration.MILLISECONDS_PER_HOUR = MILLISECONDS_PER_MINUTE * MINUTES_PER_HOUR;
462 Duration.MILLISECONDS_PER_DAY = MILLISECONDS_PER_HOUR * HOURS_PER_DAY;
463 Duration.SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
464 Duration.SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
465 Duration.MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
466 Duration.ZERO = new Duration({seconds: 0});
467 class Error extends dart.Object {
468 Error() {
469 }
470 static safeToString(object) {
471 if (dart.notNull(dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == boolean)) || dart.notNull(null === object)) {
472 return object.toString();
473 }
474 if (typeof object == string) {
475 return _stringToSafeString(object);
476 }
477 return _objectToString(object);
478 }
479 static _stringToSafeString(string) {
480 return _js_helper.jsonEncodeNative(string);
481 }
482 static _objectToString(object) {
483 return _js_helper.Primitives.objectToString(object);
484 }
485 get stackTrace() {
486 return _js_helper.Primitives.extractStackTrace(this);
487 }
488 }
489 class AssertionError extends Error {
490 }
491 class TypeError extends AssertionError {
492 }
493 class CastError extends Error {
494 }
495 class NullThrownError extends Error {
496 toString() {
497 return "Throw of null.";
498 }
499 }
500 class ArgumentError extends Error {
501 ArgumentError(message) {
502 if (message === void 0)
503 message = null;
504 this.message = message;
505 this.invalidValue = null;
506 this._hasValue = false;
507 this.name = null;
508 super.Error();
509 }
510 ArgumentError$value(value, name, message) {
511 if (name === void 0)
512 name = null;
513 if (message === void 0)
514 message = "Invalid argument";
515 this.name = name;
516 this.message = message;
517 this.invalidValue = value;
518 this._hasValue = true;
519 super.Error();
520 }
521 ArgumentError$notNull(name) {
522 if (name === void 0)
523 name = null;
524 this.ArgumentError$value(null, name, "Must not be null");
525 }
526 toString() {
527 if (!dart.notNull(this._hasValue)) {
528 let result = "Invalid arguments(s)";
529 if (this.message !== null) {
530 result = `${result}: ${this.message}`;
531 }
532 return result;
533 }
534 let nameString = "";
535 if (this.name !== null) {
536 nameString = ` (${this.name})`;
537 }
538 return `${this.message}${nameString}: ${Error.safeToString(this.invalidVal ue)}`;
539 }
540 }
541 dart.defineNamedConstructor(ArgumentError, 'value');
542 dart.defineNamedConstructor(ArgumentError, 'notNull');
543 class RangeError extends ArgumentError {
544 RangeError(message) {
545 this.start = null;
546 this.end = null;
547 super.ArgumentError(message);
548 }
549 RangeError$value(value, name, message) {
550 if (name === void 0)
551 name = null;
552 if (message === void 0)
553 message = null;
554 this.start = null;
555 this.end = null;
556 super.ArgumentError$value(value, name, message !== null ? message : "Value not in range");
557 }
558 RangeError$range(invalidValue, minValue, maxValue, name, message) {
559 if (name === void 0)
560 name = null;
561 if (message === void 0)
562 message = null;
563 this.start = minValue;
564 this.end = maxValue;
565 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Invalid value");
566 }
567 RangeError$index(index, indexable, name, message, length) {
568 return new IndexError(index, indexable, name, message, length);
569 }
570 static checkValueInInterval(value, minValue, maxValue, name, message) {
571 if (name === void 0)
572 name = null;
573 if (message === void 0)
574 message = null;
575 if (dart.notNull(value < minValue) || dart.notNull(value > maxValue)) {
576 throw new RangeError.range(value, minValue, maxValue, name, message);
577 }
578 }
579 static checkValidIndex(index, indexable, name, length, message) {
580 if (name === void 0)
581 name = null;
582 if (length === void 0)
583 length = null;
584 if (message === void 0)
585 message = null;
586 if (length === null)
587 length = dart.as(dart.dload(indexable, 'length'), int);
588 if (dart.notNull(index < 0) || dart.notNull(index >= length)) {
589 if (name === null)
590 name = "index";
591 throw new RangeError.index(index, indexable, name, message, length);
592 }
593 }
594 static checkValidRange(start, end, length, startName, endName, message) {
595 if (startName === void 0)
596 startName = null;
597 if (endName === void 0)
598 endName = null;
599 if (message === void 0)
600 message = null;
601 if (dart.notNull(start < 0) || dart.notNull(start > length)) {
602 if (startName === null)
603 startName = "start";
604 throw new RangeError.range(start, 0, length, startName, message);
605 }
606 if (dart.notNull(end !== null) && dart.notNull(dart.notNull(end < start) | | dart.notNull(end > length))) {
607 if (endName === null)
608 endName = "end";
609 throw new RangeError.range(end, start, length, endName, message);
610 }
611 }
612 static checkNotNegative(value, name, message) {
613 if (name === void 0)
614 name = null;
615 if (message === void 0)
616 message = null;
617 if (value < 0)
618 throw new RangeError.range(value, 0, dart.as(null, int), name, message);
619 }
620 toString() {
621 if (!dart.notNull(this._hasValue))
622 return `RangeError: ${this.message}`;
623 let value = Error.safeToString(this.invalidValue);
624 let explanation = "";
625 if (this.start === null) {
626 if (this.end !== null) {
627 explanation = `: Not less than or equal to ${this.end}`;
628 }
629 } else if (this.end === null) {
630 explanation = `: Not greater than or equal to ${this.start}`;
631 } else if (dart.notNull(this.end) > dart.notNull(this.start)) {
632 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`;
633 } else if (dart.notNull(this.end) < dart.notNull(this.start)) {
634 explanation = ": Valid value range is empty";
635 } else {
636 explanation = `: Only valid value is ${this.start}`;
637 }
638 return `RangeError: ${this.message} (${value})${explanation}`;
639 }
640 }
641 dart.defineNamedConstructor(RangeError, 'value');
642 dart.defineNamedConstructor(RangeError, 'range');
643 dart.defineNamedConstructor(RangeError, 'index');
644 class IndexError extends ArgumentError {
645 IndexError(invalidValue, indexable, name, message, length) {
646 if (name === void 0)
647 name = null;
648 if (message === void 0)
649 message = null;
650 if (length === void 0)
651 length = null;
652 this.indexable = indexable;
653 this.length = dart.as(length !== null ? length : dart.dload(indexable, 'le ngth'), int);
654 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Index out of range");
655 }
656 get start() {
657 return 0;
658 }
659 get end() {
660 return this.length - 1;
661 }
662 toString() {
663 dart.assert(this._hasValue);
664 let target = Error.safeToString(this.indexable);
665 let explanation = `index should be less than ${this.length}`;
666 if (dart.dbinary(this.invalidValue, '<', 0)) {
667 explanation = "index must not be negative";
668 }
669 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e xplanation}`;
670 }
671 }
672 class FallThroughError extends Error {
673 FallThroughError() {
674 super.Error();
675 }
676 }
677 class AbstractClassInstantiationError extends Error {
678 AbstractClassInstantiationError(_className) {
679 this._className = _className;
680 super.Error();
681 }
682 toString() {
683 return `Cannot instantiate abstract class: '${this._className}'`;
684 }
685 }
686 class NoSuchMethodError extends Error {
687 NoSuchMethodError(receiver, memberName, positionalArguments, namedArguments, existingArgumentNames) {
688 if (existingArgumentNames === void 0)
689 existingArgumentNames = null;
690 this._receiver = receiver;
691 this._memberName = memberName;
692 this._arguments = positionalArguments;
693 this._namedArguments = namedArguments;
694 this._existingArgumentNames = existingArgumentNames;
695 super.Error();
696 }
697 toString() {
698 let sb = new StringBuffer();
699 let i = 0;
700 if (this._arguments !== null) {
701 for (; i < this._arguments.length; i++) {
702 if (i > 0) {
703 sb.write(", ");
704 }
705 sb.write(Error.safeToString(this._arguments.get(i)));
706 }
707 }
708 if (this._namedArguments !== null) {
709 this._namedArguments.forEach(((key, value) => {
710 if (i > 0) {
711 sb.write(", ");
712 }
713 sb.write(_symbolToString(key));
714 sb.write(": ");
715 sb.write(Error.safeToString(value));
716 i++;
717 }).bind(this));
718 }
719 if (this._existingArgumentNames === null) {
720 return `NoSuchMethodError : method not found: '${this._memberName}'\n` + `Receiver: ${Error.safeToString(this._receiver)}\n` + `Arguments: [${sb}]`;
721 } else {
722 let actualParameters = sb.toString();
723 sb = new StringBuffer();
724 for (let i = 0; i < this._existingArgumentNames.length; i++) {
725 if (i > 0) {
726 sb.write(", ");
727 }
728 sb.write(this._existingArgumentNames.get(i));
729 }
730 let formalParameters = sb.toString();
731 return "NoSuchMethodError: incorrect number of arguments passed to " + ` method named '${this._memberName}'\n` + `Receiver: ${Error.safeToString(this._re ceiver)}\n` + `Tried calling: ${this._memberName}(${actualParameters})\n` + `Fou nd: ${this._memberName}(${formalParameters})`;
732 }
733 }
734 }
735 class UnsupportedError extends Error {
736 UnsupportedError(message) {
737 this.message = message;
738 super.Error();
739 }
740 toString() {
741 return `Unsupported operation: ${this.message}`;
742 }
743 }
744 class UnimplementedError extends Error {
745 UnimplementedError(message) {
746 if (message === void 0)
747 message = null;
748 this.message = message;
749 super.Error();
750 }
751 toString() {
752 return this.message !== null ? `UnimplementedError: ${this.message}` : "Un implementedError";
753 }
754 }
755 class StateError extends Error {
756 StateError(message) {
757 this.message = message;
758 super.Error();
759 }
760 toString() {
761 return `Bad state: ${this.message}`;
762 }
763 }
764 class ConcurrentModificationError extends Error {
765 ConcurrentModificationError(modifiedObject) {
766 if (modifiedObject === void 0)
767 modifiedObject = null;
768 this.modifiedObject = modifiedObject;
769 super.Error();
770 }
771 toString() {
772 if (this.modifiedObject === null) {
773 return "Concurrent modification during iteration.";
774 }
775 return "Concurrent modification during iteration: " + `${Error.safeToStrin g(this.modifiedObject)}.`;
776 }
777 }
778 class OutOfMemoryError extends dart.Object {
779 OutOfMemoryError() {
780 }
781 toString() {
782 return "Out of Memory";
783 }
784 get stackTrace() {
785 return null;
786 }
787 }
788 class StackOverflowError extends dart.Object {
789 StackOverflowError() {
790 }
791 toString() {
792 return "Stack Overflow";
793 }
794 get stackTrace() {
795 return null;
796 }
797 }
798 class CyclicInitializationError extends Error {
799 CyclicInitializationError(variableName) {
800 if (variableName === void 0)
801 variableName = null;
802 this.variableName = variableName;
803 super.Error();
804 }
805 toString() {
806 return this.variableName === null ? "Reading static variable during its in itialization" : `Reading static variable '${this.variableName}' during its initi alization`;
807 }
808 }
809 class Exception extends dart.Object {
810 Exception(message) {
811 if (message === void 0)
812 message = null;
813 return new _ExceptionImplementation(message);
814 }
815 }
816 class _ExceptionImplementation extends dart.Object {
817 _ExceptionImplementation(message) {
818 if (message === void 0)
819 message = null;
820 this.message = message;
821 }
822 toString() {
823 if (this.message === null)
824 return "Exception";
825 return `Exception: ${this.message}`;
826 }
827 }
828 class FormatException extends dart.Object {
829 FormatException(message, source, offset) {
830 if (message === void 0)
831 message = "";
832 if (source === void 0)
833 source = null;
834 if (offset === void 0)
835 offset = -1;
836 this.message = message;
837 this.source = source;
838 this.offset = offset;
839 }
840 toString() {
841 let report = "FormatException";
842 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) {
843 report = `${report}: ${this.message}`;
844 }
845 let offset = this.offset;
846 if (!(typeof this.source == string)) {
847 if (offset !== -1) {
848 report = ` (at offset ${offset})`;
849 }
850 return report;
851 }
852 if (dart.notNull(offset !== -1) && dart.notNull(dart.notNull(offset < 0) | | dart.notNull(offset['>'](dart.dload(this.source, 'length'))))) {
853 offset = -1;
854 }
855 if (offset === -1) {
856 let source = dart.as(this.source, String);
857 if (source.length > 78) {
858 source = String['+'](source.substring(0, 75), "...");
859 }
860 return `${report}\n${source}`;
861 }
862 let lineNum = 1;
863 let lineStart = 0;
864 let lastWasCR = null;
865 for (let i = 0; i < offset; i++) {
866 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
867 if (char === 10) {
868 if (dart.notNull(lineStart !== i) || dart.notNull(!dart.notNull(lastWa sCR))) {
869 lineNum++;
870 }
871 lineStart = i + 1;
872 lastWasCR = false;
873 } else if (char === 13) {
874 lineNum++;
875 lineStart = i + 1;
876 lastWasCR = true;
877 }
878 }
879 if (lineNum > 1) {
880 report = ` (at line ${lineNum}, character ${offset - lineStart + 1})\n`;
881 } else {
882 report = ` (at character ${offset + 1})\n`;
883 }
884 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
885 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i++) {
886 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
887 if (dart.notNull(char === 10) || dart.notNull(char === 13)) {
888 lineEnd = i;
889 break;
890 }
891 }
892 let length = lineEnd - lineStart;
893 let start = lineStart;
894 let end = lineEnd;
895 let prefix = "";
896 let postfix = "";
897 if (length > 78) {
898 let index = offset - lineStart;
899 if (index < 75) {
900 end = start + 75;
901 postfix = "...";
902 } else if (end - offset < 75) {
903 start = end - 75;
904 prefix = "...";
905 } else {
906 start = offset - 36;
907 end = offset + 36;
908 prefix = postfix = "...";
909 }
910 }
911 let slice = dart.as(dart.dinvoke(this.source, 'substring', start, end), St ring);
912 let markOffset = offset - start + prefix.length;
913 return `${report}${prefix}${slice}${postfix}\n${String['*'](" ", markOffse t)}^\n`;
914 }
915 }
916 class IntegerDivisionByZeroException extends dart.Object {
917 IntegerDivisionByZeroException() {
918 }
919 toString() {
920 return "IntegerDivisionByZeroException";
921 }
922 }
923 let Expando$ = dart.generic(function(T) {
924 class Expando extends dart.Object {
925 Expando(name) {
926 if (name === void 0)
927 name = null;
928 this.name = name;
929 }
930 toString() {
931 return `Expando:${this.name}`;
932 }
933 get(object) {
934 let values = _js_helper.Primitives.getProperty(object, _EXPANDO_PROPERTY _NAME);
935 return dart.as(values === null ? null : _js_helper.Primitives.getPropert y(values, this._getKey()), T);
936 }
937 set(object, value) {
938 let values = _js_helper.Primitives.getProperty(object, _EXPANDO_PROPERTY _NAME);
939 if (values === null) {
940 values = new Object();
941 _js_helper.Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, valu es);
942 }
943 _js_helper.Primitives.setProperty(values, this._getKey(), value);
944 }
945 _getKey() {
946 let key = dart.as(_js_helper.Primitives.getProperty(this, _KEY_PROPERTY_ NAME), String);
947 if (key === null) {
948 key = `expando$key$${_keyCount++}`;
949 _js_helper.Primitives.setProperty(this, _KEY_PROPERTY_NAME, key);
950 }
951 return key;
952 }
953 }
954 Expando._KEY_PROPERTY_NAME = 'expando$key';
955 Expando._EXPANDO_PROPERTY_NAME = 'expando$values';
956 Expando._keyCount = 0;
957 return Expando;
958 });
959 let Expando = Expando$(dynamic);
960 class Function extends dart.Object {
961 static apply(function, positionalArguments, namedArguments) {
962 if (namedArguments === void 0)
963 namedArguments = null;
964 return _js_helper.Primitives.applyFunction(function, positionalArguments, dart.as(namedArguments === null ? null : _toMangledNames(namedArguments), Map$(S tring, dynamic)));
965 }
966 static _toMangledNames(namedArguments) {
967 let result = dart.as(dart.map(), Map$(String, dynamic));
968 namedArguments.forEach((symbol, value) => {
969 result.set(_symbolToString(dart.as(symbol, Symbol)), value);
970 });
971 return result;
972 }
973 }
974 // Function identical: (Object, Object) → bool
975 function identical(a, b) {
976 return _js_helper.Primitives.identicalImplementation(a, b);
977 }
978 // Function identityHashCode: (Object) → int
979 function identityHashCode(object) {
980 return _js_helper.objectHashCode(object);
981 }
982 class int extends num {
983 int$fromEnvironment(name, opt$) {
984 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultValue ;
985 throw new UnsupportedError('int.fromEnvironment can only be used as a cons t constructor');
986 }
987 static parse(source, opt$) {
988 let radix = opt$.radix === void 0 ? null : opt$.radix;
989 let onError = opt$.onError === void 0 ? null : opt$.onError;
990 return _js_helper.Primitives.parseInt(source, radix, onError);
991 }
992 }
993 dart.defineNamedConstructor(int, 'fromEnvironment');
994 class Invocation extends dart.Object {
995 get isAccessor() {
996 return dart.notNull(this.isGetter) || dart.notNull(this.isSetter);
997 }
998 }
999 let Iterable$ = dart.generic(function(E) {
1000 class Iterable extends dart.Object {
1001 Iterable() {
1002 }
1003 Iterable$generate(count, generator) {
1004 if (generator === void 0)
1005 generator = null;
1006 if (count <= 0)
1007 return new _internal.EmptyIterable();
1008 return new _GeneratorIterable(count, generator);
1009 }
1010 join(separator) {
1011 if (separator === void 0)
1012 separator = "";
1013 let buffer = new StringBuffer();
1014 buffer.writeAll(this, separator);
1015 return buffer.toString();
1016 }
1017 [Symbol.iterator]() {
1018 var iterator = this.iterator;
1019 return {
1020 next() {
1021 var done = iterator.moveNext();
1022 return {done: done, current: done ? void 0 : iterator.current};
1023 }
1024 };
1025 }
1026 }
1027 dart.defineNamedConstructor(Iterable, 'generate');
1028 return Iterable;
1029 });
1030 let Iterable = Iterable$(dynamic);
1031 let _GeneratorIterable$ = dart.generic(function(E) {
1032 class _GeneratorIterable extends collection.IterableBase$(E) {
1033 _GeneratorIterable(_end, generator) {
1034 this._end = _end;
1035 this._start = 0;
1036 this._generator = dart.as(generator !== null ? generator : _id, _Generat or);
1037 super.IterableBase();
1038 }
1039 _GeneratorIterable$slice(_start, _end, _generator) {
1040 this._start = _start;
1041 this._end = _end;
1042 this._generator = _generator;
1043 super.IterableBase();
1044 }
1045 get iterator() {
1046 return new _GeneratorIterator(this._start, this._end, this._generator);
1047 }
1048 get length() {
1049 return this._end - this._start;
1050 }
1051 skip(count) {
1052 RangeError.checkNotNegative(count, "count");
1053 if (count === 0)
1054 return this;
1055 let newStart = this._start + count;
1056 if (newStart >= this._end)
1057 return new _internal.EmptyIterable();
1058 return new _GeneratorIterable.slice(newStart, this._end, this._generator );
1059 }
1060 take(count) {
1061 RangeError.checkNotNegative(count, "count");
1062 if (count === 0)
1063 return new _internal.EmptyIterable();
1064 let newEnd = this._start + count;
1065 if (newEnd >= this._end)
1066 return this;
1067 return new _GeneratorIterable.slice(this._start, newEnd, this._generator );
1068 }
1069 static _id(n) {
1070 return n;
1071 }
1072 }
1073 dart.defineNamedConstructor(_GeneratorIterable, 'slice');
1074 return _GeneratorIterable;
1075 });
1076 let _GeneratorIterable = _GeneratorIterable$(dynamic);
1077 let _GeneratorIterator$ = dart.generic(function(E) {
1078 class _GeneratorIterator extends dart.Object {
1079 _GeneratorIterator(_index, _end, _generator) {
1080 this._index = _index;
1081 this._end = _end;
1082 this._generator = _generator;
1083 this._current = dart.as(null, E);
1084 }
1085 moveNext() {
1086 if (this._index < this._end) {
1087 this._current = this._generator(this._index);
1088 this._index++;
1089 return true;
1090 } else {
1091 this._current = dart.as(null, E);
1092 return false;
1093 }
1094 }
1095 get current() {
1096 return this._current;
1097 }
1098 }
1099 return _GeneratorIterator;
1100 });
1101 let _GeneratorIterator = _GeneratorIterator$(dynamic);
1102 let BidirectionalIterator$ = dart.generic(function(E) {
1103 class BidirectionalIterator extends dart.Object {
1104 }
1105 return BidirectionalIterator;
1106 });
1107 let BidirectionalIterator = BidirectionalIterator$(dynamic);
1108 let Iterator$ = dart.generic(function(E) {
1109 class Iterator extends dart.Object {
1110 }
1111 return Iterator;
1112 });
1113 let Iterator = Iterator$(dynamic);
1114 let List$ = dart.generic(function(E) {
1115 class List extends dart.Object {
1116 List(length) {
1117 if (length === void 0)
1118 length = new _ListConstructorSentinel();
1119 if (length === new _ListConstructorSentinel()) {
1120 return new _interceptors.JSArray.emptyGrowable();
1121 }
1122 return new _interceptors.JSArray.fixed(length);
1123 }
1124 List$filled(length, fill) {
1125 let result = new _interceptors.JSArray.fixed(length);
1126 if (dart.notNull(length !== 0) && dart.notNull(fill !== null)) {
1127 for (let i = 0; i < result.length; i++) {
1128 result.set(i, fill);
1129 }
1130 }
1131 return dart.as(result, List$(E));
1132 }
1133 List$from(elements, opt$) {
1134 let growable = opt$.growable === void 0 ? true : opt$.growable;
1135 let list = new List();
1136 for (let e of elements) {
1137 list.add(e);
1138 }
1139 if (growable)
1140 return list;
1141 return dart.as(_internal.makeListFixedLength(list), List$(E));
1142 }
1143 List$generate(length, generator, opt$) {
1144 let growable = opt$.growable === void 0 ? true : opt$.growable;
1145 let result = null;
1146 if (growable) {
1147 result = ((_) => {
1148 _.length = length;
1149 return _;
1150 }).bind(this)(new List.from([]));
1151 } else {
1152 result = new List(length);
1153 }
1154 for (let i = 0; i < length; i++) {
1155 result.set(i, generator(i));
1156 }
1157 return result;
1158 }
1159 }
1160 dart.defineNamedConstructor(List, 'filled');
1161 dart.defineNamedConstructor(List, 'from');
1162 dart.defineNamedConstructor(List, 'generate');
1163 return List;
1164 });
1165 let List = List$(dynamic);
1166 let Map$ = dart.generic(function(K, V) {
1167 class Map extends dart.Object {
1168 Map() {
1169 return new collection.LinkedHashMap();
1170 }
1171 Map$from(other) {
1172 return new collection.LinkedHashMap.from(other);
1173 }
1174 Map$identity() {
1175 return new collection.LinkedHashMap.identity();
1176 }
1177 Map$fromIterable(iterable, opt$) {
1178 return new collection.LinkedHashMap.fromIterable(iterable, opt$);
1179 }
1180 Map$fromIterables(keys, values) {
1181 return new collection.LinkedHashMap.fromIterables(keys, values);
1182 }
1183 }
1184 dart.defineNamedConstructor(Map, 'from');
1185 dart.defineNamedConstructor(Map, 'identity');
1186 dart.defineNamedConstructor(Map, 'fromIterable');
1187 dart.defineNamedConstructor(Map, 'fromIterables');
1188 return Map;
1189 });
1190 let Map = Map$(dynamic, dynamic);
1191 class Null extends dart.Object {
1192 Null$_uninstantiable() {
1193 throw new UnsupportedError('class Null cannot be instantiated');
1194 }
1195 toString() {
1196 return "null";
1197 }
1198 }
1199 dart.defineNamedConstructor(Null, '_uninstantiable');
1200 class num extends dart.Object {
1201 static parse(input, onError) {
1202 if (onError === void 0)
1203 onError = null;
1204 let source = input.trim();
1205 _parseError = false;
1206 let result = int.parse(source, {onError: _onParseErrorInt});
1207 if (!dart.notNull(_parseError))
1208 return result;
1209 _parseError = false;
1210 result = double.parse(source, _onParseErrorDouble);
1211 if (!dart.notNull(_parseError))
1212 return result;
1213 if (onError === null)
1214 throw new FormatException(input);
1215 return onError(input);
1216 }
1217 static _onParseErrorInt(_) {
1218 _parseError = true;
1219 return 0;
1220 }
1221 static _onParseErrorDouble(_) {
1222 _parseError = true;
1223 return 0.0;
1224 }
1225 }
1226 num._parseError = false;
1227 class Object extends dart.Object {
1228 Object() {
1229 }
1230 ['=='](other) {
1231 return identical(this, other);
1232 }
1233 get hashCode() {
1234 return _js_helper.Primitives.objectHashCode(this);
1235 }
1236 toString() {
1237 return _js_helper.Primitives.objectToString(this);
1238 }
1239 noSuchMethod(invocation) {
1240 throw new NoSuchMethodError(this, invocation.memberName, invocation.positi onalArguments, invocation.namedArguments);
1241 }
1242 get runtimeType() {
1243 return _js_helper.getRuntimeType(this);
1244 }
1245 }
1246 class Pattern extends dart.Object {
1247 }
1248 // Function print: (Object) → void
1249 function print(object) {
1250 let line = `${object}`;
1251 if (_internal.printToZone === null) {
1252 _internal.printToConsole(line);
1253 } else {
1254 dart.dinvokef(_internal.printToZone, line);
1255 }
1256 }
1257 class Match extends dart.Object {
1258 }
1259 class RegExp extends dart.Object {
1260 RegExp(source, opt$) {
1261 let multiLine = opt$.multiLine === void 0 ? false : opt$.multiLine;
1262 let caseSensitive = opt$.caseSensitive === void 0 ? true : opt$.caseSensit ive;
1263 return new _js_helper.JSSyntaxRegExp(source, {multiLine: multiLine, caseSe nsitive: caseSensitive});
1264 }
1265 }
1266 let Set$ = dart.generic(function(E) {
1267 class Set extends collection.IterableBase$(E) {
1268 Set() {
1269 return new collection.LinkedHashSet();
1270 }
1271 Set$identity() {
1272 return new collection.LinkedHashSet.identity();
1273 }
1274 Set$from(elements) {
1275 return new collection.LinkedHashSet.from(elements);
1276 }
1277 }
1278 dart.defineNamedConstructor(Set, 'identity');
1279 dart.defineNamedConstructor(Set, 'from');
1280 return Set;
1281 });
1282 let Set = Set$(dynamic);
1283 let Sink$ = dart.generic(function(T) {
1284 class Sink extends dart.Object {
1285 }
1286 return Sink;
1287 });
1288 let Sink = Sink$(dynamic);
1289 class StackTrace extends dart.Object {
1290 }
1291 class Stopwatch extends dart.Object {
1292 get frequency() {
1293 return _frequency;
1294 }
1295 Stopwatch() {
1296 this._start = null;
1297 this._stop = null;
1298 _initTicker();
1299 }
1300 start() {
1301 if (this.isRunning)
1302 return;
1303 if (this._start === null) {
1304 this._start = _now();
1305 } else {
1306 this._start = _now() - dart.notNull(dart.notNull(this._stop) - dart.notN ull(this._start));
1307 this._stop = null;
1308 }
1309 }
1310 stop() {
1311 if (!dart.notNull(this.isRunning))
1312 return;
1313 this._stop = _now();
1314 }
1315 reset() {
1316 if (this._start === null)
1317 return;
1318 this._start = _now();
1319 if (this._stop !== null) {
1320 this._stop = this._start;
1321 }
1322 }
1323 get elapsedTicks() {
1324 if (this._start === null) {
1325 return 0;
1326 }
1327 return dart.notNull(this._stop === null ? _now() - dart.notNull(this._star t) : dart.notNull(this._stop) - dart.notNull(this._start));
1328 }
1329 get elapsed() {
1330 return new Duration({microseconds: this.elapsedMicroseconds});
1331 }
1332 get elapsedMicroseconds() {
1333 return (this.elapsedTicks * 1000000 / this.frequency).truncate();
1334 }
1335 get elapsedMilliseconds() {
1336 return (this.elapsedTicks * 1000 / this.frequency).truncate();
1337 }
1338 get isRunning() {
1339 return dart.notNull(this._start !== null) && dart.notNull(this._stop === n ull);
1340 }
1341 static _initTicker() {
1342 _js_helper.Primitives.initTicker();
1343 _frequency = _js_helper.Primitives.timerFrequency;
1344 }
1345 static _now() {
1346 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int);
1347 }
1348 }
1349 Stopwatch._frequency = null;
1350 class String extends dart.Object {
1351 String$fromCharCodes(charCodes, start, end) {
1352 if (start === void 0)
1353 start = 0;
1354 if (end === void 0)
1355 end = null;
1356 if (!dart.is(charCodes, _interceptors.JSArray)) {
1357 return _stringFromIterable(charCodes, start, end);
1358 }
1359 let list = dart.as(charCodes, List);
1360 let len = list.length;
1361 if (dart.notNull(start < 0) || dart.notNull(start > len)) {
1362 throw new RangeError.range(start, 0, len);
1363 }
1364 if (end === null) {
1365 end = len;
1366 } else if (dart.notNull(end < start) || dart.notNull(end > len)) {
1367 throw new RangeError.range(end, start, len);
1368 }
1369 if (dart.notNull(start > 0) || dart.notNull(end < len)) {
1370 list = list.sublist(start, end);
1371 }
1372 return _js_helper.Primitives.stringFromCharCodes(list);
1373 }
1374 String$fromCharCode(charCode) {
1375 return _js_helper.Primitives.stringFromCharCode(charCode);
1376 }
1377 String$fromEnvironment(name, opt$) {
1378 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultValue ;
1379 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor');
1380 }
1381 static _stringFromIterable(charCodes, start, end) {
1382 if (start < 0)
1383 throw new RangeError.range(start, 0, charCodes.length);
1384 if (dart.notNull(end !== null) && dart.notNull(end < start)) {
1385 throw new RangeError.range(end, start, charCodes.length);
1386 }
1387 let it = charCodes.iterator;
1388 for (let i = 0; i < start; i++) {
1389 if (!dart.notNull(it.moveNext())) {
1390 throw new RangeError.range(start, 0, i);
1391 }
1392 }
1393 let list = new List.from([]);
1394 if (end === null) {
1395 while (it.moveNext())
1396 list.add(it.current);
1397 } else {
1398 for (let i = start; i < end; i++) {
1399 if (!dart.notNull(it.moveNext())) {
1400 throw new RangeError.range(end, start, i);
1401 }
1402 list.add(it.current);
1403 }
1404 }
1405 return _js_helper.Primitives.stringFromCharCodes(list);
1406 }
1407 }
1408 dart.defineNamedConstructor(String, 'fromCharCodes');
1409 dart.defineNamedConstructor(String, 'fromCharCode');
1410 dart.defineNamedConstructor(String, 'fromEnvironment');
1411 class Runes extends collection.IterableBase$(int) {
1412 Runes(string) {
1413 this.string = string;
1414 super.IterableBase();
1415 }
1416 get iterator() {
1417 return new RuneIterator(this.string);
1418 }
1419 get last() {
1420 if (this.string.length === 0) {
1421 throw new StateError('No elements.');
1422 }
1423 let length = this.string.length;
1424 let code = this.string.codeUnitAt(length - 1);
1425 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.leng th > 1)) {
1426 let previousCode = this.string.codeUnitAt(length - 2);
1427 if (_isLeadSurrogate(previousCode)) {
1428 return _combineSurrogatePair(previousCode, code);
1429 }
1430 }
1431 return code;
1432 }
1433 }
1434 // Function _isLeadSurrogate: (int) → bool
1435 function _isLeadSurrogate(code) {
1436 return (code & 64512) === 55296;
1437 }
1438 // Function _isTrailSurrogate: (int) → bool
1439 function _isTrailSurrogate(code) {
1440 return (code & 64512) === 56320;
1441 }
1442 // Function _combineSurrogatePair: (int, int) → int
1443 function _combineSurrogatePair(start, end) {
1444 return 65536 + ((start & 1023) << 10) + (end & 1023);
1445 }
1446 class RuneIterator extends dart.Object {
1447 RuneIterator(string) {
1448 this.string = string;
1449 this._position = 0;
1450 this._nextPosition = 0;
1451 this._currentCodePoint = null;
1452 }
1453 RuneIterator$at(string, index) {
1454 this.string = string;
1455 this._position = index;
1456 this._nextPosition = index;
1457 this._currentCodePoint = null;
1458 RangeError.checkValueInInterval(index, 0, string.length);
1459 this._checkSplitSurrogate(index);
1460 }
1461 _checkSplitSurrogate(index) {
1462 if (dart.notNull(dart.notNull(dart.notNull(index > 0) && dart.notNull(inde x < this.string.length)) && dart.notNull(_isLeadSurrogate(this.string.codeUnitAt (index - 1)))) && dart.notNull(_isTrailSurrogate(this.string.codeUnitAt(index))) ) {
1463 throw new ArgumentError(`Index inside surrogate pair: ${index}`);
1464 }
1465 }
1466 get rawIndex() {
1467 return dart.as(this._position !== this._nextPosition ? this._position : nu ll, int);
1468 }
1469 set rawIndex(rawIndex) {
1470 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex");
1471 this.reset(rawIndex);
1472 this.moveNext();
1473 }
1474 reset(rawIndex) {
1475 if (rawIndex === void 0)
1476 rawIndex = 0;
1477 RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex ");
1478 this._checkSplitSurrogate(rawIndex);
1479 this._position = this._nextPosition = rawIndex;
1480 this._currentCodePoint = null;
1481 }
1482 get current() {
1483 return dart.notNull(this._currentCodePoint);
1484 }
1485 get currentSize() {
1486 return this._nextPosition - this._position;
1487 }
1488 get currentAsString() {
1489 if (this._position === this._nextPosition)
1490 return null;
1491 if (this._position + 1 === this._nextPosition)
1492 return this.string.get(this._position);
1493 return this.string.substring(this._position, this._nextPosition);
1494 }
1495 moveNext() {
1496 this._position = this._nextPosition;
1497 if (this._position === this.string.length) {
1498 this._currentCodePoint = null;
1499 return false;
1500 }
1501 let codeUnit = this.string.codeUnitAt(this._position);
1502 let nextPosition = this._position + 1;
1503 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition < this.string.length)) {
1504 let nextCodeUnit = this.string.codeUnitAt(nextPosition);
1505 if (_isTrailSurrogate(nextCodeUnit)) {
1506 this._nextPosition = nextPosition + 1;
1507 this._currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit) ;
1508 return true;
1509 }
1510 }
1511 this._nextPosition = nextPosition;
1512 this._currentCodePoint = codeUnit;
1513 return true;
1514 }
1515 movePrevious() {
1516 this._nextPosition = this._position;
1517 if (this._position === 0) {
1518 this._currentCodePoint = null;
1519 return false;
1520 }
1521 let position = this._position - 1;
1522 let codeUnit = this.string.codeUnitAt(position);
1523 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position > 0 )) {
1524 let prevCodeUnit = this.string.codeUnitAt(position - 1);
1525 if (_isLeadSurrogate(prevCodeUnit)) {
1526 this._position = position - 1;
1527 this._currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit) ;
1528 return true;
1529 }
1530 }
1531 this._position = position;
1532 this._currentCodePoint = codeUnit;
1533 return true;
1534 }
1535 }
1536 dart.defineNamedConstructor(RuneIterator, 'at');
1537 class StringBuffer extends dart.Object {
1538 StringBuffer(content) {
1539 if (content === void 0)
1540 content = "";
1541 this._contents = `${content}`;
1542 }
1543 get length() {
1544 return this._contents.length;
1545 }
1546 get isEmpty() {
1547 return this.length === 0;
1548 }
1549 get isNotEmpty() {
1550 return !dart.notNull(this.isEmpty);
1551 }
1552 write(obj) {
1553 this._writeString(`${obj}`);
1554 }
1555 writeCharCode(charCode) {
1556 this._writeString(new String.fromCharCode(charCode));
1557 }
1558 writeAll(objects, separator) {
1559 if (separator === void 0)
1560 separator = "";
1561 let iterator = objects.iterator;
1562 if (!dart.notNull(iterator.moveNext()))
1563 return;
1564 if (separator.isEmpty) {
1565 do {
1566 this.write(iterator.current);
1567 } while (iterator.moveNext());
1568 } else {
1569 this.write(iterator.current);
1570 while (iterator.moveNext()) {
1571 this.write(separator);
1572 this.write(iterator.current);
1573 }
1574 }
1575 }
1576 writeln(obj) {
1577 if (obj === void 0)
1578 obj = "";
1579 this.write(obj);
1580 this.write("\n");
1581 }
1582 clear() {
1583 this._contents = "";
1584 }
1585 toString() {
1586 return _js_helper.Primitives.flattenString(this._contents);
1587 }
1588 _writeString(str) {
1589 this._contents = _js_helper.Primitives.stringConcatUnchecked(this._content s, dart.as(str, String));
1590 }
1591 }
1592 class StringSink extends dart.Object {
1593 }
1594 class Symbol extends dart.Object {
1595 Symbol(name) {
1596 return new _internal.Symbol(name);
1597 }
1598 }
1599 class Type extends dart.Object {
1600 }
1601 class Uri extends dart.Object {
1602 get authority() {
1603 if (!dart.notNull(this.hasAuthority))
1604 return "";
1605 let sb = new StringBuffer();
1606 this._writeAuthority(sb);
1607 return sb.toString();
1608 }
1609 get userInfo() {
1610 return this._userInfo;
1611 }
1612 get host() {
1613 if (this._host === null)
1614 return "";
1615 if (this._host.startsWith('[')) {
1616 return this._host.substring(1, this._host.length - 1);
1617 }
1618 return this._host;
1619 }
1620 get port() {
1621 if (this._port === null)
1622 return _defaultPort(this.scheme);
1623 return dart.notNull(this._port);
1624 }
1625 static _defaultPort(scheme) {
1626 if (dart.equals(scheme, "http"))
1627 return 80;
1628 if (dart.equals(scheme, "https"))
1629 return 443;
1630 return 0;
1631 }
1632 get path() {
1633 return this._path;
1634 }
1635 get query() {
1636 return this._query === null ? "" : this._query;
1637 }
1638 get fragment() {
1639 return this._fragment === null ? "" : this._fragment;
1640 }
1641 static parse(uri) {
1642 // Function isRegName: (int) → bool
1643 function isRegName(ch) {
1644 return dart.notNull(ch < 128) && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, ch >> 4), '&', 1 << (ch & 15)), 0));
1645 }
1646 let EOI = -1;
1647 let scheme = "";
1648 let userinfo = "";
1649 let host = null;
1650 let port = null;
1651 let path = null;
1652 let query = null;
1653 let fragment = null;
1654 let index = 0;
1655 let pathStart = 0;
1656 let char = EOI;
1657 // Function parseAuth: () → void
1658 function parseAuth() {
1659 if (index === uri.length) {
1660 char = EOI;
1661 return;
1662 }
1663 let authStart = index;
1664 let lastColon = -1;
1665 let lastAt = -1;
1666 char = uri.codeUnitAt(index);
1667 while (index < uri.length) {
1668 char = uri.codeUnitAt(index);
1669 if (dart.notNull(dart.notNull(char === _SLASH) || dart.notNull(char == = _QUESTION)) || dart.notNull(char === _NUMBER_SIGN)) {
1670 break;
1671 }
1672 if (char === _AT_SIGN) {
1673 lastAt = index;
1674 lastColon = -1;
1675 } else if (char === _COLON) {
1676 lastColon = index;
1677 } else if (char === _LEFT_BRACKET) {
1678 lastColon = -1;
1679 let endBracket = uri.indexOf(']', index + 1);
1680 if (endBracket === -1) {
1681 index = uri.length;
1682 char = EOI;
1683 break;
1684 } else {
1685 index = endBracket;
1686 }
1687 }
1688 index++;
1689 char = EOI;
1690 }
1691 let hostStart = authStart;
1692 let hostEnd = index;
1693 if (lastAt >= 0) {
1694 userinfo = _makeUserInfo(uri, authStart, lastAt);
1695 hostStart = lastAt + 1;
1696 }
1697 if (lastColon >= 0) {
1698 let portNumber = null;
1699 if (lastColon + 1 < index) {
1700 portNumber = 0;
1701 for (let i = lastColon + 1; i < index; i++) {
1702 let digit = uri.codeUnitAt(i);
1703 if (dart.notNull(_ZERO > digit) || dart.notNull(_NINE < digit)) {
1704 _fail(uri, i, "Invalid port number");
1705 }
1706 portNumber = portNumber * 10 + (digit - _ZERO);
1707 }
1708 }
1709 port = _makePort(portNumber, scheme);
1710 hostEnd = lastColon;
1711 }
1712 host = _makeHost(uri, hostStart, hostEnd, true);
1713 if (index < uri.length) {
1714 char = uri.codeUnitAt(index);
1715 }
1716 }
1717 let NOT_IN_PATH = 0;
1718 let IN_PATH = 1;
1719 let ALLOW_AUTH = 2;
1720 let state = NOT_IN_PATH;
1721 let i = index;
1722 while (i < uri.length) {
1723 char = uri.codeUnitAt(i);
1724 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_SI GN)) {
1725 state = NOT_IN_PATH;
1726 break;
1727 }
1728 if (char === _SLASH) {
1729 state = i === 0 ? ALLOW_AUTH : IN_PATH;
1730 break;
1731 }
1732 if (char === _COLON) {
1733 if (i === 0)
1734 _fail(uri, 0, "Invalid empty scheme");
1735 scheme = _makeScheme(uri, i);
1736 i++;
1737 pathStart = i;
1738 if (i === uri.length) {
1739 char = EOI;
1740 state = NOT_IN_PATH;
1741 } else {
1742 char = uri.codeUnitAt(i);
1743 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBE R_SIGN)) {
1744 state = NOT_IN_PATH;
1745 } else if (char === _SLASH) {
1746 state = ALLOW_AUTH;
1747 } else {
1748 state = IN_PATH;
1749 }
1750 }
1751 break;
1752 }
1753 i++;
1754 char = EOI;
1755 }
1756 index = i;
1757 if (state === ALLOW_AUTH) {
1758 dart.assert(char === _SLASH);
1759 index++;
1760 if (index === uri.length) {
1761 char = EOI;
1762 state = NOT_IN_PATH;
1763 } else {
1764 char = uri.codeUnitAt(index);
1765 if (char === _SLASH) {
1766 index++;
1767 parseAuth();
1768 pathStart = index;
1769 }
1770 if (dart.notNull(dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_SIGN)) || dart.notNull(char === EOI)) {
1771 state = NOT_IN_PATH;
1772 } else {
1773 state = IN_PATH;
1774 }
1775 }
1776 }
1777 dart.assert(dart.notNull(state === IN_PATH) || dart.notNull(state === NOT_ IN_PATH));
1778 if (state === IN_PATH) {
1779 while (++index < uri.length) {
1780 char = uri.codeUnitAt(index);
1781 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_ SIGN)) {
1782 break;
1783 }
1784 char = EOI;
1785 }
1786 state = NOT_IN_PATH;
1787 }
1788 dart.assert(state === NOT_IN_PATH);
1789 let isFile = dart.equals(scheme, "file");
1790 let ensureLeadingSlash = host !== null;
1791 path = _makePath(uri, pathStart, index, null, ensureLeadingSlash, isFile);
1792 if (char === _QUESTION) {
1793 let numberSignIndex = uri.indexOf('#', index + 1);
1794 if (numberSignIndex < 0) {
1795 query = _makeQuery(uri, index + 1, uri.length, null);
1796 } else {
1797 query = _makeQuery(uri, index + 1, numberSignIndex, null);
1798 fragment = _makeFragment(uri, numberSignIndex + 1, uri.length);
1799 }
1800 } else if (char === _NUMBER_SIGN) {
1801 fragment = _makeFragment(uri, index + 1, uri.length);
1802 }
1803 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme nt);
1804 }
1805 static _fail(uri, index, message) {
1806 throw new FormatException(message, uri, index);
1807 }
1808 Uri$_internal(scheme, _userInfo, _host, _port, _path, _query, _fragment) {
1809 this.scheme = scheme;
1810 this._userInfo = _userInfo;
1811 this._host = _host;
1812 this._port = _port;
1813 this._path = _path;
1814 this._query = _query;
1815 this._fragment = _fragment;
1816 this._pathSegments = null;
1817 this._queryParameters = null;
1818 }
1819 Uri(opt$) {
1820 let scheme = opt$.scheme === void 0 ? "" : opt$.scheme;
1821 let userInfo = opt$.userInfo === void 0 ? "" : opt$.userInfo;
1822 let host = opt$.host === void 0 ? null : opt$.host;
1823 let port = opt$.port === void 0 ? null : opt$.port;
1824 let path = opt$.path === void 0 ? null : opt$.path;
1825 let pathSegments = opt$.pathSegments === void 0 ? null : opt$.pathSegments ;
1826 let query = opt$.query === void 0 ? null : opt$.query;
1827 let queryParameters = opt$.queryParameters === void 0 ? null : opt$.queryP arameters;
1828 let fragment = opt$.fragment === void 0 ? null : opt$.fragment;
1829 scheme = _makeScheme(scheme, _stringOrNullLength(scheme));
1830 userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo));
1831 host = _makeHost(host, 0, _stringOrNullLength(host), false);
1832 if (dart.equals(query, ""))
1833 query = null;
1834 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
1835 fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment));
1836 port = _makePort(port, scheme);
1837 let isFile = dart.equals(scheme, "file");
1838 if (dart.notNull(host === null) && dart.notNull(dart.notNull(dart.notNull( userInfo.isNotEmpty) || dart.notNull(port !== null)) || dart.notNull(isFile))) {
1839 host = "";
1840 }
1841 let ensureLeadingSlash = host !== null;
1842 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensureL eadingSlash, isFile);
1843 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
1844 }
1845 Uri$http(authority, unencodedPath, queryParameters) {
1846 if (queryParameters === void 0)
1847 queryParameters = null;
1848 return _makeHttpUri("http", authority, unencodedPath, queryParameters);
1849 }
1850 Uri$https(authority, unencodedPath, queryParameters) {
1851 if (queryParameters === void 0)
1852 queryParameters = null;
1853 return _makeHttpUri("https", authority, unencodedPath, queryParameters);
1854 }
1855 static _makeHttpUri(scheme, authority, unencodedPath, queryParameters) {
1856 let userInfo = "";
1857 let host = null;
1858 let port = null;
1859 if (dart.notNull(authority !== null) && dart.notNull(authority.isNotEmpty) ) {
1860 let hostStart = 0;
1861 let hasUserInfo = false;
1862 for (let i = 0; i < authority.length; i++) {
1863 if (authority.codeUnitAt(i) === _AT_SIGN) {
1864 hasUserInfo = true;
1865 userInfo = authority.substring(0, i);
1866 hostStart = i + 1;
1867 break;
1868 }
1869 }
1870 let hostEnd = hostStart;
1871 if (dart.notNull(hostStart < authority.length) && dart.notNull(authority .codeUnitAt(hostStart) === _LEFT_BRACKET)) {
1872 for (; hostEnd < authority.length; hostEnd++) {
1873 if (authority.codeUnitAt(hostEnd) === _RIGHT_BRACKET)
1874 break;
1875 }
1876 if (hostEnd === authority.length) {
1877 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart);
1878 }
1879 parseIPv6Address(authority, hostStart + 1, hostEnd);
1880 hostEnd++;
1881 if (dart.notNull(hostEnd !== authority.length) && dart.notNull(authori ty.codeUnitAt(hostEnd) !== _COLON)) {
1882 throw new FormatException("Invalid end of authority", authority, hos tEnd);
1883 }
1884 }
1885 let hasPort = false;
1886 for (; hostEnd < authority.length; hostEnd++) {
1887 if (authority.codeUnitAt(hostEnd) === _COLON) {
1888 let portString = authority.substring(hostEnd + 1);
1889 if (portString.isNotEmpty)
1890 port = int.parse(portString);
1891 break;
1892 }
1893 }
1894 host = authority.substring(hostStart, hostEnd);
1895 }
1896 return new Uri({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath.split("/"), queryPa rameters: queryParameters});
1897 }
1898 Uri$file(path, opt$) {
1899 let windows = opt$.windows === void 0 ? null : opt$.windows;
1900 windows = windows === null ? Uri._isWindows : windows;
1901 return dart.as(windows ? _makeWindowsFileUrl(path) : _makeFileUri(path), U ri);
1902 }
1903 static get base() {
1904 let uri = _js_helper.Primitives.currentUri();
1905 if (uri !== null)
1906 return Uri.parse(uri);
1907 throw new UnsupportedError("'Uri.base' is not supported");
1908 }
1909 static get _isWindows() {
1910 return false;
1911 }
1912 static _checkNonWindowsPathReservedCharacters(segments, argumentError) {
1913 segments.forEach((segment) => {
1914 if (dart.dinvoke(segment, 'contains', "/")) {
1915 if (argumentError) {
1916 throw new ArgumentError(`Illegal path character ${segment}`);
1917 } else {
1918 throw new UnsupportedError(`Illegal path character ${segment}`);
1919 }
1920 }
1921 });
1922 }
1923 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg ment) {
1924 if (firstSegment === void 0)
1925 firstSegment = 0;
1926 segments.skip(firstSegment).forEach((segment) => {
1927 if (dart.dinvoke(segment, 'contains', new RegExp('["*/:<>?\\\\|]'))) {
1928 if (argumentError) {
1929 throw new ArgumentError("Illegal character in path");
1930 } else {
1931 throw new UnsupportedError("Illegal character in path");
1932 }
1933 }
1934 });
1935 }
1936 static _checkWindowsDriveLetter(charCode, argumentError) {
1937 if (dart.notNull(dart.notNull(_UPPER_CASE_A <= charCode) && dart.notNull(c harCode <= _UPPER_CASE_Z)) || dart.notNull(dart.notNull(_LOWER_CASE_A <= charCod e) && dart.notNull(charCode <= _LOWER_CASE_Z))) {
1938 return;
1939 }
1940 if (argumentError) {
1941 throw new ArgumentError(String['+']("Illegal drive letter ", new String. fromCharCode(charCode)));
1942 } else {
1943 throw new UnsupportedError(String['+']("Illegal drive letter ", new Stri ng.fromCharCode(charCode)));
1944 }
1945 }
1946 static _makeFileUri(path) {
1947 let sep = "/";
1948 if (path.startsWith(sep)) {
1949 return new Uri({scheme: "file", pathSegments: path.split(sep)});
1950 } else {
1951 return new Uri({pathSegments: path.split(sep)});
1952 }
1953 }
1954 static _makeWindowsFileUrl(path) {
1955 if (path.startsWith("\\\\?\\")) {
1956 if (path.startsWith("\\\\?\\UNC\\")) {
1957 path = `\\${path.substring(7)}`;
1958 } else {
1959 path = path.substring(4);
1960 if (dart.notNull(dart.notNull(path.length < 3) || dart.notNull(path.co deUnitAt(1) !== _COLON)) || dart.notNull(path.codeUnitAt(2) !== _BACKSLASH)) {
1961 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute");
1962 }
1963 }
1964 } else {
1965 path = path.replaceAll("/", "\\");
1966 }
1967 let sep = "\\";
1968 if (dart.notNull(path.length > 1) && dart.notNull(dart.equals(path.get(1), ":"))) {
1969 _checkWindowsDriveLetter(path.codeUnitAt(0), true);
1970 if (dart.notNull(path.length === 2) || dart.notNull(path.codeUnitAt(2) ! == _BACKSLASH)) {
1971 throw new ArgumentError("Windows paths with drive letter must be absol ute");
1972 }
1973 let pathSegments = path.split(sep);
1974 _checkWindowsPathReservedCharacters(pathSegments, true, 1);
1975 return new Uri({scheme: "file", pathSegments: pathSegments});
1976 }
1977 if (dart.notNull(path.length > 0) && dart.notNull(dart.equals(path.get(0), sep))) {
1978 if (dart.notNull(path.length > 1) && dart.notNull(dart.equals(path.get(1 ), sep))) {
1979 let pathStart = path.indexOf("\\", 2);
1980 let hostPart = pathStart === -1 ? path.substring(2) : path.substring(2 , pathStart);
1981 let pathPart = pathStart === -1 ? "" : path.substring(pathStart + 1);
1982 let pathSegments = pathPart.split(sep);
1983 _checkWindowsPathReservedCharacters(pathSegments, true);
1984 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents});
1985 } else {
1986 let pathSegments = path.split(sep);
1987 _checkWindowsPathReservedCharacters(pathSegments, true);
1988 return new Uri({scheme: "file", pathSegments: pathSegments});
1989 }
1990 } else {
1991 let pathSegments = path.split(sep);
1992 _checkWindowsPathReservedCharacters(pathSegments, true);
1993 return new Uri({pathSegments: pathSegments});
1994 }
1995 }
1996 replace(opt$) {
1997 let scheme = opt$.scheme === void 0 ? null : opt$.scheme;
1998 let userInfo = opt$.userInfo === void 0 ? null : opt$.userInfo;
1999 let host = opt$.host === void 0 ? null : opt$.host;
2000 let port = opt$.port === void 0 ? null : opt$.port;
2001 let path = opt$.path === void 0 ? null : opt$.path;
2002 let pathSegments = opt$.pathSegments === void 0 ? null : opt$.pathSegments ;
2003 let query = opt$.query === void 0 ? null : opt$.query;
2004 let queryParameters = opt$.queryParameters === void 0 ? null : opt$.queryP arameters;
2005 let fragment = opt$.fragment === void 0 ? null : opt$.fragment;
2006 let schemeChanged = false;
2007 if (scheme !== null) {
2008 scheme = _makeScheme(scheme, scheme.length);
2009 schemeChanged = true;
2010 } else {
2011 scheme = this.scheme;
2012 }
2013 let isFile = dart.equals(scheme, "file");
2014 if (userInfo !== null) {
2015 userInfo = _makeUserInfo(userInfo, 0, userInfo.length);
2016 } else {
2017 userInfo = this.userInfo;
2018 }
2019 if (port !== null) {
2020 port = _makePort(port, scheme);
2021 } else {
2022 port = dart.notNull(this._port);
2023 if (schemeChanged) {
2024 port = _makePort(port, scheme);
2025 }
2026 }
2027 if (host !== null) {
2028 host = _makeHost(host, 0, host.length, false);
2029 } else if (this.hasAuthority) {
2030 host = this.host;
2031 } else if (dart.notNull(dart.notNull(userInfo.isNotEmpty) || dart.notNull( port !== null)) || dart.notNull(isFile)) {
2032 host = "";
2033 }
2034 let ensureLeadingSlash = host !== null;
2035 if (dart.notNull(path !== null) || dart.notNull(pathSegments !== null)) {
2036 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensur eLeadingSlash, isFile);
2037 } else {
2038 path = this.path;
2039 if (dart.notNull(dart.notNull(isFile) || dart.notNull(dart.notNull(ensur eLeadingSlash) && dart.notNull(!dart.notNull(path.isEmpty)))) && dart.notNull(!d art.notNull(path.startsWith('/')))) {
2040 path = `/${path}`;
2041 }
2042 }
2043 if (dart.notNull(query !== null) || dart.notNull(queryParameters !== null) ) {
2044 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters );
2045 } else if (this.hasQuery) {
2046 query = this.query;
2047 }
2048 if (fragment !== null) {
2049 fragment = _makeFragment(fragment, 0, fragment.length);
2050 } else if (this.hasFragment) {
2051 fragment = this.fragment;
2052 }
2053 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
2054 }
2055 get pathSegments() {
2056 if (this._pathSegments === null) {
2057 let pathToSplit = dart.notNull(!dart.notNull(this.path.isEmpty)) && dart .notNull(this.path.codeUnitAt(0) === _SLASH) ? this.path.substring(1) : this.pat h;
2058 this._pathSegments = dart.as(new collection.UnmodifiableListView(dart.eq uals(pathToSplit, "") ? /* Unimplemented const */new List.from([]) : pathToSplit .split("/").map(Uri.decodeComponent).toList({growable: false})), List$(String));
2059 }
2060 return this._pathSegments;
2061 }
2062 get queryParameters() {
2063 if (this._queryParameters === null) {
2064 this._queryParameters = dart.as(new collection.UnmodifiableMapView(split QueryString(this.query)), Map$(String, String));
2065 }
2066 return this._queryParameters;
2067 }
2068 static _makePort(port, scheme) {
2069 if (dart.notNull(port !== null) && dart.notNull(port === _defaultPort(sche me)))
2070 return dart.as(null, int);
2071 return port;
2072 }
2073 static _makeHost(host, start, end, strictIPv6) {
2074 if (host === null)
2075 return null;
2076 if (start === end)
2077 return "";
2078 if (host.codeUnitAt(start) === _LEFT_BRACKET) {
2079 if (host.codeUnitAt(end - 1) !== _RIGHT_BRACKET) {
2080 _fail(host, start, 'Missing end `]` to match `[` in host');
2081 }
2082 parseIPv6Address(host, start + 1, end - 1);
2083 return host.substring(start, end).toLowerCase();
2084 }
2085 if (!dart.notNull(strictIPv6)) {
2086 for (let i = start; i < end; i++) {
2087 if (host.codeUnitAt(i) === _COLON) {
2088 parseIPv6Address(host, start, end);
2089 return `[${host}]`;
2090 }
2091 }
2092 }
2093 return _normalizeRegName(host, start, end);
2094 }
2095 static _isRegNameChar(char) {
2096 return dart.notNull(char < 127) && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, char >> 4), '&', 1 << (char & 15)), 0));
2097 }
2098 static _normalizeRegName(host, start, end) {
2099 let buffer = null;
2100 let sectionStart = start;
2101 let index = start;
2102 let isNormalized = true;
2103 while (index < end) {
2104 let char = host.codeUnitAt(index);
2105 if (char === _PERCENT) {
2106 let replacement = _normalizeEscape(host, index, true);
2107 if (dart.notNull(replacement === null) && dart.notNull(isNormalized)) {
2108 index = 3;
2109 continue;
2110 }
2111 if (buffer === null)
2112 buffer = new StringBuffer();
2113 let slice = host.substring(sectionStart, index);
2114 if (!dart.notNull(isNormalized))
2115 slice = slice.toLowerCase();
2116 buffer.write(slice);
2117 let sourceLength = 3;
2118 if (replacement === null) {
2119 replacement = host.substring(index, index + 3);
2120 } else if (dart.equals(replacement, "%")) {
2121 replacement = "%25";
2122 sourceLength = 1;
2123 }
2124 buffer.write(replacement);
2125 index = sourceLength;
2126 sectionStart = index;
2127 isNormalized = true;
2128 } else if (_isRegNameChar(char)) {
2129 if (dart.notNull(dart.notNull(isNormalized) && dart.notNull(_UPPER_CAS E_A <= char)) && dart.notNull(_UPPER_CASE_Z >= char)) {
2130 if (buffer === null)
2131 buffer = new StringBuffer();
2132 if (sectionStart < index) {
2133 buffer.write(host.substring(sectionStart, index));
2134 sectionStart = index;
2135 }
2136 isNormalized = false;
2137 }
2138 index++;
2139 } else if (_isGeneralDelimiter(char)) {
2140 _fail(host, index, "Invalid character");
2141 } else {
2142 let sourceLength = 1;
2143 if (dart.notNull((char & 64512) === 55296) && dart.notNull(index + 1 < end)) {
2144 let tail = host.codeUnitAt(index + 1);
2145 if ((tail & 64512) === 56320) {
2146 char = 65536 | (char & 1023) << 10 | tail & 1023;
2147 sourceLength = 2;
2148 }
2149 }
2150 if (buffer === null)
2151 buffer = new StringBuffer();
2152 let slice = host.substring(sectionStart, index);
2153 if (!dart.notNull(isNormalized))
2154 slice = slice.toLowerCase();
2155 buffer.write(slice);
2156 buffer.write(_escapeChar(char));
2157 index = sourceLength;
2158 sectionStart = index;
2159 }
2160 }
2161 if (buffer === null)
2162 return host.substring(start, end);
2163 if (sectionStart < end) {
2164 let slice = host.substring(sectionStart, end);
2165 if (!dart.notNull(isNormalized))
2166 slice = slice.toLowerCase();
2167 buffer.write(slice);
2168 }
2169 return buffer.toString();
2170 }
2171 static _makeScheme(scheme, end) {
2172 if (end === 0)
2173 return "";
2174 let firstCodeUnit = scheme.codeUnitAt(0);
2175 if (!dart.notNull(_isAlphabeticCharacter(firstCodeUnit))) {
2176 _fail(scheme, 0, "Scheme not starting with alphabetic character");
2177 }
2178 let allLowercase = firstCodeUnit >= _LOWER_CASE_A;
2179 for (let i = 0; i < end; i++) {
2180 let codeUnit = scheme.codeUnitAt(i);
2181 if (!dart.notNull(_isSchemeCharacter(codeUnit))) {
2182 _fail(scheme, i, "Illegal scheme character");
2183 }
2184 if (dart.notNull(codeUnit < _LOWER_CASE_A) || dart.notNull(codeUnit > _L OWER_CASE_Z)) {
2185 allLowercase = false;
2186 }
2187 }
2188 scheme = scheme.substring(0, end);
2189 if (!dart.notNull(allLowercase))
2190 scheme = scheme.toLowerCase();
2191 return scheme;
2192 }
2193 static _makeUserInfo(userInfo, start, end) {
2194 if (userInfo === null)
2195 return "";
2196 return _normalize(userInfo, start, end, dart.as(_userinfoTable, List$(int) ));
2197 }
2198 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile) {
2199 if (dart.notNull(path === null) && dart.notNull(pathSegments === null))
2200 return isFile ? "/" : "";
2201 if (dart.notNull(path !== null) && dart.notNull(pathSegments !== null)) {
2202 throw new ArgumentError('Both path and pathSegments specified');
2203 }
2204 let result = null;
2205 if (path !== null) {
2206 result = _normalize(path, start, end, dart.as(_pathCharOrSlashTable, Lis t$(int)));
2207 } else {
2208 result = pathSegments.map((s) => _uriEncode(dart.as(_pathCharTable, List $(int)), dart.as(s, String))).join("/");
2209 }
2210 if (dart.dload(result, 'isEmpty')) {
2211 if (isFile)
2212 return "/";
2213 } else if (dart.notNull(dart.notNull(isFile) || dart.notNull(ensureLeading Slash)) && dart.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), _SLA SH))) {
2214 return `/${result}`;
2215 }
2216 return dart.as(result, String);
2217 }
2218 static _makeQuery(query, start, end, queryParameters) {
2219 if (dart.notNull(query === null) && dart.notNull(queryParameters === null) )
2220 return null;
2221 if (dart.notNull(query !== null) && dart.notNull(queryParameters !== null) ) {
2222 throw new ArgumentError('Both query and queryParameters specified');
2223 }
2224 if (query !== null)
2225 return _normalize(query, start, end, dart.as(_queryCharTable, List$(int) ));
2226 let result = new StringBuffer();
2227 let first = true;
2228 queryParameters.forEach(((key, value) => {
2229 if (!dart.notNull(first)) {
2230 result.write("&");
2231 }
2232 first = false;
2233 result.write(Uri.encodeQueryComponent(dart.as(key, String)));
2234 if (dart.notNull(value !== null) && dart.notNull(dart.throw_("Unimplemen ted PrefixExpression: !value.isEmpty"))) {
2235 result.write("=");
2236 result.write(Uri.encodeQueryComponent(dart.as(value, String)));
2237 }
2238 }).bind(this));
2239 return result.toString();
2240 }
2241 static _makeFragment(fragment, start, end) {
2242 if (fragment === null)
2243 return null;
2244 return _normalize(fragment, start, end, dart.as(_queryCharTable, List$(int )));
2245 }
2246 static _stringOrNullLength(s) {
2247 return s === null ? 0 : s.length;
2248 }
2249 static _isHexDigit(char) {
2250 if (_NINE >= char)
2251 return _ZERO <= char;
2252 char = 32;
2253 return dart.notNull(_LOWER_CASE_A <= char) && dart.notNull(_LOWER_CASE_F > = char);
2254 }
2255 static _hexValue(char) {
2256 dart.assert(_isHexDigit(char));
2257 if (_NINE >= char)
2258 return char - _ZERO;
2259 char = 32;
2260 return char - (_LOWER_CASE_A - 10);
2261 }
2262 static _normalizeEscape(source, index, lowerCase) {
2263 dart.assert(source.codeUnitAt(index) === _PERCENT);
2264 if (index + 2 >= source.length) {
2265 return "%";
2266 }
2267 let firstDigit = source.codeUnitAt(index + 1);
2268 let secondDigit = source.codeUnitAt(index + 2);
2269 if (dart.notNull(!dart.notNull(_isHexDigit(firstDigit))) || dart.notNull(! dart.notNull(_isHexDigit(secondDigit)))) {
2270 return "%";
2271 }
2272 let value = _hexValue(firstDigit) * 16 + _hexValue(secondDigit);
2273 if (_isUnreservedChar(value)) {
2274 if (dart.notNull(dart.notNull(lowerCase) && dart.notNull(_UPPER_CASE_A < = value)) && dart.notNull(_UPPER_CASE_Z >= value)) {
2275 value = 32;
2276 }
2277 return new String.fromCharCode(value);
2278 }
2279 if (dart.notNull(firstDigit >= _LOWER_CASE_A) || dart.notNull(secondDigit >= _LOWER_CASE_A)) {
2280 return source.substring(index, index + 3).toUpperCase();
2281 }
2282 return null;
2283 }
2284 static _isUnreservedChar(ch) {
2285 return dart.notNull(ch < 127) && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_unreservedTable, ch >> 4), '&', 1 << (ch & 15)), 0));
2286 }
2287 static _escapeChar(char) {
2288 dart.assert(dart.dbinary(char, '<=', 1114111));
2289 let hexDigits = "0123456789ABCDEF";
2290 let codeUnits = null;
2291 if (dart.dbinary(char, '<', 128)) {
2292 codeUnits = new List(3);
2293 codeUnits.set(0, _PERCENT);
2294 codeUnits.set(1, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '>>', 4 ), int)));
2295 codeUnits.set(2, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '&', 15 ), int)));
2296 } else {
2297 let flag = 192;
2298 let encodedBytes = 2;
2299 if (dart.dbinary(char, '>', 2047)) {
2300 flag = 224;
2301 encodedBytes = 3;
2302 if (dart.dbinary(char, '>', 65535)) {
2303 encodedBytes = 4;
2304 flag = 240;
2305 }
2306 }
2307 codeUnits = new List(3 * encodedBytes);
2308 let index = 0;
2309 while (--encodedBytes >= 0) {
2310 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * encodedBytes), '&', 63), '|', flag), int);
2311 codeUnits.set(index, _PERCENT);
2312 codeUnits.set(index + 1, hexDigits.codeUnitAt(byte >> 4));
2313 codeUnits.set(index + 2, hexDigits.codeUnitAt(byte & 15));
2314 index = 3;
2315 flag = 128;
2316 }
2317 }
2318 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int)));
2319 }
2320 static _normalize(component, start, end, charTable) {
2321 let buffer = null;
2322 let sectionStart = start;
2323 let index = start;
2324 while (index < end) {
2325 let char = component.codeUnitAt(index);
2326 if (dart.notNull(char < 127) && dart.notNull((charTable.get(char >> 4) & 1 << (char & 15)) !== 0)) {
2327 index++;
2328 } else {
2329 let replacement = null;
2330 let sourceLength = null;
2331 if (char === _PERCENT) {
2332 replacement = _normalizeEscape(component, index, false);
2333 if (replacement === null) {
2334 index = 3;
2335 continue;
2336 }
2337 if (dart.equals("%", replacement)) {
2338 replacement = "%25";
2339 sourceLength = 1;
2340 } else {
2341 sourceLength = 3;
2342 }
2343 } else if (_isGeneralDelimiter(char)) {
2344 _fail(component, index, "Invalid character");
2345 } else {
2346 sourceLength = 1;
2347 if ((char & 64512) === 55296) {
2348 if (index + 1 < end) {
2349 let tail = component.codeUnitAt(index + 1);
2350 if ((tail & 64512) === 56320) {
2351 sourceLength = 2;
2352 char = 65536 | (char & 1023) << 10 | tail & 1023;
2353 }
2354 }
2355 }
2356 replacement = _escapeChar(char);
2357 }
2358 if (buffer === null)
2359 buffer = new StringBuffer();
2360 buffer.write(component.substring(sectionStart, index));
2361 buffer.write(replacement);
2362 index = sourceLength;
2363 sectionStart = index;
2364 }
2365 }
2366 if (buffer === null) {
2367 return component.substring(start, end);
2368 }
2369 if (sectionStart < end) {
2370 buffer.write(component.substring(sectionStart, end));
2371 }
2372 return buffer.toString();
2373 }
2374 static _isSchemeCharacter(ch) {
2375 return dart.notNull(ch < 128) && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_schemeTable, ch >> 4), '&', 1 << (ch & 15)), 0));
2376 }
2377 static _isGeneralDelimiter(ch) {
2378 return dart.notNull(ch <= _RIGHT_BRACKET) && dart.notNull(!dart.equals(dar t.dbinary(dart.dindex(_genDelimitersTable, ch >> 4), '&', 1 << (ch & 15)), 0));
2379 }
2380 get isAbsolute() {
2381 return dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(dart.eq uals(this.fragment, ""));
2382 }
2383 _merge(base, reference) {
2384 if (base.isEmpty)
2385 return `/${reference}`;
2386 let backCount = 0;
2387 let refStart = 0;
2388 while (reference.startsWith("../", refStart)) {
2389 refStart = 3;
2390 backCount++;
2391 }
2392 let baseEnd = base.lastIndexOf('/');
2393 while (dart.notNull(baseEnd > 0) && dart.notNull(backCount > 0)) {
2394 let newEnd = base.lastIndexOf('/', baseEnd - 1);
2395 if (newEnd < 0) {
2396 break;
2397 }
2398 let delta = baseEnd - newEnd;
2399 if (dart.notNull(dart.notNull(dart.notNull(delta === 2) || dart.notNull( delta === 3)) && dart.notNull(base.codeUnitAt(newEnd + 1) === _DOT)) && dart.not Null(dart.notNull(delta === 2) || dart.notNull(base.codeUnitAt(newEnd + 2) === _ DOT))) {
2400 break;
2401 }
2402 baseEnd = newEnd;
2403 backCount--;
2404 }
2405 return String['+'](base.substring(0, baseEnd + 1), reference.substring(ref Start - 3 * backCount));
2406 }
2407 _hasDotSegments(path) {
2408 if (dart.notNull(path.length > 0) && dart.notNull(path.codeUnitAt(0) === _ DOT))
2409 return true;
2410 let index = path.indexOf("/.");
2411 return index !== -1;
2412 }
2413 _removeDotSegments(path) {
2414 if (!dart.notNull(this._hasDotSegments(path)))
2415 return path;
2416 let output = dart.as(new List.from([]), List$(String));
2417 let appendSlash = false;
2418 for (let segment of path.split("/")) {
2419 appendSlash = false;
2420 if (dart.equals(segment, "..")) {
2421 if (dart.notNull(!dart.notNull(output.isEmpty)) && dart.notNull(dart.n otNull(output.length !== 1) || dart.notNull(!dart.equals(output.get(0), ""))))
2422 output.removeLast();
2423 appendSlash = true;
2424 } else if (dart.equals(".", segment)) {
2425 appendSlash = true;
2426 } else {
2427 output.add(segment);
2428 }
2429 }
2430 if (appendSlash)
2431 output.add("");
2432 return output.join("/");
2433 }
2434 resolve(reference) {
2435 return this.resolveUri(Uri.parse(reference));
2436 }
2437 resolveUri(reference) {
2438 let targetScheme = null;
2439 let targetUserInfo = "";
2440 let targetHost = null;
2441 let targetPort = null;
2442 let targetPath = null;
2443 let targetQuery = null;
2444 if (reference.scheme.isNotEmpty) {
2445 targetScheme = reference.scheme;
2446 if (reference.hasAuthority) {
2447 targetUserInfo = reference.userInfo;
2448 targetHost = reference.host;
2449 targetPort = dart.as(reference.hasPort ? reference.port : null, int);
2450 }
2451 targetPath = this._removeDotSegments(reference.path);
2452 if (reference.hasQuery) {
2453 targetQuery = reference.query;
2454 }
2455 } else {
2456 targetScheme = this.scheme;
2457 if (reference.hasAuthority) {
2458 targetUserInfo = reference.userInfo;
2459 targetHost = reference.host;
2460 targetPort = _makePort(dart.as(reference.hasPort ? reference.port : nu ll, int), targetScheme);
2461 targetPath = this._removeDotSegments(reference.path);
2462 if (reference.hasQuery)
2463 targetQuery = reference.query;
2464 } else {
2465 if (dart.equals(reference.path, "")) {
2466 targetPath = this._path;
2467 if (reference.hasQuery) {
2468 targetQuery = reference.query;
2469 } else {
2470 targetQuery = this._query;
2471 }
2472 } else {
2473 if (reference.path.startsWith("/")) {
2474 targetPath = this._removeDotSegments(reference.path);
2475 } else {
2476 targetPath = this._removeDotSegments(this._merge(this._path, refer ence.path));
2477 }
2478 if (reference.hasQuery)
2479 targetQuery = reference.query;
2480 }
2481 targetUserInfo = this._userInfo;
2482 targetHost = this._host;
2483 targetPort = dart.notNull(this._port);
2484 }
2485 }
2486 let fragment = dart.as(reference.hasFragment ? reference.fragment : null, String);
2487 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP ort, targetPath, targetQuery, fragment);
2488 }
2489 get hasAuthority() {
2490 return this._host !== null;
2491 }
2492 get hasPort() {
2493 return this._port !== null;
2494 }
2495 get hasQuery() {
2496 return this._query !== null;
2497 }
2498 get hasFragment() {
2499 return this._fragment !== null;
2500 }
2501 get origin() {
2502 if (dart.notNull(dart.notNull(dart.equals(this.scheme, "")) || dart.notNul l(this._host === null)) || dart.notNull(dart.equals(this._host, ""))) {
2503 throw new StateError(`Cannot use origin without a scheme: ${this}`);
2504 }
2505 if (dart.notNull(!dart.equals(this.scheme, "http")) && dart.notNull(!dart. equals(this.scheme, "https"))) {
2506 throw new StateError(`Origin is only applicable schemes http and https: ${this}`);
2507 }
2508 if (this._port === null)
2509 return `${this.scheme}://${this._host}`;
2510 return `${this.scheme}://${this._host}:${this._port}`;
2511 }
2512 toFilePath(opt$) {
2513 let windows = opt$.windows === void 0 ? null : opt$.windows;
2514 if (dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(!dart.equa ls(this.scheme, "file"))) {
2515 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`);
2516 }
2517 if (!dart.equals(this.query, "")) {
2518 throw new UnsupportedError("Cannot extract a file path from a URI with a query component");
2519 }
2520 if (!dart.equals(this.fragment, "")) {
2521 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component");
2522 }
2523 if (windows === null)
2524 windows = _isWindows;
2525 return windows ? this._toWindowsFilePath() : this._toFilePath();
2526 }
2527 _toFilePath() {
2528 if (!dart.equals(this.host, "")) {
2529 throw new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority");
2530 }
2531 _checkNonWindowsPathReservedCharacters(this.pathSegments, false);
2532 let result = new StringBuffer();
2533 if (this._isPathAbsolute)
2534 result.write("/");
2535 result.writeAll(this.pathSegments, "/");
2536 return result.toString();
2537 }
2538 _toWindowsFilePath() {
2539 let hasDriveLetter = false;
2540 let segments = this.pathSegments;
2541 if (dart.notNull(dart.notNull(segments.length > 0) && dart.notNull(segment s.get(0).length === 2)) && dart.notNull(segments.get(0).codeUnitAt(1) === _COLON )) {
2542 _checkWindowsDriveLetter(segments.get(0).codeUnitAt(0), false);
2543 _checkWindowsPathReservedCharacters(segments, false, 1);
2544 hasDriveLetter = true;
2545 } else {
2546 _checkWindowsPathReservedCharacters(segments, false);
2547 }
2548 let result = new StringBuffer();
2549 if (dart.notNull(this._isPathAbsolute) && dart.notNull(!dart.notNull(hasDr iveLetter)))
2550 result.write("\\");
2551 if (!dart.equals(this.host, "")) {
2552 result.write("\\");
2553 result.write(this.host);
2554 result.write("\\");
2555 }
2556 result.writeAll(segments, "\\");
2557 if (dart.notNull(hasDriveLetter) && dart.notNull(segments.length === 1))
2558 result.write("\\");
2559 return result.toString();
2560 }
2561 get _isPathAbsolute() {
2562 if (dart.notNull(this.path === null) || dart.notNull(this.path.isEmpty))
2563 return false;
2564 return this.path.startsWith('/');
2565 }
2566 _writeAuthority(ss) {
2567 if (this._userInfo.isNotEmpty) {
2568 ss.write(this._userInfo);
2569 ss.write("@");
2570 }
2571 if (this._host !== null)
2572 ss.write(this._host);
2573 if (this._port !== null) {
2574 ss.write(":");
2575 ss.write(this._port);
2576 }
2577 }
2578 toString() {
2579 let sb = new StringBuffer();
2580 _addIfNonEmpty(sb, this.scheme, this.scheme, ':');
2581 if (dart.notNull(dart.notNull(this.hasAuthority) || dart.notNull(this.path .startsWith("//"))) || dart.notNull(dart.equals(this.scheme, "file"))) {
2582 sb.write("//");
2583 this._writeAuthority(sb);
2584 }
2585 sb.write(this.path);
2586 if (this._query !== null) {
2587 sb.write("?");
2588 sb.write(this._query);
2589 }
2590 if (this._fragment !== null) {
2591 sb.write("#");
2592 sb.write(this._fragment);
2593 }
2594 return sb.toString();
2595 }
2596 ['=='](other) {
2597 if (!dart.is(other, Uri))
2598 return false;
2599 let uri = dart.as(other, Uri);
2600 return dart.notNull(dart.notNull(dart.notNull(dart.notNull(dart.notNull(da rt.notNull(dart.notNull(dart.notNull(dart.notNull(dart.equals(this.scheme, uri.s cheme)) && dart.notNull(this.hasAuthority === uri.hasAuthority)) && dart.notNull (dart.equals(this.userInfo, uri.userInfo))) && dart.notNull(dart.equals(this.hos t, uri.host))) && dart.notNull(this.port === uri.port)) && dart.notNull(dart.equ als(this.path, uri.path))) && dart.notNull(this.hasQuery === uri.hasQuery)) && d art.notNull(dart.equals(this.query, uri.query))) && dart.notNull(this.hasFragmen t === uri.hasFragment)) && dart.notNull(dart.equals(this.fragment, uri.fragment) );
2601 }
2602 get hashCode() {
2603 // Function combine: (dynamic, dynamic) → int
2604 function combine(part, current) {
2605 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', dart.dload(part, 'hashCode')), '&', 1073741823), int);
2606 }
2607 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) )))));
2608 }
2609 static _addIfNonEmpty(sb, test, first, second) {
2610 if (!dart.equals("", test)) {
2611 sb.write(first);
2612 sb.write(second);
2613 }
2614 }
2615 static encodeComponent(component) {
2616 return _uriEncode(dart.as(_unreserved2396Table, List$(int)), component);
2617 }
2618 static encodeQueryComponent(component, opt$) {
2619 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2620 return _uriEncode(dart.as(_unreservedTable, List$(int)), component, {encod ing: encoding, spaceToPlus: true});
2621 }
2622 static decodeComponent(encodedComponent) {
2623 return _uriDecode(encodedComponent);
2624 }
2625 static decodeQueryComponent(encodedComponent, opt$) {
2626 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2627 return _uriDecode(encodedComponent, {plusToSpace: true, encoding: encoding });
2628 }
2629 static encodeFull(uri) {
2630 return _uriEncode(dart.as(_encodeFullTable, List$(int)), uri);
2631 }
2632 static decodeFull(uri) {
2633 return _uriDecode(uri);
2634 }
2635 static splitQueryString(query, opt$) {
2636 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2637 return dart.as(query.split("&").fold(dart.map(), (map, element) => {
2638 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int);
2639 if (index === -1) {
2640 if (!dart.equals(element, "")) {
2641 dart.dsetindex(map, decodeQueryComponent(dart.as(element, String), { encoding: encoding}), "");
2642 }
2643 } else if (index !== 0) {
2644 let key = dart.dinvoke(element, 'substring', 0, index);
2645 let value = dart.dinvoke(element, 'substring', index + 1);
2646 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), decodeQueryComponent(dart.as(value, String), {encoding: enco ding}));
2647 }
2648 return map;
2649 }), Map$(String, String));
2650 }
2651 static parseIPv4Address(host) {
2652 // Function error: (String) → void
2653 function error(msg) {
2654 throw new FormatException(`Illegal IPv4 address, ${msg}`);
2655 }
2656 let bytes = host.split('.');
2657 if (bytes.length !== 4) {
2658 error('IPv4 address should contain exactly 4 parts');
2659 }
2660 return dart.as(bytes.map((byteString) => {
2661 let byte = int.parse(dart.as(byteString, String));
2662 if (dart.notNull(byte < 0) || dart.notNull(byte > 255)) {
2663 error('each part must be in the range of `0..255`');
2664 }
2665 return byte;
2666 }).toList(), List$(int));
2667 }
2668 static parseIPv6Address(host, start, end) {
2669 if (start === void 0)
2670 start = 0;
2671 if (end === void 0)
2672 end = null;
2673 if (end === null)
2674 end = host.length;
2675 // Function error: (String, [dynamic]) → void
2676 function error(msg, position) {
2677 if (position === void 0)
2678 position = null;
2679 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int));
2680 }
2681 // Function parseHex: (int, int) → int
2682 function parseHex(start, end) {
2683 if (end - start > 4) {
2684 error('an IPv6 part can only contain a maximum of 4 hex digits', start );
2685 }
2686 let value = int.parse(host.substring(start, end), {radix: 16});
2687 if (dart.notNull(value < 0) || dart.notNull(value > (1 << 16) - 1)) {
2688 error('each part must be in the range of `0x0..0xFFFF`', start);
2689 }
2690 return value;
2691 }
2692 if (host.length < 2)
2693 error('address is too short');
2694 let parts = dart.as(new List.from([]), List$(int));
2695 let wildcardSeen = false;
2696 let partStart = start;
2697 for (let i = start; i < end; i++) {
2698 if (host.codeUnitAt(i) === _COLON) {
2699 if (i === start) {
2700 i++;
2701 if (host.codeUnitAt(i) !== _COLON) {
2702 error('invalid start colon.', i);
2703 }
2704 partStart = i;
2705 }
2706 if (i === partStart) {
2707 if (wildcardSeen) {
2708 error('only one wildcard `::` is allowed', i);
2709 }
2710 wildcardSeen = true;
2711 parts.add(-1);
2712 } else {
2713 parts.add(parseHex(partStart, i));
2714 }
2715 partStart = i + 1;
2716 }
2717 }
2718 if (parts.length === 0)
2719 error('too few parts');
2720 let atEnd = partStart === end;
2721 let isLastWildcard = parts.last === -1;
2722 if (dart.notNull(atEnd) && dart.notNull(!dart.notNull(isLastWildcard))) {
2723 error('expected a part after last `:`', end);
2724 }
2725 if (!dart.notNull(atEnd)) {
2726 try {
2727 parts.add(parseHex(partStart, end));
2728 } catch (e) {
2729 try {
2730 let last = parseIPv4Address(host.substring(partStart, end));
2731 parts.add(last.get(0) << 8 | last.get(1));
2732 parts.add(last.get(2) << 8 | last.get(3));
2733 } catch (e) {
2734 error('invalid end of IPv6 address.', partStart);
2735 }
2736
2737 }
2738
2739 }
2740 if (wildcardSeen) {
2741 if (parts.length > 7) {
2742 error('an address with a wildcard must have less than 7 parts');
2743 }
2744 } else if (parts.length !== 8) {
2745 error('an address without a wildcard must contain exactly 8 parts');
2746 }
2747 let bytes = new List(16);
2748 for (let i = 0, index = 0; i < parts.length; i++) {
2749 let value = parts.get(i);
2750 if (value === -1) {
2751 let wildCardLength = 9 - parts.length;
2752 for (let j = 0; j < wildCardLength; j++) {
2753 bytes.set(index, 0);
2754 bytes.set(index + 1, 0);
2755 index = 2;
2756 }
2757 } else {
2758 bytes.set(index, value >> 8);
2759 bytes.set(index + 1, value & 255);
2760 index = 2;
2761 }
2762 }
2763 return dart.as(bytes, List$(int));
2764 }
2765 static _uriEncode(canonicalTable, text, opt$) {
2766 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2767 let spaceToPlus = opt$.spaceToPlus === void 0 ? false : opt$.spaceToPlus;
2768 // Function byteToHex: (dynamic, dynamic) → dynamic
2769 function byteToHex(byte, buffer) {
2770 let hex = '0123456789ABCDEF';
2771 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int)));
2772 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int)));
2773 }
2774 let result = new StringBuffer();
2775 let bytes = encoding.encode(text);
2776 for (let i = 0; i < bytes.length; i++) {
2777 let byte = bytes.get(i);
2778 if (dart.notNull(byte < 128) && dart.notNull((canonicalTable.get(byte >> 4) & 1 << (byte & 15)) !== 0)) {
2779 result.writeCharCode(byte);
2780 } else if (dart.notNull(spaceToPlus) && dart.notNull(byte === _SPACE)) {
2781 result.writeCharCode(_PLUS);
2782 } else {
2783 result.writeCharCode(_PERCENT);
2784 byteToHex(byte, result);
2785 }
2786 }
2787 return result.toString();
2788 }
2789 static _hexCharPairToByte(s, pos) {
2790 let byte = 0;
2791 for (let i = 0; i < 2; i++) {
2792 let charCode = s.codeUnitAt(pos + i);
2793 if (dart.notNull(48 <= charCode) && dart.notNull(charCode <= 57)) {
2794 byte = byte * 16 + charCode - 48;
2795 } else {
2796 charCode = 32;
2797 if (dart.notNull(97 <= charCode) && dart.notNull(charCode <= 102)) {
2798 byte = byte * 16 + charCode - 87;
2799 } else {
2800 throw new ArgumentError("Invalid URL encoding");
2801 }
2802 }
2803 }
2804 return byte;
2805 }
2806 static _uriDecode(text, opt$) {
2807 let plusToSpace = opt$.plusToSpace === void 0 ? false : opt$.plusToSpace;
2808 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2809 let simple = true;
2810 for (let i = 0; dart.notNull(i < text.length) && dart.notNull(simple); i++ ) {
2811 let codeUnit = text.codeUnitAt(i);
2812 simple = dart.notNull(codeUnit !== _PERCENT) && dart.notNull(codeUnit != = _PLUS);
2813 }
2814 let bytes = null;
2815 if (simple) {
2816 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da rt.equals(encoding, convert.LATIN1))) {
2817 return text;
2818 } else {
2819 bytes = text.codeUnits;
2820 }
2821 } else {
2822 bytes = dart.as(new List(), List$(int));
2823 for (let i = 0; i < text.length; i++) {
2824 let codeUnit = text.codeUnitAt(i);
2825 if (codeUnit > 127) {
2826 throw new ArgumentError("Illegal percent encoding in URI");
2827 }
2828 if (codeUnit === _PERCENT) {
2829 if (i + 3 > text.length) {
2830 throw new ArgumentError('Truncated URI');
2831 }
2832 bytes.add(_hexCharPairToByte(text, i + 1));
2833 i = 2;
2834 } else if (dart.notNull(plusToSpace) && dart.notNull(codeUnit === _PLU S)) {
2835 bytes.add(_SPACE);
2836 } else {
2837 bytes.add(codeUnit);
2838 }
2839 }
2840 }
2841 return encoding.decode(bytes);
2842 }
2843 static _isAlphabeticCharacter(codeUnit) {
2844 return dart.notNull(dart.notNull(codeUnit >= _LOWER_CASE_A) && dart.notNul l(codeUnit <= _LOWER_CASE_Z)) || dart.notNull(dart.notNull(codeUnit >= _UPPER_CA SE_A) && dart.notNull(codeUnit <= _UPPER_CASE_Z));
2845 }
2846 }
2847 dart.defineNamedConstructor(Uri, '_internal');
2848 dart.defineNamedConstructor(Uri, 'http');
2849 dart.defineNamedConstructor(Uri, 'https');
2850 dart.defineNamedConstructor(Uri, 'file');
2851 Uri._SPACE = 32;
2852 Uri._DOUBLE_QUOTE = 34;
2853 Uri._NUMBER_SIGN = 35;
2854 Uri._PERCENT = 37;
2855 Uri._ASTERISK = 42;
2856 Uri._PLUS = 43;
2857 Uri._DOT = 46;
2858 Uri._SLASH = 47;
2859 Uri._ZERO = 48;
2860 Uri._NINE = 57;
2861 Uri._COLON = 58;
2862 Uri._LESS = 60;
2863 Uri._GREATER = 62;
2864 Uri._QUESTION = 63;
2865 Uri._AT_SIGN = 64;
2866 Uri._UPPER_CASE_A = 65;
2867 Uri._UPPER_CASE_F = 70;
2868 Uri._UPPER_CASE_Z = 90;
2869 Uri._LEFT_BRACKET = 91;
2870 Uri._BACKSLASH = 92;
2871 Uri._RIGHT_BRACKET = 93;
2872 Uri._LOWER_CASE_A = 97;
2873 Uri._LOWER_CASE_F = 102;
2874 Uri._LOWER_CASE_Z = 122;
2875 Uri._BAR = 124;
2876 Uri._unreservedTable = /* Unimplemented const */new List.from([0, 0, 24576, 10 23, 65534, 34815, 65534, 18431]);
2877 Uri._unreserved2396Table = /* Unimplemented const */new List.from([0, 0, 26498 , 1023, 65534, 34815, 65534, 18431]);
2878 Uri._encodeFullTable = /* Unimplemented const */new List.from([0, 0, 65498, 45 055, 65535, 34815, 65534, 18431]);
2879 Uri._schemeTable = /* Unimplemented const */new List.from([0, 0, 26624, 1023, 65534, 2047, 65534, 2047]);
2880 Uri._schemeLowerTable = /* Unimplemented const */new List.from([0, 0, 26624, 1 023, 0, 0, 65534, 2047]);
2881 Uri._subDelimitersTable = /* Unimplemented const */new List.from([0, 0, 32722, 11263, 65534, 34815, 65534, 18431]);
2882 Uri._genDelimitersTable = /* Unimplemented const */new List.from([0, 0, 32776, 33792, 1, 10240, 0, 0]);
2883 Uri._userinfoTable = /* Unimplemented const */new List.from([0, 0, 32722, 1228 7, 65534, 34815, 65534, 18431]);
2884 Uri._regNameTable = /* Unimplemented const */new List.from([0, 0, 32754, 11263 , 65534, 34815, 65534, 18431]);
2885 Uri._pathCharTable = /* Unimplemented const */new List.from([0, 0, 32722, 1228 7, 65535, 34815, 65534, 18431]);
2886 Uri._pathCharOrSlashTable = /* Unimplemented const */new List.from([0, 0, 6549 0, 12287, 65535, 34815, 65534, 18431]);
2887 Uri._queryCharTable = /* Unimplemented const */new List.from([0, 0, 65490, 450 55, 65535, 34815, 65534, 18431]);
2888 // Exports:
2889 exports.Deprecated = Deprecated;
2890 exports.deprecated = deprecated;
2891 exports.override = override;
2892 exports.proxy = proxy;
2893 exports.bool = bool;
2894 exports.Comparable = Comparable;
2895 exports.Comparable$ = Comparable$;
2896 exports.DateTime = DateTime;
2897 exports.double = double;
2898 exports.Duration = Duration;
2899 exports.Error = Error;
2900 exports.AssertionError = AssertionError;
2901 exports.TypeError = TypeError;
2902 exports.CastError = CastError;
2903 exports.NullThrownError = NullThrownError;
2904 exports.ArgumentError = ArgumentError;
2905 exports.RangeError = RangeError;
2906 exports.IndexError = IndexError;
2907 exports.FallThroughError = FallThroughError;
2908 exports.AbstractClassInstantiationError = AbstractClassInstantiationError;
2909 exports.NoSuchMethodError = NoSuchMethodError;
2910 exports.UnsupportedError = UnsupportedError;
2911 exports.UnimplementedError = UnimplementedError;
2912 exports.StateError = StateError;
2913 exports.ConcurrentModificationError = ConcurrentModificationError;
2914 exports.OutOfMemoryError = OutOfMemoryError;
2915 exports.StackOverflowError = StackOverflowError;
2916 exports.CyclicInitializationError = CyclicInitializationError;
2917 exports.Exception = Exception;
2918 exports.FormatException = FormatException;
2919 exports.IntegerDivisionByZeroException = IntegerDivisionByZeroException;
2920 exports.Expando = Expando;
2921 exports.Expando$ = Expando$;
2922 exports.Function = Function;
2923 exports.identical = identical;
2924 exports.identityHashCode = identityHashCode;
2925 exports.int = int;
2926 exports.Invocation = Invocation;
2927 exports.Iterable = Iterable;
2928 exports.Iterable$ = Iterable$;
2929 exports.BidirectionalIterator = BidirectionalIterator;
2930 exports.BidirectionalIterator$ = BidirectionalIterator$;
2931 exports.Iterator = Iterator;
2932 exports.Iterator$ = Iterator$;
2933 exports.List = List;
2934 exports.List$ = List$;
2935 exports.Map = Map;
2936 exports.Map$ = Map$;
2937 exports.Null = Null;
2938 exports.num = num;
2939 exports.Object = Object;
2940 exports.Pattern = Pattern;
2941 exports.print = print;
2942 exports.Match = Match;
2943 exports.RegExp = RegExp;
2944 exports.Set = Set;
2945 exports.Set$ = Set$;
2946 exports.Sink = Sink;
2947 exports.Sink$ = Sink$;
2948 exports.StackTrace = StackTrace;
2949 exports.Stopwatch = Stopwatch;
2950 exports.String = String;
2951 exports.Runes = Runes;
2952 exports.RuneIterator = RuneIterator;
2953 exports.StringBuffer = StringBuffer;
2954 exports.StringSink = StringSink;
2955 exports.Symbol = Symbol;
2956 exports.Type = Type;
2957 exports.Uri = Uri;
2958 })(core || (core = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/convert/convert.js ('k') | test/codegen/expect/dart/_foreign_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698