UNPKG

bip-topl

Version:

A pure JavaScript implementation of bip-topl.

1,249 lines (1,229 loc) 116 kB
// make sure to keep this as 'var' // we don't want block scoping var dartNodePreambleSelf = typeof global !== "undefined" ? global : window; var self = Object.create(dartNodePreambleSelf); self.scheduleImmediate = typeof setImmediate !== "undefined" ? function (cb) { setImmediate(cb); } : function(cb) { setTimeout(cb, 0); }; // CommonJS globals. self.exports = exports; // Node.js specific exports, check to see if they exist & or polyfilled if (typeof process !== "undefined") { self.process = process; } if (typeof __dirname !== "undefined") { self.__dirname = __dirname; } if (typeof __filename !== "undefined") { self.__filename = __filename; } if (typeof Buffer !== "undefined") { self.Buffer = Buffer; } // if we're running in a browser, Dart supports most of this out of box // make sure we only run these in Node.js environment var dartNodeIsActuallyNode = !dartNodePreambleSelf.window try { // Check if we're in a Web Worker instead. if ("undefined" !== typeof WorkerGlobalScope && dartNodePreambleSelf instanceof WorkerGlobalScope) { dartNodeIsActuallyNode = false; } // Check if we're in Electron, with Node.js integration, and override if true. if ("undefined" !== typeof process && process.versions && process.versions.hasOwnProperty('electron') && process.versions.hasOwnProperty('node')) { dartNodeIsActuallyNode = true; } } catch(e) {} if (dartNodeIsActuallyNode) { // This line is to: // 1) Prevent Webpack from bundling. // 2) In Webpack on Node.js, make sure we're using the native Node.js require, which is available via __non_webpack_require__ // https://github.com/mbullington/node_preamble.dart/issues/18#issuecomment-527305561 var url = ("undefined" !== typeof __webpack_require__ ? __non_webpack_require__ : require)("url"); // Setting `self.location=` in Electron throws a `TypeError`, so we define it // as a property instead to be safe. Object.defineProperty(self, "location", { value: { get href() { if (url.pathToFileURL) { return url.pathToFileURL(process.cwd()).href + "/"; } else { // This isn't really a correct transformation, but it's the best we have // for versions of Node <10.12.0 which introduced `url.pathToFileURL()`. // For example, it will fail for paths that contain characters that need // to be escaped in URLs. return "file://" + (function() { var cwd = process.cwd(); if (process.platform != "win32") return cwd; return "/" + cwd.replace(/\\/g, "/"); })() + "/" } } } }); (function() { function computeCurrentScript() { try { throw new Error(); } catch(e) { var stack = e.stack; var re = new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "mg"); var lastMatch = null; do { var match = re.exec(stack); if (match != null) lastMatch = match; } while (match != null); return lastMatch[1]; } } // Setting `self.document=` isn't known to throw an error anywhere like // `self.location=` does on Electron, but it's better to be future-proof // just in case.. var cachedCurrentScript = null; Object.defineProperty(self, "document", { value: { get currentScript() { if (cachedCurrentScript == null) { cachedCurrentScript = {src: computeCurrentScript()}; } return cachedCurrentScript; } } }); })(); self.dartDeferredLibraryLoader = function(uri, successCallback, errorCallback) { try { load(uri); successCallback(); } catch (error) { errorCallback(error); } }; } // Generated by dart2js (fast startup emitter, strong, trust primitives, omit checks, lax runtime type), the Dart to JavaScript compiler version: 2.13.4. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] // method. // // dartMainRunner(main, args): // if this function is defined, the Dart [main] method will not be invoked // directly. Instead, a closure that will invoke [main], and its arguments // [args] is passed to [dartMainRunner]. // // dartDeferredLibraryLoader(uri, successCallback, errorCallback): // if this function is defined, it will be called when a deferred library // is loaded. It should load and eval the javascript of `uri`, and call // successCallback. If it fails to do so, it should call errorCallback with // an error. // // dartCallInstrumentation(id, qualifiedName): // if this function is defined, it will be called at each entry of a // method or constructor. Used only when compiling programs with // --experiment-call-instrumentation. (function dartProgram() { function copyProperties(from, to) { var keys = Object.keys(from); for (var i = 0; i < keys.length; i++) { var key = keys[i]; to[key] = from[key]; } } function mixinProperties(from, to) { var keys = Object.keys(from); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!to.hasOwnProperty(key)) to[key] = from[key]; } } var supportsDirectProtoAccess = function() { var cls = function() { }; cls.prototype = {p: {}}; var object = new cls(); if (!(object.__proto__ && object.__proto__.p === cls.prototype.p)) return false; try { if (typeof navigator != "undefined" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Chrome/") >= 0) return true; if (typeof version == "function" && version.length == 0) { var v = version(); if (/^\d+\.\d+\.\d+\.\d+$/.test(v)) return true; } } catch (_) { } return false; }(); function setFunctionNamesIfNecessary(holders) { function t() { } ; if (typeof t.name == "string") return; for (var i = 0; i < holders.length; i++) { var holder = holders[i]; var keys = Object.keys(holder); for (var j = 0; j < keys.length; j++) { var key = keys[j]; var f = holder[key]; if (typeof f == "function") f.name = key; } } } function inherit(cls, sup) { cls.prototype.constructor = cls; cls.prototype["$is" + cls.name] = cls; if (sup != null) { if (supportsDirectProtoAccess) { cls.prototype.__proto__ = sup.prototype; return; } var clsPrototype = Object.create(sup.prototype); copyProperties(cls.prototype, clsPrototype); cls.prototype = clsPrototype; } } function inheritMany(sup, classes) { for (var i = 0; i < classes.length; i++) inherit(classes[i], sup); } function mixin(cls, mixin) { mixinProperties(mixin.prototype, cls.prototype); cls.prototype.constructor = cls; } function lazyOld(holder, name, getterName, initializer) { var uninitializedSentinel = holder; holder[name] = uninitializedSentinel; holder[getterName] = function() { holder[getterName] = function() { H.throwCyclicInit(name); }; var result; var sentinelInProgress = initializer; try { if (holder[name] === uninitializedSentinel) { result = holder[name] = sentinelInProgress; result = holder[name] = initializer(); } else result = holder[name]; } finally { if (result === sentinelInProgress) holder[name] = null; holder[getterName] = function() { return this[name]; }; } return result; }; } function lazy(holder, name, getterName, initializer) { var uninitializedSentinel = holder; holder[name] = uninitializedSentinel; holder[getterName] = function() { if (holder[name] === uninitializedSentinel) holder[name] = initializer(); holder[getterName] = function() { return this[name]; }; return holder[name]; }; } function lazyFinal(holder, name, getterName, initializer) { var uninitializedSentinel = holder; holder[name] = uninitializedSentinel; holder[getterName] = function() { if (holder[name] === uninitializedSentinel) { var value = initializer(); if (holder[name] !== uninitializedSentinel) H.throwLateInitializationError(name); holder[name] = value; } holder[getterName] = function() { return this[name]; }; return holder[name]; }; } function makeConstList(list) { list.immutable$list = Array; list.fixed$length = Array; return list; } function convertToFastObject(properties) { function t() { } t.prototype = properties; new t(); return properties; } function convertAllToFastObject(arrayOfObjects) { for (var i = 0; i < arrayOfObjects.length; ++i) convertToFastObject(arrayOfObjects[i]); } var functionCounter = 0; function tearOffGetter(funcs, applyTrampolineIndex, reflectionInfo, name, isIntercepted) { return isIntercepted ? new Function("funcs", "applyTrampolineIndex", "reflectionInfo", "name", "H", "c", "return function tearOff_" + name + functionCounter++ + "(receiver) {" + "if (c === null) c = " + "H.closureFromTearOff" + "(" + "this, funcs, applyTrampolineIndex, reflectionInfo, false, true, name);" + "return new c(this, funcs[0], receiver, name);" + "}")(funcs, applyTrampolineIndex, reflectionInfo, name, H, null) : new Function("funcs", "applyTrampolineIndex", "reflectionInfo", "name", "H", "c", "return function tearOff_" + name + functionCounter++ + "() {" + "if (c === null) c = " + "H.closureFromTearOff" + "(" + "this, funcs, applyTrampolineIndex, reflectionInfo, false, false, name);" + "return new c(this, funcs[0], null, name);" + "}")(funcs, applyTrampolineIndex, reflectionInfo, name, H, null); } function tearOff(funcs, applyTrampolineIndex, reflectionInfo, isStatic, name, isIntercepted) { var cache = null; return isStatic ? function() { if (cache === null) cache = H.closureFromTearOff(this, funcs, applyTrampolineIndex, reflectionInfo, true, false, name).prototype; return cache; } : tearOffGetter(funcs, applyTrampolineIndex, reflectionInfo, name, isIntercepted); } var typesOffset = 0; function installTearOff(container, getterName, isStatic, isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex) { var funs = []; for (var i = 0; i < funsOrNames.length; i++) { var fun = funsOrNames[i]; if (typeof fun == "string") fun = container[fun]; fun.$callName = callNames[i]; funs.push(fun); } var fun = funs[0]; fun.$requiredArgCount = requiredParameterCount; fun.$defaultValues = optionalParameterDefaultValues; var reflectionInfo = funType; if (typeof reflectionInfo == "number") reflectionInfo += typesOffset; var name = funsOrNames[0]; fun.$stubName = name; var getterFunction = tearOff(funs, applyIndex || 0, reflectionInfo, isStatic, name, isIntercepted); container[getterName] = getterFunction; if (isStatic) fun.$tearOff = getterFunction; } function installStaticTearOff(container, getterName, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex) { return installTearOff(container, getterName, true, false, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex); } function installInstanceTearOff(container, getterName, isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex) { return installTearOff(container, getterName, false, isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, funsOrNames, funType, applyIndex); } function setOrUpdateInterceptorsByTag(newTags) { var tags = init.interceptorsByTag; if (!tags) { init.interceptorsByTag = newTags; return; } copyProperties(newTags, tags); } function setOrUpdateLeafTags(newTags) { var tags = init.leafTags; if (!tags) { init.leafTags = newTags; return; } copyProperties(newTags, tags); } function updateTypes(newTypes) { var types = init.types; var length = types.length; types.push.apply(types, newTypes); return length; } function updateHolder(holder, newHolder) { copyProperties(newHolder, holder); return holder; } var hunkHelpers = function() { var mkInstance = function(isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, applyIndex) { return function(container, getterName, name, funType) { return installInstanceTearOff(container, getterName, isIntercepted, requiredParameterCount, optionalParameterDefaultValues, callNames, [name], funType, applyIndex); }; }, mkStatic = function(requiredParameterCount, optionalParameterDefaultValues, callNames, applyIndex) { return function(container, getterName, name, funType) { return installStaticTearOff(container, getterName, requiredParameterCount, optionalParameterDefaultValues, callNames, [name], funType, applyIndex); }; }; return {inherit: inherit, inheritMany: inheritMany, mixin: mixin, installStaticTearOff: installStaticTearOff, installInstanceTearOff: installInstanceTearOff, _instance_0u: mkInstance(0, 0, null, ["call$0"], 0), _instance_1u: mkInstance(0, 1, null, ["call$1"], 0), _instance_2u: mkInstance(0, 2, null, ["call$2"], 0), _instance_0i: mkInstance(1, 0, null, ["call$0"], 0), _instance_1i: mkInstance(1, 1, null, ["call$1"], 0), _instance_2i: mkInstance(1, 2, null, ["call$2"], 0), _static_0: mkStatic(0, null, ["call$0"], 0), _static_1: mkStatic(1, null, ["call$1"], 0), _static_2: mkStatic(2, null, ["call$2"], 0), makeConstList: makeConstList, lazy: lazy, lazyFinal: lazyFinal, lazyOld: lazyOld, updateHolder: updateHolder, convertToFastObject: convertToFastObject, setFunctionNamesIfNecessary: setFunctionNamesIfNecessary, updateTypes: updateTypes, setOrUpdateInterceptorsByTag: setOrUpdateInterceptorsByTag, setOrUpdateLeafTags: setOrUpdateLeafTags}; }(); function initializeDeferredHunk(hunk) { typesOffset = init.types.length; hunk(hunkHelpers, init, holders, $); } function getGlobalFromName(name) { for (var i = 0; i < holders.length; i++) { if (holders[i] == C) continue; if (holders[i][name]) return holders[i][name]; } } var C = {}, H = {JS_CONST: function JS_CONST() { }, LateError: function LateError(t0) { this._message = t0; }, ListIterator: function ListIterator(t0, t1) { var _ = this; _.__internal$_iterable = t0; _.__internal$_length = t1; _.__internal$_index = 0; _.__internal$_current = null; }, FixedLengthListMixin: function FixedLengthListMixin() { }, unminifyOrTag: function(rawClassName) { var preserved = H.unmangleGlobalNameIfPreservedAnyways(rawClassName); if (preserved != null) return preserved; return rawClassName; }, isJsIndexable: function(object, record) { var result; if (record != null) { result = record.x; if (result != null) return result; } return type$.JavaScriptIndexingBehavior_dynamic._is(object); }, S: function(value) { var res; if (typeof value == "string") return value; if (typeof value == "number") { if (value !== 0) return "" + value; } else if (true === value) return "true"; else if (false === value) return "false"; else if (value == null) return "null"; res = J.toString$0$(value); return res; }, Primitives_objectTypeName: function(object) { return H.Primitives__objectTypeNameNewRti(object); }, Primitives__objectTypeNameNewRti: function(object) { var dispatchName, t1, $constructor, constructorName; if (object instanceof P.Object) return H._rtiToString(H.instanceType(object), null); if (J.getInterceptor$(object) === C.Interceptor_methods || type$.UnknownJavaScriptObject._is(object)) { dispatchName = C.C_JS_CONST(object); t1 = dispatchName !== "Object" && dispatchName !== ""; if (t1) return dispatchName; $constructor = object.constructor; if (typeof $constructor == "function") { constructorName = $constructor.name; if (typeof constructorName == "string") t1 = constructorName !== "Object" && constructorName !== ""; else t1 = false; if (t1) return constructorName; } } return H._rtiToString(H.instanceType(object), null); }, wrapException: function(ex) { var wrapper, t1; if (ex == null) ex = new P.NullThrownError(); wrapper = new Error(); wrapper.dartException = ex; t1 = H.toStringWrapper; if ("defineProperty" in Object) { Object.defineProperty(wrapper, "message", {get: t1}); wrapper.name = ""; } else wrapper.toString = t1; return wrapper; }, toStringWrapper: function() { return J.toString$0$(this.dartException); }, throwExpression: function(ex) { throw H.wrapException(ex); }, throwConcurrentModificationError: function(collection) { throw H.wrapException(P.ConcurrentModificationError$(collection)); }, Closure_fromTearOff: function(receiver, functions, applyTrampolineIndex, reflectionInfo, isStatic, isIntercepted, propertyName) { var $constructor, t1, trampoline, applyTrampoline, i, stub, stubCallName, $function = functions[0], callName = $function.$callName, $prototype = isStatic ? Object.create(new H.StaticClosure().constructor.prototype) : Object.create(new H.BoundClosure(null, null, null, "").constructor.prototype); $prototype.$initialize = $prototype.constructor; if (isStatic) $constructor = function static_tear_off() { this.$initialize(); }; else { t1 = $.Closure_functionCounter; $.Closure_functionCounter = t1 + 1; t1 = new Function("a,b,c,d" + t1, "this.$initialize(a,b,c,d" + t1 + ")"); $constructor = t1; } $prototype.constructor = $constructor; $constructor.prototype = $prototype; if (!isStatic) { trampoline = H.Closure_forwardCallTo(receiver, $function, isIntercepted); trampoline.$reflectionInfo = reflectionInfo; } else { $prototype.$static_name = propertyName; trampoline = $function; } $prototype.$signature = H.Closure__computeSignatureFunctionNewRti(reflectionInfo, isStatic, isIntercepted); $prototype[callName] = trampoline; for (applyTrampoline = trampoline, i = 1; i < functions.length; ++i) { stub = functions[i]; stubCallName = stub.$callName; if (stubCallName != null) { stub = isStatic ? stub : H.Closure_forwardCallTo(receiver, stub, isIntercepted); $prototype[stubCallName] = stub; } if (i === applyTrampolineIndex) { stub.$reflectionInfo = reflectionInfo; applyTrampoline = stub; } } $prototype["call*"] = applyTrampoline; $prototype.$requiredArgCount = $function.$requiredArgCount; $prototype.$defaultValues = $function.$defaultValues; return $constructor; }, Closure__computeSignatureFunctionNewRti: function(functionType, isStatic, isIntercepted) { var typeEvalMethod; if (typeof functionType == "number") return function(getType, t) { return function() { return getType(t); }; }(H.getTypeFromTypesTable, functionType); if (typeof functionType == "string") { if (isStatic) throw H.wrapException("Cannot compute signature for static tearoff."); typeEvalMethod = isIntercepted ? H.BoundClosure_evalRecipeIntercepted : H.BoundClosure_evalRecipe; return function(recipe, evalOnReceiver) { return function() { return evalOnReceiver(this, recipe); }; }(functionType, typeEvalMethod); } throw H.wrapException("Error in functionType of tearoff"); }, Closure_cspForwardCall: function(arity, isSuperCall, stubName, $function) { var getSelf = H.BoundClosure_selfOf; switch (isSuperCall ? -1 : arity) { case 0: return function(n, S) { return function() { return S(this)[n](); }; }(stubName, getSelf); case 1: return function(n, S) { return function(a) { return S(this)[n](a); }; }(stubName, getSelf); case 2: return function(n, S) { return function(a, b) { return S(this)[n](a, b); }; }(stubName, getSelf); case 3: return function(n, S) { return function(a, b, c) { return S(this)[n](a, b, c); }; }(stubName, getSelf); case 4: return function(n, S) { return function(a, b, c, d) { return S(this)[n](a, b, c, d); }; }(stubName, getSelf); case 5: return function(n, S) { return function(a, b, c, d, e) { return S(this)[n](a, b, c, d, e); }; }(stubName, getSelf); default: return function(f, s) { return function() { return f.apply(s(this), arguments); }; }($function, getSelf); } }, Closure_forwardCallTo: function(receiver, $function, isIntercepted) { var stubName, arity, lookedUpFunction, t1, t2, selfName, $arguments; if (isIntercepted) return H.Closure_forwardInterceptedCallTo(receiver, $function); stubName = $function.$stubName; arity = $function.length; lookedUpFunction = receiver[stubName]; t1 = $function == null ? lookedUpFunction == null : $function === lookedUpFunction; t2 = !t1 || arity >= 27; if (t2) return H.Closure_cspForwardCall(arity, !t1, stubName, $function); if (arity === 0) { t1 = $.Closure_functionCounter; $.Closure_functionCounter = t1 + 1; selfName = "self" + H.S(t1); t1 = "return function(){var " + selfName + " = this."; t2 = $.BoundClosure_selfFieldNameCache; return new Function(t1 + (t2 == null ? $.BoundClosure_selfFieldNameCache = H.BoundClosure_computeFieldNamed("self") : t2) + ";return " + selfName + "." + H.S(stubName) + "();}")(); } $arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).join(","); t1 = $.Closure_functionCounter; $.Closure_functionCounter = t1 + 1; $arguments += H.S(t1); t1 = "return function(" + $arguments + "){return this."; t2 = $.BoundClosure_selfFieldNameCache; return new Function(t1 + (t2 == null ? $.BoundClosure_selfFieldNameCache = H.BoundClosure_computeFieldNamed("self") : t2) + "." + H.S(stubName) + "(" + $arguments + ");}")(); }, Closure_cspForwardInterceptedCall: function(arity, isSuperCall, $name, $function) { var getSelf = H.BoundClosure_selfOf, getReceiver = H.BoundClosure_receiverOf; switch (isSuperCall ? -1 : arity) { case 0: throw H.wrapException(new H.RuntimeError("Intercepted function with no arguments.")); case 1: return function(n, s, r) { return function() { return s(this)[n](r(this)); }; }($name, getSelf, getReceiver); case 2: return function(n, s, r) { return function(a) { return s(this)[n](r(this), a); }; }($name, getSelf, getReceiver); case 3: return function(n, s, r) { return function(a, b) { return s(this)[n](r(this), a, b); }; }($name, getSelf, getReceiver); case 4: return function(n, s, r) { return function(a, b, c) { return s(this)[n](r(this), a, b, c); }; }($name, getSelf, getReceiver); case 5: return function(n, s, r) { return function(a, b, c, d) { return s(this)[n](r(this), a, b, c, d); }; }($name, getSelf, getReceiver); case 6: return function(n, s, r) { return function(a, b, c, d, e) { return s(this)[n](r(this), a, b, c, d, e); }; }($name, getSelf, getReceiver); default: return function(f, s, r, a) { return function() { a = [r(this)]; Array.prototype.push.apply(a, arguments); return f.apply(s(this), a); }; }($function, getSelf, getReceiver); } }, Closure_forwardInterceptedCallTo: function(receiver, $function) { var receiverField, stubName, arity, lookedUpFunction, t1, t2, $arguments, selfField = $.BoundClosure_selfFieldNameCache; if (selfField == null) selfField = $.BoundClosure_selfFieldNameCache = H.BoundClosure_computeFieldNamed("self"); receiverField = $.BoundClosure_receiverFieldNameCache; if (receiverField == null) receiverField = $.BoundClosure_receiverFieldNameCache = H.BoundClosure_computeFieldNamed("receiver"); stubName = $function.$stubName; arity = $function.length; lookedUpFunction = receiver[stubName]; t1 = $function == null ? lookedUpFunction == null : $function === lookedUpFunction; t2 = !t1 || arity >= 28; if (t2) return H.Closure_cspForwardInterceptedCall(arity, !t1, stubName, $function); if (arity === 1) { t1 = "return function(){return this." + selfField + "." + H.S(stubName) + "(this." + receiverField + ");"; t2 = $.Closure_functionCounter; $.Closure_functionCounter = t2 + 1; return new Function(t1 + H.S(t2) + "}")(); } $arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity - 1).join(","); t1 = "return function(" + $arguments + "){return this." + selfField + "." + H.S(stubName) + "(this." + receiverField + ", " + $arguments + ");"; t2 = $.Closure_functionCounter; $.Closure_functionCounter = t2 + 1; return new Function(t1 + H.S(t2) + "}")(); }, closureFromTearOff: function(receiver, functions, applyTrampolineIndex, reflectionInfo, isStatic, isIntercepted, $name) { return H.Closure_fromTearOff(receiver, functions, applyTrampolineIndex, reflectionInfo, !!isStatic, !!isIntercepted, $name); }, BoundClosure_evalRecipe: function(closure, recipe) { return H._Universe_evalInEnvironment(init.typeUniverse, H.instanceType(closure._self), recipe); }, BoundClosure_evalRecipeIntercepted: function(closure, recipe) { return H._Universe_evalInEnvironment(init.typeUniverse, H.instanceType(closure._receiver), recipe); }, BoundClosure_selfOf: function(closure) { return closure._self; }, BoundClosure_receiverOf: function(closure) { return closure._receiver; }, BoundClosure_computeFieldNamed: function(fieldName) { var names, i, $name, template = new H.BoundClosure("self", "target", "receiver", "name"), t1 = Object.getOwnPropertyNames(template); t1.fixed$length = Array; names = t1; for (t1 = names.length, i = 0; i < t1; ++i) { $name = names[i]; if (template[$name] === fieldName) return $name; } throw H.wrapException(P.ArgumentError$("Field name " + fieldName + " not found.")); }, throwCyclicInit: function(staticName) { throw H.wrapException(new P.CyclicInitializationError(staticName)); }, getIsolateAffinityTag: function($name) { return init.getIsolateTag($name); }, throwLateInitializationError: function($name) { return H.throwExpression(new H.LateError($name)); }, lookupAndCacheInterceptor: function(obj) { var interceptor, interceptorClass, altTag, mark, t1, tag = $.getTagFunction.call$1(obj), record = $.dispatchRecordsForInstanceTags[tag]; if (record != null) { Object.defineProperty(obj, init.dispatchPropertyName, {value: record, enumerable: false, writable: true, configurable: true}); return record.i; } interceptor = $.interceptorsForUncacheableTags[tag]; if (interceptor != null) return interceptor; interceptorClass = init.interceptorsByTag[tag]; if (interceptorClass == null) { altTag = $.alternateTagFunction.call$2(obj, tag); if (altTag != null) { record = $.dispatchRecordsForInstanceTags[altTag]; if (record != null) { Object.defineProperty(obj, init.dispatchPropertyName, {value: record, enumerable: false, writable: true, configurable: true}); return record.i; } interceptor = $.interceptorsForUncacheableTags[altTag]; if (interceptor != null) return interceptor; interceptorClass = init.interceptorsByTag[altTag]; tag = altTag; } } if (interceptorClass == null) return null; interceptor = interceptorClass.prototype; mark = tag[0]; if (mark === "!") { record = H.makeLeafDispatchRecord(interceptor); $.dispatchRecordsForInstanceTags[tag] = record; Object.defineProperty(obj, init.dispatchPropertyName, {value: record, enumerable: false, writable: true, configurable: true}); return record.i; } if (mark === "~") { $.interceptorsForUncacheableTags[tag] = interceptor; return interceptor; } if (mark === "-") { t1 = H.makeLeafDispatchRecord(interceptor); Object.defineProperty(Object.getPrototypeOf(obj), init.dispatchPropertyName, {value: t1, enumerable: false, writable: true, configurable: true}); return t1.i; } if (mark === "+") return H.patchInteriorProto(obj, interceptor); if (mark === "*") throw H.wrapException(P.UnimplementedError$(tag)); if (init.leafTags[tag] === true) { t1 = H.makeLeafDispatchRecord(interceptor); Object.defineProperty(Object.getPrototypeOf(obj), init.dispatchPropertyName, {value: t1, enumerable: false, writable: true, configurable: true}); return t1.i; } else return H.patchInteriorProto(obj, interceptor); }, patchInteriorProto: function(obj, interceptor) { var proto = Object.getPrototypeOf(obj); Object.defineProperty(proto, init.dispatchPropertyName, {value: J.makeDispatchRecord(interceptor, proto, null, null), enumerable: false, writable: true, configurable: true}); return interceptor; }, makeLeafDispatchRecord: function(interceptor) { return J.makeDispatchRecord(interceptor, false, null, !!interceptor.$isJavaScriptIndexingBehavior); }, makeDefaultDispatchRecord: function(tag, interceptorClass, proto) { var interceptor = interceptorClass.prototype; if (init.leafTags[tag] === true) return H.makeLeafDispatchRecord(interceptor); else return J.makeDispatchRecord(interceptor, proto, null, null); }, initNativeDispatch: function() { if (true === $.initNativeDispatchFlag) return; $.initNativeDispatchFlag = true; H.initNativeDispatchContinue(); }, initNativeDispatchContinue: function() { var map, tags, fun, i, tag, proto, record, interceptorClass; $.dispatchRecordsForInstanceTags = Object.create(null); $.interceptorsForUncacheableTags = Object.create(null); H.initHooks(); map = init.interceptorsByTag; tags = Object.getOwnPropertyNames(map); if (typeof window != "undefined") { window; fun = function() { }; for (i = 0; i < tags.length; ++i) { tag = tags[i]; proto = $.prototypeForTagFunction.call$1(tag); if (proto != null) { record = H.makeDefaultDispatchRecord(tag, map[tag], proto); if (record != null) { Object.defineProperty(proto, init.dispatchPropertyName, {value: record, enumerable: false, writable: true, configurable: true}); fun.prototype = proto; } } } } for (i = 0; i < tags.length; ++i) { tag = tags[i]; if (/^[A-Za-z_]/.test(tag)) { interceptorClass = map[tag]; map["!" + tag] = interceptorClass; map["~" + tag] = interceptorClass; map["-" + tag] = interceptorClass; map["+" + tag] = interceptorClass; map["*" + tag] = interceptorClass; } } }, initHooks: function() { var transformers, i, transformer, getTag, getUnknownTag, prototypeForTag, hooks = C.C_JS_CONST0(); hooks = H.applyHooksTransformer(C.C_JS_CONST1, H.applyHooksTransformer(C.C_JS_CONST2, H.applyHooksTransformer(C.C_JS_CONST3, H.applyHooksTransformer(C.C_JS_CONST3, H.applyHooksTransformer(C.C_JS_CONST4, H.applyHooksTransformer(C.C_JS_CONST5, H.applyHooksTransformer(C.C_JS_CONST6(C.C_JS_CONST), hooks))))))); if (typeof dartNativeDispatchHooksTransformer != "undefined") { transformers = dartNativeDispatchHooksTransformer; if (typeof transformers == "function") transformers = [transformers]; if (transformers.constructor == Array) for (i = 0; i < transformers.length; ++i) { transformer = transformers[i]; if (typeof transformer == "function") hooks = transformer(hooks) || hooks; } } getTag = hooks.getTag; getUnknownTag = hooks.getUnknownTag; prototypeForTag = hooks.prototypeForTag; $.getTagFunction = new H.initHooks_closure(getTag); $.alternateTagFunction = new H.initHooks_closure0(getUnknownTag); $.prototypeForTagFunction = new H.initHooks_closure1(prototypeForTag); }, applyHooksTransformer: function(transformer, hooks) { return transformer(hooks) || hooks; }, Closure: function Closure() { }, TearOffClosure: function TearOffClosure() { }, StaticClosure: function StaticClosure() { }, BoundClosure: function BoundClosure(t0, t1, t2, t3) { var _ = this; _._self = t0; _._target = t1; _._receiver = t2; _._name = t3; }, RuntimeError: function RuntimeError(t0) { this.message = t0; }, initHooks_closure: function initHooks_closure(t0) { this.getTag = t0; }, initHooks_closure0: function initHooks_closure0(t0) { this.getUnknownTag = t0; }, initHooks_closure1: function initHooks_closure1(t0) { this.prototypeForTag = t0; }, NativeTypedData: function NativeTypedData() { }, NativeTypedArray: function NativeTypedArray() { }, NativeTypedArrayOfInt: function NativeTypedArrayOfInt() { }, NativeUint8List: function NativeUint8List() { }, _NativeTypedArrayOfInt_NativeTypedArray_ListMixin: function _NativeTypedArrayOfInt_NativeTypedArray_ListMixin() { }, _NativeTypedArrayOfInt_NativeTypedArray_ListMixin_FixedLengthListMixin: function _NativeTypedArrayOfInt_NativeTypedArray_ListMixin_FixedLengthListMixin() { }, Rti__getQuestionFromStar: function(universe, rti) { var question = rti._precomputed1; return question == null ? rti._precomputed1 = H._Universe__lookupQuestionRti(universe, rti._primary, true) : question; }, Rti__getFutureFromFutureOr: function(universe, rti) { var future = rti._precomputed1; return future == null ? rti._precomputed1 = H._Universe__lookupInterfaceRti(universe, "Future", [rti._primary]) : future; }, Rti__isUnionOfFunctionType: function(rti) { var kind = rti._kind; if (kind === 6 || kind === 7 || kind === 8) return H.Rti__isUnionOfFunctionType(rti._primary); return kind === 11 || kind === 12; }, Rti__getCanonicalRecipe: function(rti) { return rti._canonicalRecipe; }, findType: function(recipe) { return H._Universe_eval(init.typeUniverse, recipe, false); }, _substitute: function(universe, rti, typeArguments, depth) { var baseType, substitutedBaseType, interfaceTypeArguments, substitutedInterfaceTypeArguments, base, substitutedBase, $arguments, substitutedArguments, returnType, substitutedReturnType, functionParameters, substitutedFunctionParameters, bounds, substitutedBounds, index, argument, kind = rti._kind; switch (kind) { case 5: case 1: case 2: case 3: case 4: return rti; case 6: baseType = rti._primary; substitutedBaseType = H._substitute(universe, baseType, typeArguments, depth); if (substitutedBaseType === baseType) return rti; return H._Universe__lookupStarRti(universe, substitutedBaseType, true); case 7: baseType = rti._primary; substitutedBaseType = H._substitute(universe, baseType, typeArguments, depth); if (substitutedBaseType === baseType) return rti; return H._Universe__lookupQuestionRti(universe, substitutedBaseType, true); case 8: baseType = rti._primary; substitutedBaseType = H._substitute(universe, baseType, typeArguments, depth); if (substitutedBaseType === baseType) return rti; return H._Universe__lookupFutureOrRti(universe, substitutedBaseType, true); case 9: interfaceTypeArguments = rti._rest; substitutedInterfaceTypeArguments = H._substituteArray(universe, interfaceTypeArguments, typeArguments, depth); if (substitutedInterfaceTypeArguments === interfaceTypeArguments) return rti; return H._Universe__lookupInterfaceRti(universe, rti._primary, substitutedInterfaceTypeArguments); case 10: base = rti._primary; substitutedBase = H._substitute(universe, base, typeArguments, depth); $arguments = rti._rest; substitutedArguments = H._substituteArray(universe, $arguments, typeArguments, depth); if (substitutedBase === base && substitutedArguments === $arguments) return rti; return H._Universe__lookupBindingRti(universe, substitutedBase, substitutedArguments); case 11: returnType = rti._primary; substitutedReturnType = H._substitute(universe, returnType, typeArguments, depth); functionParameters = rti._rest; substitutedFunctionParameters = H._substituteFunctionParameters(universe, functionParameters, typeArguments, depth); if (substitutedReturnType === returnType && substitutedFunctionParameters === functionParameters) return rti; return H._Universe__lookupFunctionRti(universe, substitutedReturnType, substitutedFunctionParameters); case 12: bounds = rti._rest; depth += bounds.length; substitutedBounds = H._substituteArray(universe, bounds, typeArguments, depth); base = rti._primary; substitutedBase = H._substitute(universe, base, typeArguments, depth); if (substitutedBounds === bounds && substitutedBase === base) return rti; return H._Universe__lookupGenericFunctionRti(universe, substitutedBase, substitutedBounds, true); case 13: index = rti._primary; if (index < depth) return rti; argument = typeArguments[index - depth]; if (argument == null) return rti; return argument; default: throw H.wrapException(P.AssertionError$("Attempted to substitute unexpected RTI kind " + kind)); } }, _substituteArray: function(universe, rtiArray, typeArguments, depth) { var changed, i, rti, substitutedRti, $length = rtiArray.length, result = []; for (changed = false, i = 0; i < $length; ++i) { rti = rtiArray[i]; substitutedRti = H._substitute(universe, rti, typeArguments, depth); if (substitutedRti !== rti) changed = true; result.push(substitutedRti); } return changed ? result : rtiArray; }, _substituteNamed: function(universe, namedArray, typeArguments, depth) { var changed, i, t1, t2, rti, substitutedRti, $length = namedArray.length, result = []; for (changed = false, i = 0; i < $length; i += 3) { t1 = namedArray[i]; t2 = namedArray[i + 1]; rti = namedArray[i + 2]; substitutedRti = H._substitute(universe, rti, typeArguments, depth); if (substitutedRti !== rti) changed = true; result.push(t1); result.push(t2); result.push(substitutedRti); } return changed ? result : namedArray; }, _substituteFunctionParameters: function(universe, functionParameters, typeArguments, depth) { var result, requiredPositional = functionParameters._requiredPositional, substitutedRequiredPositional = H._substituteArray(universe, requiredPositional, typeArguments, depth), optionalPositional = functionParameters._optionalPositional, substitutedOptionalPositional = H._substituteArray(universe, optionalPositional, typeArguments, depth), named = functionParameters._named, substitutedNamed = H._substituteNamed(universe, named, typeArguments, depth); if (substitutedRequiredPositional === requiredPositional && substitutedOptionalPositional === optionalPositional && substitutedNamed === named) return functionParameters; result = new H._FunctionParameters(); result._requiredPositional = substitutedRequiredPositional; result._optionalPositional = substitutedOptionalPositional; result._named = substitutedNamed; return result; }, closureFunctionType: function(closure) { var signature = closure.$signature; if (signature != null) { if (typeof signature == "number") return H.getTypeFromTypesTable(signature); return closure.$signature(); } return null; }, instanceOrFunctionType: function(object, testRti) { var rti; if (H.Rti__isUnionOfFunctionType(testRti)) if (object instanceof H.Closure) { rti = H.closureFunctionType(object); if (rti != null) return rti; } return H.instanceType(object); }, instanceType: function(object) { var rti; if (object instanceof P.Object) { rti = object.$ti; return rti != null ? rti : H._instanceTypeFromConstructor(object); } if (Array.isArray(object)) return H._arrayInstanceType(object); return H._instanceTypeFromConstructor(J.getInterceptor$(object)); }, _arrayInstanceType: function(object) { var rti = object[init.arrayRti], defaultRti = type$.JSArray_dynamic; if (rti == null) return defaultRti; if (rti.constructor !== defaultRti.constructor) return defaultRti; return rti; }, _instanceType: function(object) { var rti = object.$ti; return rti != null ? rti : H._instanceTypeFromConstructor(object); }, _instanceTypeFromConstructor: function(instance) { var $constructor = instance.constructor, probe = $constructor.$ccache; if (probe != null) return probe; return H._instanceTypeFromConstructorMiss(instance, $constructor); }, _instanceTypeFromConstructorMiss: function(instance, $constructor) { var effectiveConstructor = instance instanceof H.Closure ? instance.__proto__.__proto__.constructor : $constructor, rti = H._Universe_findErasedType(init.typeUniverse, effectiveConstructor.name); $constructor.$ccache = rti; return rti; }, getTypeFromTypesTable: function(index) { var rti, table = init.types, type = table[index]; if (typeof type == "string") { rti = H._Universe_eval(init.typeUniverse, type, false); table[index] = rti; return rti; } return type; }, _installSpecializedIsTest: function(object) { var t1, unstarred, isFn, testRti = this; if (testRti === type$.Object) return H._finishIsFn(testRti, object, H._isObject); if (!H.isStrongTopType(testRti)) if (!(testRti === type$.legacy_Object)) t1 = false; else t1 = true; else t1 = true; if (t1) return H._finishIsFn(testRti, object, H._isTop); t1 = testRti._kind; unstarred = t1 === 6 ? testRti._primary : testRti; if (unstarred === type$.int) isFn = H._isInt; else if (unstarred === type$.double || unstarred === type$.num) isFn = H._isNum; else if (unstarred === type$.String) isFn = H._isString; else isFn = unstarred === type$.bool ? H._isBool : null; if (isFn != null) return H._finishIsFn(testRti, object, isFn); if (unstarred._kind === 9) { t1 = unstarred._primary; if (unstarred._rest.every(H.isTopType)) { testRti._specializedTestResource = "$is" + t1; return H._finishIsFn(testRti, object, H._isTestViaProperty); } } else if (t1 === 7) return H._finishIsFn(testRti, object, H._generalNullableIsTestImplementation); return H._finishIsFn(testRti, object, H._generalIsTestImplementation); }, _finishIsFn: function(testRti, object, isFn) { testRti._is = isFn; return testRti._is(object); }, _installSpecializedAsCheck: function(object) { var t1, testRti = this, asFn = H._generalAsCheckImplementation; if (!H.isStrongTopType(testRti)) if (!(testRti === type$.legacy_Object)) t1 = false; else t1 = true; else t1 = true; if (t1) asFn = H._asTop; else if (testRti === type$.Object) asFn = H._asObject; else { t1 = H.isNullable(testRti); if (t1) asFn = H._generalNullableAsCheckImplementation; } testRti._as = asFn; return testRti._as(object); }, _nullIs: function(testRti) { var t1, kind = testRti._kind; if (!H.isStrongTopType(testRti)) if (!(testRti === type$.legacy_Object)) if (!(testRti === type$.legacy_Never)) if (kind !== 7) t1 = kind === 8 && H._nullIs(testRti._primary) || testRti === type$.Null || testRti === type$.JSNull; else t1 = true; else t1 = true; else t1 = true; else t1 = true; return t1; }, _generalIsTestImplementation: function(object) { var testRti = this; if (object == null) return H._nullIs(testRti); return H._isSubtype(init.typeUniverse, H.instanceOrFunctionType(object, testRti), null, testRti, null); }, _generalNullableIsTestImplementation: function(object) { if (object == null) return true; return this._primary._is(object); }, _isTestViaProperty: function(object) { var tag, testRti = this; if (object == null) return H._nullIs(testRti); tag = testRti._specializedTestResource; if (object instanceof P.Object) return !!object[tag]; return !!J.getInterceptor$(object)[tag]; }, _generalAsCheckImplementation: function(object) { var t1, testRti = this; if (object == null) { t1 = H.isNullable(testRti); if (t1) return object; } else if (testRti._is(object)) return object; H._failedAsCheck(object, testRti); }, _generalNullableAsCheckImplementation: function(object) { var testRti = this; if (object == null) return object; else if (testRti._is(object)) return object; H._failedAsCheck(object, testRti); }, _failedAsCheck: function(object, testRti) { throw H.wrapException(H._TypeError$fromMessage(H._Error_compose(object, H.instanceOrFunctionType(object, testRti), H._rtiToString(testRti, null)))); }, _Error_compose: function(object, objectRti, checkedTypeDescription) { var objectDescription = P.Error_safeToString(object), objectTypeDescription = H._rtiToString(objectRti == null ? H.instanceType(object) : objectRti, null); return objectDescription + ": type '" + objectTypeDescription + "' is not a subtype of type '" + checkedTypeDescription + "'"; }, _TypeError$fromMessage: function(message) { return new H._TypeError("TypeError: " + message); }, _TypeError__TypeError$forType: function(object, type) { return new H._TypeError("TypeError: " + H._Error_compose(object, null, type)); }, _isObject: function(object) { return object != null; }, _asObject: function(object) { if (object != null) return object; throw H.wrapException(H._TypeError__TypeError$forType(object, "Object")); }, _isTop: function(object) { return true; }, _asTop: function(object) { return object; }, _isBool: function(object) {