Skip to content

Instantly share code, notes, and snippets.

@mbreton
Created February 12, 2013 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbreton/4770464 to your computer and use it in GitHub Desktop.
Save mbreton/4770464 to your computer and use it in GitHub Desktop.
Minesweeper implementation in Dart
library minesweeper;
class Minesweeper {
int width;
int height;
List<String> _lines;
Minesweeper (){
width = 0;
height = 0;
}
Minesweeper.fromGrid(String grid) {
var lines = grid.split('\n');
var dimensions = lines[0].split(' ');
width = int.parse(dimensions[0]);
height = int.parse(dimensions[1]);
_lines = lines.getRange(1, lines.length -1);
}
bool isBomb (x, y){
if (x < 0 || x >= width || y < 0 || y >= height){
return false;
}
return _lines[y][x] == "*";
}
int countBomb(x,y) {
int result = 0;
for(var xx = x -1 ; xx <= x+1; ++xx) {
for(var yy = y -1 ; yy <= y+1; ++yy) {
if(isBomb(xx, yy)) {
result++;
}
}
}
return result;
}
String get solution {
var result = "";
for (var y=0; y < height; y++){
for (var x=0; x < width; x++){
result = "$result${isBomb(x,y) ? "*" : countBomb(x,y)}";
}
result = "$result\n";
}
return result;
}
}
import "packages/unittest/unittest.dart";
import "minesweeper.dart";
main (){
group ("Minesweeper", (){
test ("Should be instantiable with with and height", (){
Minesweeper minesweeper = new Minesweeper ();
expect (minesweeper.width, 0);
expect (minesweeper.height, 0);
});
Minesweeper minesweeper = new Minesweeper.fromGrid ("""
4 2
.*..
*...
""");
test ("Should be instantiable with a grid", (){
expect (minesweeper.width, 4);
expect (minesweeper.height, 2);
});
test("Should detect a bomb", () {
expect(minesweeper.isBomb(0,0), false);
expect(minesweeper.isBomb(1,0), true);
expect(minesweeper.isBomb(-1,0), false);
});
test("Should count the number of bomb", () {
expect(minesweeper.countBomb(0,0),2);
expect(minesweeper.countBomb(3,1),0);
});
test("Should render correctly the grid", () {
expect(minesweeper.solution, """
2*10
*210
""");
});
});
}
// Generated by dart2js, the Dart to JavaScript compiler.
// The code supports the following hooks:
// dartPrint(message) - if this function is defined it is called
// instead of the Dart [print] method.
// dartMainRunner(main) - if this function is defined, the Dart [main]
// method will not be invoked directly.
// Instead, a closure that will invoke [main] is
// passed to [dartMainRunner].
function Isolate() {}
init();
var $$ = {};
var $ = Isolate.$isolateProperties;
$$.DartError = {"": "Object;",
get$stack: function() {
return this.stack;
},
toString$0: function() {
var dartException = this.dartException;
if (!!Error.captureStackTrace || this.get$stack() == null)
return $.toString(dartException);
else
return $.S(dartException) + "\n" + $.S(this.get$stack());
},
DartError$1: function(dartException) {
this.dartException = dartException;
this.toString = $.DartError_toStringWrapper.call$0;
}
};
$$.StackTrace = {"": "Object;stack",
toString$0: function() {
var t1 = this.stack;
return !(t1 == null) ? t1 : "";
}
};
$$.Closure = {"": "Object;",
toString$0: function() {
return "Closure";
},
$isFunction: true
};
$$.Null = {"": "Object;"};
$$.MetaInfo = {"": "Object;_tag>,_tags,_set>"};
$$.JSSyntaxRegExp = {"": "Object;_liblib0$_pattern,_isMultiLine,_isCaseSensitive",
hasMatch$1: function(str) {
return $.regExpTest(this, $.checkString(str));
},
get$pattern: function() {
return this._liblib0$_pattern;
},
get$isMultiLine: function() {
return this._isMultiLine;
},
get$isCaseSensitive: function() {
return this._isCaseSensitive;
},
$isRegExp: true
};
$$.JsStringBuffer = {"": "Object;_contents",
get$length: function() {
return $.length(this._contents);
},
get$isEmpty: function() {
return $.$$eq($.length(this), 0);
},
add$1: function(obj) {
var t1, t2;
if (typeof obj !== "string")
return this.add$1$bailout(1, obj);
t1 = this._contents;
t2 = obj;
this._contents = t1 + t2;
},
add$1$bailout: function(state0, obj) {
var t1, t2;
t1 = this._contents;
t2 = typeof obj === "string" ? obj : $.S(obj);
this._contents = t1 + t2;
},
toString$0: function() {
return this._contents;
}
};
$$.Collection = {"": "Iterable;", $isCollection: true};
$$.DateTime = {"": "Object;millisecondsSinceEpoch>,isUtc",
$eq: function(other) {
if (other == null)
return false;
if (!(typeof other === "object" && other !== null && !!other.$isDateTime))
return false;
return $.$$eq(this.millisecondsSinceEpoch, other.millisecondsSinceEpoch);
},
$lt: function(other) {
var t1, t3;
t1 = this.millisecondsSinceEpoch;
t3 = other.get$millisecondsSinceEpoch();
if (typeof t1 !== "number")
return this.$$lt$bailout(1, other, t1);
if (typeof t3 !== "number")
return this.$$lt$bailout(2, null, t1, t3);
return t1 < t3;
},
$$lt$bailout: function(state0, other, t1, t3) {
switch (state0) {
case 0:
t1 = this.millisecondsSinceEpoch;
case 1:
state0 = 0;
t3 = other.get$millisecondsSinceEpoch();
case 2:
state0 = 0;
return $.$$lt(t1, t3);
}
},
$gt: function(other) {
var t1, t3;
t1 = this.millisecondsSinceEpoch;
t3 = other.get$millisecondsSinceEpoch();
if (typeof t1 !== "number")
return this.$$gt$bailout(1, other, t1);
if (typeof t3 !== "number")
return this.$$gt$bailout(2, null, t1, t3);
return t1 > t3;
},
$$gt$bailout: function(state0, other, t1, t3) {
switch (state0) {
case 0:
t1 = this.millisecondsSinceEpoch;
case 1:
state0 = 0;
t3 = other.get$millisecondsSinceEpoch();
case 2:
state0 = 0;
return $.$$gt(t1, t3);
}
},
$ge: function(other) {
return $.$$ge(this.millisecondsSinceEpoch, other.get$millisecondsSinceEpoch());
},
get$hashCode: function() {
return this.millisecondsSinceEpoch;
},
toString$0: function() {
var t1, t2, t3, y, m, d, h, min, sec, ms;
t1 = new $.DateTime_toString_fourDigits();
t2 = new $.DateTime_toString_threeDigits();
t3 = new $.DateTime_toString_twoDigits();
y = t1.call$1(this.get$year());
m = t3.call$1(this.get$month());
d = t3.call$1(this.get$day());
h = t3.call$1(this.get$hour());
min = t3.call$1(this.get$minute());
sec = t3.call$1(this.get$second());
ms = t2.call$1(this.get$millisecond());
if (this.isUtc === true)
return $.S(y) + "-" + $.S(m) + "-" + $.S(d) + " " + $.S(h) + ":" + $.S(min) + ":" + $.S(sec) + "." + $.S(ms) + "Z";
else
return $.S(y) + "-" + $.S(m) + "-" + $.S(d) + " " + $.S(h) + ":" + $.S(min) + ":" + $.S(sec) + "." + $.S(ms);
},
add$1: function(duration) {
var ms, t2;
ms = this.millisecondsSinceEpoch;
t2 = duration.get$inMilliseconds();
if (typeof ms !== "number")
return this.add$1$bailout0(1, duration, ms);
if (typeof t2 !== "number")
return this.add$1$bailout0(2, null, ms, t2);
return $.DateTime$fromMillisecondsSinceEpoch(ms + t2, this.isUtc);
},
add$1$bailout0: function(state0, duration, ms, t2) {
switch (state0) {
case 0:
ms = this.millisecondsSinceEpoch;
case 1:
state0 = 0;
t2 = duration.get$inMilliseconds();
case 2:
state0 = 0;
return $.DateTime$fromMillisecondsSinceEpoch($.$$add(ms, t2), this.isUtc);
}
},
get$year: function() {
return $.Primitives_getYear(this);
},
get$month: function() {
return $.Primitives_getMonth(this);
},
get$day: function() {
return $.Primitives_getDay(this);
},
get$hour: function() {
return $.Primitives_getHours(this);
},
get$minute: function() {
return $.Primitives_getMinutes(this);
},
get$second: function() {
return $.Primitives_getSeconds(this);
},
get$millisecond: function() {
return $.Primitives_getMilliseconds(this);
},
DateTime$_now$0: function() {
$.Primitives_lazyAsJsDate(this);
},
DateTime$fromMillisecondsSinceEpoch$2$isUtc: function(millisecondsSinceEpoch, isUtc) {
if ($.$$gt($.abs(millisecondsSinceEpoch), 8640000000000000) === true)
throw $.$$throw($.ArgumentError$(millisecondsSinceEpoch));
if (isUtc == null)
throw $.$$throw($.ArgumentError$(isUtc));
},
$isDateTime: true
};
$$.Duration = {"": "Object;inMilliseconds>",
get$inHours: function() {
return $.$$tdiv(this.inMilliseconds, 3600000);
},
get$inMinutes: function() {
return $.$$tdiv(this.inMilliseconds, 60000);
},
get$inSeconds: function() {
return $.$$tdiv(this.inMilliseconds, 1000);
},
$eq: function(other) {
if (other == null)
return false;
if (!(typeof other === "object" && other !== null && !!other.$isDuration))
return false;
return $.$$eq(this.inMilliseconds, other.inMilliseconds);
},
get$hashCode: function() {
return $.hashCode(this.inMilliseconds);
},
toString$0: function() {
var t1, t2, t3, t4, twoDigitMinutes, twoDigitSeconds, threeDigitMs;
t1 = new $.Duration_toString_threeDigits();
t2 = new $.Duration_toString_twoDigits();
t3 = this.inMilliseconds;
t4 = $.getInterceptor$JSNumber(t3);
if (t4.$lt(t3, 0) === true)
return "-" + $.S($.Duration$(0, 0, t4.$negate(t3), 0, 0));
twoDigitMinutes = t2.call$1($.remainder(this.get$inMinutes(), 60));
twoDigitSeconds = t2.call$1($.remainder(this.get$inSeconds(), 60));
threeDigitMs = t1.call$1(t4.remainder$1(t3, 1000));
return $.S(this.get$inHours()) + ":" + $.S(twoDigitMinutes) + ":" + $.S(twoDigitSeconds) + "." + $.S(threeDigitMs);
},
$isDuration: true
};
$$.NullThrownError = {"": "Object;",
toString$0: function() {
return "Throw of null.";
}
};
$$.ArgumentError = {"": "Object;message>",
toString$0: function() {
var t1 = this.message;
if (!(t1 == null))
return "Illegal argument(s): " + $.S(t1);
return "Illegal argument(s)";
}
};
$$.RangeError = {"": "ArgumentError;message",
toString$0: function() {
return "RangeError: " + $.S(this.message);
}
};
$$.NoSuchMethodError = {"": "Object;_receiver,_memberName,_arguments,_namedArguments,_existingArgumentNames",
toString$0: function() {
var t1, t2, t3, t4, i;
t1 = {};
t1.sb_0 = $.StringBuffer_StringBuffer("");
t1.i_1 = 0;
t2 = this._arguments;
if (typeof t2 !== "string" && (typeof t2 !== "object" || t2 === null || t2.constructor !== Array && !t2.$isJavaScriptIndexingBehavior))
return this.toString$0$bailout(1, t1, t2);
for (; $.$$lt(t1.i_1, t2.length) === true; t1.i_1 = $.$$add(t1.i_1, 1)) {
if ($.$$gt(t1.i_1, 0) === true)
$.add(t1.sb_0, ", ");
t3 = t1.sb_0;
t4 = t1.i_1;
if (t4 !== (t4 | 0))
throw $.iae(t4);
if (t4 < 0 || t4 >= t2.length)
throw $.ioore(t4);
$.add(t3, $.Error_safeToString(t2[t4]));
}
t2 = this._namedArguments;
if (!(t2 == null))
$.forEach(t2, new $.NoSuchMethodError_toString_anon(t1));
t2 = this._existingArgumentNames;
if (typeof t2 !== "string" && (typeof t2 !== "object" || t2 === null || t2.constructor !== Array && !t2.$isJavaScriptIndexingBehavior))
return this.toString$0$bailout(2, t1, t2);
t3 = $.toString(t1.sb_0);
t1.sb_0 = $.StringBuffer_StringBuffer("");
for (i = 0; i < t2.length; ++i) {
if (i > 0)
$.add(t1.sb_0, ", ");
t4 = t1.sb_0;
if (i >= t2.length)
throw $.ioore(i);
$.add(t4, t2[i]);
}
t2 = $.toString(t1.sb_0);
t4 = this._memberName;
return "NoSuchMethodError: incorrect number of arguments passed to method named '" + $.S(t4) + "'\n" + "Receiver: " + $.S($.Error_safeToString(this._receiver)) + "\n" + "Tried calling: " + $.S(t4) + "(" + $.S(t3) + ")\n" + "Found: " + $.S(t4) + "(" + $.S(t2) + ")";
},
toString$0$bailout: function(state0, t1, t2) {
switch (state0) {
case 0:
t1 = {};
t1.sb_0 = $.StringBuffer_StringBuffer("");
t1.i_1 = 0;
t2 = this._arguments;
case 1:
state0 = 0;
if (!(t2 == null))
for (t3 = $.getInterceptor$JSStringJSArray(t2); $.$$lt(t1.i_1, t3.get$length(t2)) === true; t1.i_1 = $.$$add(t1.i_1, 1)) {
if ($.$$gt(t1.i_1, 0) === true)
$.add(t1.sb_0, ", ");
$.add(t1.sb_0, $.Error_safeToString(t3.$index(t2, t1.i_1)));
}
t2 = this._namedArguments;
if (!(t2 == null))
$.forEach(t2, new $.NoSuchMethodError_toString_anon(t1));
t2 = this._existingArgumentNames;
case 2:
var t3, t4, i;
state0 = 0;
if (t2 == null)
return "NoSuchMethodError : method not found: '" + $.S(this._memberName) + "'\n" + "Receiver: " + $.S($.Error_safeToString(this._receiver)) + "\n" + "Arguments: [" + $.S(t1.sb_0) + "]";
else {
t3 = $.toString(t1.sb_0);
t1.sb_0 = $.StringBuffer_StringBuffer("");
for (t4 = $.getInterceptor$JSStringJSArray(t2), i = 0; $.CONSTANT2.$lt(i, t4.get$length(t2)); ++i) {
if (i > 0)
$.add(t1.sb_0, ", ");
$.add(t1.sb_0, t4.$index(t2, i));
}
t2 = $.toString(t1.sb_0);
t4 = this._memberName;
return "NoSuchMethodError: incorrect number of arguments passed to method named '" + $.S(t4) + "'\n" + "Receiver: " + $.S($.Error_safeToString(this._receiver)) + "\n" + "Tried calling: " + $.S(t4) + "(" + $.S(t3) + ")\n" + "Found: " + $.S(t4) + "(" + $.S(t2) + ")";
}
}
}
};
$$.UnsupportedError = {"": "Object;message>",
toString$0: function() {
return "Unsupported operation: " + $.S(this.get$message());
}
};
$$.UnimplementedError = {"": "Object;message>",
toString$0: function() {
var t1 = this.message;
return !(t1 == null) ? "UnimplementedError: " + $.S(t1) : "UnimplementedError";
}
};
$$.StateError = {"": "Object;message>",
toString$0: function() {
return "Bad state: " + this.message;
}
};
$$.ConcurrentModificationError = {"": "Object;modifiedObject",
toString$0: function() {
var t1 = this.modifiedObject;
if (t1 == null)
return "Concurrent modification during iteration.";
return "Concurrent modification during iteration: " + $.S($.Error_safeToString(t1)) + ".";
}
};
$$.StackOverflowError = {"": "Object;",
toString$0: function() {
return "Stack Overflow";
}
};
$$.RuntimeError = {"": "Object;message>",
toString$0: function() {
return "RuntimeError: " + this.message;
}
};
$$._ExceptionImplementation = {"": "Object;message>",
toString$0: function() {
var t1 = this.message;
if (t1 == null)
return "Exception";
return "Exception: " + $.S(t1);
},
$isException: true
};
$$.FormatException = {"": "Object;message>",
toString$0: function() {
return "FormatException: " + $.S(this.message);
},
$isException: true
};
$$.IllegalJSRegExpException = {"": "Object;_pattern,_errmsg",
toString$0: function() {
return "IllegalJSRegExpException: '" + $.S(this._pattern) + "' '" + this._errmsg + "'";
},
$isException: true
};
$$.ExpectException = {"": "Object;message>",
toString$0: function() {
return this.message;
},
$isExpectException: true,
$isException: true
};
$$.Iterable = {"": "Object;",
mappedBy$1: function(f) {
return $.MappedIterable$(this, f);
},
where$1: function(f) {
return $.WhereIterable$(this, f);
},
forEach$1: function(f) {
var t1;
for (t1 = $.iterator(this); t1.moveNext$0() === true;)
f.call$1(t1.get$current());
},
toList$0: function() {
return $.List_List$from(this);
},
get$length: function() {
var t1, count;
t1 = $.iterator(this);
for (count = 0; t1.moveNext$0() === true;)
++count;
return count;
},
get$isEmpty: function() {
return $.iterator(this).moveNext$0() !== true;
},
$isIterable: true
};
$$.Iterator = {"": "Object;"};
$$.Object = {"": ";",
$eq: function(other) {
if (other == null)
return false;
return this === other;
},
get$hashCode: function() {
return $.Primitives_objectHashCode(this);
},
toString$0: function() {
return "Instance of '" + $.S($.Primitives_objectTypeName(this)) + "'";
}
};
$$.ObjectInterceptor = {"": "Object;",
toString$0: function(receiver) {
return receiver.toString$0();
},
$eq: function(receiver, a0) {
return receiver.$eq(a0);
},
charCodeAt$1: function(receiver, a0) {
return receiver.charCodeAt$1(a0);
},
get$iterator: function(receiver) {
return receiver.get$iterator();
},
substring$1: function(receiver, a0) {
return receiver.substring$1(a0);
},
$indexSet: function(receiver, a0, a1) {
return receiver.$indexSet(a0, a1);
},
removeLast$0: function(receiver) {
return receiver.removeLast$0();
},
endsWith$1: function(receiver, a0) {
return receiver.endsWith$1(a0);
},
replaceAll$2: function(receiver, a0, a1) {
return receiver.replaceAll$2(a0, a1);
},
forEach$1: function(receiver, a0) {
return receiver.forEach$1(a0);
},
get$length: function(receiver) {
return receiver.get$length();
},
$add: function(receiver, a0) {
return receiver.$add(a0);
},
getRange$2: function(receiver, a0, a1) {
return receiver.getRange$2(a0, a1);
},
toList$0: function(receiver) {
return receiver.toList$0();
},
get$hashCode: function(receiver) {
return receiver.get$hashCode();
},
$lt: function(receiver, a0) {
return receiver.$lt(a0);
},
$xor: function(receiver, a0) {
return receiver.$xor(a0);
},
truncate$0: function(receiver) {
return receiver.truncate$0();
},
$mul: function(receiver, a0) {
return receiver.$mul(a0);
},
startsWith$1: function(receiver, a0) {
return receiver.startsWith$1(a0);
},
abs$0: function(receiver) {
return receiver.abs$0();
},
$tdiv: function(receiver, a0) {
return receiver.$tdiv(a0);
},
toUpperCase$0: function(receiver) {
return receiver.toUpperCase$0();
},
$and: function(receiver, a0) {
return receiver.$and(a0);
},
$index: function(receiver, a0) {
return receiver.$index(a0);
},
mappedBy$1: function(receiver, a0) {
return receiver.mappedBy$1(a0);
},
ceil$0: function(receiver) {
return receiver.ceil$0();
},
$gt: function(receiver, a0) {
return receiver.$gt(a0);
},
where$1: function(receiver, a0) {
return receiver.where$1(a0);
},
$negate: function(receiver) {
return receiver.$negate();
},
$ge: function(receiver, a0) {
return receiver.$ge(a0);
},
toLowerCase$0: function(receiver) {
return receiver.toLowerCase$0();
},
$or: function(receiver, a0) {
return receiver.$or(a0);
},
floor$0: function(receiver) {
return receiver.floor$0();
},
add$1: function(receiver, a0) {
return receiver.add$1(a0);
},
remove$1: function(receiver, a0) {
return receiver.remove$1(a0);
},
get$isEmpty: function(receiver) {
return receiver.get$isEmpty();
},
addLast$1: function(receiver, a0) {
return receiver.addLast$1(a0);
},
$sub: function(receiver, a0) {
return receiver.$sub(a0);
},
remainder$1: function(receiver, a0) {
return receiver.remainder$1(a0);
},
split$1: function(receiver, a0) {
return receiver.split$1(a0);
},
$shl: function(receiver, a0) {
return receiver.$shl(a0);
}
};
$$.JSFunction = {"": "Object;",
toString$0: function(receiver) {
return "Closure";
},
$isFunction: true,
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSBool = {"": "Object;",
toString$0: function(receiver) {
return String(receiver);
},
get$hashCode: function(receiver) {
return receiver ? 519018 : 218159;
},
$isbool: true,
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSNull = {"": "Object;",
toString$0: function(receiver) {
return "null";
},
get$hashCode: function(receiver) {
return 0;
},
$eq: function(receiver, a) {
return receiver == a;
}
};
$$.JSArray = {"": "Object;",
add$1: function(receiver, value) {
$.checkGrowable(receiver, "add");
receiver.push(value);
},
removeLast$0: function(receiver) {
$.checkGrowable(receiver, "removeLast");
if (receiver.length === 0)
throw $.$$throw($.RangeError$value(-1));
return receiver.pop();
},
remove$1: function(receiver, element) {
var i;
$.checkGrowable(receiver, "remove");
for (i = 0; i < receiver.length; ++i)
if ($.$$eq(receiver[i], element) === true) {
receiver.splice(i, 1);
return;
}
},
where$1: function(receiver, f) {
return $.WhereIterable$(receiver, f);
},
addLast$1: function(receiver, value) {
$.checkGrowable(receiver, "addLast");
receiver.push(value);
},
forEach$1: function(receiver, f) {
var t1;
for (t1 = this.get$iterator(receiver); t1.moveNext$0() === true;)
f.call$1(t1.get$current());
return;
},
mappedBy$1: function(receiver, f) {
return $.MappedList$(receiver, f);
},
getRange$2: function(receiver, start, length) {
var t1, end;
if (0 === length)
return [];
$.checkNull(start);
$.checkNull(length);
if (!(typeof length === "number" && Math.floor(length) === length))
throw $.$$throw($.ArgumentError$(length));
t1 = length < 0;
if (t1)
throw $.$$throw($.ArgumentError$(length));
if (start < 0)
throw $.$$throw($.RangeError$value(start));
end = start + length;
if (end > receiver.length)
throw $.$$throw($.RangeError$value(length));
if (t1)
throw $.$$throw($.ArgumentError$(length));
return receiver.slice(start, end);
},
get$isEmpty: function(receiver) {
return receiver.length === 0;
},
toString$0: function(receiver) {
return $.Collections_collectionToString(receiver);
},
toList$0: function(receiver) {
return $.List_List$from(receiver);
},
get$iterator: function(receiver) {
return $.ListIterator$(receiver);
},
get$hashCode: function(receiver) {
return $.Primitives_objectHashCode(receiver);
},
get$length: function(receiver) {
return receiver.length;
},
$index: function(receiver, index) {
if (!(typeof index === "number" && Math.floor(index) === index))
throw $.$$throw($.ArgumentError$(index));
if (index >= receiver.length || index < 0)
throw $.$$throw($.RangeError$value(index));
return receiver[index];
},
$indexSet: function(receiver, index, value) {
$.checkMutable(receiver, "indexed set");
if (!(typeof index === "number" && Math.floor(index) === index))
throw $.$$throw($.ArgumentError$(index));
if (index >= receiver.length || index < 0)
throw $.$$throw($.RangeError$value(index));
receiver[index] = value;
},
$isList: true,
$isCollection: true,
$isIterable: true,
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSNumber = {"": "Object;",
remainder$1: function(receiver, b) {
$.checkNull(b);
return receiver % b;
},
abs$0: function(receiver) {
return Math.abs(receiver);
},
ceil$0: function(receiver) {
return Math.ceil(receiver);
},
floor$0: function(receiver) {
return Math.floor(receiver);
},
truncate$0: function(receiver) {
return receiver < 0 ? this.ceil$0(receiver) : this.floor$0(receiver);
},
toString$0: function(receiver) {
if (receiver === 0 && (1 / receiver) < 0)
return "-0.0";
else
return String(receiver);
},
get$hashCode: function(receiver) {
return receiver & 0x1FFFFFFF;
},
$negate: function(receiver) {
return -receiver;
},
$add: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return receiver + other;
},
$sub: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return receiver - other;
},
$mul: function(receiver, other) {
return receiver * other;
},
$tdiv: function(receiver, other) {
return this.truncate$0(receiver / other);
},
$shl: function(receiver, other) {
if (other < 0)
throw $.$$throw($.ArgumentError$(other));
if (other > 31)
return 0;
return (receiver << other) >>> 0;
},
$and: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return (receiver & other) >>> 0;
},
$or: function(receiver, other) {
return (receiver | other) >>> 0;
},
$xor: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return (receiver ^ other) >>> 0;
},
$lt: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return receiver < other;
},
$gt: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return receiver > other;
},
$ge: function(receiver, other) {
if (!(typeof other === "number"))
throw $.$$throw($.ArgumentError$(other));
return receiver >= other;
},
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSInt = {"": "JSNumber;",
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSDouble = {"": "JSNumber;",
$eq: function(receiver, a) {
return receiver === a;
}
};
$$.JSString = {"": "Object;",
charCodeAt$1: function(receiver, index) {
if (index < 0)
throw $.$$throw($.RangeError$value(index));
if (index >= receiver.length)
throw $.$$throw($.RangeError$value(index));
return receiver.charCodeAt(index);
},
endsWith$1: function(receiver, other) {
var otherLength, t1;
$.checkString(other);
otherLength = other.length;
t1 = receiver.length;
if (otherLength > t1)
return false;
return other === this.substring$1(receiver, t1 - otherLength);
},
replaceAll$2: function(receiver, from, to) {
$.checkString(to);
return $.stringReplaceAllUnchecked(receiver, from, to);
},
split$1: function(receiver, pattern) {
$.checkNull(pattern);
return receiver.split(pattern);
},
startsWith$1: function(receiver, other) {
var otherLength;
$.checkString(other);
otherLength = other.length;
if (otherLength > receiver.length)
return false;
return other == receiver.substring(0, otherLength);
},
substring$2: function(receiver, startIndex, endIndex) {
var t1;
$.checkNum(startIndex);
if (endIndex == null)
endIndex = receiver.length;
$.checkNum(endIndex);
t1 = $.getInterceptor$JSNumber(startIndex);
if (t1.$lt(startIndex, 0) === true)
throw $.$$throw($.RangeError$value(startIndex));
if (t1.$gt(startIndex, endIndex) === true)
throw $.$$throw($.RangeError$value(startIndex));
if ($.$$gt(endIndex, receiver.length) === true)
throw $.$$throw($.RangeError$value(endIndex));
return receiver.substring(startIndex, endIndex);
},
substring$1: function($receiver, startIndex) {
return this.substring$2($receiver, startIndex, null);
},
toLowerCase$0: function(receiver) {
return receiver.toLowerCase();
},
toUpperCase$0: function(receiver) {
return receiver.toUpperCase();
},
get$isEmpty: function(receiver) {
return receiver.length === 0;
},
toString$0: function(receiver) {
return receiver;
},
get$hashCode: function(receiver) {
var hash, i, hash0, hash1;
for (hash = 0, i = 0; i < receiver.length; ++i, hash = hash1) {
hash0 = 536870911 & hash + receiver.charCodeAt(i);
hash1 = 536870911 & hash0 + ((524287 & hash0) << 10 >>> 0);
hash1 = hash1 ^ (hash1 >> 6);
}
hash0 = 536870911 & hash + ((67108863 & hash) << 3 >>> 0);
hash0 = hash0 ^ (hash0 >> 11);
return 536870911 & hash0 + ((16383 & hash0) << 15 >>> 0);
},
get$length: function(receiver) {
return receiver.length;
},
$index: function(receiver, index) {
if (!(typeof index === "number" && Math.floor(index) === index))
throw $.$$throw($.ArgumentError$(index));
if (index >= receiver.length || index < 0)
throw $.$$throw($.RangeError$value(index));
return receiver[index];
},
$isString: true,
$eq: function(receiver, a) {
return receiver === a;
}
};
$$._HashMapImpl = {"": "Object;_keys>,_values>,_loadLimit,_numberOfEntries,_numberOfDeleted",
_probeForAdding$1: function(key) {
var t1, t3, hash, numberOfProbes, insertionIndex, existingKey, numberOfProbes0;
if (key == null)
throw $.$$throw($.ArgumentError$(null));
t1 = $.hashCode(key);
t3 = this._keys.length;
if (t1 !== (t1 | 0))
return this._probeForAdding$1$bailout(1, key, t1);
hash = (t1 & t3 - 1) >>> 0;
for (numberOfProbes = 1, insertionIndex = -1; true; numberOfProbes = numberOfProbes0) {
t1 = this._keys;
if (hash < 0 || hash >= t1.length)
throw $.ioore(hash);
existingKey = t1[hash];
if (existingKey == null) {
if (insertionIndex < 0)
return hash;
return insertionIndex;
} else if ($.$$eq(existingKey, key) === true)
return hash;
else if (insertionIndex < 0 && existingKey === $.CONSTANT3)
insertionIndex = hash;
numberOfProbes0 = numberOfProbes + 1;
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length);
if (hash !== (hash | 0))
return this._probeForAdding$1$bailout(2, key, null, hash, numberOfProbes0, insertionIndex);
}
},
_probeForAdding$1$bailout: function(state0, key, t1, hash, numberOfProbes0, insertionIndex) {
switch (state0) {
case 0:
if (key == null)
throw $.$$throw($.ArgumentError$(null));
t1 = $.hashCode(key);
case 1:
state0 = 0;
hash = $.$$and(t1, this._keys.length - 1);
numberOfProbes = 1;
insertionIndex = -1;
case 2:
var numberOfProbes, existingKey;
L0:
while (true)
switch (state0) {
case 0:
if (!true)
break L0;
t1 = this._keys;
if (hash !== (hash | 0))
throw $.iae(hash);
if (hash < 0 || hash >= t1.length)
throw $.ioore(hash);
existingKey = t1[hash];
if (existingKey == null) {
if (insertionIndex < 0)
return hash;
return insertionIndex;
} else if ($.$$eq(existingKey, key) === true)
return hash;
else if (insertionIndex < 0 && existingKey === $.CONSTANT3)
insertionIndex = hash;
numberOfProbes0 = numberOfProbes + 1;
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length);
case 2:
state0 = 0;
numberOfProbes = numberOfProbes0;
}
}
},
_probeForLookup$1: function(key) {
var t1, hash, numberOfProbes, existingKey, numberOfProbes0;
if (key == null)
throw $.$$throw($.ArgumentError$(null));
t1 = $.$$and($.hashCode(key), this._keys.length - 1);
if (t1 !== (t1 | 0))
return this._probeForLookup$1$bailout(1, key, t1);
for (hash = t1, numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) {
t1 = this._keys;
if (hash !== (hash | 0))
throw $.iae(hash);
if (hash < 0 || hash >= t1.length)
throw $.ioore(hash);
existingKey = t1[hash];
if (existingKey == null)
return -1;
if ($.$$eq(existingKey, key) === true)
return hash;
numberOfProbes0 = numberOfProbes + 1;
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length);
}
},
_probeForLookup$1$bailout: function(state0, key, t1) {
var hash, numberOfProbes, existingKey, numberOfProbes0;
for (hash = t1, numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) {
t1 = this._keys;
if (hash !== (hash | 0))
throw $.iae(hash);
if (hash < 0 || hash >= t1.length)
throw $.ioore(hash);
existingKey = t1[hash];
if (existingKey == null)
return -1;
if ($.$$eq(existingKey, key) === true)
return hash;
numberOfProbes0 = numberOfProbes + 1;
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length);
}
},
_ensureCapacity$0: function() {
var t1, capacity, t2;
t1 = $.$$add(this._numberOfEntries, 1);
if ($.$$ge(t1, this._loadLimit) === true) {
this._grow$1(this._keys.length * 2);
return;
}
capacity = this._keys.length;
if (typeof t1 !== "number")
throw $.iae(t1);
t2 = this._numberOfDeleted;
if (t2 > capacity - t1 - t2)
this._grow$1(capacity);
},
_grow$1: function(newCapacity) {
var capacity, oldKeys, oldValues, i, key, value, newIndex, t1;
capacity = this._keys.length;
this._loadLimit = $.$$tdiv($.$$mul(newCapacity, 3), 4);
oldKeys = this._keys;
oldValues = this._values;
this._keys = $.List_List$fixedLength(newCapacity, null);
this._values = $.List_List$fixedLength(newCapacity, null);
for (i = 0; i < capacity; ++i) {
if (i >= oldKeys.length)
throw $.ioore(i);
key = oldKeys[i];
if (key == null || key === $.CONSTANT3)
continue;
if (i >= oldValues.length)
throw $.ioore(i);
value = oldValues[i];
newIndex = this._probeForAdding$1(key);
t1 = this._keys;
if (newIndex !== (newIndex | 0))
throw $.iae(newIndex);
if (newIndex < 0 || newIndex >= t1.length)
throw $.ioore(newIndex);
t1[newIndex] = key;
t1 = this._values;
if (newIndex >= t1.length)
throw $.ioore(newIndex);
t1[newIndex] = value;
}
this._numberOfDeleted = 0;
},
$indexSet: function(key, value) {
var index, t1;
this._ensureCapacity$0();
index = this._probeForAdding$1(key);
t1 = this._keys;
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
t1 = t1[index];
if (t1 == null || t1 === $.CONSTANT3) {
t1 = this._numberOfEntries;
if (typeof t1 !== "number")
return this.$$indexSet$bailout0(1, key, value, t1, index);
this._numberOfEntries = t1 + 1;
}
t1 = this._keys;
if (index >= t1.length)
throw $.ioore(index);
t1[index] = key;
t1 = this._values;
if (index >= t1.length)
throw $.ioore(index);
t1[index] = value;
},
$$indexSet$bailout0: function(state0, key, value, t1, index) {
switch (state0) {
case 0:
this._ensureCapacity$0();
index = this._probeForAdding$1(key);
t1 = this._keys;
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
t1 = t1[index];
case 1:
if (state0 === 1 || state0 === 0 && (t1 == null || t1 === $.CONSTANT3))
switch (state0) {
case 0:
t1 = this._numberOfEntries;
case 1:
state0 = 0;
this._numberOfEntries = $.$$add(t1, 1);
}
t1 = this._keys;
if (index >= t1.length)
throw $.ioore(index);
t1[index] = key;
t1 = this._values;
if (index >= t1.length)
throw $.ioore(index);
t1[index] = value;
}
},
$index: function(key) {
var index, t1;
index = this._probeForLookup$1(key);
if (typeof index !== "number")
return this.$$index$bailout(1, index);
if (index < 0)
return;
t1 = this._values;
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
return t1[index];
},
$$index$bailout: function(state0, index) {
var t1;
if ($.$$lt(index, 0) === true)
return;
t1 = this._values;
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
return t1[index];
},
remove$1: function(key) {
var index, t1, value;
index = this._probeForLookup$1(key);
if ($.$$ge(index, 0) === true) {
this._numberOfEntries = $.$$sub(this._numberOfEntries, 1);
t1 = this._values;
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
value = t1[index];
t1[index] = null;
t1 = this._keys;
if (index >= t1.length)
throw $.ioore(index);
t1[index] = $.CONSTANT3;
this._numberOfDeleted = this._numberOfDeleted + 1;
return value;
}
return;
},
get$isEmpty: function() {
return $.$$eq(this._numberOfEntries, 0);
},
get$length: function() {
return this._numberOfEntries;
},
forEach$1: function(f) {
var it, t1, t2, t3;
it = $._HashMapImplIndexIterator$(this);
for (; it.moveNext$0() === true;) {
t1 = this._keys;
t2 = it.get$current();
if (t2 !== (t2 | 0))
throw $.iae(t2);
if (t2 < 0 || t2 >= t1.length)
throw $.ioore(t2);
t2 = t1[t2];
t1 = this._values;
t3 = it.get$current();
if (t3 !== (t3 | 0))
throw $.iae(t3);
if (t3 < 0 || t3 >= t1.length)
throw $.ioore(t3);
f.call$2(t2, t1[t3]);
}
},
get$keys: function() {
return $._HashMapImplKeyIterable$(this);
},
get$values: function() {
return $._HashMapImplValueIterable$(this);
},
containsKey$1: function(key) {
return $.$$eq(this._probeForLookup$1(key), -1) !== true;
},
toString$0: function() {
return $.Maps_mapToString(this);
},
_HashMapImpl$0: function() {
this._numberOfEntries = 0;
this._numberOfDeleted = 0;
this._loadLimit = $._HashMapImpl__computeLoadLimit(8);
this._keys = $.List_List$fixedLength(8, null);
this._values = $.List_List$fixedLength(8, null);
},
$isMap: true
};
$$._HashMapImplKeyIterable = {"": "Iterable;_map",
get$iterator: function() {
return $._HashMapImplKeyIterator$(this._map);
}
};
$$._HashMapImplValueIterable = {"": "Iterable;_map",
get$iterator: function() {
return $._HashMapImplValueIterator$(this._map);
}
};
$$._HashMapImplIterator = {"": "Object;",
moveNext$0: function() {
var t1, t2, t4, newIndex, t3, t5;
t1 = this._map;
t2 = $.length(t1.get$_keys());
if (typeof t2 !== "number")
return this.moveNext$0$bailout(1, t2, t1);
t4 = this._index;
if (typeof t4 !== "number")
return this.moveNext$0$bailout(2, t2, t1, t4);
newIndex = t4 + 1;
for (t3 = t1.get$_keys(); newIndex < t2;) {
if (typeof t3 !== "string" && (typeof t3 !== "object" || t3 === null || t3.constructor !== Array && !t3.$isJavaScriptIndexingBehavior))
return this.moveNext$0$bailout(3, t2, t1, t3, newIndex, $.CONSTANT4);
if (newIndex !== (newIndex | 0))
throw $.iae(newIndex);
if (newIndex < 0 || newIndex >= t3.length)
throw $.ioore(newIndex);
t5 = t3[newIndex];
if (!(t5 == null) && !(t5 === $.CONSTANT3)) {
this._current = this._computeCurrentFromIndex$3(newIndex, t3, t1.get$_values());
this._index = newIndex;
return true;
}
++newIndex;
}
this._index = t2;
this._current = null;
return false;
},
moveNext$0$bailout: function(state0, t2, t1, t4, newIndex, t3) {
switch (state0) {
case 0:
t1 = this._map;
t2 = $.length(t1.get$_keys());
case 1:
state0 = 0;
t4 = this._index;
case 2:
state0 = 0;
newIndex = $.$$add(t4, 1);
case 3:
L0:
while (true)
switch (state0) {
case 0:
t3 = $.getInterceptor$JSNumber(newIndex);
if (!(t3.$lt(newIndex, t2) === true))
break L0;
t4 = t1.get$_keys();
case 3:
state0 = 0;
t4 = $.$$index(t4, newIndex);
if (!(t4 == null) && !(t4 === $.CONSTANT3)) {
this._current = this._computeCurrentFromIndex$3(newIndex, t1.get$_keys(), t1.get$_values());
this._index = newIndex;
return true;
}
newIndex = t3.$add(newIndex, 1);
}
this._index = t2;
this._current = null;
return false;
}
},
get$current: function() {
return this._current;
}
};
$$._HashMapImplKeyIterator = {"": "_HashMapImplIterator;_map,_index,_current",
_computeCurrentFromIndex$3: function(index, keys, values) {
return $.$$index(keys, index);
}
};
$$._HashMapImplValueIterator = {"": "_HashMapImplIterator;_map,_index,_current",
_computeCurrentFromIndex$3: function(index, keys, values) {
return $.$$index(values, index);
}
};
$$._HashMapImplIndexIterator = {"": "_HashMapImplIterator;_map,_index,_current",
_computeCurrentFromIndex$3: function(index, keys, values) {
return index;
}
};
$$._DeletedKeySentinel = {"": "Object;"};
$$._KeyValuePair = {"": "Object;key>,value="};
$$._LinkedHashMapImpl = {"": "Object;_list,_map",
$indexSet: function(key, value) {
var t1, t3;
if (this._map.containsKey$1(key) === true) {
t1 = this._map;
if (typeof t1 !== "string" && (typeof t1 !== "object" || t1 === null || t1.constructor !== Array && !t1.$isJavaScriptIndexingBehavior))
return this.$$indexSet$bailout(1, key, value, t1);
if (key !== (key | 0))
throw $.iae(key);
if (key < 0 || key >= t1.length)
throw $.ioore(key);
t1[key].get$element().set$value(value);
} else {
this._list.addLast$1($._KeyValuePair$(key, value));
t1 = this._map;
t3 = this._list.lastEntry$0();
if (typeof t1 !== "object" || t1 === null || (t1.constructor !== Array || !!t1.immutable$list) && !t1.$isJavaScriptIndexingBehavior)
return this.$$indexSet$bailout(2, key, null, t1);
if (key !== (key | 0))
throw $.iae(key);
if (key < 0 || key >= t1.length)
throw $.ioore(key);
t1[key] = t3;
}
},
$$indexSet$bailout: function(state0, key, value, t1) {
switch (state0) {
case 0:
default:
if (state0 === 1 || state0 === 0 && this._map.containsKey$1(key) === true)
switch (state0) {
case 0:
t1 = this._map;
case 1:
state0 = 0;
$.$$index(t1, key).get$element().set$value(value);
}
else
switch (state0) {
case 0:
this._list.addLast$1($._KeyValuePair$(key, value));
t1 = this._map;
case 2:
state0 = 0;
$.$$indexSet(t1, key, this._list.lastEntry$0());
}
}
},
$index: function(key) {
var t1 = $.$$index(this._map, key);
if (t1 == null)
return;
return t1.get$element().get$value();
},
remove$1: function(key) {
var t1 = $.remove(this._map, key);
if (t1 == null)
return;
t1.remove$0();
return t1.get$element().get$value();
},
get$keys: function() {
return $.MappedIterable$(this._list, new $._LinkedHashMapImpl_keys_anon());
},
get$values: function() {
return $.MappedIterable$(this._list, new $._LinkedHashMapImpl_values_anon());
},
forEach$1: function(f) {
this._list.forEach$1(new $._LinkedHashMapImpl_forEach_anon(f));
},
containsKey$1: function(key) {
return this._map.containsKey$1(key);
},
get$length: function() {
return $.length(this._map);
},
get$isEmpty: function() {
return $.$$eq($.length(this), 0);
},
toString$0: function() {
return $.Maps_mapToString(this);
},
_LinkedHashMapImpl$0: function() {
this._map = $.HashMap_HashMap();
this._list = $.DoubleLinkedQueue$();
},
$isMap: true
};
$$.DoubleLinkedQueueEntry = {"": "Object;_previous=,_next=,_element",
_link$2: function(p, n) {
this._next = n;
this._previous = p;
p.set$_next(this);
n.set$_previous(this);
},
prepend$1: function(e) {
$.DoubleLinkedQueueEntry$(e)._link$2(this._previous, this);
},
remove$0: function() {
var t1 = this._next;
this._previous.set$_next(t1);
t1 = this._previous;
this._next.set$_previous(t1);
this._next = null;
this._previous = null;
return this._element;
},
_asNonSentinelEntry$0: function() {
return this;
},
previousEntry$0: function() {
return this._previous._asNonSentinelEntry$0();
},
nextEntry$0: function() {
return this._next._asNonSentinelEntry$0();
},
get$element: function() {
return this._element;
},
DoubleLinkedQueueEntry$1: function(e) {
this._element = e;
}
};
$$._DoubleLinkedQueueEntrySentinel = {"": "DoubleLinkedQueueEntry;_previous,_next,_element",
remove$0: function() {
throw $.$$throw($.StateError$("Empty queue"));
},
_asNonSentinelEntry$0: function() {
return;
},
get$element: function() {
throw $.$$throw($.StateError$("Empty queue"));
},
_DoubleLinkedQueueEntrySentinel$0: function() {
this._link$2(this, this);
}
};
$$.DoubleLinkedQueue = {"": "Iterable;_sentinel",
addLast$1: function(value) {
this._sentinel.prepend$1(value);
},
add$1: function(value) {
this._sentinel.prepend$1(value);
},
removeLast$0: function() {
return this._sentinel._previous.remove$0();
},
removeFirst$0: function() {
return this._sentinel._next.remove$0();
},
remove$1: function(o) {
var entry = this._sentinel.nextEntry$0();
for (; !(entry === this._sentinel);) {
if ($.$$eq(entry.get$element(), o) === true) {
entry.remove$0();
return;
}
entry = entry.get$_next();
}
},
lastEntry$0: function() {
return this._sentinel.previousEntry$0();
},
get$isEmpty: function() {
var t1 = this._sentinel;
return t1._next === t1;
},
get$iterator: function() {
return $._DoubleLinkedQueueIterator$(this._sentinel);
},
toString$0: function() {
return $.Collections_collectionToString(this);
},
DoubleLinkedQueue$0: function() {
this._sentinel = $._DoubleLinkedQueueEntrySentinel$();
},
$isCollection: true,
$isIterable: true
};
$$._DoubleLinkedQueueIterator = {"": "Object;_sentinel,_currentEntry,_current",
moveNext$0: function() {
var t1, t2;
t1 = this._currentEntry;
if (t1 == null)
return false;
this._currentEntry = t1.get$_next();
t1 = this._currentEntry;
t2 = this._sentinel;
if (t1 == null ? t2 == null : t1 === t2) {
this._currentEntry = null;
this._current = null;
this._sentinel = null;
return false;
}
this._current = t1.get$element();
return true;
},
get$current: function() {
return this._current;
}
};
$$.MappedIterable = {"": "Iterable;_iterable,_f",
_f$1: function(arg0) {
return this._f.call$1(arg0);
},
get$iterator: function() {
return $.MappedIterator$($.iterator(this._iterable), this._f);
},
get$length: function() {
return $.length(this._iterable);
},
get$isEmpty: function() {
return $.isEmpty(this._iterable);
}
};
$$.MappedIterator = {"": "Iterator;_liblib$_current,_iterator,_f",
_f$1: function(arg0) {
return this._f.call$1(arg0);
},
moveNext$0: function() {
var t1 = this._iterator;
if (t1.moveNext$0() === true) {
this._liblib$_current = this._f$1(t1.get$current());
return true;
} else {
this._liblib$_current = null;
return false;
}
},
get$current: function() {
return this._liblib$_current;
}
};
$$.WhereIterable = {"": "Iterable;_iterable,_f",
_f$1: function(arg0) {
return this._f.call$1(arg0);
},
get$iterator: function() {
return $.WhereIterator$($.iterator(this._iterable), this._f);
}
};
$$.WhereIterator = {"": "Iterator;_iterator,_f",
_f$1: function(arg0) {
return this._f.call$1(arg0);
},
moveNext$0: function() {
for (var t1 = this._iterator; t1.moveNext$0() === true;)
if (this._f$1(t1.get$current()) === true)
return true;
return false;
},
get$current: function() {
return this._iterator.get$current();
}
};
$$.ListBase = {"": "Collection;",
get$iterator: function() {
return $.ListIterator$(this);
},
forEach$1: function(f) {
var t1, i;
for (t1 = $.getInterceptor$JSStringJSArray(this), i = 0; $.CONSTANT2.$lt(i, t1.get$length(this)); ++i)
f.call$1(this.$index(i));
},
get$isEmpty: function() {
return $.$$eq($.length(this), 0);
},
getRange$2: function(start, length) {
var result, i;
if (typeof length !== "number")
return this.getRange$2$bailout(1, start, length);
result = [];
for (i = 0; i < length; ++i)
result.push(this.$index(start + i));
return result;
},
getRange$2$bailout: function(state0, start, length) {
var result, i;
result = [];
for (i = 0; $.CONSTANT2.$lt(i, length); ++i)
result.push(this.$index(start + i));
return result;
},
mappedBy$1: function(f) {
return $.MappedList$(this, f);
},
toString$0: function() {
return this.get$Collections().collectionToString$1(this);
},
$isList: true,
$isCollection: true,
$isIterable: true
};
$$.UnmodifiableListBase = {"": "ListBase;",
$indexSet: function(index, value) {
throw $.$$throw($.UnsupportedError$("Cannot modify an unmodifiable list"));
},
add$1: function(value) {
throw $.$$throw($.UnsupportedError$("Cannot add to an unmodifiable list"));
},
addLast$1: function(value) {
throw $.$$throw($.UnsupportedError$("Cannot add to an unmodifiable list"));
},
remove$1: function(element) {
throw $.$$throw($.UnsupportedError$("Cannot remove from an unmodifiable list"));
},
removeLast$0: function() {
throw $.$$throw($.UnsupportedError$("Cannot remove from an unmodifiable list"));
}
};
$$.ListIterator = {"": "Object;_liblib$_list,_length,_position,_liblib$_current",
moveNext$0: function() {
var t1, t3, t4, t5, t2;
t1 = this._liblib$_list;
if (typeof t1 !== "string" && (typeof t1 !== "object" || t1 === null || t1.constructor !== Array && !t1.$isJavaScriptIndexingBehavior))
return this.moveNext$0$bailout0(1, t1);
t3 = $.getInterceptor$JSStringJSArray(t1);
t4 = t1.length;
t5 = this._length;
if (typeof t5 !== "number")
return this.moveNext$0$bailout0(3, t1, t3, t4, t5);
if (!(t4 === t5))
throw $.$$throw($.ConcurrentModificationError$(t1));
t2 = this._position;
if (typeof t2 !== "number")
return this.moveNext$0$bailout0(4, t1, t3, null, t5, t2);
++t2;
if (t2 < t5) {
this._position = t2;
if (t2 !== (t2 | 0))
throw $.iae(t2);
if (t2 < 0 || t2 >= t1.length)
throw $.ioore(t2);
this._liblib$_current = t1[t2];
return true;
}
this._liblib$_current = null;
return false;
},
moveNext$0$bailout0: function(state0, t1, t3, t4, t6, t2) {
switch (state0) {
case 0:
t1 = this._liblib$_list;
case 1:
state0 = 0;
t3 = $.getInterceptor$JSStringJSArray(t1);
t4 = t3.get$length(t1);
case 2:
state0 = 0;
t6 = this._length;
case 3:
state0 = 0;
if ($.$$eq(t4, t6) !== true)
throw $.$$throw($.ConcurrentModificationError$(t1));
t2 = this._position;
case 4:
state0 = 0;
t2 = $.$$add(t2, 1);
if ($.$$lt(t2, t6) === true) {
this._position = t2;
this._liblib$_current = t3.$index(t1, t2);
return true;
}
this._liblib$_current = null;
return false;
}
},
get$current: function() {
return this._liblib$_current;
}
};
$$.MappedList = {"": "UnmodifiableListBase;_liblib$_list,_f",
_f$1: function(arg0) {
return this._f.call$1(arg0);
},
$index: function(index) {
var t1 = this._liblib$_list;
if (typeof t1 !== "string" && (typeof t1 !== "object" || t1 === null || t1.constructor !== Array && !t1.$isJavaScriptIndexingBehavior))
return this.$$index$bailout0(1, index, t1);
if (index !== (index | 0))
throw $.iae(index);
if (index < 0 || index >= t1.length)
throw $.ioore(index);
return this._f$1(t1[index]);
},
$$index$bailout0: function(state0, index, t1) {
return this._f$1($.$$index(t1, index));
},
get$length: function() {
return $.length(this._liblib$_list);
}
};
$$._Manager = {"": "Object;nextIsolateId=,currentManagerId=,nextManagerId=,currentContext=,rootContext=,topEventLoop>,fromCommandLine>,isWorker>,supportsWorkers,isolates>,mainManager>,managers>",
get$useWorkers: function() {
return this.supportsWorkers;
},
get$needSerialization: function() {
return this.get$useWorkers();
},
_nativeDetectEnvironment$0: function() {
var t1, t2;
t1 = $.get$globalWindow() == null;
this.isWorker = t1 && $.get$globalPostMessageDefined() === true;
if (this.isWorker !== true)
t2 = !($.get$globalWorker() == null) && !($.get$IsolateNatives_thisScript() == null);
else
t2 = true;
this.supportsWorkers = t2;
this.fromCommandLine = t1 && this.isWorker !== true;
},
_nativeInitWorkerMessageHandler$0: function() {
var $function = function (e) { $.IsolateNatives__processWorkerMessage.call$2(this.mainManager, e); };
$.get$globalThis().onmessage = $function;
$.get$globalThis().dartPrint = function (object) {};
},
maybeCloseWorker$0: function() {
if (this.isWorker === true && $.isEmpty(this.isolates) === true && $.$$eq(this.topEventLoop.get$activeTimerCount(), 0) === true)
this.mainManager.postMessage$1($._serializeMessage($.makeLiteralMap(["command", "close"])));
},
_Manager$0: function() {
this._nativeDetectEnvironment$0();
this.topEventLoop = $._EventLoop$();
this.isolates = $.Map_Map();
this.managers = $.Map_Map();
if (this.isWorker === true) {
this.mainManager = $._MainManagerStub$();
this._nativeInitWorkerMessageHandler$0();
}
}
};
$$._IsolateContext = {"": "Object;id=,ports>,isolateStatics",
eval$1: function(code) {
var old, result;
old = $globalState.get$currentContext();
$globalState.set$currentContext(this);
this._setGlobals$0();
result = null;
try {
result = code.call$0();
} finally {
$globalState.set$currentContext(old);
if (!(old == null))
old._setGlobals$0();
}
return result;
},
_setGlobals$0: function() {
$ = this.isolateStatics;
},
lookup$1: function(portId) {
return $.$$index(this.ports, portId);
},
register$2: function(portId, port) {
if (this.ports.containsKey$1(portId) === true)
throw $.$$throw($.Exception_Exception("Registry: ports must be registered only once."));
$.$$indexSet(this.ports, portId, port);
$.$$indexSet($globalState.get$isolates(), this.id, this);
},
unregister$1: function(portId) {
$.remove(this.ports, portId);
if ($.isEmpty(this.ports) === true)
$.remove($globalState.get$isolates(), this.id);
},
_IsolateContext$0: function() {
var t1, t2;
t1 = $._globalState();
t2 = t1.get$nextIsolateId();
t1.set$nextIsolateId($.$$add(t2, 1));
this.id = t2;
this.ports = $.Map_Map();
this.isolateStatics = new Isolate;
}
};
$$._EventLoop = {"": "Object;events,activeTimerCount=",
enqueue$3: function(isolate, fn, msg) {
$.addLast(this.events, $._IsolateEvent$(isolate, fn, msg));
},
dequeue$0: function() {
var t1 = this.events;
if ($.isEmpty(t1) === true)
return;
return t1.removeFirst$0();
},
checkOpenReceivePortsFromCommandLine$0: function() {
if (!($globalState.get$rootContext() == null) && $globalState.get$isolates().containsKey$1($globalState.get$rootContext().get$id()) === true && $globalState.get$fromCommandLine() === true && $.isEmpty($globalState.get$rootContext().get$ports()) === true)
throw $.$$throw($.Exception_Exception("Program exited with open ReceivePorts."));
},
runIteration$0: function() {
var event = this.dequeue$0();
if (event == null) {
this.checkOpenReceivePortsFromCommandLine$0();
$globalState.maybeCloseWorker$0();
return false;
}
event.process$0();
return true;
},
_runHelper$0: function() {
if (!($.get$globalWindow() == null))
new $._EventLoop__runHelper_next(this).call$0();
else
for (; this.runIteration$0() === true;)
;
},
run$0: function() {
var e, trace, exception, t1;
if ($globalState.get$isWorker() !== true)
this._runHelper$0();
else
try {
this._runHelper$0();
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
trace = $.getTraceFromException(exception);
$globalState.get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(["command", "error", "msg", $.S(e) + "\n" + $.S(trace)])));
}
}
};
$$._IsolateEvent = {"": "Object;isolate,fn,message>",
process$0: function() {
this.isolate.eval$1(this.fn);
}
};
$$._MainManagerStub = {"": "Object;",
get$id: function() {
return 0;
},
set$id: function(i) {
throw $.$$throw($.UnimplementedError$(null));
},
set$onmessage: function(f) {
throw $.$$throw($.Exception_Exception("onmessage should not be set on MainManagerStub"));
},
postMessage$1: function(msg) {
$.get$globalThis().postMessage(msg);
},
terminate$0: function() {
}
};
$$._BaseSendPort = {"": "Object;_isolateId>",
_checkReplyTo$1: function(replyTo) {
if (!(replyTo == null) && !(typeof replyTo === "object" && replyTo !== null && !!replyTo.$is_NativeJsSendPort) && !(typeof replyTo === "object" && replyTo !== null && !!replyTo.$is_WorkerSendPort) && !(typeof replyTo === "object" && replyTo !== null && !!replyTo.$is_BufferingSendPort))
throw $.$$throw($.Exception_Exception("SendPort.send: Illegal replyTo port type"));
},
call$1: function(message) {
var completer, port;
completer = $.Completer_Completer();
port = $.ReceivePortImpl$();
this.send$2(message, port.toSendPort$0());
port.receive$1(new $._BaseSendPort_call_anon(completer, port));
return completer.get$future();
},
$isFunction: true,
$isSendPort: true
};
$$._NativeJsSendPort = {"": "_BaseSendPort;_receivePort>,_isolateId",
send$2: function(message, replyTo) {
$._waitForPendingPorts([message, replyTo], new $._NativeJsSendPort_send_anon(this, message, replyTo));
},
$eq: function(other) {
if (other == null)
return false;
return typeof other === "object" && other !== null && !!other.$is_NativeJsSendPort && $.$$eq(this._receivePort, other._receivePort) === true;
},
get$hashCode: function() {
return this._receivePort.get$_id();
},
$is_NativeJsSendPort: true,
$isSendPort: true
};
$$._WorkerSendPort = {"": "_BaseSendPort;_workerId>,_receivePortId,_isolateId",
send$2: function(message, replyTo) {
$._waitForPendingPorts([message, replyTo], new $._WorkerSendPort_send_anon(this, message, replyTo));
},
$eq: function(other) {
var t1;
if (other == null)
return false;
if (typeof other === "object" && other !== null && !!other.$is_WorkerSendPort)
t1 = $.$$eq(this._workerId, other._workerId) === true && $.$$eq(this._isolateId, other._isolateId) === true && $.$$eq(this._receivePortId, other._receivePortId) === true;
else
t1 = false;
return t1;
},
get$hashCode: function() {
return $.$$xor($.$$xor($.$$shl(this._workerId, 16), $.$$shl(this._isolateId, 8)), this._receivePortId);
},
$is_WorkerSendPort: true,
$isSendPort: true
};
$$.ReceivePortImpl = {"": "Object;_id>,_callback>",
_callback$2: function(arg0, arg1) {
return this._callback.call$2(arg0, arg1);
},
receive$1: function(onMessage) {
this._callback = onMessage;
},
close$0: function() {
this._callback = null;
$globalState.get$currentContext().unregister$1(this._id);
},
toSendPort$0: function() {
return $._NativeJsSendPort$(this, $globalState.get$currentContext().get$id());
},
ReceivePortImpl$0: function() {
$._globalState().get$currentContext().register$2(this._id, this);
}
};
$$._PendingSendPortFinder = {"": "_MessageTraverser;ports>,_visited",
visitPrimitive$1: function(x) {
},
visitList$1: function(list) {
if (!($.$$index(this._visited, list) == null))
return;
$.$$indexSet(this._visited, list, true);
$.forEach(list, new $._PendingSendPortFinder_visitList_anon(this));
},
visitMap$1: function(map) {
if (!($.$$index(this._visited, map) == null))
return;
$.$$indexSet(this._visited, map, true);
$.forEach(map.get$values(), new $._PendingSendPortFinder_visitMap_anon(this));
},
visitSendPort$1: function(port) {
if (!!port.$is_BufferingSendPort && port._port == null)
this.ports.push(port.get$_futurePort());
},
_PendingSendPortFinder$0: function() {
this._visited = $._JsVisitedMap$();
}
};
$$._JsSerializer = {"": "_Serializer;_nextFreeRefId,_visited",
visitSendPort$1: function(x) {
if (typeof x === "object" && x !== null && !!x.$is_NativeJsSendPort)
return this.visitNativeJsSendPort$1(x);
if (typeof x === "object" && x !== null && !!x.$is_WorkerSendPort)
return ["sendport", x._workerId, x._isolateId, x._receivePortId];
if (typeof x === "object" && x !== null && !!x.$is_BufferingSendPort)
return this.visitBufferingSendPort$1(x);
throw $.$$throw("Illegal underlying port " + $.S(x));
},
visitNativeJsSendPort$1: function(port) {
return ["sendport", $globalState.get$currentManagerId(), port._isolateId, port._receivePort.get$_id()];
},
visitBufferingSendPort$1: function(port) {
var t1 = port._port;
if (!(t1 == null))
return this.visitSendPort$1(t1);
else
throw $.$$throw("internal error: must call _waitForPendingPorts to ensure all ports are resolved at this point.");
},
_JsSerializer$0: function() {
this._visited = $._JsVisitedMap$();
}
};
$$._JsCopier = {"": "_Copier;_visited",
visitSendPort$1: function(x) {
if (typeof x === "object" && x !== null && !!x.$is_NativeJsSendPort)
return this.visitNativeJsSendPort$1(x);
if (typeof x === "object" && x !== null && !!x.$is_WorkerSendPort)
return this.visitWorkerSendPort$1(x);
if (typeof x === "object" && x !== null && !!x.$is_BufferingSendPort)
return this.visitBufferingSendPort$1(x);
throw $.$$throw("Illegal underlying port " + $.S(this.get$p()));
},
visitNativeJsSendPort$1: function(port) {
return $._NativeJsSendPort$(port._receivePort, port._isolateId);
},
visitWorkerSendPort$1: function(port) {
return $._WorkerSendPort$(port._workerId, port._isolateId, port._receivePortId);
},
visitBufferingSendPort$1: function(port) {
var t1 = port._port;
if (!(t1 == null))
return this.visitSendPort$1(t1);
else
throw $.$$throw("internal error: must call _waitForPendingPorts to ensure all ports are resolved at this point.");
},
_JsCopier$0: function() {
this._visited = $._JsVisitedMap$();
}
};
$$._JsDeserializer = {"": "_Deserializer;_deserialized",
deserializeSendPort$1: function(x) {
var t1, managerId, isolateId, receivePortId, receivePort;
t1 = $.getInterceptor$JSStringJSArray(x);
managerId = t1.$index(x, 1);
isolateId = t1.$index(x, 2);
receivePortId = t1.$index(x, 3);
if ($.$$eq(managerId, $globalState.get$currentManagerId()) === true) {
t1 = $.$$index($globalState.get$isolates(), isolateId);
if (t1 == null)
return;
receivePort = t1.lookup$1(receivePortId);
if (receivePort == null)
return;
return $._NativeJsSendPort$(receivePort, isolateId);
} else
return $._WorkerSendPort$(managerId, isolateId, receivePortId);
}
};
$$._JsVisitedMap = {"": "Object;tagged",
$index: function(object) {
return object['__MessageTraverser__attached_info__'];
},
$indexSet: function(object, info) {
$.add(this.tagged, object);
object['__MessageTraverser__attached_info__'] = info;
},
reset$0: function() {
this.tagged = $.List_List(0);
},
cleanup$0: function() {
var t1, i;
t1 = $.length(this.tagged);
if (typeof t1 !== "number")
return this.cleanup$0$bailout(1, t1);
i = 0;
for (; i < t1; ++i)
$.$$index(this.tagged, i)['__MessageTraverser__attached_info__'] = null;
this.tagged = null;
},
cleanup$0$bailout: function(state0, t1) {
var i = 0;
for (; $.CONSTANT2.$lt(i, t1); ++i)
$.$$index(this.tagged, i)['__MessageTraverser__attached_info__'] = null;
this.tagged = null;
}
};
$$._MessageTraverserVisitedMap = {"": "Object;",
$index: function(object) {
return;
},
$indexSet: function(object, info) {
},
reset$0: function() {
},
cleanup$0: function() {
}
};
$$._MessageTraverser = {"": "Object;",
traverse$1: function(x) {
var result, t1;
t1 = x;
if (t1 == null || typeof t1 === "string" || typeof t1 === "number" || typeof t1 === "boolean")
return this.visitPrimitive$1(x);
this._visited.reset$0();
result = null;
try {
result = this._dispatch$1(x);
} finally {
this._visited.cleanup$0();
}
return result;
},
_dispatch$1: function(x) {
if (x == null || typeof x === "string" || typeof x === "number" || typeof x === "boolean")
return this.visitPrimitive$1(x);
if (typeof x === "object" && x !== null && (x.constructor === Array || !!x.$isList))
return this.visitList$1(x);
if (typeof x === "object" && x !== null && !!x.$isMap)
return this.visitMap$1(x);
if (typeof x === "object" && x !== null && !!x.$isSendPort)
return this.visitSendPort$1(x);
if (typeof x === "object" && x !== null && !!x.$isSendPortSync)
return this.visitSendPortSync$1(x);
return this.visitObject$1(x);
},
visitObject$1: function(x) {
throw $.$$throw("Message serialization: Illegal value " + $.S(x) + " passed");
}
};
$$._Copier = {"": "_MessageTraverser;",
visitPrimitive$1: function(x) {
return x;
},
visitList$1: function(list) {
var t1, len, copy, i;
if (typeof list !== "object" || list === null || list.constructor !== Array && !list.$isJavaScriptIndexingBehavior)
return this.visitList$1$bailout(1, list);
t1 = $.$$index(this._visited, list);
if (!(t1 == null))
return t1;
len = list.length;
copy = $.List_List(len);
$.$$indexSet(this._visited, list, copy);
for (i = 0; i < len; ++i) {
if (i >= list.length)
throw $.ioore(i);
t1 = this._dispatch$1(list[i]);
if (i >= copy.length)
throw $.ioore(i);
copy[i] = t1;
}
return copy;
},
visitList$1$bailout: function(state0, list, t1, len) {
switch (state0) {
case 0:
case 1:
state0 = 0;
t1 = $.$$index(this._visited, list);
if (!(t1 == null))
return t1;
t1 = $.getInterceptor$JSStringJSArray(list);
len = t1.get$length(list);
case 2:
var copy, i, t2;
state0 = 0;
copy = $.List_List(len);
$.$$indexSet(this._visited, list, copy);
for (i = 0; $.CONSTANT2.$lt(i, len); ++i) {
t2 = this._dispatch$1(t1.$index(list, i));
if (i >= copy.length)
throw $.ioore(i);
copy[i] = t2;
}
return copy;
}
},
visitMap$1: function(map) {
var t1, t2;
t1 = {};
t1.copy_0 = $.$$index(this._visited, map);
t2 = t1.copy_0;
if (!(t2 == null))
return t2;
t1.copy_0 = $.Map_Map();
$.$$indexSet(this._visited, map, t1.copy_0);
map.forEach$1(new $._Copier_visitMap_anon(t1, this));
return t1.copy_0;
}
};
$$._Serializer = {"": "_MessageTraverser;",
visitPrimitive$1: function(x) {
return x;
},
visitList$1: function(list) {
var t1, id;
t1 = $.$$index(this._visited, list);
if (!(t1 == null))
return ["ref", t1];
id = this._nextFreeRefId;
this._nextFreeRefId = id + 1;
$.$$indexSet(this._visited, list, id);
return ["list", id, this._serializeList$1(list)];
},
visitMap$1: function(map) {
var t1, id;
t1 = $.$$index(this._visited, map);
if (!(t1 == null))
return ["ref", t1];
id = this._nextFreeRefId;
this._nextFreeRefId = id + 1;
$.$$indexSet(this._visited, map, id);
return ["map", id, this._serializeList$1($.toList(map.get$keys())), this._serializeList$1($.toList(map.get$values()))];
},
_serializeList$1: function(list) {
var len, result, i, t1;
if (typeof list !== "string" && (typeof list !== "object" || list === null || list.constructor !== Array && !list.$isJavaScriptIndexingBehavior))
return this._serializeList$1$bailout(1, list);
len = list.length;
result = $.List_List(len);
for (i = 0; i < len; ++i) {
if (i >= list.length)
throw $.ioore(i);
t1 = this._dispatch$1(list[i]);
if (i >= result.length)
throw $.ioore(i);
result[i] = t1;
}
return result;
},
_serializeList$1$bailout: function(state0, list, t1, len) {
switch (state0) {
case 0:
case 1:
state0 = 0;
t1 = $.getInterceptor$JSStringJSArray(list);
len = t1.get$length(list);
case 2:
var result, i, t2;
state0 = 0;
result = $.List_List(len);
for (i = 0; $.CONSTANT2.$lt(i, len); ++i) {
t2 = this._dispatch$1(t1.$index(list, i));
if (i >= result.length)
throw $.ioore(i);
result[i] = t2;
}
return result;
}
}
};
$$._Deserializer = {"": "Object;",
deserialize$1: function(x) {
if (x == null || typeof x === "string" || typeof x === "number" || typeof x === "boolean")
return x;
this._deserialized = $.HashMap_HashMap();
return this._deserializeHelper$1(x);
},
_deserializeHelper$1: function(x) {
if (x == null || typeof x === "string" || typeof x === "number" || typeof x === "boolean")
return x;
switch ($.$$index(x, 0)) {
case "ref":
return this._deserializeRef$1(x);
case "list":
return this._deserializeList$1(x);
case "map":
return this._deserializeMap$1(x);
case "sendport":
return this.deserializeSendPort$1(x);
default:
return this.deserializeObject$1(x);
}
},
_deserializeRef$1: function(x) {
var t1 = $.$$index(x, 1);
return $.$$index(this._deserialized, t1);
},
_deserializeList$1: function(x) {
var t1, id, dartList, len, i;
t1 = $.getInterceptor$JSStringJSArray(x);
id = t1.$index(x, 1);
dartList = t1.$index(x, 2);
if (typeof dartList !== "object" || dartList === null || (dartList.constructor !== Array || !!dartList.immutable$list) && !dartList.$isJavaScriptIndexingBehavior)
return this._deserializeList$1$bailout(1, dartList, id);
$.$$indexSet(this._deserialized, id, dartList);
len = dartList.length;
for (i = 0; i < len; ++i) {
if (i >= dartList.length)
throw $.ioore(i);
t1 = this._deserializeHelper$1(dartList[i]);
if (i >= dartList.length)
throw $.ioore(i);
dartList[i] = t1;
}
return dartList;
},
_deserializeList$1$bailout: function(state0, dartList, id, t2, len) {
switch (state0) {
case 0:
t1 = $.getInterceptor$JSStringJSArray(x);
id = t1.$index(x, 1);
dartList = t1.$index(x, 2);
case 1:
state0 = 0;
$.$$indexSet(this._deserialized, id, dartList);
t2 = $.getInterceptor$JSStringJSArray(dartList);
len = t2.get$length(dartList);
case 2:
var t1, i;
state0 = 0;
for (i = 0; $.CONSTANT2.$lt(i, len); ++i)
t2.$indexSet(dartList, i, this._deserializeHelper$1(t2.$index(dartList, i)));
return dartList;
}
},
_deserializeMap$1: function(x) {
var result, t1, id, keys, values, len, i, key;
result = $.Map_Map();
t1 = $.getInterceptor$JSStringJSArray(x);
id = t1.$index(x, 1);
$.$$indexSet(this._deserialized, id, result);
keys = t1.$index(x, 2);
if (typeof keys !== "string" && (typeof keys !== "object" || keys === null || keys.constructor !== Array && !keys.$isJavaScriptIndexingBehavior))
return this._deserializeMap$1$bailout(1, x, result, keys, t1);
values = t1.$index(x, 3);
if (typeof values !== "string" && (typeof values !== "object" || values === null || values.constructor !== Array && !values.$isJavaScriptIndexingBehavior))
return this._deserializeMap$1$bailout(2, null, result, keys, null, values);
len = keys.length;
for (t1 = $.getInterceptor$JSArray(result), i = 0; i < len; ++i) {
if (i >= keys.length)
throw $.ioore(i);
key = this._deserializeHelper$1(keys[i]);
if (i >= values.length)
throw $.ioore(i);
t1.$indexSet(result, key, this._deserializeHelper$1(values[i]));
}
return result;
},
_deserializeMap$1$bailout: function(state0, x, result, keys, t1, values, t3, len) {
switch (state0) {
case 0:
result = $.Map_Map();
t1 = $.getInterceptor$JSStringJSArray(x);
id = t1.$index(x, 1);
$.$$indexSet(this._deserialized, id, result);
keys = t1.$index(x, 2);
case 1:
state0 = 0;
values = t1.$index(x, 3);
case 2:
state0 = 0;
t3 = $.getInterceptor$JSStringJSArray(keys);
len = t3.get$length(keys);
case 3:
var id, t2, i;
state0 = 0;
for (t1 = $.getInterceptor$JSStringJSArray(values), t2 = $.getInterceptor$JSArray(result), i = 0; $.CONSTANT2.$lt(i, len); ++i)
t2.$indexSet(result, this._deserializeHelper$1(t3.$index(keys, i)), this._deserializeHelper$1(t1.$index(values, i)));
return result;
}
},
deserializeObject$1: function(x) {
throw $.$$throw("Unexpected serialized object");
}
};
$$.TimerImpl = {"": "Object;_once,_inEventLoop,_handle<",
TimerImpl$2: function(milliseconds, callback) {
var t1;
if ($.$$eq(milliseconds, 0) === true)
t1 = $.hasTimer() !== true || $._globalState().get$isWorker() === true;
else
t1 = false;
if (t1) {
$._globalState().get$topEventLoop().enqueue$3($._globalState().get$currentContext(), new $.anon(this, callback), "timer");
this._inEventLoop = true;
} else if ($.hasTimer() === true) {
t1 = $._globalState().get$topEventLoop();
t1.set$activeTimerCount($.$$add(t1.get$activeTimerCount(), 1));
t1 = new $.internalCallback(this, callback);
this._handle = $.get$globalThis().setTimeout($.convertDartClosureToJS(t1, 0), milliseconds);
} else
throw $.$$throw($.UnsupportedError$("Timer greater than 0."));
}
};
$$.AsyncError = {"": "Object;error>,stackTrace>,cause>",
error$2: function(arg0, arg1) {
return this.error.call$2(arg0, arg1);
},
_writeOn$1: function(buffer) {
var message, t1, exception, t2;
t1 = $.getInterceptor$JSArray(buffer);
t1.add$1(buffer, "'");
message = null;
try {
message = $.toString(this.error);
} catch (exception) {
$.unwrapException(exception);
message = $.Error_safeToString(this.error);
}
t1.add$1(buffer, message);
t1.add$1(buffer, "'\n");
t2 = this.stackTrace;
if (!(t2 == null)) {
t1.add$1(buffer, "Stack trace:\n");
t1.add$1(buffer, $.toString(t2));
t1.add$1(buffer, "\n");
}
},
toString$0: function() {
var buffer, t1, cause;
buffer = $.StringBuffer_StringBuffer("");
t1 = $.getInterceptor$JSArray(buffer);
t1.add$1(buffer, "AsyncError: ");
this._writeOn$1(buffer);
cause = this.cause;
for (; !(cause == null);) {
t1.add$1(buffer, "Caused by: ");
cause._writeOn$1(buffer);
cause = cause.get$cause();
}
return t1.toString$0(buffer);
},
$isAsyncError: true
};
$$._CompleterImpl = {"": "Object;future>,_isComplete>",
complete$1: function(value) {
if (this._isComplete)
throw $.$$throw($.StateError$("Future already completed"));
this._isComplete = true;
this.future._setValue$1(value);
},
completeError$2: function(error, stackTrace) {
var asyncError;
if (this._isComplete)
throw $.$$throw($.StateError$("Future already completed"));
this._isComplete = true;
asyncError = typeof error === "object" && error !== null && !!error.$isAsyncError ? error : $.AsyncError$(error, stackTrace);
this.future._setError$1(asyncError);
},
completeError$1: function(error) {
return this.completeError$2(error, null);
}
};
$$._FutureListenerWrapper = {"": "Object;future>,_nextListener=",
_sendValue$1: function(value) {
this.future._setValue$1(value);
},
_sendError$1: function(error) {
this.future._setError$1(error);
}
};
$$._FutureImpl = {"": "Object;_state,_resultOrListeners>",
get$_isComplete: function() {
return $.$$eq(this._state, 0) !== true;
},
get$_hasValue: function() {
return $.$$eq(this._state, 1);
},
get$_hasError: function() {
return $.$$eq($.$$and(this._state, 2), 0) !== true;
},
get$_hasUnhandledError: function() {
return $.$$eq($.$$and(this._state, 4), 0) !== true;
},
_clearUnhandledError$0: function() {
this._state = $.$$and(this._state, 4294967291);
},
then$2$onError: function(f, onError) {
var t1;
if (this.get$_isComplete() !== true) {
if (onError == null) {
t1 = $._ThenFuture$(f);
t1._subscribeTo$1(this);
return t1;
}
t1 = $._SubscribeFuture$(f, onError);
t1._subscribeTo$1(this);
return t1;
}
if (this.get$_hasError() === true) {
if (!(onError == null))
return this._handleError$2(onError, null);
return $._FutureWrapper$(this);
} else
return this._handleValue$1(f);
},
then$1: function(f) {
return this.then$2$onError(f, null);
},
catchError$2$test: function(f, test) {
var t1;
if (this.get$_hasValue() === true)
return $._FutureWrapper$(this);
if (this.get$_isComplete() !== true) {
t1 = $._CatchErrorFuture$(f, test);
t1._subscribeTo$1(this);
return t1;
} else
return this._handleError$2(f, test);
},
catchError$1: function(f) {
return this.catchError$2$test(f, null);
},
_handleValue$1: function(onValue) {
var thenFuture = $._ThenFuture$(onValue);
$.Timer_Timer(0, new $._FutureImpl__handleValue_anon(thenFuture, this._resultOrListeners));
return thenFuture;
},
_handleError$2: function(onError, test) {
var error, errorFuture;
this._clearUnhandledError$0();
error = this._resultOrListeners;
errorFuture = $._CatchErrorFuture$(onError, test);
$.Timer_Timer(0, new $._FutureImpl__handleError_anon(error, errorFuture));
return errorFuture;
},
_setValue$1: function(value) {
var listeners, listeners0;
if (this.get$_isComplete() === true)
throw $.$$throw($.StateError$("Future already completed"));
listeners = this._removeListeners$0();
this._state = 1;
this._resultOrListeners = value;
for (; !(listeners == null); listeners = listeners0) {
listeners0 = listeners.get$_nextListener();
listeners.set$_nextListener(null);
listeners._sendValue$1(value);
}
},
get$_setValue: function() {
return new $.BoundClosure(this, "_setValue$1");
},
_setError$1: function(error) {
var listeners, listeners0;
if (this.get$_isComplete() === true)
throw $.$$throw($.StateError$("Future already completed"));
listeners = this._removeListeners$0();
this._state = 2;
this._resultOrListeners = error;
if (listeners == null) {
this._scheduleUnhandledError$0();
return;
}
do {
listeners0 = listeners.get$_nextListener();
listeners.set$_nextListener(null);
listeners._sendError$1(error);
if (!(listeners0 == null)) {
listeners = listeners0;
continue;
} else
break;
} while (true);
},
get$_setError: function() {
return new $.BoundClosure(this, "_setError$1");
},
_scheduleUnhandledError$0: function() {
this._state = $.$$or(this._state, 4);
$.Timer_Timer(0, new $._FutureImpl__scheduleUnhandledError_anon(this));
},
_addListener$1: function(listener) {
listener.set$_nextListener(this._resultOrListeners);
this._resultOrListeners = listener;
},
_removeListeners$0: function() {
var current, prev, next;
current = this._resultOrListeners;
this._resultOrListeners = null;
for (prev = null; !(current == null); prev = current, current = next) {
next = current.get$_nextListener();
current.set$_nextListener(prev);
}
return prev;
},
_chain$1: function(future) {
if (this.get$_isComplete() !== true)
this._addListener$1(future._asListener$0());
else if (this.get$_hasValue() === true)
future._setValue$1(this._resultOrListeners);
else {
this._clearUnhandledError$0();
future._setError$1(this._resultOrListeners);
}
},
_asListener$0: function() {
return $._FutureListener__FutureListener$wrap(this);
},
_FutureImpl$immediate$1: function(value) {
this._state = 1;
this._resultOrListeners = value;
},
$is_FutureImpl: true,
$isFuture: true
};
$$._TransformFuture = {"": "_FutureImpl;_nextListener=",
_subscribeTo$1: function(future) {
future._addListener$1(this);
},
_setOrChainValue$1: function(result) {
if (typeof result === "object" && result !== null && !!result.$isFuture)
if (!!result.$is_FutureImpl) {
result._chain$1(this);
return;
} else {
result.then$2$onError(this.get$_setValue(), this.get$_setError());
return;
}
else
this._setValue$1(result);
}
};
$$._ThenFuture = {"": "_TransformFuture;_onValue,_nextListener,_state,_resultOrListeners",
_onValue$1: function(arg0) {
return this._onValue.call$1(arg0);
},
_sendValue$1: function(value) {
var result, e, e0, s, exception, t1;
result = null;
try {
result = this._onValue$1(value);
} catch (exception) {
t1 = $.unwrapException(exception);
if (typeof t1 === "object" && t1 !== null && !!t1.$isAsyncError) {
e = t1;
this._setError$1(e);
return;
} else {
e0 = t1;
s = $.getTraceFromException(exception);
this._setError$1($.AsyncError$(e0, s));
return;
}
}
this._setOrChainValue$1(result);
},
_sendError$1: function(error) {
this._setError$1(error);
}
};
$$._CatchErrorFuture = {"": "_TransformFuture;_test,_onError,_nextListener,_state,_resultOrListeners",
_test$1: function(arg0) {
return this._test.call$1(arg0);
},
_onError$1: function(arg0) {
return this._onError.call$1(arg0);
},
_sendValue$1: function(value) {
this._setValue$1(value);
},
_sendError$1: function(error) {
var matchesTest, e, s, result, e0, e1, s0, exception, t1;
if (!(this._test == null)) {
matchesTest = null;
try {
matchesTest = this._test$1(error.get$error());
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
s = $.getTraceFromException(exception);
this._setError$1($.AsyncError$withCause(e, s, error));
return;
}
if (matchesTest !== true) {
this._setError$1(error);
return;
}
}
result = null;
try {
result = this._onError$1(error);
} catch (exception) {
t1 = $.unwrapException(exception);
if (typeof t1 === "object" && t1 !== null && !!t1.$isAsyncError) {
e0 = t1;
this._setError$1(e0);
return;
} else {
e1 = t1;
s0 = $.getTraceFromException(exception);
this._setError$1($.AsyncError$withCause(e1, s0, error));
return;
}
}
this._setOrChainValue$1(result);
}
};
$$._SubscribeFuture = {"": "_ThenFuture;_onError,_onValue,_nextListener,_state,_resultOrListeners",
_onError$1: function(arg0) {
return this._onError.call$1(arg0);
},
_sendError$1: function(error) {
var result, e, e0, s, exception, t1;
result = null;
try {
result = this._onError$1(error);
} catch (exception) {
t1 = $.unwrapException(exception);
if (typeof t1 === "object" && t1 !== null && !!t1.$isAsyncError) {
e = t1;
this._setError$1(e);
return;
} else {
e0 = t1;
s = $.getTraceFromException(exception);
this._setError$1($.AsyncError$withCause(e0, s, error));
return;
}
}
this._setOrChainValue$1(result);
}
};
$$._FutureWrapper = {"": "Object;_future",
then$2$onError: function($function, onError) {
return this._future.then$2$onError($function, onError);
},
then$1: function($function) {
return this.then$2$onError($function, null);
},
catchError$2$test: function($function, test) {
return this._future.catchError$2$test($function, test);
},
catchError$1: function($function) {
return this.catchError$2$test($function, null);
},
$isFuture: true
};
$$._SpreadArgsHelper = {"": "Object;_liblib1$_callback,_expectedCalls,_actualCalls=,_testNum,_testCase,_shouldCallBack,_isDone",
_liblib1$_callback$1: function(arg0) {
return this._liblib1$_callback.call$1(arg0);
},
_shouldCallBack$0: function() {
return this._shouldCallBack.call$0();
},
_isDone$0: function() {
return this._isDone.call$0();
},
_init$4: function(callback, shouldCallBack, isDone, expectedCalls) {
var t1;
$.ensureInitialized();
if (!($.$$ge($._currentTest, 0) === true && $.$$lt($._currentTest, $.length($._tests)) === true && !($.$$index($._tests, $._currentTest) == null)))
$.print("No valid test, did you forget to run your test inside a call to test()?");
this._liblib1$_callback = callback;
this._shouldCallBack = shouldCallBack;
this._isDone = isDone;
this._expectedCalls = expectedCalls;
t1 = $._currentTest;
this._testNum = t1;
this._testCase = $.$$index($._tests, t1);
if ($.$$gt(expectedCalls, 0) === true) {
t1 = this._testCase;
t1.set$callbackFunctionsOutstanding($.$$add(t1.get$callbackFunctionsOutstanding(), 1));
}
},
_after$0: function() {
if (this._isDone$0() === true)
$._handleCallbackFunctionComplete(this._testNum);
},
get$_after: function() {
return new $.BoundClosure0(this, "_after$0");
},
_allCallsDone$0: function() {
return $.$$eq(this._actualCalls, this._expectedCalls);
},
get$_allCallsDone: function() {
return new $.BoundClosure0(this, "_allCallsDone$0");
},
invoke1$1: function(arg1) {
return $.guardAsync(new $._SpreadArgsHelper_invoke1_anon(this, arg1), this.get$_after(), this._testNum);
},
get$invoke1: function() {
return new $.BoundClosure(this, "invoke1$1");
},
_checkCallCount$0: function() {
if ($.$$gt(this._actualCalls, this._expectedCalls) === true) {
this._testCase.error$2("Callback called more times than expected (" + $.S(this._actualCalls) + " > " + $.S(this._expectedCalls) + ").", "");
return false;
}
return true;
},
get$_checkCallCount: function() {
return new $.BoundClosure0(this, "_checkCallCount$0");
},
_SpreadArgsHelper$fixedCallCount$2: function(callback, expectedCalls) {
this._init$4(callback, this.get$_checkCallCount(), this.get$_allCallsDone(), expectedCalls);
}
};
$$.Configuration = {"": "Object;_liblib1$_receivePort,currentTestCase",
get$autoStart: function() {
return true;
},
onInit$0: function() {
this._liblib1$_receivePort = $.ReceivePort_ReceivePort();
this._postMessage$1("unittest-suite-wait-for-done");
},
onStart$0: function() {
},
onTestStart$1: function(testCase) {
this.currentTestCase = testCase;
},
onTestResult$1: function(testCase) {
this.currentTestCase = null;
},
onSummary$5: function(passed, failed, errors, results, uncaughtError) {
var t1, t2, t3;
for (t1 = $.iterator($._tests); t1.moveNext$0() === true;) {
t2 = t1.get$current();
$.print($.S($.CONSTANT0.toUpperCase$0($.S(t2.get$result()))) + ": " + $.S(t2.get$description()));
if ($.$$eq(t2.get$message(), "") !== true)
$.print(this._indent$1(t2.get$message()));
t3 = t2.get$stackTrace();
if (!(t3 == null) && $.$$eq(t3, "") !== true)
$.print(this._indent$1(t2.get$stackTrace()));
}
$.print("");
if (passed === 0 && failed === 0 && errors === 0 && uncaughtError == null)
$.print("No tests found.");
else if (failed === 0 && errors === 0 && uncaughtError == null)
$.print("All " + $.S(passed) + " tests passed.");
else {
if (!(uncaughtError == null))
$.print("Top-level uncaught error: " + $.S(uncaughtError));
$.print($.S(passed) + " PASSED, " + $.S(failed) + " FAILED, " + $.S(errors) + " ERRORS");
}
},
onDone$1: function(success) {
if (success) {
this._postMessage$1("unittest-suite-success");
this._liblib1$_receivePort.close$0();
} else {
this._liblib1$_receivePort.close$0();
throw $.$$throw($.Exception_Exception("Some tests failed."));
}
},
_indent$1: function(str) {
return $.Strings_join($.mappedBy($.split(str, "\n"), new $.Configuration__indent_anon()), "\n");
},
_postMessage$1: function(message) {
$.print(message);
}
};
$$.TestCase = {"": "Object;id>,description>,_setUp,_tearDown,test,callbackFunctionsOutstanding=,message>,result>,stackTrace>,currentGroup,startTime,runningTime,enabled,_doneTeardown",
_setUp$0: function() {
return this._setUp.call$0();
},
_tearDown$0: function() {
return this._tearDown.call$0();
},
test$0: function() {
return this.test.call$0();
},
get$isComplete: function() {
return !this.enabled || !(this.result == null);
},
run$0: function() {
if (this.enabled) {
this.stackTrace = null;
this.result = null;
this.message = "";
this._doneTeardown = false;
if (!(this._setUp == null))
this._setUp$0();
$._config.onTestStart$1(this);
this.startTime = $.Date_Date$now();
this.runningTime = null;
this.test$0();
}
},
_complete$0: function() {
if (this.runningTime == null)
this.runningTime = $.Duration$(0, 0, 0, 0, 0);
if (!this._doneTeardown) {
if (!(this._tearDown == null))
this._tearDown$0();
this._doneTeardown = true;
}
$._config.onTestResult$1(this);
},
pass$0: function() {
this.result = "pass";
this._complete$0();
},
fail$2: function(messageText, stack) {
var t1 = this.result;
if (!(t1 == null)) {
if (t1 === "pass")
this.error$2("Test failed after initially passing: " + $.S(messageText), stack);
else if (t1 === "fail")
this.error$2("Test failed more than once: " + $.S(messageText), stack);
} else {
this.result = "fail";
this.message = messageText;
this.stackTrace = stack;
this._complete$0();
}
},
error$2: function(messageText, stack) {
this.result = "error";
this.message = messageText;
this.stackTrace = stack;
this._complete$0();
},
get$error: function() {
return new $.BoundClosure1(this, "error$2");
}
};
$$.MatchState = {"": "Object;state"};
$$.BaseMatcher = {"": "Object;",
describeMismatch$4: function(item, mismatchDescription, matchState, verbose) {
return mismatchDescription.add$1("was ").addDescriptionOf$1(item);
},
$isMatcher: true
};
$$._DeepMatcher = {"": "BaseMatcher;_expected,_limit,count",
_compareIterables$4: function(expected, actual, matcher, depth) {
var t1, t2, position, reason, r;
if (!(typeof actual === "object" && actual !== null && (actual.constructor === Array || !!actual.$isIterable)))
return "is not Iterable";
t1 = $.iterator(expected);
t2 = $.iterator(actual);
for (position = 0, reason = null; reason == null;)
if (t1.moveNext$0() === true)
if (t2.moveNext$0() === true) {
r = matcher.call$4(t1.get$current(), t2.get$current(), "mismatch at position " + $.S(position), depth);
if (!(r == null))
reason = $.toString(r);
++position;
} else
reason = "shorter than expected";
else {
if (t2.moveNext$0() === true)
;
else
return;
reason = "longer than expected";
}
return reason;
},
_recursiveMatch$4: function(expected, actual, location, depth) {
var t1, canRecurse, reason, t2, r, t3;
if (typeof expected !== "string" && (typeof expected !== "object" || expected === null || expected.constructor !== Array && !expected.$isJavaScriptIndexingBehavior))
return this._recursiveMatch$4$bailout(1, expected, actual, location, depth);
if (typeof depth !== "number")
return this._recursiveMatch$4$bailout(1, expected, actual, location, depth);
if (!(depth === 0)) {
t1 = this._limit;
if (typeof t1 !== "number")
return this._recursiveMatch$4$bailout(2, expected, actual, location, depth, t1, $.CONSTANT4);
canRecurse = t1 > 1;
} else
canRecurse = true;
t1 = $.getInterceptor(expected);
if (expected === actual)
reason = null;
else {
t2 = this._limit;
if (typeof t2 !== "number")
return this._recursiveMatch$4$bailout(3, expected, actual, location, depth, t1, $.CONSTANT4, t2, canRecurse);
if (depth > t2)
reason = $.StringDescription$("recursion depth limit exceeded");
else if (typeof expected === "object" && expected !== null && (expected.constructor === Array || !!expected.$isIterable) && canRecurse) {
r = this._compareIterables$4(expected, actual, this.get$_recursiveMatch(), depth + 1);
reason = !(r == null) ? $.StringDescription$(r) : null;
} else if (typeof expected === "object" && expected !== null && !!expected.$isMap && canRecurse)
if (!(typeof actual === "object" && actual !== null && !!actual.$isMap))
reason = $.StringDescription$("expected a map");
else if (!(expected.length === $.length(actual)))
reason = $.StringDescription$("different map lengths");
else
for (t1 = $.iterator(expected.get$keys()), t2 = depth + 1, reason = null; t1.moveNext$0() === true;) {
t3 = t1.get$current();
if (actual.containsKey$1(t3) !== true) {
reason = $.StringDescription$("missing map key ");
reason.addDescriptionOf$1(t3);
break;
}
if (t3 !== (t3 | 0))
throw $.iae(t3);
if (t3 < 0 || t3 >= expected.length)
throw $.ioore(t3);
reason = this._recursiveMatch$4(expected[t3], actual.$index(t3), "with key <" + $.S(t3) + "> " + $.S(location), t2);
if (!(reason == null))
break;
}
else {
reason = $.StringDescription$("");
if (depth > 1)
$.add(reason.add$1("expected ").addDescriptionOf$1(expected), " but was ").addDescriptionOf$1(actual);
else
reason.add$1("was ").addDescriptionOf$1(actual);
}
}
if (!(reason == null)) {
t1 = $.length(location);
if (typeof t1 !== "number")
return this._recursiveMatch$4$bailout(4, null, null, location, null, null, t1, null, null, reason);
t1 = t1 > 0;
} else
t1 = false;
if (t1)
$.add($.add(reason, " "), location);
return reason;
},
_recursiveMatch$4$bailout: function(state0, expected, actual, location, depth, t2, t1, t3, canRecurse, reason) {
switch (state0) {
case 0:
case 1:
state0 = 0;
t1 = $.getInterceptor(depth);
case 2:
if (state0 === 2 || state0 === 0 && t1.$eq(depth, 0) !== true)
switch (state0) {
case 0:
t2 = this._limit;
case 2:
state0 = 0;
canRecurse = $.$$gt(t2, 1) === true;
}
else
canRecurse = true;
t2 = $.getInterceptor(expected);
case 3:
if (state0 === 0 && t2.$eq(expected, actual) === true)
reason = null;
else
switch (state0) {
case 0:
t3 = this._limit;
case 3:
state0 = 0;
if (t1.$gt(depth, t3) === true)
reason = $.StringDescription$("recursion depth limit exceeded");
else if (typeof expected === "object" && expected !== null && (expected.constructor === Array || !!expected.$isIterable) && canRecurse) {
r = this._compareIterables$4(expected, actual, this.get$_recursiveMatch(), t1.$add(depth, 1));
reason = !(r == null) ? $.StringDescription$(r) : null;
} else if (typeof expected === "object" && expected !== null && !!expected.$isMap && canRecurse)
if (!(typeof actual === "object" && actual !== null && !!actual.$isMap))
reason = $.StringDescription$("expected a map");
else if ($.$$eq(t2.get$length(expected), $.length(actual)) !== true)
reason = $.StringDescription$("different map lengths");
else
for (t3 = $.iterator(expected.get$keys()), reason = null; t3.moveNext$0() === true;) {
t4 = t3.get$current();
if (actual.containsKey$1(t4) !== true) {
reason = $.StringDescription$("missing map key ");
reason.addDescriptionOf$1(t4);
break;
}
reason = this._recursiveMatch$4(t2.$index(expected, t4), actual.$index(t4), "with key <" + $.S(t4) + "> " + $.S(location), t1.$add(depth, 1));
if (!(reason == null))
break;
}
else {
reason = $.StringDescription$("");
if (t1.$gt(depth, 1) === true)
$.add(reason.add$1("expected ").addDescriptionOf$1(expected), " but was ").addDescriptionOf$1(actual);
else
reason.add$1("was ").addDescriptionOf$1(actual);
}
}
case 4:
var r, t4;
if (state0 === 4 || state0 === 0 && !(reason == null))
switch (state0) {
case 0:
t1 = $.length(location);
case 4:
state0 = 0;
t3 = $.$$gt(t1, 0) === true;
t1 = t3;
}
else
t1 = false;
if (t1)
$.add($.add(reason, " "), location);
return reason;
}
},
get$_recursiveMatch: function() {
return new $.BoundClosure2(this, "_recursiveMatch$4");
},
_match$2: function(expected, actual) {
var reason = this._recursiveMatch$4(expected, actual, "", 0);
return reason == null ? null : $.toString(reason);
},
matches$2: function(item, matchState) {
return this._match$2(this._expected, item) == null;
},
describe$1: function(description) {
return description.addDescriptionOf$1(this._expected);
},
describeMismatch$4: function(item, mismatchDescription, matchState, verbose) {
return mismatchDescription.add$1(this._match$2(this._expected, item));
}
};
$$._Predicate = {"": "BaseMatcher;_matcher,_description",
_matcher$1: function(arg0) {
return this._matcher.call$1(arg0);
},
matches$2: function(item, matchState) {
return this._matcher$1(item);
},
describe$1: function(description) {
return description.add$1(this._description);
}
};
$$.StringDescription = {"": "Object;_out",
toString$0: function() {
return this._out;
},
add$1: function(text) {
this._out = $.S(this._out) + $.S(text);
return this;
},
addDescriptionOf$1: function(value) {
var description, t1, t2;
if (typeof value === "object" && value !== null && !!value.$isMatcher)
value.describe$1(this);
else if (typeof value === "string")
this._addEscapedString$1(value);
else {
description = value == null ? "null" : $.toString(value);
t1 = $.getInterceptor$JSString(description);
t1 = t1.startsWith$1(description, "<") === true && t1.endsWith$1(description, ">") === true;
t2 = this._out;
if (t1)
this._out = $.S(t2) + $.S(description);
else {
this._out = $.S(t2) + "<";
this._out = $.S(this._out) + $.S(description);
this._out = $.S(this._out) + ">";
}
}
return this;
},
_addEscapedString$1: function(string) {
var i, t1;
this._out = $.S(this._out) + "'";
for (i = 0; i < string.length; ++i) {
if (i >= string.length)
throw $.ioore(i);
t1 = this._escape$1(string[i]);
this._out = $.S(this._out) + $.S(t1);
}
this._out = $.S(this._out) + "'";
},
_escape$1: function(ch) {
if (typeof ch !== "string")
return this._escape$1$bailout(1, ch);
if (ch === "'")
return "'";
else if (ch === "\n")
return "\\n";
else if (ch === "\r")
return "\\r";
else if (ch === "\t")
return "\\t";
else
return ch;
},
_escape$1$bailout: function(state0, ch) {
var t1 = $.getInterceptor(ch);
if (t1.$eq(ch, "'") === true)
return "'";
else if (t1.$eq(ch, "\n") === true)
return "\\n";
else if (t1.$eq(ch, "\r") === true)
return "\\r";
else if (t1.$eq(ch, "\t") === true)
return "\\t";
else
return ch;
},
StringDescription$1: function(init) {
this._out = init;
}
};
$$.DefaultFailureHandler = {"": "Object;",
fail$1: function(reason) {
throw $.$$throw($.ExpectException$(reason));
},
failMatch$5: function(actual, matcher, reason, matchState, verbose) {
this.fail$1($._assertErrorFormatter.call$5(actual, matcher, reason, matchState, verbose));
},
DefaultFailureHandler$0: function() {
if ($._assertErrorFormatter == null)
$._assertErrorFormatter = $._defaultErrorFormatter;
}
};
$$.Minesweeper = {"": "Object;width>,height>,_lines",
isBomb$2: function(x, y) {
var t1;
if (x >= 0) {
t1 = this.width;
if (typeof t1 !== "number")
return this.isBomb$2$bailout(1, x, y, t1);
if (!(x >= t1))
if (y >= 0) {
t1 = this.height;
if (typeof t1 !== "number")
return this.isBomb$2$bailout(2, x, y, t1);
t1 = y >= t1;
} else
t1 = true;
else
t1 = true;
} else
t1 = true;
if (t1)
return false;
t1 = this._lines;
if (typeof t1 !== "string" && (typeof t1 !== "object" || t1 === null || t1.constructor !== Array && !t1.$isJavaScriptIndexingBehavior))
return this.isBomb$2$bailout(3, x, y, t1);
if (y < 0 || y >= t1.length)
throw $.ioore(y);
t1 = t1[y];
if (typeof t1 !== "string" && (typeof t1 !== "object" || t1 === null || t1.constructor !== Array && !t1.$isJavaScriptIndexingBehavior))
return this.isBomb$2$bailout(4, x, null, t1);
if (x < 0 || x >= t1.length)
throw $.ioore(x);
t1 = t1[x];
if (typeof t1 !== "string")
return this.isBomb$2$bailout(5, null, null, t1);
return t1 === "*";
},
isBomb$2$bailout: function(state0, x, y, t1) {
switch (state0) {
case 0:
default:
if (state0 === 2 || state0 === 1 || state0 === 0 && x >= 0)
switch (state0) {
case 0:
t1 = this.width;
case 1:
state0 = 0;
case 2:
if (state0 === 2 || state0 === 0 && !$.CONSTANT2.$ge(x, t1))
switch (state0) {
case 0:
case 2:
if (state0 === 2 || state0 === 0 && y >= 0)
switch (state0) {
case 0:
t1 = this.height;
case 2:
state0 = 0;
t1 = $.CONSTANT2.$ge(y, t1);
}
else
t1 = true;
}
else
t1 = true;
}
else
t1 = true;
if (t1)
return false;
t1 = this._lines;
case 3:
state0 = 0;
t1 = $.$$index(t1, y);
case 4:
state0 = 0;
t1 = $.$$index(t1, x);
case 5:
state0 = 0;
return $.$$eq(t1, "*");
}
},
countBomb$2: function(x, y) {
var xx, t1, yy, result, yy0;
for (xx = x - 1, t1 = y + 1, yy = y - 1, result = 0; xx <= x + 1; ++xx)
for (yy0 = yy; yy0 <= t1; ++yy0)
if (this.isBomb$2(xx, yy0) === true)
++result;
return result;
},
get$solution: function() {
var result, y, x, t1, result0;
for (result = "", y = 0; $.CONSTANT2.$lt(y, this.height); ++y, result = result0) {
for (x = 0; $.CONSTANT2.$lt(x, this.width); ++x) {
t1 = result;
result = t1 + $.S(this.isBomb$2(x, y) === true ? "*" : this.countBomb$2(x, y));
}
result0 = result + "\n";
}
return result;
},
Minesweeper$0: function() {
this.width = 0;
this.height = 0;
},
Minesweeper$fromGrid$1: function(grid) {
var t1, t2, t3, t4;
t1 = $.split(grid, "\n");
t2 = $.getInterceptor$JSStringJSArray(t1);
t3 = $.split(t2.$index(t1, 0), " ");
t4 = $.getInterceptor$JSStringJSArray(t3);
this.width = $.int_parse(t4.$index(t3, 0), null, null);
this.height = $.int_parse(t4.$index(t3, 1), null, null);
this._lines = t2.getRange$2(t1, 1, $.$$sub(t2.get$length(t1), 1));
}
};
$$.main_anon = {"": "Closure;",
call$0: function() {
$.test("Should be instantiable with with and height", new $.main__anon());
var minesweeper = $.Minesweeper$fromGrid("4 2\n.*..\n*...\n ");
$.test("Should be instantiable with a grid", new $.main__anon0(minesweeper));
$.test("Should detect a bomb", new $.main__anon1(minesweeper));
$.test("Should count the number of bomb", new $.main__anon2(minesweeper));
$.test("Should render correctly the grid", new $.main__anon3(minesweeper));
},
$isFunction: true
};
$$.main__anon = {"": "Closure;",
call$0: function() {
var minesweeper = $.Minesweeper$();
$.expect(minesweeper.width, 0, null, null, false);
$.expect(minesweeper.height, 0, null, null, false);
},
$isFunction: true
};
$$.main__anon0 = {"": "Closure;minesweeper_0",
call$0: function() {
var t1 = this.minesweeper_0;
$.expect(t1.get$width(), 4, null, null, false);
$.expect(t1.get$height(), 2, null, null, false);
},
$isFunction: true
};
$$.main__anon1 = {"": "Closure;minesweeper_1",
call$0: function() {
var t1 = this.minesweeper_1;
$.expect(t1.isBomb$2(0, 0), false, null, null, false);
$.expect(t1.isBomb$2(1, 0), true, null, null, false);
$.expect(t1.isBomb$2(-1, 0), false, null, null, false);
},
$isFunction: true
};
$$.main__anon2 = {"": "Closure;minesweeper_2",
call$0: function() {
var t1 = this.minesweeper_2;
$.expect(t1.countBomb$2(0, 0), 2, null, null, false);
$.expect(t1.countBomb$2(3, 1), 0, null, null, false);
},
$isFunction: true
};
$$.main__anon3 = {"": "Closure;minesweeper_3",
call$0: function() {
$.expect(this.minesweeper_3.get$solution(), "2*10\n*210\n", null, null, false);
},
$isFunction: true
};
$$.Maps__emitMap_anon = {"": "Closure;box_0,result_1,visiting_2",
call$2: function(k, v) {
var t1, t2;
t1 = this.box_0;
if (t1.first_0 !== true)
$.add(this.result_1, ", ");
t1.first_0 = false;
t1 = this.result_1;
t2 = this.visiting_2;
$.Collections__emitObject(k, t1, t2);
$.add(t1, ": ");
$.Collections__emitObject(v, t1, t2);
},
$isFunction: true
};
$$._LinkedHashMapImpl_forEach_anon = {"": "Closure;f_0",
call$1: function(entry) {
this.f_0.call$2(entry.get$key(), entry.get$value());
},
$isFunction: true
};
$$.NoSuchMethodError_toString_anon = {"": "Closure;box_0",
call$2: function(key, value) {
var t1 = this.box_0;
if ($.$$gt(t1.i_1, 0) === true)
$.add(t1.sb_0, ", ");
$.add(t1.sb_0, key);
$.add(t1.sb_0, ": ");
$.add(t1.sb_0, $.Error_safeToString(value));
t1.i_1 = $.$$add(t1.i_1, 1);
},
$isFunction: true
};
$$.runTests_anon = {"": "Closure;",
call$1: function(t) {
return $.$$eq(t, $._soloTest);
},
$isFunction: true
};
$$.runTests_anon0 = {"": "Closure;",
call$0: function() {
$._testRunner.call$0();
},
$isFunction: true
};
$$._defer_anon = {"": "Closure;callback_0,port_1",
call$2: function(msg, reply) {
this.callback_0.call$0();
this.port_1.close$0();
},
$isFunction: true
};
$$._BaseSendPort_call_anon = {"": "Closure;completer_0,port_1",
call$2: function(value, ignoreReplyTo) {
var t1;
this.port_1.close$0();
t1 = this.completer_0;
if (typeof value === "object" && value !== null && !!value.$isException)
t1.completeError$1(value);
else
t1.complete$1(value);
},
$isFunction: true
};
$$._NativeJsSendPort_send_anon = {"": "Closure;this_1,message_2,replyTo_3",
call$0: function() {
var t1, t2, t3, t4, shouldSerialize, msg;
t1 = {};
t2 = this.this_1;
t3 = this.replyTo_3;
t2._checkReplyTo$1(t3);
t4 = $.$$index($globalState.get$isolates(), t2.get$_isolateId());
if (t4 == null)
return;
if (t2.get$_receivePort().get$_callback() == null)
return;
shouldSerialize = !($globalState.get$currentContext() == null) && $.$$eq($globalState.get$currentContext().get$id(), t2.get$_isolateId()) !== true;
msg = this.message_2;
t1.msg_0 = msg;
t1.reply_1 = t3;
if (shouldSerialize) {
t1.msg_0 = $._serializeMessage(t1.msg_0);
t1.reply_1 = $._serializeMessage(t1.reply_1);
}
$globalState.get$topEventLoop().enqueue$3(t4, new $._NativeJsSendPort_send__anon(t1, t2, shouldSerialize), "receive " + $.S(msg));
},
$isFunction: true
};
$$._NativeJsSendPort_send__anon = {"": "Closure;box_0,this_4,shouldSerialize_5",
call$0: function() {
var t1, t2;
t1 = this.this_4;
if (!(t1.get$_receivePort().get$_callback() == null)) {
if (this.shouldSerialize_5 === true) {
t2 = this.box_0;
t2.msg_0 = $._deserializeMessage(t2.msg_0);
t2.reply_1 = $._deserializeMessage(t2.reply_1);
}
t1 = t1.get$_receivePort();
t2 = this.box_0;
t1._callback$2(t2.msg_0, t2.reply_1);
}
},
$isFunction: true
};
$$._waitForPendingPorts_anon = {"": "Closure;callback_0",
call$1: function(_) {
return this.callback_0.call$0();
},
$isFunction: true
};
$$._FutureImpl__FutureImpl$wait_anon = {"": "Closure;box_0,completer_1,values_2,pos_3",
call$1: function(value) {
var t1, t2, t3;
t1 = this.values_2;
$.$$indexSet(t1, this.pos_3, value);
t2 = this.box_0;
t3 = $.$$sub(t2.remaining_0, 1);
t2.remaining_0 = t3;
if ($.$$eq(t3, 0) === true)
this.completer_1.complete$1(t1);
},
$isFunction: true
};
$$._FutureImpl__FutureImpl$wait_anon0 = {"": "Closure;box_0,completer_4",
call$1: function(error) {
var t1 = this.box_0;
if (t1.completed_1 !== true)
this.completer_4.completeError$2(error.get$error(), error.get$stackTrace());
t1.completed_1 = true;
},
$isFunction: true
};
$$._FutureImpl__handleError_anon = {"": "Closure;error_0,errorFuture_1",
call$1: function(_) {
this.errorFuture_1._sendError$1(this.error_0);
},
$isFunction: true
};
$$.anon = {"": "Closure;this_0,callback_1",
call$0: function() {
this.callback_1.call$1(this.this_0);
},
$isFunction: true
};
$$.internalCallback = {"": "Closure;this_2,callback_3",
call$0: function() {
var t1, t2;
t1 = this.callback_3;
t2 = this.this_2;
t1.call$1(t2);
t2.set$_handle(null);
t2 = $globalState.get$topEventLoop();
t2.set$activeTimerCount($.$$sub(t2.get$activeTimerCount(), 1));
},
$isFunction: true
};
$$.invokeClosure_anon = {"": "Closure;closure_0",
call$0: function() {
return this.closure_0.call$0();
},
$isFunction: true
};
$$.invokeClosure_anon0 = {"": "Closure;closure_1,arg1_2",
call$0: function() {
return this.closure_1.call$1(this.arg1_2);
},
$isFunction: true
};
$$.invokeClosure_anon1 = {"": "Closure;closure_3,arg1_4,arg2_5",
call$0: function() {
return this.closure_3.call$2(this.arg1_4, this.arg2_5);
},
$isFunction: true
};
$$._FutureImpl__handleValue_anon = {"": "Closure;thenFuture_0,value_1",
call$1: function(_) {
this.thenFuture_0._sendValue$1(this.value_1);
},
$isFunction: true
};
$$._FutureImpl__scheduleUnhandledError_anon = {"": "Closure;this_0",
call$1: function(_) {
var t1, error;
t1 = this.this_0;
if (t1.get$_hasUnhandledError() === true) {
t1._clearUnhandledError$0();
error = t1.get$_resultOrListeners();
$.print("Uncaught Error: " + $.S(error.get$error()));
t1 = error.get$stackTrace();
if (!(t1 == null))
$.print("Stack Trace:\n" + $.S(t1) + "\n");
throw $.$$throw(error.get$error());
}
},
$isFunction: true
};
$$._PendingSendPortFinder_visitMap_anon = {"": "Closure;this_0",
call$1: function(e) {
return this.this_0._dispatch$1(e);
},
$isFunction: true
};
$$._LinkedHashMapImpl_values_anon = {"": "Closure;",
call$1: function(entry) {
return entry.get$value();
},
$isFunction: true
};
$$._PendingSendPortFinder_visitList_anon = {"": "Closure;this_0",
call$1: function(e) {
return this.this_0._dispatch$1(e);
},
$isFunction: true
};
$$._Copier_visitMap_anon = {"": "Closure;box_0,this_1",
call$2: function(key, val) {
var t1, t2;
t1 = this.box_0.copy_0;
t2 = this.this_1;
$.$$indexSet(t1, t2._dispatch$1(key), t2._dispatch$1(val));
},
$isFunction: true
};
$$._WorkerSendPort_send_anon = {"": "Closure;this_0,message_1,replyTo_2",
call$0: function() {
var t1, t2, workerMessage;
t1 = this.this_0;
t2 = this.replyTo_2;
t1._checkReplyTo$1(t2);
workerMessage = $._serializeMessage($.makeLiteralMap(["command", "message", "port", t1, "msg", this.message_1, "replyTo", t2]));
if ($globalState.get$isWorker() === true)
$globalState.get$mainManager().postMessage$1(workerMessage);
else {
t2 = $.$$index($globalState.get$managers(), t1.get$_workerId());
if (!(t2 == null))
t2.postMessage$1(workerMessage);
}
},
$isFunction: true
};
$$._LinkedHashMapImpl_keys_anon = {"": "Closure;",
call$1: function(entry) {
return entry.get$key();
},
$isFunction: true
};
$$.filterTests_anon = {"": "Closure;re_0",
call$1: function(t) {
return this.re_0.hasMatch$1(t.get$description());
},
$isFunction: true
};
$$.filterTests_anon0 = {"": "Closure;testFilter_1",
call$1: function(t) {
return this.testFilter_1.hasMatch$1(t.get$description());
},
$isFunction: true
};
$$._nextBatch_anon = {"": "Closure;testCase_0",
call$0: function() {
var t1 = this.testCase_0;
t1.run$0();
if (t1.get$isComplete() !== true && $.$$eq(t1.get$callbackFunctionsOutstanding(), 0) === true)
t1.pass$0();
},
$isFunction: true
};
$$.Configuration__indent_anon = {"": "Closure;",
call$1: function(line) {
return " " + $.S(line);
},
$isFunction: true
};
$$._SpreadArgsHelper_invoke1_anon = {"": "Closure;this_0,arg1_1",
call$0: function() {
var t1 = this.this_0;
t1.set$_actualCalls($.$$add(t1.get$_actualCalls(), 1));
if (t1._shouldCallBack$0() === true)
return t1._liblib1$_callback$1(this.arg1_1);
},
$isFunction: true
};
$$._handleCallbackFunctionComplete_anon = {"": "Closure;testNum_0",
call$0: function() {
var t1, t2;
t1 = $._currentTest;
t2 = this.testNum_0;
if ($.$$eq(t1, t2) !== true) {
if ($.$$eq($.$$index($._tests, t2).get$result(), "pass") === true)
$.$$index($._tests, t2).error$2("Unexpected extra callbacks", "");
return;
}
if ($.$$lt($._currentTest, $.length($._tests)) === true) {
t1 = $.$$index($._tests, $._currentTest);
t1.set$callbackFunctionsOutstanding($.$$sub(t1.get$callbackFunctionsOutstanding(), 1));
if ($.$$lt(t1.get$callbackFunctionsOutstanding(), 0) === true)
t1.error$2("More calls to _handleCallbackFunctionComplete() than expected.", "");
else if ($.$$eq(t1.get$callbackFunctionsOutstanding(), 0) === true) {
if (t1.get$isComplete() !== true)
t1.pass$0();
$._currentTest = $.$$add($._currentTest, 1);
$._testRunner.call$0();
}
}
},
$isFunction: true
};
$$.anon0 = {"": "Closure;",
call$1: function(f) {
return f;
},
$isFunction: true
};
$$.Duration_toString_threeDigits = {"": "Closure;",
call$1: function(n) {
var t1 = $.getInterceptor$JSNumber(n);
if (t1.$ge(n, 100) === true)
return $.S(n);
if (t1.$gt(n, 10) === true)
return "0" + $.S(n);
return "00" + $.S(n);
},
$isFunction: true
};
$$.Duration_toString_twoDigits = {"": "Closure;",
call$1: function(n) {
if ($.$$ge(n, 10) === true)
return $.S(n);
return "0" + $.S(n);
},
$isFunction: true
};
$$.DateTime_toString_fourDigits = {"": "Closure;",
call$1: function(n) {
var t1, absN, sign;
t1 = $.getInterceptor$JSNumber(n);
absN = t1.abs$0(n);
sign = t1.$lt(n, 0) === true ? "-" : "";
t1 = $.getInterceptor$JSNumber(absN);
if (t1.$ge(absN, 1000) === true)
return $.S(n);
if (t1.$ge(absN, 100) === true)
return sign + "0" + $.S(absN);
if (t1.$ge(absN, 10) === true)
return sign + "00" + $.S(absN);
return sign + "000" + $.S(absN);
},
$isFunction: true
};
$$.DateTime_toString_threeDigits = {"": "Closure;",
call$1: function(n) {
var t1 = $.getInterceptor$JSNumber(n);
if (t1.$ge(n, 100) === true)
return $.S(n);
if (t1.$ge(n, 10) === true)
return "0" + $.S(n);
return "00" + $.S(n);
},
$isFunction: true
};
$$.DateTime_toString_twoDigits = {"": "Closure;",
call$1: function(n) {
if ($.$$ge(n, 10) === true)
return $.S(n);
return "0" + $.S(n);
},
$isFunction: true
};
$$.IsolateNatives__processWorkerMessage_function = {"": "Closure;entryPoint_0,replyTo_1",
call$0: function() {
$.IsolateNatives__startIsolate(this.entryPoint_0, this.replyTo_1);
},
$isFunction: true
};
$$._EventLoop__runHelper_next = {"": "Closure;this_0",
call$0: function() {
if (this.this_0.runIteration$0() !== true)
return;
$.Timer_Timer(0, new $._EventLoop__runHelper_next_anon(this));
},
$isFunction: true
};
$$._EventLoop__runHelper_next_anon = {"": "Closure;next_1",
call$1: function(_) {
return this.next_1.call$0();
},
$isFunction: true
};
$$.Closure = {"": "Object;",
toString$0: function() {
return "Closure";
},
$isFunction: true
};
$$.BoundClosure = {"": "Closure;self,target",
call$1: function(p0) {
return this.self[this.target](p0);
}
};
$$.BoundClosure0 = {"": "Closure;self,target",
call$0: function() {
return this.self[this.target]();
}
};
$$.BoundClosure1 = {"": "Closure;self,target",
call$2: function(p0, p1) {
return this.self[this.target](p0, p1);
},
call$1: function(messageText) {
return this.call$2(messageText, "");
}
};
$$.BoundClosure2 = {"": "Closure;self,target",
call$4: function(p0, p1, p2, p3) {
return this.self[this.target](p0, p1, p2, p3);
}
};
$.Minesweeper$ = function() {
var t1 = new $.Minesweeper(null, null, null);
t1.Minesweeper$0();
return t1;
};
$.Minesweeper$fromGrid = function(grid) {
var t1 = new $.Minesweeper(null, null, null);
t1.Minesweeper$fromGrid$1(grid);
return t1;
};
$.main = function() {
$.group("Minesweeper", new $.main_anon());
};
$.MatchState$ = function(state) {
return new $.MatchState(state);
};
$.Configuration$ = function() {
return new $.Configuration(null, null);
};
$._DeepMatcher$ = function(_expected, limit) {
return new $._DeepMatcher(_expected, limit, null);
};
$._Predicate$ = function(_matcher, _description) {
return new $._Predicate(_matcher, _description);
};
$.StringDescription$ = function(init) {
var t1 = new $.StringDescription(null);
t1.StringDescription$1(init);
return t1;
};
$.expect = function(actual, matcher, failureHandler, reason, verbose) {
var doesMatch, matchState, e, trace, exception, t1;
matcher = $.wrapMatcher(matcher);
doesMatch = null;
matchState = $.MatchState$(null);
try {
doesMatch = matcher.matches$2(actual, matchState);
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
trace = $.getTraceFromException(exception);
doesMatch = false;
if (reason == null) {
t1 = e;
reason = $.S(typeof t1 === "string" ? e : $.toString(e)) + " at " + $.S(trace);
}
}
if (doesMatch !== true) {
if (failureHandler == null)
failureHandler = $.getOrCreateExpectFailureHandler();
failureHandler.failMatch$5(actual, matcher, reason, matchState, verbose);
}
};
$.wrapMatcher = function(x) {
if (typeof x === "object" && x !== null && !!x.$isMatcher)
return x;
else if (typeof x === "function" || typeof x === "object" && x !== null && !!x.$isFunction)
return $._Predicate$(x, "satisfies function");
else
return $._DeepMatcher$(x, 100);
};
$.DefaultFailureHandler$ = function() {
var t1 = new $.DefaultFailureHandler();
t1.DefaultFailureHandler$0();
return t1;
};
$.configureExpectFailureHandler = function(handler) {
$._assertFailureHandler = handler == null ? $.DefaultFailureHandler$() : handler;
};
$.getOrCreateExpectFailureHandler = function() {
if ($._assertFailureHandler == null)
$.configureExpectFailureHandler(null);
return $._assertFailureHandler;
};
$._defaultErrorFormatter = function(actual, matcher, reason, matchState, verbose) {
var description = $.StringDescription$("");
$.add(description.add$1("Expected: ").addDescriptionOf$1(matcher), "\n but: ");
matcher.describeMismatch$4(actual, description, matchState, verbose);
description.add$1(".\n");
if (verbose === true && typeof actual === "object" && actual !== null && (actual.constructor === Array || !!actual.$isIterable))
$.add(description.add$1("Actual: ").addDescriptionOf$1(actual), "\n");
if (!(reason == null))
$.add(description.add$1(reason), "\n");
return description.toString$0();
};
$.TestCase$ = function(id, description, test, callbackFunctionsOutstanding) {
var t1 = $._currentGroup;
return new $.TestCase(id, description, $._testSetup, $._testTeardown, test, callbackFunctionsOutstanding, "", null, null, t1, null, null, true, false);
};
$.test = function(spec, body) {
var t1;
$.ensureInitialized();
t1 = $._tests;
$.add(t1, $.TestCase$($.$$add($.length(t1), 1), $._fullSpec(spec), body, 0));
};
$._SpreadArgsHelper$fixedCallCount = function(callback, expectedCalls) {
var t1 = new $._SpreadArgsHelper(null, null, 0, null, null, null, null);
t1._SpreadArgsHelper$fixedCallCount$2(callback, expectedCalls);
return t1;
};
$.expectAsync1 = function(callback, count) {
return $._SpreadArgsHelper$fixedCallCount(callback, count).get$invoke1();
};
$.group = function(description, body) {
var parentGroup, parentSetup, parentTeardown, e, trace, stack, parentGroup0, exception, t1;
$.ensureInitialized();
parentGroup0 = $._currentGroup;
parentGroup = parentGroup0;
if ($.$$eq(parentGroup0, "") !== true)
$._currentGroup = $.S($._currentGroup) + $.S($.groupSep) + description;
else
$._currentGroup = description;
parentSetup = $._testSetup;
parentTeardown = $._testTeardown;
try {
$._testSetup = null;
$._testTeardown = null;
body.call$0();
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
trace = $.getTraceFromException(exception);
stack = trace == null ? "" : ": " + $.S($.toString(trace));
$._uncaughtErrorMessage = $.S($.toString(e)) + $.S(stack);
}
finally {
$._currentGroup = parentGroup;
$._testSetup = parentSetup;
$._testTeardown = parentTeardown;
}
};
$._handleCallbackFunctionComplete = function(testNum) {
$._defer(new $._handleCallbackFunctionComplete_anon(testNum));
};
$._defer = function(callback) {
var port = $.ReceivePort_ReceivePort();
port.receive$1(new $._defer_anon(callback, port));
port.toSendPort$0().send$2(null, null);
};
$.filterTests = function(testFilter) {
var filterFunction;
if (typeof testFilter === "string")
filterFunction = new $.filterTests_anon($.RegExp_RegExp(testFilter, true, false));
else if (typeof testFilter === "object" && testFilter !== null && !!testFilter.$isRegExp)
filterFunction = new $.filterTests_anon0(testFilter);
else
filterFunction = typeof testFilter === "function" || typeof testFilter === "object" && testFilter !== null && !!testFilter.$isFunction ? testFilter : null;
$._tests = $.toList($.where($._tests, filterFunction));
};
$.runTests = function() {
$._currentTest = 0;
$._currentGroup = "";
if (!($._soloTest == null))
$.filterTests(new $.runTests_anon());
$._config.onStart$0();
$._defer(new $.runTests_anon0());
};
$.guardAsync = function(tryBody, finallyBody, testNum) {
var e, trace, t1, exception;
if ($.$$lt(testNum, 0) === true)
testNum = $._currentTest;
try {
t1 = tryBody.call$0();
return t1;
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
trace = $.getTraceFromException(exception);
$._registerException(testNum, e, trace);
}
finally {
if (!(finallyBody == null))
finallyBody.call$0();
}
};
$._registerException = function(testNum, e, trace) {
var message;
trace = trace == null ? "" : $.toString(trace);
if ($.$$index($._tests, testNum).get$result() == null) {
message = typeof e === "object" && e !== null && !!e.$isExpectException ? e.message : "Caught " + $.S(e);
$.$$index($._tests, testNum).fail$2(message, trace);
} else
$.$$index($._tests, testNum).error$2("Caught " + $.S(e), trace);
if ($.$$eq(testNum, $._currentTest) === true && $.$$gt($.$$index($._tests, testNum).get$callbackFunctionsOutstanding(), 0) === true) {
$._currentTest = $.$$add($._currentTest, 1);
$._testRunner.call$0();
}
};
$._nextBatch = function() {
for (; $.$$lt($._currentTest, $.length($._tests)) === true;) {
var t1 = $.$$index($._tests, $._currentTest);
$.guardAsync(new $._nextBatch_anon(t1), null, $._currentTest);
if (t1.get$isComplete() !== true && $.$$gt(t1.get$callbackFunctionsOutstanding(), 0) === true)
return;
$._currentTest = $.$$add($._currentTest, 1);
}
$._completeTests();
};
$._completeTests = function() {
var t1, errors, passed, failed;
if ($._initialized !== true)
return;
for (t1 = $.iterator($._tests), errors = 0, passed = 0, failed = 0; t1.moveNext$0() === true;)
switch (t1.get$current().get$result()) {
case "pass":
++passed;
break;
case "fail":
++failed;
break;
case "error":
++errors;
break;
}
$._config.onSummary$5(passed, failed, errors, $._tests, $._uncaughtErrorMessage);
t1 = $._config;
t1.onDone$1(passed > 0 && failed === 0 && errors === 0 && $._uncaughtErrorMessage == null);
$._initialized = false;
};
$._fullSpec = function(spec) {
return $.$$eq($._currentGroup, "") !== true ? $.S($._currentGroup) + $.S($.groupSep) + spec : spec;
};
$.ensureInitialized = function() {
if ($._initialized === true)
return;
$._initialized = true;
$.wrapAsync = $.expectAsync1;
$._tests = [];
$._testRunner = $._nextBatch;
$._uncaughtErrorMessage = null;
if ($._config == null)
$._config = $.Configuration$();
$._config.onInit$0();
if ($._config.get$autoStart() === true)
$._defer($.runTests);
};
$.Strings__toJsStringArray = function(strings) {
var length, i, string;
if (typeof strings !== "object" || strings === null || (strings.constructor !== Array || !!strings.immutable$list) && !strings.$isJavaScriptIndexingBehavior)
return $.Strings__toJsStringArray$bailout(1, strings);
$.checkNull(strings);
if (!strings.constructor === Array)
strings = $.List_List$from(strings);
length = strings.length;
for (i = 0; i < length; ++i) {
string = strings[i];
if (!(typeof string === "string"))
throw $.$$throw($.ArgumentError$(string));
}
return strings;
};
$.Strings__toJsStringArray$bailout = function(state0, strings, t1, length) {
switch (state0) {
case 0:
case 1:
state0 = 0;
$.checkNull(strings);
if (!(!(strings == null) && strings.constructor === Array))
strings = $.List_List$from(strings);
t1 = $.getInterceptor$JSStringJSArray(strings);
length = t1.get$length(strings);
case 2:
var i, string;
state0 = 0;
for (i = 0; $.CONSTANT2.$lt(i, length); ++i) {
string = t1.$index(strings, i);
if (!(typeof string === "string"))
throw $.$$throw($.ArgumentError$(string));
}
return strings;
}
};
$._callInIsolate = function(isolate, $function) {
isolate.eval$1($function);
$globalState.get$topEventLoop().run$0();
};
$._currentIsolate = function() {
return $globalState.get$currentContext();
};
$.startRootIsolate = function(entry) {
var t1, rootContext;
t1 = $._Manager$();
$._globalState0(t1);
if ($globalState.get$isWorker() === true)
return;
rootContext = $._IsolateContext$();
$globalState.set$rootContext(rootContext);
$globalState.set$currentContext(rootContext);
rootContext.eval$1(entry);
$globalState.get$topEventLoop().run$0();
};
$._globalState = function() {
return $globalState;
};
$._globalState0 = function(val) {
$globalState = val;
};
$._Manager$ = function() {
var t1 = new $._Manager(0, 0, 1, null, null, null, null, null, null, null, null, null);
t1._Manager$0();
return t1;
};
$._IsolateContext$ = function() {
var t1 = new $._IsolateContext(null, null, null);
t1._IsolateContext$0();
return t1;
};
$._EventLoop$ = function() {
return new $._EventLoop($.Queue_Queue(), 0);
};
$._IsolateEvent$ = function(isolate, fn, message) {
return new $._IsolateEvent(isolate, fn, message);
};
$._MainManagerStub$ = function() {
return new $._MainManagerStub();
};
$.IsolateNatives_computeThisScript = function() {
var scripts, len, i, script, src, t1;
scripts = document.getElementsByTagName('script');
for (len = scripts.length, i = 0; i < len; ++i) {
script = scripts[i];
src = script && script.src;
t1 = $.getInterceptor(src);
if (!(src == null) && t1.endsWith$1(src, "test_controller.js") !== true && t1.endsWith$1(src, "dart.js") !== true)
return src;
}
return;
};
$.IsolateNatives_computeGlobalThis = function() {
return function() { return this; }();
};
$.IsolateNatives__processWorkerMessage = function(sender, e) {
var msg, t1, t2, entryPoint, replyTo, context;
msg = $._deserializeMessage(e.data);
t1 = $.getInterceptor$JSStringJSArray(msg);
switch (t1.$index(msg, "command")) {
case "start":
t2 = t1.$index(msg, "id");
$globalState.set$currentManagerId(t2);
entryPoint = $[t1.$index(msg, "functionName")];
replyTo = $._deserializeMessage(t1.$index(msg, "replyTo"));
context = $._IsolateContext$();
$globalState.get$topEventLoop().enqueue$3(context, new $.IsolateNatives__processWorkerMessage_function(entryPoint, replyTo), "worker-start");
$globalState.set$currentContext(context);
$globalState.get$topEventLoop().run$0();
break;
case "spawn-worker":
$.IsolateNatives__spawnWorker(t1.$index(msg, "functionName"), t1.$index(msg, "uri"), t1.$index(msg, "replyPort"));
break;
case "message":
if (!(t1.$index(msg, "port") == null))
t1.$index(msg, "port").send$2(t1.$index(msg, "msg"), t1.$index(msg, "replyTo"));
$globalState.get$topEventLoop().run$0();
break;
case "close":
$.IsolateNatives__log("Closing Worker");
$.remove($globalState.get$managers(), sender.get$id());
sender.terminate$0();
$globalState.get$topEventLoop().run$0();
break;
case "log":
$.IsolateNatives__log(t1.$index(msg, "msg"));
break;
case "print":
if ($globalState.get$isWorker() === true)
$globalState.get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(["command", "print", "msg", msg])));
else
$.print(t1.$index(msg, "msg"));
break;
case "error":
throw $.$$throw(t1.$index(msg, "msg"));
}
};
$.IsolateNatives__log = function(msg) {
var trace, exception;
if ($globalState.get$isWorker() === true)
$globalState.get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(["command", "log", "msg", msg])));
else
try {
$.get$globalThis().console.log(msg);
} catch (exception) {
$.unwrapException(exception);
trace = $.getTraceFromException(exception);
throw $.$$throw($.Exception_Exception(trace));
}
};
$.IsolateNatives__startIsolate = function(topLevel, replyTo) {
$.lazyPort = $.ReceivePort_ReceivePort();
if ($.lazyPort == null)
$.lazyPort = $.ReceivePort_ReceivePort();
replyTo.send$2("spawned", $.lazyPort.toSendPort$0());
topLevel.call$0();
};
$.IsolateNatives__spawnWorker = function(functionName, uri, replyPort) {
var worker, t1, workerId;
if (functionName == null)
functionName = "main";
if (uri == null)
uri = $.get$IsolateNatives_thisScript();
worker = new Worker(uri);
worker.set$onmessage(function(e) { $.IsolateNatives__processWorkerMessage.call$2(worker, e); });
t1 = $globalState;
workerId = t1.get$nextManagerId();
t1.set$nextManagerId($.$$add(workerId, 1));
worker.set$id(workerId);
$.$$indexSet($globalState.get$managers(), workerId, worker);
worker.postMessage$1($._serializeMessage($.makeLiteralMap(["command", "start", "id", workerId, "replyTo", $._serializeMessage(replyPort), "functionName", functionName])));
};
$._NativeJsSendPort$ = function(_receivePort, isolateId) {
return new $._NativeJsSendPort(_receivePort, isolateId);
};
$._WorkerSendPort$ = function(_workerId, isolateId, _receivePortId) {
return new $._WorkerSendPort(_workerId, _receivePortId, isolateId);
};
$.ReceivePortImpl$ = function() {
var t1 = $.ReceivePortImpl__nextFreeId;
$.ReceivePortImpl__nextFreeId = $.$$add(t1, 1);
t1 = new $.ReceivePortImpl(t1, null);
t1.ReceivePortImpl$0();
return t1;
};
$._waitForPendingPorts = function(message, callback) {
var finder = $._PendingSendPortFinder$();
finder.traverse$1(message);
$._FutureImpl__FutureImpl$wait(finder.ports).then$1(new $._waitForPendingPorts_anon(callback));
};
$._PendingSendPortFinder$ = function() {
var t1 = new $._PendingSendPortFinder([], $._MessageTraverserVisitedMap$());
t1._PendingSendPortFinder$0();
return t1;
};
$._serializeMessage = function(message) {
if ($globalState.get$needSerialization() === true)
return $._JsSerializer$().traverse$1(message);
else
return $._JsCopier$().traverse$1(message);
};
$._deserializeMessage = function(message) {
if ($globalState.get$needSerialization() === true)
return $._JsDeserializer$().deserialize$1(message);
else
return message;
};
$._JsSerializer$ = function() {
var t1 = new $._JsSerializer(0, $._MessageTraverserVisitedMap$());
t1._JsSerializer$0();
return t1;
};
$._JsCopier$ = function() {
var t1 = new $._JsCopier($._MessageTraverserVisitedMap$());
t1._JsCopier$0();
return t1;
};
$._JsDeserializer$ = function() {
return new $._JsDeserializer(null);
};
$._JsVisitedMap$ = function() {
return new $._JsVisitedMap(null);
};
$._MessageTraverserVisitedMap$ = function() {
return new $._MessageTraverserVisitedMap();
};
$.TimerImpl$ = function(milliseconds, callback) {
var t1 = new $.TimerImpl(true, false, null);
t1.TimerImpl$2(milliseconds, callback);
return t1;
};
$.hasTimer = function() {
return !($.get$globalThis().setTimeout == null);
};
$.checkMutable = function(list, reason) {
if (!!(list.immutable$list))
throw $.$$throw($.UnsupportedError$(reason));
};
$.checkGrowable = function(list, reason) {
if (!!(list.fixed$length))
throw $.$$throw($.UnsupportedError$(reason));
};
$.S = function(value) {
var t1;
if (typeof value === "string")
return value;
if (typeof value === "number" && !(value === 0) || typeof value === "boolean")
return String(value);
if (value == null)
return "null";
t1 = $.toString(value);
if (!(typeof t1 === "string"))
throw $.$$throw($.ArgumentError$(value));
return t1;
};
$.Primitives_objectHashCode = function(object) {
var hash = object.$identityHash;
if (hash == null) {
hash = $.$$add($.Primitives_hashCodeSeed, 1);
$.Primitives_hashCodeSeed = hash;
object.$identityHash = hash;
}
return hash;
};
$.Primitives_printString = function(string) {
if (typeof dartPrint == "function") {
dartPrint(string);
return;
}
if (typeof window == "object") {
if (typeof console == "object")
console.log(string);
return;
}
if (typeof print == "function") {
print(string);
return;
}
throw 'Unable to print message: ' + String(string);
};
$.Primitives__throwFormatException = function(string) {
throw $.$$throw($.FormatException$(string));
};
$.Primitives_parseInt = function(source, radix, handleError) {
var match, t1, maxCharCode, t2, i;
if (handleError == null)
handleError = $.Primitives__throwFormatException;
$.checkString(source);
match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source);
if (radix == null) {
t1 = $.getInterceptor(match);
if (!(match == null)) {
if (!(t1.$index(match, 2) == null))
return parseInt(source, 16);
if (!(t1.$index(match, 3) == null))
return parseInt(source, 10);
return handleError.call$1(source);
}
radix = 10;
} else {
if (!(typeof radix === "number" && Math.floor(radix) === radix))
throw $.$$throw($.ArgumentError$("Radix is not an integer"));
if (radix < 2 || radix > 36)
throw $.$$throw($.RangeError$("Radix " + $.S(radix) + " not in range 2..36"));
t1 = $.getInterceptor(match);
if (!(match == null)) {
if (radix === 10 && !(t1.$index(match, 3) == null))
return parseInt(source, 10);
if (radix < 10 || t1.$index(match, 3) == null) {
maxCharCode = radix <= 10 ? 48 + radix - 1 : 97 + radix - 10 - 1;
t2 = $.toLowerCase(t1.$index(match, 1));
for (t1 = $.getInterceptor$JSStringJSArray(t2), i = 0; $.CONSTANT2.$lt(i, t1.get$length(t2)); ++i)
if ($.$$gt(t1.charCodeAt$1(t2, i), maxCharCode) === true)
return handleError.call$1(source);
}
}
radix = radix;
}
if (match == null)
return handleError.call$1(source);
return parseInt(source, radix);
};
$.Primitives_objectTypeName = function(object) {
var name, decompiled, t1;
name = $.constructorNameFallback(object);
if ($.$$eq(name, "Object") === true) {
decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\s*\(/)[1];
if (typeof decompiled === "string")
name = decompiled;
}
t1 = $.getInterceptor$JSString(name);
return t1.charCodeAt$1(name, 0) === 36 ? t1.substring$1(name, 1) : name;
};
$.Primitives_newFixedList = function(length) {
var result = new Array(length);
result.fixed$length = true;
return result;
};
$.Primitives_dateNow = function() {
return Date.now();
};
$.Primitives_lazyAsJsDate = function(receiver) {
if (receiver.date === (void 0))
receiver.date = new Date(receiver.millisecondsSinceEpoch);
return receiver.date;
};
$.Primitives_getYear = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCFullYear() + 0) : ($.Primitives_lazyAsJsDate(receiver).getFullYear() + 0);
};
$.Primitives_getMonth = function(receiver) {
return receiver.isUtc === true ? $.Primitives_lazyAsJsDate(receiver).getUTCMonth() + 1 : $.Primitives_lazyAsJsDate(receiver).getMonth() + 1;
};
$.Primitives_getDay = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCDate() + 0) : ($.Primitives_lazyAsJsDate(receiver).getDate() + 0);
};
$.Primitives_getHours = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCHours() + 0) : ($.Primitives_lazyAsJsDate(receiver).getHours() + 0);
};
$.Primitives_getMinutes = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCMinutes() + 0) : ($.Primitives_lazyAsJsDate(receiver).getMinutes() + 0);
};
$.Primitives_getSeconds = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCSeconds() + 0) : ($.Primitives_lazyAsJsDate(receiver).getSeconds() + 0);
};
$.Primitives_getMilliseconds = function(receiver) {
return receiver.isUtc === true ? ($.Primitives_lazyAsJsDate(receiver).getUTCMilliseconds() + 0) : ($.Primitives_lazyAsJsDate(receiver).getMilliseconds() + 0);
};
$.iae = function(argument) {
throw $.$$throw($.ArgumentError$(argument));
};
$.ioore = function(index) {
throw $.$$throw($.RangeError$value(index));
};
$.checkNull = function(object) {
if (object == null)
throw $.$$throw($.ArgumentError$(null));
return object;
};
$.checkNum = function(value) {
if (!(typeof value === "number"))
throw $.$$throw($.ArgumentError$(value));
return value;
};
$.checkString = function(value) {
if (!(typeof value === "string"))
throw $.$$throw($.ArgumentError$(value));
return value;
};
$.$$throw = function(ex) {
var wrapper;
if (ex == null)
ex = $.CONSTANT;
wrapper = $.DartError$(ex);
if (!!Error.captureStackTrace)
Error.captureStackTrace(wrapper, $.$$throw);
else
wrapper.stack = new Error().stack;
return wrapper;
};
$.DartError$ = function(dartException) {
var t1 = new $.DartError();
t1.DartError$1(dartException);
return t1;
};
$.DartError_toStringWrapper = function() {
return $.toString(this);
};
$.unwrapException = function(ex) {
var message, type, name, t1, ieErrorCode, ieFacilityNumber, t2;
if ("dartException" in ex)
return ex.dartException;
message = ex.message;
if (ex instanceof TypeError) {
type = ex.type;
name = ex.arguments ? ex.arguments[0] : "";
if (message.indexOf("JSNull") === -1) {
t1 = $.getInterceptor(type);
t1 = t1.$eq(type, "property_not_function") === true || t1.$eq(type, "called_non_callable") === true || t1.$eq(type, "non_object_property_call") === true || t1.$eq(type, "non_object_property_load") === true;
} else
t1 = true;
if (t1)
return $.NoSuchMethodError$(null, name, [], $.makeLiteralMap([]), null);
else if ($.$$eq(type, "undefined_method") === true)
return $.NoSuchMethodError$("", name, [], $.makeLiteralMap([]), null);
ieErrorCode = ex.number & 0xffff;
ieFacilityNumber = ex.number>>16 & 0x1FFF;
t1 = typeof message === "string";
if (t1)
if ($.CONSTANT0.endsWith$1(message, "is null") === true || $.CONSTANT0.endsWith$1(message, "is undefined") === true || $.CONSTANT0.endsWith$1(message, "is null or undefined") === true || $.CONSTANT0.endsWith$1(message, "of undefined") === true || $.CONSTANT0.endsWith$1(message, "of null") === true)
return $.NoSuchMethodError$(null, "<unknown>", [], $.makeLiteralMap([]), null);
else {
if (message.indexOf(" has no method ") === -1)
if (message.indexOf(" is not a function") === -1)
t2 = ieErrorCode === 438 && ieFacilityNumber === 10;
else
t2 = true;
else
t2 = true;
if (t2)
return $.NoSuchMethodError$("", "<unknown>", [], $.makeLiteralMap([]), null);
}
return $.Exception_Exception(t1 ? message : "");
}
if (ex instanceof RangeError) {
if (typeof message === "string" && message.indexOf("call stack") !== -1)
return $.StackOverflowError$();
return $.ArgumentError$(null);
}
if (typeof InternalError == 'function' && ex instanceof InternalError)
if (typeof message === "string" && message === "too much recursion")
return $.StackOverflowError$();
return ex;
};
$.getTraceFromException = function(exception) {
return $.StackTrace$(exception.stack);
};
$.StackTrace$ = function(stack) {
return new $.StackTrace(stack);
};
$.makeLiteralMap = function(keyValuePairs) {
var iterator, result, t1, key;
iterator = $.CONSTANT1.get$iterator(keyValuePairs);
result = $.LinkedHashMap_LinkedHashMap();
for (t1 = $.getInterceptor$JSArray(result); iterator.moveNext$0() === true;) {
key = iterator.get$current();
iterator.moveNext$0();
t1.$indexSet(result, key, iterator.get$current());
}
return result;
};
$.invokeClosure = function(closure, isolate, numberOfArguments, arg1, arg2) {
var t1 = $.getInterceptor(numberOfArguments);
if (t1.$eq(numberOfArguments, 0) === true)
return $._callInIsolate(isolate, new $.invokeClosure_anon(closure));
else if (t1.$eq(numberOfArguments, 1) === true)
return $._callInIsolate(isolate, new $.invokeClosure_anon0(closure, arg1));
else if (t1.$eq(numberOfArguments, 2) === true)
return $._callInIsolate(isolate, new $.invokeClosure_anon1(closure, arg1, arg2));
else
throw $.$$throw($.Exception_Exception("Unsupported number of arguments for wrapped closure"));
};
$.convertDartClosureToJS = function(closure, arity) {
var $function;
if (closure == null)
return;
$function = closure.$identity;
if (!!$function)
return $function;
$._currentIsolate();
$function = function($0, $1) { return $.invokeClosure.call$5(closure, $._currentIsolate(), arity, $0, $1); };
closure.$identity = $function;
return $function;
};
$.throwCyclicInit = function(staticName) {
throw $.$$throw($.RuntimeError$("Cyclic initialization for static " + $.S(staticName)));
};
$.typeNameInChrome = function(obj) {
return $.typeNameInWebKitCommon(obj.constructor.name);
};
$.typeNameInSafari = function(obj) {
return $.typeNameInWebKitCommon($.constructorNameFallback(obj));
};
$.typeNameInWebKitCommon = function(tag) {
var name = tag;
if (name === "Window")
return "DOMWindow";
if (name === "CanvasPixelArray")
return "Uint8ClampedArray";
if (name === "WebKitMutationObserver")
return "MutationObserver";
if (name === "AudioChannelMerger")
return "ChannelMergerNode";
if (name === "AudioChannelSplitter")
return "ChannelSplitterNode";
if (name === "AudioGainNode")
return "GainNode";
if (name === "AudioPannerNode")
return "PannerNode";
if (name === "JavaScriptAudioNode")
return "ScriptProcessorNode";
if (name === "Oscillator")
return "OscillatorNode";
if (name === "RealtimeAnalyserNode")
return "AnalyserNode";
return name;
};
$.typeNameInOpera = function(obj) {
var name = $.constructorNameFallback(obj);
if (name === "Window")
return "DOMWindow";
if (name === "ApplicationCache")
return "DOMApplicationCache";
return name;
};
$.typeNameInFirefox = function(obj) {
var name = $.constructorNameFallback(obj);
if (name === "Window")
return "DOMWindow";
if (name === "CSS2Properties")
return "CSSStyleDeclaration";
if (name === "DataTransfer")
return "Clipboard";
if (name === "DragEvent")
return "MouseEvent";
if (name === "GeoGeolocation")
return "Geolocation";
if (name === "MouseScrollEvent")
return "WheelEvent";
if (name === "OfflineResourceList")
return "DOMApplicationCache";
if (name === "WorkerMessageEvent")
return "MessageEvent";
if (name === "XMLDocument")
return "Document";
return name;
};
$.typeNameInIE = function(obj) {
var name = $.constructorNameFallback(obj);
if (name === "Window")
return "DOMWindow";
if (name === "Document") {
if (!!obj.xmlVersion)
return "Document";
return "HTMLDocument";
}
if (name === "ApplicationCache")
return "DOMApplicationCache";
if (name === "CanvasPixelArray")
return "Uint8ClampedArray";
if (name === "DataTransfer")
return "Clipboard";
if (name === "DragEvent")
return "MouseEvent";
if (name === "HTMLDDElement")
return "HTMLElement";
if (name === "HTMLDTElement")
return "HTMLElement";
if (name === "HTMLTableDataCellElement")
return "HTMLTableCellElement";
if (name === "HTMLTableHeaderCellElement")
return "HTMLTableCellElement";
if (name === "HTMLPhraseElement")
return "HTMLElement";
if (name === "MSStyleCSSProperties")
return "CSSStyleDeclaration";
if (name === "MouseWheelEvent")
return "WheelEvent";
if (name === "Position")
return "Geoposition";
if (name === "Object")
if (window.DataView && (obj instanceof window.DataView))
return "DataView";
return name;
};
$.constructorNameFallback = function(object) {
var $constructor, name, t1, string;
if (object == null)
return "Null";
$constructor = object.constructor;
if (typeof($constructor) === "function") {
name = $constructor.name;
if (typeof name === "string")
t1 = !(name === "") && !(name === "Object") && !(name === "Function.prototype");
else
t1 = false;
if (t1)
return name;
}
string = Object.prototype.toString.call(object);
return string.substring(8, string.length - 1);
};
$.alternateTag = function(object, tag) {
if (!!/^HTML[A-Z].*Element$/.test(tag)) {
if (Object.prototype.toString.call(object) === "[object Object]")
return;
return "HTMLElement";
}
return;
};
$.callHasOwnProperty = function($function, object, property) {
return $function.call(object, property);
};
$.getFunctionForTypeNameOf = function() {
if (!(typeof(navigator) === "object"))
return $.typeNameInChrome;
var userAgent = navigator.userAgent;
if (userAgent.indexOf("Chrome") !== -1 || userAgent.indexOf("DumpRenderTree") !== -1)
return $.typeNameInChrome;
else if (userAgent.indexOf("Firefox") !== -1)
return $.typeNameInFirefox;
else if (userAgent.indexOf("MSIE") !== -1)
return $.typeNameInIE;
else if (userAgent.indexOf("Opera") !== -1)
return $.typeNameInOpera;
else if (userAgent.indexOf("AppleWebKit") !== -1)
return $.typeNameInSafari;
else
return $.constructorNameFallback;
};
$.getTypeNameOf = function(obj) {
if ($._getTypeNameOf == null)
$._getTypeNameOf = $.getFunctionForTypeNameOf();
return $._getTypeNameOf.call$1(obj);
};
$.toStringForNativeObject = function(obj) {
return "Instance of " + $.getTypeNameOf(obj);
};
$.hashCodeForNativeObject = function(object) {
return $.Primitives_objectHashCode(object);
};
$.defineProperty = function(obj, property, value) {
Object.defineProperty(obj, property, {value: value, enumerable: false, writable: true, configurable: true});
};
$.dynamicBind = function(obj, name, methods, arguments) {
var tag, hasOwnPropertyFunction, method, secondTag, proto;
tag = $.getTypeNameOf(obj);
hasOwnPropertyFunction = Object.prototype.hasOwnProperty;
method = $.dynamicBindLookup(hasOwnPropertyFunction, tag, methods);
if (method == null) {
secondTag = $.alternateTag(obj, tag);
if (!(secondTag == null))
method = $.dynamicBindLookup(hasOwnPropertyFunction, secondTag, methods);
}
if (method == null)
method = $.lookupDynamicClass(hasOwnPropertyFunction, methods, $.getTypeNameOf($.CONSTANT6));
proto = Object.getPrototypeOf(obj);
if (method == null)
method = function () {if (Object.getPrototypeOf(this) === proto) {throw new TypeError(name + " is not a function");} else {return Object.prototype[name].apply(this, arguments);}};
if ($.callHasOwnProperty(hasOwnPropertyFunction, proto, name) !== true)
$.defineProperty(proto, name, method);
return method.apply(obj, arguments);
};
$.dynamicBindLookup = function(hasOwnPropertyFunction, tag, methods) {
var method, i, entry;
method = $.lookupDynamicClass(hasOwnPropertyFunction, methods, tag);
if (method == null && !($._dynamicMetadata0() == null))
for (i = 0; i < $._dynamicMetadata0().length; ++i) {
entry = $._dynamicMetadata0()[i];
if ($.callHasOwnProperty(hasOwnPropertyFunction, entry.get$_set(), tag)) {
method = $.lookupDynamicClass(hasOwnPropertyFunction, methods, entry.get$_tag());
if (!(method == null))
break;
}
}
return method;
};
$.lookupDynamicClass = function(hasOwnPropertyFunction, methods, className) {
return $.callHasOwnProperty(hasOwnPropertyFunction, methods, className) ? methods[className] : null;
};
$.dynamicFunction = function(name) {
var f, methods, dartMethod, bind;
f = Object.prototype[name];
if (!(f == null) && !!f.methods)
return f.methods;
methods = {};
dartMethod = Object.getPrototypeOf($.CONSTANT6)[name];
if (!(dartMethod == null))
methods["Object"] = dartMethod;
bind = function() {return $.dynamicBind.call$4(this, name, methods, Array.prototype.slice.call(arguments));};
bind.methods = methods;
$.defineProperty(Object.prototype, name, bind);
return methods;
};
$.MetaInfo$ = function(_tag, _tags, _set) {
return new $.MetaInfo(_tag, _tags, _set);
};
$._dynamicMetadata0 = function() {
if (typeof($dynamicMetadata) === "undefined")
$._dynamicMetadata([]);
return $dynamicMetadata;
};
$._dynamicMetadata = function(table) {
$dynamicMetadata = table;
};
$.buildDynamicMetadata = function(inputTable) {
var result, i, tag, tags, set, tagNames, j;
result = [];
for (i = 0; i < inputTable.length; ++i) {
tag = inputTable[i][0];
tags = inputTable[i][1];
set = {};
tagNames = tags.split("|");
for (j = 0; j < tagNames.length; ++j)
set[tagNames[j]] = true;
result.push($.MetaInfo$(tag, tags, set));
}
return result;
};
$.dynamicSetMetadata = function(inputTable) {
var t1 = $.buildDynamicMetadata(inputTable);
$._dynamicMetadata(t1);
};
$.regExpTest = function(regExp, str) {
return $.regExpGetNative(regExp).test(str);
};
$.regExpGetNative = function(regExp) {
var r = regExp._re;
return r == null ? regExp._re = $.regExpMakeNative(regExp, false) : r;
};
$.regExpMakeNative = function(regExp, global) {
var pattern, sb, e, isMultiLine, isCaseSensitive, t1, exception;
pattern = regExp.get$pattern();
isMultiLine = regExp.get$isMultiLine();
isCaseSensitive = regExp.get$isCaseSensitive();
$.checkString(pattern);
sb = $.StringBuffer_StringBuffer("");
if (isMultiLine === true)
$.add(sb, "m");
if (isCaseSensitive !== true)
$.add(sb, "i");
if (global === true)
$.add(sb, "g");
try {
t1 = new RegExp(pattern, $.toString(sb));
return t1;
} catch (exception) {
t1 = $.unwrapException(exception);
e = t1;
throw $.$$throw($.IllegalJSRegExpException$(pattern, String(e)));
}
};
$.JSSyntaxRegExp$ = function(pattern, caseSensitive, multiLine) {
return new $.JSSyntaxRegExp(pattern, multiLine, caseSensitive);
};
$.stringReplaceJS = function(receiver, replacer, to) {
return receiver.replace(replacer, to.replace('$', '$$$$'));
};
$.stringReplaceAllUnchecked = function(receiver, from, to) {
var result, length, t1, i;
$.checkString(to);
if (from === "")
if (receiver === "")
return to;
else {
result = $.StringBuffer_StringBuffer("");
length = receiver.length;
t1 = $.getInterceptor$JSArray(result);
t1.add$1(result, to);
for (i = 0; i < length; ++i) {
if (i >= receiver.length)
throw $.ioore(i);
t1.add$1(result, receiver[i]);
t1.add$1(result, to);
}
return t1.toString$0(result);
}
else
return $.stringReplaceJS(receiver, $.regExpMakeNative($.JSSyntaxRegExp$(from.replace($.regExpMakeNative($.get$quoteRegExp(), true), "\\$&"), true, false), true), to);
};
$.JsStringBuffer$ = function(content) {
var t1 = typeof content === "string" ? content : $.S(content);
return new $.JsStringBuffer(t1);
};
$.AsyncError$ = function(error, stackTrace) {
return new $.AsyncError(error, stackTrace, null);
};
$.AsyncError$withCause = function(error, stackTrace, cause) {
return new $.AsyncError(error, stackTrace, cause);
};
$.Future_Future$immediate = function(value) {
return $._FutureImpl$immediate(value);
};
$.Completer_Completer = function() {
return $._CompleterImpl$();
};
$._CompleterImpl$ = function() {
return new $._CompleterImpl($._FutureImpl$(), false);
};
$._FutureListener__FutureListener$wrap = function(future) {
return $._FutureListenerWrapper$(future);
};
$._FutureListenerWrapper$ = function(future) {
return new $._FutureListenerWrapper(future, null);
};
$._FutureImpl$ = function() {
return new $._FutureImpl(0, null);
};
$._FutureImpl$immediate = function(value) {
var t1 = new $._FutureImpl(0, null);
t1._FutureImpl$immediate$1(value);
return t1;
};
$._FutureImpl__FutureImpl$wait = function(futures) {
var t1, t2, completer, values, i, i0;
t1 = {};
t2 = $.getInterceptor$JSStringJSArray(futures);
if (t2.get$isEmpty(futures) === true)
return $.Future_Future$immediate($.CONSTANT5);
completer = $.Completer_Completer();
t1.remaining_0 = t2.get$length(futures);
values = $.List_List$fixedLength(t2.get$length(futures), null);
t1.completed_1 = false;
for (t2 = t2.get$iterator(futures), i = 0; t2.moveNext$0() === true; i = i0) {
i0 = i + 1;
t2.get$current().then$1(new $._FutureImpl__FutureImpl$wait_anon(t1, completer, values, i)).catchError$1(new $._FutureImpl__FutureImpl$wait_anon0(t1, completer));
}
return completer.get$future();
};
$._ThenFuture$ = function(_onValue) {
return new $._ThenFuture(_onValue, null, 0, null);
};
$._CatchErrorFuture$ = function(_onError, _test) {
return new $._CatchErrorFuture(_test, _onError, null, 0, null);
};
$._SubscribeFuture$ = function(onValue, _onError) {
return new $._SubscribeFuture(_onError, onValue, null, 0, null);
};
$._FutureWrapper$ = function(_future) {
return new $._FutureWrapper(_future);
};
$.Timer_Timer = function(milliseconds, callback) {
return $.TimerImpl$(milliseconds, callback);
};
$.Collections_collectionToString = function(c) {
var result = $.StringBuffer_StringBuffer("");
$.Collections__emitCollection(c, result, $.List_List(0));
return $.toString(result);
};
$.Collections__emitCollection = function(c, result, visiting) {
var t1, isList, t2, t3, first, t4;
t1 = $.getInterceptor$JSArray(visiting);
t1.add$1(visiting, c);
isList = typeof c === "object" && c !== null && (c.constructor === Array || !!c.$isList);
t2 = isList ? "[" : "{";
t3 = $.getInterceptor$JSArray(result);
t3.add$1(result, t2);
for (t2 = $.iterator(c), first = true; t2.moveNext$0() === true; first = false) {
t4 = t2.get$current();
if (!first)
t3.add$1(result, ", ");
$.Collections__emitObject(t4, result, visiting);
}
t3.add$1(result, isList ? "]" : "}");
t1.removeLast$0(visiting);
};
$.Collections__emitObject = function(o, result, visiting) {
if (typeof o === "object" && o !== null && (o.constructor === Array || !!o.$isCollection))
if ($.Collections__containsRef(visiting, o) === true)
$.add(result, typeof o === "object" && o !== null && (o.constructor === Array || !!o.$isList) ? "[...]" : "{...}");
else
$.Collections__emitCollection(o, result, visiting);
else if (typeof o === "object" && o !== null && !!o.$isMap)
if ($.Collections__containsRef(visiting, o) === true)
$.add(result, "{...}");
else
$.Maps__emitMap(o, result, visiting);
else
$.add(result, o);
};
$.Collections__containsRef = function(c, ref) {
var t1, t2;
for (t1 = $.iterator(c); t1.moveNext$0() === true;) {
t2 = t1.get$current();
if (t2 == null ? ref == null : t2 === ref)
return true;
}
return false;
};
$.HashMap_HashMap = function() {
return $._HashMapImpl$();
};
$.LinkedHashMap_LinkedHashMap = function() {
return $._LinkedHashMapImpl$();
};
$._HashMapImpl$ = function() {
var t1 = new $._HashMapImpl(null, null, null, null, null);
t1._HashMapImpl$0();
return t1;
};
$._HashMapImpl__computeLoadLimit = function(capacity) {
return $.CONSTANT2.$tdiv(capacity * 3, 4);
};
$._HashMapImpl__nextProbe = function(currentProbe, numberOfProbes, length) {
return $.$$and($.$$add(currentProbe, numberOfProbes), $.$$sub(length, 1));
};
$._HashMapImplKeyIterable$ = function(_map) {
return new $._HashMapImplKeyIterable(_map);
};
$._HashMapImplValueIterable$ = function(_map) {
return new $._HashMapImplValueIterable(_map);
};
$._HashMapImplKeyIterator$ = function(map) {
return new $._HashMapImplKeyIterator(map, -1, null);
};
$._HashMapImplValueIterator$ = function(map) {
return new $._HashMapImplValueIterator(map, -1, null);
};
$._HashMapImplIndexIterator$ = function(map) {
return new $._HashMapImplIndexIterator(map, -1, null);
};
$._KeyValuePair$ = function(key, value) {
return new $._KeyValuePair(key, value);
};
$._LinkedHashMapImpl$ = function() {
var t1 = new $._LinkedHashMapImpl(null, null);
t1._LinkedHashMapImpl$0();
return t1;
};
$.Maps_mapToString = function(m) {
var result = $.StringBuffer_StringBuffer("");
$.Maps__emitMap(m, result, $.List_List(0));
return $.toString(result);
};
$.Maps__emitMap = function(m, result, visiting) {
var t1, t2, t3;
t1 = {};
t2 = $.getInterceptor$JSArray(visiting);
t2.add$1(visiting, m);
t3 = $.getInterceptor$JSArray(result);
t3.add$1(result, "{");
t1.first_0 = true;
$.forEach(m, new $.Maps__emitMap_anon(t1, result, visiting));
t3.add$1(result, "}");
t2.removeLast$0(visiting);
};
$.Queue_Queue = function() {
return $.DoubleLinkedQueue$();
};
$.DoubleLinkedQueueEntry$ = function(e) {
var t1 = new $.DoubleLinkedQueueEntry(null, null, null);
t1.DoubleLinkedQueueEntry$1(e);
return t1;
};
$._DoubleLinkedQueueEntrySentinel$ = function() {
var t1 = new $._DoubleLinkedQueueEntrySentinel(null, null, null);
t1.DoubleLinkedQueueEntry$1(null);
t1._DoubleLinkedQueueEntrySentinel$0();
return t1;
};
$.DoubleLinkedQueue$ = function() {
var t1 = new $.DoubleLinkedQueue(null);
t1.DoubleLinkedQueue$0();
return t1;
};
$._DoubleLinkedQueueIterator$ = function(sentinel) {
return new $._DoubleLinkedQueueIterator(sentinel, sentinel, null);
};
$.MappedIterable$ = function(_iterable, _f) {
return new $.MappedIterable(_iterable, _f);
};
$.MappedIterator$ = function(_iterator, _f) {
return new $.MappedIterator(null, _iterator, _f);
};
$.WhereIterable$ = function(_iterable, _f) {
return new $.WhereIterable(_iterable, _f);
};
$.WhereIterator$ = function(_iterator, _f) {
return new $.WhereIterator(_iterator, _f);
};
$.ListIterator$ = function(list) {
return new $.ListIterator(list, $.length(list), -1, null);
};
$.MappedList$ = function(_list, _f) {
return new $.MappedList(_list, _f);
};
$.Date_Date$now = function() {
return $.DateTime_DateTime$now();
};
$.DateTime_DateTime$now = function() {
return $.DateTime$_now();
};
$.DateTime$fromMillisecondsSinceEpoch = function(millisecondsSinceEpoch, isUtc) {
var t1 = new $.DateTime(millisecondsSinceEpoch, isUtc);
t1.DateTime$fromMillisecondsSinceEpoch$2$isUtc(millisecondsSinceEpoch, isUtc);
return t1;
};
$.DateTime$_now = function() {
var t1 = new $.DateTime($.Primitives_dateNow(), false);
t1.DateTime$_now$0();
return t1;
};
$.Duration$ = function(days, hours, milliseconds, minutes, seconds) {
return new $.Duration($.$$add($.$$add($.$$add($.$$add($.$$mul(days, 86400000), $.$$mul(hours, 3600000)), $.$$mul(minutes, 60000)), $.$$mul(seconds, 1000)), milliseconds));
};
$.Error_safeToString = function(object) {
if (typeof object === "number" && Math.floor(object) === object || typeof object === "number" || typeof object === "boolean" || null == object)
return $.toString(object);
if (typeof object === "string")
return "\"" + $.S($.replaceAll($.replaceAll($.replaceAll($.CONSTANT0.replaceAll$2(object, "\\", "\\\\"), "\n", "\\n"), "\r", "\\r"), "\"", "\\\"")) + "\"";
return "Instance of '" + $.S($.Primitives_objectTypeName(object)) + "'";
};
$.ArgumentError$ = function(message) {
return new $.ArgumentError(message);
};
$.RangeError$ = function(message) {
return new $.RangeError(message);
};
$.RangeError$value = function(value) {
return new $.RangeError("value " + $.S(value));
};
$.NoSuchMethodError$ = function(_receiver, _memberName, _arguments, _namedArguments, existingArgumentNames) {
return new $.NoSuchMethodError(_receiver, _memberName, _arguments, _namedArguments, existingArgumentNames);
};
$.UnsupportedError$ = function(message) {
return new $.UnsupportedError(message);
};
$.UnimplementedError$ = function(message) {
return new $.UnimplementedError(message);
};
$.StateError$ = function(message) {
return new $.StateError(message);
};
$.ConcurrentModificationError$ = function(modifiedObject) {
return new $.ConcurrentModificationError(modifiedObject);
};
$.StackOverflowError$ = function() {
return new $.StackOverflowError();
};
$.RuntimeError$ = function(message) {
return new $.RuntimeError(message);
};
$.Exception_Exception = function(message) {
return $._ExceptionImplementation$(message);
};
$._ExceptionImplementation$ = function(message) {
return new $._ExceptionImplementation(message);
};
$.FormatException$ = function(message) {
return new $.FormatException(message);
};
$.IllegalJSRegExpException$ = function(_pattern, _errmsg) {
return new $.IllegalJSRegExpException(_pattern, _errmsg);
};
$.ExpectException$ = function(message) {
return new $.ExpectException(message);
};
$.int_parse = function(source, onError, radix) {
return $.Primitives_parseInt(source, radix, onError);
};
$.List_List = function(length) {
if (!(typeof length === "number" && Math.floor(length) === length) || length < 0)
throw $.$$throw($.ArgumentError$("Length must be a positive integer: " + $.S(length) + "."));
return new Array(length);
};
$.List_List$fixedLength = function(length, fill) {
var result, t1, i;
if (!(typeof length === "number" && Math.floor(length) === length) || length < 0)
throw $.$$throw($.ArgumentError$("Length must be a positive integer: " + $.S(length) + "."));
result = $.Primitives_newFixedList(length);
if (typeof result !== "object" || result === null || (result.constructor !== Array || !!result.immutable$list) && !result.$isJavaScriptIndexingBehavior)
return $.List_List$fixedLength$bailout(1, length, fill, result);
if ($.$$eq(length, 0) !== true && !(fill == null))
for (t1 = result.length, i = 0; i < t1; ++i)
result[i] = fill;
return result;
};
$.List_List$fixedLength$bailout = function(state0, length, fill, result) {
var t1, i;
if ($.$$eq(length, 0) !== true && !(fill == null))
for (t1 = $.getInterceptor$JSStringJSArray(result), i = 0; $.CONSTANT2.$lt(i, t1.get$length(result)); ++i)
t1.$indexSet(result, i, fill);
return result;
};
$.List_List$from = function(other) {
var list, t1;
list = $.List_List(0);
for (t1 = $.iterator(other); t1.moveNext$0() === true;)
list.push(t1.get$current());
return list;
};
$.Map_Map = function() {
return $.HashMap_HashMap();
};
$.print = function(object) {
if (typeof object === "string")
$.Primitives_printString(object);
else
$.Primitives_printString($.toString(object));
};
$.RegExp_RegExp = function(pattern, caseSensitive, multiLine) {
return $.JSSyntaxRegExp$(pattern, caseSensitive, multiLine);
};
$.StringBuffer_StringBuffer = function(content) {
return $.JsStringBuffer$(content);
};
$.Strings_join = function(strings, separator) {
$.checkNull(strings);
return $.Strings__toJsStringArray(strings).join(separator);
};
$.ReceivePort_ReceivePort = function() {
return $.ReceivePortImpl$();
};
$._defaultErrorFormatter.call$5 = $._defaultErrorFormatter;
$._defaultErrorFormatter.$name = "_defaultErrorFormatter";
$.expectAsync1.call$2$count = $.expectAsync1;
$.expectAsync1.call$1 = function(callback) {
return this.call$2$count(callback, 1);
};
;
$.expectAsync1.$name = "expectAsync1";
$.runTests.call$0 = $.runTests;
$.runTests.$name = "runTests";
$._nextBatch.call$0 = $._nextBatch;
$._nextBatch.$name = "_nextBatch";
$.IsolateNatives__processWorkerMessage.call$2 = $.IsolateNatives__processWorkerMessage;
$.IsolateNatives__processWorkerMessage.$name = "IsolateNatives__processWorkerMessage";
$.Primitives__throwFormatException.call$1 = $.Primitives__throwFormatException;
$.Primitives__throwFormatException.$name = "Primitives__throwFormatException";
$.$$throw.call$1 = $.$$throw;
$.$$throw.$name = "$$throw";
$.DartError_toStringWrapper.call$0 = $.DartError_toStringWrapper;
$.DartError_toStringWrapper.$name = "DartError_toStringWrapper";
$.invokeClosure.call$5 = $.invokeClosure;
$.invokeClosure.$name = "invokeClosure";
$.typeNameInChrome.call$1 = $.typeNameInChrome;
$.typeNameInChrome.$name = "typeNameInChrome";
$.typeNameInSafari.call$1 = $.typeNameInSafari;
$.typeNameInSafari.$name = "typeNameInSafari";
$.typeNameInOpera.call$1 = $.typeNameInOpera;
$.typeNameInOpera.$name = "typeNameInOpera";
$.typeNameInFirefox.call$1 = $.typeNameInFirefox;
$.typeNameInFirefox.$name = "typeNameInFirefox";
$.typeNameInIE.call$1 = $.typeNameInIE;
$.typeNameInIE.$name = "typeNameInIE";
$.constructorNameFallback.call$1 = $.constructorNameFallback;
$.constructorNameFallback.$name = "constructorNameFallback";
$.dynamicBind.call$4 = $.dynamicBind;
$.dynamicBind.$name = "dynamicBind";
Isolate.$finishClasses($$);
$$ = {};
$.ReceivePort = {builtin$cls: 'ReceivePort'};
$.List = {builtin$cls: 'List'};
$.$int = {builtin$cls: '$int'};
$._ManagerStub = {builtin$cls: '_ManagerStub'};
Isolate.makeConstantList = function(list) {
list.immutable$list = true;
list.fixed$length = true;
return list;
};
$.CONSTANT5 = Isolate.makeConstantList([]);
$.CONSTANT1 = new Isolate.$isolateProperties.JSArray();
$.CONSTANT = new Isolate.$isolateProperties.NullThrownError();
$.CONSTANT2 = new Isolate.$isolateProperties.JSInt();
$.CONSTANT3 = new Isolate.$isolateProperties._DeletedKeySentinel();
$.CONSTANT0 = new Isolate.$isolateProperties.JSString();
$.CONSTANT6 = new Isolate.$isolateProperties.Object();
$.CONSTANT4 = new Isolate.$isolateProperties.JSNumber();
$._assertFailureHandler = null;
$._assertErrorFormatter = null;
$._config = null;
$._currentGroup = "";
$.groupSep = " ";
$._tests = null;
$._testRunner = null;
$._testSetup = null;
$._testTeardown = null;
$._currentTest = 0;
$._initialized = false;
$._uncaughtErrorMessage = null;
$.PASS = "pass";
$.FAIL = "fail";
$.ERROR = "error";
$._soloTest = null;
$.lazyPort = null;
$._SPAWNED_SIGNAL = "spawned";
$.ReceivePortImpl__nextFreeId = 1;
$.Primitives_hashCodeSeed = 0;
$.Primitives_DOLLAR_CHAR_VALUE = 36;
$._getTypeNameOf = null;
$._FutureImpl__INCOMPLETE = 0;
$._FutureImpl__VALUE = 1;
$._FutureImpl__ERROR = 2;
$._FutureImpl__UNHANDLED_ERROR = 4;
$._HashMapImpl__DELETED_KEY = Isolate.$isolateProperties.CONSTANT3;
$._HashMapImpl__INITIAL_CAPACITY = 8;
$.DateTime__MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
$.Duration_MILLISECONDS_PER_SECOND = 1000;
$.Duration_SECONDS_PER_MINUTE = 60;
$.Duration_MINUTES_PER_HOUR = 60;
$.Duration_HOURS_PER_DAY = 24;
$.Duration_MILLISECONDS_PER_MINUTE = 60000;
$.Duration_MILLISECONDS_PER_HOUR = 3600000;
$.Duration_MILLISECONDS_PER_DAY = 86400000;
$.toString = function(receiver) {
return $.getInterceptor(receiver).toString$0(receiver);
};
$.$$eq = function(receiver, a0) {
return $.getInterceptor(receiver).$eq(receiver, a0);
};
$.$$gt = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$gt(receiver, a0);
};
$.iterator = function(receiver) {
return $.getInterceptor$JSArray(receiver).get$iterator(receiver);
};
$.forEach = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).forEach$1(receiver, a0);
};
$.$$indexSet = function(receiver, a0, a1) {
return $.getInterceptor$JSArray(receiver).$indexSet(receiver, a0, a1);
};
$.length = function(receiver) {
return $.getInterceptor$JSStringJSArray(receiver).get$length(receiver);
};
$.addLast = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).addLast$1(receiver, a0);
};
$.replaceAll = function(receiver, a0, a1) {
return $.getInterceptor$JSString(receiver).replaceAll$2(receiver, a0, a1);
};
$.$$mul = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$mul(receiver, a0);
};
$.hashCode = function(receiver) {
return $.getInterceptor(receiver).get$hashCode(receiver);
};
$.$$or = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$or(receiver, a0);
};
$.isEmpty = function(receiver) {
return $.getInterceptor$JSStringJSArray(receiver).get$isEmpty(receiver);
};
$.add = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).add$1(receiver, a0);
};
$.mappedBy = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).mappedBy$1(receiver, a0);
};
$.toList = function(receiver) {
return $.getInterceptor$JSArray(receiver).toList$0(receiver);
};
$.$$xor = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$xor(receiver, a0);
};
$.$$and = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$and(receiver, a0);
};
$.$$lt = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$lt(receiver, a0);
};
$.$$add = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$add(receiver, a0);
};
$.abs = function(receiver) {
return $.getInterceptor$JSNumber(receiver).abs$0(receiver);
};
$.$$ge = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$ge(receiver, a0);
};
$.remainder = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).remainder$1(receiver, a0);
};
$.$$tdiv = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$tdiv(receiver, a0);
};
$.where = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).where$1(receiver, a0);
};
$.toLowerCase = function(receiver) {
return $.getInterceptor$JSString(receiver).toLowerCase$0(receiver);
};
$.$$index = function(receiver, a0) {
return $.getInterceptor$JSStringJSArray(receiver).$index(receiver, a0);
};
$.$$sub = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$sub(receiver, a0);
};
$.$$shl = function(receiver, a0) {
return $.getInterceptor$JSNumber(receiver).$shl(receiver, a0);
};
$.remove = function(receiver, a0) {
return $.getInterceptor$JSArray(receiver).remove$1(receiver, a0);
};
$.split = function(receiver, a0) {
return $.getInterceptor$JSString(receiver).split$1(receiver, a0);
};
$.getInterceptor$JSStringJSArray = function(receiver) {
if (typeof receiver == "string")
return $.JSString.prototype;
if (receiver == null)
return void 0;
if (receiver.constructor == Array)
return $.JSArray.prototype;
return $.ObjectInterceptor.prototype;
};
$.getInterceptor$JSString = function(receiver) {
if (typeof receiver == "string")
return $.JSString.prototype;
if (receiver == null)
return void 0;
return $.ObjectInterceptor.prototype;
};
$.getInterceptor$JSNumber = function(receiver) {
if (typeof receiver == "number")
return $.JSNumber.prototype;
if (receiver == null)
return void 0;
return $.ObjectInterceptor.prototype;
};
$.getInterceptor = function(receiver) {
if (typeof receiver == "number") {
if (Math.floor(receiver) == receiver)
return $.JSInt.prototype;
return $.JSDouble.prototype;
}
if (typeof receiver == "string")
return $.JSString.prototype;
if (receiver == null)
return $.JSNull.prototype;
if (typeof receiver == "function")
return $.JSFunction.prototype;
if (typeof receiver == "boolean")
return $.JSBool.prototype;
if (receiver.constructor == Array)
return $.JSArray.prototype;
return $.ObjectInterceptor.prototype;
};
$.getInterceptor$JSArray = function(receiver) {
if (receiver == null)
return void 0;
if (receiver.constructor == Array)
return $.JSArray.prototype;
return $.ObjectInterceptor.prototype;
};
Isolate.$lazy($, "wrapAsync", "wrapAsync", "get$wrapAsync", function() {
return new $.anon0();
});
Isolate.$lazy($, "globalThis", "globalThis", "get$globalThis", function() {
return $.IsolateNatives_computeGlobalThis();
});
Isolate.$lazy($, "globalWindow", "globalWindow", "get$globalWindow", function() {
return $.get$globalThis().window;
});
Isolate.$lazy($, "globalWorker", "globalWorker", "get$globalWorker", function() {
return $.get$globalThis().Worker;
});
Isolate.$lazy($, "globalPostMessageDefined", "globalPostMessageDefined", "get$globalPostMessageDefined", function() {
return $.get$globalThis().postMessage !== (void 0);
});
Isolate.$lazy($, "thisScript", "IsolateNatives_thisScript", "get$IsolateNatives_thisScript", function() {
return $.IsolateNatives_computeThisScript();
});
Isolate.$lazy($, "quoteRegExp", "quoteRegExp", "get$quoteRegExp", function() {
return $.JSSyntaxRegExp$("[-[\\]{}()*+?.,\\\\^$|#\\s]", true, false);
});
var $ = null;
Isolate.$finishClasses($$);
$$ = {};
Isolate = Isolate.$finishIsolateConstructor(Isolate);
var $ = new Isolate();
$.$defineNativeClass = function(cls, desc) {
var fields = desc[''];
var fields_array = fields ? fields.split(',') : [];
for (var i = 0; i < fields_array.length; i++) {
$.$generateAccessor(fields_array[i], desc);
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var method in desc) {
if (method) {
if (hasOwnProperty.call(desc, method)) {
$.dynamicFunction(method)[cls] = desc[method];
}
}
}
};
(function(table) {
for (var key in table)
$.defineProperty(Object.prototype, key, table[key]);
})({
toString$0: function() {
return $.toStringForNativeObject(this);
},
get$hashCode: function() {
return $.hashCodeForNativeObject(this);
},
$eq: function(a) {
return this === a;
}
});
$.$defineNativeClass("Worker", {
get$id: function() {
return this.id;
},
set$id: function(i) {
this.id = i;
},
set$onmessage: function(f) {
this.onmessage = f;
},
postMessage$1: function(msg) {
this.postMessage(msg);
},
terminate$0: function() {
this.terminate();
}
});
// 1 dynamic classes.
// 1 classes
// 0 !leaf
$.main.call$0 = $.main;
//
// BEGIN invoke [main].
//
if (typeof document !== 'undefined' && document.readyState !== 'complete') {
document.addEventListener('readystatechange', function () {
if (document.readyState == 'complete') {
if (typeof dartMainRunner === 'function') {
dartMainRunner(function() { $.startRootIsolate($.main); });
} else {
$.startRootIsolate($.main);
}
}
}, false);
} else {
if (typeof dartMainRunner === 'function') {
dartMainRunner(function() { $.startRootIsolate($.main); });
} else {
$.startRootIsolate($.main);
}
}
//
// END invoke [main].
//
function init() {
Isolate.$isolateProperties = {};
function generateAccessor(field, prototype) {
var len = field.length;
var lastCharCode = field.charCodeAt(len - 1);
var needsAccessor = (lastCharCode & 63) >= 60;
if (needsAccessor) {
var needsGetter = (lastCharCode & 3) > 0;
var needsSetter = (lastCharCode & 2) == 0;
var renaming = (lastCharCode & 64) != 0;
var accessorName = field = field.substring(0, len - 1);
if (renaming) {
var divider = field.indexOf(":");
accessorName = field.substring(0, divider);
field = field.substring(divider + 1);
}
if (needsGetter) {
var getterString = "return this." + field + ";";
prototype["get$" + accessorName] = new Function(getterString);
}
if (needsSetter) {
var setterString = "this." + field + " = v;";
prototype["set$" + accessorName] = new Function("v", setterString);
}
}
return field;
};
Isolate.$isolateProperties.$generateAccessor = generateAccessor;
Isolate.$defineClass = function(cls, fields, prototype) {
var constructor;
if (typeof fields == 'function') {
constructor = fields;
} else {
var str = "function " + cls + "(";
var body = "";
for (var i = 0; i < fields.length; i++) {
if (i != 0) str += ", ";
var field = fields[i];
field = generateAccessor(field, prototype);
str += field;
body += "this." + field + " = " + field + ";\n";
}
str += ") {" + body + "}\n";
str += "return " + cls + ";";
constructor = new Function(str)();
}
constructor.prototype = prototype;
constructor.builtin$cls = cls;
return constructor;
};
var supportsProto = false;
var tmp = Isolate.$defineClass('c', ['f?'], {}).prototype;
if (tmp.__proto__) {
tmp.__proto__ = {};
if (typeof tmp.get$f !== 'undefined') supportsProto = true;
}
Isolate.$pendingClasses = {};
Isolate.$finishClasses = function(collectedClasses) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var cls in collectedClasses) {
if (hasOwnProperty.call(collectedClasses, cls)) {
var desc = collectedClasses[cls];
var fields = desc[''], supr;
if (typeof fields == 'string') {
var s = fields.split(';'); supr = s[0];
fields = s[1] == '' ? [] : s[1].split(',');
} else {
supr = desc['super'];
}
Isolate.$isolateProperties[cls] = Isolate.$defineClass(cls, fields, desc);
if (supr) Isolate.$pendingClasses[cls] = supr;
}
}
var pendingClasses = Isolate.$pendingClasses;
Isolate.$pendingClasses = {};
var finishedClasses = {};
function finishClass(cls) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (hasOwnProperty.call(finishedClasses, cls)) return;
finishedClasses[cls] = true;
var superclass = pendingClasses[cls];
if (!superclass) return;
finishClass(superclass);
var constructor = Isolate.$isolateProperties[cls];
var superConstructor = Isolate.$isolateProperties[superclass];
var prototype = constructor.prototype;
if (supportsProto) {
prototype.__proto__ = superConstructor.prototype;
prototype.constructor = constructor;
} else {
function tmp() {};
tmp.prototype = superConstructor.prototype;
var newPrototype = new tmp();
constructor.prototype = newPrototype;
newPrototype.constructor = constructor;
for (var member in prototype) {
if (!member) continue; if (hasOwnProperty.call(prototype, member)) {
newPrototype[member] = prototype[member];
}
}
}
}
for (var cls in pendingClasses) finishClass(cls);
};
Isolate.$lazy = function(prototype, staticName, fieldName, getterName, lazyValue) {
var getter = new Function("{ return $." + fieldName + ";}");
var sentinelUndefined = {};
var sentinelInProgress = {};
prototype[fieldName] = sentinelUndefined;
prototype[getterName] = function() {
var result = $[fieldName];
try {
if (result === sentinelUndefined) {
$[fieldName] = sentinelInProgress;
try {
result = $[fieldName] = lazyValue();
} finally {
if (result === sentinelUndefined) {
if ($[fieldName] === sentinelInProgress) {
$[fieldName] = null;
}
}
}
} else if (result === sentinelInProgress) {
$.throwCyclicInit(staticName);
}
return result;
} finally {
$[getterName] = getter;
}
};
};
Isolate.$finishIsolateConstructor = function(oldIsolate) {
var isolateProperties = oldIsolate.$isolateProperties;
var isolatePrototype = oldIsolate.prototype;
var str = "{\n";
str += "var properties = Isolate.$isolateProperties;\n";
for (var staticName in isolateProperties) {
if (Object.prototype.hasOwnProperty.call(isolateProperties, staticName)) {
str += "this." + staticName + "= properties." + staticName + ";\n";
}
}
str += "}\n";
var newIsolate = new Function(str);
newIsolate.prototype = isolatePrototype;
isolatePrototype.constructor = newIsolate;
newIsolate.$isolateProperties = isolateProperties;
return newIsolate;
};
}
//@ sourceMappingURL=minesweeper.test.dart.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment