g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar define = require('define-data-property');\nvar hasDescriptors = require('has-property-descriptors')();\nvar gOPD = require('gopd');\n\nvar $TypeError = require('es-errors/type');\nvar $floor = GetIntrinsic('%Math.floor%');\n\n/** @type {import('.')} */\nmodule.exports = function setFunctionLength(fn, length) {\n\tif (typeof fn !== 'function') {\n\t\tthrow new $TypeError('`fn` is not a function');\n\t}\n\tif (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {\n\t\tthrow new $TypeError('`length` must be a positive 32-bit integer');\n\t}\n\n\tvar loose = arguments.length > 2 && !!arguments[2];\n\n\tvar functionLengthIsConfigurable = true;\n\tvar functionLengthIsWritable = true;\n\tif ('length' in fn && gOPD) {\n\t\tvar desc = gOPD(fn, 'length');\n\t\tif (desc && !desc.configurable) {\n\t\t\tfunctionLengthIsConfigurable = false;\n\t\t}\n\t\tif (desc && !desc.writable) {\n\t\t\tfunctionLengthIsWritable = false;\n\t\t}\n\t}\n\n\tif (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {\n\t\tif (hasDescriptors) {\n\t\t\tdefine(/** @type {Parameters[0]} */ (fn), 'length', length, true, true);\n\t\t} else {\n\t\t\tdefine(/** @type {Parameters[0]} */ (fn), 'length', length);\n\t\t}\n\t}\n\treturn fn;\n};\n","/*!\n * shallow-clone \n *\n * Copyright (c) 2015-present, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nconst valueOf = Symbol.prototype.valueOf;\nconst typeOf = require('kind-of');\n\nfunction clone(val, deep) {\n switch (typeOf(val)) {\n case 'array':\n return val.slice();\n case 'object':\n return Object.assign({}, val);\n case 'date':\n return new val.constructor(Number(val));\n case 'map':\n return new Map(val);\n case 'set':\n return new Set(val);\n case 'buffer':\n return cloneBuffer(val);\n case 'symbol':\n return cloneSymbol(val);\n case 'arraybuffer':\n return cloneArrayBuffer(val);\n case 'float32array':\n case 'float64array':\n case 'int16array':\n case 'int32array':\n case 'int8array':\n case 'uint16array':\n case 'uint32array':\n case 'uint8clampedarray':\n case 'uint8array':\n return cloneTypedArray(val);\n case 'regexp':\n return cloneRegExp(val);\n case 'error':\n return Object.create(val);\n default: {\n return val;\n }\n }\n}\n\nfunction cloneRegExp(val) {\n const flags = val.flags !== void 0 ? val.flags : (/\\w+$/.exec(val) || void 0);\n const re = new val.constructor(val.source, flags);\n re.lastIndex = val.lastIndex;\n return re;\n}\n\nfunction cloneArrayBuffer(val) {\n const res = new val.constructor(val.byteLength);\n new Uint8Array(res).set(new Uint8Array(val));\n return res;\n}\n\nfunction cloneTypedArray(val, deep) {\n return new val.constructor(val.buffer, val.byteOffset, val.length);\n}\n\nfunction cloneBuffer(val) {\n const len = val.length;\n const buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);\n val.copy(buf);\n return buf;\n}\n\nfunction cloneSymbol(val) {\n return valueOf ? Object(valueOf.call(val)) : {};\n}\n\n/**\n * Expose `clone`\n */\n\nmodule.exports = clone;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\nvar inspect = require('object-inspect');\n\nvar $TypeError = GetIntrinsic('%TypeError%');\nvar $WeakMap = GetIntrinsic('%WeakMap%', true);\nvar $Map = GetIntrinsic('%Map%', true);\n\nvar $weakMapGet = callBound('WeakMap.prototype.get', true);\nvar $weakMapSet = callBound('WeakMap.prototype.set', true);\nvar $weakMapHas = callBound('WeakMap.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSet = callBound('Map.prototype.set', true);\nvar $mapHas = callBound('Map.prototype.has', true);\n\n/*\n * This function traverses the list returning the node corresponding to the\n * given key.\n *\n * That node is also moved to the head of the list, so that if it's accessed\n * again we don't need to traverse the whole list. By doing so, all the recently\n * used nodes can be accessed relatively quickly.\n */\nvar listGetNode = function (list, key) { // eslint-disable-line consistent-return\n\tfor (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {\n\t\tif (curr.key === key) {\n\t\t\tprev.next = curr.next;\n\t\t\tcurr.next = list.next;\n\t\t\tlist.next = curr; // eslint-disable-line no-param-reassign\n\t\t\treturn curr;\n\t\t}\n\t}\n};\n\nvar listGet = function (objects, key) {\n\tvar node = listGetNode(objects, key);\n\treturn node && node.value;\n};\nvar listSet = function (objects, key, value) {\n\tvar node = listGetNode(objects, key);\n\tif (node) {\n\t\tnode.value = value;\n\t} else {\n\t\t// Prepend the new node to the beginning of the list\n\t\tobjects.next = { // eslint-disable-line no-param-reassign\n\t\t\tkey: key,\n\t\t\tnext: objects.next,\n\t\t\tvalue: value\n\t\t};\n\t}\n};\nvar listHas = function (objects, key) {\n\treturn !!listGetNode(objects, key);\n};\n\nmodule.exports = function getSideChannel() {\n\tvar $wm;\n\tvar $m;\n\tvar $o;\n\tvar channel = {\n\t\tassert: function (key) {\n\t\t\tif (!channel.has(key)) {\n\t\t\t\tthrow new $TypeError('Side channel does not contain ' + inspect(key));\n\t\t\t}\n\t\t},\n\t\tget: function (key) { // eslint-disable-line consistent-return\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapGet($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapGet($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listGet($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\thas: function (key) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapHas($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapHas($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listHas($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tset: function (key, value) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif (!$wm) {\n\t\t\t\t\t$wm = new $WeakMap();\n\t\t\t\t}\n\t\t\t\t$weakMapSet($wm, key, value);\n\t\t\t} else if ($Map) {\n\t\t\t\tif (!$m) {\n\t\t\t\t\t$m = new $Map();\n\t\t\t\t}\n\t\t\t\t$mapSet($m, key, value);\n\t\t\t} else {\n\t\t\t\tif (!$o) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Initialize the linked list as an empty node, so that we don't have\n\t\t\t\t\t * to special-case handling of the first node: we can always refer to\n\t\t\t\t\t * it as (previous node).next, instead of something like (list).head\n\t\t\t\t\t */\n\t\t\t\t\t$o = { key: {}, next: null };\n\t\t\t\t}\n\t\t\t\tlistSet($o, key, value);\n\t\t\t}\n\t\t}\n\t};\n\treturn channel;\n};\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/g, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","var hasMap = typeof Map === 'function' && Map.prototype;\nvar mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;\nvar mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;\nvar mapForEach = hasMap && Map.prototype.forEach;\nvar hasSet = typeof Set === 'function' && Set.prototype;\nvar setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;\nvar setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;\nvar setForEach = hasSet && Set.prototype.forEach;\nvar hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;\nvar weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;\nvar hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;\nvar weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;\nvar hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;\nvar weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;\nvar booleanValueOf = Boolean.prototype.valueOf;\nvar objectToString = Object.prototype.toString;\nvar functionToString = Function.prototype.toString;\nvar $match = String.prototype.match;\nvar $slice = String.prototype.slice;\nvar $replace = String.prototype.replace;\nvar $toUpperCase = String.prototype.toUpperCase;\nvar $toLowerCase = String.prototype.toLowerCase;\nvar $test = RegExp.prototype.test;\nvar $concat = Array.prototype.concat;\nvar $join = Array.prototype.join;\nvar $arrSlice = Array.prototype.slice;\nvar $floor = Math.floor;\nvar bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;\nvar gOPS = Object.getOwnPropertySymbols;\nvar symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;\nvar hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';\n// ie, `has-tostringtag/shams\nvar toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')\n ? Symbol.toStringTag\n : null;\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\nvar gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (\n [].__proto__ === Array.prototype // eslint-disable-line no-proto\n ? function (O) {\n return O.__proto__; // eslint-disable-line no-proto\n }\n : null\n);\n\nfunction addNumericSeparator(num, str) {\n if (\n num === Infinity\n || num === -Infinity\n || num !== num\n || (num && num > -1000 && num < 1000)\n || $test.call(/e/, str)\n ) {\n return str;\n }\n var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;\n if (typeof num === 'number') {\n var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)\n if (int !== num) {\n var intStr = String(int);\n var dec = $slice.call(str, intStr.length + 1);\n return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');\n }\n }\n return $replace.call(str, sepRegex, '$&_');\n}\n\nvar utilInspect = require('./util.inspect');\nvar inspectCustom = utilInspect.custom;\nvar inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;\n\nmodule.exports = function inspect_(obj, options, depth, seen) {\n var opts = options || {};\n\n if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {\n throw new TypeError('option \"quoteStyle\" must be \"single\" or \"double\"');\n }\n if (\n has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'\n ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity\n : opts.maxStringLength !== null\n )\n ) {\n throw new TypeError('option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`');\n }\n var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;\n if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {\n throw new TypeError('option \"customInspect\", if provided, must be `true`, `false`, or `\\'symbol\\'`');\n }\n\n if (\n has(opts, 'indent')\n && opts.indent !== null\n && opts.indent !== '\\t'\n && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)\n ) {\n throw new TypeError('option \"indent\" must be \"\\\\t\", an integer > 0, or `null`');\n }\n if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {\n throw new TypeError('option \"numericSeparator\", if provided, must be `true` or `false`');\n }\n var numericSeparator = opts.numericSeparator;\n\n if (typeof obj === 'undefined') {\n return 'undefined';\n }\n if (obj === null) {\n return 'null';\n }\n if (typeof obj === 'boolean') {\n return obj ? 'true' : 'false';\n }\n\n if (typeof obj === 'string') {\n return inspectString(obj, opts);\n }\n if (typeof obj === 'number') {\n if (obj === 0) {\n return Infinity / obj > 0 ? '0' : '-0';\n }\n var str = String(obj);\n return numericSeparator ? addNumericSeparator(obj, str) : str;\n }\n if (typeof obj === 'bigint') {\n var bigIntStr = String(obj) + 'n';\n return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;\n }\n\n var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;\n if (typeof depth === 'undefined') { depth = 0; }\n if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {\n return isArray(obj) ? '[Array]' : '[Object]';\n }\n\n var indent = getIndent(opts, depth);\n\n if (typeof seen === 'undefined') {\n seen = [];\n } else if (indexOf(seen, obj) >= 0) {\n return '[Circular]';\n }\n\n function inspect(value, from, noIndent) {\n if (from) {\n seen = $arrSlice.call(seen);\n seen.push(from);\n }\n if (noIndent) {\n var newOpts = {\n depth: opts.depth\n };\n if (has(opts, 'quoteStyle')) {\n newOpts.quoteStyle = opts.quoteStyle;\n }\n return inspect_(value, newOpts, depth + 1, seen);\n }\n return inspect_(value, opts, depth + 1, seen);\n }\n\n if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable\n var name = nameOf(obj);\n var keys = arrObjKeys(obj, inspect);\n return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');\n }\n if (isSymbol(obj)) {\n var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\\(.*\\))_[^)]*$/, '$1') : symToString.call(obj);\n return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;\n }\n if (isElement(obj)) {\n var s = '<' + $toLowerCase.call(String(obj.nodeName));\n var attrs = obj.attributes || [];\n for (var i = 0; i < attrs.length; i++) {\n s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);\n }\n s += '>';\n if (obj.childNodes && obj.childNodes.length) { s += '...'; }\n s += '' + $toLowerCase.call(String(obj.nodeName)) + '>';\n return s;\n }\n if (isArray(obj)) {\n if (obj.length === 0) { return '[]'; }\n var xs = arrObjKeys(obj, inspect);\n if (indent && !singleLineValues(xs)) {\n return '[' + indentedJoin(xs, indent) + ']';\n }\n return '[ ' + $join.call(xs, ', ') + ' ]';\n }\n if (isError(obj)) {\n var parts = arrObjKeys(obj, inspect);\n if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {\n return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';\n }\n if (parts.length === 0) { return '[' + String(obj) + ']'; }\n return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';\n }\n if (typeof obj === 'object' && customInspect) {\n if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {\n return utilInspect(obj, { depth: maxDepth - depth });\n } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {\n return obj.inspect();\n }\n }\n if (isMap(obj)) {\n var mapParts = [];\n mapForEach.call(obj, function (value, key) {\n mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));\n });\n return collectionOf('Map', mapSize.call(obj), mapParts, indent);\n }\n if (isSet(obj)) {\n var setParts = [];\n setForEach.call(obj, function (value) {\n setParts.push(inspect(value, obj));\n });\n return collectionOf('Set', setSize.call(obj), setParts, indent);\n }\n if (isWeakMap(obj)) {\n return weakCollectionOf('WeakMap');\n }\n if (isWeakSet(obj)) {\n return weakCollectionOf('WeakSet');\n }\n if (isWeakRef(obj)) {\n return weakCollectionOf('WeakRef');\n }\n if (isNumber(obj)) {\n return markBoxed(inspect(Number(obj)));\n }\n if (isBigInt(obj)) {\n return markBoxed(inspect(bigIntValueOf.call(obj)));\n }\n if (isBoolean(obj)) {\n return markBoxed(booleanValueOf.call(obj));\n }\n if (isString(obj)) {\n return markBoxed(inspect(String(obj)));\n }\n if (!isDate(obj) && !isRegExp(obj)) {\n var ys = arrObjKeys(obj, inspect);\n var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;\n var protoTag = obj instanceof Object ? '' : 'null prototype';\n var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';\n var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';\n var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');\n if (ys.length === 0) { return tag + '{}'; }\n if (indent) {\n return tag + '{' + indentedJoin(ys, indent) + '}';\n }\n return tag + '{ ' + $join.call(ys, ', ') + ' }';\n }\n return String(obj);\n};\n\nfunction wrapQuotes(s, defaultStyle, opts) {\n var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '\"' : \"'\";\n return quoteChar + s + quoteChar;\n}\n\nfunction quote(s) {\n return $replace.call(String(s), /\"/g, '"');\n}\n\nfunction isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\n\n// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives\nfunction isSymbol(obj) {\n if (hasShammedSymbols) {\n return obj && typeof obj === 'object' && obj instanceof Symbol;\n }\n if (typeof obj === 'symbol') {\n return true;\n }\n if (!obj || typeof obj !== 'object' || !symToString) {\n return false;\n }\n try {\n symToString.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isBigInt(obj) {\n if (!obj || typeof obj !== 'object' || !bigIntValueOf) {\n return false;\n }\n try {\n bigIntValueOf.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };\nfunction has(obj, key) {\n return hasOwn.call(obj, key);\n}\n\nfunction toStr(obj) {\n return objectToString.call(obj);\n}\n\nfunction nameOf(f) {\n if (f.name) { return f.name; }\n var m = $match.call(functionToString.call(f), /^function\\s*([\\w$]+)/);\n if (m) { return m[1]; }\n return null;\n}\n\nfunction indexOf(xs, x) {\n if (xs.indexOf) { return xs.indexOf(x); }\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) { return i; }\n }\n return -1;\n}\n\nfunction isMap(x) {\n if (!mapSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n mapSize.call(x);\n try {\n setSize.call(x);\n } catch (s) {\n return true;\n }\n return x instanceof Map; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakMap(x) {\n if (!weakMapHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakMapHas.call(x, weakMapHas);\n try {\n weakSetHas.call(x, weakSetHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakMap; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakRef(x) {\n if (!weakRefDeref || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakRefDeref.call(x);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isSet(x) {\n if (!setSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n setSize.call(x);\n try {\n mapSize.call(x);\n } catch (m) {\n return true;\n }\n return x instanceof Set; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakSet(x) {\n if (!weakSetHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakSetHas.call(x, weakSetHas);\n try {\n weakMapHas.call(x, weakMapHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakSet; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isElement(x) {\n if (!x || typeof x !== 'object') { return false; }\n if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {\n return true;\n }\n return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';\n}\n\nfunction inspectString(str, opts) {\n if (str.length > opts.maxStringLength) {\n var remaining = str.length - opts.maxStringLength;\n var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');\n return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;\n }\n // eslint-disable-next-line no-control-regex\n var s = $replace.call($replace.call(str, /(['\\\\])/g, '\\\\$1'), /[\\x00-\\x1f]/g, lowbyte);\n return wrapQuotes(s, 'single', opts);\n}\n\nfunction lowbyte(c) {\n var n = c.charCodeAt(0);\n var x = {\n 8: 'b',\n 9: 't',\n 10: 'n',\n 12: 'f',\n 13: 'r'\n }[n];\n if (x) { return '\\\\' + x; }\n return '\\\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));\n}\n\nfunction markBoxed(str) {\n return 'Object(' + str + ')';\n}\n\nfunction weakCollectionOf(type) {\n return type + ' { ? }';\n}\n\nfunction collectionOf(type, size, entries, indent) {\n var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');\n return type + ' (' + size + ') {' + joinedEntries + '}';\n}\n\nfunction singleLineValues(xs) {\n for (var i = 0; i < xs.length; i++) {\n if (indexOf(xs[i], '\\n') >= 0) {\n return false;\n }\n }\n return true;\n}\n\nfunction getIndent(opts, depth) {\n var baseIndent;\n if (opts.indent === '\\t') {\n baseIndent = '\\t';\n } else if (typeof opts.indent === 'number' && opts.indent > 0) {\n baseIndent = $join.call(Array(opts.indent + 1), ' ');\n } else {\n return null;\n }\n return {\n base: baseIndent,\n prev: $join.call(Array(depth + 1), baseIndent)\n };\n}\n\nfunction indentedJoin(xs, indent) {\n if (xs.length === 0) { return ''; }\n var lineJoiner = '\\n' + indent.prev + indent.base;\n return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\\n' + indent.prev;\n}\n\nfunction arrObjKeys(obj, inspect) {\n var isArr = isArray(obj);\n var xs = [];\n if (isArr) {\n xs.length = obj.length;\n for (var i = 0; i < obj.length; i++) {\n xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';\n }\n }\n var syms = typeof gOPS === 'function' ? gOPS(obj) : [];\n var symMap;\n if (hasShammedSymbols) {\n symMap = {};\n for (var k = 0; k < syms.length; k++) {\n symMap['$' + syms[k]] = syms[k];\n }\n }\n\n for (var key in obj) { // eslint-disable-line no-restricted-syntax\n if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {\n // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section\n continue; // eslint-disable-line no-restricted-syntax, no-continue\n } else if ($test.call(/[^\\w$]/, key)) {\n xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));\n } else {\n xs.push(key + ': ' + inspect(obj[key], obj));\n }\n }\n if (typeof gOPS === 'function') {\n for (var j = 0; j < syms.length; j++) {\n if (isEnumerable.call(obj, syms[j])) {\n xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));\n }\n }\n }\n return xs;\n}\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // “sources” entry. This value is prepended to the individual\n // entries in the “source” field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // “sourceRoot”, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n","(function (factory) {\n if (typeof exports === 'object') {\n // Node/CommonJS\n module.exports = factory();\n } else if (typeof define === 'function' && define.amd) {\n // AMD\n define(factory);\n } else {\n // Browser globals (with support for web workers)\n var glob;\n\n try {\n glob = window;\n } catch (e) {\n glob = self;\n }\n\n glob.SparkMD5 = factory();\n }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash.slice()\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} [raw] True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} [raw] True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} [raw] True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n","/*\nStimulus 3.2.1\nCopyright © 2023 Basecamp, LLC\n */\nclass EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n }\n else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n hasBindings() {\n return this.unorderedBindings.size > 0;\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index, rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n}\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n }\n else {\n const { stopImmediatePropagation } = event;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n },\n });\n }\n}\n\nclass Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach((eventListener) => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach((eventListener) => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding, clearEventListeners = false) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n if (clearEventListeners)\n this.clearEventListenersForBinding(binding);\n }\n handleError(error, message, detail = {}) {\n this.application.handleError(error, `Error ${message}`, detail);\n }\n clearEventListenersForBinding(binding) {\n const eventListener = this.fetchEventListenerForBinding(binding);\n if (!eventListener.hasBindings()) {\n eventListener.disconnect();\n this.removeMappedEventListenerFor(binding);\n }\n }\n removeMappedEventListenerFor(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n eventListenerMap.delete(cacheKey);\n if (eventListenerMap.size == 0)\n this.eventListenerMaps.delete(eventTarget);\n }\n fetchEventListenerForBinding(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions)\n .sort()\n .forEach((key) => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n}\n\nconst defaultActionDescriptorFilters = {\n stop({ event, value }) {\n if (value)\n event.stopPropagation();\n return true;\n },\n prevent({ event, value }) {\n if (value)\n event.preventDefault();\n return true;\n },\n self({ event, value, element }) {\n if (value) {\n return element === event.target;\n }\n else {\n return true;\n }\n },\n};\nconst descriptorPattern = /^(?:(?:([^.]+?)\\+)?(.+?)(?:\\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;\nfunction parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n let eventName = matches[2];\n let keyFilter = matches[3];\n if (keyFilter && ![\"keydown\", \"keyup\", \"keypress\"].includes(eventName)) {\n eventName += `.${keyFilter}`;\n keyFilter = \"\";\n }\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName,\n eventOptions: matches[7] ? parseEventOptions(matches[7]) : {},\n identifier: matches[5],\n methodName: matches[6],\n keyFilter: matches[1] || keyFilter,\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n }\n else if (eventTargetName == \"document\") {\n return document;\n }\n}\nfunction parseEventOptions(eventOptions) {\n return eventOptions\n .split(\":\")\n .reduce((options, token) => Object.assign(options, { [token.replace(/^!/, \"\")]: !/^!/.test(token) }), {});\n}\nfunction stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n }\n else if (eventTarget == document) {\n return \"document\";\n }\n}\n\nfunction camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction namespaceCamelize(value) {\n return camelize(value.replace(/--/g, \"-\").replace(/__/g, \"_\"));\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n}\n\nfunction isSomething(object) {\n return object !== null && object !== undefined;\n}\nfunction hasProperty(object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n}\n\nconst allModifiers = [\"meta\", \"ctrl\", \"alt\", \"shift\"];\nclass Action {\n constructor(element, index, descriptor, schema) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n this.keyFilter = descriptor.keyFilter || \"\";\n this.schema = schema;\n }\n static forToken(token, schema) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content), schema);\n }\n toString() {\n const eventFilter = this.keyFilter ? `.${this.keyFilter}` : \"\";\n const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`;\n }\n shouldIgnoreKeyboardEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = this.keyFilter.split(\"+\");\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n const standardFilter = filters.filter((key) => !allModifiers.includes(key))[0];\n if (!standardFilter) {\n return false;\n }\n if (!hasProperty(this.keyMappings, standardFilter)) {\n error(`contains unknown key filter: ${this.keyFilter}`);\n }\n return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase();\n }\n shouldIgnoreMouseEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = [this.keyFilter];\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n return false;\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, \"i\");\n for (const { name, value } of Array.from(this.element.attributes)) {\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n get keyMappings() {\n return this.schema.keyMappings;\n }\n keyFilterDissatisfied(event, filters) {\n const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier));\n return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift;\n }\n}\nconst defaultEventNames = {\n a: () => \"click\",\n button: () => \"click\",\n form: () => \"submit\",\n details: () => \"toggle\",\n input: (e) => (e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\"),\n select: () => \"change\",\n textarea: () => \"input\",\n};\nfunction getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}\nfunction typecast(value) {\n try {\n return JSON.parse(value);\n }\n catch (o_O) {\n return value;\n }\n}\n\nclass Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n const actionEvent = this.prepareActionEvent(event);\n if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) {\n this.invokeWithEvent(actionEvent);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n applyEventModifiers(event) {\n const { element } = this.action;\n const { actionDescriptorFilters } = this.context.application;\n const { controller } = this.context;\n let passes = true;\n for (const [name, value] of Object.entries(this.eventOptions)) {\n if (name in actionDescriptorFilters) {\n const filter = actionDescriptorFilters[name];\n passes = passes && filter({ name, value, event, element, controller });\n }\n else {\n continue;\n }\n }\n return passes;\n }\n prepareActionEvent(event) {\n return Object.assign(event, { params: this.action.params });\n }\n invokeWithEvent(event) {\n const { target, currentTarget } = event;\n try {\n this.method.call(this.controller, event);\n this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName });\n }\n catch (error) {\n const { identifier, controller, element, index } = this;\n const detail = { identifier, controller, element, index, event };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) {\n return false;\n }\n if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) {\n return false;\n }\n if (this.element === eventTarget) {\n return true;\n }\n else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n }\n else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nclass ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = { attributes: true, childList: true, subtree: true };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n }\n else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(element, attributeName) {\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n }\n else {\n this.removeElement(element);\n }\n }\n else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree(tree = this.element) {\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n }\n else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n}\n\nclass AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n}\n\nfunction add(map, key, value) {\n fetch(map, key).add(value);\n}\nfunction del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nfunction fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nfunction prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}\n\nclass Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some((set) => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey)\n .filter(([_key, values]) => values.has(value))\n .map(([key, _values]) => key);\n }\n}\n\nclass IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map();\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n}\n\nclass SelectorObserver {\n constructor(element, selector, delegate, details) {\n this._selector = selector;\n this.details = details;\n this.elementObserver = new ElementObserver(element, this);\n this.delegate = delegate;\n this.matchesByElement = new Multimap();\n }\n get started() {\n return this.elementObserver.started;\n }\n get selector() {\n return this._selector;\n }\n set selector(selector) {\n this._selector = selector;\n this.refresh();\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get element() {\n return this.elementObserver.element;\n }\n matchElement(element) {\n const { selector } = this;\n if (selector) {\n const matches = element.matches(selector);\n if (this.delegate.selectorMatchElement) {\n return matches && this.delegate.selectorMatchElement(element, this.details);\n }\n return matches;\n }\n else {\n return false;\n }\n }\n matchElementsInTree(tree) {\n const { selector } = this;\n if (selector) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(selector)).filter((match) => this.matchElement(match));\n return match.concat(matches);\n }\n else {\n return [];\n }\n }\n elementMatched(element) {\n const { selector } = this;\n if (selector) {\n this.selectorMatched(element, selector);\n }\n }\n elementUnmatched(element) {\n const selectors = this.matchesByElement.getKeysForValue(element);\n for (const selector of selectors) {\n this.selectorUnmatched(element, selector);\n }\n }\n elementAttributeChanged(element, _attributeName) {\n const { selector } = this;\n if (selector) {\n const matches = this.matchElement(element);\n const matchedBefore = this.matchesByElement.has(selector, element);\n if (matches && !matchedBefore) {\n this.selectorMatched(element, selector);\n }\n else if (!matches && matchedBefore) {\n this.selectorUnmatched(element, selector);\n }\n }\n }\n selectorMatched(element, selector) {\n this.delegate.selectorMatched(element, selector, this.details);\n this.matchesByElement.add(selector, element);\n }\n selectorUnmatched(element, selector) {\n this.delegate.selectorUnmatched(element, selector, this.details);\n this.matchesByElement.delete(selector, element);\n }\n}\n\nclass StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue)\n this.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map((attribute) => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n}\n\nclass TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element);\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach((token) => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach((token) => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken));\n if (firstDifferingIndex == -1) {\n return [[], []];\n }\n else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n}\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString\n .trim()\n .split(/\\s+/)\n .filter((content) => content.length)\n .map((content, index) => ({ element, attributeName, content, index }));\n}\nfunction zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({ length }, (_, index) => [left[index], right[index]]);\n}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}\n\nclass ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return { value };\n }\n catch (error) {\n return { error };\n }\n }\n}\n\nclass BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token, this.schema);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n}\n\nclass ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null)\n return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n }\n else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const { key, name, defaultValue, writer } of this.valueDescriptors) {\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n }\n catch (error) {\n if (error instanceof TypeError) {\n error.message = `Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`;\n }\n throw error;\n }\n }\n }\n get valueDescriptors() {\n const { valueDescriptorMap } = this;\n return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach((key) => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n}\n\nclass TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap();\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched({ element, content: name }) {\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched({ element, content: name }) {\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach((name) => values.add(name));\n return values;\n }, new Set()));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : [];\n}\n\nclass OutletObserver {\n constructor(context, delegate) {\n this.started = false;\n this.context = context;\n this.delegate = delegate;\n this.outletsByName = new Multimap();\n this.outletElementsByName = new Multimap();\n this.selectorObserverMap = new Map();\n this.attributeObserverMap = new Map();\n }\n start() {\n if (!this.started) {\n this.outletDefinitions.forEach((outletName) => {\n this.setupSelectorObserverForOutlet(outletName);\n this.setupAttributeObserverForOutlet(outletName);\n });\n this.started = true;\n this.dependentContexts.forEach((context) => context.refresh());\n }\n }\n refresh() {\n this.selectorObserverMap.forEach((observer) => observer.refresh());\n this.attributeObserverMap.forEach((observer) => observer.refresh());\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.disconnectAllOutlets();\n this.stopSelectorObservers();\n this.stopAttributeObservers();\n }\n }\n stopSelectorObservers() {\n if (this.selectorObserverMap.size > 0) {\n this.selectorObserverMap.forEach((observer) => observer.stop());\n this.selectorObserverMap.clear();\n }\n }\n stopAttributeObservers() {\n if (this.attributeObserverMap.size > 0) {\n this.attributeObserverMap.forEach((observer) => observer.stop());\n this.attributeObserverMap.clear();\n }\n }\n selectorMatched(element, _selector, { outletName }) {\n const outlet = this.getOutlet(element, outletName);\n if (outlet) {\n this.connectOutlet(outlet, element, outletName);\n }\n }\n selectorUnmatched(element, _selector, { outletName }) {\n const outlet = this.getOutletFromMap(element, outletName);\n if (outlet) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n selectorMatchElement(element, { outletName }) {\n const selector = this.selector(outletName);\n const hasOutlet = this.hasOutlet(element, outletName);\n const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`);\n if (selector) {\n return hasOutlet && hasOutletController && element.matches(selector);\n }\n else {\n return false;\n }\n }\n elementMatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementAttributeValueChanged(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementUnmatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n connectOutlet(outlet, element, outletName) {\n var _a;\n if (!this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.add(outletName, outlet);\n this.outletElementsByName.add(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName));\n }\n }\n disconnectOutlet(outlet, element, outletName) {\n var _a;\n if (this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.delete(outletName, outlet);\n this.outletElementsByName.delete(outletName, element);\n (_a = this.selectorObserverMap\n .get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName));\n }\n }\n disconnectAllOutlets() {\n for (const outletName of this.outletElementsByName.keys) {\n for (const element of this.outletElementsByName.getValuesForKey(outletName)) {\n for (const outlet of this.outletsByName.getValuesForKey(outletName)) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n }\n }\n updateSelectorObserverForOutlet(outletName) {\n const observer = this.selectorObserverMap.get(outletName);\n if (observer) {\n observer.selector = this.selector(outletName);\n }\n }\n setupSelectorObserverForOutlet(outletName) {\n const selector = this.selector(outletName);\n const selectorObserver = new SelectorObserver(document.body, selector, this, { outletName });\n this.selectorObserverMap.set(outletName, selectorObserver);\n selectorObserver.start();\n }\n setupAttributeObserverForOutlet(outletName) {\n const attributeName = this.attributeNameForOutletName(outletName);\n const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this);\n this.attributeObserverMap.set(outletName, attributeObserver);\n attributeObserver.start();\n }\n selector(outletName) {\n return this.scope.outlets.getSelectorForOutletName(outletName);\n }\n attributeNameForOutletName(outletName) {\n return this.scope.schema.outletAttributeForScope(this.identifier, outletName);\n }\n getOutletNameFromOutletAttributeName(attributeName) {\n return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName);\n }\n get outletDependencies() {\n const dependencies = new Multimap();\n this.router.modules.forEach((module) => {\n const constructor = module.definition.controllerConstructor;\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n outlets.forEach((outlet) => dependencies.add(outlet, module.identifier));\n });\n return dependencies;\n }\n get outletDefinitions() {\n return this.outletDependencies.getKeysForValue(this.identifier);\n }\n get dependentControllerIdentifiers() {\n return this.outletDependencies.getValuesForKey(this.identifier);\n }\n get dependentContexts() {\n const identifiers = this.dependentControllerIdentifiers;\n return this.router.contexts.filter((context) => identifiers.includes(context.identifier));\n }\n hasOutlet(element, outletName) {\n return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName);\n }\n getOutlet(element, outletName) {\n return this.application.getControllerForElementAndIdentifier(element, outletName);\n }\n getOutletFromMap(element, outletName) {\n return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element);\n }\n get scope() {\n return this.context.scope;\n }\n get schema() {\n return this.context.schema;\n }\n get identifier() {\n return this.context.identifier;\n }\n get application() {\n return this.context.application;\n }\n get router() {\n return this.application.router;\n }\n}\n\nclass Context {\n constructor(module, scope) {\n this.logDebugActivity = (functionName, detail = {}) => {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.logDebugActivity(this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n this.outletObserver = new OutletObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n }\n catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n this.outletObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n }\n catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n refresh() {\n this.outletObserver.refresh();\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n }\n catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.outletObserver.stop();\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message, detail = {}) {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n outletConnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element);\n }\n outletDisconnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element);\n }\n invokeControllerMethod(methodName, ...args) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n controller[methodName](...args);\n }\n }\n}\n\nfunction bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\nfunction shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\nfunction getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n}\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, { [key]: descriptor });\n }\n return shadowProperties;\n }, {});\n}\nfunction getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n}\nconst getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];\n }\n else {\n return Object.getOwnPropertyNames;\n }\n})();\nconst extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: { value: extended },\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function () { };\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n }\n catch (error) {\n return (constructor) => class extended extends constructor {\n };\n }\n})();\n\nfunction blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor),\n };\n}\n\nclass Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n}\n\nclass ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n}\n\nclass DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n }\n else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n}\n\nclass Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n}\n\nfunction attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n}\n\nclass TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find(...targetNames) {\n return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined);\n }\n findAll(...targetNames) {\n return targetNames.reduce((targets, targetName) => [\n ...targets,\n ...this.findAllTargets(targetName),\n ...this.findAllLegacyTargets(targetName),\n ], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const { identifier } = this;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` +\n `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n}\n\nclass OutletSet {\n constructor(scope, controllerElement) {\n this.scope = scope;\n this.controllerElement = controllerElement;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(outletName) {\n return this.find(outletName) != null;\n }\n find(...outletNames) {\n return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined);\n }\n findAll(...outletNames) {\n return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []);\n }\n getSelectorForOutletName(outletName) {\n const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName);\n return this.controllerElement.getAttribute(attributeName);\n }\n findOutlet(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n if (selector)\n return this.findElement(selector, outletName);\n }\n findAllOutlets(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n return selector ? this.findAllElements(selector, outletName) : [];\n }\n findElement(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName))[0];\n }\n findAllElements(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName));\n }\n matchesElement(element, selector, outletName) {\n const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || \"\";\n return element.matches(selector) && controllerAttribute.split(\" \").includes(outletName);\n }\n}\n\nclass Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = (element) => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n this.outlets = new OutletSet(this.documentScope, element);\n }\n findElement(selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [\n ...(this.element.matches(selector) ? [this.element] : []),\n ...this.queryElements(selector).filter(this.containsElement),\n ];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n get isDocumentScope() {\n return this.element === document.documentElement;\n }\n get documentScope() {\n return this.isDocumentScope\n ? this\n : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger);\n }\n}\n\nclass ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const { element, content: identifier } = token;\n return this.parseValueForElementAndIdentifier(element, identifier);\n }\n parseValueForElementAndIdentifier(element, identifier) {\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n}\n\nclass Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n const afterLoad = definition.controllerConstructor.afterLoad;\n if (afterLoad) {\n afterLoad.call(definition.controllerConstructor, definition.identifier, this.application);\n }\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find((context) => context.element == element);\n }\n }\n proposeToConnectScopeForElementAndIdentifier(element, identifier) {\n const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier);\n if (scope) {\n this.scopeObserver.elementMatchedValue(scope.element, scope);\n }\n else {\n console.error(`Couldn't find or create scope for identifier: \"${identifier}\" and element:`, element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.disconnectContextForScope(scope));\n }\n}\n\nconst defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: (identifier) => `data-${identifier}-target`,\n outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`,\n keyMappings: Object.assign(Object.assign({ enter: \"Enter\", tab: \"Tab\", esc: \"Escape\", space: \" \", up: \"ArrowUp\", down: \"ArrowDown\", left: \"ArrowLeft\", right: \"ArrowRight\", home: \"Home\", end: \"End\", page_up: \"PageUp\", page_down: \"PageDown\" }, objectFromEntries(\"abcdefghijklmnopqrstuvwxyz\".split(\"\").map((c) => [c, c]))), objectFromEntries(\"0123456789\".split(\"\").map((n) => [n, n]))),\n};\nfunction objectFromEntries(array) {\n return array.reduce((memo, [k, v]) => (Object.assign(Object.assign({}, memo), { [k]: v })), {});\n}\n\nclass Application {\n constructor(element = document.documentElement, schema = defaultSchema) {\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = (identifier, functionName, detail = {}) => {\n if (this.debug) {\n this.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters);\n }\n static start(element, schema) {\n const application = new this(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({ identifier, controllerConstructor });\n }\n registerActionOption(name, filter) {\n this.actionDescriptorFilters[name] = filter;\n }\n load(head, ...rest) {\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach((definition) => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head, ...rest) {\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map((context) => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName, detail = {}) {\n detail = Object.assign({ application: this }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n}\nfunction domReady() {\n return new Promise((resolve) => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n }\n else {\n resolve();\n }\n });\n}\n\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const { classes } = this;\n if (classes.has(key)) {\n return classes.get(key);\n }\n else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n },\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n },\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n },\n },\n };\n}\n\nfunction OutletPropertiesBlessing(constructor) {\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n return outlets.reduce((properties, outletDefinition) => {\n return Object.assign(properties, propertiesForOutletDefinition(outletDefinition));\n }, {});\n}\nfunction getOutletController(controller, element, identifier) {\n return controller.application.getControllerForElementAndIdentifier(element, identifier);\n}\nfunction getControllerAndEnsureConnectedScope(controller, element, outletName) {\n let outletController = getOutletController(controller, element, outletName);\n if (outletController)\n return outletController;\n controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName);\n outletController = getOutletController(controller, element, outletName);\n if (outletController)\n return outletController;\n}\nfunction propertiesForOutletDefinition(name) {\n const camelizedName = namespaceCamelize(name);\n return {\n [`${camelizedName}Outlet`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController)\n return outletController;\n throw new Error(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`);\n }\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n },\n },\n [`${camelizedName}Outlets`]: {\n get() {\n const outlets = this.outlets.findAll(name);\n if (outlets.length > 0) {\n return outlets\n .map((outletElement) => {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController)\n return outletController;\n console.warn(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`, outletElement);\n })\n .filter((controller) => controller);\n }\n return [];\n },\n },\n [`${camelizedName}OutletElement`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n return outletElement;\n }\n else {\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n },\n },\n [`${camelizedName}OutletElements`]: {\n get() {\n return this.outlets.findAll(name);\n },\n },\n [`has${capitalize(camelizedName)}Outlet`]: {\n get() {\n return this.outlets.has(name);\n },\n },\n };\n}\n\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n }\n else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n },\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n },\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n },\n },\n };\n}\n\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, { [attributeName]: valueDescriptor });\n }, {});\n },\n },\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const { key, name, reader: read, writer: write } = definition;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n }\n else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n }\n else {\n this.data.set(key, write(value));\n }\n },\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n },\n },\n };\n}\nfunction parseValueDefinitionPair([token, typeDefinition], controller) {\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition,\n });\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue))\n return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\")\n return \"object\";\n}\nfunction parseValueTypeObject(payload) {\n const { controller, token, typeObject } = payload;\n const hasType = isSomething(typeObject.type);\n const hasDefault = isSomething(typeObject.default);\n const fullObject = hasType && hasDefault;\n const onlyType = hasType && !hasDefault;\n const onlyDefault = !hasType && hasDefault;\n const typeFromObject = parseValueTypeConstant(typeObject.type);\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default);\n if (onlyType)\n return typeFromObject;\n if (onlyDefault)\n return typeFromDefaultValue;\n if (typeFromObject !== typeFromDefaultValue) {\n const propertyPath = controller ? `${controller}.${token}` : token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${typeObject.default}\" is of type \"${typeFromDefaultValue}\".`);\n }\n if (fullObject)\n return typeFromObject;\n}\nfunction parseValueTypeDefinition(payload) {\n const { controller, token, typeDefinition } = payload;\n const typeObject = { controller, token, typeObject: typeDefinition };\n const typeFromObject = parseValueTypeObject(typeObject);\n const typeFromDefaultValue = parseValueTypeDefault(typeDefinition);\n const typeFromConstant = parseValueTypeConstant(typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type)\n return type;\n const propertyPath = controller ? `${controller}.${typeDefinition}` : token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${token}\" value`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant)\n return defaultValuesByType[constant];\n const hasDefault = hasProperty(typeDefinition, \"default\");\n const hasType = hasProperty(typeDefinition, \"type\");\n const typeObject = typeDefinition;\n if (hasDefault)\n return typeObject.default;\n if (hasType) {\n const { type } = typeObject;\n const constantFromType = parseValueTypeConstant(type);\n if (constantFromType)\n return defaultValuesByType[constantFromType];\n }\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(payload) {\n const { token, typeDefinition } = payload;\n const key = `${dasherize(token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(typeDefinition) !== undefined;\n },\n reader: readers[type],\n writer: writers[type] || writers.default,\n };\n}\nconst defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\",\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value.replace(/_/g, \"\"));\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n },\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\n\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n static afterLoad(_identifier, _application) {\n return;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get outlets() {\n return this.scope.outlets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {\n }\n connect() {\n }\n disconnect() {\n }\n dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true, } = {}) {\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, { detail, bubbles, cancelable });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [\n ClassPropertiesBlessing,\n TargetPropertiesBlessing,\n ValuePropertiesBlessing,\n OutletPropertiesBlessing,\n];\nController.targets = [];\nController.outlets = [];\nController.values = {};\n\nexport { Application, AttributeObserver, Context, Controller, ElementObserver, IndexedMultimap, Multimap, SelectorObserver, StringMapObserver, TokenListObserver, ValueListObserver, add, defaultSchema, del, fetch, prune };\n","/*\nStimulus Webpack Helpers 1.0.0\nCopyright © 2021 Basecamp, LLC\n */\nfunction definitionsFromContext(context) {\n return context.keys()\n .map((key) => definitionForModuleWithContextAndKey(context, key))\n .filter((value) => value);\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n const identifier = identifierForContextKey(key);\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n const controllerConstructor = module.default;\n if (typeof controllerConstructor == \"function\") {\n return { identifier, controllerConstructor };\n }\n}\nfunction identifierForContextKey(key) {\n const logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}\n\nexport { definitionForModuleAndIdentifier, definitionForModuleWithContextAndKey, definitionsFromContext, identifierForContextKey };\n","//\n// strftime\n// github.com/samsonjs/strftime\n// @_sjs\n//\n// Copyright 2010 - 2021 Sami Samhuri \n//\n// MIT License\n// http://sjs.mit-license.org\n//\n\n;(function() {\n\n var Locales = {\n de_DE: {\n identifier: 'de-DE',\n days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],\n shortDays: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],\n months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],\n shortMonths: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d.%m.%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n en_CA: {\n identifier: 'en-CA',\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],\n shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n ordinalSuffixes: [\n 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'st'\n ],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d/%m/%y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%r',\n x: '%D'\n }\n },\n\n en_US: {\n identifier: 'en-US',\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],\n shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n ordinalSuffixes: [\n 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th',\n 'st'\n ],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%m/%d/%y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%r',\n x: '%D'\n }\n },\n\n es_MX: {\n identifier: 'es-MX',\n days: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],\n shortDays: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],\n months: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre',' diciembre'],\n shortMonths: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d/%m/%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n fr_FR: {\n identifier: 'fr-FR',\n days: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],\n shortDays: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],\n months: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],\n shortMonths: ['janv.', 'févr.', 'mars', 'avril', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d/%m/%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n it_IT: {\n identifier: 'it-IT',\n days: ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'],\n shortDays: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],\n months: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],\n shortMonths: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d/%m/%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n nl_NL: {\n identifier: 'nl-NL',\n days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],\n shortDays: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],\n months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],\n shortMonths: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d-%m-%y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n pt_BR: {\n identifier: 'pt-BR',\n days: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],\n shortDays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],\n months: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],\n shortMonths: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d-%m-%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n ru_RU: {\n identifier: 'ru-RU',\n days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],\n shortDays: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],\n months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],\n shortMonths: ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'],\n AM: 'AM',\n PM: 'PM',\n am: 'am',\n pm: 'pm',\n formats: {\n c: '%a %d %b %Y %X',\n D: '%d.%m.%y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n tr_TR: {\n identifier: 'tr-TR',\n days: ['Pazar', 'Pazartesi', 'Salı','Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],\n shortDays: ['Paz', 'Pzt', 'Sal', 'Çrş', 'Prş', 'Cum', 'Cts'],\n months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],\n shortMonths: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],\n AM: 'ÖÖ',\n PM: 'ÖS',\n am: 'ÖÖ',\n pm: 'ÖS',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d-%m-%Y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%T',\n x: '%D'\n }\n },\n\n // By michaeljayt\n // https://github.com/michaeljayt/strftime/commit/bcb4c12743811d51e568175aa7bff3fd2a77cef3\n zh_CN: {\n identifier: 'zh-CN',\n days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],\n shortDays: ['日', '一', '二', '三', '四', '五', '六'],\n months: ['一月份', '二月份', '三月份', '四月份', '五月份', '六月份', '七月份', '八月份', '九月份', '十月份', '十一月份', '十二月份'],\n shortMonths: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],\n AM: '上午',\n PM: '下午',\n am: '上午',\n pm: '下午',\n formats: {\n c: '%a %d %b %Y %X %Z',\n D: '%d/%m/%y',\n F: '%Y-%m-%d',\n R: '%H:%M',\n r: '%I:%M:%S %p',\n T: '%H:%M:%S',\n v: '%e-%b-%Y',\n X: '%r',\n x: '%D'\n }\n }\n };\n\n var DefaultLocale = Locales['en_US'],\n defaultStrftime = new Strftime(DefaultLocale, 0, false),\n isCommonJS = typeof module !== 'undefined',\n namespace;\n\n // CommonJS / Node module\n if (isCommonJS) {\n namespace = module.exports = defaultStrftime;\n }\n // Browsers and other environments\n else {\n // Get the global object. Works in ES3, ES5, and ES5 strict mode.\n namespace = (function() { return this || (1,eval)('this'); }());\n namespace.strftime = defaultStrftime;\n }\n\n // Polyfill Date.now for old browsers.\n if (typeof Date.now !== 'function') {\n Date.now = function() {\n return +new Date();\n };\n }\n\n function Strftime(locale, customTimezoneOffset, useUtcTimezone) {\n var _locale = locale || DefaultLocale,\n _customTimezoneOffset = customTimezoneOffset || 0,\n _useUtcBasedDate = useUtcTimezone || false,\n\n // we store unix timestamp value here to not create new Date() each iteration (each millisecond)\n // Date.now() is 2 times faster than new Date()\n // while millisecond precise is enough here\n // this could be very helpful when strftime triggered a lot of times one by one\n _cachedDateTimestamp = 0,\n _cachedDate;\n\n function _strftime(format, date) {\n var timestamp;\n\n if (!date) {\n var currentTimestamp = Date.now();\n if (currentTimestamp > _cachedDateTimestamp) {\n _cachedDateTimestamp = currentTimestamp;\n _cachedDate = new Date(_cachedDateTimestamp);\n\n timestamp = _cachedDateTimestamp;\n\n if (_useUtcBasedDate) {\n // how to avoid duplication of date instantiation for utc here?\n // we tied to getTimezoneOffset of the current date\n _cachedDate = new Date(_cachedDateTimestamp + getTimestampToUtcOffsetFor(_cachedDate) + _customTimezoneOffset);\n }\n }\n else {\n timestamp = _cachedDateTimestamp;\n }\n date = _cachedDate;\n }\n else {\n timestamp = date.getTime();\n\n if (_useUtcBasedDate) {\n var utcOffset = getTimestampToUtcOffsetFor(date);\n date = new Date(timestamp + utcOffset + _customTimezoneOffset);\n // If we've crossed a DST boundary with this calculation we need to\n // adjust the new date accordingly or it will be off by an hour in UTC.\n if (getTimestampToUtcOffsetFor(date) !== utcOffset) {\n var newUTCOffset = getTimestampToUtcOffsetFor(date);\n date = new Date(timestamp + newUTCOffset + _customTimezoneOffset);\n }\n }\n }\n\n return _processFormat(format, date, _locale, timestamp);\n }\n\n function _processFormat(format, date, locale, timestamp) {\n var resultString = '',\n padding = null,\n isInScope = false,\n length = format.length,\n extendedTZ = false;\n\n for (var i = 0; i < length; i++) {\n\n var currentCharCode = format.charCodeAt(i);\n\n if (isInScope === true) {\n // '-'\n if (currentCharCode === 45) {\n padding = '';\n continue;\n }\n // '_'\n else if (currentCharCode === 95) {\n padding = ' ';\n continue;\n }\n // '0'\n else if (currentCharCode === 48) {\n padding = '0';\n continue;\n }\n // ':'\n else if (currentCharCode === 58) {\n if (extendedTZ) {\n warn(\"[WARNING] detected use of unsupported %:: or %::: modifiers to strftime\");\n }\n extendedTZ = true;\n continue;\n }\n\n switch (currentCharCode) {\n\n // Examples for new Date(0) in GMT\n\n // '%'\n // case '%':\n case 37:\n resultString += '%';\n break;\n\n // 'Thursday'\n // case 'A':\n case 65:\n resultString += locale.days[date.getDay()];\n break;\n\n // 'January'\n // case 'B':\n case 66:\n resultString += locale.months[date.getMonth()];\n break;\n\n // '19'\n // case 'C':\n case 67:\n resultString += padTill2(Math.floor(date.getFullYear() / 100), padding);\n break;\n\n // '01/01/70'\n // case 'D':\n case 68:\n resultString += _processFormat(locale.formats.D, date, locale, timestamp);\n break;\n\n // '1970-01-01'\n // case 'F':\n case 70:\n resultString += _processFormat(locale.formats.F, date, locale, timestamp);\n break;\n\n // '00'\n // case 'H':\n case 72:\n resultString += padTill2(date.getHours(), padding);\n break;\n\n // '12'\n // case 'I':\n case 73:\n resultString += padTill2(hours12(date.getHours()), padding);\n break;\n\n // '000'\n // case 'L':\n case 76:\n resultString += padTill3(Math.floor(timestamp % 1000));\n break;\n\n // '00'\n // case 'M':\n case 77:\n resultString += padTill2(date.getMinutes(), padding);\n break;\n\n // 'am'\n // case 'P':\n case 80:\n resultString += date.getHours() < 12 ? locale.am : locale.pm;\n break;\n\n // '00:00'\n // case 'R':\n case 82:\n resultString += _processFormat(locale.formats.R, date, locale, timestamp);\n break;\n\n // '00'\n // case 'S':\n case 83:\n resultString += padTill2(date.getSeconds(), padding);\n break;\n\n // '00:00:00'\n // case 'T':\n case 84:\n resultString += _processFormat(locale.formats.T, date, locale, timestamp);\n break;\n\n // '00'\n // case 'U':\n case 85:\n resultString += padTill2(weekNumber(date, 'sunday'), padding);\n break;\n\n // '00'\n // case 'W':\n case 87:\n resultString += padTill2(weekNumber(date, 'monday'), padding);\n break;\n\n // '16:00:00'\n // case 'X':\n case 88:\n resultString += _processFormat(locale.formats.X, date, locale, timestamp);\n break;\n\n // '1970'\n // case 'Y':\n case 89:\n resultString += date.getFullYear();\n break;\n\n // 'GMT'\n // case 'Z':\n case 90:\n if (_useUtcBasedDate && _customTimezoneOffset === 0) {\n resultString += \"GMT\";\n }\n else {\n var tzName = getTimezoneName(date);\n resultString += tzName || '';\n }\n break;\n\n // 'Thu'\n // case 'a':\n case 97:\n resultString += locale.shortDays[date.getDay()];\n break;\n\n // 'Jan'\n // case 'b':\n case 98:\n resultString += locale.shortMonths[date.getMonth()];\n break;\n\n // ''\n // case 'c':\n case 99:\n resultString += _processFormat(locale.formats.c, date, locale, timestamp);\n break;\n\n // '01'\n // case 'd':\n case 100:\n resultString += padTill2(date.getDate(), padding);\n break;\n\n // ' 1'\n // case 'e':\n case 101:\n resultString += padTill2(date.getDate(), padding == null ? ' ' : padding);\n break;\n\n // 'Jan'\n // case 'h':\n case 104:\n resultString += locale.shortMonths[date.getMonth()];\n break;\n\n // '000'\n // case 'j':\n case 106:\n var y = new Date(date.getFullYear(), 0, 1);\n var day = Math.ceil((date.getTime() - y.getTime()) / (1000 * 60 * 60 * 24));\n resultString += padTill3(day);\n break;\n\n // ' 0'\n // case 'k':\n case 107:\n resultString += padTill2(date.getHours(), padding == null ? ' ' : padding);\n break;\n\n // '12'\n // case 'l':\n case 108:\n resultString += padTill2(hours12(date.getHours()), padding == null ? ' ' : padding);\n break;\n\n // '01'\n // case 'm':\n case 109:\n resultString += padTill2(date.getMonth() + 1, padding);\n break;\n\n // '\\n'\n // case 'n':\n case 110:\n resultString += '\\n';\n break;\n\n // '1st'\n // case 'o':\n case 111:\n // Try to use an ordinal suffix from the locale, but fall back to using the old\n // function for compatibility with old locales that lack them.\n var day = date.getDate();\n if (locale.ordinalSuffixes) {\n resultString += String(day) + (locale.ordinalSuffixes[day - 1] || ordinal(day));\n }\n else {\n resultString += String(day) + ordinal(day);\n }\n break;\n\n // 'AM'\n // case 'p':\n case 112:\n resultString += date.getHours() < 12 ? locale.AM : locale.PM;\n break;\n\n // '12:00:00 AM'\n // case 'r':\n case 114:\n resultString += _processFormat(locale.formats.r, date, locale, timestamp);\n break;\n\n // '0'\n // case 's':\n case 115:\n resultString += Math.floor(timestamp / 1000);\n break;\n\n // '\\t'\n // case 't':\n case 116:\n resultString += '\\t';\n break;\n\n // '4'\n // case 'u':\n case 117:\n var day = date.getDay();\n resultString += day === 0 ? 7 : day;\n break; // 1 - 7, Monday is first day of the week\n\n // ' 1-Jan-1970'\n // case 'v':\n case 118:\n resultString += _processFormat(locale.formats.v, date, locale, timestamp);\n break;\n\n // '4'\n // case 'w':\n case 119:\n resultString += date.getDay();\n break; // 0 - 6, Sunday is first day of the week\n\n // '12/31/69'\n // case 'x':\n case 120:\n resultString += _processFormat(locale.formats.x, date, locale, timestamp);\n break;\n\n // '70'\n // case 'y':\n case 121:\n resultString += ('' + date.getFullYear()).slice(2);\n break;\n\n // '+0000'\n // case 'z':\n case 122:\n if (_useUtcBasedDate && _customTimezoneOffset === 0) {\n resultString += extendedTZ ? \"+00:00\" : \"+0000\";\n }\n else {\n var off;\n if (_customTimezoneOffset !== 0) {\n off = _customTimezoneOffset / (60 * 1000);\n }\n else {\n off = -date.getTimezoneOffset();\n }\n var sign = off < 0 ? '-' : '+';\n var sep = extendedTZ ? ':' : '';\n var hours = Math.floor(Math.abs(off / 60));\n var mins = Math.abs(off % 60);\n resultString += sign + padTill2(hours) + sep + padTill2(mins);\n }\n break;\n\n default:\n if (isInScope) {\n resultString += '%';\n }\n resultString += format[i];\n break;\n }\n\n padding = null;\n isInScope = false;\n continue;\n }\n\n // '%'\n if (currentCharCode === 37) {\n isInScope = true;\n continue;\n }\n\n resultString += format[i];\n }\n\n return resultString;\n }\n\n var strftime = _strftime;\n\n strftime.localize = function(locale) {\n return new Strftime(locale || _locale, _customTimezoneOffset, _useUtcBasedDate);\n };\n\n strftime.localizeByIdentifier = function(localeIdentifier) {\n var locale = Locales[localeIdentifier];\n if (!locale) {\n warn('[WARNING] No locale found with identifier \"' + localeIdentifier + '\".');\n return strftime;\n }\n return strftime.localize(locale);\n };\n\n strftime.timezone = function(timezone) {\n var customTimezoneOffset = _customTimezoneOffset;\n var useUtcBasedDate = _useUtcBasedDate;\n\n var timezoneType = typeof timezone;\n if (timezoneType === 'number' || timezoneType === 'string') {\n useUtcBasedDate = true;\n\n // ISO 8601 format timezone string, [-+]HHMM\n if (timezoneType === 'string') {\n var sign = timezone[0] === '-' ? -1 : 1,\n hours = parseInt(timezone.slice(1, 3), 10),\n minutes = parseInt(timezone.slice(3, 5), 10);\n\n customTimezoneOffset = sign * ((60 * hours) + minutes) * 60 * 1000;\n // in minutes: 420\n }\n else if (timezoneType === 'number') {\n customTimezoneOffset = timezone * 60 * 1000;\n }\n }\n\n return new Strftime(_locale, customTimezoneOffset, useUtcBasedDate);\n };\n\n strftime.utc = function() {\n return new Strftime(_locale, _customTimezoneOffset, true);\n };\n\n return strftime;\n }\n\n function padTill2(numberToPad, paddingChar) {\n if (paddingChar === '' || numberToPad > 9) {\n return numberToPad;\n }\n if (paddingChar == null) {\n paddingChar = '0';\n }\n return paddingChar + numberToPad;\n }\n\n function padTill3(numberToPad) {\n if (numberToPad > 99) {\n return numberToPad;\n }\n if (numberToPad > 9) {\n return '0' + numberToPad;\n }\n return '00' + numberToPad;\n }\n\n function hours12(hour) {\n if (hour === 0) {\n return 12;\n }\n else if (hour > 12) {\n return hour - 12;\n }\n return hour;\n }\n\n // firstWeekday: 'sunday' or 'monday', default is 'sunday'\n //\n // Pilfered & ported from Ruby's strftime implementation.\n function weekNumber(date, firstWeekday) {\n firstWeekday = firstWeekday || 'sunday';\n\n // This works by shifting the weekday back by one day if we\n // are treating Monday as the first day of the week.\n var weekday = date.getDay();\n if (firstWeekday === 'monday') {\n if (weekday === 0) // Sunday\n weekday = 6;\n else\n weekday--;\n }\n\n var firstDayOfYearUtc = Date.UTC(date.getFullYear(), 0, 1),\n dateUtc = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),\n yday = Math.floor((dateUtc - firstDayOfYearUtc) / 86400000),\n weekNum = (yday + 7 - weekday) / 7;\n\n return Math.floor(weekNum);\n }\n\n // Get the ordinal suffix for a number: st, nd, rd, or th\n function ordinal(number) {\n var i = number % 10;\n var ii = number % 100;\n\n if ((ii >= 11 && ii <= 13) || i === 0 || i >= 4) {\n return 'th';\n }\n switch (i) {\n case 1: return 'st';\n case 2: return 'nd';\n case 3: return 'rd';\n }\n }\n\n function getTimestampToUtcOffsetFor(date) {\n return (date.getTimezoneOffset() || 0) * 60000;\n }\n\n // Tries to get a short timezone name using Date.toLocaleString, falling back on the platform default\n // using Date.toString if necessary.\n function getTimezoneName(date, localeIdentifier) {\n return getShortTimezoneName(date, localeIdentifier) || getDefaultTimezoneName(date);\n }\n\n // Unfortunately this returns GMT+2 when running with `TZ=Europe/Amsterdam node test.js` so it's not\n // perfect.\n function getShortTimezoneName(date, localeIdentifier) {\n if (localeIdentifier == null) return null;\n\n var tzString = date\n .toLocaleString(localeIdentifier, { timeZoneName: 'short' })\n .match(/\\s([\\w]+)$/);\n return tzString && tzString[1];\n }\n\n // This varies by platform so it's not an ideal way to get the time zone name. On most platforms it's\n // a short name but in Node v10+ and Chrome 66+ it's a long name now. Prefer getShortTimezoneName(date)\n // where possible.\n function getDefaultTimezoneName(date) {\n var tzString = date.toString().match(/\\(([\\w\\s]+)\\)/);\n return tzString && tzString[1];\n }\n\n function warn(message) {\n if (typeof console !== 'undefined' && typeof console.warn == 'function') {\n console.warn(message)\n }\n }\n\n}());\n","/**\n * Copyright (c) Nicolas Gallagher\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.styleq = void 0;\nvar cache = new WeakMap();\nvar compiledKey = '$$css';\n\nfunction createStyleq(options) {\n var disableCache;\n var disableMix;\n var transform;\n\n if (options != null) {\n disableCache = options.disableCache === true;\n disableMix = options.disableMix === true;\n transform = options.transform;\n }\n\n return function styleq() {\n // Keep track of property commits to the className\n var definedProperties = []; // The className and inline style to build up\n\n var className = '';\n var inlineStyle = null; // The current position in the cache graph\n\n var nextCache = disableCache ? null : cache; // This way of creating an array from arguments is fastest\n\n var styles = new Array(arguments.length);\n\n for (var i = 0; i < arguments.length; i++) {\n styles[i] = arguments[i];\n } // Iterate over styles from last to first\n\n\n while (styles.length > 0) {\n var possibleStyle = styles.pop(); // Skip empty items\n\n if (possibleStyle == null || possibleStyle === false) {\n continue;\n } // Push nested styles back onto the stack to be processed\n\n\n if (Array.isArray(possibleStyle)) {\n for (var _i = 0; _i < possibleStyle.length; _i++) {\n styles.push(possibleStyle[_i]);\n }\n\n continue;\n } // Process an individual style object\n\n\n var style = transform != null ? transform(possibleStyle) : possibleStyle;\n\n if (style.$$css) {\n // Build up the class names defined by this object\n var classNameChunk = ''; // Check the cache to see if we've already done this work\n\n if (nextCache != null && nextCache.has(style)) {\n // Cache: read\n var cacheEntry = nextCache.get(style);\n\n if (cacheEntry != null) {\n classNameChunk = cacheEntry[0]; // $FlowIgnore\n\n definedProperties.push.apply(definedProperties, cacheEntry[1]);\n nextCache = cacheEntry[2];\n }\n } // Update the chunks with data from this object\n else {\n // The properties defined by this object\n var definedPropertiesChunk = [];\n\n for (var prop in style) {\n var value = style[prop];\n if (prop === compiledKey) continue; // Each property value is used as an HTML class name\n // { 'debug.string': 'debug.string', opacity: 's-jskmnoqp' }\n\n if (typeof value === 'string' || value === null) {\n // Only add to chunks if this property hasn't already been seen\n if (!definedProperties.includes(prop)) {\n definedProperties.push(prop);\n\n if (nextCache != null) {\n definedPropertiesChunk.push(prop);\n }\n\n if (typeof value === 'string') {\n classNameChunk += classNameChunk ? ' ' + value : value;\n }\n }\n } // If we encounter a value that isn't a string or `null`\n else {\n console.error(\"styleq: \".concat(prop, \" typeof \").concat(String(value), \" is not \\\"string\\\" or \\\"null\\\".\"));\n }\n } // Cache: write\n\n\n if (nextCache != null) {\n // Create the next WeakMap for this sequence of styles\n var weakMap = new WeakMap();\n nextCache.set(style, [classNameChunk, definedPropertiesChunk, weakMap]);\n nextCache = weakMap;\n }\n } // Order of classes in chunks matches property-iteration order of style\n // object. Order of chunks matches passed order of styles from first to\n // last (which we iterate over in reverse).\n\n\n if (classNameChunk) {\n className = className ? classNameChunk + ' ' + className : classNameChunk;\n }\n } // ----- DYNAMIC: Process inline style object -----\n else {\n if (disableMix) {\n if (inlineStyle == null) {\n inlineStyle = {};\n }\n\n inlineStyle = Object.assign({}, style, inlineStyle);\n } else {\n var subStyle = null;\n\n for (var _prop in style) {\n var _value = style[_prop];\n\n if (_value !== undefined) {\n if (!definedProperties.includes(_prop)) {\n if (_value != null) {\n if (inlineStyle == null) {\n inlineStyle = {};\n }\n\n if (subStyle == null) {\n subStyle = {};\n }\n\n subStyle[_prop] = _value;\n }\n\n definedProperties.push(_prop); // Cache is unnecessary overhead if results can't be reused.\n\n nextCache = null;\n }\n }\n }\n\n if (subStyle != null) {\n inlineStyle = Object.assign(subStyle, inlineStyle);\n }\n }\n }\n }\n\n var styleProps = [className, inlineStyle];\n return styleProps;\n };\n}\n\nvar styleq = createStyleq();\nexports.styleq = styleq;\nstyleq.factory = createStyleq;","/**\n * Copyright (c) Nicolas Gallagher\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.localizeStyle = localizeStyle;\nvar cache = new WeakMap();\nvar markerProp = '$$css$localize';\n/**\n * The compiler polyfills logical properties and values, generating a class\n * name for both writing directions. The style objects are annotated by\n * the compiler as needing this runtime transform. The results are memoized.\n *\n * { '$$css$localize': true, float: [ 'float-left', 'float-right' ] }\n * => { float: 'float-left' }\n */\n\nfunction compileStyle(style, isRTL) {\n // Create a new compiled style for styleq\n var compiledStyle = {};\n\n for (var prop in style) {\n if (prop !== markerProp) {\n var value = style[prop];\n\n if (Array.isArray(value)) {\n compiledStyle[prop] = isRTL ? value[1] : value[0];\n } else {\n compiledStyle[prop] = value;\n }\n }\n }\n\n return compiledStyle;\n}\n\nfunction localizeStyle(style, isRTL) {\n if (style[markerProp] != null) {\n var compiledStyleIndex = isRTL ? 1 : 0; // Check the cache in case we've already seen this object\n\n if (cache.has(style)) {\n var _cachedStyles = cache.get(style);\n\n var _compiledStyle = _cachedStyles[compiledStyleIndex];\n\n if (_compiledStyle == null) {\n // Update the missing cache entry\n _compiledStyle = compileStyle(style, isRTL);\n _cachedStyles[compiledStyleIndex] = _compiledStyle;\n cache.set(style, _cachedStyles);\n }\n\n return _compiledStyle;\n } // Create a new compiled style for styleq\n\n\n var compiledStyle = compileStyle(style, isRTL);\n var cachedStyles = new Array(2);\n cachedStyles[compiledStyleIndex] = compiledStyle;\n cache.set(style, cachedStyles);\n return compiledStyle;\n }\n\n return style;\n}","/**\n * Copyright (c) Nicolas Gallagher\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nmodule.exports = require('./dist/transform-localize-style');\n","var timeout = 5000;\nvar lastTime = Date.now();\nvar callbacks = [];\n\nsetInterval(function() {\n var currentTime = Date.now();\n if (currentTime > (lastTime + timeout + 2000)) {\n callbacks.forEach(function (fn) {\n fn();\n });\n }\n lastTime = currentTime;\n}, timeout);\n\nmodule.exports = function (fn) {\n callbacks.push(fn);\n};\n","var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _extends() {\n return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _extends.apply(null, arguments);\n}\nmodule.exports = _extends, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _interopRequireDefault(e) {\n return e && e.__esModule ? e : {\n \"default\": e\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _getRequireWildcardCache(e) {\n if (\"function\" != typeof WeakMap) return null;\n var r = new WeakMap(),\n t = new WeakMap();\n return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {\n return e ? t : r;\n })(e);\n}\nfunction _interopRequireWildcard(e, r) {\n if (!r && e && e.__esModule) return e;\n if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return {\n \"default\": e\n };\n var t = _getRequireWildcardCache(r);\n if (t && t.has(e)) return t.get(e);\n var n = {\n __proto__: null\n },\n a = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var u in e) if (\"default\" !== u && {}.hasOwnProperty.call(e, u)) {\n var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;\n i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];\n }\n return n[\"default\"] = e, t && t.set(e, n), n;\n}\nmodule.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var defineProperty = require(\"./defineProperty.js\");\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nmodule.exports = _objectSpread2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.includes(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nmodule.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nmodule.exports = toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nvar toPrimitive = require(\"./toPrimitive.js\");\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nmodule.exports = toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","const ReadersWriterLock = require(\"./src/readers-writer-lock.cjs\")\n\nmodule.exports = {\n ReadersWriterLock\n}\n","module.exports = class ReadersWriterLock {\n constructor(args = {}) {\n this._debug = args.debug\n this._readers = 0\n this._writers = 0\n this._processQueueTimeout = null\n this._readQueue = []\n this._writeQueue = []\n }\n\n read(callback) {\n if (this._debug) this._log(\"read\")\n return new Promise((resolve, reject) => {\n this._readWithResolve({callback, resolve, reject})\n })\n }\n\n write(callback) {\n if (this._debug) this._log(\"write\")\n return new Promise((resolve, reject) => {\n this._writeWithResolve({callback, resolve, reject})\n })\n }\n\n _log(message) {\n console.log(\"ReadersWriteLock\", message, JSON.stringify({readers: this._readers, writers: this._writers}))\n }\n\n _readWithResolve(item) {\n if (this._writers > 0) {\n if (this._debug) this._log(\"Queue read\")\n this._readQueue.push(item)\n } else {\n if (this._debug) this._log(\"Process read\")\n this._processRead(item)\n }\n }\n\n _writeWithResolve(item) {\n if (this._readers > 0 || this._writers > 0) {\n if (this._debug) this._log(\"Queue write\")\n this._writeQueue.push(item)\n } else {\n if (this._debug) this._log(\"Process write\")\n this._processWrite(item)\n }\n }\n\n async _processRead(item) {\n this._readers++\n\n try {\n let result\n\n if (item.callback) result = await item.callback()\n await item.resolve(result)\n } catch (error) {\n item.reject(error)\n } finally {\n this._readers--\n this._processQueueLater()\n }\n }\n\n async _processWrite(item) {\n this._writers++\n\n try {\n let result\n\n if (item.callback) result = await item.callback()\n await item.resolve(result)\n } catch (error) {\n item.reject(error)\n } finally {\n this._writers--\n this._processQueueLater()\n }\n }\n\n // First execute anything waiting after having given the lock back to the original caller by executing at the end of the event-queue by timeout-hack\n _processQueueLater() {\n if (this._processQueueTimeout) {\n clearTimeout(this._processQueueTimeout)\n }\n\n this._processQueueTimeout = setTimeout(this._processQueue, 0)\n }\n\n _processQueue = () => {\n if (this._writers == 0) {\n // If no one has begun writing, we should try and proceed to next read item if any\n const readQueueItem = this._readQueue.shift()\n\n if (readQueueItem) {\n if (this._debug) this._log(\"Process next read\")\n this._processRead(readQueueItem)\n } else if (this._readers == 0) {\n // No writers, no next item to read - we should try and proceed to next write item if any\n const writeQueueItem = this._writeQueue.shift()\n\n if (writeQueueItem) {\n if (this._debug) this._log(\"Process next write\")\n this._processWrite(writeQueueItem)\n }\n }\n }\n }\n}\n","module.exports = class FormDataToObject {\n static toObject(formData) {\n const formDataToObject = new FormDataToObject(formData)\n return formDataToObject.toObject()\n }\n\n constructor(formData) {\n this.formData = formData\n }\n\n static formDataFromObject(object, options) {\n if (object instanceof FormData) {\n return object\n } else if (object.nodeName == \"FORM\") {\n if (options) options[\"form\"] = object\n\n return new FormData(object)\n } else {\n throw new Error(\"Didnt know how to get form data from that object\")\n }\n }\n\n toObject() {\n const result = {}\n\n for(const entry of this.formData.entries()) {\n const key = entry[0]\n const value = entry[1]\n\n this.treatInitial(key, value, result)\n }\n\n return result\n }\n\n treatInitial(key, value, result) {\n const firstMatch = key.match(/^(.+?)(\\[([\\s\\S]+$))/)\n\n if (firstMatch) {\n const inputName = firstMatch[1]\n const rest = firstMatch[2]\n\n let newResult\n\n if (inputName in result) {\n newResult = result[inputName]\n } else if (rest == \"[]\") {\n newResult = []\n result[inputName] = newResult\n } else {\n newResult = {}\n result[inputName] = newResult\n }\n\n this.treatSecond(value, rest, newResult)\n } else {\n result[key] = value\n }\n }\n\n treatSecond(value, rest, result) {\n const secondMatch = rest.match(/^\\[(.*?)\\]([\\s\\S]*)$/)\n const key = secondMatch[1]\n const newRest = secondMatch[2]\n\n let newResult\n\n if (rest == \"[]\") {\n result.push(value)\n } else if (newRest == \"\") {\n result[key] = value\n } else {\n if (typeof result == \"object\" && key in result) {\n newResult = result[key]\n } else if (newRest == \"[]\") {\n newResult = []\n result[key] = newResult\n } else {\n newResult = {}\n result[key] = newResult\n }\n\n this.treatSecond(value, newRest, newResult)\n }\n }\n}\n","module.exports = function numberable(number, {delimiter = \",\", precision = 2, separator = \".\"}) {\n // Fixed number of decimals to given precision and convert to string\n number = `${number.toFixed(precision)}`\n\n // Split whole number with decimals\n const numberParts = number.split(\".\")\n const wholeNumbers = numberParts[0]\n\n let decimals = numberParts[1]\n\n // Append decimals if there are fewer then decired\n while(decimals.length < precision) {\n decimals += \"0\"\n }\n\n // Add delimiters to the whole number\n let numberWithDelimiters = \"\"\n let location = wholeNumbers.length\n\n while(location >= 1) {\n if (numberWithDelimiters != \"\") {\n numberWithDelimiters = `${delimiter}${numberWithDelimiters}`\n }\n\n numberWithDelimiters = `${wholeNumbers.substring(location - 3, location)}${numberWithDelimiters}`\n location -= 3\n }\n\n return `${numberWithDelimiters}${separator}${decimals}`\n}\n","'use strict';\n\nvar $TypeError = require('es-errors/type');\n\nvar DefineOwnProperty = require('../helpers/DefineOwnProperty');\n\nvar FromPropertyDescriptor = require('./FromPropertyDescriptor');\nvar IsDataDescriptor = require('./IsDataDescriptor');\nvar IsPropertyKey = require('./IsPropertyKey');\nvar SameValue = require('./SameValue');\nvar Type = require('./Type');\n\n// https://262.ecma-international.org/6.0/#sec-createmethodproperty\n\nmodule.exports = function CreateMethodProperty(O, P, V) {\n\tif (Type(O) !== 'Object') {\n\t\tthrow new $TypeError('Assertion failed: Type(O) is not Object');\n\t}\n\n\tif (!IsPropertyKey(P)) {\n\t\tthrow new $TypeError('Assertion failed: IsPropertyKey(P) is not true');\n\t}\n\n\tvar newDesc = {\n\t\t'[[Configurable]]': true,\n\t\t'[[Enumerable]]': false,\n\t\t'[[Value]]': V,\n\t\t'[[Writable]]': true\n\t};\n\treturn DefineOwnProperty(\n\t\tIsDataDescriptor,\n\t\tSameValue,\n\t\tFromPropertyDescriptor,\n\t\tO,\n\t\tP,\n\t\tnewDesc\n\t);\n};\n","'use strict';\n\nvar $TypeError = require('es-errors/type');\n\nvar isPropertyDescriptor = require('../helpers/records/property-descriptor');\nvar fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');\n\n// https://262.ecma-international.org/6.0/#sec-frompropertydescriptor\n\nmodule.exports = function FromPropertyDescriptor(Desc) {\n\tif (typeof Desc !== 'undefined' && !isPropertyDescriptor(Desc)) {\n\t\tthrow new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');\n\t}\n\n\treturn fromPropertyDescriptor(Desc);\n};\n","'use strict';\n\nvar $TypeError = require('es-errors/type');\n\nvar hasOwn = require('hasown');\n\nvar isPropertyDescriptor = require('../helpers/records/property-descriptor');\n\n// https://262.ecma-international.org/5.1/#sec-8.10.2\n\nmodule.exports = function IsDataDescriptor(Desc) {\n\tif (typeof Desc === 'undefined') {\n\t\treturn false;\n\t}\n\n\tif (!isPropertyDescriptor(Desc)) {\n\t\tthrow new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');\n\t}\n\n\tif (!hasOwn(Desc, '[[Value]]') && !hasOwn(Desc, '[[Writable]]')) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n","'use strict';\n\n// https://262.ecma-international.org/6.0/#sec-ispropertykey\n\nmodule.exports = function IsPropertyKey(argument) {\n\treturn typeof argument === 'string' || typeof argument === 'symbol';\n};\n","'use strict';\n\nvar $isNaN = require('../helpers/isNaN');\n\n// http://262.ecma-international.org/5.1/#sec-9.12\n\nmodule.exports = function SameValue(x, y) {\n\tif (x === y) { // 0 === -0, but they are not identical.\n\t\tif (x === 0) { return 1 / x === 1 / y; }\n\t\treturn true;\n\t}\n\treturn $isNaN(x) && $isNaN(y);\n};\n","'use strict';\n\nvar ES5Type = require('../5/Type');\n\n// https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values\n\nmodule.exports = function Type(x) {\n\tif (typeof x === 'symbol') {\n\t\treturn 'Symbol';\n\t}\n\tif (typeof x === 'bigint') {\n\t\treturn 'BigInt';\n\t}\n\treturn ES5Type(x);\n};\n","'use strict';\n\n// https://262.ecma-international.org/5.1/#sec-8\n\nmodule.exports = function Type(x) {\n\tif (x === null) {\n\t\treturn 'Null';\n\t}\n\tif (typeof x === 'undefined') {\n\t\treturn 'Undefined';\n\t}\n\tif (typeof x === 'function' || typeof x === 'object') {\n\t\treturn 'Object';\n\t}\n\tif (typeof x === 'number') {\n\t\treturn 'Number';\n\t}\n\tif (typeof x === 'boolean') {\n\t\treturn 'Boolean';\n\t}\n\tif (typeof x === 'string') {\n\t\treturn 'String';\n\t}\n};\n","'use strict';\n\nvar hasPropertyDescriptors = require('has-property-descriptors');\n\nvar $defineProperty = require('es-define-property');\n\nvar hasArrayLengthDefineBug = hasPropertyDescriptors.hasArrayLengthDefineBug();\n\n// eslint-disable-next-line global-require\nvar isArray = hasArrayLengthDefineBug && require('../helpers/IsArray');\n\nvar callBound = require('call-bind/callBound');\n\nvar $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');\n\n// eslint-disable-next-line max-params\nmodule.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {\n\tif (!$defineProperty) {\n\t\tif (!IsDataDescriptor(desc)) {\n\t\t\t// ES3 does not support getters/setters\n\t\t\treturn false;\n\t\t}\n\t\tif (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// fallback for ES3\n\t\tif (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {\n\t\t\t// a non-enumerable existing property\n\t\t\treturn false;\n\t\t}\n\n\t\t// property does not exist at all, or exists but is enumerable\n\t\tvar V = desc['[[Value]]'];\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tO[P] = V; // will use [[Define]]\n\t\treturn SameValue(O[P], V);\n\t}\n\tif (\n\t\thasArrayLengthDefineBug\n\t\t&& P === 'length'\n\t\t&& '[[Value]]' in desc\n\t\t&& isArray(O)\n\t\t&& O.length !== desc['[[Value]]']\n\t) {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tO.length = desc['[[Value]]'];\n\t\treturn O.length === desc['[[Value]]'];\n\t}\n\n\t$defineProperty(O, P, FromPropertyDescriptor(desc));\n\treturn true;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $Array = GetIntrinsic('%Array%');\n\n// eslint-disable-next-line global-require\nvar toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString');\n\nmodule.exports = $Array.isArray || function IsArray(argument) {\n\treturn toStr(argument) === '[object Array]';\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('call-bind');\nvar callBound = require('call-bind/callBound');\n\nvar $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true);\nvar $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%'));\nvar $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);\nvar $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);\nvar $gOPS = $SymbolValueOf ? GetIntrinsic('%Object.getOwnPropertySymbols%') : null;\n\nvar keys = require('object-keys');\n\nmodule.exports = $ownKeys || function OwnPropertyKeys(source) {\n\tvar ownKeys = ($gOPN || keys)(source);\n\tif ($gOPS) {\n\t\t$pushApply(ownKeys, $gOPS(source));\n\t}\n\treturn ownKeys;\n};\n","'use strict';\n\nmodule.exports = function fromPropertyDescriptor(Desc) {\n\tif (typeof Desc === 'undefined') {\n\t\treturn Desc;\n\t}\n\tvar obj = {};\n\tif ('[[Value]]' in Desc) {\n\t\tobj.value = Desc['[[Value]]'];\n\t}\n\tif ('[[Writable]]' in Desc) {\n\t\tobj.writable = !!Desc['[[Writable]]'];\n\t}\n\tif ('[[Get]]' in Desc) {\n\t\tobj.get = Desc['[[Get]]'];\n\t}\n\tif ('[[Set]]' in Desc) {\n\t\tobj.set = Desc['[[Set]]'];\n\t}\n\tif ('[[Enumerable]]' in Desc) {\n\t\tobj.enumerable = !!Desc['[[Enumerable]]'];\n\t}\n\tif ('[[Configurable]]' in Desc) {\n\t\tobj.configurable = !!Desc['[[Configurable]]'];\n\t}\n\treturn obj;\n};\n","'use strict';\n\nmodule.exports = Number.isNaN || function isNaN(a) {\n\treturn a !== a;\n};\n","'use strict';\n\nvar $TypeError = require('es-errors/type');\n\nvar hasOwn = require('hasown');\n\nvar allowed = {\n\t__proto__: null,\n\t'[[Configurable]]': true,\n\t'[[Enumerable]]': true,\n\t'[[Get]]': true,\n\t'[[Set]]': true,\n\t'[[Value]]': true,\n\t'[[Writable]]': true\n};\n\n// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type\n\nmodule.exports = function isPropertyDescriptor(Desc) {\n\tif (!Desc || typeof Desc !== 'object') {\n\t\treturn false;\n\t}\n\n\tfor (var key in Desc) { // eslint-disable-line\n\t\tif (hasOwn(Desc, key) && !allowed[key]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tvar isData = hasOwn(Desc, '[[Value]]') || hasOwn(Desc, '[[Writable]]');\n\tvar IsAccessor = hasOwn(Desc, '[[Get]]') || hasOwn(Desc, '[[Set]]');\n\tif (isData && IsAccessor) {\n\t\tthrow new $TypeError('Property Descriptors may not be both accessor and data descriptors');\n\t}\n\treturn true;\n};\n","module.exports = function uniqunize(array, callback) {\n const valuesSeen = []\n const uniqueArray = []\n\n for (const index in array) {\n const value = callback ? callback(array[index]) : array[index]\n\n if (!valuesSeen.includes(value)) {\n valuesSeen.push(value)\n uniqueArray.push(array[index])\n }\n }\n\n return uniqueArray\n}\n","function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nexport { _arrayLikeToArray as default };","import unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _createForOfIteratorHelperLoose as default };","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nexport { _unsupportedIterableToArray as default };","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nexport { _objectSpread2 as default };","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.includes(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","import {digg} from \"diggerize\"\n\nconst errorMessages = (args) => {\n if (typeof args.response == \"object\") {\n return digg(args, \"response\", \"errors\").map((error) => {\n if (typeof error == \"string\") {\n return error\n }\n\n return digg(error, \"message\")\n })\n }\n}\n\nexport default errorMessages\n","import {dig, digg} from \"diggerize\"\nimport errorMessages from \"./error-messages.mjs\"\n\nexport default class BaseError extends Error {\n static apiMakerType = \"BaseError\"\n\n constructor (message, args = {}) {\n let messageToUse = message\n\n if (\"addResponseErrorsToErrorMessage\" in args && !args.addResponseErrorsToErrorMessage) {\n messageToUse = message\n } else {\n if (typeof args.response == \"object\" && dig(args, \"response\", \"errors\")) {\n if (message) {\n messageToUse = `${messageToUse}: ${errorMessages(args).join(\". \")}`\n } else {\n messageToUse = errorMessages(args).join(\". \")\n }\n }\n }\n\n super(messageToUse)\n this.args = args\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) Error.captureStackTrace(this, BaseError)\n }\n\n errorMessages () {\n return errorMessages(this.args)\n }\n\n errorTypes () {\n if (typeof this.args.response == \"object\") {\n return digg(this, \"args\", \"response\", \"errors\").map((error) => digg(error, \"type\"))\n }\n }\n}\n","import {digg} from \"diggerize\"\nimport EventEmitter from \"events\"\nimport * as inflection from \"inflection\"\nimport {ReadersWriterLock} from \"epic-locks\"\nimport Services from \"./services.mjs\"\n\nconst shared = {}\n\nexport default class ApiMakerCanCan {\n abilities = []\n abilitiesToLoad = []\n abilitiesToLoadData = []\n events = new EventEmitter()\n lock = new ReadersWriterLock()\n\n static current () {\n if (!shared.currentApiMakerCanCan) shared.currentApiMakerCanCan = new ApiMakerCanCan()\n\n return shared.currentApiMakerCanCan\n }\n\n can (ability, subject) {\n let abilityToUse = inflection.underscore(ability)\n const foundAbility = this.findAbility(abilityToUse, subject)\n\n if (foundAbility === undefined) {\n let subjectLabel = subject\n\n // Translate resource-models into class name strings\n if (typeof subject == \"function\" && subject.modelClassData) {\n subjectLabel = digg(subject.modelClassData(), \"name\")\n }\n\n console.error(`Ability not loaded ${subjectLabel}#${abilityToUse}`, {abilities: this.abilities, ability, subject})\n\n return false\n } else {\n return digg(foundAbility, \"can\")\n }\n }\n\n findAbility (ability, subject) {\n return this.abilities.find((abilityData) => {\n const abilityDataSubject = digg(abilityData, \"subject\")\n const abilityDataAbility = digg(abilityData, \"ability\")\n\n if (abilityDataAbility == ability) {\n // If actually same class\n if (abilityDataSubject == subject) return true\n\n // Sometimes in dev when using linking it will actually be two different but identical resource classes\n if (\n typeof subject == \"function\" &&\n subject.modelClassData &&\n typeof abilityDataSubject == \"function\" &&\n abilityDataSubject.modelClassData &&\n digg(subject.modelClassData(), \"name\") == digg(abilityDataSubject.modelClassData(), \"name\")\n ) {\n return true\n }\n }\n\n return false\n })\n }\n\n isAbilityLoaded (ability, subject) {\n const foundAbility = this.findAbility(ability, subject)\n\n if (foundAbility !== undefined) {\n return true\n }\n\n return false\n }\n\n async loadAbilities (abilities) {\n await this.lock.read(async () => {\n const promises = []\n\n for (const abilityData of abilities) {\n const subject = abilityData[0]\n\n if (!subject) throw new Error(`Invalid subject given in abilities: ${subject} - ${JSON.stringify(abilities)}`)\n if (!Array.isArray(abilityData[1])) throw new Error(`Expected an array of abilities but got: ${typeof abilityData[1]}: ${abilityData[1]}`)\n\n for (const ability of abilityData[1]) {\n const promise = this.loadAbility(ability, subject)\n\n promises.push(promise)\n }\n }\n\n await Promise.all(promises)\n })\n }\n\n loadAbility (ability, subject) {\n return new Promise((resolve) => {\n ability = inflection.underscore(ability)\n\n if (this.isAbilityLoaded(ability, subject)) {\n resolve()\n return\n }\n\n const foundAbility = this.abilitiesToLoad.find((abilityToLoad) => digg(abilityToLoad, \"ability\") == ability && digg(abilityToLoad, \"subject\") == subject)\n\n if (foundAbility) {\n foundAbility.callbacks.push(resolve)\n } else {\n this.abilitiesToLoad.push({ability, callbacks: [resolve], subject})\n this.abilitiesToLoadData.push({ability, subject})\n\n this.queueAbilitiesRequest()\n }\n })\n }\n\n queueAbilitiesRequest () {\n if (this.queueAbilitiesRequestTimeout) {\n clearTimeout(this.queueAbilitiesRequestTimeout)\n }\n\n this.queueAbilitiesRequestTimeout = setTimeout(this.sendAbilitiesRequest, 0)\n }\n\n async resetAbilities () {\n await this.lock.write(() => {\n this.abilities = []\n })\n this.events.emit(\"onResetAbilities\")\n }\n\n sendAbilitiesRequest = async () => {\n const abilitiesToLoad = this.abilitiesToLoad\n const abilitiesToLoadData = this.abilitiesToLoadData\n\n this.abilitiesToLoad = []\n this.abilitiesToLoadData = []\n\n // Load abilities from backend\n const result = await Services.current().sendRequest(\"CanCan::LoadAbilities\", {\n request: abilitiesToLoadData\n })\n const abilities = digg(result, \"abilities\")\n\n // Set the loaded abilities\n this.abilities = this.abilities.concat(abilities)\n\n // Call the callbacks that are waiting for the ability to have been loaded\n for (const abilityData of abilitiesToLoad) {\n for (const callback of abilityData.callbacks) {\n callback()\n }\n }\n }\n}\n","import cloneDeep from \"clone-deep\"\nimport CommandsPool from \"./commands-pool.mjs\"\nimport {digg} from \"diggerize\"\nimport * as inflection from \"inflection\"\nimport {incorporate} from \"incorporator\"\nimport modelClassRequire from \"./model-class-require.mjs\"\nimport Result from \"./result.mjs\"\n\nexport default class ApiMakerCollection {\n static apiMakerType = \"Collection\"\n\n constructor(args, queryArgs = {}) {\n this.queryArgs = queryArgs\n this.args = args\n }\n\n abilities(originalAbilities) {\n const newAbilities = {}\n\n for (const originalAbilityName in originalAbilities) {\n const newModelName = inflection.underscore(originalAbilityName)\n const newValues = []\n const originalValues = originalAbilities[originalAbilityName]\n\n for (const originalAbilityName of originalValues) {\n const newAbilityName = inflection.underscore(originalAbilityName)\n newValues.push(newAbilityName)\n }\n\n newAbilities[newModelName] = newValues\n }\n\n return this._merge({abilities: newAbilities})\n }\n\n accessibleBy(abilityName) {\n return this._merge({accessibleBy: inflection.underscore(abilityName)})\n }\n\n async count() {\n const response = await this.clone()._merge({count: true})._response()\n\n return digg(response, \"count\")\n }\n\n distinct() {\n return this._merge({distinct: true})\n }\n\n async each(callback) {\n const array = await this.toArray()\n\n for (const model in array) {\n callback.call(model)\n }\n }\n\n except(...keys) {\n for (const key of keys) {\n if (key == \"page\") {\n delete this.queryArgs[key]\n } else {\n throw new Error(`Unhandled key: ${key}`)\n }\n }\n\n return this\n }\n\n async first() {\n const models = await this.toArray()\n return models[0]\n }\n\n groupBy(...arrayOfTablesAndColumns) {\n const arrayOfTablesAndColumnsWithLowercaseColumns = arrayOfTablesAndColumns.map((tableAndColumn) => {\n if (Array.isArray(tableAndColumn)) {\n return [tableAndColumn[0], tableAndColumn[1].toLowerCase()]\n } else {\n return tableAndColumn.toLowerCase()\n }\n })\n const currentGroupBy = this.queryArgs.groupBy || []\n const newGroupBy = currentGroupBy.concat(arrayOfTablesAndColumnsWithLowercaseColumns)\n\n return this._merge({\n groupBy: newGroupBy\n })\n }\n\n isLoaded() {\n if (this.args.reflectionName in this.args.model.relationshipsCache)\n return true\n\n return false\n }\n\n limit(amount) {\n return this._merge({limit: amount})\n }\n\n preloaded() {\n if (!(this.args.reflectionName in this.args.model.relationshipsCache)) {\n throw new Error(`${this.args.reflectionName} hasnt been loaded yet`)\n }\n\n return this.args.model.relationshipsCache[this.args.reflectionName]\n }\n\n loaded() {\n const {model, reflectionName} = this.args\n\n if (reflectionName in model.relationships) {\n return model.relationships[reflectionName]\n } else if (reflectionName in model.relationshipsCache) {\n return model.relationshipsCache[reflectionName]\n } else if (model.isNewRecord()) {\n const reflectionNameUnderscore = inflection.underscore(reflectionName)\n\n // Initialize as empty and try again to return the empty result\n this.set([])\n\n return digg(model.relationships, reflectionNameUnderscore)\n } else {\n const relationshipsLoaded = uniqunize(Object.keys(model.relationships).concat(Object.keys(model.relationshipsCache)))\n\n throw new Error(`${reflectionName} hasnt been loaded yet on ${model.modelClassData().name}. Loaded was: ${relationshipsLoaded.join(\", \")}`)\n }\n }\n\n // Replaces the relationships with the given new collection.\n set(newCollection) {\n this.args.model.relationships[this.args.reflectionName] = newCollection\n }\n\n // Pushes another model onto the given collection.\n push(newModel) {\n if (!(this.args.reflectionName in this.args.model.relationships)) {\n this.args.model.relationships[this.args.reflectionName] = []\n }\n\n this.args.model.relationships[this.args.reflectionName].push(newModel)\n }\n\n // Array shortcuts\n find = (...args) => this.loaded().find(...args)\n forEach = (...args) => this.loaded().forEach(...args)\n map = (...args) => this.loaded().map(...args)\n\n preload(preloadValue) {\n return this._merge({preload: preloadValue})\n }\n\n page(page) {\n if (!page)\n page = 1\n\n return this._merge({page})\n }\n\n pageKey(pageKey) {\n return this._merge({pageKey})\n }\n\n params() {\n let params = {}\n\n if (this.queryArgs.params) params = incorporate(params, this.queryArgs.params)\n if (this.queryArgs.abilities) params.abilities = this.queryArgs.abilities\n if (this.queryArgs.accessibleBy) params.accessible_by = inflection.underscore(this.queryArgs.accessibleBy)\n if (this.queryArgs.count) params.count = this.queryArgs.count\n if (this.queryArgs.distinct) params.distinct = this.queryArgs.distinct\n if (this.queryArgs.groupBy) params.group_by = this.queryArgs.groupBy\n if (this.queryArgs.ransack) params.q = this.queryArgs.ransack\n if (this.queryArgs.limit) params.limit = this.queryArgs.limit\n if (this.queryArgs.preload) params.preload = this.queryArgs.preload\n if (this.queryArgs.page) params.page = this.queryArgs.page\n if (this.queryArgs.per) params.per = this.queryArgs.per\n if (this.queryArgs.search) params.search = this.queryArgs.search\n if (this.queryArgs.select) params.select = this.queryArgs.select\n if (this.queryArgs.selectColumns) params.select_columns = this.queryArgs.selectColumns\n\n return params\n }\n\n per(per) {\n return this._merge({per})\n }\n\n perKey(perKey) {\n return this._merge({perKey})\n }\n\n ransack(params) {\n if (params) this._merge({ransack: params})\n return this\n }\n\n async result() {\n const response = await this._response()\n const models = digg(response, \"collection\")\n\n this._addQueryToModels(models)\n\n const result = new Result({collection: this, models, response})\n\n return result\n }\n\n search(params) {\n if (params) this._merge({search: params})\n return this\n }\n\n searchKey(searchKey) {\n return this._merge({searchKey})\n }\n\n select(originalSelect) {\n const newSelect = {}\n\n for (const originalModelName in originalSelect) {\n const newModelName = inflection.underscore(originalModelName)\n const newValues = []\n const originalValues = originalSelect[originalModelName]\n\n for (const originalAttributeName of originalValues) {\n const newAttributeName = inflection.underscore(originalAttributeName)\n newValues.push(newAttributeName)\n }\n\n newSelect[newModelName] = newValues\n }\n\n return this._merge({select: newSelect})\n }\n\n selectColumns(originalSelect) {\n const newSelect = {}\n\n for (const originalModelName in originalSelect) {\n const newModelName = inflection.underscore(inflection.underscore(originalModelName))\n const newValues = []\n const originalValues = originalSelect[originalModelName]\n\n for (const originalAttributeName of originalValues) {\n const newAttributeName = inflection.underscore(originalAttributeName)\n newValues.push(newAttributeName)\n }\n\n newSelect[newModelName] = newValues\n }\n\n return this._merge({selectColumns: newSelect})\n }\n\n sort(sortBy) {\n return this._merge({ransack: {s: sortBy}})\n }\n\n async toArray() {\n const response = await this._response()\n const models = digg(response, \"collection\")\n\n this._addQueryToModels(models)\n\n return models\n }\n\n modelClass() {\n const modelName = digg(this.args.modelClass.modelClassData(), \"name\")\n\n return modelClassRequire(modelName)\n }\n\n clone() {\n const clonedQueryArgs = cloneDeep(this.queryArgs)\n\n return new ApiMakerCollection(this.args, clonedQueryArgs)\n }\n\n // This is needed when reloading a version of the model with the same selected attributes and preloads\n _addQueryToModels(models) {\n for(const model of models) {\n model.collection = this\n }\n }\n\n _merge(newQueryArgs) {\n incorporate(this.queryArgs, newQueryArgs)\n\n return this\n }\n\n _response() {\n const modelClassData = this.args.modelClass.modelClassData()\n\n return CommandsPool.addCommand(\n {\n args: this.params(),\n command: `${modelClassData.collectionName}-index`,\n collectionName: modelClassData.collectionName,\n type: \"index\"\n },\n {}\n )\n }\n}\n","import config from \"./config.mjs\"\nimport CustomError from \"./custom-error.mjs\"\nimport FormDataObjectizer from \"form-data-objectizer\"\nimport Logger from \"./logger.mjs\"\nimport qs from \"qs\"\nimport SessionStatusUpdater from \"./session-status-updater.mjs\"\nimport urlEncode from \"./url-encode.mjs\"\n\nconst logger = new Logger({name: \"ApiMaker / Api\"})\n\n// logger.setDebug(true)\n\nexport default class Api {\n static get = async (path, pathParams = null) => await Api.requestLocal({path, pathParams, method: \"GET\"})\n static delete = async (path, pathParams = null) => await Api.requestLocal({path, pathParams, method: \"DELETE\"})\n static patch = async (path, data = {}) => await Api.requestLocal({path, data, method: \"PATCH\"})\n static post = async (path, data = {}) => await Api.requestLocal({path, data, method: \"POST\"})\n\n static async request({data, headers, method, path, pathParams}) {\n let requestPath = \"\"\n if (config.getHost()) requestPath += config.getHost()\n requestPath += path\n\n if (pathParams) {\n const pathParamsString = qs.stringify(pathParams, {arrayFormat: \"brackets\", encoder: urlEncode})\n requestPath += `?${pathParamsString}`\n }\n\n const xhr = new XMLHttpRequest()\n\n xhr.open(method, requestPath, true)\n xhr.withCredentials = true\n\n if (headers) {\n for (const headerName in headers) {\n xhr.setRequestHeader(headerName, headers[headerName])\n }\n }\n\n const response = await Api.executeXhr(xhr, data)\n\n return response\n }\n\n static executeXhr(xhr, data) {\n return new Promise((resolve, reject) => {\n xhr.onload = () => {\n const response = this._parseResponse(xhr)\n\n if (xhr.status == 200) {\n resolve(response)\n } else {\n const customError = new CustomError(`Request failed with code: ${xhr.status}`, {response, xhr})\n\n if (data instanceof FormData) {\n customError.peakflowParameters = FormDataObjectizer.toObject(data)\n } else {\n customError.peakflowParameters = data\n }\n\n reject(customError)\n }\n }\n\n xhr.send(data)\n })\n }\n\n static async requestLocal(args) {\n if (!args.headers) {\n args.headers = {}\n }\n\n const token = await this._token()\n\n logger.debug(() => `Got token: ${token}`)\n\n if (token) {\n args.headers[\"X-CSRF-Token\"] = token\n }\n\n if (args.data) {\n args.headers[\"Content-Type\"] = \"application/json\"\n args.data = JSON.stringify(args.data)\n }\n\n if (args.rawData) {\n args.data = args.rawData\n }\n\n return await this.request(args)\n }\n\n static async put(path, data = {}) {\n return await this.requestLocal({path, data, method: \"PUT\"})\n }\n\n static _token = async () => await SessionStatusUpdater.current().getCsrfToken()\n\n static _parseResponse(xhr) {\n const responseType = xhr.getResponseHeader(\"content-type\")\n\n if (responseType && responseType.startsWith(\"application/json\")) {\n return JSON.parse(xhr.responseText)\n } else {\n return xhr.responseText\n }\n }\n}\n","import objectToFormData from \"object-to-formdata\"\n\nexport default class ApiMakerCommandSubmitData {\n constructor (data) {\n this.data = data\n this.filesCount = 0\n this.jsonData = this.traverseObject(this.data, \"json\")\n }\n\n getFilesCount = () => this.filesCount\n getJsonData = () => this.jsonData\n\n getRawData () {\n if (!this.rawData) {\n this.rawData = this.traverseObject(this.data, \"raw\")\n }\n\n return this.rawData\n }\n\n getFormData () {\n const objectForFormData = this.getRawData() || {}\n\n objectForFormData.json = JSON.stringify(this.getJsonData())\n\n const formData = objectToFormData.serialize(objectForFormData)\n\n return formData\n }\n\n convertDynamic (value, type) {\n if (Array.isArray(value)) {\n return this.traverseArray(value, type)\n } else if (typeof value == \"object\" && value !== null && value.constructor.name == \"Object\") {\n return this.traverseObject(value, type)\n } else {\n return value\n }\n }\n\n shouldSkip (object, type) {\n if (type == \"json\" && object instanceof File) {\n this.filesCount += 1\n return true\n }\n\n if (type == \"raw\" && !Array.isArray(object) && !this.isObject(object) && !(object instanceof File)) {\n return true\n }\n\n return false\n }\n\n isObject (value) {\n if (typeof value == \"object\" && value !== null && value.constructor.name == \"Object\") {\n return true\n }\n\n return false\n }\n\n traverseArray (array, type) {\n const newArray = []\n\n for (const value of array) {\n if (this.shouldSkip(value, type)) {\n continue\n }\n\n if (Array.isArray(value)) {\n newArray.push(this.convertDynamic(value, type))\n } else if (this.isObject(value)) {\n newArray.push(this.convertDynamic(value, type))\n } else {\n newArray.push(value)\n }\n }\n\n return newArray\n }\n\n traverseObject (object, type) {\n const newObject = {}\n\n for (const key in object) {\n const value = object[key]\n\n if (this.shouldSkip(value, type)) {\n continue\n }\n\n if (Array.isArray(value)) {\n newObject[key] = this.convertDynamic(value, type)\n } else if (this.isObject(value)) {\n newObject[key] = this.convertDynamic(value, type)\n } else {\n newObject[key] = value\n }\n }\n\n return newObject\n }\n}\n","import CustomError from \"./custom-error.mjs\"\n\nclass DestroyError extends CustomError {}\n\nDestroyError.apiMakerType = \"DestroyError\"\n\nexport default DestroyError\n","import {digg} from \"diggerize\"\n\nexport default class Serializer {\n static serialize (arg) {\n const serialize = new Serializer(arg)\n\n return serialize.serialize()\n }\n\n constructor (arg) {\n this.arg = arg\n }\n\n serialize () {\n return this.serializeArgument(this.arg)\n }\n\n serializeArgument (arg) {\n if (typeof arg == \"object\" && arg && arg.constructor.apiMakerType == \"BaseModel\") {\n return {\n api_maker_type: \"model\",\n model_class_name: digg(arg.modelClassData(), \"name\"),\n model_id: arg.id()\n }\n } else if (typeof arg == \"function\" && arg.apiMakerType == \"BaseModel\") {\n return {\n api_maker_type: \"resource\",\n name: digg(arg.modelClassData(), \"name\")\n }\n } else if (arg instanceof Date) {\n let offsetNumber = parseInt((arg.getTimezoneOffset() / 60) * 100, 10)\n\n offsetNumber = -offsetNumber\n\n let offset = `${offsetNumber}`\n\n while (offset.length < 4) {\n offset = `0${offset}`\n }\n\n return {\n api_maker_type: \"datetime\",\n value: `${arg.getFullYear()}-${arg.getMonth() + 1}-${arg.getDate()} ${arg.getHours()}:${arg.getMinutes()}:${arg.getSeconds()}+${offset}`\n }\n } else if (Array.isArray(arg)) {\n return this.serializeArray(arg)\n } else if (typeof arg == \"object\" && arg && arg.constructor && arg.constructor.apiMakerType == \"Collection\") {\n return {\n api_maker_type: \"collection\",\n value: this.serializeObject(arg)\n }\n } else if (typeof arg == \"object\" && arg !== null && arg.constructor.name == \"Object\") {\n return this.serializeObject(arg)\n } else {\n return arg\n }\n }\n\n serializeArray (arg) {\n return arg.map((value) => this.serializeArgument(value))\n }\n\n serializeObject (arg) {\n const newObject = {}\n\n for (const key in arg) {\n const value = arg[key]\n const newValue = this.serializeArgument(value)\n const newKey = this.serializeArgument(key)\n\n newObject[newKey] = newValue\n }\n\n return newObject\n }\n}\n","import Api from \"./api.mjs\"\nimport CommandSubmitData from \"./command-submit-data.mjs\"\nimport CustomError from \"./custom-error.mjs\"\nimport DestroyError from \"./destroy-error.mjs\"\nimport Deserializer from \"./deserializer.mjs\"\nimport {dig, digg} from \"diggerize\"\nimport events from \"./events.mjs\"\nimport FormDataObjectizer from \"form-data-objectizer\"\nimport RunLast from \"./run-last.mjs\"\nimport Serializer from \"./serializer.mjs\"\nimport SessionStatusUpdater from \"./session-status-updater.mjs\"\nimport ValidationError from \"./validation-error.mjs\"\nimport {ValidationErrors} from \"./validation-errors.mjs\"\n\nconst shared = {}\n\nexport default class ApiMakerCommandsPool {\n static addCommand(data, args = {}) {\n let pool\n\n if (args.instant) {\n pool = new ApiMakerCommandsPool()\n } else {\n pool = ApiMakerCommandsPool.current()\n }\n\n const promiseResult = pool.addCommand(data)\n\n if (args.instant) {\n pool.flushRunLast.run()\n } else {\n pool.flushRunLast.queue()\n }\n\n return promiseResult\n }\n\n static current() {\n if (!shared.currentApiMakerCommandsPool) shared.currentApiMakerCommandsPool = new ApiMakerCommandsPool()\n\n return shared.currentApiMakerCommandsPool\n }\n\n static flush() {\n ApiMakerCommandsPool.current().flush()\n }\n\n constructor() {\n this.flushCount = 0\n this.pool = {}\n this.poolData = {}\n this.currentId = 1\n this.globalRequestData = {}\n }\n\n addCommand(data) {\n const stack = Error().stack\n\n return new Promise((resolve, reject) => {\n const id = this.currentId\n this.currentId += 1\n\n const commandType = data.type\n const commandName = data.command\n const collectionName = data.collectionName\n\n this.pool[id] = {resolve, reject, stack}\n\n if (!this.poolData[commandType]) this.poolData[commandType] = {}\n if (!this.poolData[commandType][collectionName]) this.poolData[commandType][collectionName] = {}\n if (!this.poolData[commandType][collectionName][commandName]) this.poolData[commandType][collectionName][commandName] = {}\n\n let args\n\n if (data.args?.nodeName == \"FORM\") {\n const formData = new FormData(data.args)\n\n args = FormDataObjectizer.toObject(formData)\n } else if (data.args instanceof FormData) {\n args = FormDataObjectizer.toObject(data.args)\n } else {\n args = Serializer.serialize(data.args)\n }\n\n this.poolData[commandType][collectionName][commandName][id] = {\n args,\n primary_key: data.primaryKey,\n id\n }\n })\n }\n\n commandsCount() {\n return Object.keys(this.pool)\n }\n\n async sendRequest({commandSubmitData, url}) {\n let response\n\n for (let i = 0; i < 3; i++) {\n if (commandSubmitData.getFilesCount() > 0) {\n response = await Api.requestLocal({path: url, method: \"POST\", rawData: commandSubmitData.getFormData()})\n } else {\n response = await Api.requestLocal({path: url, method: \"POST\", data: commandSubmitData.getJsonData()})\n }\n\n if (response.success === false && response.type == \"invalid_authenticity_token\") {\n console.log(\"Invalid authenticity token - try again\")\n await SessionStatusUpdater.current().updateSessionStatus()\n continue\n }\n\n return response\n }\n\n throw new Error(\"Couldnt successfully execute request\")\n }\n\n flush = async () => {\n if (this.commandsCount() == 0) {\n return\n }\n\n const currentPool = this.pool\n const currentPoolData = this.poolData\n\n this.pool = {}\n this.poolData = {}\n this.flushCount++\n\n try {\n const submitData = {pool: currentPoolData}\n\n if (Object.keys(this.globalRequestData).length > 0)\n submitData.global = this.globalRequestData\n\n const commandSubmitData = new CommandSubmitData(submitData)\n const url = \"/api_maker/commands\"\n const response = await this.sendRequest({commandSubmitData, url})\n\n for (const commandId in response.responses) {\n const commandResponse = response.responses[commandId]\n const commandResponseData = Deserializer.parse(commandResponse.data)\n const commandData = currentPool[parseInt(commandId, 10)]\n const responseType = commandResponse.type\n\n if (commandResponseData && typeof commandResponseData == \"object\") {\n const bugReportUrl = dig(commandResponseData, \"bug_report_url\")\n\n if (bugReportUrl) {\n console.log(`Bug report URL: ${bugReportUrl}`)\n }\n }\n\n if (responseType == \"success\") {\n commandData.resolve(commandResponseData)\n } else if (responseType == \"error\") {\n const error = new CustomError(\"Command error\", {response: commandResponseData})\n\n error.stack += \"\\n\"\n error.stack += commandData.stack.split(\"\\n\").slice(1).join(\"\\n\")\n\n commandData.reject(error)\n } else if (responseType == \"failed\") {\n this.handleFailedResponse(commandData, commandResponseData)\n } else {\n throw new Error(`Unhandled response type: ${responseType}`)\n }\n }\n } finally {\n this.flushCount--\n }\n }\n\n handleFailedResponse(commandData, commandResponseData) {\n let error\n\n if (commandResponseData.error_type == \"destroy_error\") {\n error = new DestroyError(`Destroy failed`, {response: commandResponseData})\n } else if (commandResponseData.error_type == \"validation_error\") {\n const validationErrors = new ValidationErrors({\n model: digg(commandResponseData, \"model\"),\n validationErrors: digg(commandResponseData, \"validation_errors\")\n })\n error = new ValidationError(validationErrors, {response: commandResponseData})\n\n events.emit(\"onValidationErrors\", validationErrors)\n } else {\n let errorMessage\n\n if (!commandResponseData.errors) { errorMessage = \"Command failed\" }\n\n error = new CustomError(errorMessage, {response: commandResponseData})\n }\n\n commandData.reject(error)\n }\n\n isActive() {\n if (this.commandsCount() > 0) {\n return true\n }\n\n if (this.flushCount > 0) {\n return true\n }\n\n return false\n }\n\n flushRunLast = new RunLast(this.flush)\n}\n","import * as inflection from \"inflection\"\n\nconst accessors = {\n breakPoints: {\n default: [\n [\"xxl\", 1400],\n [\"xl\", 1200],\n [\"lg\", 992],\n [\"md\", 768],\n [\"sm\", 576],\n [\"xs\", 0]\n ],\n required: true\n },\n currenciesCollection: {required: true},\n history: {required: false},\n host: {required: false},\n i18n: {required: false},\n modal: {required: false},\n routes: {required: false},\n routeDefinitions: {required: false}\n}\n\nclass ApiMakerConfig {\n constructor() {\n if (!globalThis.apiMakerConfigGlobal) globalThis.apiMakerConfigGlobal = {}\n\n this.global = globalThis.apiMakerConfigGlobal\n }\n}\n\nfor (const accessorName in accessors) {\n const accessorData = accessors[accessorName]\n const camelizedAccessor = inflection.camelize(accessorName)\n\n ApiMakerConfig.prototype[`set${camelizedAccessor}`] = function (newValue) { this.global[accessorName] = newValue }\n ApiMakerConfig.prototype[`get${camelizedAccessor}`] = function (...args) {\n if (!this.global[accessorName]) {\n if (accessorData.default) return accessorData.default\n if (accessorData.required) throw new Error(`${accessorName} hasn't been set`)\n }\n\n const value = this.global[accessorName]\n\n if (typeof value == \"function\") return value(...args)\n\n return value\n }\n}\n\nconst apiMakerConfig = new ApiMakerConfig()\n\nexport default apiMakerConfig\n","import BaseError from \"./base-error.mjs\"\n\nclass CustomError extends BaseError {}\n\nCustomError.apiMakerType = \"CustomError\"\n\nexport default CustomError\n","import {digg} from \"diggerize\"\nimport * as inflection from \"inflection\"\nimport modelClassRequire from \"./model-class-require.mjs\"\nimport ModelsResponseReader from \"./models-response-reader.mjs\"\nimport Money from \"js-money\"\n\nexport default class ApiMakerDeserializer {\n static parse (object) {\n if (Array.isArray(object)) {\n return object.map((value) => ApiMakerDeserializer.parse(value))\n } else if (object && typeof object == \"object\") {\n if (object.api_maker_type == \"date\") {\n const date = new Date(digg(object, \"value\"))\n\n date.apiMakerType = \"date\"\n\n return date\n } else if (object.api_maker_type == \"time\") {\n const date = new Date(digg(object, \"value\"))\n\n date.apiMakerType = \"time\"\n\n return date\n } else if (object.api_maker_type == \"collection\") {\n // Need to remove type to avoid circular error\n const {api_maker_type, ...restObject} = object\n\n return ModelsResponseReader.collection(ApiMakerDeserializer.parse(restObject))\n } else if (object.api_maker_type == \"money\") {\n const cents = digg(object, \"amount\")\n const currency = digg(object, \"currency\")\n\n return Money.fromInteger(cents, currency)\n } else if (object.api_maker_type == \"model\") {\n const modelClassName = inflection.classify(digg(object, \"model_name\"))\n const ModelClass = modelClassRequire(modelClassName)\n const data = ApiMakerDeserializer.parse(digg(object, \"serialized\"))\n const model = new ModelClass({data, isNewRecord: false})\n\n return model\n } else if (object.api_maker_type == \"resource\") {\n const modelClassName = inflection.classify(digg(object, \"name\"))\n const ModelClass = modelClassRequire(modelClassName)\n\n return ModelClass\n } else {\n const newObject = {}\n\n for (const key in object) {\n const value = object[key]\n newObject[key] = ApiMakerDeserializer.parse(value)\n }\n\n return newObject\n }\n } else {\n return object\n }\n }\n}\n","import CanCan from \"./can-can.mjs\"\nimport Deserializer from \"./deserializer.mjs\"\nimport {digg} from \"diggerize\"\nimport events from \"./events.mjs\"\nimport * as inflection from \"inflection\"\nimport modelClassRequire from \"./model-class-require.mjs\"\nimport Services from \"./services.mjs\"\n\nconst shared = {}\n\nexport default class ApiMakerDevise {\n static callSignOutEvent(args) {\n events.emit(\"onDeviseSignOut\", {args})\n }\n\n static current() {\n if (!shared.currentApiMakerDevise) {\n shared.currentApiMakerDevise = new ApiMakerDevise()\n }\n\n return shared.currentApiMakerDevise\n }\n\n static events() {\n return events\n }\n\n static addUserScope(scope) {\n const currentMethodName = `current${inflection.camelize(scope)}`\n\n ApiMakerDevise[currentMethodName] = () => ApiMakerDevise.current().getCurrentScope(scope)\n\n const isSignedInMethodName = `is${inflection.camelize(scope)}SignedIn`\n\n ApiMakerDevise[isSignedInMethodName] = () => Boolean(ApiMakerDevise.current().getCurrentScope(scope))\n }\n\n static async signIn(username, password, args = {}) {\n if (!args.scope) args.scope = \"user\"\n\n const postData = {username, password, args}\n const response = await Services.current().sendRequest(\"Devise::SignIn\", postData)\n\n let model = response.model\n\n if (Array.isArray(model)) model = model[0]\n\n await CanCan.current().resetAbilities()\n\n ApiMakerDevise.updateSession(model)\n events.emit(\"onDeviseSignIn\", Object.assign({username}, args))\n\n return {model, response}\n }\n\n static updateSession(model, args = {}) {\n if (!args.scope) args.scope = \"user\"\n\n const camelizedScopeName = inflection.camelize(args.scope, true)\n\n ApiMakerDevise.current().currents[camelizedScopeName] = model\n }\n\n hasCurrentScope(scope) {\n const camelizedScopeName = inflection.camelize(scope, true)\n\n return camelizedScopeName in ApiMakerDevise.current().currents\n }\n\n static setSignedOut(args) {\n ApiMakerDevise.current().currents[inflection.camelize(args.scope, true)] = null\n }\n\n static async signOut(args = {}) {\n if (!args.scope) {\n args.scope = \"user\"\n }\n\n const response = await Services.current().sendRequest(\"Devise::SignOut\", {args})\n\n await CanCan.current().resetAbilities()\n\n // Cannot use the class because they would both import each other\n if (shared.apiMakerSessionStatusUpdater) {\n shared.apiMakerSessionStatusUpdater.updateSessionStatus()\n }\n\n ApiMakerDevise.setSignedOut(args)\n ApiMakerDevise.callSignOutEvent(args)\n\n return response\n }\n\n constructor() {\n this.currents = {}\n }\n\n getCurrentScope(scope) {\n if (!(scope in this.currents)) {\n this.currents[scope] = this.loadCurrentScope(scope)\n }\n\n return this.currents[scope]\n }\n\n hasGlobalCurrentScope(scope) {\n if (globalThis.apiMakerDeviseCurrent && scope in globalThis.apiMakerDeviseCurrent) {\n return true\n }\n\n return false\n }\n\n loadCurrentScope(scope) {\n if (!this.hasGlobalCurrentScope(scope)) {\n return null\n }\n\n const scopeData = globalThis.apiMakerDeviseCurrent[scope]\n\n if (!scopeData) return null\n\n const parsedScopeData = Deserializer.parse(scopeData)\n\n // Might be a collection with preloaded relationships\n if (Array.isArray(parsedScopeData)) return parsedScopeData[0]\n\n const ModelClass = modelClassRequire(scope)\n const modelInstance = new ModelClass({data: parsedScopeData})\n\n return modelInstance\n }\n}\n","var UNKNOWN_FUNCTION = '';\n/**\n * This parses the different stack traces and puts them into one format\n * This borrows heavily from TraceKit (https://github.com/csnover/TraceKit)\n */\n\nfunction parse(stackString) {\n var lines = stackString.split('\\n');\n return lines.reduce(function (stack, line) {\n var parseResult = parseChrome(line) || parseWinjs(line) || parseGecko(line) || parseNode(line) || parseJSC(line);\n\n if (parseResult) {\n stack.push(parseResult);\n }\n\n return stack;\n }, []);\n}\nvar chromeRe = /^\\s*at (.*?) ?\\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\\/|[a-z]:\\\\|\\\\\\\\).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nvar chromeEvalRe = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\nfunction parseChrome(line) {\n var parts = chromeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n\n var submatch = chromeEvalRe.exec(parts[2]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n\n parts[3] = submatch[2]; // line\n\n parts[4] = submatch[3]; // column\n }\n\n return {\n file: !isNative ? parts[2] : null,\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: isNative ? [parts[2]] : [],\n lineNumber: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar winjsRe = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseWinjs(line) {\n var parts = winjsRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar geckoRe = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nvar geckoEvalRe = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nfunction parseGecko(line) {\n var parts = geckoRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n var submatch = geckoEvalRe.exec(parts[3]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: parts[2] ? parts[2].split(',') : [],\n lineNumber: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar javaScriptCoreRe = /^\\s*(?:([^@]*)(?:\\((.*?)\\))?@)?(\\S.*?):(\\d+)(?::(\\d+))?\\s*$/i;\n\nfunction parseJSC(line) {\n var parts = javaScriptCoreRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[4],\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar nodeRe = /^\\s*at (?:((?:\\[object object\\])?[^\\\\/]+(?: \\[as \\S+\\])?) )?\\(?(.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseNode(line) {\n var parts = nodeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nexport { parse };\n","import * as stackTraceParser from \"stacktrace-parser\"\nimport Logger from \"./logger.mjs\"\nimport {SourceMapConsumer} from \"source-map\"\nimport uniqunize from \"uniqunize\"\n\n// Sometimes this needs to be called and sometimes not\nif (SourceMapConsumer.initialize) {\n SourceMapConsumer.initialize({\n \"lib/mappings.wasm\": \"https://unpkg.com/source-map@0.7.3/lib/mappings.wasm\"\n })\n}\n\nconst logger = new Logger({name: \"ApiMaker / SourceMapsLoader\"})\n\nexport default class SourceMapsLoader {\n constructor() {\n this.isLoadingSourceMaps = false\n this.sourceMaps = []\n this.srcLoaded = {}\n }\n\n loadSourceMapsForScriptTags(callback) {\n this.loadSourceMapsForScriptTagsCallback = callback\n }\n\n sourceMapForSource(callback) {\n this.sourceMapForSourceCallback = callback\n }\n\n async loadSourceMaps(error) {\n if (!error) throw new Error(\"No error was given to SourceMapsLoader#loadSourceMaps\")\n\n this.isLoadingSourceMaps = true\n\n try {\n const promises = []\n const sources = this.getSources(error)\n\n for(const source of sources) {\n if (source.originalUrl && !this.srcLoaded[source.originalUrl]) {\n this.srcLoaded[source.originalUrl] = true\n\n const promise = this.loadSourceMapForSource(source)\n promises.push(promise)\n }\n }\n\n await Promise.all(promises)\n } finally {\n this.isLoadingSourceMaps = false\n }\n }\n\n getSources(error) {\n let sources = this.getSourcesFromScripts()\n\n if (error) sources = sources.concat(this.getSourcesFromError(error))\n\n return uniqunize(sources, (source) => source.originalUrl)\n }\n\n getSourcesFromError(error) {\n const stack = stackTraceParser.parse(error.stack)\n const sources = []\n\n for (const trace of stack) {\n const file = trace.file\n\n if (file != \"\\u003Canonymous>\") {\n const sourceMapUrl = this.getMapURL({src: file})\n\n if (sourceMapUrl) {\n logger.debug(() => `Found source map from error: ${sourceMapUrl}`)\n\n sources.push({originalUrl: file, sourceMapUrl})\n } else {\n logger.debug(() => `Coudn't get source map from: ${file}`)\n }\n }\n }\n\n return sources\n }\n\n getSourcesFromScripts() {\n const scripts = document.querySelectorAll(\"script\")\n const sources = []\n\n for (const script of scripts) {\n const sourceMapUrl = this.getMapURL({script, src: script.src})\n\n if (sourceMapUrl) {\n logger.debug(() => `Found source map from script: ${sourceMapUrl}`)\n sources.push({originalUrl: script.src, sourceMapUrl})\n }\n }\n\n return sources\n }\n\n getMapURL({script, src}) {\n const url = this.loadUrl(src)\n const originalUrl = `${url.origin}${url.pathname}`\n\n if (this.sourceMapForSourceCallback) {\n // Use custom callback to resolve which map-file to download\n return this.sourceMapForSourceCallback({originalUrl, script, src, url})\n } else if (this.includeMapURL(src)) {\n // Default to original URL with '.map' appended\n return `${originalUrl}.map`\n }\n }\n\n includeMapURL = (src) => src.includes(\"/packs/\")\n\n async loadSourceMapForSource({originalUrl, sourceMapUrl}) {\n const xhr = new XMLHttpRequest()\n\n xhr.open(\"GET\", sourceMapUrl, true)\n\n await this.loadXhr(xhr)\n\n const consumer = await new SourceMapConsumer(xhr.responseText)\n\n this.sourceMaps.push({consumer, originalUrl})\n }\n\n loadUrl(url) {\n const parser = document.createElement(\"a\")\n\n parser.href = url\n\n return parser\n }\n\n loadXhr(xhr, postData) {\n return new Promise((resolve) => {\n xhr.onload = () => resolve()\n xhr.send(postData)\n })\n }\n\n parseStackTrace(stackTrace) {\n return this.getStackTraceData(stackTrace)\n .map((traceData) => `at ${traceData.methodName} (${traceData.fileString})`)\n }\n\n getStackTraceData(stackTrace) {\n const stack = stackTraceParser.parse(stackTrace)\n const newSourceMap = []\n\n for (const trace of stack) {\n const sourceMapData = this.sourceMaps.find((sourceMapData) => sourceMapData.originalUrl == trace.file)\n\n let filePath, fileString, original\n\n if (sourceMapData) {\n original = sourceMapData.consumer.originalPositionFor({\n line: trace.lineNumber,\n column: trace.column\n })\n }\n\n if (original && original.source) {\n filePath = original.source.replace(/^webpack:\\/\\/(app|)\\//, \"\")\n fileString = `${filePath}:${original.line}`\n\n if (original.column) {\n fileString += `:${original.column}`\n }\n } else {\n filePath = trace.file\n fileString = `${filePath}:${trace.lineNumber}`\n\n if (trace.column) {\n fileString += `:${trace.column}`\n }\n }\n\n newSourceMap.push({\n filePath,\n fileString,\n methodName: trace.methodName\n })\n }\n\n return newSourceMap\n }\n}\n","import {digg} from \"diggerize\"\nimport SourceMapsLoader from \"./source-maps-loader.mjs\"\n\nexport default class ErrorLogger {\n constructor () {\n this.debugging = false\n this.errorOccurred = false\n this.errors = []\n this.isHandlingError = false\n this.sourceMapsLoader = new SourceMapsLoader()\n this.sourceMapsLoader.loadSourceMapsForScriptTags((script) => {\n const src = script.getAttribute(\"src\")\n const type = script.getAttribute(\"type\")\n\n if (src && (src.includes(\"/packs/\") || src.includes(\"/packs-test/\")) && (type == \"text/javascript\" || !type)) {\n return src\n }\n })\n }\n\n debug(...output) {\n if (this.debugging) console.error(`ApiMaker ErrorLogger:`, ...output)\n }\n\n enable () {\n this.debug(\"Enable called\")\n this.connectOnError()\n this.connectUnhandledRejection()\n }\n\n getErrors = () => this.errors\n\n hasErrorOccurred() {\n return digg(this, \"errorOccurred\")\n }\n\n isLoadingSourceMaps() {\n return digg(this, \"sourceMapsLoader\", \"isLoadingSourceMaps\")\n }\n\n isWorkingOnError() {\n return digg(this, \"isHandlingError\") || this.isLoadingSourceMaps()\n }\n\n connectOnError () {\n window.addEventListener(\"error\", (event) => {\n if (this.debugging) this.debug(`Error:`, event.message)\n this.errorOccurred = true\n\n if (!this.isHandlingError) {\n this.isHandlingError = true\n this.onError(event).finally(() => {\n this.isHandlingError = false\n })\n }\n })\n }\n\n connectUnhandledRejection () {\n window.addEventListener(\"unhandledrejection\", (event) => {\n if (this.debugging) this.debug(`Unhandled rejection:`, event.reason.message)\n this.errorOccurred = true\n\n if (!this.isHandlingError) {\n this.isHandlingError = true\n this.onUnhandledRejection(event).finally(() => {\n this.isHandlingError = false\n })\n }\n })\n }\n\n async onError (event) {\n this.errorOccurred = true\n await this.sourceMapsLoader.loadSourceMaps(event.error)\n\n if (event.error && event.error.stack) {\n const backtrace = this.sourceMapsLoader.parseStackTrace(event.error.stack)\n\n this.errors.push({\n errorClass: event.error ? event.error.name : \"No error class\",\n message: event.message || \"Unknown error\",\n backtrace\n })\n } else {\n this.errors.push({\n errorClass: event.error ? event.error.name : \"No error class\",\n message: event.message || \"Unknown error\",\n backtrace: null\n })\n }\n }\n\n async onUnhandledRejection (event) {\n await this.sourceMapsLoader.loadSourceMaps(event.reason)\n\n if (event.reason.stack) {\n const backtrace = this.sourceMapsLoader.parseStackTrace(event.reason.stack)\n\n this.errors.push({\n errorClass: \"UnhandledRejection\",\n message: event.reason.message || \"Unhandled promise rejection\",\n backtrace\n })\n } else {\n this.errors.push({\n errorClass: \"UnhandledRejection\",\n message: event.reason.message || \"Unhandled promise rejection\",\n backtrace: null\n })\n }\n }\n\n testPromiseError () {\n return new Promise((_resolve) => {\n throw new Error(\"testPromiseError\")\n })\n }\n}\n","import EventEmitter from \"events\"\n\nconst events = new EventEmitter()\n\nevents.setMaxListeners(1000)\n\nexport default events\n","const shared = {}\n\nexport default class ApiMakerLogger {\n static getGlobalDebug = () => shared.isDebugging\n\n static setGlobalDebug(newValue) {\n shared.isDebugging = newValue\n }\n\n constructor(args = {}) {\n this.name = args.name\n }\n\n debug(message) {\n if (this.getDebug()) {\n this.log(message)\n }\n }\n\n error(message) {\n console.error(message)\n }\n\n log(message) {\n if (!this.debug && !ApiMakerLogger.getGlobalDebug()) return\n if (typeof message == \"function\") message = message()\n if (!Array.isArray(message)) message = [message]\n if (this.name) message.unshift(`${this.name}:`)\n\n console.log(...message)\n }\n\n getDebug = () => this.isDebugging\n\n setDebug(value) {\n this.isDebugging = value\n }\n}\n","import * as inflection from \"inflection\"\nimport * as models from \"./models.mjs.erb\"\n\nexport default (modelName) => {\n const requireName = inflection.camelize(modelName)\n const ModelClass = models[requireName]\n\n if (!ModelClass) {\n const modelClasses = Object.keys(models).sort()\n\n throw new Error(`No model called ${modelName} in ${modelClasses.join(\", \")}`)\n }\n\n return ModelClass\n}\n","import {digg} from \"diggerize\"\n\nexport default class ApiMakerBaseModelColumn {\n constructor(columnData) {\n if (!columnData) {\n throw new Error(\"No column data was given\")\n }\n\n this.columnData = columnData\n }\n\n getType = () => digg(this, \"columnData\", \"type\")\n}\n","import Column from \"./column.mjs\"\nimport {digg} from \"diggerize\"\n\nexport default class ApiMakerBaseModelAttribute {\n constructor(attributeData) {\n this.attributeData = attributeData\n }\n\n getColumn() {\n if (!this.column) {\n const columnData = digg(this, \"attributeData\", \"column\")\n\n if (columnData) {\n this.column = new Column(columnData)\n }\n }\n\n return this.column\n }\n\n isColumn = () => Boolean(digg(this, \"attributeData\", \"column\"))\n\n isSelectedByDefault() {\n const isSelectedByDefault = digg(this, \"attributeData\", \"selected_by_default\")\n\n if (isSelectedByDefault || isSelectedByDefault === null) return true\n\n return false\n }\n\n isTranslated = () => digg(this, \"attributeData\", \"translated\")\n name = () => digg(this, \"attributeData\", \"name\")\n}\n","export default class AttributeNotLoadedError extends Error {}\n","import SparkMD5 from \"spark-md5\"\n\nexport default class CacheKeyGenerator {\n constructor(model) {\n this.model = model\n this.allModels = [model]\n this.readModels = {}\n this.recordModelType(model.modelClassData().name)\n this.recordModel(model.modelClassData().name, model)\n this.filledModels = false\n }\n\n local() {\n const md5 = new SparkMD5()\n\n this.feedModel(this.model, md5)\n\n return md5.end()\n }\n\n recordModelType(relationshipType) {\n if (!(relationshipType in this.readModels)) {\n this.readModels[relationshipType] = {}\n }\n }\n\n recordModel(relationshipType, model) {\n this.allModels.push(model)\n this.readModels[relationshipType][model.id() || model.uniqueKey()] = true\n }\n\n isModelRecorded(relationshipType, model) {\n if (model.id() in this.readModels[relationshipType]) {\n return true\n }\n }\n\n fillModels(model) {\n for (const relationshipType in model.relationships) {\n this.recordModelType(relationshipType)\n\n const loadedRelationship = model.relationships[relationshipType]\n\n if (Array.isArray(loadedRelationship)) { // has_many\n for (const anotherModel of loadedRelationship) {\n if (this.isModelRecorded(relationshipType, anotherModel)) {\n continue\n }\n\n this.recordModel(relationshipType, anotherModel)\n this.fillModels(anotherModel)\n }\n } else if (loadedRelationship) { // belongs_to, has_one\n if (this.isModelRecorded(relationshipType, loadedRelationship)) {\n continue\n }\n\n this.recordModel(relationshipType, loadedRelationship)\n this.fillModels(loadedRelationship)\n }\n }\n\n this.filledModels = true\n }\n\n cacheKey() {\n if (!this.filledModels) {\n this.fillModels(this.model)\n }\n\n const md5 = new SparkMD5()\n\n for (const model of this.allModels) {\n this.feedModel(model, md5)\n }\n\n return md5.end()\n }\n\n feedModel(model, md5) {\n md5.append(\"--model--\")\n md5.append(model.modelClassData().name)\n md5.append(\"--unique-key--\")\n md5.append(model.id() || model.uniqueKey())\n\n if (model.markedForDestruction()) {\n md5.append(\"--marked-for-destruction--\")\n }\n\n md5.append(\"-attributes-\")\n\n const attributes = model.attributes()\n\n for (const attributeName in attributes) {\n md5.append(attributeName)\n md5.append(\"--attribute--\")\n md5.append(`${model.readAttributeUnderscore(attributeName)}`)\n }\n }\n}\n","import Config from \"./config.mjs\"\nimport * as inflection from \"inflection\"\n\nexport default class ModelName {\n constructor(data) {\n this.data = data\n }\n\n camelizedLower = () => this.data.modelClassData.camelizedLower\n\n human(args) {\n let argsToUse = args\n\n if (!argsToUse) argsToUse = { count: 1 }\n\n let countKey\n\n if (argsToUse.count > 1 || argsToUse.count < 0) {\n countKey = \"other\"\n } else {\n countKey = \"one\"\n }\n\n const key = `activerecord.models.${this.data.modelClassData.i18nKey}.${countKey}`\n let defaultModelName = this.data.modelClassData.name\n\n if (args?.count > 1) defaultModelName = inflection.pluralize(defaultModelName)\n\n return Config.getI18n().t(key, {defaultValue: defaultModelName})\n }\n\n paramKey = () => this.data.modelClassData.paramKey\n}\n","export default class NotLoadedError extends Error {}\n","import {digg} from \"diggerize\"\nimport * as inflection from \"inflection\"\nimport modelClassRequire from \"../model-class-require.mjs\"\n\nexport default class ApiMakerBaseModelReflection {\n constructor(reflectionData) {\n this.reflectionData = reflectionData\n }\n\n foreignKey = () => digg(this, \"reflectionData\", \"foreignKey\")\n macro = () => digg(this, \"reflectionData\", \"macro\")\n modelClass = () => modelClassRequire(inflection.singularize(inflection.camelize(digg(this, \"reflectionData\", \"resource_name\"))))\n name = () => inflection.camelize(digg(this, \"reflectionData\", \"name\"), true)\n through = () => digg(this, \"reflectionData\", \"through\")\n}\n","import {digg} from \"diggerize\"\nimport * as inflection from \"inflection\"\n\nexport default class ApiMakerBaseModelScope {\n constructor(scopeData) {\n this.scopeData = scopeData\n }\n\n name() {\n return inflection.camelize(digg(this, \"scopeData\", \"name\"), true)\n }\n}\n","import Attribute from \"./base-model/attribute.mjs\"\nimport AttributeNotLoadedError from \"./attribute-not-loaded-error.mjs\"\nimport CacheKeyGenerator from \"./cache-key-generator.mjs\"\nimport Collection from \"./collection.mjs\"\nimport CommandsPool from \"./commands-pool.mjs\"\nimport Config from \"./config.mjs\"\nimport CustomError from \"./custom-error.mjs\"\nimport {digg} from \"diggerize\"\nimport FormDataObjectizer from \"form-data-objectizer\"\nimport * as inflection from \"inflection\"\nimport ModelName from \"./model-name.mjs\"\nimport NotLoadedError from \"./not-loaded-error.mjs\"\nimport objectToFormData from \"object-to-formdata\"\nimport Reflection from \"./base-model/reflection.mjs\"\nimport Scope from \"./base-model/scope.mjs\"\nimport Services from \"./services.mjs\"\nimport ValidationError from \"./validation-error.mjs\"\nimport {ValidationErrors} from \"./validation-errors.mjs\"\n\nconst objectToUnderscore = (object) => {\n const newObject = {}\n\n for (const key in object) {\n const underscoreKey = inflection.underscore(key)\n\n newObject[underscoreKey] = object[key]\n }\n\n return newObject\n}\n\nexport default class BaseModel {\n static apiMakerType = \"BaseModel\"\n\n static attributes() {\n const attributes = digg(this.modelClassData(), \"attributes\")\n const result = []\n\n for (const attributeKey in attributes) {\n const attributeData = attributes[attributeKey]\n const attribute = new Attribute(attributeData)\n\n result.push(attribute)\n }\n\n return result\n }\n\n static hasAttribute(attributeName) {\n const attributes = digg(this.modelClassData(), \"attributes\")\n const lowerCaseAttributeName = inflection.underscore(attributeName)\n\n if (lowerCaseAttributeName in attributes) return true\n\n return false\n }\n\n static modelClassData() {\n throw new Error(\"modelClassData should be overriden by child\")\n }\n\n static newCustomEvent = (validationErrors) => {\n return new CustomEvent(\"validation-errors\", {detail: validationErrors})\n }\n\n static sendValidationErrorsEvent = (validationErrors, options) => {\n if (options && options.form) {\n const event = BaseModel.newCustomEvent(validationErrors)\n options.form.dispatchEvent(event)\n }\n }\n\n static async find(id) {\n const query = {}\n\n query[`${this.primaryKey()}_eq`] = id\n\n const model = await this.ransack(query).first()\n\n if (model) {\n return model\n } else {\n throw new CustomError(\"Record not found\")\n }\n }\n\n static async findOrCreateBy(findOrCreateByArgs, args = {}) {\n const result = await Services.current().sendRequest(\"Models::FindOrCreateBy\", {\n additional_data: args.additionalData,\n find_or_create_by_args: findOrCreateByArgs,\n resource_name: digg(this.modelClassData(), \"name\")\n })\n const model = digg(result, \"model\")\n\n return model\n }\n\n static modelName() {\n return new ModelName({modelClassData: this.modelClassData()})\n }\n\n static primaryKey() {\n return digg(this.modelClassData(), \"primaryKey\")\n }\n\n static ransack(query = {}) {\n return new Collection({modelClass: this}, {ransack: query})\n }\n\n static select(select) {\n return this.ransack().select(select)\n }\n\n static ransackableAssociations() {\n const relationships = digg(this.modelClassData(), \"ransackable_associations\")\n const reflections = []\n\n for (const relationshipData of relationships) {\n reflections.push(new Reflection(relationshipData))\n }\n\n return reflections\n }\n\n static ransackableAttributes() {\n const attributes = digg(this.modelClassData(), \"ransackable_attributes\")\n const result = []\n\n for (const attributeData of attributes) {\n result.push(new Attribute(attributeData))\n }\n\n return result\n }\n\n static ransackableScopes() {\n const ransackableScopes = digg(this.modelClassData(), \"ransackable_scopes\")\n const result = []\n\n for (const scopeData of ransackableScopes) {\n const scope = new Scope(scopeData)\n\n result.push(scope)\n }\n\n return result\n }\n\n static reflections() {\n const relationships = digg(this.modelClassData(), \"relationships\")\n const reflections = []\n\n for (const relationshipData of relationships) {\n const reflection = new Reflection(relationshipData)\n\n reflections.push(reflection)\n }\n\n return reflections\n }\n\n static reflection(name) {\n const foundReflection = this.reflections().find((reflection) => reflection.name() == name)\n\n if (!foundReflection) {\n throw new Error(`No such reflection: ${name} in ${this.reflections().map((reflection) => reflection.name()).join(\", \")}`)\n }\n\n return foundReflection\n }\n\n static _token() {\n const csrfTokenElement = document.querySelector(\"meta[name='csrf-token']\")\n\n if (csrfTokenElement) {\n return csrfTokenElement.getAttribute(\"content\")\n }\n }\n\n constructor(args = {}) {\n this.changes = {}\n this.newRecord = args.isNewRecord\n this.relationshipsCache = {}\n this.relationships = {}\n\n if (args && args.data && args.data.a) {\n this._readModelDataFromArgs(args)\n } else if (args.a) {\n this.abilities = args.b || {}\n this.modelData = objectToUnderscore(args.a)\n } else if (args) {\n this.abilities = {}\n this.modelData = objectToUnderscore(args)\n } else {\n this.abilities = {}\n this.modelData = {}\n }\n }\n\n assignAttributes(newAttributes) {\n for (const key in newAttributes) {\n const newValue = newAttributes[key]\n const attributeUnderscore = inflection.underscore(key)\n\n let applyChange = true\n let deleteChange = false\n\n if (this.isAttributeLoaded(key)) {\n const oldValue = this.readAttribute(key)\n const originalValue = this.modelData[attributeUnderscore]\n\n if (newValue == oldValue) {\n applyChange = false\n } else if (newValue == originalValue) {\n applyChange = false\n deleteChange = true\n }\n }\n\n if (applyChange) {\n this.changes[attributeUnderscore] = newValue\n } else if (deleteChange) {\n delete this.changes[attributeUnderscore]\n }\n }\n }\n\n attributes() {\n const result = {}\n\n for (const key in this.modelData) {\n result[key] = this.modelData[key]\n }\n\n for (const key in this.changes) {\n result[key] = this.changes[key]\n }\n\n return result\n }\n\n can(givenAbilityName) {\n const abilityName = inflection.underscore(givenAbilityName)\n\n if (!(abilityName in this.abilities)) {\n throw new Error(`Ability ${abilityName} hasn't been loaded for ${digg(this.modelClassData(), \"name\")}`)\n }\n\n return this.abilities[abilityName]\n }\n\n clone() {\n const clone = new this.constructor()\n\n clone.abilities = {...this.abilities}\n clone.modelData = {...this.modelData}\n clone.relationships = {...this.relationships}\n clone.relationshipsCache = {...this.relationshipsCache}\n\n return clone\n }\n\n cacheKey() {\n if (this.isPersisted()) {\n const keyParts = [\n this.modelClassData().paramKey,\n this.primaryKey()\n ]\n\n if (\"updated_at\" in this.modelData) {\n const updatedAt = this.updatedAt()\n\n if (typeof updatedAt != \"object\") {\n throw new Error(`updatedAt wasn't an object: ${typeof updatedAt}`)\n } else if (!(\"getTime\" in updatedAt)) {\n throw new Error(`updatedAt didn't support getTime with class: ${updatedAt.constructor && updatedAt.constructor.name}`)\n }\n\n keyParts.push(`updatedAt-${this.updatedAt().getTime()}`)\n }\n\n return keyParts.join(\"-\")\n } else {\n return this.uniqueKey()\n }\n }\n\n localCacheKey() {\n const cacheKeyGenerator = new CacheKeyGenerator(this)\n\n return cacheKeyGenerator.local()\n }\n\n fullCacheKey() {\n const cacheKeyGenerator = new CacheKeyGenerator(this)\n\n return cacheKeyGenerator.cacheKey()\n }\n\n static all() {\n return this.ransack()\n }\n\n async create(attributes, options) {\n if (attributes) this.assignAttributes(attributes)\n const paramKey = this.modelClassData().paramKey\n const modelData = this.getAttributes()\n const dataToUse = {}\n dataToUse[paramKey] = modelData\n let response\n\n try {\n response = await CommandsPool.addCommand(\n {\n args: {\n save: dataToUse\n },\n command: `${this.modelClassData().collectionName}-create`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"create\"\n },\n {}\n )\n } catch (error) {\n BaseModel.parseValidationErrors({error, model: this, options})\n throw error\n }\n\n if (response.model) {\n this._refreshModelFromResponse(response)\n this.changes = {}\n }\n\n return {model: this, response}\n }\n\n async createRaw(rawData, options = {}) {\n const objectData = BaseModel._objectDataFromGivenRawData(rawData, options)\n\n let response\n\n try {\n response = await CommandsPool.addCommand(\n {\n args: {\n save: objectData\n },\n command: `${this.modelClassData().collectionName}-create`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"create\"\n },\n {}\n )\n } catch (error) {\n BaseModel.parseValidationErrors({error, model: this, options})\n throw error\n }\n\n if (response.model) {\n this._refreshModelDataFromResponse(response)\n this.changes = {}\n }\n\n return {model: this, response}\n }\n\n async destroy() {\n const response = await CommandsPool.addCommand(\n {\n args: {query_params: this.collection && this.collection.params()},\n command: `${this.modelClassData().collectionName}-destroy`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"destroy\"\n },\n {}\n )\n\n if (response.success) {\n if (response.model) {\n this._refreshModelDataFromResponse(response)\n this.changes = {}\n }\n\n return {model: this, response}\n } else {\n this.handleResponseError(response)\n }\n }\n\n async ensureAbilities(listOfAbilities) {\n // Populate an array with a list of abilities currently not loaded\n const abilitiesToLoad = []\n\n for (const abilityInList of listOfAbilities) {\n if (!(abilityInList in this.abilities)) {\n abilitiesToLoad.push(abilityInList)\n }\n }\n\n // Load the missing abilities if any\n if (abilitiesToLoad.length > 0) {\n const primaryKeyName = this.constructor.primaryKey()\n const ransackParams = {}\n ransackParams[`${primaryKeyName}_eq`] = this.primaryKey()\n\n const abilitiesParams = {}\n abilitiesParams[digg(this.modelClassData(), \"name\")] = abilitiesToLoad\n\n const anotherModel = await this.constructor\n .ransack(ransackParams)\n .abilities(abilitiesParams)\n .first()\n\n if (!anotherModel) {\n throw new Error(`Could not look up the same model ${this.primaryKey()} with abilities: ${abilitiesToLoad.join(\", \")}`)\n }\n\n const newAbilities = anotherModel.abilities\n for (const newAbility in newAbilities) {\n this.abilities[newAbility] = newAbilities[newAbility]\n }\n }\n }\n\n getAttributes = () => Object.assign(this.modelData, this.changes)\n\n handleResponseError(response) {\n BaseModel.parseValidationErrors({model: this, response})\n throw new new CustomError(\"Response wasn't successful\", {model: this, response})\n }\n\n identifierKey() {\n if (!this._identifierKey) this._identifierKey = this.isPersisted() ? this.primaryKey() : this.uniqueKey()\n\n return this._identifierKey\n }\n\n isAssociationLoaded = (associationName) => this.isAssociationLoadedUnderscore(inflection.underscore(associationName))\n isAssociationLoadedUnderscore (associationNameUnderscore) {\n if (associationNameUnderscore in this.relationshipsCache) return true\n return false\n }\n\n isAssociationPresent(associationName) {\n if (this.isAssociationLoaded(associationName)) return true\n if (associationName in this.relationships) return true\n return false\n }\n\n static parseValidationErrors({error, model, options}) {\n if (!(error instanceof ValidationError)) return\n if (!error.args.response.validation_errors) return\n\n const validationErrors = new ValidationErrors({\n model,\n validationErrors: digg(error, \"args\", \"response\", \"validation_errors\")\n })\n\n BaseModel.sendValidationErrorsEvent(validationErrors, options)\n\n if (!options || options.throwValidationError != false) {\n throw error\n }\n }\n\n static humanAttributeName(attributeName) {\n const keyName = digg(this.modelClassData(), \"i18nKey\")\n const i18n = Config.getI18n()\n\n if (i18n) return i18n.t(`activerecord.attributes.${keyName}.${BaseModel.snakeCase(attributeName)}`, {defaultValue: attributeName})\n\n return inflection.humanize(attributeName)\n }\n\n isAttributeChanged(attributeName) {\n const attributeNameUnderscore = inflection.underscore(attributeName)\n const attributeData = this.modelClassData().attributes.find((attribute) => digg(attribute, \"name\") == attributeNameUnderscore)\n\n if (!attributeData) {\n const attributeNames = this.modelClassData().attributes.map((attribute) => digg(attribute, \"name\"))\n\n throw new Error(`Couldn't find an attribute by that name: \"${attributeName}\" in: ${attributeNames.join(\", \")}`)\n }\n\n if (!(attributeNameUnderscore in this.changes))\n return false\n\n const oldValue = this.modelData[attributeNameUnderscore]\n const newValue = this.changes[attributeNameUnderscore]\n const changedMethod = this[`_is${inflection.camelize(attributeData.type, true)}Changed`]\n\n if (!changedMethod)\n throw new Error(`Don't know how to handle type: ${attributeData.type}`)\n\n return changedMethod(oldValue, newValue)\n }\n\n isChanged() {\n const keys = Object.keys(this.changes)\n\n if (keys.length > 0) {\n return true\n } else {\n return false\n }\n }\n\n isNewRecord() {\n if (this.newRecord !== undefined) {\n return this.newRecord\n } else if (\"id\" in this.modelData && this.modelData.id) {\n return false\n } else {\n return true\n }\n }\n\n isPersisted = () => !this.isNewRecord()\n\n static snakeCase = (string) => inflection.underscore(string)\n\n savedChangeToAttribute(attributeName) {\n if (!this.previousModelData)\n return false\n\n const attributeNameUnderscore = inflection.underscore(attributeName)\n const attributeData = this.modelClassData().attributes.find((attribute) => attribute.name == attributeNameUnderscore)\n\n if (!attributeData) {\n const attributeNames = this.modelClassData().attributes.map((attribute) => attribute.name)\n throw new Error(`Couldn't find an attribute by that name: \"${attributeName}\" in: ${attributeNames.join(\", \")}`)\n }\n\n if (!(attributeNameUnderscore in this.previousModelData))\n return true\n\n const oldValue = this.previousModelData[attributeNameUnderscore]\n const newValue = this.modelData[attributeNameUnderscore]\n const changedMethodName = `_is${inflection.camelize(attributeData.type)}Changed`\n const changedMethod = this[changedMethodName]\n\n if (!changedMethod)\n throw new Error(`Don't know how to handle type: ${attributeData.type}`)\n\n return changedMethod(oldValue, newValue)\n }\n\n setNewModel(model) {\n this.setNewModelData(model)\n\n for(const relationshipName in model.relationships) {\n this.relationships[relationshipName] = model.relationships[relationshipName]\n }\n\n for(const relationshipCacheName in model.relationshipsCache) {\n this.relationshipsCache[relationshipCacheName] = model.relationshipsCache[name]\n }\n }\n\n setNewModelData(model) {\n if (!(\"modelData\" in model)) throw new Error(`No modelData in model: ${JSON.stringify(model)}`)\n\n this.previousModelData = Object.assign({}, digg(this, \"modelData\"))\n\n for(const attributeName in model.modelData) {\n this.modelData[attributeName] = model.modelData[attributeName]\n }\n }\n\n _isDateChanged(oldValue, newValue) {\n if (Date.parse(oldValue) != Date.parse(newValue))\n return true\n }\n\n _isIntegerChanged(oldValue, newValue) {\n if (parseInt(oldValue, 10) != parseInt(newValue, 10))\n return true\n }\n\n _isStringChanged (oldValue, newValue) {\n const oldConvertedValue = `${oldValue}`\n const newConvertedValue = `${newValue}`\n\n if (oldConvertedValue != newConvertedValue)\n return true\n }\n\n modelClassData = () => this.constructor.modelClassData()\n\n async reload() {\n const params = this.collection && this.collection.params()\n const ransackParams = {}\n ransackParams[`${this.constructor.primaryKey()}_eq`] = this.primaryKey()\n\n let query = this.constructor.ransack(ransackParams)\n\n if (params) {\n if (params.preload) {\n query.queryArgs.preload = params.preload\n }\n\n if (params.select) {\n query.queryArgs.select = params.select\n }\n\n if (params.select_columns) {\n query.queryArgs.selectColumns = params.select_columns\n }\n }\n\n const model = await query.first()\n this.setNewModel(model)\n this.changes = {}\n }\n\n save() {\n if (this.isNewRecord()) {\n return this.create()\n } else {\n return this.update()\n }\n }\n\n saveRaw(rawData, options = {}) {\n if (this.isNewRecord()) {\n return this.createRaw(rawData, options)\n } else {\n return this.updateRaw(rawData, options)\n }\n }\n\n async update(newAttributes, options) {\n if (newAttributes) {\n this.assignAttributes(newAttributes)\n }\n\n if (Object.keys(this.changes).length == 0) {\n return {model: this}\n }\n\n const paramKey = this.modelClassData().paramKey\n const modelData = this.changes\n const dataToUse = {}\n dataToUse[paramKey] = modelData\n let response\n\n try {\n response = await CommandsPool.addCommand(\n {\n args: {\n query_params: this.collection && this.collection.params(),\n save: dataToUse\n },\n command: `${this.modelClassData().collectionName}-update`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"update\"\n },\n {}\n )\n } catch (error) {\n BaseModel.parseValidationErrors({error, model: this, options})\n throw error\n }\n\n if (response.success) {\n if (response.model) {\n this._refreshModelFromResponse(response)\n this.changes = {}\n }\n\n return {response, model: this}\n } else {\n this.handleResponseError(response)\n }\n }\n\n _refreshModelFromResponse(response) {\n let newModel = digg(response, \"model\")\n\n if (Array.isArray(newModel)) newModel = newModel[0]\n\n this.setNewModel(newModel)\n }\n\n _refreshModelDataFromResponse(response) {\n let newModel = digg(response, \"model\")\n\n if (Array.isArray(newModel)) newModel = newModel[0]\n\n this.setNewModelData(newModel)\n }\n\n static _objectDataFromGivenRawData(rawData, options) {\n if (rawData instanceof FormData || rawData.nodeName == \"FORM\") {\n const formData = FormDataObjectizer.formDataFromObject(rawData, options)\n\n return FormDataObjectizer.toObject(formData)\n }\n\n return rawData\n }\n\n async updateRaw(rawData, options = {}) {\n const objectData = BaseModel._objectDataFromGivenRawData(rawData, options)\n let response\n\n try {\n response = await CommandsPool.addCommand(\n {\n args: {\n query_params: this.collection && this.collection.params(),\n save: objectData,\n simple_model_errors: options?.simpleModelErrors\n },\n command: `${this.modelClassData().collectionName}-update`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"update\"\n },\n {}\n )\n } catch (error) {\n BaseModel.parseValidationErrors({error, model: this, options})\n throw error\n }\n\n if (response.model) {\n this._refreshModelFromResponse(response)\n this.changes = {}\n }\n\n return {response, model: this}\n }\n\n isValid() {\n throw new Error(\"Not implemented yet\")\n }\n\n async isValidOnServer() {\n const modelData = this.getAttributes()\n const paramKey = this.modelClassData().paramKey\n const dataToUse = {}\n dataToUse[paramKey] = modelData\n\n const response = await CommandsPool.addCommand(\n {\n args: {\n save: dataToUse\n },\n command: `${this.modelClassData().collectionName}-valid`,\n collectionName: this.modelClassData().collectionName,\n primaryKey: this.primaryKey(),\n type: \"valid\"\n },\n {}\n )\n\n return {valid: response.valid, errors: response.errors}\n }\n\n modelClass = () => this.constructor\n\n preloadRelationship(relationshipName, model) {\n this.relationshipsCache[BaseModel.snakeCase(relationshipName)] = model\n this.relationships[BaseModel.snakeCase(relationshipName)] = model\n }\n\n markForDestruction() {\n this._markedForDestruction = true\n }\n\n markedForDestruction = () => this._markedForDestruction\n\n uniqueKey() {\n if (!this.uniqueKeyValue) {\n const min = 5000000000000000\n const max = 9007199254740991\n const randomBetween = Math.floor(Math.random() * (max - min + 1) + min)\n this.uniqueKeyValue = randomBetween\n }\n\n return this.uniqueKeyValue\n }\n\n static async _callCollectionCommand(args, commandArgs) {\n const formOrDataObject = args.args\n\n try {\n return await CommandsPool.addCommand(args, commandArgs)\n } catch (error) {\n let form\n\n if (commandArgs.form) {\n form = commandArgs.form\n } else if (formOrDataObject?.nodeName == \"FORM\") {\n form = formOrDataObject\n }\n\n if (form) BaseModel.parseValidationErrors({error, options: {form}})\n\n throw error\n }\n }\n\n _callMemberCommand = (args, commandArgs) => CommandsPool.addCommand(args, commandArgs)\n\n static _postDataFromArgs(args) {\n let postData\n\n if (args) {\n if (args instanceof FormData) {\n postData = args\n } else {\n postData = objectToFormData.serialize(args, {}, null, \"args\")\n }\n } else {\n postData = new FormData()\n }\n\n return postData\n }\n\n readAttribute(attributeName) {\n const attributeNameUnderscore = inflection.underscore(attributeName)\n\n return this.readAttributeUnderscore(attributeNameUnderscore)\n }\n\n readAttributeUnderscore(attributeName) {\n if (attributeName in this.changes) {\n return this.changes[attributeName]\n } else if (attributeName in this.modelData) {\n return this.modelData[attributeName]\n } else if (this.isNewRecord()) {\n // Return null if this is a new record and the attribute name is a recognized attribute\n const attributes = digg(this.modelClassData(), \"attributes\")\n\n if (attributeName in attributes) return null\n }\n\n if (this.isPersisted()) {\n throw new AttributeNotLoadedError(`No such attribute: ${digg(this.modelClassData(), \"name\")}#${attributeName}: ${JSON.stringify(this.modelData)}`)\n }\n }\n\n isAttributeLoaded(attributeName) {\n const attributeNameUnderscore = inflection.underscore(attributeName)\n\n if (attributeNameUnderscore in this.changes) return true\n if (attributeNameUnderscore in this.modelData) return true\n return false\n }\n\n _isPresent(value) {\n if (!value) {\n return false\n } else if (typeof value == \"string\" && value.match(/^\\s*$/)) {\n return false\n }\n\n return true\n }\n\n async _loadBelongsToReflection(args, queryArgs = {}) {\n if (args.reflectionName in this.relationships) {\n return this.relationships[args.reflectionName]\n } else if (args.reflectionName in this.relationshipsCache) {\n return this.relationshipsCache[args.reflectionName]\n } else {\n const collection = new Collection(args, queryArgs)\n const model = await collection.first()\n this.relationshipsCache[args.reflectionName] = model\n return model\n }\n }\n\n _readBelongsToReflection({reflectionName}) {\n if (reflectionName in this.relationships) {\n return this.relationships[reflectionName]\n } else if (reflectionName in this.relationshipsCache) {\n return this.relationshipsCache[reflectionName]\n }\n\n if (this.isNewRecord()) return null\n\n const loadedRelationships = Object.keys(this.relationshipsCache)\n const modelClassName = digg(this.modelClassData(), \"name\")\n\n throw new NotLoadedError(`${modelClassName}#${reflectionName} hasn't been loaded yet. Only these were loaded: ${loadedRelationships.join(\", \")}`)\n }\n\n async _loadHasManyReflection(args, queryArgs = {}) {\n if (args.reflectionName in this.relationships) {\n return this.relationships[args.reflectionName]\n } else if (args.reflectionName in this.relationshipsCache) {\n return this.relationshipsCache[args.reflectionName]\n }\n\n const collection = new Collection(args, queryArgs)\n const models = await collection.toArray()\n\n this.relationshipsCache[args.reflectionName] = models\n\n return models\n }\n\n async _loadHasOneReflection(args, queryArgs = {}) {\n if (args.reflectionName in this.relationships) {\n return this.relationships[args.reflectionName]\n } else if (args.reflectionName in this.relationshipsCache) {\n return this.relationshipsCache[args.reflectionName]\n } else {\n const collection = new Collection(args, queryArgs)\n const model = await collection.first()\n\n this.relationshipsCache[args.reflectionName] = model\n\n return model\n }\n }\n\n _readHasOneReflection({reflectionName}) {\n if (reflectionName in this.relationships) {\n return this.relationships[reflectionName]\n } else if (reflectionName in this.relationshipsCache) {\n return this.relationshipsCache[reflectionName]\n }\n\n if (this.isNewRecord()) {\n return null\n }\n\n const loadedRelationships = Object.keys(this.relationshipsCache)\n const modelClassName = digg(this.modelClassData(), \"name\")\n\n throw new NotLoadedError(`${modelClassName}#${reflectionName} hasn't been loaded yet. Only these were loaded: ${loadedRelationships.join(\", \")}`)\n }\n\n _readModelDataFromArgs(args) {\n this.abilities = args.data.b || {}\n this.collection = args.collection\n this.modelData = objectToUnderscore(args.data.a)\n this.preloadedRelationships = args.data.r\n }\n\n _readPreloadedRelationships(preloaded) {\n if (!this.preloadedRelationships) {\n return\n }\n\n const relationships = digg(this.modelClassData(), \"relationships\")\n\n for (const relationshipName in this.preloadedRelationships) {\n const relationshipData = this.preloadedRelationships[relationshipName]\n const relationshipClassData = relationships.find((relationship) => digg(relationship, \"name\") == relationshipName)\n\n if (!relationshipClassData) {\n const modelName = digg(this.modelClassData(), \"name\")\n const relationshipsList = relationships.map((relationship) => relationship.name).join(\", \")\n\n throw new Error(`Could not find the relation ${relationshipName} on the ${modelName} model: ${relationshipsList}`)\n }\n\n const relationshipType = digg(relationshipClassData, \"collectionName\")\n\n if (relationshipName in this.relationshipsCache) {\n throw new Error(`${relationshipName} has already been loaded`)\n }\n\n if (!relationshipClassData) {\n throw new Error(`No relationship on ${digg(this.modelClassData(), \"name\")} by that name: ${relationshipName}`)\n }\n\n if (!relationshipData) {\n this.relationshipsCache[relationshipName] = null\n this.relationships[relationshipName] = null\n } else if (Array.isArray(relationshipData)) {\n this.relationshipsCache[relationshipName] = []\n this.relationships[relationshipName] = []\n\n for (const relationshipId of relationshipData) {\n const model = preloaded.getModel(relationshipType, relationshipId)\n\n this.relationshipsCache[relationshipName].push(model)\n this.relationships[relationshipName].push(model)\n }\n } else {\n const model = preloaded.getModel(relationshipType, relationshipData)\n\n this.relationshipsCache[relationshipName] = model\n this.relationships[relationshipName] = model\n }\n }\n }\n\n primaryKey = () => this.readAttributeUnderscore(this.constructor.primaryKey())\n}\n","import BaseModel from \"./base-model.mjs\"\nimport Collection from \"./collection.mjs\"\nimport {digg, digs} from \"diggerize\"\nimport * as inflection from \"inflection\"\n\nexport default class ApiMakerModelRecipesModelLoader {\n constructor ({modelRecipe, modelRecipesLoader}) {\n if (!modelRecipe) throw new Error(\"No 'modelRecipe' was given\")\n\n this.modelRecipesLoader = modelRecipesLoader\n this.modelRecipe = modelRecipe\n }\n\n createClass () {\n const {modelRecipe} = digs(this, \"modelRecipe\")\n const {\n attributes,\n collection_commands: collectionCommands,\n member_commands: memberCommands,\n model_class_data: modelClassData,\n relationships\n } = digs(\n modelRecipe,\n \"attributes\",\n \"collection_commands\",\n \"member_commands\",\n \"model_class_data\",\n \"relationships\"\n )\n const {name: modelClassName} = digs(modelClassData, \"name\")\n const ModelClass = class ApiMakerModel extends BaseModel { }\n\n Object.defineProperty(ModelClass, \"name\", {writable: false, value: modelClassName})\n\n ModelClass.prototype.constructor.modelClassData = () => modelClassData\n\n this.addAttributeMethodsToModelClass(ModelClass, attributes)\n this.addRelationshipsToModelClass(ModelClass, modelClassData, relationships)\n this.addQueryCommandsToModelClass(ModelClass, collectionCommands)\n this.addMemberCommandsToModelClass(ModelClass, memberCommands)\n\n return ModelClass\n }\n\n addAttributeMethodsToModelClass (ModelClass, attributes) {\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName]\n const {name} = digs(attribute, \"name\")\n const methodName = inflection.camelize(name, true)\n const hasMethodName = inflection.camelize(`has_${name}`, true)\n\n ModelClass.prototype[methodName] = function () {\n return this.readAttributeUnderscore(attributeName)\n }\n\n ModelClass.prototype[hasMethodName] = function () {\n const value = this[methodName]()\n\n return this._isPresent(value)\n }\n }\n }\n\n addQueryCommandsToModelClass (ModelClass, collectionCommands) {\n for (const collectionCommandName in collectionCommands) {\n const methodName = inflection.camelize(collectionCommandName, true)\n\n ModelClass[methodName] = function (args, commandArgs = {}) {\n return this._callCollectionCommand(\n {\n args,\n command: collectionCommandName,\n collectionName: digg(this.modelClassData(), \"collectionName\"),\n type: \"collection\"\n },\n commandArgs\n )\n }\n }\n }\n\n addMemberCommandsToModelClass (ModelClass, memberCommands) {\n for (const memberCommandName in memberCommands) {\n const methodName = inflection.camelize(memberCommandName, true)\n\n ModelClass.prototype[methodName] = function (args, commandArgs = {}) {\n return this._callMemberCommand(\n {\n args,\n command: memberCommandName,\n primaryKey: this.primaryKey(),\n collectionName: this.modelClassData().collectionName,\n type: \"member\"\n },\n commandArgs\n )\n }\n }\n }\n\n addRelationshipsToModelClass (ModelClass, modelClassData, relationships) {\n const {modelRecipesLoader} = digs(this, \"modelRecipesLoader\")\n\n for (const relationshipName in relationships) {\n const relationship = relationships[relationshipName]\n const {\n active_record: {\n name: activeRecordName,\n primary_key: activeRecordPrimaryKey\n },\n class_name: className,\n foreign_key: foreignKey,\n klass: {primary_key: klassPrimaryKey},\n options: {as: optionsAs, primary_key: optionsPrimaryKey, through: optionsThrough},\n resource_name: resourceName,\n type\n } = digs(\n relationship,\n \"active_record\",\n \"class_name\",\n \"foreign_key\",\n \"klass\",\n \"options\",\n \"resource_name\",\n \"type\"\n )\n const loadMethodName = inflection.camelize(`load_${relationshipName}`, true)\n const modelMethodName = inflection.camelize(relationshipName, true)\n\n if (type == \"belongs_to\") {\n this.defineBelongsToGetMethod({ModelClass, modelMethodName, relationshipName})\n this.defineBelongsToLoadMethod({\n foreignKey,\n klassPrimaryKey,\n loadMethodName,\n ModelClass,\n modelRecipesLoader,\n optionsPrimaryKey,\n relationshipName,\n resourceName\n })\n } else if (type == \"has_many\") {\n this.defineHasManyGetMethod({\n activeRecordName,\n className,\n foreignKey,\n ModelClass,\n modelMethodName,\n modelRecipesLoader,\n optionsAs,\n optionsPrimaryKey,\n optionsThrough,\n relationshipName,\n resourceName\n })\n this.defineHasManyLoadMethod({foreignKey, loadMethodName, ModelClass, modelClassData, modelRecipesLoader, relationshipName, resourceName})\n } else if (type == \"has_one\") {\n this.defineHasOneGetMethd({ModelClass, modelMethodName, relationshipName})\n this.defineHasOneLoadMethod({\n activeRecordPrimaryKey,\n foreignKey,\n loadMethodName,\n ModelClass,\n modelClassData,\n modelRecipesLoader,\n optionsThrough,\n relationshipName,\n resourceName\n })\n } else {\n throw new Error(`Unknown relationship type: ${type}`)\n }\n }\n }\n\n defineBelongsToGetMethod ({ModelClass, modelMethodName, relationshipName}) {\n ModelClass.prototype[modelMethodName] = function () {\n return this._readBelongsToReflection({reflectionName: relationshipName})\n }\n }\n\n defineBelongsToLoadMethod ({foreignKey, klassPrimaryKey, ModelClass, modelRecipesLoader, loadMethodName, optionsPrimaryKey, relationshipName, resourceName}) {\n ModelClass.prototype[loadMethodName] = function () {\n const foreignKeyMethodName = inflection.camelize(foreignKey, true)\n\n if (!(foreignKeyMethodName in this)) throw new Error(`Foreign key method wasn't defined: ${foreignKeyMethodName}`)\n\n const id = this[foreignKeyMethodName]()\n const modelClass = modelRecipesLoader.getModelClass(resourceName)\n const ransack = {}\n const ransackIdSearchKey = `${optionsPrimaryKey || klassPrimaryKey}_eq`\n\n ransack[ransackIdSearchKey] = id\n\n return this._loadBelongsToReflection(\n {reflectionName: relationshipName, model: this, modelClass},\n {ransack}\n )\n }\n }\n\n defineHasManyGetMethod ({\n activeRecordName,\n className,\n foreignKey,\n ModelClass,\n modelMethodName,\n modelRecipesLoader,\n optionsAs,\n optionsPrimaryKey,\n optionsThrough,\n relationshipName,\n resourceName\n }) {\n ModelClass.prototype[modelMethodName] = function () {\n const id = this.primaryKey()\n const modelClass = modelRecipesLoader.getModelClass(resourceName)\n const ransack = {}\n\n ransack[`${foreignKey}_eq`] = id\n\n const hasManyParameters = {\n reflectionName: relationshipName,\n model: this,\n modelName: className,\n modelClass\n }\n\n let queryParameters\n\n if (optionsThrough) {\n queryParameters = {\n params: {\n through: {\n model: activeRecordName,\n id: this.primaryKey(),\n reflection: relationshipName\n }\n }\n }\n } else {\n const ransack = {}\n const primaryKeyColumnName = optionsPrimaryKey || digg(ModelClass.modelClassData(), \"primaryKey\")\n const primaryKeyMethodName = inflection.camelize(primaryKeyColumnName, true)\n\n if (!(primaryKeyMethodName in this)) throw new Error(`No such primary key method: ${primaryKeyMethodName}`)\n\n ransack[`${foreignKey}_eq`] = this[primaryKeyMethodName]()\n\n if (optionsAs) {\n ransack[`${optionsAs}_type_eq`] = activeRecordName\n }\n\n queryParameters = {ransack}\n }\n\n return new Collection(hasManyParameters, queryParameters)\n }\n }\n\n defineHasManyLoadMethod ({foreignKey, loadMethodName, ModelClass, modelClassData, modelRecipesLoader, optionsThrough, relationshipName, resourceName}) {\n ModelClass.prototype[loadMethodName] = function () {\n const id = this.primaryKey()\n const modelClass = modelRecipesLoader.getModelClass(resourceName)\n\n if (optionsThrough) {\n const modelClassName = digg(modelClassData, \"className\")\n\n return this._loadHasManyReflection(\n {\n reflectionName: relationshipName,\n model: this,\n modelClass\n },\n {\n params: {\n through: {\n model: modelClassName,\n id,\n reflection: relationshipName\n }\n }\n }\n )\n } else {\n const ransack = {}\n\n ransack[`${foreignKey}_eq`] = id\n\n return this._loadHasManyReflection(\n {\n reflectionName: relationshipName,\n model: this,\n modelClass\n },\n {ransack}\n )\n }\n }\n }\n\n defineHasOneGetMethd ({ModelClass, modelMethodName, relationshipName}) {\n ModelClass.prototype[modelMethodName] = function () {\n return this._readHasOneReflection({reflectionName: relationshipName})\n }\n }\n\n defineHasOneLoadMethod ({\n activeRecordPrimaryKey,\n foreignKey,\n loadMethodName,\n ModelClass,\n modelClassData,\n modelRecipesLoader,\n optionsThrough,\n relationshipName,\n resourceName\n }) {\n ModelClass.prototype[loadMethodName] = function () {\n const primaryKeyMethodName = inflection.camelize(activeRecordPrimaryKey, true)\n\n if (!(primaryKeyMethodName in this)) throw new Error(`Primary key method wasn't defined: ${primaryKeyMethodName}`)\n\n const id = this[primaryKeyMethodName]()\n const modelClass = modelRecipesLoader.getModelClass(resourceName)\n\n if (optionsThrough) {\n const modelClassName = digg(modelClassData, \"className\")\n\n return this._loadHasOneReflection(\n {reflectionName: relationshipName, model: this, modelClass},\n {params: {through: {model: modelClassName, id, reflection: relationshipName}}}\n )\n } else {\n const ransack = {}\n\n ransack[`${foreignKey}_eq`] = id\n\n return this._loadHasOneReflection(\n {\n reflectionName: relationshipName,\n model: this,\n modelClass\n },\n {ransack}\n )\n }\n }\n }\n}\n","import {digg, digs} from \"diggerize\"\nimport ModelRecipesModelLoader from \"./model-recipes-model-loader.mjs\"\n\nexport default class ModelRecipesLoader {\n constructor ({recipes}) {\n this.modelClasses = {}\n this.recipes = recipes\n }\n\n getModelClass (name) {\n return digg(this, \"modelClasses\", name)\n }\n\n load () {\n const {recipes} = digs(this, \"recipes\")\n const {models} = digs(recipes, \"models\")\n\n for (const modelName in models) {\n const modelRecipe = models[modelName]\n const modelClassLoader = new ModelRecipesModelLoader({modelRecipe, modelRecipesLoader: this})\n const modelClass = modelClassLoader.createClass()\n\n this.modelClasses[modelName] = modelClass\n }\n\n return this.modelClasses\n }\n}\n","import * as inflection from \"inflection\"\nimport modelClassRequire from \"./model-class-require.mjs\"\n\nexport default class ApiMakerPreloaded {\n constructor (response) {\n this.response = response\n this.loadPreloadedModels()\n }\n\n loadPreloadedModels () {\n this.preloaded = {}\n\n for (const preloadedType in this.response.preloaded) {\n const modelClassName = inflection.classify(preloadedType)\n const ModelClass = modelClassRequire(modelClassName)\n\n for (const preloadedId in this.response.preloaded[preloadedType]) {\n const preloadedData = this.response.preloaded[preloadedType][preloadedId]\n const model = new ModelClass({data: preloadedData, isNewRecord: false})\n\n if (!this.preloaded[preloadedType]) {\n this.preloaded[preloadedType] = {}\n }\n\n this.preloaded[preloadedType][preloadedId] = model\n }\n }\n\n for (const modelType in this.preloaded) {\n for (const modelId in this.preloaded[modelType]) {\n this.preloaded[modelType][modelId]._readPreloadedRelationships(this)\n }\n }\n }\n\n getModel (type, id) {\n if (!this.preloaded[type] || !this.preloaded[type][id]) {\n throw new Error(`Could not find a ${type} by that ID: ${id}`)\n }\n\n return this.preloaded[type][id]\n }\n}\n","import * as inflection from \"inflection\"\nimport modelClassRequire from \"./model-class-require.mjs\"\nimport Preloaded from \"./preloaded.mjs\"\n\nexport default class ModelsResponseReader {\n static first (response) {\n return ModelsResponseReader.collection(response)[0]\n }\n\n static collection (response) {\n const reader = new ModelsResponseReader({response})\n return reader.models()\n }\n\n constructor (args) {\n this.collection = args.collection\n this.response = args.response\n }\n\n models () {\n const preloaded = new Preloaded(this.response)\n const models = []\n\n for (const modelType in this.response.data) {\n const modelClassName = inflection.classify(modelType)\n const ModelClass = modelClassRequire(modelClassName)\n const collectionName = ModelClass.modelClassData().collectionName\n\n for (const modelId of this.response.data[modelType]) {\n const modelData = this.response.preloaded[collectionName][modelId]\n\n if (!modelData)\n throw new Error(`Couldn't find model data for ${collectionName}(${modelId})`)\n\n const model = new ModelClass({\n collection: this.collection,\n data: modelData,\n isNewRecord: false\n })\n\n model._readPreloadedRelationships(preloaded)\n models.push(model)\n }\n }\n\n return models\n }\n}\n","export default class ApiMakerResult {\n constructor (data) {\n this.data = data\n }\n\n count = () => this.data.response.meta.count\n currentPage = () => this.data.response.meta.currentPage\n models = () => this.data.models\n modelClass = () => this.data.collection.modelClass()\n perPage = () => this.data.response.meta.perPage\n totalCount = () => this.data.response.meta.totalCount\n totalPages = () => this.data.response.meta.totalPages\n}\n","import {dig, digg, digs} from \"diggerize\"\nimport * as inflection from \"inflection\"\nimport qs from \"qs\"\nimport urlEncode from \"./url-encode.mjs\"\n\nexport default class ApiMakerRoutesNative {\n constructor ({getLocale}) {\n this.getLocale = getLocale\n this.routeDefinitions = []\n this.routeTranslationParts = {}\n }\n\n loadRouteDefinitions (routeDefinitions, routeDefinitionArgs) {\n for (const routeDefinition of digg(routeDefinitions, \"routes\")) {\n const {name, path} = digs(routeDefinition, \"name\", \"path\")\n const rawPathParts = path.split(\"/\")\n const pathMethodName = `${inflection.camelize(name, true)}Path`\n const urlMethodName = `${inflection.camelize(name, true)}Url`\n\n if (routeDefinitionArgs && routeDefinitionArgs.localized) {\n const localizedRoutes = {}\n\n for (const locale in this.routeTranslationParts) {\n let variableCount = 0\n\n const localizedPathParts = [\n {type: \"pathPart\", name: \"\"},\n {type: \"pathPart\", name: locale}\n ]\n\n for (let i = 1; i < rawPathParts.length; i++) {\n const pathPart = rawPathParts[i]\n const variableMatch = pathPart.match(/^:([A-z_]+)$/)\n\n if (variableMatch) {\n localizedPathParts.push({type: \"variable\", count: variableCount++})\n } else if (pathPart) {\n const name = this.i18n.t(`routes.${pathPart}`, null, {default: pathPart, locale})\n\n localizedPathParts.push({type: \"pathPart\", name})\n }\n }\n\n localizedRoutes[locale] = localizedPathParts\n }\n\n this[pathMethodName] = (...args) => this.translateRoute({args, localizedRoutes})\n this[urlMethodName] = (...args) => this.translateRoute({args, localizedRoutes, url: true})\n } else {\n let variableCount = 0\n\n const pathParts = rawPathParts.map((pathPart) => {\n const variableMatch = pathPart.match(/^:([A-z_]+)$/)\n\n if (variableMatch) {\n return {type: \"variable\", count: variableCount}\n } else {\n return {type: \"pathPart\", name: pathPart}\n }\n })\n\n this[pathMethodName] = (...args) => this.translateRoute({args, pathParts})\n this[urlMethodName] = (...args) => this.translateRoute({args, pathParts, url: true})\n }\n }\n }\n\n loadRouteTranslations (i18n) {\n this.i18n = i18n\n const locales = digg(i18n, \"locales\")\n\n for (const locale in locales) {\n const routeTranslations = dig(locales, locale, \"routes\")\n\n if (!routeTranslations) continue\n if (!(locale in this.routeTranslationParts)) this.routeTranslationParts[locale] = {}\n\n for (const key in routeTranslations) {\n this.routeTranslationParts[locale][key] = routeTranslations[key]\n }\n }\n }\n\n translateRoute ({args, localizedRoutes, pathParts, url}) {\n let options\n\n // Extract options from args if any\n const lastArg = args[args.length - 1]\n\n if (lastArg && typeof lastArg == \"object\") {\n options = args.pop()\n } else {\n options = {}\n }\n\n // Take locale from options if given or fall back to fallback\n const {locale, host, port, protocol, ...restOptions} = options\n\n if (localizedRoutes) {\n // Put together route with variables and static translated parts (which were translated and cached previously)\n let translatedRoute = digg(localizedRoutes, locale || this.getLocale())\n .map((pathPart) => {\n if (pathPart.type == \"pathPart\") {\n return pathPart.name\n } else if (pathPart.type == \"variable\") {\n // Args might not contain the right amount of variables, so dont change this to 'digg'\n return dig(args, digg(pathPart, \"count\"))\n } else {\n throw new Error(`Unhandled path part type: ${pathPart.type}`)\n }\n })\n .join(\"/\")\n\n if (restOptions && Object.keys(restOptions).length > 0) {\n translatedRoute += `?${qs.stringify(restOptions, {encoder: urlEncode})}`\n }\n\n if (url) return this.addHostToRoute({host, port, protocol, translatedRoute})\n\n return translatedRoute\n } else if (pathParts) {\n // Put together route with variables and static translated parts (which were translated and cached previously)\n let translatedRoute = pathParts\n .map((pathPart) => {\n if (pathPart.type == \"pathPart\") {\n return pathPart.name\n } else if (pathPart.type == \"variable\") {\n return digg(args, digg(pathPart, \"count\"))\n } else {\n throw new Error(`Unhandled path part type: ${pathPart.type}`)\n }\n })\n .join(\"/\")\n\n if (restOptions && Object.keys(restOptions).length > 0) {\n translatedRoute += `?${qs.stringify(restOptions, {encoder: urlEncode})}`\n }\n\n if (url) return this.addHostToRoute({host, port, protocol, translatedRoute})\n\n return translatedRoute\n }\n\n throw new Error(\"Unhandled state\")\n }\n\n addHostToRoute ({host, port, protocol, translatedRoute}) {\n let fullUrl = \"\"\n\n const hostToUse = host || globalThis.location && globalThis.location.host\n const portToUse = port || globalThis.location && globalThis.location.port\n\n if (!hostToUse) throw new Error(\"Unable to detect host\")\n\n if (protocol) {\n fullUrl += `${protocol}://`\n } else if (globalThis.location && globalThis.location.protocol) {\n fullUrl += `${globalThis.location.protocol}//`\n } else {\n fullUrl += \"https://\"\n }\n\n fullUrl += hostToUse\n\n if (portToUse && ((protocol == \"http\" && portToUse != 80) || (protocol == \"https\" && port != 443))) {\n fullUrl += `:${portToUse}`\n }\n\n fullUrl += translatedRoute\n\n return fullUrl\n }\n}\n","export default class RunLast {\n constructor(callback) {\n if (!callback) throw new Error(\"Empty callback given\")\n\n this.callback = callback\n }\n\n // Try to batch calls to backend while waiting for the event-queue-call to clear any other jobs before the request and reset on every flush call\n // If only waiting a single time, then other event-queue-jobs might be before us and queue other jobs that might queue calls to the backend\n queue() {\n this.flushTriggerCount = 0\n this.clearTimeout()\n this.flushTrigger()\n }\n\n flushTrigger = () => {\n if (this.flushTriggerCount >= 10) {\n this.run()\n } else {\n this.flushTriggerCount++\n this.flushTriggerQueue()\n }\n }\n\n flushTriggerQueue() {\n this.flushTimeout = setTimeout(this.flushTrigger, 0)\n }\n\n clearTimeout() {\n if (this.flushTimeout) {\n clearTimeout(this.flushTimeout)\n }\n }\n\n run() {\n this.clearTimeout()\n this.callback()\n }\n}\n","import CommandsPool from \"./commands-pool.mjs\"\n\nconst shared = {}\n\nexport default class ApiMakerServices {\n static current () {\n if (!shared.currentApiMakerService) shared.currentApiMakerService = new ApiMakerServices()\n\n return shared.currentApiMakerService\n }\n\n sendRequest (serviceName, args) {\n return CommandsPool.addCommand({\n args: {\n service_args: args,\n service_name: serviceName\n },\n command: \"services\",\n collectionName: \"calls\",\n type: \"service\"\n })\n }\n}\n","import config from \"./config.mjs\"\nimport Devise from \"./devise.mjs\"\nimport * as inflection from \"inflection\"\nimport Logger from \"./logger.mjs\"\nimport wakeEvent from \"wake-event\"\n\nconst logger = new Logger({name: \"ApiMaker / SessionStatusUpdater\"})\nconst shared = {}\n\n// logger.setDebug(true)\n\nexport default class ApiMakerSessionStatusUpdater {\n static current(args) {\n if (!shared.apiMakerSessionStatusUpdater) {\n shared.apiMakerSessionStatusUpdater = new ApiMakerSessionStatusUpdater(args)\n }\n\n return shared.apiMakerSessionStatusUpdater\n }\n\n constructor(args = {}) {\n this.events = {}\n this.timeout = args.timeout || 600000\n this.useMetaElement = (\"useMetaElement\" in args) ? args.useMetaElement : true\n\n this.connectOnlineEvent()\n this.connectWakeEvent()\n }\n\n connectOnlineEvent() {\n window.addEventListener(\"online\", this.updateSessionStatus, false)\n }\n\n connectWakeEvent() {\n wakeEvent(this.updateSessionStatus)\n }\n\n async getCsrfToken() {\n if (this.csrfToken) {\n logger.debug(`Get CSRF token from set variable: ${this.csrfToken}`)\n\n return this.csrfToken\n }\n\n if (this.useMetaElement) {\n const csrfTokenElement = document.querySelector(\"meta[name='csrf-token']\")\n\n if (csrfTokenElement) {\n logger.debug(() => `Get CSRF token from meta element: ${csrfTokenElement.getAttribute(\"content\")}`)\n\n this.csrfToken = csrfTokenElement.getAttribute(\"content\")\n\n return this.csrfToken\n }\n }\n\n logger.debug(\"Updating session status because no CSRF token set yet\")\n await this.updateSessionStatus()\n\n if (this.csrfToken) {\n logger.debug(() => `Returning CSRF token after updating session status: ${this.csrfToken}`)\n\n return this.csrfToken\n }\n\n throw new Error(\"CSRF token hasn't been set\")\n }\n\n sessionStatus() {\n return new Promise((resolve) => {\n const host = config.getHost()\n let requestPath = \"\"\n\n if (host) requestPath += host\n\n requestPath += \"/api_maker/session_statuses\"\n\n const xhr = new XMLHttpRequest()\n xhr.open(\"POST\", requestPath, true)\n xhr.onload = () => {\n const response = JSON.parse(xhr.responseText)\n resolve(response)\n }\n xhr.send()\n })\n }\n\n onSignedOut(callback) {\n this.addEvent(\"onSignedOut\", callback)\n }\n\n startTimeout() {\n logger.debug(\"startTimeout\")\n\n if (this.updateTimeout)\n clearTimeout(this.updateTimeout)\n\n this.updateTimeout = setTimeout(\n () => {\n this.startTimeout()\n this.updateSessionStatus()\n },\n this.timeout\n )\n }\n\n stopTimeout() {\n if (this.updateTimeout)\n clearTimeout(this.updateTimeout)\n }\n\n updateSessionStatus = async () => {\n logger.debug(\"updateSessionStatus\")\n\n const result = await this.sessionStatus()\n\n logger.debug(() => `Result: ${JSON.stringify(result, null, 2)}`)\n this.updateMetaElementsFromResult(result)\n this.updateUserSessionsFromResult(result)\n }\n\n updateMetaElementsFromResult(result) {\n logger.debug(\"updateMetaElementsFromResult\")\n\n this.csrfToken = result.csrf_token\n\n if (this.useMetaElement) {\n const csrfTokenElement = document.querySelector(\"meta[name='csrf-token']\")\n\n if (csrfTokenElement) {\n logger.debug(() => `Changing token from \"${csrfTokenElement.getAttribute(\"content\")}\" to \"${result.csrf_token}\"`)\n csrfTokenElement.setAttribute(\"content\", result.csrf_token)\n } else {\n logger.debug(\"csrf token element couldn't be found\")\n }\n }\n }\n\n updateUserSessionsFromResult(result) {\n for (const scopeName in result.scopes) {\n this.updateUserSessionScopeFromResult(scopeName, result.scopes[scopeName])\n }\n }\n\n updateUserSessionScopeFromResult(scopeName, scope) {\n const deviseIsSignedInMethodName = `is${inflection.camelize(scopeName)}SignedIn`\n\n if (!(deviseIsSignedInMethodName in Devise)) {\n throw new Error(`No such method in Devise: ${deviseIsSignedInMethodName}`)\n }\n\n const currentlySignedIn = Devise[deviseIsSignedInMethodName]()\n const signedInOnBackend = scope.signed_in\n\n if (currentlySignedIn && !signedInOnBackend) {\n logger.debug(() => `${inflection.camelize(scopeName)} signed in on frontend but not in backend!`)\n\n Devise.setSignedOut({scope: scopeName})\n Devise.callSignOutEvent({scope: scopeName})\n }\n }\n}\n","import escapeStringRegexp from \"escape-string-regexp\"\n\nconst replaces = {\n \" \": \"+\",\n \"&\": \"%26\",\n \"#\": \"%23\",\n \"+\": \"%2B\",\n \"/\": \"%2F\",\n \"?\": \"%3F\"\n}\n\nconst regexp = new RegExp(`(${Object.keys(replaces).map(escapeStringRegexp).join(\"|\")})`, \"g\")\n\nconst urlEncode = (string) => {\n return String(string).replaceAll(regexp, (character) => replaces[character])\n}\n\nexport default urlEncode\n","import {useLayoutEffect} from \"react\"\n\nconst ApiMakerUseEventEmitter = (events, event, onCalled) => {\n useLayoutEffect(() => {\n if (events) {\n events.addListener(event, onCalled)\n\n return () => {\n events.removeListener(event, onCalled)\n }\n }\n }, [events, event, onCalled])\n}\n\nexport default ApiMakerUseEventEmitter\n","import {useCallback, useLayoutEffect} from \"react\"\n\nconst ApiMakerUseEventListener = (target, event, onCalled) => {\n const onCalledCallback = useCallback((...args) => {\n onCalled.apply(null, args)\n }, [target, event, onCalled])\n\n useLayoutEffect(() => {\n if (target) {\n target.addEventListener(event, onCalledCallback)\n\n return () => {\n target.removeEventListener(event, onCalledCallback)\n }\n }\n }, [target, event, onCalled])\n}\n\nexport default ApiMakerUseEventListener\n","import BaseError from \"./base-error.mjs\"\nimport * as inflection from \"inflection\"\n\nclass ValidationError extends BaseError {\n constructor(validationErrors, args) {\n const errorMessage = validationErrors.getUnhandledErrorMessage() || validationErrors.getErrorMessage()\n const forwardedArgs = {addResponseErrorsToErrorMessage: false}\n const newArgs = Object.assign({}, args, forwardedArgs)\n\n super(errorMessage, newArgs)\n this.validationErrors = validationErrors\n }\n\n getUnhandledErrors = () => this.validationErrors.getValidationErrors().filter((validationError) => !validationError.getHandled())\n getValidationErrors = () => digg(this, \"validationErrors\")\n\n hasUnhandledErrors() {\n const unhandledError = this.validationErrors.getValidationErrors().find((validationError) => !validationError.getHandled())\n\n return Boolean(unhandledError)\n }\n\n hasValidationErrorForAttribute(attributeName) {\n const underscoredAttributeName = inflection.underscore(attributeName)\n const foundAttribute = this.validationErrors.getValidationErrors().find((validationError) => validationError.getAttributeName() == underscoredAttributeName)\n\n if (foundAttribute) return true\n\n return false\n }\n}\n\nValidationError.apiMakerType = \"ValidationError\"\n\nexport default ValidationError\n","import {digg, digs} from \"diggerize\"\nimport * as inflection from \"inflection\"\nimport modelClassRequire from \"./model-class-require.mjs\"\n\nclass ValidationError {\n constructor(args) {\n this.attributeName = digg(args, \"attribute_name\")\n this.attributeType = digg(args, \"attribute_type\")\n this.errorMessages = digg(args, \"error_messages\")\n this.errorTypes = digg(args, \"error_types\")\n this.inputName = args.input_name\n this.handled = false\n this.modelName = digg(args, \"model_name\")\n }\n\n matchesAttributeAndInputName(attributeName, inputName) {\n if (this.getInputName() == inputName) return true\n if (!attributeName) return false\n\n // A relationship column ends with \"_id\". We should try for validation errors on an attribute without the \"_id\" as well\n const attributeNameIdMatch = attributeName.match(/^(.+)Id$/)\n if (!attributeNameIdMatch) return false\n\n const attributeNameWithoutId = inflection.underscore(attributeNameIdMatch[1])\n const attributeUnderScoreName = inflection.underscore(attributeName)\n const inputNameWithoutId = inputName.replace(`[${attributeUnderScoreName}]`, `[${attributeNameWithoutId}]`)\n\n if (this.getInputName() == inputNameWithoutId) return true\n\n return false\n }\n\n getAttributeName = () => digg(this, \"attributeName\")\n getErrorMessages = () => digg(this, \"errorMessages\")\n\n getFullErrorMessages() {\n const {attributeType} = digs(this, \"attributeType\")\n\n if (attributeType == \"base\") {\n return this.getErrorMessages()\n } else {\n const fullErrorMessages = []\n\n for (const errorMessage of this.getErrorMessages()) {\n const attributeHumanName = this.getModelClass().humanAttributeName(this.getAttributeName())\n fullErrorMessages.push(`${attributeHumanName} ${errorMessage}`)\n }\n\n return fullErrorMessages\n }\n }\n\n getHandled = () => digg(this, \"handled\")\n getInputName = () => digg(this, \"inputName\")\n\n getModelClass() {\n const modelName = inflection.classify(digg(this, \"modelName\"))\n\n return modelClassRequire(modelName)\n }\n\n setHandled() {\n this.handled = true\n }\n}\n\nclass ValidationErrors {\n constructor(args) {\n this.rootModel = digg(args, \"model\")\n this.validationErrors = digg(args, \"validationErrors\").map((validationError) => new ValidationError(validationError))\n }\n\n getErrorMessage() {\n const fullErrorMessages = []\n\n for (const validationError of this.validationErrors) {\n for (const fullErrorMessage of validationError.getFullErrorMessages()) {\n fullErrorMessages.push(fullErrorMessage)\n }\n }\n\n return fullErrorMessages.join(\". \")\n }\n\n getValidationErrors = () => this.validationErrors\n\n getValidationErrorsForInput ({attribute, inputName, onMatchValidationError}) {\n const validationErrors = this.validationErrors.filter((validationError) => {\n if (onMatchValidationError) {\n return onMatchValidationError(validationError)\n } else {\n return validationError.matchesAttributeAndInputName(attribute, inputName)\n }\n })\n\n validationErrors.map((validationError) => validationError.setHandled())\n\n return validationErrors\n }\n\n getUnhandledErrorMessage () {\n const unhandledValidationErrors = this.validationErrors.filter((validationError) => !validationError.getHandled())\n\n if (unhandledValidationErrors.length > 0) {\n const unhandledValidationErrorMessages = []\n\n for (const unhandledValidationError of unhandledValidationErrors) {\n for (const errorMessage of unhandledValidationError.getFullErrorMessages()) {\n unhandledValidationErrorMessages.push(errorMessage)\n }\n }\n\n return unhandledValidationErrorMessages.join(\". \")\n }\n }\n}\n\nexport {\n ValidationError,\n ValidationErrors\n}\n","export default class OnLocationChangedCallback {\n constructor(callbacksHandler, id, callback) {\n this.callback = callback\n this.callbacksHandler = callbacksHandler\n this.id = id\n this.callCallback = this.callCallback.bind(this)\n this.disconnect = this.disconnect.bind(this)\n }\n\n callCallback() {\n try {\n this.callback()\n } catch (error) {\n // Throw error in a callback to avoid interrupting other callbacks and properly.\n setTimeout(() => { throw error }, 0)\n }\n }\n\n disconnect() {\n delete this.callbacksHandler.callbacks[this.id]\n }\n}\n","import {digg} from \"diggerize\"\nimport OnLocationChangedCallback from \"./on-location-changed-callback.js\"\n\nclass CallbacksHandler {\n constructor() {\n this.callbacks = {}\n this.count = 0\n this.currentLocationHref = location.href\n }\n\n callCallbacks = () => {\n for (const count in this.callbacks) {\n this.callbacks[count].callCallback()\n }\n }\n\n connectMutationObserver() {\n const body = document.querySelector(\"body\")\n\n // Solution recommended various places on the internet is to observe for changed and then check if the location has changed.\n const observer = new MutationObserver(digg(this, \"onLocationMightHaveChanged\"))\n const config = {subtree: true, childList: true}\n\n observer.observe(body, config)\n observer.observe(document, config)\n }\n\n connectReactRouterHistory(history) {\n // A React Router history can be registered globally (must be imported before this file).\n history.listen(digg(this, \"onLocationMightHaveChanged\"))\n }\n\n connectWindowEvents() {\n // If the hash has changed then maybe the entire location has? Trying to catch location change as early as possible.\n window.addEventListener(\"hashchange\", digg(this, \"onLocationMightHaveChanged\"))\n\n // 'popstate' is only called doing certain actions (React Router won't trigger this for example).\n window.addEventListener(\"popstate\", digg(this, \"onLocationMightHaveChanged\"))\n }\n\n connectInterval = () => setInterval(digg(this, \"onLocationMightHaveChanged\"), 500)\n\n onLocationChanged = (givenCallback) => {\n this.count += 1\n\n const callback = new OnLocationChangedCallback(this, this.count, givenCallback)\n\n this.callbacks[this.count] = callback\n\n return callback\n }\n\n onLocationMightHaveChanged = () => {\n if (location.href != this.currentLocationHref) {\n this.currentLocationHref = location.href\n this.callCallbacks()\n }\n }\n}\n\n// Prevent anything from spawning multiple instances (which happened!)\nif (!globalThis.onLocationChangedCallbacksHandler) {\n globalThis.onLocationChangedCallbacksHandler = new CallbacksHandler()\n}\n\nconst callbacksHandler = globalThis.onLocationChangedCallbacksHandler\n\n// Export the single handler that is supposed to exist\nexport {callbacksHandler}\n","import {callbacksHandler} from \"./callbacks-handler.js\"\n\nconst onLocationChanged = (callback) => callbacksHandler.onLocationChanged(callback)\n\nexport default onLocationChanged\n","import onLocationChanged from \"./on-location-changed.js\"\nimport {useCallback, useEffect, useMemo, useState} from \"react\"\n\nconst usePath = () => {\n const [path, setPath] = useState(globalThis.location.pathname)\n const shared = useMemo(() => ({}), [])\n\n shared.path = path\n\n const onLocationChangedCallback = useCallback(() => {\n const newPath = globalThis.location.pathname\n\n if (newPath != shared.path) {\n setPath(newPath)\n }\n }, [])\n\n useEffect(() => {\n const onLocationChangedEvent = onLocationChanged(onLocationChangedCallback)\n\n return () => {\n onLocationChangedEvent.disconnect()\n }\n }, [])\n\n return path\n}\n\nexport default usePath\n","import {simpleObjectValuesDifferent} from \"./diff-utils.js\"\n\nconst memoCompareProps = (prevProps, nextProps, debug) => {\n if (debug) {\n console.log(\"memoCompareProps\", {prevProps, nextProps})\n }\n\n if (Object.keys(nextProps).length != Object.keys(prevProps).length) {\n if (debug) {\n console.log(`Keys length was different - prev ${Object.keys(prevProps).length} after ${Object.keys(nextProps).length}`)\n }\n\n return false\n }\n\n if (debug) {\n console.log(\"Running simpleObjectValuesDifferent\")\n }\n\n const result = simpleObjectValuesDifferent(nextProps, prevProps, {debug})\n\n if (debug) {\n console.log(`Was it different: ${result}`)\n }\n\n return !result\n}\n\nconst memoComparePropsWithDebug = (prevProps, nextProps) => memoCompareProps(prevProps, nextProps, true)\n\nexport {memoComparePropsWithDebug}\nexport default memoCompareProps\n","import memoCompareProps, {memoComparePropsWithDebug} from \"./memo-compare-props.js\"\nimport React from \"react\"\n\nconst memo = (component) => React.memo(component, memoCompareProps)\nconst memoWithDebug = (component) => React.memo(component, memoComparePropsWithDebug)\n\nexport {memoWithDebug}\nexport default memo\n","import {anythingDifferent} from \"./diff-utils.js\"\nimport {dig} from \"diggerize\"\nimport fetchingObject from \"fetching-object\"\nimport memoCompareProps from \"./memo-compare-props.js\"\nimport PropTypes from \"prop-types\"\nimport shared from \"./shared.js\"\nimport {useEffect, useMemo, useState} from \"react\"\n\nclass ShapeComponent {\n constructor(props) {\n this.props = props\n this.setStates = {}\n this.state = {}\n this.__firstRenderCompleted = false\n this.tt = fetchingObject(this)\n this.p = fetchingObject(() => this.props)\n this.s = fetchingObject(this.state)\n }\n\n setInstance(variables) {\n for (const name in variables) {\n this[name] = variables[name]\n }\n }\n\n setState(statesList, callback) {\n if (typeof statesList == \"function\") {\n statesList = statesList(this.state)\n }\n\n for (const stateName in statesList) {\n const newValue = statesList[stateName]\n\n if (!(stateName in this.setStates)) {\n throw new Error(`No such state: ${stateName}`)\n }\n\n this.setStates[stateName](newValue)\n }\n\n if (callback) {\n shared.renderingCallbacks.push(callback)\n }\n }\n\n stylingFor(stylingName, style = {}) {\n let customStyling = dig(this, \"props\", \"styles\", stylingName)\n\n if (typeof customStyling == \"function\") {\n customStyling = customStyling({state: this.state, style})\n }\n\n if (customStyling) {\n return Object.assign(style, customStyling)\n }\n\n return style\n }\n\n useState(stateName, defaultValue) {\n const [stateValue, setState] = useState(defaultValue)\n\n if (!(stateName in this.state)) {\n this.state[stateName] = stateValue\n this.setStates[stateName] = (newValue) => {\n if (anythingDifferent(this.state[stateName], newValue)) {\n let prevState\n\n if (this.componentDidUpdate) {\n prevState = Object.assign({}, this.state)\n }\n\n this.state[stateName] = newValue\n\n // Avoid React error if using set-state while rendering (like in a useMemo callback)\n if (shared.rendering > 0) {\n shared.renderingCallbacks.push(() => {\n setState(newValue)\n })\n } else {\n setState(newValue)\n }\n\n if (this.componentDidUpdate) {\n this.componentDidUpdate(this.props, prevState)\n }\n }\n }\n }\n\n return this.setStates[stateName]\n }\n\n useStates(statesList) {\n if (Array.isArray(statesList)) {\n for(const stateName of statesList) {\n this.useState(stateName)\n }\n } else {\n for(const stateName in statesList) {\n const defaultValue = statesList[stateName]\n\n this.useState(stateName, defaultValue)\n }\n }\n }\n}\n\nconst shapeComponent = (ShapeClass) => {\n const functionalComponent = (props) => {\n // Count rendering to avoid setting state while rendering which causes a console-error from React\n shared.rendering += 1\n\n try {\n // Calculate and validate props\n let actualProps\n\n if (ShapeClass.defaultProps) {\n // Undefined values are removed from the props because they shouldn't override default values\n const propsWithoutUndefined = Object.assign({}, props)\n\n for (const key in propsWithoutUndefined) {\n const value = propsWithoutUndefined[key]\n\n if (value === undefined) {\n delete propsWithoutUndefined[key]\n }\n }\n\n actualProps = Object.assign({}, ShapeClass.defaultProps, propsWithoutUndefined)\n } else {\n actualProps = props\n }\n\n if (ShapeClass.propTypes) {\n const validateProps = {}\n\n for (const key in actualProps) {\n // Accessing 'key' will result in a warning in the console\n if (key == \"key\") continue\n\n validateProps[key] = actualProps[key]\n }\n\n PropTypes.checkPropTypes(ShapeClass.propTypes, validateProps, \"prop\", ShapeClass.name)\n }\n\n const shape = useMemo(() => new ShapeClass(actualProps), [])\n const prevProps = shape.props\n\n shape.props = actualProps\n\n if (shape.setup) {\n shape.setup()\n }\n\n if (shape.componentDidUpdate && shape.__firstRenderCompleted && memoCompareProps(shape.props, props)) {\n shape.componentDidUpdate(prevProps, shape.state)\n }\n\n if (shape.componentDidMount || shape.componentWillUnmount) {\n useEffect(() => {\n if (shape.componentDidMount) {\n shape.componentDidMount()\n }\n\n return () => {\n if (shape.componentWillUnmount) {\n shape.componentWillUnmount()\n }\n }\n }, [])\n }\n\n shape.__firstRenderCompleted = true\n\n // Run any callbacks added by setState(states, callback) once rendering is done\n useEffect(() => {\n if (shared.rendering == 0) {\n try {\n for (const callback of shared.renderingCallbacks) {\n new Promise(() => callback())\n }\n } finally {\n shared.renderingCallbacks.length = 0\n }\n }\n })\n\n // Finally render the component and return it\n return shape.render()\n } finally {\n shared.rendering -= 1\n }\n }\n\n functionalComponent.displayName = ShapeClass.name\n\n Object.defineProperty(functionalComponent, \"name\", {value: ShapeClass.name})\n\n return functionalComponent\n}\n\nexport {shapeComponent, ShapeComponent}\n","if (!window.setStateCompareData) {\n window.setStateCompareData = {\n rendering: 0,\n renderingCallbacks: []\n }\n}\n\nconst shared = window.setStateCompareData\n\nexport default shared\n","function digger(target, keys, {callFunctions = false, throwError = true}) {\n let digged = target\n const currentPath = []\n\n for (const key of keys) {\n currentPath.push(key)\n\n if (!(key in digged)) {\n if (throwError) {\n throw new Error(`Path didn't exist: ${currentPath.join(\".\")}`)\n } else {\n return undefined\n }\n } else {\n digged = digged[key]\n }\n\n if (typeof digged === \"function\" && callFunctions) {\n digged = digged()\n }\n }\n\n return digged\n}\n\nconst dig = function dig(target, ...keys) {\n return digger(target, keys, {throwError: false})\n}\n\nconst digg = function dig(target, ...keys) {\n return digger(target, keys, {throwError: true})\n}\n\nconst digs = function digs(target, ...keys) {\n const result = {}\n\n for(let key of keys) {\n if (!(key in target)) throw new Error(`Target didn't contain expected key: ${key}`)\n\n result[key] = target[key]\n }\n\n return result\n}\n\nexport {dig, digg, digger, digs}\n","export default function escapeStringRegexp(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Escape characters with special meaning either inside or outside character sets.\n\t// Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n\treturn string\n\t\t.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\t\t.replace(/-/g, '\\\\x2d');\n}\n","class PropertyNotFoundError extends Error {\n constructor(message) {\n super(message)\n this.name = \"PropertyNotFoundError\"\n }\n}\n\nconst fetchingObjectHandler = {\n get(receiver, prop) {\n if (typeof receiver == \"function\") receiver = receiver()\n if (!(prop in receiver)) throw new PropertyNotFoundError(`Property not found: ${prop}`)\n\n return Reflect.get(receiver, prop)\n },\n\n set(receiver, prop, newValue) {\n if (typeof receiver == \"function\") receiver = receiver()\n if (!(prop in receiver)) throw new PropertyNotFoundError(`Property not found: ${prop}`)\n\n return Reflect.set(receiver, prop, newValue)\n }\n}\n\nconst fetchingObject = (wrappedObject = {}) => new Proxy(wrappedObject, fetchingObjectHandler)\n\nexport default fetchingObject\n","export default class ErrorHandlersRaiser {\n constructor(i18n) {\n this.i18n = i18n\n }\n\n handleError({error}) {\n throw error\n }\n}\n","import events from \"./src/events.mjs\"\nimport {dig, digg} from \"diggerize\"\nimport numberable from \"numberable\"\nimport Raiser from \"./src/error-handlers/raiser.mjs\"\nimport strftime from \"strftime\"\n\nexport default class I18nOnSteroids {\n constructor(args) {\n this.errorHandler = new Raiser(this)\n this.locales = {}\n\n if (args?.fallbacks) {\n this.fallbacks = args.fallbacks\n } else {\n this.fallbacks = {}\n }\n }\n\n setErrorHandler(errorHandler) {\n this.errorHandler = errorHandler\n }\n\n setLocale(locale) {\n this.locale = locale\n events.emit(\"localeChanged\")\n }\n\n setLocaleOnStrftime() {\n const monthNames = [...Object.values(this.t(\"date.month_names\"))]\n const abbrMonthNames = [...Object.values(this.t(\"date.abbr_month_names\"))]\n\n monthNames.shift()\n abbrMonthNames.shift()\n\n const strftimeLocales = {\n days: Object.values(this.t(\"date.day_names\")),\n shortDays: Object.values(this.t(\"date.abbr_day_names\")),\n months: monthNames,\n shortMonths: abbrMonthNames\n }\n\n this.strftime = strftime.localize(strftimeLocales)\n }\n\n scanRequireContext(contextLoader) {\n contextLoader.keys().forEach((id) => {\n const content = contextLoader(id)\n\n this._scanRecursive(content, this.locales, [], id)\n })\n }\n\n scanObject(object) {\n this._scanRecursive(object, this.locales, [])\n }\n\n _scanRecursive(data, storage, currentPath, id) {\n for (const key in data) {\n const value = data[key]\n\n if (typeof value == \"object\") {\n if (!(key in storage)) {\n storage[key] = {}\n }\n\n this._scanRecursive(value, storage[key], currentPath.concat([key], id))\n } else {\n if (key in storage) {\n console.error(`Key already found in locales: ${currentPath.join(\".\")}.${key} '${id}'`, {oldValue: storage[key], newValue: value})\n }\n\n storage[key] = value\n }\n }\n }\n\n l(format, date) {\n const formatValue = this.t(format)\n const formattedDate = this.strftime(formatValue, date)\n\n return formattedDate\n }\n\n t(key, variables, args) {\n const locale = args?.locale || this.locale\n const path = key.split(\".\")\n const localesToTry = this.fallbacks[locale] || [locale]\n let defaultValue, value\n\n for (const locale of localesToTry) {\n value = this._lookup(locale, path)\n\n if (value) {\n break\n }\n }\n\n if (variables && \"defaultValue\" in variables) {\n defaultValue = digg(variables, \"defaultValue\")\n delete variables.defaultValue\n }\n\n if (value === undefined) {\n if (args?.default) {\n value = args.default\n } else if (defaultValue) {\n value = defaultValue\n }\n }\n\n if (value) {\n return this.insertVariables(value, variables)\n }\n\n const error = Error(`Key didn't exist: ${locale}.${key}`)\n\n return this.errorHandler.handleError({error, key, path, variables})\n }\n\n insertVariables(value, variables) {\n if (variables) {\n for (const key in variables) {\n value = value.replace(`%{${key}}`, variables[key])\n }\n }\n\n return value\n }\n\n _lookup = (locale, path) => dig(this.locales, locale, ...path)\n\n toNumber(number) {\n return numberable(number, {\n delimiter: this.t(\"number.format.delimiter\"),\n precision: this.t(\"number.format.precision\"),\n separator: this.t(\"number.format.separator\")\n })\n }\n}\n","// Raises an error outside the normal thread and returns the last part of the key as a string\nexport default class ErrorHandlersRaiseInBackground {\n constructor(i18n) {\n this.i18n = i18n\n }\n\n handleError({error, path}) {\n setTimeout(\n () => {\n throw error\n },\n 0\n )\n\n // Return the last part of the path as a string\n return path[path.length - 1]\n }\n}\n","import EventEmitter from \"events\"\n\nconst events = new EventEmitter()\n\nevents.setMaxListeners(1000)\n\nexport default events\n","import {useCallback, useMemo} from \"react\"\nimport useLocale from \"./use-locale.mjs\"\n\nconst useI18n = ({namespace}) => {\n const shared = useMemo(() => ({}), [])\n const locale = useLocale()\n\n shared.locale = locale\n shared.namespace = namespace\n\n const t = useCallback((key, variables, args = {}) => {\n const newArgs = Object.assign({locale: shared.locale}, args)\n\n if (key.startsWith(\".\")) {\n key = `${shared.namespace}${key}`\n }\n\n return I18n.t(key, variables, newArgs)\n }, [])\n\n return {\n locale,\n t\n }\n}\n\nexport default useI18n\n","import events from \"./events.mjs\"\nimport {useCallback, useEffect, useState} from \"react\"\n\nconst useLocale = () => {\n const [locale, setLocale] = useState(I18n.locale)\n const updateLocale = useCallback(() => {\n setLocale(I18n.locale)\n }, [])\n\n useEffect(() => {\n events.addListener(\"localeChanged\", updateLocale)\n\n return () => {\n events.removeListener(\"localeChanged\", updateLocale)\n }\n }, [])\n\n return locale\n}\n\nexport default useLocale\n","const incorporate = (...objects) => {\n const incorporator = new Incorporator({objects})\n\n return incorporator.merge()\n}\n\nexport {incorporate}\n\nexport default class Incorporator {\n constructor({objects}) {\n this.objects = objects\n this.replaceArrayIfExistsValue = false\n }\n\n replaceArrayIfExists(newValue) {\n this.replaceArrayIfExistsValue = newValue\n }\n\n merge() {\n return this.mergeObjects(...this.objects)\n }\n\n isPlainObject = (input) => {\n if (input && typeof input === \"object\" && !Array.isArray(input)) {\n return true\n }\n\n return false\n }\n\n mergeObjects = (firstObject, ...objects) => {\n for (const object of objects) {\n this.mergeObjectsInto(firstObject, object)\n }\n\n return firstObject\n }\n\n mergeArraysInto = (mergeIntoValue, ...arrays) => {\n for (const array of arrays) {\n for (const value of array) {\n if (!mergeIntoValue.includes(value)) {\n mergeIntoValue.push(value)\n }\n }\n }\n }\n\n mergeObjectsInto = (mergeInto, object) => {\n for (const key in object) {\n const value = object[key]\n\n if (key in mergeInto) {\n const mergeIntoValue = mergeInto[key]\n\n if (Array.isArray(value) && !this.replaceArrayIfExistsValue) {\n // Current value isn't an array - turn into array and then merge into that\n if (!Array.isArray(mergeIntoValue)) {\n mergeInto[key] = [mergeIntoValue]\n }\n\n this.mergeArraysInto(mergeInto[key], value)\n } else if (this.isPlainObject(mergeIntoValue) && this.isPlainObject(value)) {\n this.mergeObjectsInto(mergeIntoValue, value)\n } else {\n mergeInto[key] = value\n }\n } else {\n mergeInto[key] = value\n }\n }\n }\n}\n","class ParentElementsResult {\n constructor(element, path) {\n this.element = element\n this.path = path\n }\n\n getElement() {\n return this.element\n }\n\n getPath() {\n return this.path\n }\n}\n\nconst parentElement = ({element, callback}) => {\n const results = parentElements({element, breakAfterFirstFound: true, callback})\n\n if (results.length > 0) {\n return results[0].getElement()\n }\n}\n\nconst parentElements = ({element, breakAfterFirstFound, callback, currentPath = [], results = []}) => {\n const parent = element.parentNode\n const includeInResults = callback({element: parent})\n\n if (includeInResults) {\n const elementResult = new ParentElementsResult(parent, currentPath)\n\n results.push(elementResult)\n\n if (breakAfterFirstFound) {\n return results\n }\n }\n\n if (parent?.parentNode && (!breakAfterFirstFound || results.length == 0)) {\n parentElements({\n breakAfterFirstFound,\n element: parent,\n callback,\n currentPath: [...currentPath, parent],\n results\n })\n }\n\n return results\n}\n\nexport {\n parentElement,\n parentElements\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbmF0aXZlLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLEdBQ2QsT0FBTyxNQUFNLEtBQUssV0FBVyxJQUFJLE1BQU0sQ0FBQyxVQUFVLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFdkYsZUFBZSxFQUFFLFVBQVUsRUFBRSxDQUFDIn0=","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm5nLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm5nLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsSUFBSSxlQUEwRCxDQUFDO0FBRS9ELE1BQU0sS0FBSyxHQUFHLElBQUksVUFBVSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRWpDLE1BQU0sQ0FBQyxPQUFPLFVBQVUsR0FBRztJQUV6QixJQUFJLENBQUMsZUFBZSxFQUFFLENBQUM7UUFDckIsSUFBSSxPQUFPLE1BQU0sS0FBSyxXQUFXLElBQUksQ0FBQyxNQUFNLENBQUMsZUFBZSxFQUFFLENBQUM7WUFDN0QsTUFBTSxJQUFJLEtBQUssQ0FDYiwwR0FBMEcsQ0FDM0csQ0FBQztRQUNKLENBQUM7UUFFRCxlQUFlLEdBQUcsTUFBTSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDeEQsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2hDLENBQUMifQ==","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5naWZ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0cmluZ2lmeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLFFBQVEsTUFBTSxlQUFlLENBQUM7QUFNckMsTUFBTSxTQUFTLEdBQWEsRUFBRSxDQUFDO0FBRS9CLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsRUFBRSxDQUFDLEVBQUUsQ0FBQztJQUM3QixTQUFTLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNwRCxDQUFDO0FBRUQsTUFBTSxVQUFVLGVBQWUsQ0FBQyxHQUFlLEVBQUUsTUFBTSxHQUFHLENBQUM7SUFNekQsT0FBTyxDQUNMLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLEdBQUc7UUFDSCxTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztRQUMxQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztRQUMxQixHQUFHO1FBQ0gsU0FBUyxDQUFDLEdBQUcsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUM7UUFDMUIsU0FBUyxDQUFDLEdBQUcsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUM7UUFDMUIsR0FBRztRQUNILFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQzFCLEdBQUc7UUFDSCxTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQztRQUMzQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQztRQUMzQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQztRQUMzQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQztRQUMzQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQztRQUMzQixTQUFTLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQyxDQUM1QixDQUFDLFdBQVcsRUFBRSxDQUFDO0FBQ2xCLENBQUM7QUFFRCxTQUFTLFNBQVMsQ0FBQyxHQUFlLEVBQUUsTUFBTSxHQUFHLENBQUM7SUFDNUMsTUFBTSxJQUFJLEdBQUcsZUFBZSxDQUFDLEdBQUcsRUFBRSxNQUFNLENBQUMsQ0FBQztJQU8xQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7UUFDcEIsTUFBTSxTQUFTLENBQUMsNkJBQTZCLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBRUQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQsZUFBZSxTQUFTLENBQUMifQ==","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random || (options.rng || rng)();\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdjQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxNQUFNLE1BQU0sYUFBYSxDQUFDO0FBQ2pDLE9BQU8sR0FBRyxNQUFNLFVBQVUsQ0FBQztBQUMzQixPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFJakQsU0FBUyxFQUFFLENBQUMsT0FBeUIsRUFBRSxHQUFnQixFQUFFLE1BQWU7SUFDdEUsSUFBSSxNQUFNLENBQUMsVUFBVSxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDMUMsT0FBTyxNQUFNLENBQUMsVUFBVSxFQUFFLENBQUM7SUFDN0IsQ0FBQztJQUVELE9BQU8sR0FBRyxPQUFPLElBQUksRUFBRSxDQUFDO0lBRXhCLE1BQU0sSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxFQUFFLENBQUM7SUFHdEQsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQztJQUNsQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEdBQUcsSUFBSSxDQUFDLEdBQUcsSUFBSSxDQUFDO0lBR2xDLElBQUksR0FBRyxFQUFFLENBQUM7UUFDUixNQUFNLEdBQUcsTUFBTSxJQUFJLENBQUMsQ0FBQztRQUVyQixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxFQUFFLEVBQUUsQ0FBQyxFQUFFLENBQUM7WUFDNUIsR0FBRyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDNUIsQ0FBQztRQUVELE9BQU8sR0FBRyxDQUFDO0lBQ2IsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBQy9CLENBQUM7QUFFRCxlQUFlLEVBQUUsQ0FBQyJ9"],"names":["adapters","logger","console","undefined","WebSocket","log","messages","this","enabled","push","Date","now","getTime","secondsSince","time","ConnectionMonitor","constructor","connection","visibilityDidChange","bind","reconnectAttempts","start","isRunning","startedAt","stoppedAt","startPolling","addEventListener","staleThreshold","stop","stopPolling","removeEventListener","recordMessage","pingedAt","recordConnect","disconnectedAt","recordDisconnect","poll","clearTimeout","pollTimeout","setTimeout","reconnectIfStale","getPollInterval","reconnectionBackoffRate","Math","pow","min","random","connectionIsStale","refreshedAt","disconnectedRecently","reopen","document","visibilityState","isOpen","INTERNAL","message_types","welcome","disconnect","ping","confirmation","rejection","disconnect_reasons","unauthorized","invalid_request","server_restart","remote","default_mount_path","protocols","supportedProtocols","slice","length","indexOf","Connection","consumer","open","subscriptions","monitor","disconnected","send","data","webSocket","JSON","stringify","isActive","getState","socketProtocols","subprotocols","uninstallEventHandlers","url","installEventHandlers","close","allowReconnect","error","reopenDelay","getProtocol","protocol","isState","triedToReconnect","isProtocolSupported","call","states","state","readyState","toLowerCase","eventName","events","handler","prototype","message","event","identifier","reason","reconnect","type","parse","reconnectAttempted","reload","confirmSubscription","notify","reconnected","reject","notifyAll","willAttemptReconnect","Subscription","params","mixin","object","properties","key","value","extend","perform","action","command","unsubscribe","remove","SubscriptionGuarantor","pendingSubscriptions","guarantee","subscription","startGuaranteeing","forget","filter","s","stopGuaranteeing","retrySubscribing","retryTimeout","subscribe","map","Subscriptions","guarantor","create","channelName","channel","add","ensureActiveConnection","findAll","sendCommand","callbackName","args","Consumer","_url","test","a","createElement","href","replace","createWebSocketURL","connect","addSubProtocol","subprotocol","createConsumer","name","element","head","querySelector","getAttribute","getConfig","hue2rgb","p","q","t","hslToRgb","h","l","r","g","b","round","NUMBER","PERCENTAGE","join","callWithSlashSeparator","commaSeparatedCall","cachedMatchers","parse255","str","int","parseInt","parse360","parseFloat","parse1","num","parsePercentage","module","exports","color","matchers","rgb","RegExp","rgba","hsl","hsla","hwb","hex3","hex4","hex6","hex8","getMatchers","match","exec","colorFromKeyword","normalizeKeyword","w","gray","red","green","blue","hwbToRgb","BaseComponent","_ShapeComponent","_this","_classCallCheck","_len","arguments","Array","_key","_callSuper","concat","fetchingObject","props","shape","tt","_inherits","ShapeComponent","useRouter","useShape","findRouteParams","useCallback","routeDefinition","_step","result","_iterator","_createForOfIteratorHelper","path","split","n","done","part","err","e","f","getPath","window","location","pathname","getRouteDefinitions","routeDefinitions","config","getRoutes","routes","parseRouteDefinitions","_step2","Locales","require","regex","parsedRouteDefinitions","_iterator2","availableLocales","_step3","locale","_iterator3","routePathName","inflection","camelize","Error","Object","keys","routePath","apply","_toConsumableArray","groups","pathRegexString","escapeStringRegexp","variableName","pathRegex","useMemo","updateMeta","matchingRoute","_step4","_iterator4","m","parsedRouteDefinition","matched","groupKey","Number","findMatchingRoute","propTypes","PropTypes","memo","shapeComponent","_ApiMakerRouter","_BaseComponent","ApiMakerRouter","_this$props","notFoundComponent","requireComponent","NotFoundComponent","React","Suspense","fallback","Component","propTypesExact","history","isRequired","_NotificationsNotification","NotificationsNotification","onRemovedClicked","notification","className","title","style","width","maxWidth","marginBottom","padding","borderRadius","cursor","border","background","Pressable","dataSet","class","classNames","onPress","View","Text","fontWeight","PropTypesExact","FlashNotificationsContainer","onPushNotification","detail","digg","count","removeNotification","setState","notifications","useStates","useEventListener","_this2","position","zIndex","top","right","Notification","configuration","HayaSelectConfiguration","_bodyPortal","newBodyPortal","iconSet","createIconSet","glyphMap","Button","getImageSource","getImageSourceSync","ensureNativeModuleAvailable","NativeIconAPI","TYPE_VALUE","TYPE_ERROR","styles","StyleSheet","container","flexDirection","justifyContent","alignItems","touchable","overflow","icon","marginRight","text","backgroundColor","IOS7_BLUE","TEXT_PROP_NAMES","TOUCHABLE_PROP_NAMES","createIconButtonComponent","Icon","_IconButton","_PureComponent","IconButton","iconStyle","children","restProps","_objectWithoutProperties","_excluded","iconProps","pick","touchableProps","omit","colorStyle","blockStyle","TouchableHighlight","assign","selectable","PureComponent","defaultProps","size","_regeneratorRuntime","hasOwnProperty","o","defineProperty","i","Symbol","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","Context","makeInvokeMethod","tryCatch","arg","y","GeneratorFunction","GeneratorFunctionPrototype","d","getPrototypeOf","v","values","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","resolve","__await","then","callInvokeWithMethodAndArg","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","isNaN","displayName","isGeneratorFunction","mark","setPrototypeOf","__proto__","awrap","async","Promise","reverse","pop","prev","charAt","rval","handle","complete","finish","delegateYield","asyncGeneratorStep","_asyncToGenerator","_next","_throw","_defineProperties","_toPropertyKey","toPrimitive","String","_toPrimitive","_getPrototypeOf","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","_setPrototypeOf","DEFAULT_ICON_SIZE","DEFAULT_ICON_COLOR","fontFamily","fontFile","fontStyle","fontBasename","fontReference","Platform","windows","android","web","default","includes","_objectWithoutPropertiesLoose","getOwnPropertySymbols","propertyIsEnumerable","glyph","fromCodePoint","styleDefaults","fontSize","styleOverrides","allowFontScaling","cache","imageSourceCache","Map","setValue","set","setError","has","get","_cache$get","resolveGlyph","_getImageSource","_callee","processedColor","cacheKey","imagePath","_args","_context","processColor","getImageForFont","uri","scale","PixelRatio","t0","_loadFont","_callee2","file","_args2","_context2","loadFontWithFileName","_x","getImageForFontSync","loadFont","hasIcon","getRawGlyphMap","getFontFamily","obj","flat","reduce","acc","_len2","keysToOmit","_key2","keysToOmitSet","Set","getOwnPropertyNames","GetIntrinsic","callBind","$indexOf","allowMissing","intrinsic","setFunctionLength","$TypeError","$apply","$call","$reflectApply","$defineProperty","$max","originalFunction","func","applyBind","toStr","toString","max","concatty","arr","j","that","target","bound","arrLike","offset","slicy","boundLength","boundArgs","Function","joiner","joiny","Empty","implementation","clone","typeOf","isPlainObject","cloneDeep","val","instanceClone","res","cloneObjectDeep","cloneArrayDeep","isObject","isObjectObject","ctor","prot","_typeof","isArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","minLen","_unsupportedIterableToArray","_nonIterableSpread","len","arr2","filterUniqueArray","index","lastIndexOf","assignStyle","base","property","baseValue","DASH","MS","toUpper","toUpperCase","camelCaseProperty","camelProp","hyphenateProperty","cssifyDeclaration","cssifyObject","css","RE","isPrefixedProperty","isPrefixedValue","unitlessProperties","borderImageOutset","borderImageSlice","borderImageWidth","lineHeight","opacity","orphans","tabSize","widows","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","prefixedUnitlessProperties","prefixes","getPrefixedProperty","prefix","jLen","_property","isUnitlessProperty","unprefixProperty","propertyWithoutPrefix","normalizeProperty","resolveArrayValue","unprefixValue","_hyphenateStyleName2","_hyphenateStyleName","__esModule","$SyntaxError","gopd","nonEnumerable","nonWritable","nonConfigurable","loose","desc","hasSymbols","defineDataProperty","supportsDescriptors","predicate","fn","defineProperties","predicates","SyntaxError","$Function","getEvalledConstructor","expressionSyntax","$gOPD","getOwnPropertyDescriptor","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","getProto","x","needsEval","TypedArray","Uint8Array","INTRINSICS","AggregateError","ArrayBuffer","Atomics","BigInt","DataView","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","Proxy","RangeError","SharedArrayBuffer","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","doEval","gen","LEGACY_ALIASES","hasOwn","$concat","$spliceApply","splice","$replace","$strSlice","$exec","rePropName","reEscapeChar","getBaseIntrinsic","alias","intrinsicName","parts","string","first","last","number","quote","subString","stringToPath","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","hasPropertyDescriptors","hasArrayLengthDefineBug","hasToStringTag","overrideIfSet","force","ReflectOwnKeys","R","ReflectApply","receiver","ownKeys","NumberIsNaN","EventEmitter","init","once","emitter","errorListener","removeListener","resolver","eventTargetAgnosticAddListener","flags","on","addErrorHandlerIfEventEmitter","_events","_eventsCount","_maxListeners","defaultMaxListeners","checkListener","listener","_getMaxListeners","_addListener","prepend","existing","warning","newListener","emit","unshift","warned","warn","onceWrapper","fired","wrapFn","_onceWrap","wrapped","_listeners","unwrap","evlistener","ret","unwrapListeners","arrayClone","listenerCount","copy","wrapListener","setMaxListeners","getMaxListeners","doError","er","context","listeners","addListener","prependListener","prependOnceListener","list","originalListener","shift","spliceOne","off","removeAllListeners","rawListeners","eventNames","makeEmptyFunction","emptyFunction","thatReturns","thatReturnsFalse","thatReturnsTrue","thatReturnsNull","thatReturnsThis","thatReturnsArgument","validateFormat","format","condition","argIndex","framesToPop","$Error","$EvalError","$RangeError","$ReferenceError","$URIError","hasProto","BigInt64Array","BigUint64Array","errorProto","foo","$Object","self","getPolyfill","shim","polyfill","getGlobal","origDefineProperty","descriptor","globalThis","origSymbol","hasSymbolSham","sym","symObj","syms","$hasOwn","Action","readOnly","BeforeUnloadEventType","PopStateEventType","createBrowserHistory","options","_options$window","defaultView","globalHistory","getIndexAndLocation","_window$location","search","hash","idx","usr","blockedPopTx","blockers","nextAction","Pop","_getIndexAndLocation","nextIndex","nextLocation","delta","retry","go","applyTx","_getIndexAndLocation2","createEvents","createHref","to","createPath","getNextLocation","parsePath","createKey","getHistoryStateAndUrl","allowTx","_getIndexAndLocation3","replaceState","Push","_getHistoryStateAndUr","historyState","pushState","Replace","_getHistoryStateAndUr2","back","forward","listen","block","blocker","unblock","promptBeforeUnload","preventDefault","returnValue","handlers","substr","_ref","_ref$pathname","_ref$search","_ref$hash","parsedPath","hashIndex","searchIndex","uppercasePattern","msPattern","toHyphenLower","hName","uncountable_words","plural","men","people","tia","analyses","drives","hives","curves","lrves","aves","foves","movies","aeiouyies","series","xes","mice","buses","oes","shoes","crises","octopuses","aliases","summonses","oxen","matrices","vertices","feet","teeth","geese","quizzes","whereases","criteria","genera","ss","singular","man","person","child","drive","ox","axis","octopus","summons","bus","buffalo","tium","sis","ffe","hive","aeiouyy","matrix","vertex","mouse","foot","tooth","goose","quiz","whereas","criterion","genus","common","plural_rules","singular_rules","non_titlecased_words","id_suffix","underbar","space_or_underbar","uppercase","underbar_prefix","inflector","_apply_rules","rules","skip","override","item","from_index","compare_func","pluralize","singularize","inflect","low_first_letter","str_arr","k","str_path","substring","underscore","all_upper_case","humanize","capitalize","dasherize","titleize","demodulize","tableize","classify","foreign_key","drop_id_ubar","ordinalize","ltd","ld","suf","transform","prefixMap","plugins","_isObject2","combinedValue","processedValue","_prefixValue2","_addNewValuesOnly2","_processedValue","_prefixProperty2","_interopRequireDefault","_cssInJsUtils","CROSS_FADE_REGEX","grab","grabbing","FILTER_REGEX","_isPrefixedValue2","_isPrefixedValue","alternativeProps","alternativePropList","marginBlockStart","marginBlockEnd","marginInlineStart","marginInlineEnd","paddingBlockStart","paddingBlockEnd","paddingInlineStart","paddingInlineEnd","borderBlockStart","borderBlockStartColor","borderBlockStartStyle","borderBlockStartWidth","borderBlockEnd","borderBlockEndColor","borderBlockEndStyle","borderBlockEndWidth","borderInlineStart","borderInlineStartColor","borderInlineStartStyle","borderInlineStartWidth","borderInlineEnd","borderInlineEndColor","borderInlineEndStyle","borderInlineEndWidth","maxHeight","height","columnWidth","minWidth","minHeight","propertyPrefixMap","outputValue","multipleValues","singleValue","dashCaseProperty","_hyphenateProperty2","pLen","prefixMapping","prefixValue","webkitOutput","mozOutput","_capitalizeString2","transition","transitionProperty","WebkitTransition","WebkitTransitionProperty","MozTransition","MozTransitionProperty","Webkit","Moz","ms","addIfNew","prefixProperties","requiredPrefixes","capitalizedProperty","prefixedProperty","_capitalizeString","metaData","currencies","currency","isFunction","isString","isInt","assertSameCurrency","left","assertType","other","Money","assertOperand","operand","amount","code","freeze","fromInteger","fromDecimal","rounder","decimal_digits","resultAmount","equals","subtract","multiply","multiplier","divide","divisor","allocate","ratios","remainder","results","total","ratio","share","floor","compare","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","isZero","isPositive","isNegative","toDecimal","toFixed","toJSON","getAmount","getCurrency","ctorName","isGeneratorFn","isBuffer","callee","isArguments","toDateString","getDate","setDate","isDate","stackTraceLimit","isError","ignoreCase","multiline","global","isRegexp","throw","return","isGeneratorObj","thisArg","baseTimes","isIndex","isTypedArray","inherited","isArr","isArg","isBuff","isType","skipIndexes","baseAssignValue","eq","objValue","getRawTag","objectToString","symToStringTag","baseGetTag","isObjectLike","isMasked","toSource","reIsHostCtor","funcProto","objectProto","funcToString","reIsNative","isLength","typedArrayTags","isPrototype","nativeKeysIn","isProto","identity","overRest","setToString","constant","baseSetToString","iteratee","assignValue","source","customizer","isNew","newValue","coreJsData","baseRest","isIterateeCall","assigner","sources","guard","getNative","freeGlobal","baseIsNative","getValue","getPrototype","overArg","nativeObjectToString","tag","unmasked","reIsUint","isArrayLike","uid","maskSrcKey","IE_PROTO","Ctor","freeExports","nodeType","freeModule","freeProcess","process","nodeUtil","types","binding","nativeMax","array","otherArgs","freeSelf","root","shortOut","nativeNow","lastCalled","stamp","remaining","copyObject","createAssigner","keysIn","assignIn","baseIsArguments","stubFalse","Buffer","isNumber","objectCtorString","proto","baseIsTypedArray","baseUnary","nodeIsTypedArray","arrayLikeKeys","baseKeysIn","nullthrows","keysShim","isArgs","isEnumerable","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","theKeys","skipProto","skipConstructor","equalsConstructorPrototypeIfNotBuggy","origKeys","originalKeys","keysWorksWithArguments","isUndefined","isBlob","isReactNative","initCfg","serialize","cfg","fd","pre","FormData","indices","nullsAsUndefineds","booleansAsIntegers","allowEmptyArrays","noFilesWithArrayNotation","dotsForObjectNotation","getParts","append","isBoolean","lastModifiedDate","lastModified","isFile","prop","toISOString","objectKeys","callBound","toObject","$push","$propIsEnumerable","originalGetSymbols","source1","getSymbols","nextKey","propValue","letters","actual","lacksProperEnumerationOrder","preventExtensions","thrower","assignHasPendingExceptions","walk","ValueParser","nodes","cb","bubble","unit","openParentheses","charCodeAt","closeParentheses","singleQuote","doubleQuote","backslash","slash","comma","colon","star","uLower","uUpper","plus","isUnicodeRange","input","token","escape","escapePos","whitespacePos","parenthesesOpenPos","parent","tokens","pos","stack","balanced","before","after","sourceEndIndex","sourceIndex","unclosed","stringifyNode","node","custom","buf","customResult","minus","dot","exp","EXP","nextCode","nextNextCode","likeNumber","specialProperty","semaphore","forbidden","_","componentName","unknownProps","ReactPropTypesSecret","emptyFunctionWithReset","resetWarningCache","propName","propFullName","secret","getShim","ReactPropTypes","bigint","bool","symbol","any","arrayOf","elementType","instanceOf","objectOf","oneOf","oneOfType","exact","checkPropTypes","percentTwenties","Format","formatters","RFC1738","RFC3986","formats","utils","defaults","allowDots","allowPrototypes","allowSparse","arrayLimit","charset","charsetSentinel","decoder","decode","delimiter","depth","ignoreQueryPrefix","interpretNumericEntities","parameterLimit","parseArrays","plainObjects","strictNullHandling","$0","numberStr","fromCharCode","parseArrayValue","parseKeys","givenKey","valuesParsed","segment","chain","leaf","cleanRoot","parseObject","opts","isRegExp","normalizeParseOptions","tempObj","cleanStr","limit","Infinity","skipIndex","bracketEqualsPos","maybeMap","encodedVal","combine","parseValues","newObj","merge","compact","getSideChannel","arrayPrefixGenerators","brackets","repeat","pushToArray","valueOrArray","toISO","defaultFormat","addQueryPrefix","encode","encoder","encodeValuesOnly","formatter","serializeDate","date","skipNulls","sentinel","generateArrayPrefix","commaRoundTrip","sort","sideChannel","tmpSc","step","findFlag","keyValue","valuesArray","valuesJoined","objKeys","adjustedPrefix","keyPrefix","valueSideChannel","normalizeStringifyOptions","arrayFormat","joined","hexTable","arrayToObject","queue","refs","compacted","compactQueue","strWithoutPlus","unescape","defaultEncoder","kind","out","mapped","mergeTarget","targetItem","aa","ca","da","ea","fa","ha","ia","ja","ka","la","ma","acceptsBooleans","attributeName","attributeNamespace","mustUseProperty","propertyName","sanitizeURL","removeEmptyString","z","ra","sa","ta","pa","qa","oa","removeAttribute","setAttribute","setAttributeNS","xlinkHref","ua","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","va","for","wa","ya","za","Aa","Ba","Ca","Da","Ea","Fa","Ga","Ha","Ia","Ja","Ka","La","A","Ma","trim","Na","Oa","prepareStackTrace","Pa","render","Qa","$$typeof","_payload","_init","Ra","Sa","Ta","nodeName","Va","_valueTracker","stopTracking","Ua","Wa","checked","Xa","activeElement","body","Ya","defaultChecked","defaultValue","_wrapperState","initialChecked","Za","initialValue","controlled","ab","bb","db","ownerDocument","eb","fb","selected","defaultSelected","disabled","gb","dangerouslySetInnerHTML","hb","ib","jb","textContent","kb","lb","mb","nb","namespaceURI","innerHTML","firstChild","removeChild","appendChild","MSApp","execUnsafeLocalFunction","ob","lastChild","nodeValue","pb","animationIterationCount","aspectRatio","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","lineClamp","order","qb","rb","sb","setProperty","tb","menuitem","area","br","col","embed","hr","img","keygen","link","meta","param","track","wbr","ub","vb","is","wb","xb","srcElement","correspondingUseElement","parentNode","yb","zb","Ab","Bb","Cb","stateNode","Db","Eb","Fb","Gb","Hb","Ib","Jb","Kb","Lb","Mb","Nb","onError","Ob","Pb","Qb","Rb","Sb","Tb","Vb","alternate","Wb","memoizedState","dehydrated","Xb","Zb","sibling","current","Yb","$b","ac","unstable_scheduleCallback","bc","unstable_cancelCallback","cc","unstable_shouldYield","dc","unstable_requestPaint","B","unstable_now","ec","unstable_getCurrentPriorityLevel","fc","unstable_ImmediatePriority","gc","unstable_UserBlockingPriority","hc","unstable_NormalPriority","ic","unstable_LowPriority","jc","unstable_IdlePriority","kc","lc","oc","clz32","pc","qc","LN2","rc","sc","tc","uc","pendingLanes","suspendedLanes","pingedLanes","entangledLanes","entanglements","vc","xc","yc","zc","Ac","eventTimes","Cc","C","Dc","Ec","Fc","Gc","Hc","Ic","Jc","Kc","Lc","Mc","Nc","Oc","Pc","Qc","Rc","Sc","delete","pointerId","Tc","nativeEvent","blockedOn","domEventName","eventSystemFlags","targetContainers","Vc","Wc","priority","isDehydrated","containerInfo","Xc","Yc","dispatchEvent","Zc","$c","ad","bd","cd","ReactCurrentBatchConfig","dd","ed","gd","hd","id","Uc","stopPropagation","jd","kd","md","nd","od","keyCode","charCode","pd","qd","rd","_reactName","_targetInst","currentTarget","isDefaultPrevented","defaultPrevented","isPropagationStopped","cancelBubble","persist","isPersistent","wd","xd","yd","sd","eventPhase","bubbles","cancelable","timeStamp","isTrusted","td","ud","view","vd","Ad","screenX","screenY","clientX","clientY","pageX","pageY","ctrlKey","shiftKey","altKey","metaKey","getModifierState","zd","button","buttons","relatedTarget","fromElement","toElement","movementX","movementY","Bd","Dd","dataTransfer","Fd","Hd","animationName","elapsedTime","pseudoElement","Id","clipboardData","Jd","Ld","Md","Esc","Spacebar","Left","Up","Right","Down","Del","Win","Menu","Apps","Scroll","MozPrintableKey","Nd","Od","Alt","Control","Meta","Shift","Pd","Qd","which","Rd","Td","pressure","tangentialPressure","tiltX","tiltY","twist","pointerType","isPrimary","Vd","touches","targetTouches","changedTouches","Xd","Yd","deltaX","wheelDeltaX","deltaY","wheelDeltaY","wheelDelta","deltaZ","deltaMode","Zd","$d","ae","be","documentMode","ce","de","ee","fe","ge","he","ie","le","datetime","email","month","password","range","tel","week","me","ne","oe","pe","qe","re","se","te","ue","ve","we","xe","ye","ze","oninput","Ae","detachEvent","Be","Ce","attachEvent","De","Ee","Fe","He","Ie","Je","Ke","nextSibling","Le","contains","compareDocumentPosition","Me","HTMLIFrameElement","contentWindow","Ne","contentEditable","Oe","focusedElem","selectionRange","documentElement","end","selectionStart","selectionEnd","getSelection","rangeCount","anchorNode","anchorOffset","focusNode","focusOffset","createRange","setStart","removeAllRanges","addRange","setEnd","scrollLeft","scrollTop","focus","Pe","Qe","Re","Se","Te","Ue","Ve","We","animationend","animationiteration","animationstart","transitionend","Xe","Ye","Ze","animation","$e","af","bf","cf","df","ef","ff","gf","hf","lf","mf","nf","Ub","instance","D","of","pf","qf","rf","sf","capture","passive","J","F","tf","uf","parentWindow","vf","wf","na","xa","$a","ba","je","char","ke","xf","yf","zf","Af","Bf","Cf","Df","Ef","__html","Ff","Gf","Hf","Jf","queueMicrotask","catch","If","Kf","Lf","Mf","previousSibling","Nf","Of","Pf","Qf","Rf","Sf","Tf","Uf","E","G","Vf","H","Wf","Xf","Yf","contextTypes","__reactInternalMemoizedUnmaskedChildContext","__reactInternalMemoizedMaskedChildContext","Zf","childContextTypes","$f","ag","bg","getChildContext","cg","__reactInternalMemoizedMergedChildContext","dg","eg","fg","gg","hg","jg","kg","lg","mg","ng","og","pg","qg","rg","sg","tg","ug","vg","wg","xg","yg","I","zg","Ag","Bg","deletions","Cg","pendingProps","treeContext","retryLane","Dg","mode","Eg","Fg","Gg","memoizedProps","Hg","Ig","Jg","Kg","Lg","ref","_owner","_stringRef","Mg","Ng","Og","Pg","Qg","Rg","Sg","Tg","Ug","Vg","Wg","Xg","Yg","Zg","$g","ah","_currentValue","bh","childLanes","ch","dependencies","firstContext","lanes","dh","eh","memoizedValue","fh","gh","hh","interleaved","ih","jh","kh","updateQueue","baseState","firstBaseUpdate","lastBaseUpdate","shared","pending","effects","lh","mh","eventTime","lane","payload","callback","nh","K","oh","ph","qh","rh","sh","th","uh","vh","wh","xh","yh","tagName","zh","Ah","Bh","L","Ch","revealOrder","Dh","Eh","_workInProgressVersionPrimary","Fh","ReactCurrentDispatcher","Gh","Hh","M","N","O","Ih","Jh","Kh","Lh","P","Mh","Nh","Oh","Ph","Qh","Rh","Sh","Th","baseQueue","Uh","Vh","Wh","lastRenderedReducer","hasEagerState","eagerState","lastRenderedState","dispatch","Xh","Yh","Zh","$h","ai","getSnapshot","bi","ci","Q","di","lastEffect","stores","ei","fi","gi","hi","ii","destroy","deps","ji","ki","li","mi","ni","oi","pi","qi","ri","si","ti","ui","vi","wi","xi","yi","zi","Ai","Bi","readContext","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","identifierPrefix","Ci","Di","Ei","isMounted","_reactInternals","enqueueSetState","enqueueReplaceState","enqueueForceUpdate","Fi","shouldComponentUpdate","isPureReactComponent","Gi","contextType","updater","Hi","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","Ii","getDerivedStateFromProps","getSnapshotBeforeUpdate","UNSAFE_componentWillMount","componentWillMount","componentDidMount","Ji","digest","Ki","Li","Mi","Ni","Oi","Pi","Qi","getDerivedStateFromError","componentDidCatch","Ri","componentStack","Si","pingCache","Ti","Ui","Vi","Wi","ReactCurrentOwner","Xi","Yi","Zi","$i","aj","bj","cj","dj","baseLanes","cachePool","transitions","ej","fj","gj","hj","ij","UNSAFE_componentWillUpdate","componentWillUpdate","componentDidUpdate","jj","kj","pendingContext","lj","zj","Aj","Bj","Cj","mj","nj","oj","pj","qj","sj","dataset","dgst","tj","uj","_reactRetry","rj","subtreeFlags","vj","wj","isBackwards","rendering","renderingStartTime","tail","tailMode","xj","Dj","S","Ej","Fj","wasMultiple","multiple","suppressHydrationWarning","onClick","onclick","createElementNS","autoFocus","createTextNode","T","Gj","Hj","Ij","Jj","U","Kj","V","Lj","W","Mj","Nj","Pj","Qj","Rj","Sj","Tj","Uj","Vj","insertBefore","_reactRootContainer","Wj","X","Xj","Yj","Zj","onCommitFiberUnmount","componentWillUnmount","ak","bk","ck","dk","ek","isHidden","fk","gk","display","hk","ik","jk","kk","__reactInternalSnapshotBeforeUpdate","src","Vk","lk","ceil","mk","nk","ok","Y","Z","pk","qk","rk","sk","tk","uk","vk","wk","xk","yk","zk","Ak","Bk","Ck","Dk","callbackNode","expirationTimes","expiredLanes","wc","callbackPriority","ig","Ek","Fk","Gk","Hk","Ik","Jk","Kk","Lk","Mk","Nk","Ok","finishedWork","finishedLanes","Pk","timeoutHandle","Qk","Rk","Sk","Tk","Uk","mutableReadLanes","Bc","Oj","onCommitFiberRoot","mc","onRecoverableError","Wk","onPostCommitFiberRoot","Xk","Yk","$k","isReactComponent","pendingChildren","al","mutableSourceEagerHydrationData","bl","pendingSuspenseBoundaries","dl","el","fl","gl","hl","il","yj","Zk","kl","reportError","ll","_internalRoot","ml","nl","ol","pl","rl","ql","unmount","unstable_scheduleHydration","querySelectorAll","form","sl","usingClientEntryPoint","Events","tl","findFiberByHostInstance","bundleType","version","rendererPackageName","ul","rendererConfig","overrideHookState","overrideHookStateDeletePath","overrideHookStateRenamePath","overrideProps","overridePropsDeletePath","overridePropsRenamePath","setErrorHandler","setSuspenseHandler","scheduleUpdate","currentDispatcherRef","findHostInstanceByFiber","findHostInstancesForRefresh","scheduleRefresh","scheduleRoot","setRefreshHandler","getCurrentFiber","reconcilerVersion","__REACT_DEVTOOLS_GLOBAL_HOOK__","vl","isDisabled","supportsFiber","inject","createPortal","cl","createRoot","unstable_strictMode","findDOMNode","flushSync","hydrate","hydrateRoot","hydratedSources","_getVersion","_source","unmountComponentAtNode","unstable_batchedUpdates","unstable_renderSubtreeIntoContainer","checkDCE","_invariant","_canUseDom","dimensions","fontScale","screen","shouldInit","update","win","visualViewport","docEl","clientHeight","clientWidth","devicePixelRatio","handleResize","dimension","initialDimensions","_handler","_interopRequireWildcard","_StyleSheet","_createElement","getAnimationStyle","animationType","visible","animatedSlideInStyles","animatedSlideOutStyles","animatedFadeInStyles","animatedFadeOutStyles","hidden","bottom","animatedIn","animationDuration","ANIMATION_DURATION","animationTimingFunction","animatedOut","pointerEvents","fadeIn","animationKeyframes","fadeOut","slideIn","slideOut","onDismiss","onShow","_React$useState","isRendering","setIsRendering","wasVisible","wasRendering","isAnimated","animationEndCallback","onAnimationEnd","_extends2","_objectWithoutPropertiesLoose2","_View","ModalContent","forwardRef","forwardedRef","active","onRequestClose","transparent","rest","closeOnEscape","modal","modalTransparent","modalOpaque","role","_UIManager","FocusBracket","tabIndex","focusBracket","attemptFocus","focusFirstDescendant","childNodes","focusLastDescendant","trapElementRef","focusRef","trapFocusInProgress","lastFocusedElement","trapFocus","Node","hasFocused","lastFocusedElementOutsideTrap","Fragment","outlineStyle","_reactDom","elementRef","_ModalPortal","_ModalAnimation","_ModalContent","_ModalFocusTrap","uniqueModalIdentifier","activeModalStack","activeModalListeners","notifyActiveModalListeners","activeModalId","modalId","removeActiveModal","Modal","_props$visible","setIsActive","onDismissCallback","onShowCallback","addActiveModal","_Dimensions","getFontScale","getPixelSizeForLayoutSize","layoutSize","roundToNearestPixel","OS","select","isTesting","_react","_useMergeRefs","_useHover","_usePressEvents","delayLongPress","delayPressIn","delayPressOut","onBlur","onContextMenu","onFocus","onHoverIn","onHoverOut","onKeyDown","onLongPress","onPressMove","onPressIn","onPressOut","testOnly_hovered","testOnly_pressed","_useForceableState","useForceableState","hovered","setHovered","_useForceableState2","focused","setFocused","_useForceableState3","pressed","setPressed","hostRef","setRef","pressConfig","delayPressStart","delayPressEnd","onPressChange","onPressStart","onPressEnd","pressEventHandlers","onContextMenuPress","onKeyDownPress","contain","onHoverChange","onHoverStart","onHoverEnd","_tabIndex","interactionState","blurHandler","focusHandler","contextMenuHandler","keyDownHandler","forced","_useState","touchAction","MemoedPressable","_normalizeValueWithProperty","emptyObject","supportsCSS3TextDecoration","CSS","supports","SYSTEM_FONT_STACK","STYLE_SHORT_FORM_EXPANSIONS","borderColor","borderBlockColor","borderInlineColor","borderStyle","borderBlockStyle","borderInlineStyle","borderWidth","borderBlockWidth","borderInlineWidth","insetBlock","insetInline","marginBlock","marginInline","paddingBlock","paddingInline","overscrollBehavior","borderEndStartRadius","borderEndEndRadius","borderStartStartRadius","borderStartEndRadius","insetBlockEnd","insetBlockStart","isInline","resolvedStyle","_loop","backgroundClip","WebkitBackgroundClip","flexBasis","textDecorationLine","textDecoration","direction","_value","longFormProperties","marginLeft","marginTop","paddingLeft","paddingRight","paddingTop","paddingBottom","longForm","seed","murmurhash2_32_gc","atomic","compiledStyle","$$css","compiledRules","atomicCompile","srcProp","valueString","stringifyValueWithProperty","cachedResult","createIdentifier","customGroup","atomicGroup","selector","_processKeyframesValu2","processKeyframesValue","animationNames","keyframesRules","createDeclarationBlock","_block","finalValue","_block2","_block3","_block4","_block5","scrollbarWidth","_block6","createAtomicRules","orderedRules","localizeableValue","PROPERTIES_VALUE","_left","_right","propPolyfill","PROPERTIES_I18N","ltr","rtl","PROPERTIES_FLIP","polyfillIndices","ltrPolyfillValues","rtlPolyfillValues","ltrVal","ltrPolyfill","rtlPolyfill","_ltr","_rtl","classic","_processKeyframesValu","_objectSpread2","classicGroup","inline","originalStyle","isRTL","frozenProps","nextStyle","originalValue","originalProp","originalValues","valuePolyfill","_createReactDOMStyle","_hash","_prefixStyles","inset","margin","insetInlineEnd","insetInlineStart","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRightColor","borderRightStyle","borderRightWidth","normalizedValue","domStyle","keyframesValue","keyframes","_createKeyframes","steps","stepName","createKeyframes","_isWebColor","_processColor","colorInt","_unitlessNumbers","colorProps","_normalizeColor","borderTopColor","borderBottomColor","shadowColor","textDecorationColor","textShadowColor","unitlessNumbers","gridRowGap","gridColumnGap","scaleX","scaleY","scaleZ","shadowOpacity","prefixKey","rootNode","getElementById","ShadowRoot","sheet","group","selectors","cssRules","cssRule","cssText","selectorText","groupPattern","decodeGroupRule","getSelectorText","sheetInsert","orderedGroups","getOrderedGroups","nextGroupIndex","nextGroup","isInserted","insertRule","insertRuleAt","groupNumber","previousStart","getTextContent","marker","insert","groupValue","markerRule","encodeGroupRule","selectorPattern","createSheet","defaultId","getRootNode","sheets","_createOrderedCSSStyleSheet","_createCSSStyleSheet","initialRules","rule","roots","initialSheet","_compiler","_dom","_transformLocalizeStyle","_preprocess","_styleq","staticStyleMap","defaultPreprocessOptions","shadow","textShadow","insertRules","compiledOrderedRules","absoluteFillObject","absoluteFill","compiledStyles","_atomic","styleObj","_classic","compileAndInsertReset","preprocess","writingDirection","styleProps","_options","preprocessOptions","styleq","factory","localizeStyle","customStyleq","compose","style1","style2","flatten","flatArray","getSheet","hairlineWidth","resolveRNStyle","stylesheet","createTransformValue","createTextShadowValue","createBoxShadowValue","_warnOnce","defaultOffset","shadowOffset","shadowRadius","offsetX","offsetY","blurRadius","textShadowOffset","textShadowRadius","_ref2","radius","mapTransform","PROPERTIES_STANDARD","borderBottomEndRadius","borderBottomStartRadius","borderTopEndRadius","borderTopStartRadius","borderEndColor","borderEndStyle","borderEndWidth","borderStartColor","borderStartStyle","borderStartWidth","marginEnd","marginHorizontal","marginStart","marginVertical","paddingEnd","paddingHorizontal","paddingStart","paddingVertical","ignoredProps","elevation","overlayColor","resizeMode","tintColor","warnOnce","boxShadowValue","boxShadow","textShadowValue","_value2","verticalAlign","validate","isInvalid","suggestion","invalidShortforms","invalidMultiValueShortforms","_postcssValueParser","borderBottom","borderLeft","borderRight","borderTop","font","grid","outline","backgroundPosition","TextAncestorContext","createContext","forwardedProps","_pick","_useElementLayout","_usePlatformMethods","_useResponderEvents","_TextAncestorContext","_useLocale","forwardPropsList","accessibilityProps","clickProps","focusProps","keyboardProps","mouseProps","touchProps","lang","hrefAttrs","numberOfLines","onLayout","onMoveShouldSetResponder","onMoveShouldSetResponderCapture","onResponderEnd","onResponderGrant","onResponderMove","onResponderReject","onResponderRelease","onResponderStart","onResponderTerminate","onResponderTerminationRequest","onScrollShouldSetResponder","onScrollShouldSetResponderCapture","onSelectionChangeShouldSetResponder","onSelectionChangeShouldSetResponderCapture","onStartShouldSetResponder","onStartShouldSetResponderCapture","hasTextAncestor","contextDirection","useLocaleContext","handleClick","component","langDirection","getLocaleDirection","componentDirection","dir","supportedProps","pickProps","WebkitLineClamp","textHasAncestor$raw","text$raw","textOneLine","textMultiLine","notSelectable","pressable","download","rel","platformMethodsRef","Provider","textStyle","boxSizing","listStyle","textAlign","whiteSpace","wordWrap","textOverflow","WebkitBoxOrient","userSelect","createExtraStyles","activeOpacity","underlayColor","underlay","hasPressHandler","focusable","onHideUnderlay","onShowUnderlay","rejectResponderTermination","extraStyles","setExtraStyles","showUnderlay","hideUnderlay","Children","only","accessibilityDisabled","actionable","cloneElement","MemoedTouchableHighlight","_getBoundingClientRect","_setValueForStyles","getRect","offsetHeight","offsetWidth","offsetLeft","offsetTop","offsetParent","clientLeft","clientTop","scrollY","scrollX","measureLayout","relativeToNativeNode","relativeNode","isConnected","relativeRect","_getRect","elementsToIgnore","BODY","INPUT","SELECT","TEXTAREA","UIManager","blur","isContentEditable","measure","measureInWindow","_getBoundingClientRec","onFail","onSuccess","updateView","configureNextLayoutAnimation","onAnimationDidEnd","setLayoutAnimationEnabledExperimental","onScroll","onWheel","view$raw","_AccessibilityUtil","_createDOMProps","accessibilityComponent","propsToAccessibilityComponent","domProps","LocaleProvider","_normalizeColors","int32Color","_isDisabled","_propsToAccessibilityComponent","_propsToAriaRole","AccessibilityUtil","propsToAriaRole","accessibilityStates","roleComponents","article","banner","blockquote","complementary","contentinfo","deletion","emphasis","figure","insertion","listitem","main","navigation","paragraph","region","strong","accessibilityRole","level","accessibilityLevel","accessibilityRoleToWebRole","adjustable","header","image","imagebutton","keyboardkey","label","none","summary","_role","inferredRole","canUsePassiveEvents","getOptions","compatListener","supported","supportsPassiveEvents","canUseDOM","_StyleSheet2","processIDRefList","idRefList","pointerEventsStyles","auto","_props","ariaActiveDescendant","accessibilityActiveDescendant","ariaAtomic","accessibilityAtomic","ariaAutoComplete","accessibilityAutoComplete","ariaBusy","accessibilityBusy","ariaChecked","accessibilityChecked","ariaColumnCount","accessibilityColumnCount","ariaColumnIndex","accessibilityColumnIndex","ariaColumnSpan","accessibilityColumnSpan","ariaControls","accessibilityControls","ariaCurrent","accessibilityCurrent","ariaDescribedBy","accessibilityDescribedBy","ariaDetails","accessibilityDetails","ariaDisabled","ariaErrorMessage","accessibilityErrorMessage","ariaExpanded","accessibilityExpanded","ariaFlowTo","accessibilityFlowTo","ariaHasPopup","accessibilityHasPopup","ariaHidden","accessibilityHidden","ariaInvalid","accessibilityInvalid","ariaKeyShortcuts","accessibilityKeyShortcuts","ariaLabel","accessibilityLabel","ariaLabelledBy","accessibilityLabelledBy","ariaLevel","ariaLive","accessibilityLiveRegion","ariaModal","accessibilityModal","ariaMultiline","accessibilityMultiline","ariaMultiSelectable","accessibilityMultiSelectable","ariaOrientation","accessibilityOrientation","ariaOwns","accessibilityOwns","ariaPlaceholder","accessibilityPlaceholder","ariaPosInSet","accessibilityPosInSet","ariaPressed","accessibilityPressed","ariaReadOnly","accessibilityReadOnly","ariaRequired","accessibilityRequired","ariaRoleDescription","accessibilityRoleDescription","ariaRowCount","accessibilityRowCount","ariaRowIndex","accessibilityRowIndex","ariaRowSpan","accessibilityRowSpan","ariaSelected","accessibilitySelected","ariaSetSize","accessibilitySetSize","ariaSort","accessibilitySort","ariaValueMax","accessibilityValueMax","ariaValueMin","accessibilityValueMin","ariaValueNow","accessibilityValueNow","ariaValueText","accessibilityValueText","nativeID","testID","_ariaActiveDescendant","_ariaAtomic","_ariaAutoComplete","_ariaBusy","_ariaChecked","_ariaColumnCount","_ariaColumnIndex","_ariaColumnSpan","_ariaControls","_ariaCurrent","_ariaDescribedBy","_ariaDetails","_ariaErrorMessage","_ariaExpanded","_ariaFlowTo","_ariaHasPopup","_ariaHidden","_ariaInvalid","_ariaKeyShortcuts","_ariaLabel","_ariaLabelledBy","_ariaLevel","_ariaLive","_ariaModal","_ariaMultiline","_ariaMultiSelectable","_ariaOrientation","_ariaOwns","_ariaPlaceholder","_ariaPosInSet","_ariaPressed","_ariaReadOnly","_ariaRequired","required","_ariaRoleDescription","_ariaRowCount","_ariaRowIndex","_ariaRowSpan","_ariaSelected","_ariaSetSize","_ariaSort","_ariaValueMax","_ariaValueMin","_ariaValueNow","_ariaValueText","dataProp","dataName","dataValue","inlineStyle","_id","onAuxClick","onGotPointerCapture","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerEnter","onPointerMove","onPointerLeave","onPointerOut","onPointerOver","onPointerUp","onKeyDownCapture","onKeyUp","onKeyUpCapture","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOver","onMouseOut","onMouseUp","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","getBoundingClientRect","selection","isTextNode","TEXT_NODE","addModalityListener","getActiveModality","activeModality","getModality","modality","testOnly_resetActiveModality","isEmulatingMouseEvents","KEYBOARD","previousModality","previousActiveModality","_addEventListener","MOUSE","TOUCH","CONTEXTMENU","MOUSEDOWN","MOUSEMOVE","MOUSEUP","POINTERDOWN","POINTERMOVE","SCROLL","SELECTIONCHANGE","TOUCHCANCEL","TOUCHMOVE","TOUCHSTART","bubbleOptions","captureOptions","restoreModality","callListeners","onPointerish","eventType","PointerEvent","nextObj","_createPrefixer","_static","prefixAll","_backgroundClip","_crossFade","_cursor","_filter","_imageSet","_logical","_position","_sizing","_transition","wms","appearance","textEmphasisPosition","textEmphasis","textEmphasisStyle","textEmphasisColor","boxDecorationBreak","clipPath","maskImage","maskMode","maskRepeat","maskPosition","maskClip","maskOrigin","maskSize","maskComposite","mask","maskBorderSource","maskBorderMode","maskBorderSlice","maskBorderWidth","maskBorderOutset","maskBorderRepeat","maskBorder","maskType","textDecorationStyle","textDecorationSkip","breakAfter","breakBefore","breakInside","columnFill","columnGap","columnRule","columnRuleColor","columnRuleStyle","columnRuleWidth","columnSpan","backdropFilter","hyphens","flowInto","flowFrom","regionFragment","textOrientation","fontKerning","textSizeAdjust","isCustomProperty","_dangerousStyleValue","styleName","styleValue","observer","ResizeObserver","resizeObserver","entries","entry","DOM_LAYOUT_HANDLER_NAME","layout","getResizeObserver","_useLayoutEffect","observe","unobserve","targetListeners","_useStable","removeTargetListener","clear","targetRef","onHoverUpdate","canUsePE","supportsPointerEvent","addMoveListener","_useEvent","addEnterListener","addLeaveListener","addLockListener","lockEventType","addUnlockListener","unlockEventType","hoverEnd","leaveListener","getPointerType","dispatchCustomEvent","moveListener","hoverStart","lockEvent","_modality","createEvent","_ref$bubbles","_ref$cancelable","initCustomEvent","useLayoutEffectImpl","LocaleContext","_isLocaleRTL","defaultLocale","isLocaleRTL","cachedRTL","Intl","Locale","script","maximize","rtlScripts","_unused","rtlLangs","_lang","_mergeRefs","hostNode","relativeToNode","success","failure","DELAY","ERROR","LONG_PRESS_DETECTED","NOT_RESPONDER","RESPONDER_ACTIVE_LONG_PRESS_START","RESPONDER_ACTIVE_PRESS_START","RESPONDER_INACTIVE_PRESS_START","RESPONDER_RELEASE","RESPONDER_TERMINATED","Transitions","RESPONDER_GRANT","getElementRole","getElementType","isActiveSignal","signal","isButtonRole","isPressStartSignal","isValidKeyPress","isSpacebar","isButtonish","normalizeDelay","delay","getTouchFromResponderEvent","_event$nativeEvent","_eventHandlers","_isPointerTouch","_longPressDelayTimeout","_longPressDispatched","_pressDelayTimeout","_pressOutDelayTimeout","_touchState","_responderElement","configure","_config","_cancelLongPressDelayTimeout","_cancelPressDelayTimeout","_cancelPressOutDelayTimeout","getEventHandlers","_createEventHandlers","shouldDelay","_selectionTerminated","_receiveSignal","_handleLongPress","keyupHandler","isNativeInteractiveElement","isActiveElement","isSpacebarKey","touch","_touchActivatePosition","hypot","_this$_config","_this$_config2","_this$_config3","prevState","nextState","_performTransitionSideEffects","isTerminalSignal","isPrevActive","isNextActive","_activate","_deactivate","_this$_config4","_onLongPress","_this$_config5","_this$_config6","pressResponderRef","_PressResponder","pressResponder","TOUCH_START","TOUCH_MOVE","TOUCH_END","TOUCH_CANCEL","SELECTION_CHANGE","MOUSE_UP","MOUSE_MOVE","MOUSE_DOWN","MOUSE_CANCEL","FOCUS_OUT","CONTEXT_MENU","BLUR","isCancelish","isEndish","isMoveish","isScroll","isSelectionChange","isStartish","addNode","_utils","setResponderId","responderListenersMap","attachListeners","__reactResponderSystemActive","eventListener","documentEventsBubblePhase","documentEventsCapturePhase","getResponderNode","currentResponder","removeNode","terminateResponder","_createResponderEvent","_ResponderEventTypes","_ResponderTouchHistoryStore","startRegistration","moveRegistration","shouldSetResponderEvents","touchstart","mousedown","touchmove","mousemove","scroll","emptyResponder","idPath","trackedTouchCount","responderTouchHistoryStore","ResponderTouchHistoryStore","changeCurrentResponder","responder","getResponderConfig","domEvent","eventTarget","isStartEvent","isPrimaryPointerDown","isMoveEvent","isEndEvent","isScrollEvent","isSelectionChangeEvent","responderEvent","recordTouchTrack","wantsResponder","eventPaths","getResponderPaths","wasNegotiated","currentResponderIdPath","eventIdPath","lowestCommonAncestor","getLowestCommonAncestor","nodePath","shouldSetCallbacks","shouldSetCallbackCaptureName","shouldSetCallbackBubbleName","check","shouldSetCallback","_i","_result","_id2","_node2","findWantsResponder","_currentResponder2","currentId","currentNode","_getResponderConfig2","dispatchConfig","registrationName","_getResponderConfig3","allowTransfer","attemptTransfer","_currentResponder","_getResponderConfig","isTerminateEvent","hasValidSelection","isReleaseEvent","hasTargetTouches","shouldTerminate","_currentResponder3","__DEV__","MAX_TOUCH_BANK","timestampForTouch","timestamp","getTouchIdentifier","recordTouchStart","touchHistory","touchRecord","touchBank","touchActive","startPageX","startPageY","startTimeStamp","currentPageX","currentPageY","currentTimeStamp","previousPageX","previousPageY","previousTimeStamp","resetTouchRecord","createTouchRecord","mostRecentTimeStamp","printTouch","printTouchBank","printed","_touchHistory","numberActiveTouches","indexOfSingleActiveTouch","topLevelType","recordTouchMove","recordTouchEnd","touchTrackToCheck","activeRecord","rect","propagationWasStopped","domEventChangedTouches","domEventType","normalizeIdentifier","normalizeTouches","locationX","locationY","emulatedTouches","emptyArray","getInitialValue","useStable","idCounter","isAttachedRef","ResponderSystem","requiresResponderSystem","isResponder","pathA","pathB","pathALength","pathBLength","itemA","indexA","itemB","indexB","eventPath","composedPathFallback","composedPath","getEventPath","getResponderId","_isSelectionValid","isPrimaryMouseDown","isPrimaryMouseMove","noModifiers","keyName","UNINITIALIZED","isScreenReaderEnabled","prefersReducedMotionMedia","matchMedia","AccessibilityInfo","isReduceMotionEnabled","matches","fetch","setAccessibilityFocus","reactTag","announceForAccessibility","announcement","nativeEventEmitter","isLayoutAnimationEnabled","shouldEmitW3CPointerEvents","shouldPressibilityUseW3CPointerEventsForHover","animatedShouldDebounceQueueFlush","animatedShouldUseSingleOp","RN$Bridgeless","__nativeAnimatedNodeTagCount","__nativeAnimationIdCount","waitingForQueuedOperations","queueOperations","queueAndExecuteBatchedOperations","flushQueueTimeout","nativeOps","API","saveValueCallback","queueOperation","setWaitingForIdentifier","unsetWaitingForIdentifier","disableQueue","clearImmediate","setImmediate","flushQueue","createAnimatedNode","updateAnimatedNodeConfig","startListeningToAnimatedNodeValue","stopListeningToAnimatedNodeValue","connectAnimatedNodes","parentTag","childTag","disconnectAnimatedNodes","startAnimatingNode","animationId","nodeTag","endCallback","stopAnimation","setAnimatedNodeValue","setAnimatedNodeOffset","flattenAnimatedNodeOffset","extractAnimatedNodeOffset","connectAnimatedNodeToView","viewTag","disconnectAnimatedNodeFromView","restoreDefaultValues","dropAnimatedNode","addAnimatedEventToView","eventMapping","removeAnimatedEventFromView","animatedNodeTag","SUPPORTED_COLOR_STYLES","SUPPORTED_STYLES","translateX","translateY","SUPPORTED_TRANSFORMS","rotate","rotateX","rotateY","rotateZ","perspective","SUPPORTED_INTERPOLATION_PARAMS","inputRange","outputRange","extrapolate","extrapolateRight","extrapolateLeft","isSupportedStyleProp","isSupportedTransformProp","isSupportedInterpolationParam","generateNewAnimationId","_warnedMissingNativeAnimated","shouldUseNativeDriver","useNativeDriver","isSupportedColorStyleProp","addWhitelistedStyleProp","addWhitelistedTransformProp","addWhitelistedInterpolationParam","validateStyles","validateTransform","configs","validateInterpolation","_key3","generateNewNodeTag","assertNativeAnimatedModule","transformDataType","PI","NativeEventEmitter","NativeAnimatedAPI","NativeAnimatedHelper","_uniqueId","__attach","__detach","__isNative","__nativeTag","__getValue","__getAnimatedValue","__addChild","__removeChild","__getChildren","__makeNative","platformConfig","_platformConfig","hasListeners","_startListeningToNativeValueUpdates","_stopListeningForNativeValueUpdates","__nativeAnimatedValueListener","__shouldUpdateListenersForNewNativeTag","__getNativeTag","__onAnimatedValueUpdateReceived","__callListeners","_this$__nativeTag","nativeTag","__getNativeConfig","__getPlatformConfig","__setPlatformConfig","super","_children","linear","createInterpolation","colorToRgba","pattern","stringShapeRegex","checkPattern","outputRanges","interpolations","shouldRound","startsWith","createInterpolationFromStringOutputRange","checkInfiniteRange","checkValidInputRange","easing","findRange","inputMin","inputMax","outputMin","outputMax","interpolate","normalizedColor","AnimatedInterpolation","_parent","_interpolation","parentValue","__transformDataType","__createInterpolation","_startingValue","_offset","_animation","operation","_updateValue","setOffset","flattenOffset","extractOffset","resetAnimation","animate","__isInteraction","InteractionManager","createInteractionHandle","previousAnimation","clearInteractionHandle","_tracking","tracking","flush","animatedStyles","findAnimatedStyles","animatedStyle","attachNativeEvent","viewRef","argMapping","eventMappings","traverse","nativeEventPath","animatedValueTag","mapping","detach","AnimatedEvent","_argMapping","__addListener","_callListeners","_attachedEvent","__removeListener","__getHandler","recMapping","recEvt","mappingKey","_len3","_key4","transforms","_transforms","transConfigs","flattenStyle","createAnimatedStyle","inputStyle","_inputStyle","_style","_walkStyleAndGetValues","updatedStyle","_walkStyleAndGetAnimatedValues","styleConfig","styleKey","_callback","_animatedView","__disconnectAnimatedView","__connectAnimatedView","setNativeView","animatedView","nativeViewTag","__restoreDefaultValues","propsConfig","propKey","useAnimatedProps","onUpdateRef","prevNodeRef","isUnmountingRef","prevNode","useAnimatedPropsLifecycle","effect","cleanupRef","refEffect","getScrollableNode","getEventTarget","_events$_i","_propName","callbackRef","reduceAnimatedProps","collapsable","createAnimatedComponent","_useAnimatedProps","reducedProps","_refs","useMergeRefs","passthroughAnimatedPropExplicitValues","passthroughStyle","passthroughProps","mergedStyle","FlatList","scrollEventThrottle","ScrollView","SectionList","_a","_b","_min","_max","_lastValue","diff","_warnedAboutDivideByZero","modulus","_modulus","animationClass","animationConfig","_animationClass","_animationConfig","_useNativeDriver","toValue","__getNativeAnimationConfig","valueIn","jointCallback","getLayout","getTranslateTransform","startNativeAnimationNextId","fromValue","onUpdate","onEnd","animatedValue","__nativeId","__debouncedOnEnd","__onEnd","__startNativeAnimation","startNativeAnimationWaitId","_config$deceleration","_config$isInteraction","_config$iterations","_deceleration","deceleration","_velocity","velocity","isInteraction","__iterations","iterations","__active","_fromValue","_onUpdate","_startTime","_animationFrame","requestAnimationFrame","abs","finished","cancelAnimationFrame","stiffnessFromOrigamiValue","oValue","dampingFromOrigamiValue","fromOrigamiTensionAndFriction","tension","friction","stiffness","damping","fromBouncinessAndSpeed","bounciness","speed","normalize","startValue","endValue","projectNormal","bouncyTension","bouncyFriction","b3Friction2","b3Friction3","linearInterpolation","SpringAnimation","_config$overshootClam","_config$restDisplacem","_config$restSpeedThre","_config$velocity","_config$velocity2","_config$delay","_config$stiffness","_config$damping","_config$mass","_overshootClamping","overshootClamping","_restDisplacementThreshold","restDisplacementThreshold","_restSpeedThreshold","restSpeedThreshold","_initialVelocity","_lastVelocity","_toValue","_delay","mass","_stiffness","_damping","_mass","_config$bounciness","_config$speed","springConfig","SpringConfig","_config$tension","_config$friction","_springConfig","_this$_initialVelocit","initialVelocity","_startPosition","_lastPosition","_lastTime","_frameTime","internalState","getInternalState","lastPosition","lastVelocity","lastTime","_timeout","deltaTime","v0","zeta","sqrt","omega0","omega1","x0","envelope","sin","cos","_envelope","isOvershooting","isVelocity","isDisplacement","_easeInOut","_config$easing","_config$duration","_easing","Easing","inOut","ease","_duration","duration","frames","numFrames","frame","defaultColor","isRgbaValue","AnimatedColor","isRgbaAnimatedValue","rgbaAnimatedValue","initColor","nativeColor","_processColor2","shouldUpdateNodeConfig","rgbaValue","_nativeTag","_combineCallbacks","onComplete","maybeVectorAnim","anim","configX","configY","_config$key","aX","aY","parallel","stopTogether","configR","configG","configB","configA","_config$_key","aR","aG","aB","aA","timing","_start2","singleConfig","_startNativeLoop","_isUsingNativeDriver","sequence","animations","doneCount","hasEnded","endResult","Value","ValueXY","Color","Interpolation","decay","_start3","spring","_start","modulo","diffClamp","stagger","loop","_temp","_ref$iterations","_ref$resetBeforeItera","resetBeforeIteration","isFinished","iterationsSoFar","restart","animatedEvent","forkEvent","unforkEvent","Event","inAnimationCallback","mockAnimationStart","guardedCallback","emptyAnimation","mockCompositeAnimation","anyValue","AnimatedImplementation","Animated","AnimatedMock","Image","query","listenerMapping","Appearance","getColorScheme","addChangeListener","mappedListener","colorScheme","Dimensions","NEWTON_ITERATIONS","SUBDIVISION_PRECISION","SUBDIVISION_MAX_ITERATIONS","kSampleStepSize","float32ArraySupported","aA1","aA2","calcBezier","aT","getSlope","bezier","mX1","mY1","mX2","mY2","sampleValues","getTForX","intervalStart","currentSample","kSplineTableSize","guessForT","initialSlope","_aGuessT","aGuessT","currentSlope","newtonRaphsonIterate","_aA","_aB","currentX","currentT","binarySubdivide","step0","step1","quad","cubic","poly","circle","elastic","bounce","_t","_t2","t2","x1","y1","x2","y2","deepDiffer","one","two","maxDepth","twoKey","numColumnsOrDefault","numColumns","scrollToEnd","_listRef","scrollToIndex","scrollToItem","scrollToOffset","recordInteraction","flashScrollIndicators","getScrollResponder","getNativeScrollRef","getScrollRef","_virtualizedListPairs","_captureRef","_getItem","itemIndex","_item","_getItemCount","_keyExtractor","items","_this$props$keyExtrac","keyExtractor","_renderer","ListItemComponent","renderItem","columnWrapperStyle","extraData","cols","renderProp","info","_item2","_index","row","it","separators","_memoizedRenderer","_checkProps","viewabilityConfigCallbackPairs","pair","viewabilityConfig","onViewableItemsChanged","_createOnViewableItemsChanged","prevProps","getItem","getItemCount","horizontal","_pushMultiColumnViewable","_this$props$keyExtrac2","changed","viewableItems","removeClippedSubviews","_removeClippedSubviews","_this$props$strictMod","strictMode","renderer","VirtualizedList","I18nManager","allowRTL","forceRTL","getConstants","assets","getAssetByID","assetId","dataUriPattern","ImageUriCache","_entries","lastUsedTimestamp","refCount","_cleanUpIfNeeded","leastRecentlyUsedKey","leastRecentlyUsedEntry","imageUris","_maximumEntries","requests","ImageLoader","abort","requestId","onerror","onload","getSize","interval","setInterval","load","clearInterval","naturalHeight","naturalWidth","onLoad","onDecode","prefetch","queryCache","uris","LOADED","LOADING","_filterId","svgDataUriPattern","resolveAssetUri","asset","scales","preferredScale","curr","scaleSuffix","httpServerLocation","svg","defaultSource","draggable","onLoadEnd","onLoadStart","updateState","_React$useState2","updateLayout","hiddenImageRef","filterRef","requestRef","shouldDisplaySource","_extractNonStandardSt","filterId","tintColorProp","flatStyle","filters","shadowString","extractNonStandardStyleProps","_resizeMode","_tintColor","selectedSource","displayImageUri","imageSizeStyle","_getAssetByID","resolveAssetDimensions","backgroundImage","backgroundSize","_hiddenImageRef$curre","_height3","_width3","scaleFactor","getBackgroundSize","hiddenImage","alt","accessibilityImage$raw","abortPendingRequest","_layout","undo","resizeModeStyles","visibility","floodColor","in2","operator","createTintColorSVG","ImageWithStatics","backgroundRepeat","center","cover","stretch","onMoreTasks","_onMoreTasks","_queueStack","tasks","popable","enqueue","task","_getCurrentQueue","enqueueTasks","cancelTasks","tasksToCancel","hasTasksToProcess","processNext","_genPromise","run","stackIdx","stackItem","ex","isSupported","requestIdleCallback","didTimeout","timeRemaining","cancelIdleCallback","_emitter","interactionStart","interactionComplete","runAfterInteractions","promise","_scheduleUpdate","_taskQueue","cancel","_inc","_addInteractionSet","_deleteInteractionSet","setDeadline","deadline","_deadline","_interactionSet","_nextUpdateHandle","_processUpdate","interactionCount","nextInteractionCount","begin","Keyboard","isVisible","dismiss","NativeModules","useEvent","usePressEvents","useHover","colors","onRefresh","progressBackgroundColor","progressViewOffset","refreshing","titleColor","normalizeScrollEvent","contentOffset","contentSize","scrollHeight","scrollWidth","layoutMeasurement","ScrollViewBase","_props$scrollEnabled","scrollEnabled","_props$scrollEventThr","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","scrollState","isScrolling","scrollLastTick","scrollTimeout","scrollRef","createPreventableScrollHandler","handleScrollTick","hideScrollbar","lastTick","eventThrottle","timeSinceLastTick","handleScrollEnd","handleScrollStart","scrollDisabled","overflowX","overflowY","_scrollNodeRef","_innerViewRef","isTouching","lastMomentumScrollBeginTime","lastMomentumScrollEndTime","observedScrollSinceBecomingResponder","becameResponderWhileAnimating","scrollResponderHandleScrollShouldSetResponder","scrollResponderHandleStartShouldSetResponderCapture","scrollResponderIsAnimating","scrollResponderHandleTerminationRequest","scrollResponderHandleTouchEnd","scrollResponderHandleResponderRelease","currentlyFocusedTextInput","TextInputState","currentlyFocusedField","keyboardShouldPersistTaps","onScrollResponderKeyboardDismissed","blurTextInput","scrollResponderHandleScroll","scrollResponderHandleResponderGrant","scrollResponderHandleScrollBeginDrag","onScrollBeginDrag","scrollResponderHandleScrollEndDrag","onScrollEndDrag","scrollResponderHandleMomentumScrollBegin","onMomentumScrollBegin","scrollResponderHandleMomentumScrollEnd","onMomentumScrollEnd","scrollResponderHandleTouchStart","scrollResponderHandleTouchMove","scrollResponderScrollTo","animated","behavior","scrollResponderZoomTo","scrollResponderScrollNativeHandleToKeyboard","nodeHandle","additionalOffset","preventNegativeScrollOffset","additionalScrollOffset","getInnerViewNode","scrollResponderTextInputFocusError","scrollResponderInputMeasureAndScrollToKeyboard","keyboardScreenY","keyboardWillOpenTo","endCoordinates","scrollOffsetY","scrollResponderKeyboardWillShow","onKeyboardWillShow","scrollResponderKeyboardWillHide","onKeyboardWillHide","scrollResponderKeyboardDidShow","onKeyboardDidShow","scrollResponderKeyboardDidHide","onKeyboardDidHide","scrollResponderFlashScrollIndicators","getInnerViewRef","scrollTo","scrollResponderNode","_handleContentOnLayout","_e$nativeEvent$layout","onContentSizeChange","_handleScroll","keyboardDismissMode","dismissKeyboard","_setInnerViewRef","_setScrollNodeRef","mergeRefs","scrollResponderHandleStartShouldSetResponder","scrollResponderHandleResponderReject","contentContainerStyle","refreshControl","stickyHeaderIndices","pagingEnabled","centerContent","contentSizeChangeProps","hasStickyHeaderIndices","isSticky","stickyHeader","pagingEnabledChild","contentContainer","contentContainerHorizontal","contentContainerCenterContent","baseStyle","baseHorizontal","baseVertical","pagingEnabledStyle","pagingEnabledHorizontal","pagingEnabledVertical","scrollResponderHandleTerminate","ScrollViewClass","scrollView","commonStyle","WebkitOverflowScrolling","scrollSnapType","scrollSnapAlign","ForwardedScrollView","VirtualizedSectionList","_subExtractor","_convertViewable","viewable","_info$index","keyExtractorWithNullableIndex","section","keyExtractorWithNonNullableIndex","_onViewableItemsChanged","_renderItem","listItemCount","infoIndex","renderSectionHeader","renderSectionFooter","SeparatorComponent","_getSeparatorComponent","ItemWithSeparator","LeadingSeparatorComponent","SectionSeparatorComponent","cellKey","leadingItem","leadingSection","prevCellKey","setSelfHighlightCallback","_setUpdateHighlightFor","setSelfUpdatePropsCallback","_setUpdatePropsFor","updateHighlightFor","_updateHighlightFor","updatePropsFor","_updatePropsFor","trailingItem","trailingSection","inverted","updateProps","_updatePropsMap","updateHighlight","_updateHighlightMap","updateHighlightFn","updatePropsFn","scrollToLocation","sectionIndex","sections","viewOffset","stickySectionHeadersEnabled","__getFrameMetricsApprox","toIndexParams","getListRef","passThroughProps","ItemSeparatorComponent","listHeaderOffset","ListHeaderComponent","itemCount","itemIdx","sectionData","_this$props2","isLastItemInList","isLastItemInSection","leadingSeparatorHiglighted","setLeadingSeparatorHighlighted","separatorHighlighted","setSeparatorHighlighted","_React$useState3","leadingSeparatorProps","setLeadingSeparatorProps","_React$useState4","separatorProps","setSeparatorProps","highlight","unhighlight","newProps","leadingSeparator","highlighted","separator","_wrapperListRef","listRef","_stickySectionHeadersEnabled","normalizeValueWithProperty","normalizeColor","createCSSStyleSheet","createOrderedCSSStyleSheet","OrderedCSSStyleSheet","crossFade","imageSet","logical","sizing","createPrefixer","prefixStyles","setSelection","isSelectionStale","setSelectionRange","autoCapitalize","autoComplete","autoCorrect","maxLength","onChange","placeholder","rows","spellCheck","focusTimeout","TextInput","_inputMode","_props$autoCapitalize","autoCompleteType","_props$autoCorrect","blurOnSubmit","caretHidden","clearTextOnFocus","editable","enterKeyHint","inputMode","keyboardType","_props$multiline","onChangeText","onKeyPress","onSelectionChange","onSubmitEditing","placeholderTextColor","_props$readOnly","returnKeyType","_props$secureTextEntr","secureTextEntry","selectTextOnFocus","showSoftInputOnFocus","prevSelection","prevSecureTextEntry","handleContentSizeChange","newHeight","newWidth","imperativeRef","isFocused","_currentlyFocusedNode","shouldBlurOnSubmit","isComposing","isEventComposing","onSelect","_e$target","_selection","textinput$raw","virtualkeyboardpolicy","State","MozAppearance","WebkitAppearance","resize","caretColor","useWindowDimensions","dims","setDims","handleChange","reactRoot","hydrateLegacy","renderLegacy","alert","RootTagContext","AppContainer","WrapperComponent","innerView","appContainer","rootTag","wrapperComponentProvider","runnables","componentProviderInstrumentationHook","AppRegistry","getAppKeys","getApplication","appKey","appParameters","registerComponent","componentProvider","RootComponent","initialProps","getStyleElement","renderApplication","shouldHydrate","renderFn","registerConfig","registerRunnable","runApplication","setComponentProviderInstrumentationHook","hook","setWrapperComponentProvider","provider","unmountApplicationComponentAtRootTag","isPrefixed","EVENT_TYPES","VISIBILITY_CHANGE_EVENT","VISIBILITY_STATE_PROPERTY","AppStates","changeEmitter","AppState","currentState","isAvailable","clipboardAvailable","exitApp","Clipboard","queryCommandSupported","getString","setString","selectNodeContents","execCommand","configureNext","Presets","easeInEaseOut","springDamping","Types","easeIn","easeOut","keyboard","Properties","scaleXY","checkConfig","initialURL","urlToOpen","URL","_eventCallbacks","_dispatchEvent","filteredCallbacks","canOpenURL","getInitialURL","openURL","_validateURL","TouchHistoryMath","centroidDimension","touchesChangedAfter","isXAxis","ofCurrent","oneTouchData","touchTrack","noCentroid","currentCentroidXOfTouchesChangedAfter","currentCentroidYOfTouchesChangedAfter","previousCentroidXOfTouchesChangedAfter","previousCentroidYOfTouchesChangedAfter","currentCentroidX","currentCentroidY","PanResponder","_initializeGestureState","gestureState","moveX","moveY","y0","dx","dy","vx","vy","_accountsForMovesUpTo","_updateGestureStateOnMove","movedAfter","prevX","prevY","nextDX","nextDY","dt","shouldCancelClick","timeout","stateID","panHandlers","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","clearInteractionTimeout","onPanResponderGrant","onShouldBlockNativeResponder","onPanResponderReject","onPanResponderRelease","setInteractionTimeout","onPanResponderStart","onPanResponderMove","onPanResponderEnd","onPanResponderTerminate","onPanResponderTerminationRequest","onClickCapture","getInteractionHandle","content","navigator","sharedAction","dismissedAction","vibrate","createSvgCircle","cx","cy","fill","ActivityIndicator","_props$animating","animating","_props$color","_props$hidesWhenStopp","hidesWhenStopped","_props$size","viewBox","stroke","indicatorSizes","animationPause","animationPlayState","small","large","TouchableOpacity","setDuration","_useState2","opacityOverride","setOpacityOverride","setOpacityTo","setOpacityActive","setOpacityInactive","isGrant","transitionDuration","MemoedTouchableOpacity","buttonDisabled","textDisabled","textTransform","CheckBox","onValueChange","fakeControl","fakeControlChecked","fakeControlDisabled","fakeControlCheckedAndDisabled","nativeControl","cursorInherit","cursorDefault","ImageBackground","_props$style","imageStyle","imageRef","_StyleSheet$flatten","KeyboardAvoidingView","relativeKeyboardHeight","keyboardFrame","keyboardY","keyboardVerticalOffset","onKeyboardChange","Picker","selectedValue","itemStyle","prompt","selectedIndex","initial","usePlatformMethods","Item","ProgressBar","_props$indeterminate","indeterminate","_props$progress","progress","_props$trackColor","trackColor","percentageProgress","forcedColorAdjust","cssFunction","SafeAreaView","StatusBar","setBackgroundColor","setBarStyle","setHidden","setNetworkActivityIndicatorVisible","setTranslucent","CSS_UNIT_RE","thumbDefaultBoxShadow","thumbFocusedBoxShadow","defaultDisabledTrackColor","defaultDisabledThumbColor","Switch","activeThumbColor","activeTrackColor","_props$disabled","thumbColor","_props$value","thumbRef","handleFocusState","styleHeight","styleWidth","trackBorderRadius","trackCurrentColor","true","false","thumbCurrentColor","thumbHeight","thumbWidth","rootStyle","disabledTrackColor","disabledThumbColor","trackStyle","thumbStyle","thumb","thumbActive","alignSelf","twoArgumentPooler","a1","a2","Klass","instancePool","standardReleaser","destructor","poolSize","DEFAULT_POOLER","addPoolingTo","CopyConstructor","pooler","NewKlass","getPooled","release","BoundingDimensions","getPooledFromElement","Position","extractSingleTouch","hasTouches","hasChangedTouches","States","baseStatesConditions","RESPONDER_INACTIVE_PRESS_IN","RESPONDER_INACTIVE_PRESS_OUT","RESPONDER_ACTIVE_PRESS_IN","RESPONDER_ACTIVE_PRESS_OUT","RESPONDER_ACTIVE_LONG_PRESS_IN","RESPONDER_ACTIVE_LONG_PRESS_OUT","IsActive","IsPressingIn","IsLongPressingIn","Signals","ENTER_PRESS_RECT","LEAVE_PRESS_RECT","TouchableMixin","touchableNode","getTouchableNode","_touchableBlurListener","_isTouchableKeyboardActive","touchState","touchableHandleResponderTerminate","touchableDelayTimeout","longPressDelayTimeout","pressOutDelayTimeout","pressInLocation","responderID","touchableGetInitialState","touchableHandleResponderTerminationRequest","touchableHandleStartShouldSetResponder","touchableLongPressCancelsPress","touchableHandleResponderGrant","dispatchID","delayMS","touchableGetHighlightDelayMS","_handleDelay","longDelayMS","touchableGetLongPressDelayMS","LONG_PRESS_THRESHOLD","_handleLongDelay","touchableHandleResponderRelease","touchableHandleResponderMove","positionOnActivate","dimensionsOnActivate","pressRectOffset","touchableGetPressRectOffset","pressExpandLeft","pressExpandTop","pressExpandRight","pressExpandBottom","hitSlop","touchableGetHitSlop","_getDistanceBetweenPoints","touchableHandleFocus","touchableHandleBlur","_remeasureMetricsOnActivation","_handleQueryLayout","globalX","globalY","curState","_performSideEffectsForTransition","_isHighlight","_savePressInLocation","bX","bY","curIsHighlight","newIsHighlight","isInitialTransition","isActiveTransition","touchableHandleLongPress","_startHighlight","_endHighlight","hasLongPressHandler","pressIsLongButStillCallOnPress","touchableHandlePress","_playTouchSound","playTouchSound","touchableHandleActivePressIn","touchableHandleActivePressOut","touchableGetPressOutDelayMS","touchableHandleKeyEvent","withoutDefaultFocusAndBlur","TouchableMixinWithoutDefaultFocusAndBlur","Touchable","Mixin","TOUCH_TARGET_DEBUG","renderDebugView","debugHitSlopStyle","hexColor","unimplementedViewStyles","accessibilityState","accessibilityValue","TouchableWithoutFeedback","elementProps","MemoedTouchableWithoutFeedback","YellowBox","ignoreWarnings","ignoreLogs","ignoreAllLogs","uninstall","install","useColorScheme","setColorScheme","focusTextInput","textFieldNode","useElementLayout","PressResponder","createResponderEvent","useResponderEvents","nativeModule","_nativeModule","_this$_nativeModule","_this$_nativeModule2","removeListeners","_this$_nativeModule3","_this$_nativeModule4","computeWindowedRenderLimits","maxToRenderPerBatch","windowSize","getFrameMetricsApprox","scrollMetrics","visibleLength","_scrollMetrics$zoomSc","zoomScale","visibleBegin","visibleEnd","overscanLength","fillPreference","overscanBegin","overscanEnd","_elementsThatOverlapO","offsets","getFrameMetrics","offsetIndex","currentOffset","mid","scaledOffsetStart","scaledOffsetEnd","elementsThatOverlapOffsets","overscanFirst","overscanLast","newCellCount","newRangeCount","maxNewCells","firstWillAddMore","firstShouldIncrement","lastWillAddMore","lastShouldIncrement","dispose","_taskHandle","schedule","CellRenderMask","numCells","_numCells","_regions","isSpacer","enumerateRegions","addCells","cells","_this$_findRegion","_findRegion","firstIntersect","firstIntersectIdx","_this$_findRegion2","lastIntersect","lastIntersectIdx","newLeadRegion","newTailRegion","newMainRegion","replacementRegions","numRegionsToDelete","every","cellIdx","firstIdx","lastIdx","middleIdx","middleRegion","ChildListCollection","_cellKeyToChildren","_childrenToCellKey","_this$_cellKeyToChild","cellLists","listSet","forEachInCell","_this$_cellKeyToChild2","anyInCell","_this$_cellKeyToChild3","Info","any_blank_count","any_blank_ms","any_blank_speed_sum","mostly_blank_count","mostly_blank_ms","pixels_blank","pixels_sampled","pixels_scrolled","total_time_spent","sample_count","_minSampleCount","_sampleRate","setSampleRate","sampleRate","setMinSampleCount","minSampleCount","_anyBlankStartTime","_enabled","_info","_mostlyBlankStartTime","_samplesStartTime","_getFrameMetrics","_resetData","activate","performance","deactivateAndFlush","computeBlankness","cellsAroundViewport","dOffset","scrollSpeed","blankTop","firstFrame","inLayout","blankBottom","lastFrame","bottomEdge","blankness","StateSafePureComponent","_inAsyncStateUpdate","_installSetStateHooks","partialState","newState","_isViewable","viewAreaMode","viewablePercentThreshold","viewportHeight","itemLength","_isEntirelyVisible","pixels","visibleHeight","_getPixelsVisible","viewAreaCoveragePercentThreshold","_hasInteracted","_timers","_viewableIndices","_viewableItems","computeViewableItems","scrollOffset","renderRange","itemVisiblePercentThreshold","viewableIndices","firstVisible","metrics","createViewToken","waitForInteraction","minimumViewTime","_onUpdateSync","resetViewableIndices","viewableIndicesToCheck","prevItems","nextItems","_step$value","_step2$value","_viewable","isViewable","VirtualizedListContext","VirtualizedListContextProvider","getScrollMetrics","getOutermostParentListRef","registerAsNestedChild","unregisterAsNestedChild","VirtualizedListCellContextProvider","_ref3","currContext","CellRenderer","_separators","onUpdateSeparators","_this$props3","_onLayout","onCellLayout","updateSeparatorProps","onUnmount","_renderElement","_this$props4","CellRendererComponent","inversionStyle","onCellFocusCapture","itemSeparator","cellStyle","rowReverse","columnReverse","onFocusCapture","_usedIndexForKey","_keylessItemComponentName","horizontalOrDefault","maxToRenderPerBatchOrDefault","onEndReachedThresholdOrDefault","onEndReachedThreshold","getScrollingThreshold","threshold","windowSizeOrDefault","veryLast","_footerLength","_scrollMetrics","_scrollRef","getItemLayout","onScrollToIndexFailed","viewPosition","_highestMeasuredFrameIndex","averageItemLength","_averageCellLength","highestMeasuredFrameIndex","_getOffsetApprox","_nestedChildLists","childList","_viewabilityTuples","viewabilityHelper","_updateViewableItems","_getCellKey","_this$context","hasMore","_hasMore","_this$props$updateCel","_getScrollMetrics","_getOutermostParentListRef","_isNestedWithSameOrientation","_registerAsNestedChild","_unregisterAsNestedChild","_onUpdateSeparators","_cellRefs","_getSpacerKey","isVertical","_frames","_hasTriggeredInitialScrollToIndex","_hasWarned","_headerLength","_hiPriInProgress","_indicesToKeys","_lastFocusedCellKey","_offsetFromParentVirtualizedList","_prevParentOffset","contentLength","_sentStartForContentLength","_sentEndForContentLength","_totalCellLength","_totalCellsMeasured","_captureScrollRef","_defaultRenderScrollComponent","_props$refreshing","RefreshControl","_onCellLayout","_selectOffset","_selectLength","_scheduleCellsToRenderUpdate","_triggerRemeasureForChildListsInCell","_computeBlankness","_onCellUnmount","measureLayoutRelativeToContainingList","_maybeCallOnEdgeReached","_onLayoutEmpty","_onLayoutFooter","_getFooterCellKey","_onLayoutHeader","_onContentSizeChange","initialScrollIndex","_convertParentScrollMetrics","_onScroll","_this$_convertParentS","perf","prevDt","_fillRateHelper","_onScrollBeginDrag","tuple","_onScrollEndDrag","_onMomentumScrollBegin","_onMomentumScrollEnd","_updateCellsToRender","_adjustCellsAroundViewport","renderMask","_createRenderMask","_getNonViewportRenderRegions","_createViewToken","isInteger","frameMetrics","focusedCellIndex","heightOfCellsBeforeFocused","heightOfCellsAfterFocused","_updateCellsToRenderBatcher","updateCellsBatchingPeriod","initialRenderRegion","_initialRenderRegion","invertedWheelEventHandler","ev","scrollLength","clientLength","isEventTargetScrollable","leftoverDelta","targetDelta","nextScrollLeft","nextScrollTop","additionalRegions","_i2","_allRegions","initialRegion","stickyIndicesSet","_ensureClosestStickyHeader","_props$initialScrollI","initialNumToRender","firstCellIndex","stickyOffset","newCellsAroundViewport","_this$_scrollMetrics","distanceFromEnd","_constrainToItemCount","disableVirtualization","renderAhead","EPSILON","childIdx","_findFirstChildWithMore","cellKeyForIndex","setupWebWheelHandler","teardownWebWheelHandler","constrainedCells","_pushCells","stickyIndicesFromProps","debug","shouldListenForLayout","_onCellFocusCapture","nestedContext","_this$props5","ListEmptyComponent","ListFooterComponent","_this$props6","horizontallyInverted","verticallyInverted","_element","ListHeaderComponentStyle","_element2","spacerKey","renderRegions","lastSpacer","findLastWhere","firstMetrics","lastMetrics","spacerSize","_element3","ListFooterComponentStyle","scrollProps","invertStickyHeaders","renderScrollComponent","_renderDebugOverlay","_this$props7","hiPriInProgress","framesInLayout","windowTop","frameLast","windowLen","visTop","visLen","debugOverlayBase","debugOverlay","debugOverlayFrame","debugOverlayFrameLast","debugOverlayFrameVis","_this$props8","onStartReached","onStartReachedThreshold","onEndReached","_this$_scrollMetrics2","distanceFromStart","isWithinStartThreshold","isWithinEndThreshold","_this$state$cellsArou","_this$_scrollMetrics3","hiPri","onStartReachedThresholdOrDefault","distTop","distBottom","_registry","registrations","registry","registration","_arr","forceUpdate","__self","__source","_status","toArray","Profiler","StrictMode","act","_currentValue2","_threadCount","_defaultValue","_globalName","createFactory","createRef","isValidElement","lazy","startTransition","unstable_act","OwnPropertyKeys","CreateMethodProperty","setToStringTag","sortIndex","startTime","expirationTime","priorityLevel","scheduling","isInputPending","MessageChannel","port2","port1","onmessage","postMessage","unstable_Profiling","unstable_continueExecution","unstable_forceFrameRate","unstable_getFirstCallbackNode","unstable_next","unstable_pauseExecution","unstable_runWithPriority","unstable_wrapCallback","hasDescriptors","gOPD","$floor","functionLengthIsConfigurable","functionLengthIsWritable","deep","allocUnsafe","cloneBuffer","cloneSymbol","byteLength","cloneArrayBuffer","buffer","byteOffset","cloneTypedArray","lastIndex","cloneRegExp","inspect","$WeakMap","$Map","$weakMapGet","$weakMapSet","$weakMapHas","$mapGet","$mapSet","$mapHas","listGetNode","$wm","$m","$o","assert","objects","listGet","listHas","hasMap","mapSizeDescriptor","mapSize","mapForEach","hasSet","setSizeDescriptor","setSize","setForEach","weakMapHas","weakSetHas","weakRefDeref","deref","booleanValueOf","functionToString","$match","$slice","$toUpperCase","$toLowerCase","$test","$join","$arrSlice","bigIntValueOf","gOPS","symToString","hasShammedSymbols","gPO","addNumericSeparator","sepRegex","intStr","dec","utilInspect","inspectCustom","inspectSymbol","isSymbol","wrapQuotes","defaultStyle","quoteChar","quoteStyle","inspect_","seen","maxStringLength","customInspect","indent","numericSeparator","inspectString","bigIntStr","baseIndent","getIndent","noIndent","newOpts","nameOf","arrObjKeys","symString","markBoxed","HTMLElement","isElement","attrs","attributes","xs","singleLineValues","indentedJoin","cause","isMap","mapParts","collectionOf","isSet","setParts","isWeakMap","weakCollectionOf","isWeakSet","isWeakRef","isBigInt","ys","protoTag","stringTag","trailer","lowbyte","lineJoiner","symMap","util","hasNativeMap","ArraySet","_array","_set","fromArray","aArray","aAllowDuplicates","aStr","sStr","toSetString","isDuplicate","at","aIdx","base64","aValue","digit","encoded","vlq","toVLQSigned","VLQ_BASE","aIndex","aOutParam","continuation","shifted","strLen","intToCharMap","recursiveSearch","aLow","aHigh","aNeedle","aHaystack","aCompare","aBias","cmp","LEAST_UPPER_BOUND","GREATEST_LOWER_BOUND","MappingList","_sorted","_last","generatedLine","generatedColumn","unsortedForEach","aCallback","aThisArg","aMapping","mappingA","mappingB","lineA","lineB","columnA","columnB","compareByGeneratedPositionsInflated","swap","ary","temp","doQuickSort","comparator","low","high","pivot","binarySearch","base64VLQ","quickSort","SourceMapConsumer","aSourceMap","aSourceMapURL","sourceMap","parseSourceMapInput","IndexedSourceMapConsumer","BasicSourceMapConsumer","getArg","names","sourceRoot","sourcesContent","mappings","_version","isAbsolute","relative","_names","_sources","_absoluteSources","computeSourceURL","_mappings","_sourceMapURL","Mapping","originalLine","originalColumn","lastOffset","line","column","_sections","offsetLine","offsetColumn","generatedOffset","fromSourceMap","__generatedMappings","_parseMappings","__originalMappings","_charIsMappingSeparator","aSourceRoot","GENERATED_ORDER","ORIGINAL_ORDER","eachMapping","aContext","aOrder","_generatedMappings","_originalMappings","allGeneratedPositionsFor","aArgs","needle","_findSourceIndex","_findMapping","compareByOriginalPositions","lastColumn","aSource","relativeSource","smc","_sourceRoot","_generateSourcesContent","_file","generatedMappings","destGeneratedMappings","destOriginalMappings","srcMapping","destMapping","previousGeneratedColumn","previousOriginalLine","previousOriginalColumn","previousSource","previousName","cachedSegments","originalMappings","compareByGeneratedPositionsDeflated","aMappings","aLineName","aColumnName","aComparator","computeColumnSpans","nextMapping","lastGeneratedColumn","originalPositionFor","hasContentsOfAllSources","some","sourceContentFor","nullOnMissing","urlParse","fileUriAbsPath","scheme","generatedPositionFor","bias","generatedPosition","sectionMappings","adjustedMapping","SourceMapGenerator","_skipValidation","_sourcesContents","aSourceMapConsumer","generator","newMapping","generated","original","addMapping","sourceFile","sourceRelative","setSourceContent","_validateMapping","aSourceFile","aSourceContent","applySourceMap","aSourceMapPath","newSources","newNames","aGenerated","aOriginal","aName","_serializeMappings","nameIdx","sourceIdx","previousGeneratedLine","aSources","REGEX_NEWLINE","isSourceNode","SourceNode","aLine","aColumn","aChunks","sourceContents","fromStringWithSourceMap","aGeneratedCode","aRelativePath","remainingLines","remainingLinesIndex","shiftNextLine","getNextLine","lastGeneratedLine","lastMapping","nextLine","addMappingWithCode","aChunk","chunk","aFn","aSep","newChildren","replaceRight","aPattern","aReplacement","walkSourceContents","fromSetString","toStringWithSourceMap","sourceMappingActive","lastOriginalSource","lastOriginalLine","lastOriginalColumn","lastOriginalName","sourceContent","aDefaultValue","urlRegexp","dataUrlRegexp","aUrl","auth","host","port","urlGenerate","aParsedUrl","aPath","up","aRoot","aPathUrl","aRootUrl","supportsNullProto","isProtoString","strcmp","aStr1","aStr2","onlyCompareOriginal","onlyCompareGenerated","sourceURL","sourceMapURL","parsed","hex_chr","md5cycle","md5blk","md5blks","md5blk_array","md51","tmp","lo","md51_array","subarray","rhex","hex","toUtf8","utf8Str2ArrayBuffer","returnUInt8Array","buff","arrayBuffer2Utf8Str","concatenateArrayBuffers","second","hexToBinaryString","bytes","SparkMD5","clamp","targetArray","sourceArray","appendBinary","contents","_buff","_length","raw","_finish","hashBinary","EventListener","eventOptions","unorderedBindings","bindingConnected","bindingDisconnected","handleEvent","extendedEvent","stopImmediatePropagation","immediatePropagationStopped","extendEvent","bindings","hasBindings","leftIndex","rightIndex","Dispatcher","application","eventListenerMaps","started","eventListeners","fetchEventListenerForBinding","clearEventListeners","clearEventListenersForBinding","handleError","removeMappedEventListenerFor","eventListenerMap","fetchEventListenerMapForEventTarget","fetchEventListener","createEventListener","defaultActionDescriptorFilters","prevent","descriptorPattern","parseEventTarget","eventTargetName","namespaceCamelize","isSomething","hasProperty","allModifiers","schema","defaultEventNames","getDefaultEventNameForElement","methodName","keyFilter","forToken","descriptorString","parseActionDescriptorString","eventFilter","shouldIgnoreKeyboardEvent","keyFilterDissatisfied","standardFilter","keyMappings","shouldIgnoreMouseEvent","typecast","ctrl","modifier","details","textarea","o_O","Binding","actionEvent","prepareActionEvent","willBeInvokedByEvent","applyEventModifiers","invokeWithEvent","controller","actionDescriptorFilters","passes","logDebugActivity","KeyboardEvent","MouseEvent","Element","scope","containsElement","ElementObserver","mutationObserverInit","subtree","elements","mutationObserver","MutationObserver","mutations","processMutations","refresh","pause","takeRecords","matchElementsInTree","removeElement","addElement","mutation","processMutation","processAttributeChange","processRemovedNodes","removedNodes","processAddedNodes","addedNodes","elementAttributeChanged","matchElement","elementFromNode","processTree","elementIsActive","tree","processor","ELEMENT_NODE","elementMatched","elementUnmatched","AttributeObserver","elementObserver","hasAttribute","elementMatchedAttribute","elementUnmatchedAttribute","elementAttributeValueChanged","del","prune","Multimap","valuesByKey","hasKey","hasValue","getValuesForKey","getKeysForValue","_values","SelectorObserver","_selector","matchesByElement","selectorMatchElement","selectorMatched","selectorUnmatched","_attributeName","matchedBefore","StringMapObserver","stringMap","attributeOldValue","knownAttributeNames","refreshAttribute","oldValue","getStringMapKeyForAttribute","stringMapKeyAdded","stringMapValueChanged","stringMapKeyRemoved","currentAttributeNames","recordedAttributeNames","attribute","TokenListObserver","attributeObserver","tokensByElement","tokensMatched","readTokensForElement","unmatchedTokens","matchedTokens","refreshTokensForElement","tokensUnmatched","tokenMatched","tokenUnmatched","previousTokens","currentTokens","firstDifferingIndex","zip","findIndex","previousToken","currentToken","tokenString","parseTokenString","ValueListObserver","tokenListObserver","parseResultsByToken","valuesByTokenByElement","fetchParseResultForToken","fetchValuesByTokenForElement","elementMatchedValue","elementUnmatchedValue","parseResult","parseToken","valuesByToken","parseValueForToken","BindingObserver","bindingsByAction","valueListObserver","actionAttribute","disconnectAllActions","connectAction","disconnectAction","ValueObserver","stringMapObserver","valueDescriptorMap","invokeChangedCallbacksForDefaultValues","invokeChangedCallback","writer","valueDescriptorNameMap","valueDescriptors","rawValue","rawOldValue","changedMethodName","changedMethod","reader","descriptors","hasMethodName","TargetObserver","targetsByName","disconnectAllTargets","connectTarget","disconnectTarget","targetConnected","targetDisconnected","readInheritableStaticArrayValues","ancestors","getAncestorsForConstructor","definition","getOwnStaticArrayValues","readInheritableStaticObjectPairs","pairs","getOwnStaticObjectPairs","OutletObserver","outletsByName","outletElementsByName","selectorObserverMap","attributeObserverMap","outletDefinitions","outletName","setupSelectorObserverForOutlet","setupAttributeObserverForOutlet","dependentContexts","disconnectAllOutlets","stopSelectorObservers","stopAttributeObservers","outlet","getOutlet","connectOutlet","getOutletFromMap","disconnectOutlet","hasOutlet","hasOutletController","controllerAttribute","getOutletNameFromOutletAttributeName","updateSelectorObserverForOutlet","outletConnected","outletDisconnected","selectorObserver","attributeNameForOutletName","outlets","getSelectorForOutletName","outletAttributeForScope","find","outletDependencies","router","modules","controllerConstructor","dependentControllerIdentifiers","identifiers","contexts","getControllerForElementAndIdentifier","functionName","bindingObserver","dispatcher","valueObserver","targetObserver","outletObserver","initialize","parentElement","invokeControllerMethod","bless","shadowConstructor","shadowProperties","getOwnKeys","shadowingDescriptor","getShadowedDescriptor","getShadowProperties","blessings","blessedProperties","blessing","getBlessedProperties","extendWithReflect","extended","testReflectExtension","Module","blessDefinition","contextsByScope","connectedContexts","connectContextForScope","fetchContextForScope","disconnectContextForScope","ClassMap","getDataKey","getAll","getAttributeName","getAttributeNameForKey","DataMap","Guide","warnedKeysByObject","warnedKeys","attributeValueContainsToken","TargetSet","targetName","targetNames","findTarget","findLegacyTarget","targets","findAllTargets","findAllLegacyTargets","getSelectorForTargetName","findElement","findAllElements","targetAttributeForScope","getLegacySelectorForTargetName","deprecate","targetDescriptor","targetAttribute","revisedAttributeName","guide","OutletSet","controllerElement","outletNames","findOutlet","findAllOutlets","queryElements","matchesElement","Scope","classes","closest","controllerSelector","documentScope","isDocumentScope","ScopeObserver","scopesByIdentifierByElement","scopeReferenceCounts","parseValueForElementAndIdentifier","scopesByIdentifier","fetchScopesByIdentifierForElement","createScopeForElementAndIdentifier","referenceCount","scopeConnected","scopeDisconnected","Router","scopeObserver","modulesByIdentifier","loadDefinition","unloadIdentifier","connectModule","afterLoad","disconnectModule","getContextForElementAndIdentifier","proposeToConnectScopeForElementAndIdentifier","defaultSchema","enter","tab","esc","space","down","home","page_up","page_down","objectFromEntries","Application","logFormattedMessage","register","registerActionOption","shouldLoad","unload","controllers","groupCollapsed","groupEnd","getOutletController","getControllerAndEnsureConnectedScope","outletController","parseValueDefinitionPair","typeDefinition","typeObject","typeFromObject","hasType","hasDefault","fullObject","onlyType","onlyDefault","parseValueTypeConstant","typeFromDefaultValue","parseValueTypeDefault","parseValueTypeObject","typeFromConstant","propertyPath","parseValueTypeDefinition","defaultValuesByType","constantFromType","defaultValueForDefinition","hasCustomDefaultValue","readers","writers","valueDescriptorForTokenAndTypeDefinition","boolean","writeJSON","Controller","_identifier","_application","CustomEvent","classDefinition","targetDefinition","propertiesForTargetDefinition","valueDefinitionPairs","propertyDescriptorMap","valueDefinitionPair","valueDescriptor","read","write","propertiesForValueDefinitionPair","outletDefinition","camelizedName","outletElement","propertiesForOutletDefinition","definitionsFromContext","logicalName","identifierForContextKey","definitionForModuleAndIdentifier","definitionForModuleWithContextAndKey","de_DE","days","shortDays","months","shortMonths","AM","PM","am","pm","en_CA","ordinalSuffixes","en_US","es_MX","fr_FR","it_IT","nl_NL","pt_BR","ru_RU","tr_TR","zh_CN","DefaultLocale","defaultStrftime","Strftime","customTimezoneOffset","useUtcTimezone","_cachedDate","_locale","_customTimezoneOffset","_useUtcBasedDate","_cachedDateTimestamp","_processFormat","resultString","isInScope","extendedTZ","currentCharCode","getDay","getMonth","padTill2","getFullYear","getHours","hours12","padTill3","getMinutes","getSeconds","weekNumber","getTimezoneName","day","ordinal","sign","getTimezoneOffset","sep","hours","mins","strftime","utcOffset","getTimestampToUtcOffsetFor","newUTCOffset","currentTimestamp","localize","localizeByIdentifier","localeIdentifier","timezone","useUtcBasedDate","timezoneType","utc","numberToPad","paddingChar","hour","firstWeekday","weekday","firstDayOfYearUtc","UTC","dateUtc","weekNum","tzString","toLocaleString","timeZoneName","getShortTimezoneName","getDefaultTimezoneName","createStyleq","disableCache","disableMix","definedProperties","nextCache","possibleStyle","classNameChunk","cacheEntry","definedPropertiesChunk","weakMap","subStyle","_prop","markerProp","compiledStyleIndex","_cachedStyles","_compiledStyle","compileStyle","cachedStyles","callbacks","currentTime","toPropertyKey","_extends","_getRequireWildcardCache","getOwnPropertyDescriptors","ReadersWriterLock","_debug","_readers","_writers","_processQueueTimeout","_readQueue","_writeQueue","_log","_readWithResolve","_writeWithResolve","_processRead","_processWrite","_processQueueLater","_processQueue","readQueueItem","writeQueueItem","FormDataToObject","formData","formDataFromObject","treatInitial","firstMatch","inputName","newResult","treatSecond","secondMatch","newRest","precision","numberParts","wholeNumbers","decimals","numberWithDelimiters","DefineOwnProperty","FromPropertyDescriptor","IsDataDescriptor","IsPropertyKey","SameValue","Type","isPropertyDescriptor","fromPropertyDescriptor","Desc","argument","$isNaN","ES5Type","$isEnumerable","$Array","$ownKeys","$pushApply","$SymbolValueOf","$gOPN","$gOPS","allowed","isData","IsAccessor","valuesSeen","uniqueArray","_createForOfIteratorHelperLoose","_defineProperty","response","BaseError","static","messageToUse","addResponseErrorsToErrorMessage","captureStackTrace","errorMessages","errorTypes","ApiMakerCanCan","abilities","abilitiesToLoad","abilitiesToLoadData","lock","currentApiMakerCanCan","can","ability","subject","abilityToUse","foundAbility","findAbility","subjectLabel","modelClassData","abilityData","abilityDataSubject","isAbilityLoaded","loadAbilities","promises","loadAbility","all","abilityToLoad","queueAbilitiesRequest","queueAbilitiesRequestTimeout","sendAbilitiesRequest","resetAbilities","sendRequest","request","ApiMakerCollection","queryArgs","originalAbilities","newAbilities","originalAbilityName","newModelName","newValues","newAbilityName","_merge","accessibleBy","abilityName","_response","distinct","each","model","except","groupBy","arrayOfTablesAndColumns","arrayOfTablesAndColumnsWithLowercaseColumns","tableAndColumn","newGroupBy","isLoaded","reflectionName","relationshipsCache","preloaded","loaded","relationships","isNewRecord","reflectionNameUnderscore","relationshipsLoaded","uniqunize","newCollection","newModel","preload","preloadValue","page","pageKey","accessible_by","group_by","ransack","per","selectColumns","select_columns","perKey","models","_addQueryToModels","collection","searchKey","originalSelect","newSelect","originalModelName","originalAttributeName","newAttributeName","sortBy","modelClass","modelName","clonedQueryArgs","newQueryArgs","addCommand","collectionName","Api","pathParams","requestLocal","headers","requestPath","getHost","xhr","XMLHttpRequest","withCredentials","headerName","setRequestHeader","executeXhr","_parseResponse","status","customError","peakflowParameters","_token","rawData","put","getCsrfToken","responseType","getResponseHeader","responseText","ApiMakerCommandSubmitData","filesCount","jsonData","traverseObject","getFilesCount","getJsonData","getRawData","getFormData","objectForFormData","json","convertDynamic","traverseArray","shouldSkip","File","newArray","newObject","DestroyError","apiMakerType","Serializer","serializeArgument","api_maker_type","model_class_name","model_id","offsetNumber","serializeArray","serializeObject","ApiMakerCommandsPool","pool","instant","promiseResult","flushRunLast","currentApiMakerCommandsPool","flushCount","poolData","globalRequestData","commandType","commandName","primary_key","primaryKey","commandsCount","commandSubmitData","updateSessionStatus","currentPool","currentPoolData","submitData","commandId","responses","commandResponse","commandResponseData","commandData","bugReportUrl","handleFailedResponse","error_type","validationErrors","errorMessage","errors","accessors","breakPoints","currenciesCollection","i18n","ApiMakerConfig","apiMakerConfigGlobal","accessorName","accessorData","camelizedAccessor","apiMakerConfig","CustomError","ApiMakerDeserializer","restObject","cents","modelClassName","ApiMakerDevise","callSignOutEvent","currentApiMakerDevise","addUserScope","currentMethodName","getCurrentScope","isSignedInMethodName","signIn","username","postData","updateSession","camelizedScopeName","currents","hasCurrentScope","setSignedOut","signOut","apiMakerSessionStatusUpdater","loadCurrentScope","hasGlobalCurrentScope","apiMakerDeviseCurrent","scopeData","parsedScopeData","UNKNOWN_FUNCTION","stackString","chromeRe","isNative","isEval","submatch","chromeEvalRe","lineNumber","parseChrome","winjsRe","parseWinjs","geckoRe","geckoEvalRe","parseGecko","nodeRe","parseNode","javaScriptCoreRe","parseJSC","SourceMapsLoader","isLoadingSourceMaps","sourceMaps","srcLoaded","loadSourceMapsForScriptTags","loadSourceMapsForScriptTagsCallback","sourceMapForSource","sourceMapForSourceCallback","loadSourceMaps","getSources","originalUrl","loadSourceMapForSource","getSourcesFromScripts","getSourcesFromError","trace","sourceMapUrl","getMapURL","scripts","loadUrl","origin","includeMapURL","loadXhr","parser","parseStackTrace","stackTrace","getStackTraceData","traceData","fileString","newSourceMap","sourceMapData","filePath","ErrorLogger","debugging","errorOccurred","isHandlingError","sourceMapsLoader","output","enable","connectOnError","connectUnhandledRejection","getErrors","hasErrorOccurred","isWorkingOnError","finally","onUnhandledRejection","backtrace","errorClass","testPromiseError","_resolve","ApiMakerLogger","isDebugging","setGlobalDebug","getDebug","getGlobalDebug","setDebug","requireName","ModelClass","modelClasses","ApiMakerBaseModelColumn","columnData","getType","ApiMakerBaseModelAttribute","attributeData","getColumn","isColumn","isSelectedByDefault","isTranslated","AttributeNotLoadedError","CacheKeyGenerator","allModels","readModels","recordModelType","recordModel","filledModels","local","md5","feedModel","relationshipType","uniqueKey","isModelRecorded","fillModels","loadedRelationship","anotherModel","markedForDestruction","readAttributeUnderscore","ModelName","camelizedLower","human","countKey","argsToUse","i18nKey","defaultModelName","getI18n","paramKey","NotLoadedError","ApiMakerBaseModelReflection","reflectionData","foreignKey","macro","through","ApiMakerBaseModelScope","objectToUnderscore","BaseModel","attributeKey","newCustomEvent","findOrCreateBy","findOrCreateByArgs","additional_data","additionalData","find_or_create_by_args","resource_name","ransackableAssociations","reflections","relationshipData","ransackableAttributes","ransackableScopes","reflection","foundReflection","csrfTokenElement","changes","newRecord","_readModelDataFromArgs","modelData","assignAttributes","newAttributes","attributeUnderscore","applyChange","deleteChange","isAttributeLoaded","readAttribute","givenAbilityName","isPersisted","keyParts","updatedAt","localCacheKey","fullCacheKey","getAttributes","dataToUse","save","parseValidationErrors","_refreshModelFromResponse","createRaw","objectData","_objectDataFromGivenRawData","_refreshModelDataFromResponse","query_params","handleResponseError","ensureAbilities","listOfAbilities","abilityInList","ransackParams","abilitiesParams","newAbility","identifierKey","_identifierKey","isAssociationLoaded","associationName","isAssociationLoadedUnderscore","associationNameUnderscore","isAssociationPresent","validation_errors","sendValidationErrorsEvent","throwValidationError","humanAttributeName","snakeCase","isAttributeChanged","attributeNameUnderscore","attributeNames","isChanged","savedChangeToAttribute","previousModelData","setNewModel","setNewModelData","relationshipName","relationshipCacheName","_isDateChanged","_isIntegerChanged","_isStringChanged","saveRaw","updateRaw","simple_model_errors","simpleModelErrors","isValid","isValidOnServer","valid","preloadRelationship","markForDestruction","_markedForDestruction","uniqueKeyValue","randomBetween","_callCollectionCommand","commandArgs","formOrDataObject","_callMemberCommand","_postDataFromArgs","_isPresent","_loadBelongsToReflection","_readBelongsToReflection","loadedRelationships","_loadHasManyReflection","_loadHasOneReflection","_readHasOneReflection","preloadedRelationships","_readPreloadedRelationships","relationshipClassData","relationship","relationshipsList","relationshipId","getModel","ApiMakerModelRecipesModelLoader","modelRecipe","modelRecipesLoader","createClass","collection_commands","collectionCommands","member_commands","memberCommands","model_class_data","addAttributeMethodsToModelClass","addRelationshipsToModelClass","addQueryCommandsToModelClass","addMemberCommandsToModelClass","collectionCommandName","memberCommandName","active_record","activeRecordName","activeRecordPrimaryKey","class_name","klass","klassPrimaryKey","as","optionsAs","optionsPrimaryKey","optionsThrough","resourceName","loadMethodName","modelMethodName","defineBelongsToGetMethod","defineBelongsToLoadMethod","defineHasManyGetMethod","defineHasManyLoadMethod","defineHasOneGetMethd","defineHasOneLoadMethod","foreignKeyMethodName","getModelClass","hasManyParameters","queryParameters","primaryKeyColumnName","primaryKeyMethodName","ModelRecipesLoader","recipes","ApiMakerPreloaded","loadPreloadedModels","preloadedType","preloadedId","modelType","modelId","ModelsResponseReader","ApiMakerResult","currentPage","perPage","totalCount","totalPages","ApiMakerRoutesNative","getLocale","routeTranslationParts","loadRouteDefinitions","routeDefinitionArgs","rawPathParts","pathMethodName","urlMethodName","localized","localizedRoutes","variableCount","localizedPathParts","pathPart","translateRoute","pathParts","loadRouteTranslations","locales","routeTranslations","lastArg","restOptions","translatedRoute","addHostToRoute","fullUrl","hostToUse","portToUse","RunLast","flushTriggerCount","flushTrigger","flushTriggerQueue","flushTimeout","ApiMakerServices","currentApiMakerService","serviceName","service_args","service_name","ApiMakerSessionStatusUpdater","useMetaElement","connectOnlineEvent","connectWakeEvent","csrfToken","sessionStatus","onSignedOut","addEvent","startTimeout","updateTimeout","stopTimeout","updateMetaElementsFromResult","updateUserSessionsFromResult","csrf_token","scopeName","scopes","updateUserSessionScopeFromResult","deviseIsSignedInMethodName","currentlySignedIn","signedInOnBackend","signed_in","replaces","regexp","replaceAll","character","onCalled","onCalledCallback","ValidationError","getUnhandledErrorMessage","getErrorMessage","getUnhandledErrors","getValidationErrors","validationError","getHandled","hasUnhandledErrors","unhandledError","hasValidationErrorForAttribute","underscoredAttributeName","attributeType","input_name","handled","matchesAttributeAndInputName","getInputName","attributeNameIdMatch","attributeNameWithoutId","attributeUnderScoreName","inputNameWithoutId","getErrorMessages","getFullErrorMessages","fullErrorMessages","attributeHumanName","setHandled","ValidationErrors","rootModel","fullErrorMessage","getValidationErrorsForInput","onMatchValidationError","unhandledValidationErrors","unhandledValidationErrorMessages","unhandledValidationError","OnLocationChangedCallback","callbacksHandler","callCallback","CallbacksHandler","callCallbacks","connectInterval","onLocationChanged","givenCallback","onLocationMightHaveChanged","currentLocationHref","onLocationChangedCallbacksHandler","_slicedToArray","setPath","onLocationChangedCallback","newPath","onLocationChangedEvent","memoCompareProps","nextProps","simpleObjectValuesDifferent","setStates","__firstRenderCompleted","variables","statesList","stateName","renderingCallbacks","stylingName","customStyling","dig","_useState3","stateValue","anythingDifferent","ShapeClass","functionalComponent","actualProps","propsWithoutUndefined","validateProps","setup","setStateCompareData","digger","callFunctions","throwError","digged","currentPath","digs","PropertyNotFoundError","fetchingObjectHandler","wrappedObject","ErrorHandlersRaiser","I18nOnSteroids","errorHandler","fallbacks","setLocale","setLocaleOnStrftime","monthNames","abbrMonthNames","strftimeLocales","scanRequireContext","contextLoader","_scanRecursive","scanObject","storage","formatValue","localesToTry","_lookup","insertVariables","toNumber","numberable","ErrorHandlersRaiseInBackground","namespace","newArgs","I18n","updateLocale","incorporate","Incorporator","replaceArrayIfExistsValue","replaceArrayIfExists","mergeObjects","firstObject","mergeObjectsInto","mergeArraysInto","mergeIntoValue","arrays","mergeInto","ParentElementsResult","getElement","parentElements","breakAfterFirstFound","elementResult","randomUUID","crypto","getRandomValues","rnds8","rng","byteToHex","unsafeStringify","rnds"],"sourceRoot":""}