"function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;",
"/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// This method of obtaining a reference to the global object needs to be\n// kept identical to the way it is obtained in runtime.js\nvar g = (function() {\n return this || (typeof self === \"object\" && self);\n})() || Function(\"return this\")();\n\n// Use `getOwnPropertyNames` because not all browsers support calling\n// `hasOwnProperty` on the global `self` object in a worker. See #183.\nvar hadRuntime = g.regeneratorRuntime &&\n Object.getOwnPropertyNames(g).indexOf(\"regeneratorRuntime\") >= 0;\n\n// Save the old regeneratorRuntime in case it needs to be restored later.\nvar oldRuntime = hadRuntime && g.regeneratorRuntime;\n\n// Force reevalutation of runtime.js.\ng.regeneratorRuntime = undefined;\n\nmodule.exports = require(\"./runtime\");\n\nif (hadRuntime) {\n // Restore the original runtime.\n g.regeneratorRuntime = oldRuntime;\n} else {\n // Remove the global property added by runtime.js.\n try {\n delete g.regeneratorRuntime;\n } catch(e) {\n g.regeneratorRuntime = undefined;\n }\n}\n",
"/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n!(function(global) {\n\"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n var inModule = typeof module === \"object\";\n var runtime = global.regeneratorRuntime;\n if (runtime) {\n if (inModule) {\n // If regeneratorRuntime is defined globally and we're in a module,\n // make the exports object identical to regeneratorRuntime.\n module.exports = runtime;\n }\n // Don't bother evaluating the rest of this file if the runtime was\n // already defined globally.\n return;\n }\n\n // Define the runtime globally (as expected by generated code) as either\n // module.exports (if we're in a module) or a new, empty object.\n runtime = global.regeneratorRuntime = inModule ? module.exports : {};\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n runtime.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n runtime.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n runtime.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n runtime.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n runtime.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n runtime.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return runtime.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n if (delegate.iterator.return) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n\"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n runtime.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n runtime.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n\"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n})(\n // In sloppy mode, unbound `this` refers to the global object, fallback to\n // Function constructor if we're in global strict mode. That is sadly a form\n // of indirect eval which violates Content Security Policy.\n (function() {\n return this || (typeof self === \"object\" && self);\n })() || Function(\"return this\")()\n);\n",
"/**\n * Copyright (C) 2018-2020 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport 'waypoints/lib/jquery.waypoints';\n\nimport {swhSpinnerSrc} from 'utils/constants';\nimport {removeUrlFragment} from 'utils/functions';\n\nimport diffPanelTemplate from './diff-panel.ejs';\n\n// number of changed files in the revision\nlet changes = null;\nlet nbChangedFiles = 0;\n// to track the number of already computed files diffs\nlet nbDiffsComputed = 0;\n\n// the no newline at end of file marker from Github\nlet noNewLineMarker = '<span class=\"no-nl-marker\" title=\"No newline at end of file\">' +\n '<svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\">' +\n '<path fill-rule=\"evenodd\" d=\"M16 5v3c0 .55-.45 1-1 1h-3v2L9 8l3-3v2h2V5h2zM8 8c0 2.2-1.8 4-4 4s-4-1.8-4-4 1.8-4 4-4 4 1.8 4 4zM1.5 9.66L5.66 5.5C5.18 5.19 4.61 5 4 5 2.34 5 1 6.34 1 8c0 .61.19 1.17.5 1.66zM7 8c0-.61-.19-1.17-.5-1.66L2.34 10.5c.48.31 1.05.5 1.66.5 1.66 0 3-1.34 3-3z\"></path>' +\n '</svg>' +\n '</span>';\n\n// to track the total number of added lines in files diffs\nlet nbAdditions = 0;\n// to track the total number of deleted lines in files diffs\nlet nbDeletions = 0;\n// to track the already computed diffs by id\nlet computedDiffs = {};\n// map a diff id to its computation url\nlet diffsUrls = {};\n// to keep track of diff lines to highlight\nlet startLines = null;\nlet endLines = null;\n// map max line numbers characters to diff\nconst diffMaxNumberChars = {};\n// focused diff for highlighting\nlet focusedDiff = null;\n// highlighting color\nconst lineHighlightColor = '#fdf3da';\n// might contain diff lines to highlight parsed from URL fragment\nlet selectedDiffLinesInfo;\n// URL fragment to append when switching to 'Changes' tab\nconst changesUrlFragment = '#swh-revision-changes';\n// current displayed tab name\nlet currentTabName = 'Files';\n\n// to check if a DOM element is in the viewport\nfunction isInViewport(elt) {\n let elementTop = $(elt).offset().top;\n let elementBottom = elementTop + $(elt).outerHeight();\n\n let viewportTop = $(window).scrollTop();\n let viewportBottom = viewportTop + $(window).height();\n\n return elementBottom > viewportTop && elementTop < viewportBottom;\n}\n\n// to format the diffs line numbers\nexport function formatDiffLineNumbers(diffId, fromLine, toLine) {\n const maxNumberChars = diffMaxNumberChars[diffId];\n const fromLineStr = toLnStr(fromLine);\n const toLineStr = toLnStr(toLine);\n let ret = '';\n for (let i = 0; i < (maxNumberChars - fromLineStr.length); ++i) {\n ret += ' ';\n }\n ret += fromLineStr;\n ret += ' ';\n for (let i = 0; i < (maxNumberChars - toLineStr.length); ++i) {\n ret += ' ';\n }\n ret += toLineStr;\n return ret;\n}\n\nfunction parseDiffHunkRangeIfAny(lineText) {\n let baseFromLine, baseToLine;\n if (lineText.startsWith('@@')) {\n let linesInfoRegExp = new RegExp(/^@@ -(\\d+),(\\d+) \\+(\\d+),(\\d+) @@$/gm);\n let linesInfoRegExp2 = new RegExp(/^@@ -(\\d+) \\+(\\d+),(\\d+) @@$/gm);\n let linesInfoRegExp3 = new RegExp(/^@@ -(\\d+),(\\d+) \\+(\\d+) @@$/gm);\n let linesInfoRegExp4 = new RegExp(/^@@ -(\\d+) \\+(\\d+) @@$/gm);\n let linesInfo = linesInfoRegExp.exec(lineText);\n let linesInfo2 = linesInfoRegExp2.exec(lineText);\n let linesInfo3 = linesInfoRegExp3.exec(lineText);\n let linesInfo4 = linesInfoRegExp4.exec(lineText);\n if (linesInfo) {\n baseFromLine = parseInt(linesInfo[1]) - 1;\n baseToLine = parseInt(linesInfo[3]) - 1;\n } else if (linesInfo2) {\n baseFromLine = parseInt(linesInfo2[1]) - 1;\n baseToLine = parseInt(linesInfo2[2]) - 1;\n } else if (linesInfo3) {\n baseFromLine = parseInt(linesInfo3[1]) - 1;\n baseToLine = parseInt(linesInfo3[3]) - 1;\n } else if (linesInfo4) {\n baseFromLine = parseInt(linesInfo4[1]) - 1;\n baseToLine = parseInt(linesInfo4[2]) - 1;\n }\n }\n if (baseFromLine !== undefined) {\n return [baseFromLine, baseToLine];\n } else {\n return null;\n }\n}\n\nfunction toLnInt(lnStr) {\n return lnStr ? parseInt(lnStr) : 0;\n};\n\nfunction toLnStr(lnInt) {\n return lnInt ? lnInt.toString() : '';\n};\n\n// parse diff line numbers to an int array [from, to]\nexport function parseDiffLineNumbers(lineNumbersStr, from, to) {\n let lines;\n if (!from && !to) {\n lines = lineNumbersStr.replace(/[ ]+/g, ' ').split(' ');\n if (lines.length > 2) {\n lines.shift();\n }\n lines = lines.map(x => toLnInt(x));\n } else {\n let lineNumber = toLnInt(lineNumbersStr.trim());\n if (from) {\n lines = [lineNumber, 0];\n } else if (to) {\n lines = [0, lineNumber];\n }\n }\n return lines;\n}\n\n// serialize selected line numbers range to string for URL fragment\nexport function selectedDiffLinesToFragment(startLines, endLines, unified) {\n let selectedLinesFragment = '';\n selectedLinesFragment += `F${startLines[0] || 0}`;\n selectedLinesFragment += `T${startLines[1] || 0}`;\n selectedLinesFragment += `-F${endLines[0] || 0}`;\n selectedLinesFragment += `T${endLines[1] || 0}`;\n if (unified) {\n selectedLinesFragment += '-unified';\n } else {\n selectedLinesFragment += '-split';\n }\n return selectedLinesFragment;\n}\n\n// parse selected lines from URL fragment\nexport function fragmentToSelectedDiffLines(fragment) {\n const RE_LINES = /F([0-9]+)T([0-9]+)-F([0-9]+)T([0-9]+)-([a-z]+)/;\n const matchObj = RE_LINES.exec(fragment);\n if (matchObj.length === 6) {\n return {\n startLines: [parseInt(matchObj[1]), parseInt(matchObj[2])],\n endLines: [parseInt(matchObj[3]), parseInt(matchObj[4])],\n unified: matchObj[5] === 'unified'\n };\n } else {\n return null;\n }\n}\n\n// function to highlight a single diff line\nfunction highlightDiffLine(diffId, i) {\n let line = $(`#${diffId} .hljs-ln-line[data-line-number=\"${i}\"]`);\n let lineNumbers = $(`#${diffId} .hljs-ln-numbers[data-line-number=\"${i}\"]`);\n lineNumbers.css('color', 'black');\n lineNumbers.css('font-weight', 'bold');\n line.css('background-color', lineHighlightColor);\n line.css('mix-blend-mode', 'multiply');\n return line;\n}\n\n// function to reset highlighting\nfunction resetHighlightedDiffLines(resetVars = true) {\n if (resetVars) {\n focusedDiff = null;\n startLines = null;\n endLines = null;\n }\n $('.hljs-ln-line[data-line-number]').css('background-color', 'initial');\n $('.hljs-ln-line[data-line-number]').css('mix-blend-mode', 'initial');\n $('.hljs-ln-numbers[data-line-number]').css('color', '#aaa');\n $('.hljs-ln-numbers[data-line-number]').css('font-weight', 'initial');\n if (currentTabName === 'Changes' && window.location.hash !== changesUrlFragment) {\n window.history.replaceState('', document.title,\n window.location.pathname + window.location.search + changesUrlFragment);\n }\n}\n\n// highlight lines in a diff, return first highlighted line numbers element\nfunction highlightDiffLines(diffId, startLines, endLines, unified) {\n let firstHighlightedLine;\n // unified diff case\n if (unified) {\n let start = formatDiffLineNumbers(diffId, startLines[0], startLines[1]);\n let end = formatDiffLineNumbers(diffId, endLines[0], endLines[1]);\n\n const startLine = $(`#${diffId} .hljs-ln-line[data-line-number=\"${start}\"]`);\n const endLine = $(`#${diffId} .hljs-ln-line[data-line-number=\"${end}\"]`);\n if ($(endLine).position().top < $(startLine).position().top) {\n [start, end] = [end, start];\n firstHighlightedLine = endLine;\n } else {\n firstHighlightedLine = startLine;\n }\n const lineTd = highlightDiffLine(diffId, start);\n let tr = $(lineTd).closest('tr');\n let lineNumbers = $(tr).children('.hljs-ln-line').data('line-number').toString();\n while (lineNumbers !== end) {\n if (lineNumbers.trim()) {\n highlightDiffLine(diffId, lineNumbers);\n }\n tr = $(tr).next();\n lineNumbers = $(tr).children('.hljs-ln-line').data('line-number').toString();\n }\n highlightDiffLine(diffId, end);\n\n // split diff case\n } else {\n // highlight only from part of the diff\n if (startLines[0] && endLines[0]) {\n const start = Math.min(startLines[0], endLines[0]);\n const end = Math.max(startLines[0], endLines[0]);\n for (let i = start; i <= end; ++i) {\n highlightDiffLine(`${diffId}-from`, i);\n }\n firstHighlightedLine = $(`#${diffId}-from .hljs-ln-line[data-line-number=\"${start}\"]`);\n // highlight only to part of the diff\n } else if (startLines[1] && endLines[1]) {\n const start = Math.min(startLines[1], endLines[1]);\n const end = Math.max(startLines[1], endLines[1]);\n for (let i = start; i <= end; ++i) {\n highlightDiffLine(`${diffId}-to`, i);\n }\n firstHighlightedLine = $(`#${diffId}-to .hljs-ln-line[data-line-number=\"${start}\"]`);\n // highlight both part of the diff\n } else {\n let left, right;\n if (startLines[0] && endLines[1]) {\n left = startLines[0];\n right = endLines[1];\n } else {\n left = endLines[0];\n right = startLines[1];\n }\n\n const leftLine = $(`#${diffId}-from .hljs-ln-line[data-line-number=\"${left}\"]`);\n const rightLine = $(`#${diffId}-to .hljs-ln-line[data-line-number=\"${right}\"]`);\n const leftLineAbove = $(leftLine).position().top < $(rightLine).position().top;\n\n if (leftLineAbove) {\n firstHighlightedLine = leftLine;\n } else {\n firstHighlightedLine = rightLine;\n }\n\n let fromTr = $(`#${diffId}-from tr`).first();\n let fromLn = $(fromTr).children('.hljs-ln-line').data('line-number');\n let toTr = $(`#${diffId}-to tr`).first();\n let toLn = $(toTr).children('.hljs-ln-line').data('line-number');\n let canHighlight = false;\n\n while (true) {\n if (leftLineAbove && fromLn === left) {\n canHighlight = true;\n } else if (!leftLineAbove && toLn === right) {\n canHighlight = true;\n }\n\n if (canHighlight && fromLn) {\n highlightDiffLine(`${diffId}-from`, fromLn);\n }\n\n if (canHighlight && toLn) {\n highlightDiffLine(`${diffId}-to`, toLn);\n }\n\n if ((leftLineAbove && toLn === right) || (!leftLineAbove && fromLn === left)) {\n break;\n }\n\n fromTr = $(fromTr).next();\n fromLn = $(fromTr).children('.hljs-ln-line').data('line-number');\n toTr = $(toTr).next();\n toLn = $(toTr).children('.hljs-ln-line').data('line-number');\n }\n\n }\n }\n\n let selectedLinesFragment = selectedDiffLinesToFragment(startLines, endLines, unified);\n window.location.hash = `diff_${diffId}+${selectedLinesFragment}`;\n return firstHighlightedLine;\n}\n\n// callback to switch from side-by-side diff to unified one\nexport function showUnifiedDiff(diffId) {\n $(`#${diffId}-split-diff`).css('display', 'none');\n $(`#${diffId}-unified-diff`).css('display', 'block');\n}\n\n// callback to switch from unified diff to side-by-side one\nexport function showSplitDiff(diffId) {\n $(`#${diffId}-unified-diff`).css('display', 'none');\n $(`#${diffId}-split-diff`).css('display', 'block');\n}\n\n// to compute diff and process it for display\nexport function computeDiff(diffUrl, diffId) {\n\n // force diff computation ?\n let force = diffUrl.indexOf('force=true') !== -1;\n\n // it no forced computation and diff already computed, do nothing\n if (!force && computedDiffs.hasOwnProperty(diffId)) {\n return;\n }\n\n function setLineNumbers(lnElt, lineNumbers) {\n $(lnElt).attr('data-line-number', lineNumbers || '');\n $(lnElt).children().attr('data-line-number', lineNumbers || '');\n $(lnElt).siblings().attr('data-line-number', lineNumbers || '');\n }\n\n // mark diff computation as already requested\n computedDiffs[diffId] = true;\n\n $(`#${diffId}-loading`).css('visibility', 'visible');\n\n // set spinner visible while requesting diff\n $(`#${diffId}-loading`).css('display', 'block');\n $(`#${diffId}-highlightjs`).css('display', 'none');\n\n // request diff computation and process it\n fetch(diffUrl)\n .then(response => response.json())\n .then(data => {\n // increment number of computed diffs\n ++nbDiffsComputed;\n // toggle the 'Compute all diffs' button if all diffs have been computed\n if (nbDiffsComputed === changes.length) {\n $('#swh-compute-all-diffs').addClass('active');\n }\n\n // Large diff (> threshold) are not automatically computed,\n // add a button to force its computation\n if (data.diff_str.indexOf('Large diff') === 0) {\n $(`#${diffId}`)[0].innerHTML = data.diff_str +\n `<br/><button class=\"btn btn-default btn-sm\" type=\"button\"\n onclick=\"swh.revision.computeDiff('${diffUrl}&force=true', '${diffId}')\">` +\n 'Request diff</button>';\n setDiffVisible(diffId);\n } else if (data.diff_str.indexOf('@@') !== 0) {\n $(`#${diffId}`).text(data.diff_str);\n setDiffVisible(diffId);\n } else {\n\n // prepare code highlighting\n $(`.${diffId}`).removeClass('nohighlight');\n $(`.${diffId}`).addClass(data.language);\n\n // set unified diff text\n $(`#${diffId}`).text(data.diff_str);\n\n // code highlighting for unified diff\n $(`#${diffId}`).each((i, elt) => {\n hljs.highlightElement(elt);\n hljs.lineNumbersElementSync(elt);\n });\n\n // process unified diff lines in order to generate side-by-side diffs text\n // but also compute line numbers for unified and side-by-side diffs\n let baseFromLine = '';\n let baseToLine = '';\n let fromToLines = [];\n let fromLines = [];\n let toLines = [];\n let maxNumberChars = 0;\n let diffFromStr = '';\n let diffToStr = '';\n let linesOffset = 0;\n\n $(`#${diffId} .hljs-ln-numbers`).each((i, lnElt) => {\n let lnText = lnElt.nextSibling.innerText;\n let linesInfo = parseDiffHunkRangeIfAny(lnText);\n let fromLine = '';\n let toLine = '';\n // parsed lines info from the diff output\n if (linesInfo) {\n baseFromLine = linesInfo[0];\n baseToLine = linesInfo[1];\n linesOffset = 0;\n diffFromStr += (lnText + '\\n');\n diffToStr += (lnText + '\\n');\n fromLines.push('');\n toLines.push('');\n // line removed in the from file\n } else if (lnText.length > 0 && lnText[0] === '-') {\n baseFromLine = baseFromLine + 1;\n fromLine = baseFromLine.toString();\n fromLines.push(fromLine);\n ++nbDeletions;\n diffFromStr += (lnText + '\\n');\n ++linesOffset;\n // line added in the to file\n } else if (lnText.length > 0 && lnText[0] === '+') {\n baseToLine = baseToLine + 1;\n toLine = baseToLine.toString();\n toLines.push(toLine);\n ++nbAdditions;\n diffToStr += (lnText + '\\n');\n --linesOffset;\n // line present in both files\n } else {\n baseFromLine = baseFromLine + 1;\n baseToLine = baseToLine + 1;\n fromLine = baseFromLine.toString();\n toLine = baseToLine.toString();\n for (let j = 0; j < Math.abs(linesOffset); ++j) {\n if (linesOffset > 0) {\n diffToStr += '\\n';\n toLines.push('');\n } else {\n diffFromStr += '\\n';\n fromLines.push('');\n }\n }\n linesOffset = 0;\n diffFromStr += (lnText + '\\n');\n diffToStr += (lnText + '\\n');\n toLines.push(toLine);\n fromLines.push(fromLine);\n }\n if (!baseFromLine) {\n fromLine = '';\n }\n if (!baseToLine) {\n toLine = '';\n }\n fromToLines[i] = [fromLine, toLine];\n maxNumberChars = Math.max(maxNumberChars, fromLine.length);\n maxNumberChars = Math.max(maxNumberChars, toLine.length);\n });\n\n diffMaxNumberChars[diffId] = maxNumberChars;\n\n // set side-by-side diffs text\n $(`#${diffId}-from`).text(diffFromStr);\n $(`#${diffId}-to`).text(diffToStr);\n\n // code highlighting for side-by-side diffs\n $(`#${diffId}-from, #${diffId}-to`).each((i, elt) => {\n hljs.highlightElement(elt);\n hljs.lineNumbersElementSync(elt);\n });\n\n // diff highlighting for added/removed lines on top of code highlighting\n $(`.${diffId} .hljs-ln-numbers`).each((i, lnElt) => {\n let lnText = lnElt.nextSibling.innerText;\n if (lnText.startsWith('@@')) {\n $(lnElt).parent().addClass('swh-diff-lines-info');\n let linesInfoText = $(lnElt).parent().find('.hljs-ln-code .hljs-ln-line').text();\n $(lnElt).parent().find('.hljs-ln-code .hljs-ln-line').children().remove();\n $(lnElt).parent().find('.hljs-ln-code .hljs-ln-line').text('');\n $(lnElt).parent().find('.hljs-ln-code .hljs-ln-line').append(`<span class=\"hljs-meta\">${linesInfoText}</span>`);\n } else if (lnText.length > 0 && lnText[0] === '-') {\n $(lnElt).parent().addClass('swh-diff-removed-line');\n } else if (lnText.length > 0 && lnText[0] === '+') {\n $(lnElt).parent().addClass('swh-diff-added-line');\n }\n });\n\n // set line numbers for unified diff\n $(`#${diffId} .hljs-ln-numbers`).each((i, lnElt) => {\n const lineNumbers = formatDiffLineNumbers(diffId, fromToLines[i][0], fromToLines[i][1]);\n setLineNumbers(lnElt, lineNumbers);\n });\n\n // set line numbers for the from side-by-side diff\n $(`#${diffId}-from .hljs-ln-numbers`).each((i, lnElt) => {\n setLineNumbers(lnElt, fromLines[i]);\n });\n\n // set line numbers for the to side-by-side diff\n $(`#${diffId}-to .hljs-ln-numbers`).each((i, lnElt) => {\n setLineNumbers(lnElt, toLines[i]);\n });\n\n // last processing:\n // - remove the '+' and '-' at the beginning of the diff lines\n // from code highlighting\n // - add the \"no new line at end of file marker\" if needed\n $(`.${diffId} .hljs-ln-code`).each((i, lnElt) => {\n if (lnElt.firstChild) {\n if (lnElt.firstChild.nodeName !== '#text') {\n let lineText = lnElt.firstChild.innerHTML;\n if (lineText[0] === '-' || lineText[0] === '+') {\n lnElt.firstChild.innerHTML = lineText.substr(1);\n let newTextNode = document.createTextNode(lineText[0]);\n $(lnElt).prepend(newTextNode);\n }\n }\n $(lnElt).contents().filter((i, elt) => {\n return elt.nodeType === 3; // Node.TEXT_NODE\n }).each((i, textNode) => {\n let swhNoNewLineMarker = '[swh-no-nl-marker]';\n if (textNode.textContent.indexOf(swhNoNewLineMarker) !== -1) {\n textNode.textContent = textNode.textContent.replace(swhNoNewLineMarker, '');\n $(lnElt).append($(noNewLineMarker));\n }\n });\n }\n });\n\n // hide the diff mode switch button in case of not generated diffs\n if (data.diff_str.indexOf('Diffs are not generated for non textual content') !== 0) {\n $(`#diff_${diffId} .diff-styles`).css('visibility', 'visible');\n }\n\n setDiffVisible(diffId);\n\n // highlight diff lines if provided in URL fragment\n if (selectedDiffLinesInfo &&\n selectedDiffLinesInfo.diffPanelId.indexOf(diffId) !== -1) {\n if (!selectedDiffLinesInfo.unified) {\n showSplitDiff(diffId);\n }\n const firstHighlightedLine = highlightDiffLines(\n diffId, selectedDiffLinesInfo.startLines,\n selectedDiffLinesInfo.endLines, selectedDiffLinesInfo.unified);\n\n $('html, body').animate(\n {\n scrollTop: firstHighlightedLine.offset().top - 50\n },\n {\n duration: 500\n }\n );\n }\n }\n });\n}\n\nfunction setDiffVisible(diffId) {\n // set the unified diff visible by default\n $(`#${diffId}-loading`).css('display', 'none');\n $(`#${diffId}-highlightjs`).css('display', 'block');\n\n // update displayed counters\n $('#swh-revision-lines-added').text(`${nbAdditions} additions`);\n $('#swh-revision-lines-deleted').text(`${nbDeletions} deletions`);\n $('#swh-nb-diffs-computed').text(nbDiffsComputed);\n\n // refresh the waypoints triggering diffs computation as\n // the DOM layout has been updated\n Waypoint.refreshAll();\n}\n\n// to compute all visible diffs in the viewport\nfunction computeVisibleDiffs() {\n $('.swh-file-diff-panel').each((i, elt) => {\n if (isInViewport(elt)) {\n let diffId = elt.id.replace('diff_', '');\n computeDiff(diffsUrls[diffId], diffId);\n }\n });\n}\n\nfunction genDiffPanel(diffData) {\n let diffPanelTitle = diffData.path;\n if (diffData.type === 'rename') {\n diffPanelTitle = `${diffData.from_path} → ${diffData.to_path}`;\n }\n return diffPanelTemplate({\n diffData: diffData,\n diffPanelTitle: diffPanelTitle,\n swhSpinnerSrc: swhSpinnerSrc\n });\n}\n\n// setup waypoints to request diffs computation on the fly while scrolling\nfunction setupWaypoints() {\n for (let i = 0; i < changes.length; ++i) {\n let diffData = changes[i];\n\n // create a waypoint that will trigger diff computation when\n // the top of the diff panel hits the bottom of the viewport\n $(`#diff_${diffData.id}`).waypoint({\n handler: function() {\n if (isInViewport(this.element)) {\n let diffId = this.element.id.replace('diff_', '');\n computeDiff(diffsUrls[diffId], diffId);\n this.destroy();\n }\n },\n offset: '100%'\n });\n\n // create a waypoint that will trigger diff computation when\n // the bottom of the diff panel hits the top of the viewport\n $(`#diff_${diffData.id}`).waypoint({\n handler: function() {\n if (isInViewport(this.element)) {\n let diffId = this.element.id.replace('diff_', '');\n computeDiff(diffsUrls[diffId], diffId);\n this.destroy();\n }\n },\n offset: function() {\n return -$(this.element).height();\n }\n });\n }\n Waypoint.refreshAll();\n}\n\nfunction scrollToDiffPanel(diffPanelId, setHash = true) {\n // disable waypoints while scrolling as we do not want to\n // launch computation of diffs the user is not interested in\n // (file changes list can be large)\n Waypoint.disableAll();\n\n $('html, body').animate(\n {\n scrollTop: $(diffPanelId).offset().top\n },\n {\n duration: 500,\n complete: () => {\n if (setHash) {\n window.location.hash = diffPanelId;\n }\n // enable waypoints back after scrolling\n Waypoint.enableAll();\n // compute diffs visible in the viewport\n computeVisibleDiffs();\n }\n });\n}\n\n// callback when the user clicks on the 'Compute all diffs' button\nexport function computeAllDiffs(event) {\n $(event.currentTarget).addClass('active');\n for (let diffId in diffsUrls) {\n if (diffsUrls.hasOwnProperty(diffId)) {\n computeDiff(diffsUrls[diffId], diffId);\n }\n }\n event.stopPropagation();\n}\n\nexport async function initRevisionDiff(revisionMessageBody, diffRevisionUrl) {\n\n await import(/* webpackChunkName: \"highlightjs\" */ 'utils/highlightjs');\n\n // callback when the 'Changes' tab is activated\n $(document).on('shown.bs.tab', 'a[data-toggle=\"tab\"]', e => {\n currentTabName = e.currentTarget.text.trim();\n if (currentTabName === 'Changes') {\n window.location.hash = changesUrlFragment;\n $('#readme-panel').css('display', 'none');\n\n if (changes) {\n return;\n }\n\n // request computation of revision file changes list\n // when navigating to the 'Changes' tab and add diff panels\n // to the DOM when receiving the result\n fetch(diffRevisionUrl)\n .then(response => response.json())\n .then(data => {\n changes = data.changes;\n nbChangedFiles = data.total_nb_changes;\n let changedFilesText = `${nbChangedFiles} changed file`;\n if (nbChangedFiles !== 1) {\n changedFilesText += 's';\n }\n $('#swh-revision-changed-files').text(changedFilesText);\n $('#swh-total-nb-diffs').text(changes.length);\n $('#swh-revision-changes-list pre')[0].innerHTML = data.changes_msg;\n\n $('#swh-revision-changes-loading').css('display', 'none');\n $('#swh-revision-changes-list pre').css('display', 'block');\n $('#swh-compute-all-diffs').css('visibility', 'visible');\n $('#swh-revision-changes-list').removeClass('in');\n\n if (nbChangedFiles > changes.length) {\n $('#swh-too-large-revision-diff').css('display', 'block');\n $('#swh-nb-loaded-diffs').text(changes.length);\n }\n\n for (let i = 0; i < changes.length; ++i) {\n let diffData = changes[i];\n diffsUrls[diffData.id] = diffData.diff_url;\n $('#swh-revision-diffs').append(genDiffPanel(diffData));\n }\n\n setupWaypoints();\n computeVisibleDiffs();\n\n if (selectedDiffLinesInfo) {\n scrollToDiffPanel(selectedDiffLinesInfo.diffPanelId, false);\n }\n\n });\n } else if (currentTabName === 'Files') {\n removeUrlFragment();\n $('#readme-panel').css('display', 'block');\n }\n });\n\n $(document).ready(() => {\n\n if (revisionMessageBody.length > 0) {\n $('#swh-revision-message').addClass('in');\n } else {\n $('#swh-collapse-revision-message').attr('data-toggle', '');\n }\n\n // callback when the user requests to scroll on a specific diff or back to top\n $('#swh-revision-changes-list a[href^=\"#\"], #back-to-top a[href^=\"#\"]').click(e => {\n let href = $.attr(e.currentTarget, 'href');\n scrollToDiffPanel(href);\n return false;\n });\n\n // click callback for highlighting diff lines\n $('body').click(evt => {\n\n if (currentTabName !== 'Changes') {\n return;\n }\n\n if (evt.target.classList.contains('hljs-ln-n')) {\n\n const diffId = $(evt.target).closest('code').prop('id');\n\n const from = diffId.indexOf('-from') !== -1;\n const to = diffId.indexOf('-to') !== -1;\n\n const lineNumbers = $(evt.target).data('line-number').toString();\n\n const currentDiff = diffId.replace('-from', '').replace('-to', '');\n if (!evt.shiftKey || currentDiff !== focusedDiff || !lineNumbers.trim()) {\n resetHighlightedDiffLines();\n focusedDiff = currentDiff;\n }\n if (currentDiff === focusedDiff && lineNumbers.trim()) {\n if (!evt.shiftKey) {\n startLines = parseDiffLineNumbers(lineNumbers, from, to);\n highlightDiffLines(currentDiff, startLines, startLines, !from && !to);\n } else if (startLines) {\n resetHighlightedDiffLines(false);\n endLines = parseDiffLineNumbers(lineNumbers, from, to);\n highlightDiffLines(currentDiff, startLines, endLines, !from && !to);\n }\n }\n\n } else {\n resetHighlightedDiffLines();\n }\n });\n\n // if an URL fragment for highlighting a diff is present\n // parse highlighting info and initiate diff loading\n const fragment = window.location.hash;\n if (fragment) {\n const split = fragment.split('+');\n if (split.length === 2) {\n selectedDiffLinesInfo = fragmentToSelectedDiffLines(split[1]);\n if (selectedDiffLinesInfo) {\n selectedDiffLinesInfo.diffPanelId = split[0];\n $(`.nav-tabs a[href=\"${changesUrlFragment}\"]`).tab('show');\n }\n }\n if (fragment === changesUrlFragment) {\n $(`.nav-tabs a[href=\"${changesUrlFragment}\"]`).tab('show');\n }\n }\n\n });\n\n}\n",
"/**\n * Copyright (C) 2019 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nexport function revsOrderingTypeClicked(event) {\n let urlParams = new URLSearchParams(window.location.search);\n let orderingType = $(event.target).val();\n if (orderingType) {\n urlParams.set('revs_ordering', $(event.target).val());\n } else if (urlParams.has('revs_ordering')) {\n urlParams.delete('revs_ordering');\n }\n window.location.search = urlParams.toString();\n}\n\nexport function initRevisionsLog() {\n $(document).ready(() => {\n let urlParams = new URLSearchParams(window.location.search);\n let revsOrderingType = urlParams.get('revs_ordering');\n if (revsOrderingType) {\n $(`:input[value=\"${revsOrderingType}\"]`).prop('checked', true);\n }\n });\n}\n",
"/**\n * Copyright (C) 2019 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\nimport {staticAsset} from 'utils/functions';\n\n// Constants defining Bootstrap Breakpoints\nexport const BREAKPOINT_SM = 768;\nexport const BREAKPOINT_MD = 992;\nexport const BREAKPOINT_LG = 1200;\n\nexport const swhSpinnerSrc = staticAsset('img/swh-spinner.gif');\n",
"/**\n * Copyright (C) 2018-2020 The Software Heritage developers\n * See the AUTHORS file at the top-level directory of this distribution\n * License: GNU Affero General Public License version 3, or any later version\n * See top-level LICENSE file for more information\n */\n\n// utility functions\n\nexport function handleFetchError(response) {\n if (!response.ok) {\n throw response;\n }\n return response;\n}\n\nexport function handleFetchErrors(responses) {\n for (let i = 0; i < responses.length; ++i) {\n if (!responses[i].ok) {\n throw responses[i];\n }\n }\n return responses;\n}\n\nexport function staticAsset(asset) {\n return `${__STATIC__}${asset}`;\n}\n\nexport function csrfPost(url, headers = {}, body = null) {\n headers['X-CSRFToken'] = Cookies.get('csrftoken');\n return fetch(url, {\n credentials: 'include',\n headers: headers,\n method: 'POST',\n body: body\n });\n}\n\nexport function isGitRepoUrl(url, pathPrefix = '/') {\n let allowedProtocols = ['http:', 'https:', 'git:'];\n if (allowedProtocols.find(protocol => protocol === url.protocol) === undefined) {\n return false;\n }\n if (!url.pathname.startsWith(pathPrefix)) {\n return false;\n }\n let re = new RegExp('[\\\\w\\\\.-]+\\\\/?(?!=.git)(?:\\\\.git\\\\/?)?$');\n return re.test(url.pathname.slice(pathPrefix.length));\n};\n\nexport function removeUrlFragment() {\n history.replaceState('', document.title, window.location.pathname + window.location.search);\n}\n\nexport function selectText(startNode, endNode) {\n let selection = window.getSelection();\n selection.removeAllRanges();\n let range = document.createRange();\n range.setStart(startNode, 0);\n if (endNode.nodeName !== '#text') {\n range.setEnd(endNode, endNode.childNodes.length);\n } else {\n range.setEnd(endNode, endNode.textContent.length);\n }\n selection.addRange(range);\n}\n\nexport function htmlAlert(type, message, closable = false) {\n let closeButton = '';\n let extraClasses = '';\n if (closable) {\n closeButton =\n `<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>`;\n extraClasses = 'alert-dismissible';\n }\n return `<div class=\"alert alert-${type} ${extraClasses}\" role=\"alert\">${message}${closeButton}</div>`;\n}\n",
"/*!\nWaypoints - 4.0.1\nCopyright \u00a9 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/imakewebthings/waypoints/blob/master/licenses.txt\n*/\n(function() {\n 'use strict'\n\n var keyCounter = 0\n var allWaypoints = {}\n\n /* http://imakewebthings.com/waypoints/api/waypoint */\n function Waypoint(options) {\n if (!options) {\n throw new Error('No options passed to Waypoint constructor')\n }\n if (!options.element) {\n throw new Error('No element option passed to Waypoint constructor')\n }\n if (!options.handler) {\n throw new Error('No handler option passed to Waypoint constructor')\n }\n\n this.key = 'waypoint-' + keyCounter\n this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)\n this.element = this.options.element\n this.adapter = new Waypoint.Adapter(this.element)\n this.callback = options.handler\n this.axis = this.options.horizontal ? 'horizontal' : 'vertical'\n this.enabled = this.options.enabled\n this.triggerPoint = null\n this.group = Waypoint.Group.findOrCreate({\n name: this.options.group,\n axis: this.axis\n })\n this.context = Waypoint.Context.findOrCreateByElement(this.options.context)\n\n if (Waypoint.offsetAliases[this.options.offset]) {\n this.options.offset = Waypoint.offsetAliases[this.options.offset]\n }\n this.group.add(this)\n this.context.add(this)\n allWaypoints[this.key] = this\n keyCounter += 1\n }\n\n /* Private */\n Waypoint.prototype.queueTrigger = function(direction) {\n this.group.queueTrigger(this, direction)\n }\n\n /* Private */\n Waypoint.prototype.trigger = function(args) {\n if (!this.enabled) {\n return\n }\n if (this.callback) {\n this.callback.apply(this, args)\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/destroy */\n Waypoint.prototype.destroy = function() {\n this.context.remove(this)\n this.group.remove(this)\n delete allWaypoints[this.key]\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/disable */\n Waypoint.prototype.disable = function() {\n this.enabled = false\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/enable */\n Waypoint.prototype.enable = function() {\n this.context.refresh()\n this.enabled = true\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/next */\n Waypoint.prototype.next = function() {\n return this.group.next(this)\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/previous */\n Waypoint.prototype.previous = function() {\n return this.group.previous(this)\n }\n\n /* Private */\n Waypoint.invokeAll = function(method) {\n var allWaypointsArray = []\n for (var waypointKey in allWaypoints) {\n allWaypointsArray.push(allWaypoints[waypointKey])\n }\n for (var i = 0, end = allWaypointsArray.length; i < end; i++) {\n allWaypointsArray[i][method]()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/destroy-all */\n Waypoint.destroyAll = function() {\n Waypoint.invokeAll('destroy')\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/disable-all */\n Waypoint.disableAll = function() {\n Waypoint.invokeAll('disable')\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/enable-all */\n Waypoint.enableAll = function() {\n Waypoint.Context.refreshAll()\n for (var waypointKey in allWaypoints) {\n allWaypoints[waypointKey].enabled = true\n }\n return this\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/refresh-all */\n Waypoint.refreshAll = function() {\n Waypoint.Context.refreshAll()\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/viewport-height */\n Waypoint.viewportHeight = function() {\n return window.innerHeight || document.documentElement.clientHeight\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/viewport-width */\n Waypoint.viewportWidth = function() {\n return document.documentElement.clientWidth\n }\n\n Waypoint.adapters = []\n\n Waypoint.defaults = {\n context: window,\n continuous: true,\n enabled: true,\n group: 'default',\n horizontal: false,\n offset: 0\n }\n\n Waypoint.offsetAliases = {\n 'bottom-in-view': function() {\n return this.context.innerHeight() - this.adapter.outerHeight()\n },\n 'right-in-view': function() {\n return this.context.innerWidth() - this.adapter.outerWidth()\n }\n }\n\n window.Waypoint = Waypoint\n}())\n;(function() {\n 'use strict'\n\n function requestAnimationFrameShim(callback) {\n window.setTimeout(callback, 1000 / 60)\n }\n\n var keyCounter = 0\n var contexts = {}\n var Waypoint = window.Waypoint\n var oldWindowLoad = window.onload\n\n /* http://imakewebthings.com/waypoints/api/context */\n function Context(element) {\n this.element = element\n this.Adapter = Waypoint.Adapter\n this.adapter = new this.Adapter(element)\n this.key = 'waypoint-context-' + keyCounter\n this.didScroll = false\n this.didResize = false\n this.oldScroll = {\n x: this.adapter.scrollLeft(),\n y: this.adapter.scrollTop()\n }\n this.waypoints = {\n vertical: {},\n horizontal: {}\n }\n\n element.waypointContextKey = this.key\n contexts[element.waypointContextKey] = this\n keyCounter += 1\n if (!Waypoint.windowContext) {\n Waypoint.windowContext = true\n Waypoint.windowContext = new Context(window)\n }\n\n this.createThrottledScrollHandler()\n this.createThrottledResizeHandler()\n }\n\n /* Private */\n Context.prototype.add = function(waypoint) {\n var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'\n this.waypoints[axis][waypoint.key] = waypoint\n this.refresh()\n }\n\n /* Private */\n Context.prototype.checkEmpty = function() {\n var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)\n var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)\n var isWindow = this.element == this.element.window\n if (horizontalEmpty && verticalEmpty && !isWindow) {\n this.adapter.off('.waypoints')\n delete contexts[this.key]\n }\n }\n\n /* Private */\n Context.prototype.createThrottledResizeHandler = function() {\n var self = this\n\n function resizeHandler() {\n self.handleResize()\n self.didResize = false\n }\n\n this.adapter.on('resize.waypoints', function() {\n if (!self.didResize) {\n self.didResize = true\n Waypoint.requestAnimationFrame(resizeHandler)\n }\n })\n }\n\n /* Private */\n Context.prototype.createThrottledScrollHandler = function() {\n var self = this\n function scrollHandler() {\n self.handleScroll()\n self.didScroll = false\n }\n\n this.adapter.on('scroll.waypoints', function() {\n if (!self.didScroll || Waypoint.isTouch) {\n self.didScroll = true\n Waypoint.requestAnimationFrame(scrollHandler)\n }\n })\n }\n\n /* Private */\n Context.prototype.handleResize = function() {\n Waypoint.Context.refreshAll()\n }\n\n /* Private */\n Context.prototype.handleScroll = function() {\n var triggeredGroups = {}\n var axes = {\n horizontal: {\n newScroll: this.adapter.scrollLeft(),\n oldScroll: this.oldScroll.x,\n forward: 'right',\n backward: 'left'\n },\n vertical: {\n newScroll: this.adapter.scrollTop(),\n oldScroll: this.oldScroll.y,\n forward: 'down',\n backward: 'up'\n }\n }\n\n for (var axisKey in axes) {\n var axis = axes[axisKey]\n var isForward = axis.newScroll > axis.oldScroll\n var direction = isForward ? axis.forward : axis.backward\n\n for (var waypointKey in this.waypoints[axisKey]) {\n var waypoint = this.waypoints[axisKey][waypointKey]\n if (waypoint.triggerPoint === null) {\n continue\n }\n var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint\n var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint\n var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint\n var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint\n if (crossedForward || crossedBackward) {\n waypoint.queueTrigger(direction)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n }\n }\n\n for (var groupKey in triggeredGroups) {\n triggeredGroups[groupKey].flushTriggers()\n }\n\n this.oldScroll = {\n x: axes.horizontal.newScroll,\n y: axes.vertical.newScroll\n }\n }\n\n /* Private */\n Context.prototype.innerHeight = function() {\n /*eslint-disable eqeqeq */\n if (this.element == this.element.window) {\n return Waypoint.viewportHeight()\n }\n /*eslint-enable eqeqeq */\n return this.adapter.innerHeight()\n }\n\n /* Private */\n Context.prototype.remove = function(waypoint) {\n delete this.waypoints[waypoint.axis][waypoint.key]\n this.checkEmpty()\n }\n\n /* Private */\n Context.prototype.innerWidth = function() {\n /*eslint-disable eqeqeq */\n if (this.element == this.element.window) {\n return Waypoint.viewportWidth()\n }\n /*eslint-enable eqeqeq */\n return this.adapter.innerWidth()\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-destroy */\n Context.prototype.destroy = function() {\n var allWaypoints = []\n for (var axis in this.waypoints) {\n for (var waypointKey in this.waypoints[axis]) {\n allWaypoints.push(this.waypoints[axis][waypointKey])\n }\n }\n for (var i = 0, end = allWaypoints.length; i < end; i++) {\n allWaypoints[i].destroy()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-refresh */\n Context.prototype.refresh = function() {\n /*eslint-disable eqeqeq */\n var isWindow = this.element == this.element.window\n /*eslint-enable eqeqeq */\n var contextOffset = isWindow ? undefined : this.adapter.offset()\n var triggeredGroups = {}\n var axes\n\n this.handleScroll()\n axes = {\n horizontal: {\n contextOffset: isWindow ? 0 : contextOffset.left,\n contextScroll: isWindow ? 0 : this.oldScroll.x,\n contextDimension: this.innerWidth(),\n oldScroll: this.oldScroll.x,\n forward: 'right',\n backward: 'left',\n offsetProp: 'left'\n },\n vertical: {\n contextOffset: isWindow ? 0 : contextOffset.top,\n contextScroll: isWindow ? 0 : this.oldScroll.y,\n contextDimension: this.innerHeight(),\n oldScroll: this.oldScroll.y,\n forward: 'down',\n backward: 'up',\n offsetProp: 'top'\n }\n }\n\n for (var axisKey in axes) {\n var axis = axes[axisKey]\n for (var waypointKey in this.waypoints[axisKey]) {\n var waypoint = this.waypoints[axisKey][waypointKey]\n var adjustment = waypoint.options.offset\n var oldTriggerPoint = waypoint.triggerPoint\n var elementOffset = 0\n var freshWaypoint = oldTriggerPoint == null\n var contextModifier, wasBeforeScroll, nowAfterScroll\n var triggeredBackward, triggeredForward\n\n if (waypoint.element !== waypoint.element.window) {\n elementOffset = waypoint.adapter.offset()[axis.offsetProp]\n }\n\n if (typeof adjustment === 'function') {\n adjustment = adjustment.apply(waypoint)\n }\n else if (typeof adjustment === 'string') {\n adjustment = parseFloat(adjustment)\n if (waypoint.options.offset.indexOf('%') > - 1) {\n adjustment = Math.ceil(axis.contextDimension * adjustment / 100)\n }\n }\n\n contextModifier = axis.contextScroll - axis.contextOffset\n waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)\n wasBeforeScroll = oldTriggerPoint < axis.oldScroll\n nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll\n triggeredBackward = wasBeforeScroll && nowAfterScroll\n triggeredForward = !wasBeforeScroll && !nowAfterScroll\n\n if (!freshWaypoint && triggeredBackward) {\n waypoint.queueTrigger(axis.backward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n else if (!freshWaypoint && triggeredForward) {\n waypoint.queueTrigger(axis.forward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {\n waypoint.queueTrigger(axis.forward)\n triggeredGroups[waypoint.group.id] = waypoint.group\n }\n }\n }\n\n Waypoint.requestAnimationFrame(function() {\n for (var groupKey in triggeredGroups) {\n triggeredGroups[groupKey].flushTriggers()\n }\n })\n\n return this\n }\n\n /* Private */\n Context.findOrCreateByElement = function(element) {\n return Context.findByElement(element) || new Context(element)\n }\n\n /* Private */\n Context.refreshAll = function() {\n for (var contextId in contexts) {\n contexts[contextId].refresh()\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/context-find-by-element */\n Context.findByElement = function(element) {\n return contexts[element.waypointContextKey]\n }\n\n window.onload = function() {\n if (oldWindowLoad) {\n oldWindowLoad()\n }\n Context.refreshAll()\n }\n\n\n Waypoint.requestAnimationFrame = function(callback) {\n var requestFn = window.requestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n requestAnimationFrameShim\n requestFn.call(window, callback)\n }\n Waypoint.Context = Context\n}())\n;(function() {\n 'use strict'\n\n function byTriggerPoint(a, b) {\n return a.triggerPoint - b.triggerPoint\n }\n\n function byReverseTriggerPoint(a, b) {\n return b.triggerPoint - a.triggerPoint\n }\n\n var groups = {\n vertical: {},\n horizontal: {}\n }\n var Waypoint = window.Waypoint\n\n /* http://imakewebthings.com/waypoints/api/group */\n function Group(options) {\n this.name = options.name\n this.axis = options.axis\n this.id = this.name + '-' + this.axis\n this.waypoints = []\n this.clearTriggerQueues()\n groups[this.axis][this.name] = this\n }\n\n /* Private */\n Group.prototype.add = function(waypoint) {\n this.waypoints.push(waypoint)\n }\n\n /* Private */\n Group.prototype.clearTriggerQueues = function() {\n this.triggerQueues = {\n up: [],\n down: [],\n left: [],\n right: []\n }\n }\n\n /* Private */\n Group.prototype.flushTriggers = function() {\n for (var direction in this.triggerQueues) {\n var waypoints = this.triggerQueues[direction]\n var reverse = direction === 'up' || direction === 'left'\n waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)\n for (var i = 0, end = waypoints.length; i < end; i += 1) {\n var waypoint = waypoints[i]\n if (waypoint.options.continuous || i === waypoints.length - 1) {\n waypoint.trigger([direction])\n }\n }\n }\n this.clearTriggerQueues()\n }\n\n /* Private */\n Group.prototype.next = function(waypoint) {\n this.waypoints.sort(byTriggerPoint)\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n var isLast = index === this.waypoints.length - 1\n return isLast ? null : this.waypoints[index + 1]\n }\n\n /* Private */\n Group.prototype.previous = function(waypoint) {\n this.waypoints.sort(byTriggerPoint)\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n return index ? this.waypoints[index - 1] : null\n }\n\n /* Private */\n Group.prototype.queueTrigger = function(waypoint, direction) {\n this.triggerQueues[direction].push(waypoint)\n }\n\n /* Private */\n Group.prototype.remove = function(waypoint) {\n var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n if (index > -1) {\n this.waypoints.splice(index, 1)\n }\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/first */\n Group.prototype.first = function() {\n return this.waypoints[0]\n }\n\n /* Public */\n /* http://imakewebthings.com/waypoints/api/last */\n Group.prototype.last = function() {\n return this.waypoints[this.waypoints.length - 1]\n }\n\n /* Private */\n Group.findOrCreate = function(options) {\n return groups[options.axis][options.name] || new Group(options)\n }\n\n Waypoint.Group = Group\n}())\n;(function() {\n 'use strict'\n\n var $ = window.jQuery\n var Waypoint = window.Waypoint\n\n function JQueryAdapter(element) {\n this.$element = $(element)\n }\n\n $.each([\n 'innerHeight',\n 'innerWidth',\n 'off',\n 'offset',\n 'on',\n 'outerHeight',\n 'outerWidth',\n 'scrollLeft',\n 'scrollTop'\n ], function(i, method) {\n JQueryAdapter.prototype[method] = function() {\n var args = Array.prototype.slice.call(arguments)\n return this.$element[method].apply(this.$element, args)\n }\n })\n\n $.each([\n 'extend',\n 'inArray',\n 'isEmptyObject'\n ], function(i, method) {\n JQueryAdapter[method] = $[method]\n })\n\n Waypoint.adapters.push({\n name: 'jquery',\n Adapter: JQueryAdapter\n })\n Waypoint.Adapter = JQueryAdapter\n}())\n;(function() {\n 'use strict'\n\n var Waypoint = window.Waypoint\n\n function createExtension(framework) {\n return function() {\n var waypoints = []\n var overrides = arguments[0]\n\n if (framework.isFunction(arguments[0])) {\n overrides = framework.extend({}, arguments[1])\n overrides.handler = arguments[0]\n }\n\n this.each(function() {\n var options = framework.extend({}, overrides, {\n element: this\n })\n if (typeof options.context === 'string') {\n options.context = framework(this).closest(options.context)[0]\n }\n waypoints.push(new Waypoint(options))\n })\n\n return waypoints\n }\n }\n\n if (window.jQuery) {\n window.jQuery.fn.waypoint = createExtension(window.jQuery)\n }\n if (window.Zepto) {\n window.Zepto.fn.waypoint = createExtension(window.Zepto)\n }\n}())\n;",
"// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n",
"__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = function(chunkId) {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};",
"// This function allow to reference async chunks\n__webpack_require__.u = function(chunkId) {\n\t// return url for filenames based on template\n\treturn \"js/\" + \"highlightjs\" + \".\" + \"20b210fb4e503f75c059\" + \".js\";\n};",
"// This function allow to reference all chunks\n__webpack_require__.miniCssF = function(chunkId) {\n\t// return url for filenames based on template\n\treturn \"css/\" + \"highlightjs\" + \".\" + \"7b7705451651153be1c8\" + \".css\";\n};",