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/dart/core.js

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

Powered by Google App Engine
This is Rietveld 408576698