fRect.bottom < bound.top ||\n refRect.left > bound.right ||\n refRect.top > bound.bottom ||\n refRect.right < bound.left\n ) {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === true) {\n return data;\n }\n\n data.hide = true;\n data.attributes['x-out-of-boundaries'] = '';\n } else {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === false) {\n return data;\n }\n\n data.hide = false;\n data.attributes['x-out-of-boundaries'] = false;\n }\n\n return data;\n}\n","/**\n * @function\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Boolean} shouldRound - If the offsets should be rounded at all\n * @returns {Object} The popper's position offsets rounded\n *\n * The tale of pixel-perfect positioning. It's still not 100% perfect, but as\n * good as it can be within reason.\n * Discussion here: https://github.com/FezVrasta/popper.js/pull/715\n *\n * Low DPI screens cause a popper to be blurry if not using full pixels (Safari\n * as well on High DPI screens).\n *\n * Firefox prefers no rounding for positioning and does not have blurriness on\n * high DPI screens.\n *\n * Only horizontal placement and left/right values need to be considered.\n */\nexport default function getRoundedOffsets(data, shouldRound) {\n const { popper, reference } = data.offsets;\n const { round, floor } = Math;\n const noRound = v => v;\n \n const referenceWidth = round(reference.width);\n const popperWidth = round(popper.width);\n \n const isVertical = ['left', 'right'].indexOf(data.placement) !== -1;\n const isVariation = data.placement.indexOf('-') !== -1;\n const sameWidthParity = referenceWidth % 2 === popperWidth % 2;\n const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;\n\n const horizontalToInteger = !shouldRound\n ? noRound\n : isVertical || isVariation || sameWidthParity\n ? round\n : floor;\n const verticalToInteger = !shouldRound ? noRound : round;\n\n return {\n left: horizontalToInteger(\n bothOddWidth && !isVariation && shouldRound\n ? popper.left - 1\n : popper.left\n ),\n top: verticalToInteger(popper.top),\n bottom: verticalToInteger(popper.bottom),\n right: horizontalToInteger(popper.right),\n };\n}\n","import setStyles from '../utils/setStyles';\nimport setAttributes from '../utils/setAttributes';\nimport getReferenceOffsets from '../utils/getReferenceOffsets';\nimport computeAutoPlacement from '../utils/computeAutoPlacement';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} data.styles - List of style properties - values to apply to popper element\n * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The same data object\n */\nexport default function applyStyle(data) {\n // any property present in `data.styles` will be applied to the popper,\n // in this way we can make the 3rd party modifiers add custom styles to it\n // Be aware, modifiers could override the properties defined in the previous\n // lines of this modifier!\n setStyles(data.instance.popper, data.styles);\n\n // any property present in `data.attributes` will be applied to the popper,\n // they will be set as HTML attributes of the element\n setAttributes(data.instance.popper, data.attributes);\n\n // if arrowElement is defined and arrowStyles has some properties\n if (data.arrowElement && Object.keys(data.arrowStyles).length) {\n setStyles(data.arrowElement, data.arrowStyles);\n }\n\n return data;\n}\n\n/**\n * Set the x-placement attribute before everything else because it could be used\n * to add margins to the popper margins needs to be calculated to get the\n * correct popper offsets.\n * @method\n * @memberof Popper.modifiers\n * @param {HTMLElement} reference - The reference element used to position the popper\n * @param {HTMLElement} popper - The HTML element used as popper\n * @param {Object} options - Popper.js options\n */\nexport function applyStyleOnLoad(\n reference,\n popper,\n options,\n modifierOptions,\n state\n) {\n // compute reference element offsets\n const referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n const placement = computeAutoPlacement(\n options.placement,\n referenceOffsets,\n popper,\n reference,\n options.modifiers.flip.boundariesElement,\n options.modifiers.flip.padding\n );\n\n popper.setAttribute('x-placement', placement);\n\n // Apply `position` to popper before anything else because\n // without the position applied we can't guarantee correct computations\n setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });\n\n return options;\n}\n","/**\n * Set the attributes to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the attributes to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nexport default function setAttributes(element, attributes) {\n Object.keys(attributes).forEach(function(prop) {\n const value = attributes[prop];\n if (value !== false) {\n element.setAttribute(prop, attributes[prop]);\n } else {\n element.removeAttribute(prop);\n }\n });\n}\n","// Utils\nimport debounce from './utils/debounce';\nimport isFunction from './utils/isFunction';\n\n// Methods\nimport update from './methods/update';\nimport destroy from './methods/destroy';\nimport enableEventListeners from './methods/enableEventListeners';\nimport disableEventListeners from './methods/disableEventListeners';\nimport Defaults from './methods/defaults';\nimport placements from './methods/placements';\n\nexport default class Popper {\n /**\n * Creates a new Popper.js instance.\n * @class Popper\n * @param {Element|referenceObject} reference - The reference element used to position the popper\n * @param {Element} popper - The HTML / XML element used as the popper\n * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)\n * @return {Object} instance - The generated Popper.js instance\n */\n constructor(reference, popper, options = {}) {\n // make update() debounced, so that it only runs at most once-per-tick\n this.update = debounce(this.update.bind(this));\n\n // with {} we create a new object with the options inside it\n this.options = { ...Popper.Defaults, ...options };\n\n // init state\n this.state = {\n isDestroyed: false,\n isCreated: false,\n scrollParents: [],\n };\n\n // get reference and popper elements (allow jQuery wrappers)\n this.reference = reference && reference.jquery ? reference[0] : reference;\n this.popper = popper && popper.jquery ? popper[0] : popper;\n\n // Deep merge modifiers options\n this.options.modifiers = {};\n Object.keys({\n ...Popper.Defaults.modifiers,\n ...options.modifiers,\n }).forEach(name => {\n this.options.modifiers[name] = {\n // If it's a built-in modifier, use it as base\n ...(Popper.Defaults.modifiers[name] || {}),\n // If there are custom options, override and merge with default ones\n ...(options.modifiers ? options.modifiers[name] : {}),\n };\n });\n\n // Refactoring modifiers' list (Object => Array)\n this.modifiers = Object.keys(this.options.modifiers)\n .map(name => ({\n name,\n ...this.options.modifiers[name],\n }))\n // sort the modifiers by order\n .sort((a, b) => a.order - b.order);\n\n // modifiers have the ability to execute arbitrary code when Popper.js get inited\n // such code is executed in the same order of its modifier\n // they could add new properties to their options configuration\n // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!\n this.modifiers.forEach(modifierOptions => {\n if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {\n modifierOptions.onLoad(\n this.reference,\n this.popper,\n this.options,\n modifierOptions,\n this.state\n );\n }\n });\n\n // fire the first update to position the popper in the right place\n this.update();\n\n const eventsEnabled = this.options.eventsEnabled;\n if (eventsEnabled) {\n // setup event listeners, they will take care of update the position in specific situations\n this.enableEventListeners();\n }\n\n this.state.eventsEnabled = eventsEnabled;\n }\n\n // We can't use class properties because they don't get listed in the\n // class prototype and break stuff like Sinon stubs\n update() {\n return update.call(this);\n }\n destroy() {\n return destroy.call(this);\n }\n enableEventListeners() {\n return enableEventListeners.call(this);\n }\n disableEventListeners() {\n return disableEventListeners.call(this);\n }\n\n /**\n * Schedules an update. It will run on the next UI update available.\n * @method scheduleUpdate\n * @memberof Popper\n */\n scheduleUpdate = () => requestAnimationFrame(this.update);\n\n /**\n * Collection of utilities useful when writing custom modifiers.\n * Starting from version 1.7, this method is available only if you\n * include `popper-utils.js` before `popper.js`.\n *\n * **DEPRECATION**: This way to access PopperUtils is deprecated\n * and will be removed in v2! Use the PopperUtils module directly instead.\n * Due to the high instability of the methods contained in Utils, we can't\n * guarantee them to follow semver. Use them at your own risk!\n * @static\n * @private\n * @type {Object}\n * @deprecated since version 1.8\n * @member Utils\n * @memberof Popper\n */\n static Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;\n\n static placements = placements;\n\n static Defaults = Defaults;\n}\n\n/**\n * The `referenceObject` is an object that provides an interface compatible with Popper.js\n * and lets you use it as replacement of a real DOM node.
\n * You can use this method to position a popper relatively to a set of coordinates\n * in case you don't have a DOM node to use as reference.\n *\n * ```\n * new Popper(referenceObject, popperNode);\n * ```\n *\n * NB: This feature isn't supported in Internet Explorer 10.\n * @name referenceObject\n * @property {Function} data.getBoundingClientRect\n * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.\n * @property {number} data.clientWidth\n * An ES6 getter that will return the width of the virtual reference element.\n * @property {number} data.clientHeight\n * An ES6 getter that will return the height of the virtual reference element.\n */\n","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\nconst baseX = require('@multiformats/base-x')\nconst Base = require('./base.js')\nconst { rfc4648 } = require('./rfc4648')\nconst { decodeText, encodeText } = require('./util')\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n/** @typedef {import('./types').Codec} Codec */\n/** @typedef {import('./types').BaseName} BaseName */\n/** @typedef {import('./types').BaseCode} BaseCode */\n\n/** @type {CodecFactory} */\nconst identity = () => {\n return {\n encode: decodeText,\n decode: encodeText\n }\n}\n\n/**\n *\n * name, code, implementation, alphabet\n *\n * @type {Array<[BaseName, BaseCode, CodecFactory, string]>}\n */\nconst constants = [\n ['identity', '\\x00', identity, ''],\n ['base2', '0', rfc4648(1), '01'],\n ['base8', '7', rfc4648(3), '01234567'],\n ['base10', '9', baseX, '0123456789'],\n ['base16', 'f', rfc4648(4), '0123456789abcdef'],\n ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'],\n ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'],\n ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='],\n ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='],\n ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'],\n ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='],\n ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'],\n ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'],\n ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n]\n\n/** @type {Record} */\nconst names = constants.reduce((prev, tupple) => {\n prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3])\n return prev\n}, /** @type {Record} */({}))\n\n/** @type {Record} */\nconst codes = constants.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]]\n return prev\n}, /** @type {Record} */({}))\n\nmodule.exports = {\n names,\n codes\n}\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\nfunction Protocols (proto) {\n if (typeof (proto) === 'number') {\n if (Protocols.codes[proto]) {\n return Protocols.codes[proto]\n }\n\n throw new Error('no protocol with code: ' + proto)\n } else if (typeof (proto) === 'string' || proto instanceof String) {\n if (Protocols.names[proto]) {\n return Protocols.names[proto]\n }\n\n throw new Error('no protocol with name: ' + proto)\n }\n\n throw new Error('invalid protocol id type: ' + proto)\n}\n\nconst V = -1\nProtocols.lengthPrefixedVarSize = V\nProtocols.V = V\n\nProtocols.table = [\n [4, 32, 'ip4'],\n [6, 16, 'tcp'],\n [33, 16, 'dccp'],\n [41, 128, 'ip6'],\n [42, V, 'ip6zone'],\n [53, V, 'dns', 'resolvable'],\n [54, V, 'dns4', 'resolvable'],\n [55, V, 'dns6', 'resolvable'],\n [56, V, 'dnsaddr', 'resolvable'],\n [132, 16, 'sctp'],\n [273, 16, 'udp'],\n [275, 0, 'p2p-webrtc-star'],\n [276, 0, 'p2p-webrtc-direct'],\n [277, 0, 'p2p-stardust'],\n [290, 0, 'p2p-circuit'],\n [301, 0, 'udt'],\n [302, 0, 'utp'],\n [400, V, 'unix', false, 'path'],\n // `ipfs` is added before `p2p` for legacy support.\n // All text representations will default to `p2p`, but `ipfs` will\n // still be supported\n [421, V, 'ipfs'],\n // `p2p` is the preferred name for 421, and is now the default\n [421, V, 'p2p'],\n [443, 0, 'https'],\n [444, 96, 'onion'],\n [445, 296, 'onion3'],\n [446, V, 'garlic64'],\n [460, 0, 'quic'],\n [477, 0, 'ws'],\n [478, 0, 'wss'],\n [479, 0, 'p2p-websocket-star'],\n [480, 0, 'http'],\n [777, V, 'memory']\n]\n\nProtocols.names = {}\nProtocols.codes = {}\n\n// populate tables\nProtocols.table.map(row => {\n const proto = p.apply(null, row)\n Protocols.codes[proto.code] = proto\n Protocols.names[proto.name] = proto\n})\n\nProtocols.object = p\n\nfunction p (code, size, name, resolvable, path) {\n return {\n code,\n size,\n name,\n resolvable: Boolean(resolvable),\n path: Boolean(path)\n }\n}\n\nmodule.exports = Protocols\n","'use strict'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array>} arrays\n * @param {Number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = concat\n","'use strict';\n\nfunction withIs(Class, { className, symbolName }) {\n const symbol = Symbol.for(symbolName);\n\n const ClassIsWrapper = {\n // The code below assigns the class wrapper to an object to trick\n // JavaScript engines to show the name of the extended class when\n // logging an instances.\n // We are assigning an anonymous class (class wrapper) to the object\n // with key `className` to keep the correct name.\n // If this is not supported it falls back to logging `ClassIsWrapper`.\n [className]: class extends Class {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, symbol, { value: true });\n }\n\n get [Symbol.toStringTag]() {\n return className;\n }\n },\n }[className];\n\n ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]);\n\n return ClassIsWrapper;\n}\n\nfunction withIsProto(Class, { className, symbolName, withoutNew }) {\n const symbol = Symbol.for(symbolName);\n\n /* eslint-disable object-shorthand */\n const ClassIsWrapper = {\n [className]: function (...args) {\n if (withoutNew && !(this instanceof ClassIsWrapper)) {\n return new ClassIsWrapper(...args);\n }\n\n const _this = Class.call(this, ...args) || this;\n\n if (_this && !_this[symbol]) {\n Object.defineProperty(_this, symbol, { value: true });\n }\n\n return _this;\n },\n }[className];\n /* eslint-enable object-shorthand */\n\n ClassIsWrapper.prototype = Object.create(Class.prototype);\n ClassIsWrapper.prototype.constructor = ClassIsWrapper;\n\n Object.defineProperty(ClassIsWrapper.prototype, Symbol.toStringTag, {\n get() {\n return className;\n },\n });\n\n ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]);\n\n return ClassIsWrapper;\n}\n\nmodule.exports = withIs;\nmodule.exports.proto = withIsProto;\n","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","\"use strict\"\n\nexports.TextEncoder = TextEncoder\nexports.TextDecoder = TextDecoder\n","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst { TextDecoder } = require('web-encoding')\nconst utf8Decoder = new TextDecoder('utf8')\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array - The array to turn into a string\n */\nfunction uint8ArrayToAsciiString (array) {\n let string = ''\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i])\n }\n return string\n}\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - The encoding to use\n * @returns {string}\n */\nfunction toString (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString(array)\n }\n\n return getCodec(encoding).encode(array)\n}\n\nmodule.exports = toString\n","'use strict'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array>} arrays\n * @param {number} [length]\n */\nfunction concat (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = concat\n","'use strict'\n\nconst baseX = require('@multiformats/base-x')\nconst Base = require('./base.js')\nconst { rfc4648 } = require('./rfc4648')\nconst { decodeText, encodeText } = require('./util')\n\n/** @typedef {import('./types').CodecFactory} CodecFactory */\n/** @typedef {import('./types').Codec} Codec */\n/** @typedef {import('./types').BaseName} BaseName */\n/** @typedef {import('./types').BaseCode} BaseCode */\n\n/** @type {CodecFactory} */\nconst identity = () => {\n return {\n encode: decodeText,\n decode: encodeText\n }\n}\n\n/**\n *\n * name, code, implementation, alphabet\n *\n * @type {Array<[BaseName, BaseCode, CodecFactory, string]>}\n */\nconst constants = [\n ['identity', '\\x00', identity, ''],\n ['base2', '0', rfc4648(1), '01'],\n ['base8', '7', rfc4648(3), '01234567'],\n ['base10', '9', baseX, '0123456789'],\n ['base16', 'f', rfc4648(4), '0123456789abcdef'],\n ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'],\n ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'],\n ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='],\n ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='],\n ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'],\n ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='],\n ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'],\n ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'],\n ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n]\n\n/** @type {Record} */\nconst names = constants.reduce((prev, tupple) => {\n prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3])\n return prev\n}, /** @type {Record} */({}))\n\n/** @type {Record} */\nconst codes = constants.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]]\n return prev\n}, /** @type {Record} */({}))\n\nmodule.exports = {\n names,\n codes\n}\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","module.exports = {\n encode: require('./encode.js')\n , decode: require('./decode.js')\n , encodingLength: require('./length.js')\n}\n","/**\n * Multihash implementation in JavaScript.\n *\n * @module multihash\n */\n'use strict'\n\nconst multibase = require('multibase')\nconst varint = require('varint')\nconst { names } = require('./constants')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\nconst uint8ArrayConcat = require('uint8arrays/concat')\n\nconst codes = /** @type {import('./types').CodeNameMap} */({})\n\n// eslint-disable-next-line guard-for-in\nfor (const key in names) {\n const name = /** @type {HashName} */(key)\n codes[names[name]] = name\n}\n\n/**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(hash, 'base16')\n}\n\n/**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\nfunction fromHexString (hash) {\n return uint8ArrayFromString(hash, 'base16')\n}\n\n/**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\nfunction toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1)\n}\n\n/**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\nfunction fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? uint8ArrayToString(hash)\n : hash\n\n return multibase.decode('z' + encoded)\n}\n\n/**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\nfunction decode (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes))\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n const len = varint.decode(bytes)\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes)\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes[code],\n length: len,\n digest: bytes\n }\n}\n\n/**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\nfunction encode (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code)\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn)\n const len = varint.encode(length)\n return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length)\n}\n\n/**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\nfunction coerceCode (name) {\n let code = name\n\n if (typeof name === 'string') {\n if (names[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names[name]\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n}\n\n/**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\nfunction isAppCode (code) {\n return code > 0 && code < 0x10\n}\n\n/**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\nfunction isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes[code]) {\n return true\n }\n\n return false\n}\n\n/**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\nfunction validate (multihash) {\n decode(multihash) // throws if bad.\n}\n\n/**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\nfunction prefix (multihash) {\n validate(multihash)\n\n return multihash.subarray(0, 2)\n}\n\nmodule.exports = {\n names,\n codes: Object.freeze(codes),\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode,\n encode,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n}\n\n/**\n * @typedef { import(\"./constants\").HashCode } HashCode\n * @typedef { import(\"./constants\").HashName } HashName\n */\n","'use strict'\n/* eslint-env browser */\nconst Multiaddr = require('multiaddr')\nconst { isBrowser, isWebWorker, isNode } = require('ipfs-utils/src/env')\nconst { default: parseDuration } = require('parse-duration')\nconst log = require('debug')('ipfs-http-client:lib:error-handler')\nconst HTTP = require('ipfs-utils/src/http')\nconst merge = require('merge-options')\nconst toUrlString = require('ipfs-core-utils/src/to-url-string')\nconst http = require('http')\nconst https = require('https')\n\nconst DEFAULT_PROTOCOL = isBrowser || isWebWorker ? location.protocol : 'http'\nconst DEFAULT_HOST = isBrowser || isWebWorker ? location.hostname : 'localhost'\nconst DEFAULT_PORT = isBrowser || isWebWorker ? location.port : '5001'\n\n/**\n * @param {ClientOptions|URL|Multiaddr|string} [options]\n * @returns {ClientOptions}\n */\nconst normalizeOptions = (options = {}) => {\n let url\n let opts = {}\n let agent\n\n if (typeof options === 'string' || Multiaddr.isMultiaddr(options)) {\n url = new URL(toUrlString(options))\n } else if (options instanceof URL) {\n url = options\n } else if (typeof options.url === 'string' || Multiaddr.isMultiaddr(options.url)) {\n url = new URL(toUrlString(options.url))\n opts = options\n } else if (options.url instanceof URL) {\n url = options.url\n opts = options\n } else {\n opts = options || {}\n\n const protocol = (opts.protocol || DEFAULT_PROTOCOL).replace(':', '')\n const host = (opts.host || DEFAULT_HOST).split(':')[0]\n const port = (opts.port || DEFAULT_PORT)\n\n url = new URL(`${protocol}://${host}:${port}`)\n }\n\n if (opts.apiPath) {\n url.pathname = opts.apiPath\n } else if (url.pathname === '/' || url.pathname === undefined) {\n url.pathname = 'api/v0'\n }\n\n if (isNode) {\n const Agent = url.protocol.startsWith('https') ? https.Agent : http.Agent\n\n agent = opts.agent || new Agent({\n keepAlive: true,\n // Similar to browsers which limit connections to six per host\n maxSockets: 6\n })\n }\n\n return {\n ...opts,\n host: url.host,\n protocol: url.protocol.replace(':', ''),\n port: Number(url.port),\n apiPath: url.pathname,\n url,\n agent\n }\n}\n\nconst errorHandler = async (response) => {\n let msg\n\n try {\n if ((response.headers.get('Content-Type') || '').startsWith('application/json')) {\n const data = await response.json()\n log(data)\n msg = data.Message || data.message\n } else {\n msg = await response.text()\n }\n } catch (err) {\n log('Failed to parse error response', err)\n // Failed to extract/parse error message from response\n msg = err.message\n }\n\n /** @type {Error} */\n let error = new HTTP.HTTPError(response)\n\n // This is what go-ipfs returns where there's a timeout\n if (msg && msg.includes('context deadline exceeded')) {\n error = new HTTP.TimeoutError(response)\n }\n\n // This also gets returned\n if (msg && msg.includes('request timed out')) {\n error = new HTTP.TimeoutError(response)\n }\n\n // If we managed to extract a message from the response, use it\n if (msg) {\n error.message = msg\n }\n\n throw error\n}\n\nconst KEBAB_REGEX = /[A-Z\\u00C0-\\u00D6\\u00D8-\\u00DE]/g\nconst kebabCase = (str) => {\n return str.replace(KEBAB_REGEX, function (match) {\n return '-' + match.toLowerCase()\n })\n}\n\nconst parseTimeout = (value) => {\n return typeof value === 'string' ? parseDuration(value) : value\n}\n\n/**\n * @typedef {import('http').Agent} HttpAgent\n * @typedef {import('https').Agent} HttpsAgent\n *\n * @typedef {Object} ClientOptions\n * @property {string} [host]\n * @property {number} [port]\n * @property {string} [protocol]\n * @property {Headers|Record} [headers] - Request headers.\n * @property {number|string} [timeout] - Amount of time until request should timeout in ms or humand readable. https://www.npmjs.com/package/parse-duration for valid string values.\n * @property {string} [apiPath] - Path to the API.\n * @property {URL|string|Multiaddr} [url] - Full API URL.\n * @property {object} [ipld]\n * @property {any[]} [ipld.formats] - An array of additional [IPLD formats](https://github.com/ipld/interface-ipld-format) to support\n * @property {(format: string) => Promise} [ipld.loadFormat] - an async function that takes the name of an [IPLD format](https://github.com/ipld/interface-ipld-format) as a string and should return the implementation of that codec\n * @property {HttpAgent|HttpsAgent} [agent] - A [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) used to control connection persistence and reuse for HTTP clients (only supported in node.js)\n */\nclass Client extends HTTP {\n /**\n * @param {ClientOptions|URL|Multiaddr|string} [options]\n */\n constructor (options = {}) {\n const opts = normalizeOptions(options)\n\n super({\n timeout: parseTimeout(opts.timeout) || 60000 * 20,\n headers: opts.headers,\n base: `${opts.url}`,\n handleError: errorHandler,\n transformSearchParams: (search) => {\n const out = new URLSearchParams()\n\n // @ts-ignore https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n for (const [key, value] of search) {\n if (\n value !== 'undefined' &&\n value !== 'null' &&\n key !== 'signal'\n ) {\n out.append(kebabCase(key), value)\n }\n\n // @ts-ignore server timeouts are strings\n if (key === 'timeout' && !isNaN(value)) {\n out.append(kebabCase(key), value)\n }\n }\n\n return out\n },\n // @ts-ignore this can be a https agent or a http agent\n agent: opts.agent\n })\n\n // @ts-ignore\n delete this.get\n // @ts-ignore\n delete this.put\n // @ts-ignore\n delete this.delete\n // @ts-ignore\n delete this.options\n\n const fetch = this.fetch\n\n this.fetch = (resource, options = {}) => {\n if (typeof resource === 'string' && !resource.startsWith('/')) {\n resource = `${opts.url}/${resource}`\n }\n\n return fetch.call(this, resource, merge(options, {\n method: 'POST'\n }))\n }\n }\n}\n\nClient.errorHandler = errorHandler\n\nmodule.exports = Client\n","'use strict'\n\nmodule.exports = (mode) => {\n if (mode === undefined || mode === null) {\n return undefined\n }\n\n if (typeof mode === 'string' || mode instanceof String) {\n return mode\n }\n\n return mode.toString(8).padStart(4, '0')\n}\n","'use strict'\n\nconst { names } = require('multibase/src/constants')\nconst { TextDecoder } = require('web-encoding')\nconst utf8Decoder = new TextDecoder('utf8')\n\n/**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array The array to turn into a string\n * @returns {String}\n */\nfunction uint8ArrayToAsciiString (array) {\n let string = ''\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i])\n }\n return string\n}\n\n/**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array The array to turn into a string\n * @param {String} [encoding=utf8] The encoding to use\n * @returns {String}\n * @see {@link https://www.npmjs.com/package/multibase|multibase} for supported encodings other than `utf8`\n */\nfunction toString (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString(array)\n }\n\n const codec = names[encoding]\n\n if (!codec) {\n throw new Error('Unknown base')\n }\n\n return codec.encode(array)\n}\n\nmodule.exports = toString\n","'use strict'\n\nexports.defined = function (val) {\n return val !== null && val !== undefined && (typeof val !== 'number' || !isNaN(val))\n}\n","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nconst names = Object.freeze(constants.names)\nconst codes = Object.freeze(constants.codes)\nexports.names = names\nexports.codes = codes\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","\"use strict\"\n\nexports.TextEncoder = TextEncoder\nexports.TextDecoder = TextDecoder\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\nconst { Buffer } = require('buffer')\nconst Bignumber = require('bignumber.js').BigNumber\n\nconst constants = require('./constants')\nconst SHIFT32 = constants.SHIFT32\nconst SHIFT16 = constants.SHIFT16\nconst MAX_SAFE_HIGH = 0x1fffff\n\nexports.parseHalf = function parseHalf (buf) {\n var exp, mant, sign\n sign = buf[0] & 0x80 ? -1 : 1\n exp = (buf[0] & 0x7C) >> 2\n mant = ((buf[0] & 0x03) << 8) | buf[1]\n if (!exp) {\n return sign * 5.9604644775390625e-8 * mant\n } else if (exp === 0x1f) {\n return sign * (mant ? 0 / 0 : 2e308)\n } else {\n return sign * Math.pow(2, exp - 25) * (1024 + mant)\n }\n}\n\nfunction toHex (n) {\n if (n < 16) {\n return '0' + n.toString(16)\n }\n\n return n.toString(16)\n}\n\nexports.arrayBufferToBignumber = function (buf) {\n const len = buf.byteLength\n let res = ''\n for (let i = 0; i < len; i++) {\n res += toHex(buf[i])\n }\n\n return new Bignumber(res, 16)\n}\n\n// convert an Object into a Map\nexports.buildMap = (obj) => {\n const res = new Map()\n const keys = Object.keys(obj)\n const length = keys.length\n for (let i = 0; i < length; i++) {\n res.set(keys[i], obj[keys[i]])\n }\n return res\n}\n\nexports.buildInt32 = (f, g) => {\n return f * SHIFT16 + g\n}\n\nexports.buildInt64 = (f1, f2, g1, g2) => {\n const f = exports.buildInt32(f1, f2)\n const g = exports.buildInt32(g1, g2)\n\n if (f > MAX_SAFE_HIGH) {\n return new Bignumber(f).times(SHIFT32).plus(g)\n } else {\n return (f * SHIFT32) + g\n }\n}\n\nexports.writeHalf = function writeHalf (buf, half) {\n // assume 0, -0, NaN, Infinity, and -Infinity have already been caught\n\n // HACK: everyone settle in. This isn't going to be pretty.\n // Translate cn-cbor's C code (from Carsten Borman):\n\n // uint32_t be32;\n // uint16_t be16, u16;\n // union {\n // float f;\n // uint32_t u;\n // } u32;\n // u32.f = float_val;\n\n const u32 = Buffer.allocUnsafe(4)\n u32.writeFloatBE(half, 0)\n const u = u32.readUInt32BE(0)\n\n // if ((u32.u & 0x1FFF) == 0) { /* worth trying half */\n\n // hildjj: If the lower 13 bits are 0, we won't lose anything in the conversion\n if ((u & 0x1FFF) !== 0) {\n return false\n }\n\n // int s16 = (u32.u >> 16) & 0x8000;\n // int exp = (u32.u >> 23) & 0xff;\n // int mant = u32.u & 0x7fffff;\n\n var s16 = (u >> 16) & 0x8000 // top bit is sign\n const exp = (u >> 23) & 0xff // then 5 bits of exponent\n const mant = u & 0x7fffff\n\n // if (exp == 0 && mant == 0)\n // ; /* 0.0, -0.0 */\n\n // hildjj: zeros already handled. Assert if you don't believe me.\n\n // else if (exp >= 113 && exp <= 142) /* normalized */\n // s16 += ((exp - 112) << 10) + (mant >> 13);\n if ((exp >= 113) && (exp <= 142)) {\n s16 += ((exp - 112) << 10) + (mant >> 13)\n\n // else if (exp >= 103 && exp < 113) { /* denorm, exp16 = 0 */\n // if (mant & ((1 << (126 - exp)) - 1))\n // goto float32; /* loss of precision */\n // s16 += ((mant + 0x800000) >> (126 - exp));\n } else if ((exp >= 103) && (exp < 113)) {\n if (mant & ((1 << (126 - exp)) - 1)) {\n return false\n }\n s16 += ((mant + 0x800000) >> (126 - exp))\n\n // } else if (exp == 255 && mant == 0) { /* Inf */\n // s16 += 0x7c00;\n\n // hildjj: Infinity already handled\n\n // } else\n // goto float32; /* loss of range */\n } else {\n return false\n }\n\n // ensure_writable(3);\n // u16 = s16;\n // be16 = hton16p((const uint8_t*)&u16);\n buf.writeUInt16BE(s16, 0)\n return true\n}\n\nexports.keySorter = function (a, b) {\n var lenA = a[0].byteLength\n var lenB = b[0].byteLength\n\n if (lenA > lenB) {\n return 1\n }\n\n if (lenB > lenA) {\n return -1\n }\n\n return a[0].compare(b[0])\n}\n\n// Adapted from http://www.2ality.com/2012/03/signedzero.html\nexports.isNegativeZero = (x) => {\n return x === 0 && (1 / x < 0)\n}\n\nexports.nextPowerOf2 = (n) => {\n let count = 0\n // First n in the below condition is for\n // the case where n is 0\n if (n && !(n & (n - 1))) {\n return n\n }\n\n while (n !== 0) {\n n >>= 1\n count += 1\n }\n\n return 1 << count\n}\n","'use strict'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array>} arrays\n * @param {number} [length]\n */\nfunction concat (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = concat\n","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nconst names = Object.freeze(constants.names)\nconst codes = Object.freeze(constants.codes)\nexports.names = names\nexports.codes = codes\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","\"use strict\"\n\nexports.TextEncoder = TextEncoder\nexports.TextDecoder = TextDecoder\n","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nconst names = Object.freeze(constants.names)\nconst codes = Object.freeze(constants.codes)\nexports.names = names\nexports.codes = codes\n","'use strict'\n\n// @ts-ignore\nconst { TextEncoder, TextDecoder } = require('web-encoding')\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","'use strict'\n\n// Response types are defined here:\n// https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b969bdab/routing/query.go#L15-L24\nmodule.exports = {\n SendingQuery: 0,\n PeerResponse: 1,\n FinalPeer: 2,\n QueryError: 3,\n Provider: 4,\n Value: 5,\n AddingPeer: 6,\n DialingPeer: 7\n}\n","'use strict'\n\nexports.findSources = (args) => {\n /** @type {Record} */\n let options = {}\n let sources = []\n\n if (!Array.isArray(args[args.length - 1]) && typeof args[args.length - 1] === 'object') {\n options = args.pop()\n }\n\n if (args.length === 1 && Array.isArray(args[0])) {\n // support ipfs.files.cp([src, dest], opts)\n sources = args[0]\n } else {\n // support ipfs.files.cp(src, dest, opts) and ipfs.files.cp(src1, src2, dest, opts)\n sources = args\n }\n\n return {\n sources,\n options\n }\n}\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","exports.f = Object.getOwnPropertySymbols;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","require('./es6.array.iterator');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar TO_STRING_TAG = require('./_wks')('toStringTag');\n\nvar DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +\n 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +\n 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +\n 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +\n 'TextTrackList,TouchList').split(',');\n\nfor (var i = 0; i < DOMIterables.length; i++) {\n var NAME = DOMIterables[i];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n","exports.f = require('./_wks');\n","var global = require('./_global');\nvar core = require('./_core');\nvar LIBRARY = require('./_library');\nvar wksExt = require('./_wks-ext');\nvar defineProperty = require('./_object-dp').f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _react = require('react');\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar ThemeProvider = function (_Component) {\n (0, _inherits3.default)(ThemeProvider, _Component);\n\n function ThemeProvider() {\n (0, _classCallCheck3.default)(this, ThemeProvider);\n return (0, _possibleConstructorReturn3.default)(this, (ThemeProvider.__proto__ || Object.getPrototypeOf(ThemeProvider)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(ThemeProvider, [{\n key: 'getChildContext',\n value: function getChildContext() {\n var theme = this.props.theme;\n\n return {\n // createStyles: createStyles\n theme: theme\n };\n }\n }, {\n key: 'render',\n value: function render() {\n return this.props.children;\n }\n }]);\n return ThemeProvider;\n}(_react.Component);\n\nThemeProvider.childContextTypes = {\n theme: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object])\n};\n\nexports.default = ThemeProvider;","'use strict'\n\nconst textDecoder = new TextDecoder()\n/**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\nconst decodeText = (bytes) => textDecoder.decode(bytes)\n\nconst textEncoder = new TextEncoder()\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nconst encodeText = (text) => textEncoder.encode(text)\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\nfunction concat (arrs, length) {\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrs) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = { decodeText, encodeText, concat }\n","import CID from 'cids';\nexport function toCidOrNull(value) {\n if (!value) return null;\n\n try {\n return new CID(value);\n } catch (err) {\n console.log('Failed to parse CID', value, err);\n return null;\n }\n}\nexport function getCodecOrNull(value) {\n var cid = toCidOrNull(value);\n return cid ? cid.codec : null;\n}\nexport function toCidStrOrNull(value) {\n var cid = toCidOrNull(value);\n return cid ? cid.toString() : null;\n}","var upperCase = require('upper-case')\n\n/**\n * Upper case the first character of a string.\n *\n * @param {String} str\n * @return {String}\n */\nmodule.exports = function (str, locale) {\n if (str == null) {\n return ''\n }\n\n str = String(str)\n\n return upperCase(str.charAt(0), locale) + str.substr(1)\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createNumberElement = exports.createLiteralElement = exports.isDateTimeSkeleton = exports.isNumberSkeleton = exports.isTagElement = exports.isPoundElement = exports.isPluralElement = exports.isSelectElement = exports.isTimeElement = exports.isDateElement = exports.isNumberElement = exports.isArgumentElement = exports.isLiteralElement = exports.SKELETON_TYPE = exports.TYPE = void 0;\nvar TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n /**\n * XML-like tag\n */\n TYPE[TYPE[\"tag\"] = 8] = \"tag\";\n})(TYPE = exports.TYPE || (exports.TYPE = {}));\nvar SKELETON_TYPE;\n(function (SKELETON_TYPE) {\n SKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n SKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n})(SKELETON_TYPE = exports.SKELETON_TYPE || (exports.SKELETON_TYPE = {}));\n/**\n * Type Guards\n */\nfunction isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nexports.isLiteralElement = isLiteralElement;\nfunction isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nexports.isArgumentElement = isArgumentElement;\nfunction isNumberElement(el) {\n return el.type === TYPE.number;\n}\nexports.isNumberElement = isNumberElement;\nfunction isDateElement(el) {\n return el.type === TYPE.date;\n}\nexports.isDateElement = isDateElement;\nfunction isTimeElement(el) {\n return el.type === TYPE.time;\n}\nexports.isTimeElement = isTimeElement;\nfunction isSelectElement(el) {\n return el.type === TYPE.select;\n}\nexports.isSelectElement = isSelectElement;\nfunction isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nexports.isPluralElement = isPluralElement;\nfunction isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nexports.isPoundElement = isPoundElement;\nfunction isTagElement(el) {\n return el.type === TYPE.tag;\n}\nexports.isTagElement = isTagElement;\nfunction isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);\n}\nexports.isNumberSkeleton = isNumberSkeleton;\nfunction isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);\n}\nexports.isDateTimeSkeleton = isDateTimeSkeleton;\nfunction createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nexports.createLiteralElement = createLiteralElement;\nfunction createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\nexports.createNumberElement = createNumberElement;\n","const Multiaddr = require('multiaddr')\n\nconst reduceValue = (_, v) => v\nconst tcpUri = (str, port, parts, opts) => {\n // return tcp when explicitly requested\n if (opts && opts.assumeHttp === false) return `tcp://${str}:${port}`\n // check if tcp is the last protocol in multiaddr\n let protocol = 'tcp'\n let explicitPort = `:${port}`\n const last = parts[parts.length - 1]\n if (last.protocol === 'tcp') {\n // assume http and produce clean urls\n protocol = port === '443' ? 'https' : 'http'\n explicitPort = port === '443' || port === '80' ? '' : explicitPort\n }\n return `${protocol}://${str}${explicitPort}`\n}\n\nconst Reducers = {\n ip4: reduceValue,\n ip6: (str, content, i, parts) => (\n parts.length === 1 && parts[0].protocol === 'ip6'\n ? content\n : `[${content}]`\n ),\n tcp: (str, content, i, parts, opts) => (\n parts.some(p => ['http', 'https', 'ws', 'wss'].includes(p.protocol))\n ? `${str}:${content}`\n : tcpUri(str, content, parts, opts)\n ),\n udp: (str, content) => `udp://${str}:${content}`,\n dnsaddr: reduceValue,\n dns4: reduceValue,\n dns6: reduceValue,\n ipfs: (str, content) => `${str}/ipfs/${content}`,\n p2p: (str, content) => `${str}/p2p/${content}`,\n http: str => `http://${str}`,\n https: str => `https://${str}`,\n ws: str => `ws://${str}`,\n wss: str => `wss://${str}`,\n 'p2p-websocket-star': str => `${str}/p2p-websocket-star`,\n 'p2p-webrtc-star': str => `${str}/p2p-webrtc-star`,\n 'p2p-webrtc-direct': str => `${str}/p2p-webrtc-direct`\n}\n\nmodule.exports = (multiaddr, opts) => {\n const ma = Multiaddr(multiaddr)\n const parts = multiaddr.toString().split('/').slice(1)\n return ma\n .tuples()\n .map(tuple => ({\n protocol: parts.shift(),\n content: tuple[1] ? parts.shift() : null\n }))\n .reduce((str, part, i, parts) => {\n const reduce = Reducers[part.protocol]\n if (!reduce) throw new Error(`Unsupported protocol ${part.protocol}`)\n return reduce(str, part.content, i, parts, opts)\n }, '')\n}\n","import React from 'react';\nexport var projectsTour = {\n getSteps: function getSteps(_ref) {\n var t = _ref.t;\n return [{\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.projects.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.projects.paragraph1'))),\n placement: 'center',\n target: 'body'\n }];\n },\n styles: {\n options: {\n width: '500px',\n primaryColor: '#69c4cd',\n textColor: '#34373f',\n zIndex: 999\n }\n }\n};\nexport var explorerTour = {\n getSteps: function getSteps(_ref2) {\n var t = _ref2.t;\n return [{\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.explorer.step1.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step1.paragraph1'))),\n placement: 'center',\n target: 'body'\n }, {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.explorer.step2.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step2.paragraph1')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step2.paragraph2'))),\n placement: 'bottom',\n target: '.joyride-explorer-crumbs'\n }, {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.explorer.step3.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step3.paragraph1'))),\n placement: 'right',\n target: '.joyride-explorer-node'\n }, {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.explorer.step4.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step4.paragraph1'))),\n placement: 'left',\n target: '.joyride-explorer-cid'\n }, {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: \"montserrat charcoal\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"f3 fw4\"\n }, t('tour.explorer.step5.title')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"tl f6\"\n }, t('tour.explorer.step5.paragraph1'))),\n locale: {\n last: 'Finish'\n },\n placement: 'left',\n target: '.joyride-explorer-graph'\n }];\n },\n styles: {\n options: {\n width: '500px',\n primaryColor: '#69c4cd',\n textColor: '#34373f',\n zIndex: 999\n }\n }\n};","(function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n } else {\n root.Scrollparent = factory();\n }\n}(this, function () {\n var regex = /(auto|scroll)/;\n\n var parents = function (node, ps) {\n if (node.parentNode === null) { return ps; }\n\n return parents(node.parentNode, ps.concat([node]));\n };\n\n var style = function (node, prop) {\n return getComputedStyle(node, null).getPropertyValue(prop);\n };\n\n var overflow = function (node) {\n return style(node, \"overflow\") + style(node, \"overflow-y\") + style(node, \"overflow-x\");\n };\n\n var scroll = function (node) {\n return regex.test(overflow(node));\n };\n\n var scrollParent = function (node) {\n if (!(node instanceof HTMLElement || node instanceof SVGElement)) {\n return ;\n }\n\n var ps = parents(node.parentNode, []);\n\n for (var i = 0; i < ps.length; i += 1) {\n if (scroll(ps[i])) {\n return ps[i];\n }\n }\n\n return document.scrollingElement || document.documentElement;\n };\n\n return scrollParent;\n}));\n","const VALIDATOR_ARG_ERROR_MESSAGE =\n 'The typeValidator argument must be a function ' +\n 'with the signature function(props, propName, componentName).';\n\nconst MESSAGE_ARG_ERROR_MESSAGE =\n 'The error message is optional, but must be a string if provided.';\n\nconst propIsRequired = (condition, props, propName, componentName) => {\n if (typeof condition === 'boolean') {\n return condition;\n } else if (typeof condition === 'function') {\n return condition(props, propName, componentName);\n } else if (Boolean(condition) === true) {\n return Boolean(condition);\n }\n\n return false;\n};\n\nconst propExists = (props, propName) => Object.hasOwnProperty.call(props, propName);\n\nconst missingPropError = (props, propName, componentName, message) => {\n if (message) {\n return new Error(message);\n }\n\n return new Error(\n `Required ${props[propName]} \\`${propName}\\`` +\n ` was not specified in \\`${componentName}\\`.`,\n );\n};\n\nconst guardAgainstInvalidArgTypes = (typeValidator, message) => {\n if (typeof typeValidator !== 'function') {\n throw new TypeError(VALIDATOR_ARG_ERROR_MESSAGE);\n }\n\n if (Boolean(message) && typeof message !== 'string') {\n throw new TypeError(MESSAGE_ARG_ERROR_MESSAGE);\n }\n};\n\nconst isRequiredIf = (typeValidator, condition, message) => {\n guardAgainstInvalidArgTypes(typeValidator, message);\n\n return (props, propName, componentName, ...rest) => {\n if (propIsRequired(condition, props, propName, componentName)) {\n if (propExists(props, propName)) {\n return typeValidator(props, propName, componentName, ...rest);\n }\n\n return missingPropError(props, propName, componentName, message);\n }\n\n // Is not required, so just run typeValidator.\n return typeValidator(props, propName, componentName, ...rest);\n };\n};\n\nexport default isRequiredIf;\n","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nexport function rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n } // Equivalent to push, but avoids a function call.\n\n\n queue[queue.length] = task;\n}\nvar queue = []; // Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\n// @ts-ignore\n\nvar flushing = false; // `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\n\nvar requestFlush; // The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\n\nvar index = 0; // If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\n\nvar capacity = 1024; // The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\n\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index; // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n\n index = index + 1;\n queue[currentIndex].call(); // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n\n queue.length -= index;\n index = 0;\n }\n }\n\n queue.length = 0;\n index = 0;\n flushing = false;\n} // `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\n\n\nvar scope = typeof global !== 'undefined' ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; // MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\n\nif (typeof BrowserMutationObserver === 'function') {\n requestFlush = makeRequestCallFromMutationObserver(flush); // MessageChannels are desirable because they give direct access to the HTML\n // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n // 11-12, and in web workers in many engines.\n // Although message channels yield to any queued rendering and IO tasks, they\n // would be better than imposing the 4ms delay of timers.\n // However, they do not work reliably in Internet Explorer or Safari.\n // Internet Explorer 10 is the only browser that has setImmediate but does\n // not have MutationObservers.\n // Although setImmediate yields to the browser's renderer, it would be\n // preferrable to falling back to setTimeout since it does not have\n // the minimum 4ms penalty.\n // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n // Desktop to a lesser extent) that renders both setImmediate and\n // MessageChannel useless for the purposes of ASAP.\n // https://github.com/kriskowal/q/issues/396\n // Timers are implemented universally.\n // We fall back to timers in workers in most engines, and in foreground\n // contexts in the following browsers.\n // However, note that even this simple case requires nuances to operate in a\n // broad spectrum of browsers.\n //\n // - Firefox 3-13\n // - Internet Explorer 6-9\n // - iPad Safari 4.3\n // - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n} // `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\n\n\nrawAsap.requestFlush = requestFlush; // To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\n\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode('');\n observer.observe(node, {\n characterData: true\n });\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n} // The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0); // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n} // This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\n\n\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js","'use strict'\n\nconst root = require('./constants/root')\nconst mergeOptions = require('merge-options')\nconst tryWebExt = require('./providers/webext')\nconst tryWindow = require('./providers/window-ipfs')\nconst tryHttpClient = require('./providers/http-client')\nconst tryJsIpfs = require('./providers/js-ipfs')\n\nconst defaultGlobalOpts = {\n connectionTest: async (ipfs) => {\n // ipfs connection is working if we can fetch data via async iterator API\n const cid = 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' // TODO: switch to identity hash when js-ipfs is fixed: https://github.com/ipfs/js-ipfs/issues/3289\n for await (const file of ipfs.get(cid)) {\n if (file.type === 'dir' && file.name === cid) return true\n }\n return false\n }\n}\n\nconst makeProvider = (fn, defaults = {}) => {\n return (options = {}) => {\n return (globalOpts) => {\n options = mergeOptions(defaultGlobalOpts, defaults, globalOpts, options)\n return fn(options)\n }\n }\n}\n\nconst providers = {\n httpClient: makeProvider((options) => {\n return tryHttpClient({ root, ...options })\n }),\n windowIpfs: makeProvider(options => {\n return tryWindow({ root, ...options })\n }),\n jsIpfs: makeProvider(options => {\n return tryJsIpfs(options)\n }),\n webExt: makeProvider(options => {\n return tryWebExt({ root, ...options })\n })\n}\n\nconst defaultProviders = [\n providers.windowIpfs(),\n providers.httpClient()\n]\n\nasync function getIpfs ({ providers = defaultProviders, ...options } = {}) {\n for (const provider of providers) {\n try {\n const res = await provider(options)\n if (res) return res\n } catch (err) {\n // provider failed unexpectedly, log error and move to the next one\n console.error('[ipfs-provider]', err) // eslint-disable-line no-console\n }\n }\n}\n\nmodule.exports = {\n getIpfs,\n providers,\n makeProvider\n}\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Inspector = exports.ObjectName = exports.ObjectValue = exports.ObjectRootLabel = exports.ObjectLabel = exports.DOMInspector = exports.TableInspector = exports.ObjectInspector = exports.chromeDark = exports.chromeLight = undefined;\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');\n\nvar _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);\n\nvar _themes = require('./styles/themes');\n\nObject.defineProperty(exports, 'chromeLight', {\n enumerable: true,\n get: function get() {\n return _themes.chromeLight;\n }\n});\nObject.defineProperty(exports, 'chromeDark', {\n enumerable: true,\n get: function get() {\n return _themes.chromeDark;\n }\n});\n\nvar _ObjectInspector2 = require('./object-inspector/ObjectInspector');\n\nvar _ObjectInspector3 = _interopRequireDefault(_ObjectInspector2);\n\nvar _TableInspector2 = require('./table-inspector/TableInspector');\n\nvar _TableInspector3 = _interopRequireDefault(_TableInspector2);\n\nvar _DOMInspector2 = require('./dom-inspector/DOMInspector');\n\nvar _DOMInspector3 = _interopRequireDefault(_DOMInspector2);\n\nvar _ObjectLabel2 = require('./object-inspector/ObjectLabel');\n\nvar _ObjectLabel3 = _interopRequireDefault(_ObjectLabel2);\n\nvar _ObjectRootLabel2 = require('./object-inspector/ObjectRootLabel');\n\nvar _ObjectRootLabel3 = _interopRequireDefault(_ObjectRootLabel2);\n\nvar _ObjectValue2 = require('./object/ObjectValue');\n\nvar _ObjectValue3 = _interopRequireDefault(_ObjectValue2);\n\nvar _ObjectName2 = require('./object/ObjectName');\n\nvar _ObjectName3 = _interopRequireDefault(_ObjectName2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _isDom = require('is-dom');\n\nvar _isDom2 = _interopRequireDefault(_isDom);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.ObjectInspector = _ObjectInspector3.default;\nexports.TableInspector = _TableInspector3.default;\nexports.DOMInspector = _DOMInspector3.default;\nexports.ObjectLabel = _ObjectLabel3.default;\nexports.ObjectRootLabel = _ObjectRootLabel3.default;\nexports.ObjectValue = _ObjectValue3.default;\nexports.ObjectName = _ObjectName3.default;\n\n// Wrapping the inspectors\n\nvar Inspector = function Inspector(_ref) {\n var _ref$table = _ref.table,\n table = _ref$table === undefined ? false : _ref$table,\n data = _ref.data,\n rest = (0, _objectWithoutProperties3.default)(_ref, ['table', 'data']);\n\n if (table) {\n return _react2.default.createElement(_TableInspector3.default, (0, _extends3.default)({ data: data }, rest));\n }\n\n if ((0, _isDom2.default)(data)) return _react2.default.createElement(_DOMInspector3.default, (0, _extends3.default)({ data: data }, rest));\n\n return _react2.default.createElement(_ObjectInspector3.default, (0, _extends3.default)({ data: data }, rest));\n};\n\nInspector.propTypes = {\n data: _propTypes2.default.any,\n name: _propTypes2.default.string,\n table: _propTypes2.default.bool\n};\n\nexports.Inspector = Inspector;\nexports.default = Inspector;","export default function _asyncGeneratorDelegate(inner, awaitWrap) {\n var iter = {},\n waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) {\n resolve(inner[key](value));\n });\n return {\n done: false,\n value: awaitWrap(value)\n };\n }\n\n ;\n\n if (typeof Symbol === \"function\" && Symbol.iterator) {\n iter[Symbol.iterator] = function () {\n return this;\n };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n\n return pump(\"next\", value);\n };\n\n if (typeof inner[\"throw\"] === \"function\") {\n iter[\"throw\"] = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n\n return pump(\"throw\", value);\n };\n }\n\n if (typeof inner[\"return\"] === \"function\") {\n iter[\"return\"] = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n\n return pump(\"return\", value);\n };\n }\n\n return iter;\n}","//\n// Main\n//\n\nfunction memoize (fn, options) {\n var cache = options && options.cache\n ? options.cache\n : cacheDefault\n\n var serializer = options && options.serializer\n ? options.serializer\n : serializerDefault\n\n var strategy = options && options.strategy\n ? options.strategy\n : strategyDefault\n\n return strategy(fn, {\n cache: cache,\n serializer: serializer\n })\n}\n\n//\n// Strategy\n//\n\nfunction isPrimitive (value) {\n return value == null || typeof value === 'number' || typeof value === 'boolean' // || typeof value === \"string\" 'unsafe' primitive for our needs\n}\n\nfunction monadic (fn, cache, serializer, arg) {\n var cacheKey = isPrimitive(arg) ? arg : serializer(arg)\n\n var computedValue = cache.get(cacheKey)\n if (typeof computedValue === 'undefined') {\n computedValue = fn.call(this, arg)\n cache.set(cacheKey, computedValue)\n }\n\n return computedValue\n}\n\nfunction variadic (fn, cache, serializer) {\n var args = Array.prototype.slice.call(arguments, 3)\n var cacheKey = serializer(args)\n\n var computedValue = cache.get(cacheKey)\n if (typeof computedValue === 'undefined') {\n computedValue = fn.apply(this, args)\n cache.set(cacheKey, computedValue)\n }\n\n return computedValue\n}\n\nfunction assemble (fn, context, strategy, cache, serialize) {\n return strategy.bind(\n context,\n fn,\n cache,\n serialize\n )\n}\n\nfunction strategyDefault (fn, options) {\n var strategy = fn.length === 1 ? monadic : variadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\nfunction strategyVariadic (fn, options) {\n var strategy = variadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\nfunction strategyMonadic (fn, options) {\n var strategy = monadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\n//\n// Serializer\n//\n\nfunction serializerDefault () {\n return JSON.stringify(arguments)\n}\n\n//\n// Cache\n//\n\nfunction ObjectWithoutPrototypeCache () {\n this.cache = Object.create(null)\n}\n\nObjectWithoutPrototypeCache.prototype.has = function (key) {\n return (key in this.cache)\n}\n\nObjectWithoutPrototypeCache.prototype.get = function (key) {\n return this.cache[key]\n}\n\nObjectWithoutPrototypeCache.prototype.set = function (key, value) {\n this.cache[key] = value\n}\n\nvar cacheDefault = {\n create: function create () {\n return new ObjectWithoutPrototypeCache()\n }\n}\n\n//\n// API\n//\n\nmodule.exports = memoize\nmodule.exports.strategies = {\n variadic: strategyVariadic,\n monadic: strategyMonadic\n}\n","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"@babel/runtime/helpers/esm/setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import _typeof from '@babel/runtime/helpers/esm/typeof';\nimport _objectSpread from '@babel/runtime/helpers/esm/objectSpread';\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';\nimport _createClass from '@babel/runtime/helpers/esm/createClass';\nimport _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';\nimport _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport _inherits from '@babel/runtime/helpers/esm/inherits';\n\nvar consoleLogger = {\n type: 'logger',\n log: function log(args) {\n this.output('log', args);\n },\n warn: function warn(args) {\n this.output('warn', args);\n },\n error: function error(args) {\n this.output('error', args);\n },\n output: function output(type, args) {\n if (console && console[type]) console[type].apply(console, args);\n }\n};\n\nvar Logger = function () {\n function Logger(concreteLogger) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Logger);\n\n this.init(concreteLogger, options);\n }\n\n _createClass(Logger, [{\n key: \"init\",\n value: function init(concreteLogger) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.prefix = options.prefix || 'i18next:';\n this.logger = concreteLogger || consoleLogger;\n this.options = options;\n this.debug = options.debug;\n }\n }, {\n key: \"setDebug\",\n value: function setDebug(bool) {\n this.debug = bool;\n }\n }, {\n key: \"log\",\n value: function log() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return this.forward(args, 'log', '', true);\n }\n }, {\n key: \"warn\",\n value: function warn() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return this.forward(args, 'warn', '', true);\n }\n }, {\n key: \"error\",\n value: function error() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return this.forward(args, 'error', '');\n }\n }, {\n key: \"deprecate\",\n value: function deprecate() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);\n }\n }, {\n key: \"forward\",\n value: function forward(args, lvl, prefix, debugOnly) {\n if (debugOnly && !this.debug) return null;\n if (typeof args[0] === 'string') args[0] = \"\".concat(prefix).concat(this.prefix, \" \").concat(args[0]);\n return this.logger[lvl](args);\n }\n }, {\n key: \"create\",\n value: function create(moduleName) {\n return new Logger(this.logger, _objectSpread({}, {\n prefix: \"\".concat(this.prefix, \":\").concat(moduleName, \":\")\n }, this.options));\n }\n }]);\n\n return Logger;\n}();\n\nvar baseLogger = new Logger();\n\nvar EventEmitter = function () {\n function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this.observers = {};\n }\n\n _createClass(EventEmitter, [{\n key: \"on\",\n value: function on(events, listener) {\n var _this = this;\n\n events.split(' ').forEach(function (event) {\n _this.observers[event] = _this.observers[event] || [];\n\n _this.observers[event].push(listener);\n });\n return this;\n }\n }, {\n key: \"off\",\n value: function off(event, listener) {\n if (!this.observers[event]) return;\n\n if (!listener) {\n delete this.observers[event];\n return;\n }\n\n this.observers[event] = this.observers[event].filter(function (l) {\n return l !== listener;\n });\n }\n }, {\n key: \"emit\",\n value: function emit(event) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (this.observers[event]) {\n var cloned = [].concat(this.observers[event]);\n cloned.forEach(function (observer) {\n observer.apply(void 0, args);\n });\n }\n\n if (this.observers['*']) {\n var _cloned = [].concat(this.observers['*']);\n\n _cloned.forEach(function (observer) {\n observer.apply(observer, [event].concat(args));\n });\n }\n }\n }]);\n\n return EventEmitter;\n}();\n\nfunction defer() {\n var res;\n var rej;\n var promise = new Promise(function (resolve, reject) {\n res = resolve;\n rej = reject;\n });\n promise.resolve = res;\n promise.reject = rej;\n return promise;\n}\nfunction makeString(object) {\n if (object == null) return '';\n return '' + object;\n}\nfunction copy(a, s, t) {\n a.forEach(function (m) {\n if (s[m]) t[m] = s[m];\n });\n}\n\nfunction getLastOfPath(object, path, Empty) {\n function cleanKey(key) {\n return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;\n }\n\n function canNotTraverseDeeper() {\n return !object || typeof object === 'string';\n }\n\n var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');\n\n while (stack.length > 1) {\n if (canNotTraverseDeeper()) return {};\n var key = cleanKey(stack.shift());\n if (!object[key] && Empty) object[key] = new Empty();\n\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n object = object[key];\n } else {\n object = {};\n }\n }\n\n if (canNotTraverseDeeper()) return {};\n return {\n obj: object,\n k: cleanKey(stack.shift())\n };\n}\n\nfunction setPath(object, path, newValue) {\n var _getLastOfPath = getLastOfPath(object, path, Object),\n obj = _getLastOfPath.obj,\n k = _getLastOfPath.k;\n\n obj[k] = newValue;\n}\nfunction pushPath(object, path, newValue, concat) {\n var _getLastOfPath2 = getLastOfPath(object, path, Object),\n obj = _getLastOfPath2.obj,\n k = _getLastOfPath2.k;\n\n obj[k] = obj[k] || [];\n if (concat) obj[k] = obj[k].concat(newValue);\n if (!concat) obj[k].push(newValue);\n}\nfunction getPath(object, path) {\n var _getLastOfPath3 = getLastOfPath(object, path),\n obj = _getLastOfPath3.obj,\n k = _getLastOfPath3.k;\n\n if (!obj) return undefined;\n return obj[k];\n}\nfunction getPathWithDefaults(data, defaultData, key) {\n var value = getPath(data, key);\n\n if (value !== undefined) {\n return value;\n }\n\n return getPath(defaultData, key);\n}\nfunction deepExtend(target, source, overwrite) {\n for (var prop in source) {\n if (prop !== '__proto__' && prop !== 'constructor') {\n if (prop in target) {\n if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {\n if (overwrite) target[prop] = source[prop];\n } else {\n deepExtend(target[prop], source[prop], overwrite);\n }\n } else {\n target[prop] = source[prop];\n }\n }\n }\n\n return target;\n}\nfunction regexEscape(str) {\n return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n}\nvar _entityMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '/': '/'\n};\nfunction escape(data) {\n if (typeof data === 'string') {\n return data.replace(/[&<>\"'\\/]/g, function (s) {\n return _entityMap[s];\n });\n }\n\n return data;\n}\nvar isIE10 = typeof window !== 'undefined' && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;\n\nfunction deepFind(obj, path) {\n var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';\n if (!obj) return undefined;\n if (obj[path]) return obj[path];\n var paths = path.split(keySeparator);\n var current = obj;\n\n for (var i = 0; i < paths.length; ++i) {\n if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {\n return undefined;\n }\n\n if (current[paths[i]] === undefined) {\n var j = 2;\n var p = paths.slice(i, i + j).join(keySeparator);\n var mix = current[p];\n\n while (mix === undefined && paths.length > i + j) {\n j++;\n p = paths.slice(i, i + j).join(keySeparator);\n mix = current[p];\n }\n\n if (mix === undefined) return undefined;\n if (typeof mix === 'string') return mix;\n if (p && typeof mix[p] === 'string') return mix[p];\n var joinedPath = paths.slice(i + j).join(keySeparator);\n if (joinedPath) return deepFind(mix, joinedPath, keySeparator);\n return undefined;\n }\n\n current = current[paths[i]];\n }\n\n return current;\n}\n\nvar ResourceStore = function (_EventEmitter) {\n _inherits(ResourceStore, _EventEmitter);\n\n function ResourceStore(data) {\n var _this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n ns: ['translation'],\n defaultNS: 'translation'\n };\n\n _classCallCheck(this, ResourceStore);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(ResourceStore).call(this));\n\n if (isIE10) {\n EventEmitter.call(_assertThisInitialized(_this));\n }\n\n _this.data = data || {};\n _this.options = options;\n\n if (_this.options.keySeparator === undefined) {\n _this.options.keySeparator = '.';\n }\n\n if (_this.options.ignoreJSONStructure === undefined) {\n _this.options.ignoreJSONStructure = true;\n }\n\n return _this;\n }\n\n _createClass(ResourceStore, [{\n key: \"addNamespaces\",\n value: function addNamespaces(ns) {\n if (this.options.ns.indexOf(ns) < 0) {\n this.options.ns.push(ns);\n }\n }\n }, {\n key: \"removeNamespaces\",\n value: function removeNamespaces(ns) {\n var index = this.options.ns.indexOf(ns);\n\n if (index > -1) {\n this.options.ns.splice(index, 1);\n }\n }\n }, {\n key: \"getResource\",\n value: function getResource(lng, ns, key) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;\n var path = [lng, ns];\n if (key && typeof key !== 'string') path = path.concat(key);\n if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);\n\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n }\n\n var result = getPath(this.data, path);\n if (result || !ignoreJSONStructure || typeof key !== 'string') return result;\n return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);\n }\n }, {\n key: \"addResource\",\n value: function addResource(lng, ns, key, value) {\n var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {\n silent: false\n };\n var keySeparator = this.options.keySeparator;\n if (keySeparator === undefined) keySeparator = '.';\n var path = [lng, ns];\n if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);\n\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n value = ns;\n ns = path[1];\n }\n\n this.addNamespaces(ns);\n setPath(this.data, path, value);\n if (!options.silent) this.emit('added', lng, ns, key, value);\n }\n }, {\n key: \"addResources\",\n value: function addResources(lng, ns, resources) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {\n silent: false\n };\n\n for (var m in resources) {\n if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {\n silent: true\n });\n }\n\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n }, {\n key: \"addResourceBundle\",\n value: function addResourceBundle(lng, ns, resources, deep, overwrite) {\n var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {\n silent: false\n };\n var path = [lng, ns];\n\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n deep = resources;\n resources = ns;\n ns = path[1];\n }\n\n this.addNamespaces(ns);\n var pack = getPath(this.data, path) || {};\n\n if (deep) {\n deepExtend(pack, resources, overwrite);\n } else {\n pack = _objectSpread({}, pack, resources);\n }\n\n setPath(this.data, path, pack);\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n }, {\n key: \"removeResourceBundle\",\n value: function removeResourceBundle(lng, ns) {\n if (this.hasResourceBundle(lng, ns)) {\n delete this.data[lng][ns];\n }\n\n this.removeNamespaces(ns);\n this.emit('removed', lng, ns);\n }\n }, {\n key: \"hasResourceBundle\",\n value: function hasResourceBundle(lng, ns) {\n return this.getResource(lng, ns) !== undefined;\n }\n }, {\n key: \"getResourceBundle\",\n value: function getResourceBundle(lng, ns) {\n if (!ns) ns = this.options.defaultNS;\n if (this.options.compatibilityAPI === 'v1') return _objectSpread({}, {}, this.getResource(lng, ns));\n return this.getResource(lng, ns);\n }\n }, {\n key: \"getDataByLanguage\",\n value: function getDataByLanguage(lng) {\n return this.data[lng];\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return this.data;\n }\n }]);\n\n return ResourceStore;\n}(EventEmitter);\n\nvar postProcessor = {\n processors: {},\n addPostProcessor: function addPostProcessor(module) {\n this.processors[module.name] = module;\n },\n handle: function handle(processors, value, key, options, translator) {\n var _this = this;\n\n processors.forEach(function (processor) {\n if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);\n });\n return value;\n }\n};\n\nvar checkedLoadedFor = {};\n\nvar Translator = function (_EventEmitter) {\n _inherits(Translator, _EventEmitter);\n\n function Translator(services) {\n var _this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Translator);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Translator).call(this));\n\n if (isIE10) {\n EventEmitter.call(_assertThisInitialized(_this));\n }\n\n copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));\n _this.options = options;\n\n if (_this.options.keySeparator === undefined) {\n _this.options.keySeparator = '.';\n }\n\n _this.logger = baseLogger.create('translator');\n return _this;\n }\n\n _createClass(Translator, [{\n key: \"changeLanguage\",\n value: function changeLanguage(lng) {\n if (lng) this.language = lng;\n }\n }, {\n key: \"exists\",\n value: function exists(key) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n interpolation: {}\n };\n var resolved = this.resolve(key, options);\n return resolved && resolved.res !== undefined;\n }\n }, {\n key: \"extractFromKey\",\n value: function extractFromKey(key, options) {\n var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;\n if (nsSeparator === undefined) nsSeparator = ':';\n var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n var namespaces = options.ns || this.options.defaultNS;\n\n if (nsSeparator && key.indexOf(nsSeparator) > -1) {\n var m = key.match(this.interpolator.nestingRegexp);\n\n if (m && m.length > 0) {\n return {\n key: key,\n namespaces: namespaces\n };\n }\n\n var parts = key.split(nsSeparator);\n if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();\n key = parts.join(keySeparator);\n }\n\n if (typeof namespaces === 'string') namespaces = [namespaces];\n return {\n key: key,\n namespaces: namespaces\n };\n }\n }, {\n key: \"translate\",\n value: function translate(keys, options, lastKey) {\n var _this2 = this;\n\n if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {\n options = this.options.overloadTranslationOptionHandler(arguments);\n }\n\n if (!options) options = {};\n if (keys === undefined || keys === null) return '';\n if (!Array.isArray(keys)) keys = [String(keys)];\n var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n\n var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),\n key = _this$extractFromKey.key,\n namespaces = _this$extractFromKey.namespaces;\n\n var namespace = namespaces[namespaces.length - 1];\n var lng = options.lng || this.language;\n var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;\n\n if (lng && lng.toLowerCase() === 'cimode') {\n if (appendNamespaceToCIMode) {\n var nsSeparator = options.nsSeparator || this.options.nsSeparator;\n return namespace + nsSeparator + key;\n }\n\n return key;\n }\n\n var resolved = this.resolve(keys, options);\n var res = resolved && resolved.res;\n var resUsedKey = resolved && resolved.usedKey || key;\n var resExactUsedKey = resolved && resolved.exactUsedKey || key;\n var resType = Object.prototype.toString.apply(res);\n var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];\n var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;\n var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;\n var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';\n\n if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {\n if (!options.returnObjects && !this.options.returnObjects) {\n this.logger.warn('accessing an object - but returnObjects options is not enabled!');\n return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, options) : \"key '\".concat(key, \" (\").concat(this.language, \")' returned an object instead of string.\");\n }\n\n if (keySeparator) {\n var resTypeIsArray = resType === '[object Array]';\n var copy = resTypeIsArray ? [] : {};\n var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;\n\n for (var m in res) {\n if (Object.prototype.hasOwnProperty.call(res, m)) {\n var deepKey = \"\".concat(newKeyToUse).concat(keySeparator).concat(m);\n copy[m] = this.translate(deepKey, _objectSpread({}, options, {\n joinArrays: false,\n ns: namespaces\n }));\n if (copy[m] === deepKey) copy[m] = res[m];\n }\n }\n\n res = copy;\n }\n } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {\n res = res.join(joinArrays);\n if (res) res = this.extendTranslation(res, keys, options, lastKey);\n } else {\n var usedDefault = false;\n var usedKey = false;\n var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n var hasDefaultValue = Translator.hasDefaultValue(options);\n var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count) : '';\n var defaultValue = options[\"defaultValue\".concat(defaultValueSuffix)] || options.defaultValue;\n\n if (!this.isValidLookup(res) && hasDefaultValue) {\n usedDefault = true;\n res = defaultValue;\n }\n\n if (!this.isValidLookup(res)) {\n usedKey = true;\n res = key;\n }\n\n var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;\n\n if (usedKey || usedDefault || updateMissing) {\n this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);\n\n if (keySeparator) {\n var fk = this.resolve(key, _objectSpread({}, options, {\n keySeparator: false\n }));\n if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');\n }\n\n var lngs = [];\n var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);\n\n if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {\n for (var i = 0; i < fallbackLngs.length; i++) {\n lngs.push(fallbackLngs[i]);\n }\n } else if (this.options.saveMissingTo === 'all') {\n lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);\n } else {\n lngs.push(options.lng || this.language);\n }\n\n var send = function send(l, k, fallbackValue) {\n if (_this2.options.missingKeyHandler) {\n _this2.options.missingKeyHandler(l, namespace, k, updateMissing ? fallbackValue : res, updateMissing, options);\n } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {\n _this2.backendConnector.saveMissing(l, namespace, k, updateMissing ? fallbackValue : res, updateMissing, options);\n }\n\n _this2.emit('missingKey', l, namespace, k, res);\n };\n\n if (this.options.saveMissing) {\n if (this.options.saveMissingPlurals && needsPluralHandling) {\n lngs.forEach(function (language) {\n _this2.pluralResolver.getSuffixes(language).forEach(function (suffix) {\n send([language], key + suffix, options[\"defaultValue\".concat(suffix)] || defaultValue);\n });\n });\n } else {\n send(lngs, key, defaultValue);\n }\n }\n }\n\n res = this.extendTranslation(res, keys, options, resolved, lastKey);\n if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = \"\".concat(namespace, \":\").concat(key);\n if (usedKey && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(res);\n }\n\n return res;\n }\n }, {\n key: \"extendTranslation\",\n value: function extendTranslation(res, key, options, resolved, lastKey) {\n var _this3 = this;\n\n if (this.i18nFormat && this.i18nFormat.parse) {\n res = this.i18nFormat.parse(res, options, resolved.usedLng, resolved.usedNS, resolved.usedKey, {\n resolved: resolved\n });\n } else if (!options.skipInterpolation) {\n if (options.interpolation) this.interpolator.init(_objectSpread({}, options, {\n interpolation: _objectSpread({}, this.options.interpolation, options.interpolation)\n }));\n var skipOnVariables = options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables;\n var nestBef;\n\n if (skipOnVariables) {\n var nb = res.match(this.interpolator.nestingRegexp);\n nestBef = nb && nb.length;\n }\n\n var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;\n if (this.options.interpolation.defaultVariables) data = _objectSpread({}, this.options.interpolation.defaultVariables, data);\n res = this.interpolator.interpolate(res, data, options.lng || this.language, options);\n\n if (skipOnVariables) {\n var na = res.match(this.interpolator.nestingRegexp);\n var nestAft = na && na.length;\n if (nestBef < nestAft) options.nest = false;\n }\n\n if (options.nest !== false) res = this.interpolator.nest(res, function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (lastKey && lastKey[0] === args[0] && !options.context) {\n _this3.logger.warn(\"It seems you are nesting recursively key: \".concat(args[0], \" in key: \").concat(key[0]));\n\n return null;\n }\n\n return _this3.translate.apply(_this3, args.concat([key]));\n }, options);\n if (options.interpolation) this.interpolator.reset();\n }\n\n var postProcess = options.postProcess || this.options.postProcess;\n var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;\n\n if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {\n res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread({\n i18nResolved: resolved\n }, options) : options, this);\n }\n\n return res;\n }\n }, {\n key: \"resolve\",\n value: function resolve(keys) {\n var _this4 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var found;\n var usedKey;\n var exactUsedKey;\n var usedLng;\n var usedNS;\n if (typeof keys === 'string') keys = [keys];\n keys.forEach(function (k) {\n if (_this4.isValidLookup(found)) return;\n\n var extracted = _this4.extractFromKey(k, options);\n\n var key = extracted.key;\n usedKey = key;\n var namespaces = extracted.namespaces;\n if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);\n var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n var needsContextHandling = options.context !== undefined && typeof options.context === 'string' && options.context !== '';\n var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);\n namespaces.forEach(function (ns) {\n if (_this4.isValidLookup(found)) return;\n usedNS = ns;\n\n if (!checkedLoadedFor[\"\".concat(codes[0], \"-\").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {\n checkedLoadedFor[\"\".concat(codes[0], \"-\").concat(ns)] = true;\n\n _this4.logger.warn(\"key \\\"\".concat(usedKey, \"\\\" for languages \\\"\").concat(codes.join(', '), \"\\\" won't get resolved as namespace \\\"\").concat(usedNS, \"\\\" was not yet loaded\"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n }\n\n codes.forEach(function (code) {\n if (_this4.isValidLookup(found)) return;\n usedLng = code;\n var finalKey = key;\n var finalKeys = [finalKey];\n\n if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {\n _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);\n } else {\n var pluralSuffix;\n if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count);\n if (needsPluralHandling && needsContextHandling) finalKeys.push(finalKey + pluralSuffix);\n if (needsContextHandling) finalKeys.push(finalKey += \"\".concat(_this4.options.contextSeparator).concat(options.context));\n if (needsPluralHandling) finalKeys.push(finalKey += pluralSuffix);\n }\n\n var possibleKey;\n\n while (possibleKey = finalKeys.pop()) {\n if (!_this4.isValidLookup(found)) {\n exactUsedKey = possibleKey;\n found = _this4.getResource(code, ns, possibleKey, options);\n }\n }\n });\n });\n });\n return {\n res: found,\n usedKey: usedKey,\n exactUsedKey: exactUsedKey,\n usedLng: usedLng,\n usedNS: usedNS\n };\n }\n }, {\n key: \"isValidLookup\",\n value: function isValidLookup(res) {\n return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');\n }\n }, {\n key: \"getResource\",\n value: function getResource(code, ns, key) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);\n return this.resourceStore.getResource(code, ns, key, options);\n }\n }], [{\n key: \"hasDefaultValue\",\n value: function hasDefaultValue(options) {\n var prefix = 'defaultValue';\n\n for (var option in options) {\n if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {\n return true;\n }\n }\n\n return false;\n }\n }]);\n\n return Translator;\n}(EventEmitter);\n\nfunction capitalize(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nvar LanguageUtil = function () {\n function LanguageUtil(options) {\n _classCallCheck(this, LanguageUtil);\n\n this.options = options;\n this.whitelist = this.options.supportedLngs || false;\n this.supportedLngs = this.options.supportedLngs || false;\n this.logger = baseLogger.create('languageUtils');\n }\n\n _createClass(LanguageUtil, [{\n key: \"getScriptPartFromCode\",\n value: function getScriptPartFromCode(code) {\n if (!code || code.indexOf('-') < 0) return null;\n var p = code.split('-');\n if (p.length === 2) return null;\n p.pop();\n if (p[p.length - 1].toLowerCase() === 'x') return null;\n return this.formatLanguageCode(p.join('-'));\n }\n }, {\n key: \"getLanguagePartFromCode\",\n value: function getLanguagePartFromCode(code) {\n if (!code || code.indexOf('-') < 0) return code;\n var p = code.split('-');\n return this.formatLanguageCode(p[0]);\n }\n }, {\n key: \"formatLanguageCode\",\n value: function formatLanguageCode(code) {\n if (typeof code === 'string' && code.indexOf('-') > -1) {\n var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];\n var p = code.split('-');\n\n if (this.options.lowerCaseLng) {\n p = p.map(function (part) {\n return part.toLowerCase();\n });\n } else if (p.length === 2) {\n p[0] = p[0].toLowerCase();\n p[1] = p[1].toUpperCase();\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n } else if (p.length === 3) {\n p[0] = p[0].toLowerCase();\n if (p[1].length === 2) p[1] = p[1].toUpperCase();\n if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());\n }\n\n return p.join('-');\n }\n\n return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;\n }\n }, {\n key: \"isWhitelisted\",\n value: function isWhitelisted(code) {\n this.logger.deprecate('languageUtils.isWhitelisted', 'function \"isWhitelisted\" will be renamed to \"isSupportedCode\" in the next major - please make sure to rename it\\'s usage asap.');\n return this.isSupportedCode(code);\n }\n }, {\n key: \"isSupportedCode\",\n value: function isSupportedCode(code) {\n if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {\n code = this.getLanguagePartFromCode(code);\n }\n\n return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;\n }\n }, {\n key: \"getBestMatchFromCodes\",\n value: function getBestMatchFromCodes(codes) {\n var _this = this;\n\n if (!codes) return null;\n var found;\n codes.forEach(function (code) {\n if (found) return;\n\n var cleanedLng = _this.formatLanguageCode(code);\n\n if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;\n });\n\n if (!found && this.options.supportedLngs) {\n codes.forEach(function (code) {\n if (found) return;\n\n var lngOnly = _this.getLanguagePartFromCode(code);\n\n if (_this.isSupportedCode(lngOnly)) return found = lngOnly;\n found = _this.options.supportedLngs.find(function (supportedLng) {\n if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;\n });\n });\n }\n\n if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];\n return found;\n }\n }, {\n key: \"getFallbackCodes\",\n value: function getFallbackCodes(fallbacks, code) {\n if (!fallbacks) return [];\n if (typeof fallbacks === 'function') fallbacks = fallbacks(code);\n if (typeof fallbacks === 'string') fallbacks = [fallbacks];\n if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;\n if (!code) return fallbacks[\"default\"] || [];\n var found = fallbacks[code];\n if (!found) found = fallbacks[this.getScriptPartFromCode(code)];\n if (!found) found = fallbacks[this.formatLanguageCode(code)];\n if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];\n if (!found) found = fallbacks[\"default\"];\n return found || [];\n }\n }, {\n key: \"toResolveHierarchy\",\n value: function toResolveHierarchy(code, fallbackCode) {\n var _this2 = this;\n\n var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);\n var codes = [];\n\n var addCode = function addCode(c) {\n if (!c) return;\n\n if (_this2.isSupportedCode(c)) {\n codes.push(c);\n } else {\n _this2.logger.warn(\"rejecting language code not found in supportedLngs: \".concat(c));\n }\n };\n\n if (typeof code === 'string' && code.indexOf('-') > -1) {\n if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));\n if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));\n if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));\n } else if (typeof code === 'string') {\n addCode(this.formatLanguageCode(code));\n }\n\n fallbackCodes.forEach(function (fc) {\n if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));\n });\n return codes;\n }\n }]);\n\n return LanguageUtil;\n}();\n\nvar sets = [{\n lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],\n nr: [1, 2],\n fc: 1\n}, {\n lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],\n nr: [1, 2],\n fc: 2\n}, {\n lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],\n nr: [1],\n fc: 3\n}, {\n lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],\n nr: [1, 2, 5],\n fc: 4\n}, {\n lngs: ['ar'],\n nr: [0, 1, 2, 3, 11, 100],\n fc: 5\n}, {\n lngs: ['cs', 'sk'],\n nr: [1, 2, 5],\n fc: 6\n}, {\n lngs: ['csb', 'pl'],\n nr: [1, 2, 5],\n fc: 7\n}, {\n lngs: ['cy'],\n nr: [1, 2, 3, 8],\n fc: 8\n}, {\n lngs: ['fr'],\n nr: [1, 2],\n fc: 9\n}, {\n lngs: ['ga'],\n nr: [1, 2, 3, 7, 11],\n fc: 10\n}, {\n lngs: ['gd'],\n nr: [1, 2, 3, 20],\n fc: 11\n}, {\n lngs: ['is'],\n nr: [1, 2],\n fc: 12\n}, {\n lngs: ['jv'],\n nr: [0, 1],\n fc: 13\n}, {\n lngs: ['kw'],\n nr: [1, 2, 3, 4],\n fc: 14\n}, {\n lngs: ['lt'],\n nr: [1, 2, 10],\n fc: 15\n}, {\n lngs: ['lv'],\n nr: [1, 2, 0],\n fc: 16\n}, {\n lngs: ['mk'],\n nr: [1, 2],\n fc: 17\n}, {\n lngs: ['mnk'],\n nr: [0, 1, 2],\n fc: 18\n}, {\n lngs: ['mt'],\n nr: [1, 2, 11, 20],\n fc: 19\n}, {\n lngs: ['or'],\n nr: [2, 1],\n fc: 2\n}, {\n lngs: ['ro'],\n nr: [1, 2, 20],\n fc: 20\n}, {\n lngs: ['sl'],\n nr: [5, 1, 2, 3],\n fc: 21\n}, {\n lngs: ['he', 'iw'],\n nr: [1, 2, 20, 21],\n fc: 22\n}];\nvar _rulesPluralsTypes = {\n 1: function _(n) {\n return Number(n > 1);\n },\n 2: function _(n) {\n return Number(n != 1);\n },\n 3: function _(n) {\n return 0;\n },\n 4: function _(n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 5: function _(n) {\n return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);\n },\n 6: function _(n) {\n return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);\n },\n 7: function _(n) {\n return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 8: function _(n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);\n },\n 9: function _(n) {\n return Number(n >= 2);\n },\n 10: function _(n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);\n },\n 11: function _(n) {\n return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);\n },\n 12: function _(n) {\n return Number(n % 10 != 1 || n % 100 == 11);\n },\n 13: function _(n) {\n return Number(n !== 0);\n },\n 14: function _(n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);\n },\n 15: function _(n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 16: function _(n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);\n },\n 17: function _(n) {\n return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);\n },\n 18: function _(n) {\n return Number(n == 0 ? 0 : n == 1 ? 1 : 2);\n },\n 19: function _(n) {\n return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);\n },\n 20: function _(n) {\n return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);\n },\n 21: function _(n) {\n return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);\n },\n 22: function _(n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);\n }\n};\n\nfunction createRules() {\n var rules = {};\n sets.forEach(function (set) {\n set.lngs.forEach(function (l) {\n rules[l] = {\n numbers: set.nr,\n plurals: _rulesPluralsTypes[set.fc]\n };\n });\n });\n return rules;\n}\n\nvar PluralResolver = function () {\n function PluralResolver(languageUtils) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, PluralResolver);\n\n this.languageUtils = languageUtils;\n this.options = options;\n this.logger = baseLogger.create('pluralResolver');\n this.rules = createRules();\n }\n\n _createClass(PluralResolver, [{\n key: \"addRule\",\n value: function addRule(lng, obj) {\n this.rules[lng] = obj;\n }\n }, {\n key: \"getRule\",\n value: function getRule(code) {\n return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];\n }\n }, {\n key: \"needsPlural\",\n value: function needsPlural(code) {\n var rule = this.getRule(code);\n return rule && rule.numbers.length > 1;\n }\n }, {\n key: \"getPluralFormsOfKey\",\n value: function getPluralFormsOfKey(code, key) {\n return this.getSuffixes(code).map(function (suffix) {\n return key + suffix;\n });\n }\n }, {\n key: \"getSuffixes\",\n value: function getSuffixes(code) {\n var _this = this;\n\n var rule = this.getRule(code);\n\n if (!rule) {\n return [];\n }\n\n return rule.numbers.map(function (number) {\n return _this.getSuffix(code, number);\n });\n }\n }, {\n key: \"getSuffix\",\n value: function getSuffix(code, count) {\n var _this2 = this;\n\n var rule = this.getRule(code);\n\n if (rule) {\n var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));\n var suffix = rule.numbers[idx];\n\n if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n if (suffix === 2) {\n suffix = 'plural';\n } else if (suffix === 1) {\n suffix = '';\n }\n }\n\n var returnSuffix = function returnSuffix() {\n return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();\n };\n\n if (this.options.compatibilityJSON === 'v1') {\n if (suffix === 1) return '';\n if (typeof suffix === 'number') return \"_plural_\".concat(suffix.toString());\n return returnSuffix();\n } else if (this.options.compatibilityJSON === 'v2') {\n return returnSuffix();\n } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n return returnSuffix();\n }\n\n return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();\n }\n\n this.logger.warn(\"no plural rule found for: \".concat(code));\n return '';\n }\n }]);\n\n return PluralResolver;\n}();\n\nvar Interpolator = function () {\n function Interpolator() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Interpolator);\n\n this.logger = baseLogger.create('interpolator');\n this.options = options;\n\n this.format = options.interpolation && options.interpolation.format || function (value) {\n return value;\n };\n\n this.init(options);\n }\n\n _createClass(Interpolator, [{\n key: \"init\",\n value: function init() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!options.interpolation) options.interpolation = {\n escapeValue: true\n };\n var iOpts = options.interpolation;\n this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;\n this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;\n this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;\n this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';\n this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';\n this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';\n this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';\n this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';\n this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');\n this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');\n this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';\n this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;\n this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;\n this.resetRegExp();\n }\n }, {\n key: \"reset\",\n value: function reset() {\n if (this.options) this.init(this.options);\n }\n }, {\n key: \"resetRegExp\",\n value: function resetRegExp() {\n var regexpStr = \"\".concat(this.prefix, \"(.+?)\").concat(this.suffix);\n this.regexp = new RegExp(regexpStr, 'g');\n var regexpUnescapeStr = \"\".concat(this.prefix).concat(this.unescapePrefix, \"(.+?)\").concat(this.unescapeSuffix).concat(this.suffix);\n this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');\n var nestingRegexpStr = \"\".concat(this.nestingPrefix, \"(.+?)\").concat(this.nestingSuffix);\n this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');\n }\n }, {\n key: \"interpolate\",\n value: function interpolate(str, data, lng, options) {\n var _this = this;\n\n var match;\n var value;\n var replaces;\n var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};\n\n function regexSafe(val) {\n return val.replace(/\\$/g, '$$$$');\n }\n\n var handleFormat = function handleFormat(key) {\n if (key.indexOf(_this.formatSeparator) < 0) {\n var path = getPathWithDefaults(data, defaultData, key);\n return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread({}, options, data, {\n interpolationkey: key\n })) : path;\n }\n\n var p = key.split(_this.formatSeparator);\n var k = p.shift().trim();\n var f = p.join(_this.formatSeparator).trim();\n return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread({}, options, data, {\n interpolationkey: k\n }));\n };\n\n this.resetRegExp();\n var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;\n var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables;\n var todos = [{\n regex: this.regexpUnescape,\n safeValue: function safeValue(val) {\n return regexSafe(val);\n }\n }, {\n regex: this.regexp,\n safeValue: function safeValue(val) {\n return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);\n }\n }];\n todos.forEach(function (todo) {\n replaces = 0;\n\n while (match = todo.regex.exec(str)) {\n value = handleFormat(match[1].trim());\n\n if (value === undefined) {\n if (typeof missingInterpolationHandler === 'function') {\n var temp = missingInterpolationHandler(str, match, options);\n value = typeof temp === 'string' ? temp : '';\n } else if (skipOnVariables) {\n value = match[0];\n continue;\n } else {\n _this.logger.warn(\"missed to pass in variable \".concat(match[1], \" for interpolating \").concat(str));\n\n value = '';\n }\n } else if (typeof value !== 'string' && !_this.useRawValueToEscape) {\n value = makeString(value);\n }\n\n str = str.replace(match[0], todo.safeValue(value));\n todo.regex.lastIndex = 0;\n replaces++;\n\n if (replaces >= _this.maxReplaces) {\n break;\n }\n }\n });\n return str;\n }\n }, {\n key: \"nest\",\n value: function nest(str, fc) {\n var _this2 = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var match;\n var value;\n\n var clonedOptions = _objectSpread({}, options);\n\n clonedOptions.applyPostProcessor = false;\n delete clonedOptions.defaultValue;\n\n function handleHasOptions(key, inheritedOptions) {\n var sep = this.nestingOptionsSeparator;\n if (key.indexOf(sep) < 0) return key;\n var c = key.split(new RegExp(\"\".concat(sep, \"[ ]*{\")));\n var optionsString = \"{\".concat(c[1]);\n key = c[0];\n optionsString = this.interpolate(optionsString, clonedOptions);\n optionsString = optionsString.replace(/'/g, '\"');\n\n try {\n clonedOptions = JSON.parse(optionsString);\n if (inheritedOptions) clonedOptions = _objectSpread({}, inheritedOptions, clonedOptions);\n } catch (e) {\n this.logger.warn(\"failed parsing options string in nesting for key \".concat(key), e);\n return \"\".concat(key).concat(sep).concat(optionsString);\n }\n\n delete clonedOptions.defaultValue;\n return key;\n }\n\n while (match = this.nestingRegexp.exec(str)) {\n var formatters = [];\n var doReduce = false;\n\n if (match[0].includes(this.formatSeparator) && !/{.*}/.test(match[1])) {\n var r = match[1].split(this.formatSeparator).map(function (elem) {\n return elem.trim();\n });\n match[1] = r.shift();\n formatters = r;\n doReduce = true;\n }\n\n value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);\n if (value && match[0] === str && typeof value !== 'string') return value;\n if (typeof value !== 'string') value = makeString(value);\n\n if (!value) {\n this.logger.warn(\"missed to resolve \".concat(match[1], \" for nesting \").concat(str));\n value = '';\n }\n\n if (doReduce) {\n value = formatters.reduce(function (v, f) {\n return _this2.format(v, f, options.lng, _objectSpread({}, options, {\n interpolationkey: match[1].trim()\n }));\n }, value.trim());\n }\n\n str = str.replace(match[0], value);\n this.regexp.lastIndex = 0;\n }\n\n return str;\n }\n }]);\n\n return Interpolator;\n}();\n\nfunction remove(arr, what) {\n var found = arr.indexOf(what);\n\n while (found !== -1) {\n arr.splice(found, 1);\n found = arr.indexOf(what);\n }\n}\n\nvar Connector = function (_EventEmitter) {\n _inherits(Connector, _EventEmitter);\n\n function Connector(backend, store, services) {\n var _this;\n\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n _classCallCheck(this, Connector);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Connector).call(this));\n\n if (isIE10) {\n EventEmitter.call(_assertThisInitialized(_this));\n }\n\n _this.backend = backend;\n _this.store = store;\n _this.services = services;\n _this.languageUtils = services.languageUtils;\n _this.options = options;\n _this.logger = baseLogger.create('backendConnector');\n _this.state = {};\n _this.queue = [];\n\n if (_this.backend && _this.backend.init) {\n _this.backend.init(services, options.backend, options);\n }\n\n return _this;\n }\n\n _createClass(Connector, [{\n key: \"queueLoad\",\n value: function queueLoad(languages, namespaces, options, callback) {\n var _this2 = this;\n\n var toLoad = [];\n var pending = [];\n var toLoadLanguages = [];\n var toLoadNamespaces = [];\n languages.forEach(function (lng) {\n var hasAllNamespaces = true;\n namespaces.forEach(function (ns) {\n var name = \"\".concat(lng, \"|\").concat(ns);\n\n if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {\n _this2.state[name] = 2;\n } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {\n if (pending.indexOf(name) < 0) pending.push(name);\n } else {\n _this2.state[name] = 1;\n hasAllNamespaces = false;\n if (pending.indexOf(name) < 0) pending.push(name);\n if (toLoad.indexOf(name) < 0) toLoad.push(name);\n if (toLoadNamespaces.indexOf(ns) < 0) toLoadNamespaces.push(ns);\n }\n });\n if (!hasAllNamespaces) toLoadLanguages.push(lng);\n });\n\n if (toLoad.length || pending.length) {\n this.queue.push({\n pending: pending,\n loaded: {},\n errors: [],\n callback: callback\n });\n }\n\n return {\n toLoad: toLoad,\n pending: pending,\n toLoadLanguages: toLoadLanguages,\n toLoadNamespaces: toLoadNamespaces\n };\n }\n }, {\n key: \"loaded\",\n value: function loaded(name, err, data) {\n var s = name.split('|');\n var lng = s[0];\n var ns = s[1];\n if (err) this.emit('failedLoading', lng, ns, err);\n\n if (data) {\n this.store.addResourceBundle(lng, ns, data);\n }\n\n this.state[name] = err ? -1 : 2;\n var loaded = {};\n this.queue.forEach(function (q) {\n pushPath(q.loaded, [lng], ns);\n remove(q.pending, name);\n if (err) q.errors.push(err);\n\n if (q.pending.length === 0 && !q.done) {\n Object.keys(q.loaded).forEach(function (l) {\n if (!loaded[l]) loaded[l] = [];\n\n if (q.loaded[l].length) {\n q.loaded[l].forEach(function (ns) {\n if (loaded[l].indexOf(ns) < 0) loaded[l].push(ns);\n });\n }\n });\n q.done = true;\n\n if (q.errors.length) {\n q.callback(q.errors);\n } else {\n q.callback();\n }\n }\n });\n this.emit('loaded', loaded);\n this.queue = this.queue.filter(function (q) {\n return !q.done;\n });\n }\n }, {\n key: \"read\",\n value: function read(lng, ns, fcName) {\n var _this3 = this;\n\n var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 350;\n var callback = arguments.length > 5 ? arguments[5] : undefined;\n if (!lng.length) return callback(null, {});\n return this.backend[fcName](lng, ns, function (err, data) {\n if (err && data && tried < 5) {\n setTimeout(function () {\n _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);\n }, wait);\n return;\n }\n\n callback(err, data);\n });\n }\n }, {\n key: \"prepareLoading\",\n value: function prepareLoading(languages, namespaces) {\n var _this4 = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var callback = arguments.length > 3 ? arguments[3] : undefined;\n\n if (!this.backend) {\n this.logger.warn('No backend was added via i18next.use. Will not load resources.');\n return callback && callback();\n }\n\n if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);\n if (typeof namespaces === 'string') namespaces = [namespaces];\n var toLoad = this.queueLoad(languages, namespaces, options, callback);\n\n if (!toLoad.toLoad.length) {\n if (!toLoad.pending.length) callback();\n return null;\n }\n\n toLoad.toLoad.forEach(function (name) {\n _this4.loadOne(name);\n });\n }\n }, {\n key: \"load\",\n value: function load(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {}, callback);\n }\n }, {\n key: \"reload\",\n value: function reload(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {\n reload: true\n }, callback);\n }\n }, {\n key: \"loadOne\",\n value: function loadOne(name) {\n var _this5 = this;\n\n var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var s = name.split('|');\n var lng = s[0];\n var ns = s[1];\n this.read(lng, ns, 'read', undefined, undefined, function (err, data) {\n if (err) _this5.logger.warn(\"\".concat(prefix, \"loading namespace \").concat(ns, \" for language \").concat(lng, \" failed\"), err);\n if (!err && data) _this5.logger.log(\"\".concat(prefix, \"loaded namespace \").concat(ns, \" for language \").concat(lng), data);\n\n _this5.loaded(name, err, data);\n });\n }\n }, {\n key: \"saveMissing\",\n value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {\n var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};\n\n if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {\n this.logger.warn(\"did not save key \\\"\".concat(key, \"\\\" as the namespace \\\"\").concat(namespace, \"\\\" was not yet loaded\"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n return;\n }\n\n if (key === undefined || key === null || key === '') return;\n\n if (this.backend && this.backend.create) {\n this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread({}, options, {\n isUpdate: isUpdate\n }));\n }\n\n if (!languages || !languages[0]) return;\n this.store.addResource(languages[0], namespace, key, fallbackValue);\n }\n }]);\n\n return Connector;\n}(EventEmitter);\n\nfunction get() {\n return {\n debug: false,\n initImmediate: true,\n ns: ['translation'],\n defaultNS: ['translation'],\n fallbackLng: ['dev'],\n fallbackNS: false,\n whitelist: false,\n nonExplicitWhitelist: false,\n supportedLngs: false,\n nonExplicitSupportedLngs: false,\n load: 'all',\n preload: false,\n simplifyPluralSuffix: true,\n keySeparator: '.',\n nsSeparator: ':',\n pluralSeparator: '_',\n contextSeparator: '_',\n partialBundledLanguages: false,\n saveMissing: false,\n updateMissing: false,\n saveMissingTo: 'fallback',\n saveMissingPlurals: true,\n missingKeyHandler: false,\n missingInterpolationHandler: false,\n postProcess: false,\n postProcessPassResolved: false,\n returnNull: true,\n returnEmptyString: true,\n returnObjects: false,\n joinArrays: false,\n returnedObjectHandler: false,\n parseMissingKeyHandler: false,\n appendNamespaceToMissingKey: false,\n appendNamespaceToCIMode: false,\n overloadTranslationOptionHandler: function handle(args) {\n var ret = {};\n if (_typeof(args[1]) === 'object') ret = args[1];\n if (typeof args[1] === 'string') ret.defaultValue = args[1];\n if (typeof args[2] === 'string') ret.tDescription = args[2];\n\n if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {\n var options = args[3] || args[2];\n Object.keys(options).forEach(function (key) {\n ret[key] = options[key];\n });\n }\n\n return ret;\n },\n interpolation: {\n escapeValue: true,\n format: function format(value, _format, lng, options) {\n return value;\n },\n prefix: '{{',\n suffix: '}}',\n formatSeparator: ',',\n unescapePrefix: '-',\n nestingPrefix: '$t(',\n nestingSuffix: ')',\n nestingOptionsSeparator: ',',\n maxReplaces: 1000,\n skipOnVariables: false\n }\n };\n}\nfunction transformOptions(options) {\n if (typeof options.ns === 'string') options.ns = [options.ns];\n if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];\n if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];\n\n if (options.whitelist) {\n if (options.whitelist && options.whitelist.indexOf('cimode') < 0) {\n options.whitelist = options.whitelist.concat(['cimode']);\n }\n\n options.supportedLngs = options.whitelist;\n }\n\n if (options.nonExplicitWhitelist) {\n options.nonExplicitSupportedLngs = options.nonExplicitWhitelist;\n }\n\n if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {\n options.supportedLngs = options.supportedLngs.concat(['cimode']);\n }\n\n return options;\n}\n\nfunction noop() {}\n\nvar I18n = function (_EventEmitter) {\n _inherits(I18n, _EventEmitter);\n\n function I18n() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = arguments.length > 1 ? arguments[1] : undefined;\n\n _classCallCheck(this, I18n);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(I18n).call(this));\n\n if (isIE10) {\n EventEmitter.call(_assertThisInitialized(_this));\n }\n\n _this.options = transformOptions(options);\n _this.services = {};\n _this.logger = baseLogger;\n _this.modules = {\n external: []\n };\n\n if (callback && !_this.isInitialized && !options.isClone) {\n if (!_this.options.initImmediate) {\n _this.init(options, callback);\n\n return _possibleConstructorReturn(_this, _assertThisInitialized(_this));\n }\n\n setTimeout(function () {\n _this.init(options, callback);\n }, 0);\n }\n\n return _this;\n }\n\n _createClass(I18n, [{\n key: \"init\",\n value: function init() {\n var _this2 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = arguments.length > 1 ? arguments[1] : undefined;\n\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n if (options.whitelist && !options.supportedLngs) {\n this.logger.deprecate('whitelist', 'option \"whitelist\" will be renamed to \"supportedLngs\" in the next major - please make sure to rename this option asap.');\n }\n\n if (options.nonExplicitWhitelist && !options.nonExplicitSupportedLngs) {\n this.logger.deprecate('whitelist', 'options \"nonExplicitWhitelist\" will be renamed to \"nonExplicitSupportedLngs\" in the next major - please make sure to rename this option asap.');\n }\n\n this.options = _objectSpread({}, get(), this.options, transformOptions(options));\n this.format = this.options.interpolation.format;\n if (!callback) callback = noop;\n\n function createClassOnDemand(ClassOrObject) {\n if (!ClassOrObject) return null;\n if (typeof ClassOrObject === 'function') return new ClassOrObject();\n return ClassOrObject;\n }\n\n if (!this.options.isClone) {\n if (this.modules.logger) {\n baseLogger.init(createClassOnDemand(this.modules.logger), this.options);\n } else {\n baseLogger.init(null, this.options);\n }\n\n var lu = new LanguageUtil(this.options);\n this.store = new ResourceStore(this.options.resources, this.options);\n var s = this.services;\n s.logger = baseLogger;\n s.resourceStore = this.store;\n s.languageUtils = lu;\n s.pluralResolver = new PluralResolver(lu, {\n prepend: this.options.pluralSeparator,\n compatibilityJSON: this.options.compatibilityJSON,\n simplifyPluralSuffix: this.options.simplifyPluralSuffix\n });\n s.interpolator = new Interpolator(this.options);\n s.utils = {\n hasLoadedNamespace: this.hasLoadedNamespace.bind(this)\n };\n s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);\n s.backendConnector.on('*', function (event) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n _this2.emit.apply(_this2, [event].concat(args));\n });\n\n if (this.modules.languageDetector) {\n s.languageDetector = createClassOnDemand(this.modules.languageDetector);\n s.languageDetector.init(s, this.options.detection, this.options);\n }\n\n if (this.modules.i18nFormat) {\n s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);\n if (s.i18nFormat.init) s.i18nFormat.init(this);\n }\n\n this.translator = new Translator(this.services, this.options);\n this.translator.on('*', function (event) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n _this2.emit.apply(_this2, [event].concat(args));\n });\n this.modules.external.forEach(function (m) {\n if (m.init) m.init(_this2);\n });\n }\n\n if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {\n var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];\n }\n\n if (!this.services.languageDetector && !this.options.lng) {\n this.logger.warn('init: no languageDetector is used and no lng is defined');\n }\n\n var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];\n storeApi.forEach(function (fcName) {\n _this2[fcName] = function () {\n var _this2$store;\n\n return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);\n };\n });\n var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];\n storeApiChained.forEach(function (fcName) {\n _this2[fcName] = function () {\n var _this2$store2;\n\n (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);\n\n return _this2;\n };\n });\n var deferred = defer();\n\n var load = function load() {\n var finish = function finish(err, t) {\n if (_this2.isInitialized) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');\n _this2.isInitialized = true;\n if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);\n\n _this2.emit('initialized', _this2.options);\n\n deferred.resolve(t);\n callback(err, t);\n };\n\n if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));\n\n _this2.changeLanguage(_this2.options.lng, finish);\n };\n\n if (this.options.resources || !this.options.initImmediate) {\n load();\n } else {\n setTimeout(load, 0);\n }\n\n return deferred;\n }\n }, {\n key: \"loadResources\",\n value: function loadResources(language) {\n var _this3 = this;\n\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n var usedCallback = callback;\n var usedLng = typeof language === 'string' ? language : this.language;\n if (typeof language === 'function') usedCallback = language;\n\n if (!this.options.resources || this.options.partialBundledLanguages) {\n if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();\n var toLoad = [];\n\n var append = function append(lng) {\n if (!lng) return;\n\n var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);\n\n lngs.forEach(function (l) {\n if (toLoad.indexOf(l) < 0) toLoad.push(l);\n });\n };\n\n if (!usedLng) {\n var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n fallbacks.forEach(function (l) {\n return append(l);\n });\n } else {\n append(usedLng);\n }\n\n if (this.options.preload) {\n this.options.preload.forEach(function (l) {\n return append(l);\n });\n }\n\n this.services.backendConnector.load(toLoad, this.options.ns, usedCallback);\n } else {\n usedCallback(null);\n }\n }\n }, {\n key: \"reloadResources\",\n value: function reloadResources(lngs, ns, callback) {\n var deferred = defer();\n if (!lngs) lngs = this.languages;\n if (!ns) ns = this.options.ns;\n if (!callback) callback = noop;\n this.services.backendConnector.reload(lngs, ns, function (err) {\n deferred.resolve();\n callback(err);\n });\n return deferred;\n }\n }, {\n key: \"use\",\n value: function use(module) {\n if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');\n if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');\n\n if (module.type === 'backend') {\n this.modules.backend = module;\n }\n\n if (module.type === 'logger' || module.log && module.warn && module.error) {\n this.modules.logger = module;\n }\n\n if (module.type === 'languageDetector') {\n this.modules.languageDetector = module;\n }\n\n if (module.type === 'i18nFormat') {\n this.modules.i18nFormat = module;\n }\n\n if (module.type === 'postProcessor') {\n postProcessor.addPostProcessor(module);\n }\n\n if (module.type === '3rdParty') {\n this.modules.external.push(module);\n }\n\n return this;\n }\n }, {\n key: \"changeLanguage\",\n value: function changeLanguage(lng, callback) {\n var _this4 = this;\n\n this.isLanguageChangingTo = lng;\n var deferred = defer();\n this.emit('languageChanging', lng);\n\n var done = function done(err, l) {\n if (l) {\n _this4.language = l;\n _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);\n\n _this4.translator.changeLanguage(l);\n\n _this4.isLanguageChangingTo = undefined;\n\n _this4.emit('languageChanged', l);\n\n _this4.logger.log('languageChanged', l);\n } else {\n _this4.isLanguageChangingTo = undefined;\n }\n\n deferred.resolve(function () {\n return _this4.t.apply(_this4, arguments);\n });\n if (callback) callback(err, function () {\n return _this4.t.apply(_this4, arguments);\n });\n };\n\n var setLng = function setLng(lngs) {\n var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);\n\n if (l) {\n if (!_this4.language) {\n _this4.language = l;\n _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);\n }\n\n if (!_this4.translator.language) _this4.translator.changeLanguage(l);\n if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);\n }\n\n _this4.loadResources(l, function (err) {\n done(err, l);\n });\n };\n\n if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {\n setLng(this.services.languageDetector.detect());\n } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {\n this.services.languageDetector.detect(setLng);\n } else {\n setLng(lng);\n }\n\n return deferred;\n }\n }, {\n key: \"getFixedT\",\n value: function getFixedT(lng, ns) {\n var _this5 = this;\n\n var fixedT = function fixedT(key, opts) {\n var options;\n\n if (_typeof(opts) !== 'object') {\n for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {\n rest[_key3 - 2] = arguments[_key3];\n }\n\n options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));\n } else {\n options = _objectSpread({}, opts);\n }\n\n options.lng = options.lng || fixedT.lng;\n options.lngs = options.lngs || fixedT.lngs;\n options.ns = options.ns || fixedT.ns;\n return _this5.t(key, options);\n };\n\n if (typeof lng === 'string') {\n fixedT.lng = lng;\n } else {\n fixedT.lngs = lng;\n }\n\n fixedT.ns = ns;\n return fixedT;\n }\n }, {\n key: \"t\",\n value: function t() {\n var _this$translator;\n\n return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);\n }\n }, {\n key: \"exists\",\n value: function exists() {\n var _this$translator2;\n\n return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);\n }\n }, {\n key: \"setDefaultNamespace\",\n value: function setDefaultNamespace(ns) {\n this.options.defaultNS = ns;\n }\n }, {\n key: \"hasLoadedNamespace\",\n value: function hasLoadedNamespace(ns) {\n var _this6 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (!this.isInitialized) {\n this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);\n return false;\n }\n\n if (!this.languages || !this.languages.length) {\n this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);\n return false;\n }\n\n var lng = this.languages[0];\n var fallbackLng = this.options ? this.options.fallbackLng : false;\n var lastLng = this.languages[this.languages.length - 1];\n if (lng.toLowerCase() === 'cimode') return true;\n\n var loadNotPending = function loadNotPending(l, n) {\n var loadState = _this6.services.backendConnector.state[\"\".concat(l, \"|\").concat(n)];\n\n return loadState === -1 || loadState === 2;\n };\n\n if (options.precheck) {\n var preResult = options.precheck(this, loadNotPending);\n if (preResult !== undefined) return preResult;\n }\n\n if (this.hasResourceBundle(lng, ns)) return true;\n if (!this.services.backendConnector.backend) return true;\n if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;\n return false;\n }\n }, {\n key: \"loadNamespaces\",\n value: function loadNamespaces(ns, callback) {\n var _this7 = this;\n\n var deferred = defer();\n\n if (!this.options.ns) {\n callback && callback();\n return Promise.resolve();\n }\n\n if (typeof ns === 'string') ns = [ns];\n ns.forEach(function (n) {\n if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);\n });\n this.loadResources(function (err) {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n }, {\n key: \"loadLanguages\",\n value: function loadLanguages(lngs, callback) {\n var deferred = defer();\n if (typeof lngs === 'string') lngs = [lngs];\n var preloaded = this.options.preload || [];\n var newLngs = lngs.filter(function (lng) {\n return preloaded.indexOf(lng) < 0;\n });\n\n if (!newLngs.length) {\n if (callback) callback();\n return Promise.resolve();\n }\n\n this.options.preload = preloaded.concat(newLngs);\n this.loadResources(function (err) {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n }, {\n key: \"dir\",\n value: function dir(lng) {\n if (!lng) lng = this.languages && this.languages.length > 0 ? this.languages[0] : this.language;\n if (!lng) return 'rtl';\n var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam'];\n return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) >= 0 ? 'rtl' : 'ltr';\n }\n }, {\n key: \"createInstance\",\n value: function createInstance() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = arguments.length > 1 ? arguments[1] : undefined;\n return new I18n(options, callback);\n }\n }, {\n key: \"cloneInstance\",\n value: function cloneInstance() {\n var _this8 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n\n var mergedOptions = _objectSpread({}, this.options, options, {\n isClone: true\n });\n\n var clone = new I18n(mergedOptions);\n var membersToCopy = ['store', 'services', 'language'];\n membersToCopy.forEach(function (m) {\n clone[m] = _this8[m];\n });\n clone.services = _objectSpread({}, this.services);\n clone.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n clone.translator = new Translator(clone.services, clone.options);\n clone.translator.on('*', function (event) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n clone.emit.apply(clone, [event].concat(args));\n });\n clone.init(mergedOptions, callback);\n clone.translator.options = clone.options;\n clone.translator.backendConnector.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n return clone;\n }\n }]);\n\n return I18n;\n}(EventEmitter);\n\nvar i18next = new I18n();\n\nexport default i18next;\n","/**\n * Implementation of the multicodec specification.\n *\n * @module multicodec\n * @example\n * const multicodec = require('multicodec')\n *\n * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer)\n * // prefixedProtobuf 0x50...\n *\n */\n'use strict'\n\n/** @typedef {import('./generated-types').CodecName} CodecName */\n/** @typedef {import('./generated-types').CodecCode} CodecCode */\n\nconst varint = require('varint')\nconst uint8ArrayConcat = require('uint8arrays/concat')\nconst util = require('./util')\nconst { nameToVarint, constantToCode, nameToCode, codeToName } = require('./maps')\n\n/**\n * Prefix a buffer with a multicodec-packed.\n *\n * @param {CodecName|Uint8Array} multicodecStrOrCode\n * @param {Uint8Array} data\n * @returns {Uint8Array}\n */\nfunction addPrefix (multicodecStrOrCode, data) {\n let prefix\n\n if (multicodecStrOrCode instanceof Uint8Array) {\n prefix = util.varintUint8ArrayEncode(multicodecStrOrCode)\n } else {\n if (nameToVarint[multicodecStrOrCode]) {\n prefix = nameToVarint[multicodecStrOrCode]\n } else {\n throw new Error('multicodec not recognized')\n }\n }\n\n return uint8ArrayConcat([prefix, data], prefix.length + data.length)\n}\n\n/**\n * Decapsulate the multicodec-packed prefix from the data.\n *\n * @param {Uint8Array} data\n * @returns {Uint8Array}\n */\nfunction rmPrefix (data) {\n varint.decode(/** @type {Buffer} */(data))\n return data.slice(varint.decode.bytes)\n}\n\n/**\n * Get the codec name of the prefixed data.\n *\n * @param {Uint8Array} prefixedData\n * @returns {CodecName}\n */\nfunction getNameFromData (prefixedData) {\n const code = /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData)))\n const name = codeToName[code]\n if (name === undefined) {\n throw new Error(`Code \"${code}\" not found`)\n }\n return name\n}\n\n/**\n * Get the codec name from a code.\n *\n * @param {CodecCode} codec\n * @returns {CodecName}\n */\nfunction getNameFromCode (codec) {\n return codeToName[codec]\n}\n\n/**\n * Get the code of the codec\n *\n * @param {CodecName} name\n * @returns {CodecCode}\n */\nfunction getCodeFromName (name) {\n const code = nameToCode[name]\n if (code === undefined) {\n throw new Error(`Codec \"${name}\" not found`)\n }\n return code\n}\n\n/**\n * Get the code of the prefixed data.\n *\n * @param {Uint8Array} prefixedData\n * @returns {CodecCode}\n */\nfunction getCodeFromData (prefixedData) {\n return /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData)))\n}\n\n/**\n * Get the code as varint of a codec name.\n *\n * @param {CodecName} name\n * @returns {Uint8Array}\n */\nfunction getVarintFromName (name) {\n const code = nameToVarint[name]\n if (code === undefined) {\n throw new Error(`Codec \"${name}\" not found`)\n }\n return code\n}\n\n/**\n * Get the varint of a code.\n *\n * @param {CodecCode} code\n * @returns {Uint8Array}\n */\nfunction getVarintFromCode (code) {\n return util.varintEncode(code)\n}\n\n/**\n * Get the codec name of the prefixed data.\n *\n * @deprecated use getNameFromData instead.\n * @param {Uint8Array} prefixedData\n * @returns {CodecName}\n */\nfunction getCodec (prefixedData) {\n return getNameFromData(prefixedData)\n}\n\n/**\n * Get the codec name from a code.\n *\n * @deprecated use getNameFromCode instead.\n * @param {CodecCode} codec\n * @returns {CodecName}\n */\nfunction getName (codec) {\n return getNameFromCode(codec)\n}\n\n/**\n * Get the code of the codec\n *\n * @deprecated use getCodeFromName instead.\n * @param {CodecName} name\n * @returns {CodecCode}\n */\nfunction getNumber (name) {\n return getCodeFromName(name)\n}\n\n/**\n * Get the code of the prefixed data.\n *\n * @deprecated use getCodeFromData instead.\n * @param {Uint8Array} prefixedData\n * @returns {CodecCode}\n */\nfunction getCode (prefixedData) {\n return getCodeFromData(prefixedData)\n}\n\n/**\n * Get the code as varint of a codec name.\n *\n * @deprecated use getVarintFromName instead.\n * @param {CodecName} name\n * @returns {Uint8Array}\n */\nfunction getCodeVarint (name) {\n return getVarintFromName(name)\n}\n\n/**\n * Get the varint of a code.\n *\n * @deprecated use getVarintFromCode instead.\n * @param {CodecCode} code\n * @returns {Array.}\n */\nfunction getVarint (code) {\n return Array.from(getVarintFromCode(code))\n}\n\nmodule.exports = {\n addPrefix,\n rmPrefix,\n getNameFromData,\n getNameFromCode,\n getCodeFromName,\n getCodeFromData,\n getVarintFromName,\n getVarintFromCode,\n // Deprecated\n getCodec,\n getName,\n getNumber,\n getCode,\n getCodeVarint,\n getVarint,\n // Make the constants top-level constants\n ...constantToCode,\n // Export the maps\n nameToVarint,\n nameToCode,\n codeToName\n}\n","'use strict'\n\nconst { encoding: getCodec } = require('multibase')\nconst utf8Encoder = new TextEncoder()\n\n/**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n/**\n * Interprets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {string} string - The string to turn into an array\n */\nfunction asciiStringToUint8Array (string) {\n const array = new Uint8Array(string.length)\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i)\n }\n\n return array\n}\n\n/**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {string} string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n */\nfunction fromString (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array(string)\n }\n\n return getCodec(encoding).decode(string)\n}\n\nmodule.exports = fromString\n","export function registerTarget(type, target, manager) {\n var registry = manager.getRegistry();\n var targetId = registry.addTarget(type, target);\n return [targetId, function () {\n return registry.removeTarget(targetId);\n }];\n}\nexport function registerSource(type, source, manager) {\n var registry = manager.getRegistry();\n var sourceId = registry.addSource(type, source);\n return [sourceId, function () {\n return registry.removeSource(sourceId);\n }];\n}","'use strict';\nconst isOptionObject = require('is-plain-obj');\n\nconst {hasOwnProperty} = Object.prototype;\nconst {propertyIsEnumerable} = Object;\nconst defineProperty = (object, name, value) => Object.defineProperty(object, name, {\n\tvalue,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true\n});\n\nconst globalThis = this;\nconst defaultMergeOptions = {\n\tconcatArrays: false,\n\tignoreUndefined: false\n};\n\nconst getEnumerableOwnPropertyKeys = value => {\n\tconst keys = [];\n\n\tfor (const key in value) {\n\t\tif (hasOwnProperty.call(value, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\n\t/* istanbul ignore else */\n\tif (Object.getOwnPropertySymbols) {\n\t\tconst symbols = Object.getOwnPropertySymbols(value);\n\n\t\tfor (const symbol of symbols) {\n\t\t\tif (propertyIsEnumerable.call(value, symbol)) {\n\t\t\t\tkeys.push(symbol);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn keys;\n};\n\nfunction clone(value) {\n\tif (Array.isArray(value)) {\n\t\treturn cloneArray(value);\n\t}\n\n\tif (isOptionObject(value)) {\n\t\treturn cloneOptionObject(value);\n\t}\n\n\treturn value;\n}\n\nfunction cloneArray(array) {\n\tconst result = array.slice(0, 0);\n\n\tgetEnumerableOwnPropertyKeys(array).forEach(key => {\n\t\tdefineProperty(result, key, clone(array[key]));\n\t});\n\n\treturn result;\n}\n\nfunction cloneOptionObject(object) {\n\tconst result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};\n\n\tgetEnumerableOwnPropertyKeys(object).forEach(key => {\n\t\tdefineProperty(result, key, clone(object[key]));\n\t});\n\n\treturn result;\n}\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {string[]} keys keys to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nconst mergeKeys = (merged, source, keys, config) => {\n\tkeys.forEach(key => {\n\t\tif (typeof source[key] === 'undefined' && config.ignoreUndefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not recurse into prototype chain of merged\n\t\tif (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {\n\t\t\tdefineProperty(merged, key, merge(merged[key], source[key], config));\n\t\t} else {\n\t\t\tdefineProperty(merged, key, clone(source[key]));\n\t\t}\n\t});\n\n\treturn merged;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n *\n * see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)\n */\nconst concatArrays = (merged, source, config) => {\n\tlet result = merged.slice(0, 0);\n\tlet resultIndex = 0;\n\n\t[merged, source].forEach(array => {\n\t\tconst indices = [];\n\n\t\t// `result.concat(array)` with cloning\n\t\tfor (let k = 0; k < array.length; k++) {\n\t\t\tif (!hasOwnProperty.call(array, k)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tindices.push(String(k));\n\n\t\t\tif (array === merged) {\n\t\t\t\t// Already cloned\n\t\t\t\tdefineProperty(result, resultIndex++, array[k]);\n\t\t\t} else {\n\t\t\t\tdefineProperty(result, resultIndex++, clone(array[k]));\n\t\t\t}\n\t\t}\n\n\t\t// Merge non-index keys\n\t\tresult = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);\n\t});\n\n\treturn result;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nfunction merge(merged, source, config) {\n\tif (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {\n\t\treturn concatArrays(merged, source, config);\n\t}\n\n\tif (!isOptionObject(source) || !isOptionObject(merged)) {\n\t\treturn clone(source);\n\t}\n\n\treturn mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);\n}\n\nmodule.exports = function (...options) {\n\tconst config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);\n\tlet merged = {_: {}};\n\n\tfor (const option of options) {\n\t\tif (option === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!isOptionObject(option)) {\n\t\t\tthrow new TypeError('`' + option + '` is not an Option Object');\n\t\t}\n\n\t\tmerged = merge(merged, {_: option}, config);\n\t}\n\n\treturn merged._;\n};\n","'use strict'\n\nconst CID = require('cids')\n\nconst { version } = require('../package.json')\nconst blockSymbol = Symbol.for('@ipld/js-ipld-block/block')\nconst readonly = { writable: false, configurable: false, enumerable: true }\n\n/**\n * Represents an immutable block of data that is uniquely referenced with a cid.\n *\n * @example\n * const block = new Block(Uint8Array.from([0, 1, 2, 3]), new CID('...'))\n */\nclass Block {\n /**\n * @param {Uint8Array} data - The data to be stored in the block as a Uint8Array.\n * @param {CID} cid - The cid of the data\n */\n constructor (data, cid) {\n if (!data || !(data instanceof Uint8Array)) {\n throw new Error('first argument must be a Uint8Array')\n }\n\n if (!cid || !CID.isCID(cid)) {\n throw new Error('second argument must be a CID')\n }\n\n this.data = data\n this.cid = cid\n\n Object.defineProperties(this, {\n data: readonly,\n cid: readonly\n })\n }\n\n /**\n * The data of this block.\n *\n * @deprecated\n * @type {Uint8Array}\n */\n get _data () {\n deprecateData()\n return this.data\n }\n\n /**\n * The cid of the data this block represents.\n *\n * @deprecated\n * @type {CID}\n */\n get _cid () {\n deprecateCID()\n return this.cid\n }\n\n get [Symbol.toStringTag] () {\n return 'Block'\n }\n\n get [blockSymbol] () {\n return true\n }\n\n /**\n * Check if the given value is a Block.\n *\n * @param {any} other\n * @returns {other is Block}\n */\n static isBlock (other) {\n return Boolean(other && other[blockSymbol])\n }\n}\n\n/**\n * @param {RegExp} range\n * @param {string} message\n * @returns {() => void}\n */\nconst deprecate = (range, message) => {\n let warned = false\n return () => {\n if (range.test(version)) {\n if (!warned) {\n warned = true\n // eslint-disable-next-line no-console\n console.warn(message)\n }\n } else {\n throw new Error(message)\n }\n }\n}\n\nconst deprecateCID = deprecate(/^0\\.10|^0\\.11/, 'block._cid is deprecated and will be removed in 0.12 release. Please use block.cid instead')\nconst deprecateData = deprecate(/^0\\.10|^0.11/, 'block._data is deprecated and will be removed in 0.12 release. Please use block.data instead')\n\nmodule.exports = Block\n","export default !!(typeof window !== 'undefined' && window.document && window.document.createElement);","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","'use strict'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array>} arrays\n * @param {number} [length]\n */\nfunction concat (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = concat\n","import React from 'react';\nimport Loadable from '@loadable/component';\nimport ComponentLoader from '../loader/ComponentLoader.js';\nvar LoadableSettingsPage = Loadable(function () {\n return import('./IpldGraphCytoscape');\n}, {\n fallback: /*#__PURE__*/React.createElement(ComponentLoader, null)\n});\nexport default LoadableSettingsPage;","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport React from 'react';\n\nvar StrokeIpld = function StrokeIpld(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n viewBox: \"0 0 100 100\"\n }, props), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M87.714 44.764c0-1.157-.45-2.245-1.269-3.062a4.304 4.304 0 0 0-3.063-1.269 4.304 4.304 0 0 0-3.062 1.269 4.337 4.337 0 0 0 0 6.125c.602.602 1.351 1 2.164 1.172v2.442l-14.686 9.276v-19.79l4.498-2.842v-3.717a4.27 4.27 0 0 0 1.827-1.067 4.337 4.337 0 0 0 0-6.125 4.337 4.337 0 0 0-6.126 0 4.304 4.304 0 0 0-1.269 3.063c0 1.157.45 2.245 1.269 3.062a4.282 4.282 0 0 0 1.963 1.107v2.391L51.236 48.627v-8.901l9.304-5.877v-7.051a4.282 4.282 0 0 0 1.986-1.114 4.336 4.336 0 0 0-.001-6.125 4.337 4.337 0 0 0-6.125 0h-.001a4.337 4.337 0 0 0 0 6.125c.52.519 1.145.859 1.804 1.059v5.818l-6.967 4.401V15.561a4.283 4.283 0 0 0 2.008-1.12 4.337 4.337 0 0 0-.001-6.126 4.337 4.337 0 0 0-6.125 0h-.001a4.337 4.337 0 0 0 .001 6.126 4.273 4.273 0 0 0 1.782 1.053v15.881l-7.229-4.566v-3.436a4.292 4.292 0 0 0 2.008-1.12 4.337 4.337 0 0 0 0-6.125 4.337 4.337 0 0 0-6.126 0 4.304 4.304 0 0 0-1.269 3.063c0 1.157.45 2.245 1.269 3.062a4.276 4.276 0 0 0 1.781 1.053v4.79l9.565 6.042v21.108l-7.708-4.226v-7.809a4.275 4.275 0 0 0 2.034-1.128 4.337 4.337 0 0 0 0-6.125 4.337 4.337 0 0 0-6.126 0 4.304 4.304 0 0 0-1.269 3.063c0 1.157.45 2.245 1.269 3.062a4.284 4.284 0 0 0 1.756 1.046v6.61L27.15 43.322v-6.217a4.28 4.28 0 0 0 1.984-1.117 4.3 4.3 0 0 0 1.27-3.063c0-1.157-.45-2.245-1.269-3.062a4.336 4.336 0 0 0-6.126 0 4.337 4.337 0 0 0 0 6.125c.51.51 1.132.858 1.804 1.062v7.621l3.646 2.004v13.632l-10.582-5.77v-2.418a4.29 4.29 0 0 0 2.051-1.133 4.337 4.337 0 0 0 0-6.125 4.304 4.304 0 0 0-3.062-1.269 4.304 4.304 0 0 0-3.063 1.269 4.337 4.337 0 0 0 0 6.125 4.285 4.285 0 0 0 1.738 1.041v3.812L48.9 74.108v11.397a4.277 4.277 0 0 0-1.783 1.053 4.337 4.337 0 0 0 0 6.125 4.32 4.32 0 0 0 3.063 1.266 4.316 4.316 0 0 0 3.063-1.267 4.337 4.337 0 0 0 0-6.125 4.29 4.29 0 0 0-2.008-1.119V73.943L84.82 52.727v-3.892a4.29 4.29 0 0 0 1.625-1.008 4.3 4.3 0 0 0 1.269-3.063zM30.586 61.468V47.844L48.9 57.91v13.542l-18.314-9.984zm34.876-19.065v19.79l-14.227 8.986v-19.79l14.227-8.986zm3.067-12.164c0-.676.264-1.312.742-1.79a2.525 2.525 0 0 1 1.79-.74c.647 0 1.296.247 1.789.74a2.536 2.536 0 0 1 0 3.581 2.535 2.535 0 0 1-3.579 0 2.516 2.516 0 0 1-.742-1.791zm-10.857-9.407a2.534 2.534 0 0 1 3.58 0 2.534 2.534 0 0 1 0 3.58 2.534 2.534 0 0 1-3.58 0 2.534 2.534 0 0 1 0-3.58zM48.389 9.589a2.536 2.536 0 0 1 3.581 0c.987.987.987 2.593.001 3.58a2.536 2.536 0 0 1-3.581 0 2.535 2.535 0 0 1-.001-3.58zM38.084 19.19c0-.676.264-1.312.742-1.79a2.525 2.525 0 0 1 1.79-.74c.647 0 1.296.247 1.789.74a2.536 2.536 0 0 1 0 3.581 2.535 2.535 0 0 1-3.579 0 2.52 2.52 0 0 1-.742-1.791zm-.453 19.832c0-.676.264-1.312.742-1.79a2.525 2.525 0 0 1 1.79-.74c.647 0 1.296.247 1.789.74a2.536 2.536 0 0 1 0 3.581 2.535 2.535 0 0 1-3.58 0 2.525 2.525 0 0 1-.741-1.791zm-13.348-7.887a2.524 2.524 0 0 1 1.789-.74 2.526 2.526 0 0 1 2.532 2.531c0 .677-.264 1.312-.742 1.79-.422.422-.984.647-1.562.696h-.456c-.577-.049-1.139-.274-1.561-.696a2.534 2.534 0 0 1 0-3.581zm-9.207 14.999a2.514 2.514 0 0 1 1.79-.742 2.534 2.534 0 0 1 1.789 4.322 2.533 2.533 0 0 1-3.579 0 2.533 2.533 0 0 1 0-3.58zM51.97 91.411a2.534 2.534 0 0 1-3.58 0 2.534 2.534 0 0 1 0-3.58 2.536 2.536 0 0 1 3.58 0 2.534 2.534 0 0 1 0 3.58zm33.202-44.857c-.955.955-2.624.957-3.579 0a2.534 2.534 0 0 1 1.789-4.322c.677 0 1.312.264 1.791.742.478.478.741 1.113.741 1.79s-.263 1.311-.742 1.79z\"\n }));\n};\n\nexport default StrokeIpld;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport { connect } from 'redux-bundler-react';\nimport { withTranslation } from 'react-i18next';\nimport StrokeIpld from '../../icons/StrokeIpld';\n\nvar IpldExploreForm = /*#__PURE__*/function (_React$Component) {\n _inherits(IpldExploreForm, _React$Component);\n\n var _super = _createSuper(IpldExploreForm);\n\n function IpldExploreForm(props) {\n var _this;\n\n _classCallCheck(this, IpldExploreForm);\n\n _this = _super.call(this, props);\n _this.state = {\n path: ''\n };\n _this.handleOnChange = _this.handleOnChange.bind(_assertThisInitialized(_this));\n _this.handleOnSubmit = _this.handleOnSubmit.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(IpldExploreForm, [{\n key: \"handleOnSubmit\",\n value: function handleOnSubmit(evt) {\n evt.preventDefault();\n this.props.doExploreUserProvidedPath(this.state.path);\n }\n }, {\n key: \"handleOnChange\",\n value: function handleOnChange(evt) {\n var path = evt.target.value;\n this.setState({\n path: path\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var t = this.props.t;\n return /*#__PURE__*/React.createElement(\"form\", {\n \"data-id\": \"IpldExploreForm\",\n className: \"sans-serif black-80 flex\",\n onSubmit: this.handleOnSubmit\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"flex-auto\"\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"relative\"\n }, /*#__PURE__*/React.createElement(\"input\", {\n id: \"ipfs-path\",\n className: \"input-reset bn pa2 mb2 db w-100 f6 br-0 placeholder-light focus-outline\",\n style: {\n borderRadius: '3px 0 0 3px'\n },\n type: \"text\",\n placeholder: \"QmHash\",\n \"aria-describedby\": \"name-desc\",\n onChange: this.handleOnChange,\n value: this.state.path\n }), /*#__PURE__*/React.createElement(\"small\", {\n id: \"ipfs-path-desc\",\n className: \"o-0 absolute f6 black-60 db mb2\"\n }, \"Paste in a CID or IPFS path\"))), /*#__PURE__*/React.createElement(\"div\", {\n className: \"flex-none\"\n }, /*#__PURE__*/React.createElement(\"button\", {\n type: \"submit\",\n className: \"button-reset dib lh-copy pv1 pl2 pr3 ba f7 fw4 focus-outline white bg-aqua bn\",\n style: {\n borderRadius: '0 3px 3px 0'\n }\n }, /*#__PURE__*/React.createElement(StrokeIpld, {\n style: {\n height: 24\n },\n className: \"dib fill-current-color v-mid\"\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: \"ml2\"\n }, t('IpldExploreForm.explore')))));\n }\n }]);\n\n return IpldExploreForm;\n}(React.Component);\n\nexport default connect('doExploreUserProvidedPath', withTranslation('explore')(IpldExploreForm));","export default __webpack_public_path__ + \"static/media/ipld.c2e6094f.svg\";","import React from 'react';\nimport { Trans, withTranslation } from 'react-i18next';\nimport Box from '../box/Box';\nimport ipldLogoSrc from './ipld.svg';\nexport var AboutIpld = function AboutIpld(_ref) {\n var t = _ref.t;\n return /*#__PURE__*/React.createElement(Box, {\n className: \"tl dib pa4 avenir measure-wide-l lh-copy dark-gray ba-l b--black-10\"\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"tc\"\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: \"link\",\n href: \"https://ipld.io\"\n }, /*#__PURE__*/React.createElement(\"img\", {\n src: ipldLogoSrc,\n alt: \"IPLD\",\n style: {\n height: 60\n }\n }))), /*#__PURE__*/React.createElement(Trans, {\n i18nKey: \"AboutIpld.paragraph1\",\n t: t\n }, /*#__PURE__*/React.createElement(\"p\", null, \"IPLD is \", /*#__PURE__*/React.createElement(\"strong\", null, \"the data model of the content-addressable web.\"), \" It allows us to treat all hash-linked data structures as subsets of a unified information space, unifying all data models that link data with hashes as instances of IPLD.\")), /*#__PURE__*/React.createElement(Trans, {\n i18nKey: \"AboutIpld.paragraph2\",\n t: t\n }, /*#__PURE__*/React.createElement(\"p\", null, \"Content addressing through hashes has become a widely-used means of connecting data in distributed systems, from the blockchains that run your favorite cryptocurrencies, to the commits that back your code, to the web\\u2019s content at large. Yet, whilst all of these tools rely on some common primitives, their specific underlying data structures are not interoperable.\")), /*#__PURE__*/React.createElement(Trans, {\n i18nKey: \"AboutIpld.paragraph3\",\n t: t\n }, /*#__PURE__*/React.createElement(\"p\", null, \"Enter IPLD: a single namespace for all hash-inspired protocols. Through IPLD, links can be traversed across protocols, allowing you to explore data regardless of the underlying protocol.\")));\n};\nexport default withTranslation('explore')(AboutIpld);","import React from 'react';\nimport { Helmet } from 'react-helmet';\nimport { withTranslation } from 'react-i18next';\nimport { colorForNode, nameForNode, shortNameForNode } from './object-info/ObjectInfo';\nimport IpldExploreForm from './explore/IpldExploreForm';\nimport AboutIpld from './about/AboutIpld';\nimport ReactJoyride from 'react-joyride';\nimport { projectsTour } from '../lib/tours';\n\nvar ExploreSuggestion = function ExploreSuggestion(_ref) {\n var cid = _ref.cid,\n name = _ref.name,\n type = _ref.type;\n return /*#__PURE__*/React.createElement(\"a\", {\n className: \"flex items-center lh-copy pl3 pl0-l pv3 bb b--black-10 link focus-outline\",\n href: \"#/explore/\".concat(cid)\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: \"flex items-center justify-center w3 h3 flex-none br-100 tc\",\n style: {\n background: colorForNode(type)\n }\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: \"montserrat fw2 f4 snow\",\n title: nameForNode(type)\n }, shortNameForNode(type))), /*#__PURE__*/React.createElement(\"span\", {\n className: \"pl3 truncate\"\n }, /*#__PURE__*/React.createElement(\"h2\", {\n className: \"ma0 fw4 f5 db black montserrat\"\n }, name), /*#__PURE__*/React.createElement(\"span\", {\n className: \"f7 db blue truncate monospace\"\n }, cid)));\n};\n\nvar StartExploringPage = function StartExploringPage(_ref2) {\n var t = _ref2.t,\n embed = _ref2.embed,\n _ref2$runTour = _ref2.runTour,\n runTour = _ref2$runTour === void 0 ? false : _ref2$runTour,\n joyrideCallback = _ref2.joyrideCallback;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"mw9 center explore-sug-2\"\n }, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement(\"title\", null, t('StartExploringPage.title'))), /*#__PURE__*/React.createElement(\"div\", {\n className: \"flex-l\"\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"flex-auto-l mr3-l\"\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"pl3 pl0-l pt4 pt2-l\"\n }, /*#__PURE__*/React.createElement(\"h1\", {\n className: \"f3 f2-l ma0 fw4 montserrat charcoal\"\n }, t('StartExploringPage.header')), /*#__PURE__*/React.createElement(\"p\", {\n className: \"lh-copy f5 avenir charcoal-muted\"\n }, t('StartExploringPage.leadParagraph'))), embed ? /*#__PURE__*/React.createElement(IpldExploreForm, null) : null, /*#__PURE__*/React.createElement(\"ul\", {\n className: \"list pl0 ma0 mt4 mt0-l bt bn-l b--black-10\"\n }, /*#__PURE__*/React.createElement(\"li\", null, /*#__PURE__*/React.createElement(ExploreSuggestion, {\n name: \"Project Apollo Archives\",\n cid: \"QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D\",\n type: \"dag-pb\"\n })), /*#__PURE__*/React.createElement(\"li\", null, /*#__PURE__*/React.createElement(ExploreSuggestion, {\n name: \"IGIS Git Repo\",\n cid: \"baf4bcfg4ep767tjp5lxyanx5urpjjgx5q2volvy\",\n type: \"git-raw\"\n })), /*#__PURE__*/React.createElement(\"li\", null, /*#__PURE__*/React.createElement(ExploreSuggestion, {\n name: \"An Ethereum Block\",\n cid: \"bagiacgzah24drzou2jlkixpblbgbg6nxfrasoklzttzoht5hixhxz3rlncyq\",\n type: \"eth-block\"\n })), /*#__PURE__*/React.createElement(\"li\", null, /*#__PURE__*/React.createElement(ExploreSuggestion, {\n name: \"XKCD Archives\",\n cid: \"QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm\",\n type: \"dag-pb\"\n })))), /*#__PURE__*/React.createElement(\"div\", {\n className: \"pt2-l\"\n }, /*#__PURE__*/React.createElement(AboutIpld, null))), /*#__PURE__*/React.createElement(ReactJoyride, {\n run: runTour,\n steps: projectsTour.getSteps({\n t: t\n }),\n styles: projectsTour.styles,\n callback: joyrideCallback,\n scrollToFirstStep: true\n }));\n};\n/* TODO: add dag-cbor and raw block examples\n
  • \n \n
  • \n
  • \n \n
  • \n*/\n\n\nexport default withTranslation('explore')(StartExploringPage);","import React from 'react';\nimport Loadable from '@loadable/component';\nimport ComponentLoader from './loader/ComponentLoader.js';\nvar LoadableExplorePage = Loadable(function () {\n return import('./ExplorePage');\n}, {\n fallback: /*#__PURE__*/React.createElement(ComponentLoader, null)\n});\nexport default LoadableExplorePage;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nimport normaliseDagNode from './normalise-dag-node';\nimport Cid from 'cids';\n/**\n * Walk an IPLD path to find all the nodes and path boundaries it traverses.\n *\n * Normalizes nodes into a common structure:\n *\n * ```js\n * { cid: String, type: 'dag-cbor' | 'dag-pb' | 'git-raw' | ..., data: *, links: [{cid, name}] }\n * ```\n *\n * Path boundaries capture the source and target cid where a path traverses a link:\n *\n * ```js\n * { linkPath: 'a/b', source: `zdpHash1` target: `zdpHash2`' }\n * ```\n *\n * Usage:\n * ```js\n * const res = resolveIpldPath(getIpfs, 'zdpuHash' '/favourites/0/a/css')\n * const {targetNode, canonicalPath, localPath, nodes, pathBoundaries} = res\n * ```\n * Where:\n * - `targetNode` is the normalised node that the path lands in.\n * - `canonicalPath` is the shortest cid + path that can be used to locate the targetNode\n * - `localPath` is the tail part of the path that is local to the targetNode. May be ''\n * - `nodes` is the array of nodes that the path traverses.\n * - `pathBoundaries` is the array of links that the path traverses.\n *\n * @param {function()} ipldGet fn that returns a promise of the ipld data for a (cid, path, options)\n * @param {string} sourceCid the root hash\n * @param {string} path everything after the hash\n * @param {Object[]} nodes accumulated node info\n * @param {Object[]} pathBoundaries accumulated path boundary info\n * @returns {{targetNode: Object, canonicalPath: String, localPath: String, nodes: Object[], pathBoundaries: Object[]}} resolved path info\n */\n\nexport default function resolveIpldPath(_x, _x2, _x3) {\n return _resolveIpldPath.apply(this, arguments);\n}\n\nfunction _resolveIpldPath() {\n _resolveIpldPath = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ipld, sourceCid, path) {\n var nodes,\n pathBoundaries,\n _yield$ipldGetNodeAnd,\n value,\n remainderPath,\n sourceCidStr,\n node,\n linkPath,\n link,\n canonicalPath,\n targetNode,\n _args = arguments;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n nodes = _args.length > 3 && _args[3] !== undefined ? _args[3] : [];\n pathBoundaries = _args.length > 4 && _args[4] !== undefined ? _args[4] : [];\n _context.next = 4;\n return ipldGetNodeAndRemainder(ipld, sourceCid, path);\n\n case 4:\n _yield$ipldGetNodeAnd = _context.sent;\n value = _yield$ipldGetNodeAnd.value;\n remainderPath = _yield$ipldGetNodeAnd.remainderPath;\n sourceCidStr = sourceCid.toString();\n node = normaliseDagNode(value, sourceCidStr);\n nodes.push(node);\n linkPath = findLinkPath(path, remainderPath);\n link = findLink(node, linkPath);\n\n if (!link) {\n _context.next = 15;\n break;\n }\n\n pathBoundaries.push(link); // Go again, using the link.target as the sourceCid, and the remainderPath as the path.\n\n return _context.abrupt(\"return\", resolveIpldPath(ipld, new Cid(link.target), remainderPath, nodes, pathBoundaries));\n\n case 15:\n // we made it to the containing node. Hand back the info\n canonicalPath = path ? \"\".concat(sourceCidStr).concat(path) : sourceCidStr;\n targetNode = node;\n return _context.abrupt(\"return\", {\n targetNode: targetNode,\n canonicalPath: canonicalPath,\n localPath: path,\n nodes: nodes,\n pathBoundaries: pathBoundaries\n });\n\n case 18:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _resolveIpldPath.apply(this, arguments);\n}\n\nexport function ipldGetNodeAndRemainder(_x4, _x5, _x6) {\n return _ipldGetNodeAndRemainder.apply(this, arguments);\n}\n/**\n * Find the link object that matches linkPath\n *\n * @param {Object} node a `normalisedDagNode`\n * @param {Object} linkPath an IPLD path string\n * @returns {Object} the link object for `linkPath`\n */\n\nfunction _ipldGetNodeAndRemainder() {\n _ipldGetNodeAndRemainder = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ipld, sourceCid, path) {\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return ipld.get(sourceCid);\n\n case 2:\n _context2.t0 = _context2.sent;\n _context2.next = 5;\n return ipld.resolve(sourceCid, path || '/').first();\n\n case 5:\n _context2.t1 = _context2.sent.remainderPath;\n return _context2.abrupt(\"return\", {\n value: _context2.t0,\n remainderPath: _context2.t1\n });\n\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _ipldGetNodeAndRemainder.apply(this, arguments);\n}\n\nexport function findLink(node, linkPath) {\n if (!linkPath) return null;\n if (!node) return null;\n var links = node.links;\n var link = links.find(function (link) {\n return link.path === linkPath;\n });\n return link;\n}\nexport function findLinkPath(fullPath, remainderPath) {\n if (!fullPath || fullPath === '/') return null;\n if (!remainderPath) return trimSlashes(fullPath);\n\n if (!fullPath.endsWith(remainderPath)) {\n throw new Error('Requested IPLD path should end with the remainder path', {\n fullPath: fullPath,\n remainderPath: remainderPath\n });\n } // Remove remainder path from end of full path to get link path\n\n\n var linkPath = fullPath.substring(0, fullPath.length - remainderPath.length);\n return trimSlashes(linkPath);\n}\nexport function trimSlashes(str) {\n if (str.startsWith('/')) {\n str = str.substring(1);\n }\n\n if (str.endsWith('/')) {\n str = str.substring(0, str.length - 1);\n }\n\n return str;\n}","/*\n Capture groups 1\n 1: ipns | ipfs | ipld\n 2: CID | fqdn\n 3: /rest\n*/\nexport var pathRegEx = /(\\/(ipns|ipfs|ipld)\\/)?([^/]+)(\\/.*)?/;\nexport default function parseIpldPath(str) {\n var res = pathRegEx.exec(str);\n if (!res) return null;\n return {\n namespace: res[2],\n // 'ipfs'\n cidOrFqdn: res[3],\n // 'QmHash'\n rest: res[4],\n // /foo/bar\n address: res[0] // /ipfs/QmHash/foo/bar\n\n };\n}","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nimport Cid from 'cids';\nimport { createAsyncResourceBundle, createSelector } from 'redux-bundler';\nimport resolveIpldPath from '../lib/resolve-ipld-path';\nimport parseIpldPath from '../lib/parse-ipld-path'; // Find all the nodes and path boundaries traversed along a given path\n\nvar makeBundle = function makeBundle() {\n // Lazy load ipld because it is a large dependency\n var IpldResolver = null;\n var ipldFormats = null;\n var bundle = createAsyncResourceBundle({\n name: 'explore',\n actionBaseType: 'EXPLORE',\n getPromise: function () {\n var _getPromise = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {\n var store, getIpfs, path, pathParts, cidOrFqdn, rest, _yield$getIpld, _ipld, formats, ipld, cid, _yield$resolveIpldPat, targetNode, canonicalPath, localPath, nodes, pathBoundaries;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n store = args.store, getIpfs = args.getIpfs;\n path = store.selectExplorePathFromHash();\n\n if (path) {\n _context.next = 4;\n break;\n }\n\n return _context.abrupt(\"return\", null);\n\n case 4:\n pathParts = parseIpldPath(path);\n\n if (pathParts) {\n _context.next = 7;\n break;\n }\n\n return _context.abrupt(\"return\", null);\n\n case 7:\n cidOrFqdn = pathParts.cidOrFqdn, rest = pathParts.rest;\n _context.prev = 8;\n\n if (IpldResolver) {\n _context.next = 17;\n break;\n }\n\n _context.next = 12;\n return getIpld();\n\n case 12:\n _yield$getIpld = _context.sent;\n _ipld = _yield$getIpld.ipld;\n formats = _yield$getIpld.formats;\n IpldResolver = _ipld;\n ipldFormats = formats;\n\n case 17:\n ipld = makeIpld(IpldResolver, ipldFormats, getIpfs); // TODO: handle ipns, which would give us a fqdn in the cid position.\n\n cid = new Cid(cidOrFqdn);\n _context.next = 21;\n return resolveIpldPath(ipld, cid, rest);\n\n case 21:\n _yield$resolveIpldPat = _context.sent;\n targetNode = _yield$resolveIpldPat.targetNode;\n canonicalPath = _yield$resolveIpldPat.canonicalPath;\n localPath = _yield$resolveIpldPat.localPath;\n nodes = _yield$resolveIpldPat.nodes;\n pathBoundaries = _yield$resolveIpldPat.pathBoundaries;\n return _context.abrupt(\"return\", {\n path: path,\n targetNode: targetNode,\n canonicalPath: canonicalPath,\n localPath: localPath,\n nodes: nodes,\n pathBoundaries: pathBoundaries\n });\n\n case 30:\n _context.prev = 30;\n _context.t0 = _context[\"catch\"](8);\n console.warn('Failed to resolve path', path, _context.t0);\n return _context.abrupt(\"return\", {\n path: path,\n error: _context.t0.toString()\n });\n\n case 34:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[8, 30]]);\n }));\n\n function getPromise(_x) {\n return _getPromise.apply(this, arguments);\n }\n\n return getPromise;\n }(),\n staleAfter: Infinity,\n checkIfOnline: false\n });\n bundle.selectExplorePathFromHash = createSelector('selectRouteInfo', function (routeInfo) {\n if (!routeInfo.url.startsWith('/explore')) return;\n var path = routeInfo.url.slice('/explore'.length);\n return decodeURIComponent(path);\n }); // Fetch the explore data when the address in the url hash changes.\n\n bundle.reactExploreFetch = createSelector('selectIpfsReady', 'selectExploreIsLoading', 'selectExploreIsWaitingToRetry', 'selectExplorePathFromHash', 'selectExplore', function (ipfsReady, isLoading, isWaitingToRetry, explorePathFromHash, obj) {\n // Wait for ipfs or the pending request to complete\n if (!ipfsReady || isLoading || isWaitingToRetry) return false; // Theres no url path and no data so nothing to do.\n\n if (!explorePathFromHash && !obj) return false; // We already have the data for the path.\n\n if (obj && explorePathFromHash === obj.path) return false;\n return {\n actionCreator: 'doFetchExplore'\n };\n }); // Unpack append a dag link target to the current path and update the url hash\n\n bundle.doExploreLink = function (link) {\n return function (_ref) {\n var store = _ref.store;\n\n var _store$selectExplore = store.selectExplore(),\n nodes = _store$selectExplore.nodes,\n pathBoundaries = _store$selectExplore.pathBoundaries;\n\n var cid = nodes[0].cid;\n var pathParts = pathBoundaries.map(function (p) {\n return p.path;\n }); // add the extra path step from the link to the end\n\n if (link && link.path) {\n pathParts.push(link.path);\n } // add the root cid to the start\n\n\n pathParts.unshift(cid);\n var path = pathParts.join('/');\n var hash = \"#/explore/\".concat(path);\n store.doUpdateHash(hash);\n };\n }; // validate user submitted path and put it in url hash fragment\n\n\n bundle.doExploreUserProvidedPath = function (path) {\n return function (_ref2) {\n var store = _ref2.store;\n var hash = path ? \"#/explore\".concat(ensureLeadingSlash(path)) : '#/explore';\n store.doUpdateHash(hash);\n };\n };\n\n return bundle;\n};\n\nfunction ensureLeadingSlash(str) {\n if (str.startsWith('/')) return str;\n return \"/\".concat(str);\n}\n\nfunction makeIpld(IpldResolver, ipldFormats, getIpfs) {\n return new IpldResolver({\n blockService: getIpfs().block,\n formats: ipldFormats\n });\n}\n\nfunction getIpld() {\n return _getIpld.apply(this, arguments);\n}\n\nfunction _getIpld() {\n _getIpld = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {\n var ipldDeps, _ipldDeps$map, _ipldDeps$map2, ipld, formats, ipldEthereum;\n\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Promise.all([import(\n /* webpackChunkName: \"ipld\" */\n 'ipld'), import(\n /* webpackChunkName: \"ipld\" */\n 'ipld-dag-cbor'), import(\n /* webpackChunkName: \"ipld\" */\n 'ipld-dag-pb'), import(\n /* webpackChunkName: \"ipld\" */\n 'ipld-git'), import(\n /* webpackChunkName: \"ipld\" */\n 'ipld-raw'), import(\n /* webpackChunkName: \"ipld\" */\n 'ipld-ethereum')]);\n\n case 2:\n ipldDeps = _context2.sent;\n // CommonJs exports object is .default when imported ESM style\n _ipldDeps$map = ipldDeps.map(function (mod) {\n return mod[\"default\"];\n }), _ipldDeps$map2 = _toArray(_ipldDeps$map), ipld = _ipldDeps$map2[0], formats = _ipldDeps$map2.slice(1); // ipldEthereum is an Object, each key points to a ipld format impl\n\n ipldEthereum = formats.pop();\n formats.push.apply(formats, _toConsumableArray(Object.values(ipldEthereum)));\n return _context2.abrupt(\"return\", {\n ipld: ipld,\n formats: formats\n });\n\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _getIpld.apply(this, arguments);\n}\n\nexport default makeBundle;","import CID from 'cids';\nimport multihash from 'multihashes';\nimport multibase from 'multibase';\nimport { getCodeFromName } from 'multicodec';\nexport function decodeCid(value) {\n var cid = new CID(value).toJSON();\n\n if (cid.version === 0) {\n return decodeCidV0(value, cid);\n }\n\n if (cid.version === 1) {\n return decodeCidV1(value, cid);\n }\n\n throw new Error('Unknown CID version', cid.version, cid);\n} // cidv0 ::= \n// QmRds34t1KFiatDY6yJFj8U9VPTLvSMsR63y7qdUV3RMmT\n\nexport function decodeCidV0(value, cid) {\n return {\n cid: cid,\n multibase: {\n name: 'base58btc',\n code: 'implicit'\n },\n multicodec: {\n name: cid.codec,\n code: 'implicit'\n },\n multihash: multihash.decode(cid.hash)\n };\n} // ::= \n// zb2rhiVd5G2DSpnbYtty8NhYHeDvNkPxjSqA7YbDPuhdihj9L\n\nexport function decodeCidV1(value, cid) {\n return {\n cid: cid,\n multibase: multibase.codes[value.substring(0, 1)],\n multicodec: {\n name: cid.codec,\n code: '0x' + getCodeFromName(cid.codec)\n },\n multihash: multihash.decode(cid.hash)\n };\n}","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React from 'react';\nimport { decodeCid } from './decode-cid';\nimport { withTranslation } from 'react-i18next';\n\nfunction extractInfo(cid) {\n var cidInfo = decodeCid(cid);\n var hashFn = cidInfo.multihash.name;\n var hashFnCode = cidInfo.multihash.code.toString('16');\n var hashLengthCode = cidInfo.multihash.length.toString('16');\n var hashLengthInBits = cidInfo.multihash.length * 8;\n var hashValue = toHex(cidInfo.multihash.digest);\n var hashValueIn32CharChunks = hashValue.split('').reduce(function (resultArray, item, index) {\n var chunkIndex = Math.floor(index / 32);\n\n if (!resultArray[chunkIndex]) {\n resultArray[chunkIndex] = []; // start a new chunk\n }\n\n resultArray[chunkIndex].push(item);\n return resultArray;\n }, []);\n var humanReadable = \"\".concat(cidInfo.multibase.name, \" - cidv\").concat(cidInfo.cid.version, \" - \").concat(cidInfo.cid.codec, \" - \").concat(hashFn, \"~\").concat(hashLengthInBits, \"~\").concat(hashValue, \")\");\n return {\n hashFn: hashFn,\n hashFnCode: hashFnCode,\n hashLengthCode: hashLengthCode,\n hashLengthInBits: hashLengthInBits,\n hashValue: hashValue,\n hashValueIn32CharChunks: hashValueIn32CharChunks,\n humanReadable: humanReadable\n };\n}\n\nvar toHex = function toHex(bytes) {\n return Array.prototype.map.call(bytes, function (x) {\n return x.toString(16).padStart(2, '0');\n }).join('').toUpperCase();\n};\n\nexport var CidInfo = function CidInfo(_ref) {\n var t = _ref.t,\n tReady = _ref.tReady,\n cid = _ref.cid,\n className = _ref.className,\n props = _objectWithoutProperties(_ref, [\"t\", \"tReady\", \"cid\", \"className\"]);\n\n var cidErr = null;\n var cidInfo = null;\n\n try {\n cidInfo = cid ? extractInfo(cid) : null;\n } catch (err) {\n cidErr = err;\n }\n\n return !cid ? null : /*#__PURE__*/React.createElement(\"section\", _extends({\n className: \"ph3 pv4 sans-serif \".concat(className)\n }, props), /*#__PURE__*/React.createElement(\"label\", {\n className: \"db pb2\"\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: \"tracked ttu f5 fw2 teal-muted hover-aqua link\",\n href: \"https://docs.ipfs.io/guides/concepts/cid/\"\n }, t('CidInfo.header'))), !cidInfo ? null : /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"f7 monospace fw4 ma0 pb2 truncate gray\"\n }, cid), /*#__PURE__*/React.createElement(\"div\", {\n className: \"f6 sans-serif fw4 ma0 pb2 truncate\",\n id: \"CidInfo-human-readable-cid\"\n }, cidInfo.humanReadable), /*#__PURE__*/React.createElement(\"label\", {\n htmlFor: \"CidInfo-human-readable-cid\",\n className: \"db fw2 ma0 gray ttu f7 tracked\"\n }, t('base'), \" - \", t('version'), \" - \", t('codec'), \" - \", t('multihash')), /*#__PURE__*/React.createElement(\"a\", {\n href: \"https://github.com/multiformats/multihash#visual-examples\",\n className: \"dib tracked ttu f6 fw2 teal-muted hover-aqua link mt4\"\n }, t('multihash')), /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"dib monospace f6 pt2 tr dark-gray lh-title ph2\"\n }, /*#__PURE__*/React.createElement(\"code\", {\n className: \"gray\"\n }, \"0x\"), /*#__PURE__*/React.createElement(\"span\", {\n className: \"orange\"\n }, cidInfo.hashFnCode), /*#__PURE__*/React.createElement(\"span\", {\n className: \"green\"\n }, cidInfo.hashLengthCode), /*#__PURE__*/React.createElement(\"span\", {\n id: \"CidInfo-multihash\"\n }, cidInfo.hashValueIn32CharChunks.map(function (chunk) {\n return /*#__PURE__*/React.createElement(\"span\", {\n key: chunk.join('')\n }, chunk.join(''), /*#__PURE__*/React.createElement(\"br\", null));\n })), /*#__PURE__*/React.createElement(\"label\", {\n htmlFor: \"CidInfo-multihash\",\n className: \"sans-serif fw2 ma0 gray ttu f7 tracked\"\n }, t('CidInfo.hashDigest')), /*#__PURE__*/React.createElement(\"div\", {\n className: \"tl lh-copy\"\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: \"db link orange pt2\",\n href: \"https://github.com/multiformats/multicodec/blob/master/table.csv\"\n }, /*#__PURE__*/React.createElement(\"code\", {\n className: \"gray\"\n }, \"0x\"), /*#__PURE__*/React.createElement(\"code\", null, cidInfo.hashFnCode), \" = \", cidInfo.hashFn), /*#__PURE__*/React.createElement(\"div\", {\n id: \"CidInfo-multihash\",\n className: \"green\"\n }, /*#__PURE__*/React.createElement(\"code\", {\n className: \"gray\"\n }, \"0x\"), /*#__PURE__*/React.createElement(\"code\", null, cidInfo.hashLengthCode), \" = \", cidInfo.hashLengthInBits, \" bits\"))))), !cidErr ? null : /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"f5 sans-serif fw5 ma0 pv2 truncate navy\"\n }, cid), /*#__PURE__*/React.createElement(\"div\", {\n className: \"red fw2 ma0 f7\"\n }, cidErr.message)));\n};\nexport default withTranslation('explore')(CidInfo);","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nexports.names = Object.freeze(constants.names)\nexports.codes = Object.freeze(constants.codes)\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","/**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n'use strict'\n\nconst constants = require('./constants')\nconst { encodeText, decodeText, concat } = require('./util')\n\n/** @typedef {import('./base')} Base */\n/** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n/** @typedef {import(\"./types\").BaseCode} BaseCode */\n/** @typedef {import(\"./types\").BaseName} BaseName */\n\n/**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode)\n validEncode(name, buf)\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n}\n\n/**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode)\n const data = encodeText(enc.encode(buf))\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n}\n\n/**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\nfunction decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n const prefix = data[0]\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase()\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.decode(data.substring(1))\n}\n\n/**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\nfunction isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]))\n return enc.name\n } catch (err) {\n return false\n }\n}\n\n/**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction validEncode (name, buf) {\n const enc = encoding(name)\n enc.decode(decodeText(buf))\n}\n\n/**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encoding (nameOrCode) {\n if (constants.names[/** @type {BaseName} */(nameOrCode)]) {\n return constants.names[/** @type {BaseName} */(nameOrCode)]\n } else if (constants.codes[/** @type {BaseCode} */(nameOrCode)]) {\n return constants.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n}\n\n/**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\nfunction encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data)\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n}\n\nexports = module.exports = multibase\nexports.encode = encode\nexports.decode = decode\nexports.isEncoded = isEncoded\nexports.encoding = encoding\nexports.encodingFromData = encodingFromData\nexports.names = Object.freeze(constants.names)\nexports.codes = Object.freeze(constants.codes)\n","'use strict'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array>} arrays\n * @param {number} [length]\n */\nfunction concat (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = new Uint8Array(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return output\n}\n\nmodule.exports = concat\n","'use strict'\n\nconst mh = require('multihashes')\nconst multibase = require('multibase')\nconst multicodec = require('multicodec')\nconst { baseTable: codecs } = require('multicodec/src/base-table.js')\nconst CIDUtil = require('./cid-util')\nconst uint8ArrayConcat = require('uint8arrays/concat')\nconst uint8ArrayToString = require('uint8arrays/to-string')\nconst uint8ArrayEquals = require('uint8arrays/equals')\n\nconst codecInts = /** @type {CodecName[]} */(Object.keys(codecs)).reduce((p, name) => {\n p[codecs[name]] = name\n return p\n}, /** @type {Record} */({}))\n\nconst symbol = Symbol.for('@ipld/js-cid/CID')\n\n/**\n * @typedef {Object} SerializedCID\n * @property {string} codec\n * @property {number} version\n * @property {Uint8Array} hash\n */\n/**\n * @typedef {0|1} CIDVersion\n * @typedef {import('multibase').BaseNameOrCode} BaseNameOrCode\n * @typedef {import('multicodec').CodecName} CodecName\n * @typedef {import('multicodec').CodecNumber} CodecNumber\n */\n\n/**\n * Class representing a CID ``\n * , as defined in [ipld/cid](https://github.com/multiformats/cid).\n *\n * @class CID\n */\nclass CID {\n /**\n * Create a new CID.\n *\n * The algorithm for argument input is roughly:\n * ```\n * if (cid)\n * -> create a copy\n * else if (str)\n * if (1st char is on multibase table) -> CID String\n * else -> bs58 encoded multihash\n * else if (Uint8Array)\n * if (1st byte is 0 or 1) -> CID\n * else -> multihash\n * else if (Number)\n * -> construct CID by parts\n * ```\n *\n * @param {CIDVersion | string | Uint8Array | CID} version\n * @param {string|number} [codec]\n * @param {Uint8Array} [multihash]\n * @param {string} [multibaseName]\n *\n * @example\n * new CID(, , , )\n * new CID()\n * new CID()\n * new CID()\n * new CID()\n * new CID()\n */\n constructor (version, codec, multihash, multibaseName) {\n // We have below three blank field accessors only because\n // otherwise TS will not pick them up if done after assignemnts\n\n /**\n * The version of the CID.\n *\n * @type {CIDVersion}\n */\n // eslint-disable-next-line no-unused-expressions\n this.version\n\n /**\n * The codec of the CID.\n *\n * @deprecated\n * @type {CodecName}\n */\n // eslint-disable-next-line no-unused-expressions\n this.codec\n\n /**\n * The multihash of the CID.\n *\n * @type {Uint8Array}\n */\n // eslint-disable-next-line no-unused-expressions\n this.multihash\n\n Object.defineProperty(this, symbol, { value: true })\n if (CID.isCID(version)) {\n // version is an exising CID instance\n const cid = /** @type {CID} */(version)\n this.version = cid.version\n this.codec = cid.codec\n this.multihash = cid.multihash\n // Default guard for when a CID < 0.7 is passed with no multibaseName\n // @ts-ignore\n this.multibaseName = cid.multibaseName || (cid.version === 0 ? 'base58btc' : 'base32')\n return\n }\n\n if (typeof version === 'string') {\n // e.g. 'base32' or false\n const baseName = multibase.isEncoded(version)\n if (baseName) {\n // version is a CID String encoded with multibase, so v1\n const cid = multibase.decode(version)\n this.version = /** @type {CIDVersion} */(parseInt(cid[0].toString(), 16))\n this.codec = multicodec.getCodec(cid.slice(1))\n this.multihash = multicodec.rmPrefix(cid.slice(1))\n this.multibaseName = baseName\n } else {\n // version is a base58btc string multihash, so v0\n this.version = 0\n this.codec = 'dag-pb'\n this.multihash = mh.fromB58String(version)\n this.multibaseName = 'base58btc'\n }\n CID.validateCID(this)\n Object.defineProperty(this, 'string', { value: version })\n return\n }\n\n if (version instanceof Uint8Array) {\n const v = parseInt(version[0].toString(), 16)\n if (v === 1) {\n // version is a CID Uint8Array\n const cid = version\n this.version = v\n this.codec = multicodec.getCodec(cid.slice(1))\n this.multihash = multicodec.rmPrefix(cid.slice(1))\n this.multibaseName = 'base32'\n } else {\n // version is a raw multihash Uint8Array, so v0\n this.version = 0\n this.codec = 'dag-pb'\n this.multihash = version\n this.multibaseName = 'base58btc'\n }\n CID.validateCID(this)\n return\n }\n\n // otherwise, assemble the CID from the parameters\n\n this.version = version\n\n if (typeof codec === 'number') {\n // @ts-ignore\n codec = codecInts[codec]\n }\n\n this.codec = /** @type {CodecName} */ (codec)\n\n this.multihash = /** @type {Uint8Array} */ (multihash)\n\n /**\n * Multibase name as string.\n *\n * @deprecated\n * @type {string}\n */\n this.multibaseName = multibaseName || (version === 0 ? 'base58btc' : 'base32')\n\n CID.validateCID(this)\n }\n\n /**\n * The CID as a `Uint8Array`\n *\n * @returns {Uint8Array}\n *\n */\n get bytes () {\n // @ts-ignore\n let bytes = this._bytes\n\n if (!bytes) {\n if (this.version === 0) {\n bytes = this.multihash\n } else if (this.version === 1) {\n const codec = multicodec.getCodeVarint(this.codec)\n bytes = uint8ArrayConcat([\n [1], codec, this.multihash\n ], 1 + codec.byteLength + this.multihash.byteLength)\n } else {\n throw new Error('unsupported version')\n }\n\n // Cache this Uint8Array so it doesn't have to be recreated\n Object.defineProperty(this, '_bytes', { value: bytes })\n }\n\n return bytes\n }\n\n /**\n * The prefix of the CID.\n *\n * @returns {Uint8Array}\n */\n get prefix () {\n const codec = multicodec.getCodeVarint(this.codec)\n const multihash = mh.prefix(this.multihash)\n const prefix = uint8ArrayConcat([\n [this.version], codec, multihash\n ], 1 + codec.byteLength + multihash.byteLength)\n\n return prefix\n }\n\n /**\n * The codec of the CID in its number form.\n *\n * @returns {CodecNumber}\n */\n get code () {\n return codecs[this.codec]\n }\n\n /**\n * Convert to a CID of version `0`.\n *\n * @returns {CID}\n */\n toV0 () {\n if (this.codec !== 'dag-pb') {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0')\n }\n\n const { name, length } = mh.decode(this.multihash)\n\n if (name !== 'sha2-256') {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0')\n }\n\n if (length !== 32) {\n throw new Error('Cannot convert non 32 byte multihash CID to CIDv0')\n }\n\n return new CID(0, this.codec, this.multihash)\n }\n\n /**\n * Convert to a CID of version `1`.\n *\n * @returns {CID}\n */\n toV1 () {\n return new CID(1, this.codec, this.multihash)\n }\n\n /**\n * Encode the CID into a string.\n *\n * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use.\n * @returns {string}\n */\n toBaseEncodedString (base = this.multibaseName) {\n // @ts-ignore non enumerable cache property\n if (this.string && this.string.length !== 0 && base === this.multibaseName) {\n // @ts-ignore non enumerable cache property\n return this.string\n }\n let str\n if (this.version === 0) {\n if (base !== 'base58btc') {\n throw new Error('not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()')\n }\n str = mh.toB58String(this.multihash)\n } else if (this.version === 1) {\n str = uint8ArrayToString(multibase.encode(base, this.bytes))\n } else {\n throw new Error('unsupported version')\n }\n if (base === this.multibaseName) {\n // cache the string value\n Object.defineProperty(this, 'string', { value: str })\n }\n return str\n }\n\n /**\n * CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n)\n *\n * @returns {string}\n */\n [Symbol.for('nodejs.util.inspect.custom')] () {\n return 'CID(' + this.toString() + ')'\n }\n\n /**\n * Encode the CID