{"version":3,"sources":["webpack://git/webpack/universalModuleDefinition","webpack://git/webpack/bootstrap","webpack://git/./src/utils/assertParameter.js","webpack://git/./src/utils/normalizePath.js","webpack://git/./src/utils/join.js","webpack://git/./src/errors/BaseError.js","webpack://git/./src/models/FileSystem.js","webpack://git/./src/models/GitPackedRefs.js","webpack://git/./src/utils/compareRefNames.js","webpack://git/./src/managers/GitRefManager.js","webpack://git/./src/errors/InternalError.js","webpack://git/./src/storage/readObject.js","webpack://git/./src/models/GitPktLine.js","webpack://git/./src/errors/NotFoundError.js","webpack://git/./node_modules/node-libs-browser/node_modules/buffer/index.js","webpack://git/./src/models/GitTree.js","webpack://git/./src/models/GitCommit.js","webpack://git/./src/managers/GitIndexManager.js","webpack://git/./src/managers/GitConfigManager.js","webpack://git/./src/errors/ObjectTypeError.js","webpack://git/./src/models/GitAnnotatedTag.js","webpack://git/./src/storage/writeObject.js","webpack://git/./src/utils/toHex.js","webpack://git/./src/utils/shasum.js","webpack://git/./src/utils/BufferCursor.js","webpack://git/./src/utils/normalizeNewlines.js","webpack://git/./src/errors/MissingNameError.js","webpack://git/./src/models/GitObject.js","webpack://git/./src/errors/MissingParameterError.js","webpack://git/./src/errors/AlreadyExistsError.js","webpack://git/./src/utils/dirname.js","webpack://git/./node_modules/pako/lib/utils/common.js","webpack://git/./src/errors/InvalidOidError.js","webpack://git/./src/utils/normalizeStats.js","webpack://git/./src/models/GitWalkerRepo.js","webpack://git/./src/commands/TREE.js","webpack://git/./src/errors/ParseError.js","webpack://git/./src/utils/symbols.js","webpack://git/./src/utils/compareStrings.js","webpack://git/./src/utils/forAwait.js","webpack://git/./node_modules/async-lock/index.js","webpack://git/./src/utils/basename.js","webpack://git/./src/utils/arrayRange.js","webpack://git/./src/models/RunningMinimum.js","webpack://git/./src/utils/unionOfIterators.js","webpack://git/./src/commands/walk.js","webpack://git/./src/errors/InvalidRefNameError.js","webpack://git/./src/managers/GitShallowManager.js","webpack://git/./src/commands/currentBranch.js","webpack://git/./node_modules/clean-git-ref/lib/index.js","webpack://git/./src/errors/UnsafeFilepathError.js","webpack://git/./src/utils/resolveTree.js","webpack://git/./src/utils/pkg.js","webpack://git/./node_modules/pako/index.js","webpack://git/./src/utils/padHex.js","webpack://git/./src/utils/parseAuthor.js","webpack://git/./src/utils/collect.js","webpack://git/./src/utils/modified.js","webpack://git/./src/commands/readTree.js","webpack://git/./src/managers/GitRemoteHTTP.js","webpack://git/./src/errors/MergeNotSupportedError.js","webpack://git/./src/errors/MergeConflictError.js","webpack://git/./src/errors/HttpError.js","webpack://git/./src/errors/InvalidFilepathError.js","webpack://git/./src/utils/comparePath.js","webpack://git/./src/models/GitPackIndex.js","webpack://git/./src/managers/GitIgnoreManager.js","webpack://git/./src/managers/GitRemoteManager.js","webpack://git/./src/utils/translateSSHtoHTTP.js","webpack://git/./src/utils/formatAuthor.js","webpack://git/./src/utils/FIFO.js","webpack://git/./src/errors/RemoteCapabilityError.js","webpack://git/./src/utils/compareStats.js","webpack://git/./src/utils/resolveFilepath.js","webpack://git/./src/errors/EmptyServerResponseError.js","webpack://git/./src/errors/NoRefspecError.js","webpack://git/./src/errors/SmartHttpError.js","webpack://git/./src/errors/UnknownTransportError.js","webpack://git/./src/errors/UrlParseError.js","webpack://git/./src/errors/UserCanceledError.js","webpack://git/./src/errors/UnmergedPathsError.js","webpack://git/./src/models/GitSideBand.js","webpack://git/./node_modules/sha.js/sha1.js","webpack://git/./src/utils/normalizeMode.js","webpack://git/./src/models/GitRefSpec.js","webpack://git/./src/storage/readPackIndex.js","webpack://git/./src/utils/StreamReader.js","webpack://git/./src/utils/inflate.js","webpack://git/./src/utils/deflate.js","webpack://git/./src/utils/calculateBasicAuthHeader.js","webpack://git/./src/wire/parseCapabilitiesV2.js","webpack://git/./src/wire/parseRefsAdResponse.js","webpack://git/./src/utils/getIterator.js","webpack://git/./src/utils/fromValue.js","webpack://git/./src/utils/indent.js","webpack://git/./node_modules/pify/index.js","webpack://git/./src/utils/abbreviateRef.js","webpack://git/./src/errors/index.js","webpack://git/./src/errors/PushRejectedError.js","webpack://git/./src/commands/commit.js","webpack://git/./node_modules/pako/lib/zlib/messages.js","webpack://git/./src/errors/AmbiguousError.js","webpack://git/./src/errors/CheckoutConflictError.js","webpack://git/./src/errors/CommitNotFetchedError.js","webpack://git/./src/errors/FastForwardError.js","webpack://git/./src/errors/GitPushError.js","webpack://git/./src/errors/MaxDepthError.js","webpack://git/./src/errors/MultipleGitError.js","webpack://git/./src/errors/IndexResetError.js","webpack://git/./src/models/GitIndex.js","webpack://git/./src/utils/flatFileListToDirectoryStructure.js","webpack://git/./src/models/GitConfig.js","webpack://git/./src/models/GitRefSpecSet.js","webpack://git/./src/storage/readObjectPacked.js","webpack://git/./src/utils/mergeFile.js","webpack://git/./src/commands/pack.js","webpack://git/./src/utils/flat.js","webpack://git/./src/commands/listObjects.js","webpack://git/./src/utils/rmRecursive.js","webpack://git/./src/utils/extractAuthFromUrl.js","webpack://git/./node_modules/process/browser.js","webpack://git/./src/commands/writeTree.js","webpack://git/./src/commands/fetch.js","webpack://git/./node_modules/safe-buffer/index.js","webpack://git/./node_modules/pako/lib/zlib/adler32.js","webpack://git/./node_modules/pako/lib/zlib/crc32.js","webpack://git/./node_modules/pako/lib/utils/strings.js","webpack://git/./node_modules/pako/lib/zlib/zstream.js","webpack://git/./node_modules/pako/lib/zlib/constants.js","webpack://git/./src/wire/writeUploadPackRequest.js","webpack://git/./src/wire/parseUploadPackResponse.js","webpack://git/./src/utils/mergeTree.js","webpack://git/./src/commands/listCommitsAndTags.js","webpack://git/./src/wire/writeReceivePackRequest.js","webpack://git/./src/wire/parseReceivePackResponse.js","webpack://git/./src/utils/compareTreeEntryPath.js","webpack://git/./src/storage/readObjectLoose.js","webpack://git/./node_modules/crc-32/crc32.js","webpack://git/./src/utils/git-list-pack.js","webpack://git/./src/utils/applyDelta.js","webpack://git/./src/utils/outdent.js","webpack://git/./src/utils/types.js","webpack://git/./node_modules/ignore/index.js","webpack://git/./src/storage/writeObjectLoose.js","webpack://git/./node_modules/diff3/diff3.js","webpack://git/./src/commands/types.js","webpack://git/./src/utils/filterCapabilities.js","webpack://git/./src/utils/splitLines.js","webpack://git/./node_modules/async-lock/lib/index.js","webpack://git/(webpack)/buildin/global.js","webpack://git/./node_modules/node-libs-browser/node_modules/base64-js/index.js","webpack://git/./node_modules/ieee754/index.js","webpack://git/./node_modules/isarray/index.js","webpack://git/./node_modules/inherits/inherits_browser.js","webpack://git/./node_modules/sha.js/hash.js","webpack://git/./node_modules/pako/lib/deflate.js","webpack://git/./node_modules/pako/lib/zlib/deflate.js","webpack://git/./node_modules/pako/lib/zlib/trees.js","webpack://git/./node_modules/pako/lib/inflate.js","webpack://git/./node_modules/pako/lib/zlib/inflate.js","webpack://git/./node_modules/pako/lib/zlib/inffast.js","webpack://git/./node_modules/pako/lib/zlib/inftrees.js","webpack://git/./node_modules/pako/lib/zlib/gzheader.js","webpack://git/./node_modules/diff3/onp.js","webpack://git/./src/api/hashBlob.js","webpack://git/./src/api/writeObject.js","webpack://git/./src/storage/hasObjectLoose.js","webpack://git/./src/storage/hasObjectPacked.js","webpack://git/./src/storage/hasObject.js","webpack://git/./src/commands/addNote.js","webpack://git/./src/utils/emptyPackfile.js","webpack://git/./src/storage/hashObject.js","webpack://git/./src/commands/packObjects.js","webpack://git/./src/models/GitWalkerIndex.js","webpack://git/./src/utils/mode2type.js","webpack://git/./src/commands/STAGE.js","webpack://git/./src/models/GitWalkerFs.js","webpack://git/./src/commands/WORKDIR.js","webpack://git/./src/api/abortMerge.js","webpack://git/./src/utils/posixifyPathBuffer.js","webpack://git/./src/api/add.js","webpack://git/./src/commands/getConfig.js","webpack://git/./src/utils/normalizeAuthorObject.js","webpack://git/./src/utils/normalizeCommitterObject.js","webpack://git/./src/api/addNote.js","webpack://git/./src/commands/addRemote.js","webpack://git/./src/api/addRemote.js","webpack://git/./src/commands/annotatedTag.js","webpack://git/./src/api/annotatedTag.js","webpack://git/./src/commands/branch.js","webpack://git/./src/api/branch.js","webpack://git/./src/utils/worthWalking.js","webpack://git/./src/commands/checkout.js","webpack://git/./src/api/checkout.js","webpack://git/./src/commands/init.js","webpack://git/./src/commands/clone.js","webpack://git/./src/api/clone.js","webpack://git/./src/api/commit.js","webpack://git/./src/api/currentBranch.js","webpack://git/./src/commands/deleteBranch.js","webpack://git/./src/api/deleteBranch.js","webpack://git/./src/api/deleteRef.js","webpack://git/./src/commands/deleteRemote.js","webpack://git/./src/api/deleteRemote.js","webpack://git/./src/commands/deleteTag.js","webpack://git/./src/api/deleteTag.js","webpack://git/./src/storage/expandOidLoose.js","webpack://git/./src/storage/expandOidPacked.js","webpack://git/./src/storage/expandOid.js","webpack://git/./src/api/expandOid.js","webpack://git/./src/api/expandRef.js","webpack://git/./src/commands/findMergeBase.js","webpack://git/./src/commands/merge.js","webpack://git/./src/commands/pull.js","webpack://git/./src/api/fastForward.js","webpack://git/./src/api/fetch.js","webpack://git/./src/api/findMergeBase.js","webpack://git/./src/commands/findRoot.js","webpack://git/./src/api/findRoot.js","webpack://git/./src/api/getConfig.js","webpack://git/./src/commands/getConfigAll.js","webpack://git/./src/api/getConfigAll.js","webpack://git/./src/api/getRemoteInfo.js","webpack://git/./src/utils/formatInfoRefs.js","webpack://git/./src/api/getRemoteInfo2.js","webpack://git/./src/commands/indexPack.js","webpack://git/./src/api/indexPack.js","webpack://git/./src/api/init.js","webpack://git/./src/commands/isDescendent.js","webpack://git/./src/api/isDescendent.js","webpack://git/./src/api/isIgnored.js","webpack://git/./src/api/listBranches.js","webpack://git/./src/commands/listFiles.js","webpack://git/./src/api/listFiles.js","webpack://git/./src/commands/listNotes.js","webpack://git/./src/api/listNotes.js","webpack://git/./src/commands/listRemotes.js","webpack://git/./src/api/listRemotes.js","webpack://git/./src/wire/parseListRefsResponse.js","webpack://git/./src/wire/writeListRefsRequest.js","webpack://git/./src/api/listServerRefs.js","webpack://git/./src/api/listTags.js","webpack://git/./src/utils/resolveCommit.js","webpack://git/./src/commands/readCommit.js","webpack://git/./src/utils/compareAge.js","webpack://git/./src/utils/resolveFileIdInTree.js","webpack://git/./src/commands/log.js","webpack://git/./src/api/log.js","webpack://git/./src/api/merge.js","webpack://git/./src/api/packObjects.js","webpack://git/./src/api/pull.js","webpack://git/./src/commands/push.js","webpack://git/./src/api/push.js","webpack://git/./src/utils/resolveBlob.js","webpack://git/./src/commands/readBlob.js","webpack://git/./src/api/readBlob.js","webpack://git/./src/api/readCommit.js","webpack://git/./src/commands/readNote.js","webpack://git/./src/api/readNote.js","webpack://git/./src/api/readObject.js","webpack://git/./src/commands/readTag.js","webpack://git/./src/api/readTag.js","webpack://git/./src/api/readTree.js","webpack://git/./src/api/remove.js","webpack://git/./src/commands/removeNote.js","webpack://git/./src/api/removeNote.js","webpack://git/./src/commands/renameBranch.js","webpack://git/./src/api/renameBranch.js","webpack://git/./src/utils/hashObject.js","webpack://git/./src/api/resetIndex.js","webpack://git/./src/api/resolveRef.js","webpack://git/./src/api/setConfig.js","webpack://git/./src/api/status.js","webpack://git/./src/api/statusMatrix.js","webpack://git/./src/api/tag.js","webpack://git/./src/api/updateIndex.js","webpack://git/./src/api/version.js","webpack://git/./src/api/walk.js","webpack://git/./src/api/writeBlob.js","webpack://git/./src/commands/writeCommit.js","webpack://git/./src/api/writeCommit.js","webpack://git/./src/api/writeRef.js","webpack://git/./src/commands/writeTag.js","webpack://git/./src/api/writeTag.js","webpack://git/./src/api/writeTree.js","webpack://git/./src/index.js"],"names":["root","factory","exports","module","define","amd","self","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","assertParameter","undefined","MissingParameterError","memo","Map","normalizePath","path","normalizedPath","split","join","replace","startsWith","slice","endsWith","length","normalizePathInternal","set","parts","map","BaseError","Error","constructor","message","super","this","caller","toJSON","code","data","stack","fromJSON","json","e","isPromiseFs","fs","isPromiseLike","targetFs","readFile","catch","test","commands","bindFs","target","command","pify","rm","_rm","rmdir","rmRecursive","FileSystem","_original_unwrapped_fs","promises","getOwnPropertyDescriptor","exists","filepath","options","_stat","err","console","log","read","buffer","_readFile","Buffer","from","write","contents","_writeFile","mkdir","dirname","_selfCall","_mkdir","parent","_unlink","opts","recursive","_rmdir","readdir","names","_readdir","sort","compareStrings","readdirDeep","dir","subdirs","Promise","all","subdir","res","isDirectory","reduce","a","f","concat","lstat","filename","_lstat","readlink","encoding","link","_readlink","isBuffer","writelink","_symlink","toString","GitPackedRefs","text","refs","parsedConfig","trim","line","comment","indexOf","ref","peeled","oid","delete","filter","entry","compareRefNames","b","_a","_b","tmp","refpaths","GIT_FILES","lock","acquireLock","callback","AsyncLock","acquire","GitRefManager","gitdir","remote","symrefs","tags","refspecs","prune","pruneTags","values","match","InvalidOidError","config","GitConfigManager","getall","NoRefspecError","unshift","refspec","GitRefSpecSet","actualRefsToWrite","listRefs","deleteRefs","tag","serverRef","keys","refTranslations","translate","translatedRef","symrefTranslations","symtarget","translateOne","pruned","localNamespaces","file","has","push","packed","beforeSize","size","depth","resolve","packedMap","packedRefs","allpaths","includes","sha","NotFoundError","expand","fullref","resolveAgainstMap","files","x","InternalError","_readObject","cache","format","getExternalRefDelta","result","readObjectLoose","readObjectPacked","inflate","shasum","type","GitObject","unwrap","GitPktLine","hexlength","padHex","stream","reader","StreamReader","parseInt","error","what","base64","ieee754","isArray","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","allocUnsafe","TypeError","ArrayBuffer","array","byteOffset","byteLength","fromArrayLike","fromArrayBuffer","string","isEncoding","actual","fromString","obj","len","checked","copy","val","fromObject","assertSize","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","isNaN","arrayIndexOf","lastIndexOf","arr","indexSize","arrLength","valLength","String","buf","readUInt16BE","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","charCodeAt","asciiToBytes","latin1Write","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","fromByteArray","Math","min","secondByte","thirdByte","fourthByte","tempCodePoint","firstByte","codePoint","bytesPerSequence","codePoints","fromCharCode","apply","decodeCodePointsArray","SlowBuffer","alloc","INSPECT_MAX_BYTES","global","foo","subarray","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","y","list","pos","swap16","swap32","swap64","arguments","equals","inspect","max","thisStart","thisEnd","thisCopy","targetCopy","isFinite","Array","_arr","ret","out","toHex","bytes","checkOffset","ext","checkInt","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","writeDouble","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","INVALID_BASE64_RE","Infinity","leadSurrogate","toByteArray","stringtrim","base64clean","src","dst","mode2type","nudgeIntoShape","limitModeToAllowed","GitTree","entries","_entries","cursor","space","nullchar","UnsafeFilepathError","parseBuffer","comparePath","tree","render","toObject","compareTreeEntryPath","iterator","GitCommit","commit","_commit","payload","signature","headers","justHeaders","justMessage","normalizeNewlines","indent","parseHeaders","parse","assign","hs","h","author","parseAuthor","committer","formatAuthor","gpgsig","renderHeaders","withoutSignature","isolateSignature","outdent","sign","secretKey","signedCommit","IndexCache","stat","rawIndexFile","index","GitIndex","stats","savedStats","currStats","compareStats","GitIndexManager","allowUnmerged","closure","maxPending","unmergedPaths","isIndexStale","updateCachedIndexFile","UnmergedPathsError","_dirty","GitConfig","ObjectTypeError","expected","GitAnnotatedTag","_tag","tagger","signedTag","_writeObject","dryRun","wrap","deflate","writeObjectLoose","hex","byte","supportsSubtleSHA1","testSubtleSHA1","subtleSHA1","shasumSync","Hash","update","digest","crypto","subtle","_","BufferCursor","_start","eof","tell","seek","enc","source","MissingNameError","role","actualLength","parameter","AlreadyExistsError","noun","where","canForce","last","TYPED_OK","Uint16Array","Int32Array","_has","sources","shift","shrinkBuf","fnTyped","arraySet","dest","src_offs","dest_offs","flattenChunks","chunks","chunk","fnUntyped","setTyped","on","Buf8","Buf16","Buf32","SecondsNanoseconds","givenSeconds","givenNanoseconds","milliseconds","date","valueOf","seconds","normalizeStats","ctimeSeconds","ctimeNanoseconds","ctimeMs","ctime","mtimeSeconds","mtimeNanoseconds","mtimeMs","mtime","dev","ino","normalizeMode","uid","gid","GitWalkerRepo","mapPromise","resolveTree","walker","ConstructEntry","fullpath","_fullpath","_type","_mode","_content","_oid","content","JSON","stringify","readObject","_entry","TREE","GitWalkSymbol","freeze","ParseError","forAwait","iterable","cb","iter","getIterator","done","next","return","basename","arrayRange","RunningMinimum","consider","reset","unionOfIterators","sets","minimum","heads","numsets","_walk","trees","children","flatten","flat","iterate","walk","walkers","proxy","range","unionWalkerFromReaddir","iterators","find","walkedChildren","InvalidRefNameError","suggestion","GitShallowManager","oids","Set","add","_currentBranch","fullname","abbreviateRef","replaceAll","search","replacement","RegExp","CleanGitRef","clean","pkg","version","agent","pako","repeat","email","timestamp","timezoneOffset","parseTimezoneOffset","hours","minutes","collect","buffers","nextIndex","modified","base","_readTree","resolveFilepath","treeOid","corsProxify","corsProxy","url","updateHeaders","auth","username","password","Authorization","calculateBasicAuthHeader","stringifyBody","body","response","preview","GitRemoteHTTP","http","onProgress","onAuth","onAuthSuccess","onAuthFailure","service","_origUrl","protocolVersion","extractAuthFromUrl","proxifiedURL","tryAgain","providedAuthBefore","request","method","statusCode","getAuth","cancel","UserCanceledError","HttpError","statusMessage","remoteHTTP","parseRefsAdResponse","SmartHttpError","urlAuth","accept","MergeNotSupportedError","MergeConflictError","filepaths","bothModified","deleteByUs","deleteByTheirs","InvalidFilepathError","reason","GitPackIndex","stuff","offsetCache","idx","hashes","hash","offsets","packfileSha","crcs","pack","listpackTypes","1","2","3","4","6","7","offsetToObject","totalObjectCount","lastPercent","listpack","reference","num","percent","phase","loaded","total","offsetArray","crc","crc32","count","objectsByDepth","readDepth","externalReadDepth","readSlice","toBuffer","fanoutBuffer","crcsBuffer","offsetsBuffer","totalBuffer","shaBuffer","load","unload","raw","btype","lastFour","startWith","otherVarIntDecode","multibyte","lastSeven","decodeVarInt","baseOffset","applyDelta","GitIgnoreManager","excludes","excludesFile","pairs","gitignore","pieces","Boolean","folder","ignoredStatus","ign","ignore","parentdir","ignores","unignored","ignored","GitRemoteManager","remoteHelpers","transport","address","matches","parseRemoteUrl","UrlParseError","UnknownTransportError","translateSSHtoHTTP","is","simpleSign","abs","strHours","strMinutes","formatTimezoneOffset","FIFO","_queue","_ended","_waiting","destroy","RemoteCapabilityError","capability","pathArray","_resolveFilepath","EmptyServerResponseError","GitSideBand","input","streamReader","packetlines","packfile","progress","nextBit","inherits","K","W","Sha1","init","_w","rotl5","rotl30","ft","_c","_d","_e","_update","M","_hash","H","permissions","GitRefSpec","remotePath","localPath","force","matchPrefix","forceMatch","remoteGlobMatch","localGlobMatch","remoteIsGlob","remoteBranch","reverseTranslate","localBranch","PackfileCache","emitter","emitterPrefix","fromIdx","readPackIndex","loadPackIndex","undoCursor","started","_discardedBytes","_init","_loadnext","_moveCursor","_trim","_accumulate","skip","undo","_next","lengthBuffers","nextbuffer","acc","supportsDecompressionStream","testDecompressionStream","browserInflate","ds","DecompressionStream","Blob","pipeThrough","Response","arrayBuffer","supportsCompressionStream","testCompressionStream","browserDeflate","cs","CompressionStream","writable","close","parseCapabilitiesV2","capabilities2","capabilities","lineOne","lineTwo","firstRef","capabilitiesLine","splitAndAssert","cap","sep","asyncIterator","queue","pop","fromValue","processFn","fn","args","P","promiseModule","reject","multiArgs","errorFirst","exclude","objType","pattern","include","some","excludeMain","getPrototypeOf","abbreviateRx","exec","PushRejectedError","onSign","signingKey","noUpdateBranch","inode","flatFileListToDirectoryStructure","constructTree","comm","writeObject","writeRef","metadata","0","AmbiguousError","nouns","short","CheckoutConflictError","CommitNotFetchedError","FastForwardError","GitPushError","prettyDetails","MaxDepthError","MultipleGitError","errors","IndexResetError","_unmergedPaths","_addEntry","flags","stage","stages","existingEntry","fromBuffer","magic","shaComputed","shaClaimed","numEntries","bits","assumeValid","extended","nameLength","pathlength","padding","flatMap","insert","bfilepath","clear","bpath","ceil","written","writer","renderCacheEntryFlags","header","entriesFlat","entryBuffers","_entryToBuffer","main","sum","inodes","mkfile","bool","schema","core","filemode","bare","logallrefupdates","symlinks","ignorecase","bigFileThreshold","SECTION_LINE_REGEX","SECTION_REGEX","VARIABLE_LINE_REGEX","VARIABLE_NAME_REGEX","VARIABLE_VALUE_COMMENT_REGEX","removeComments","rawValue","commentMatches","valueWithoutComment","hasOddNumberOfQuotes","removeQuotes","newText","isQuote","isEscapeForQuote","lower","getPath","section","subsection","pathSegments","sectionPath","trimmedLine","extractedSection","extractSectionLine","isSection","extractedVariable","valueWithoutComments","extractVariableLine","allValues","getSubsections","deleteSection","append","configIndex","lastIndex","item","splice","modifiedConfig","sectionIndex","findIndex","newConfig","newSection","rules","rule","remoteRefs","remoteRef","localRef","indexFile","packFile","LINEBREAKS","mergeFile","branches","ourName","theirName","baseContent","ourContent","theirContent","ours","theirs","diff3Merge","mergedText","cleanMerge","ok","conflict","_pack","outputStream","buff","stype","types","listObjects","visited","subpath","then","userpass","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","versions","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","_writeTree","_fetch","onMessage","_ref","_remoteRef","_remote","_url","since","relative","singleBranch","getRemoteHelperFor","discover","defaultBranch","fetchHead","fetchHeadDescription","filterCapabilities","wants","haveRefs","haves","hasObject","shallows","packstream","writeUploadPackRequest","packbuffer","connect","parseUploadPackResponse","hasParents","every","unshallows","bail","realRef","updateRemoteRefs","HEAD","FETCH_HEAD","description","lines","splitLines","emptyPackfile","fromPack","copyProps","SafeBuffer","adler","s1","s2","crcTable","table","k","makeTable","utils","STR_APPLY_OK","STR_APPLY_UIA_OK","__","_utf8len","q","buf2binstring","string2buf","c2","m_pos","str_len","buf_len","binstring2buf","buf2string","c_len","utf16buf","utf8border","next_in","avail_in","total_in","output","next_out","avail_out","total_out","msg","state","data_type","Z_NO_FLUSH","Z_PARTIAL_FLUSH","Z_SYNC_FLUSH","Z_FULL_FLUSH","Z_FINISH","Z_BLOCK","Z_TREES","Z_OK","Z_STREAM_END","Z_NEED_DICT","Z_ERRNO","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_DEFAULT_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_DEFAULT_STRATEGY","Z_BINARY","Z_TEXT","Z_UNKNOWN","Z_DEFLATED","firstLineCapabilities","encode","flush","demux","acks","nak","status","finally","mergeTree","ourOid","baseOid","theirOid","baseName","abortOnConflict","mergeDriver","ourTree","baseTree","theirTree","unmergedFiles","results","mergeBlobs","mergeResult","TextDecoder","decode","listCommitsAndTags","finish","startingSet","finishingSet","parents","writeReceivePackRequest","triplets","capsFirstLine","trip","oldoid","fullRef","parseReceivePackResponse","refAndMessage","appendSlashIfDir","CRC32","T","signed_crc_table","bstr","seed","C","L","crc32_buf_8","DO_NOT_EXPORT_CRC","onData","PACK","numObjects","ofs","parseHeader","inflator","Inflate","strm","delta","sourceSize","readVarIntLE","targetSize","firstOp","readOp","readCompactLE","isObject","isFunction","makeArray","subject","REGEX_TEST_BLANK_LINE","REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION","REGEX_REPLACE_LEADING_EXCAPED_HASH","REGEX_SPLITALL_CRLF","REGEX_TEST_INVALID_PATH","KEY_IGNORE","for","REGEX_REGEXP_RANGE","RETURN_FALSE","REPLACERS","p1","leadEscape","endEscape","slashes","cleanRangeBackSlash","to","sanitizeRange","regexCache","isString","IgnoreRule","origin","negative","regex","createRule","ignoreCase","prev","current","makeRegex","throwError","Ctor","checkPath","originalPath","doThrow","isNotRelative","convert","Ignore","allowRelativePaths","_rules","_ignoreCase","_allowRelativePaths","_initCache","_ignoreCache","_testCache","_added","checkPattern","splitPattern","forEach","_addPattern","checkUnignored","slices","_t","_testOne","_test","paths","createFilter","isPathValid","default","IGNORE_TEST_WIN32","platform","makePosix","REGIX_IS_WINDOWS_PATH_ABSOLUTE","onp","diffIndices","file1","file2","tail1","tail2","candidate","diff","compose","ses","getses","file1RevIdx","file2RevIdx","SES_COMMON","chain","file1index","file2index","SES_DELETE","SES_ADD","tail","longestCommonSubsequence","mismatchLength1","mismatchLength2","reverse","indices","m1","m2","hunks","addHunk","side","commonOffset","copyCommon","targetOffset","hunkIndex","firstHunkIndex","hunk","regionLhs","regionRhs","maybeOverlapping","maybeLhs","regions","oLhs","oRhs","abLhs","abRhs","aLhs","aRhs","bLhs","bRhs","diff3MergeIndices","okLines","flushOk","pushOk","xs","isTrueConflict","rec","aoff","boff","aIndex","oIndex","bIndex","blob","ofs_delta","ref_delta","server","client","serverNames","findSplit","queues","domains","domainReentrant","DEFAULT_TIMEOUT","DEFAULT_MAX_PENDING","_acquireBatch","deferredResolve","deferredReject","deferred","resolved","timer","locked","domain","called","_promiseTry","taskFn","skipQueue","fnx","getFn","isBusy","g","Function","window","b64","lens","getLens","validLen","placeHoldersLen","Arr","_byteLength","curByte","revLookup","uint8","extraBytes","len2","encodeChunk","lookup","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","LN2","ctor","superCtor","super_","TempCtor","blockSize","finalSize","_block","_finalSize","_blockSize","_len","block","accum","assigned","remainder","rem","lowBits","highBits","zlib_deflate","strings","ZStream","Deflate","level","chunkSize","windowBits","memLevel","strategy","opt","gzip","ended","deflateInit2","deflateSetHeader","dictionary","dict","deflateSetDictionary","_dict_set","deflator","onEnd","deflateEnd","deflateRaw","configuration_table","adler32","errorCode","rank","zero","flush_pending","pending","pending_buf","pending_out","flush_block_only","_tr_flush_block","block_start","strstart","put_byte","putShortMSB","longest_match","cur_match","chain_length","max_chain_length","scan","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","strend","scan_end1","scan_end","good_match","lookahead","match_start","fill_window","more","_w_size","window_size","hash_size","head","ins_h","hash_shift","hash_mask","deflate_fast","hash_head","bflush","match_length","_tr_tally","max_lazy_match","MIN_MATCH","last_lit","deflate_slow","max_insert","prev_match","match_available","Config","good_length","max_lazy","nice_length","max_chain","func","DeflateState","pending_buf_size","gzhead","gzindex","last_flush","w_bits","hash_bits","dyn_ltree","HEAP_SIZE","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","bl_count","MAX_BITS","heap","heap_len","heap_max","l_buf","lit_bufsize","d_buf","opt_len","static_len","bi_buf","bi_valid","deflateResetKeep","_tr_init","deflateReset","max_block_size","max_start","deflateInit","old_flush","beg","hcrc","extra","time","os","bstate","deflate_huff","deflate_rle","_tr_align","_tr_stored_block","avail","tmpDict","dictLength","deflateInfo","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","D_CODES","_dist_code","_length_code","MAX_MATCH","base_length","static_l_desc","static_d_desc","static_bl_desc","base_dist","StaticTreeDesc","static_tree","extra_bits","extra_base","elems","max_length","has_stree","TreeDesc","dyn_tree","stat_desc","max_code","d_code","dist","put_short","w","send_bits","send_code","bi_reverse","gen_codes","next_code","init_block","LITERALS","END_BLOCK","bi_windup","smaller","_n2","_m2","pqdownheap","v","compress_block","ltree","dtree","lc","lx","build_tree","desc","node","stree","xbits","overflow","gen_bitlen","scan_tree","curlen","prevlen","nextlen","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","send_tree","static_init_done","stored_len","copy_block","LENGTH_CODES","L_CODES","tr_static_init","opt_lenb","static_lenb","max_blindex","black_mask","detect_data_type","BL_CODES","build_bl_tree","lcodes","dcodes","blcodes","send_all_trees","STATIC_TREES","bi_flush","zlib_inflate","GZheader","inflateInit2","inflateGetHeader","inflateSetDictionary","next_out_utf8","utf8str","allowBufError","inflateEnd","inflateRaw","ungzip","inflate_fast","inflate_table","zswap32","InflateState","havedict","dmax","check","wbits","wsize","whave","wnext","hold","lencode","distcode","lenbits","distbits","ncode","nlen","ndist","have","work","lendyn","distdyn","sane","back","was","inflateResetKeep","inflateReset","inflateReset2","lenfix","distfix","virgin","fixedtables","sym","updatewindow","inflateInit","put","left","_in","_out","from_source","here_bits","here_op","here_val","last_bits","last_op","last_val","here","hbuf","order","inf_leave","xflags","extra_len","inflateInfo","s_window","lcode","dcode","lmask","dmask","op","top","dolen","dodist","lbase","lext","dbase","dext","lens_index","codes","table_index","incr","low","mask","curr","drop","used","huff","base_index","MAXBITS","offs","extra_index","a_","b_","tmp1","tmp2","ed","pathposi","lcs","seselem","elem","snake","pp","editdistance","getlcs","fp","epc","px_idx","py_idx","recordseq","hashBlob","_object","hashObject","_fs","hasObjectLoose","hasObjectPacked","_addNote","note","noteOid","pheader","_packObjects","GitWalkerIndex","treePromise","STAGE","GitWalkerFs","isFile","isSymbolicLink","_actualSize","entriesMap","WORKDIR","abortMerge","workdir","staged","unmerged","unmodified","posixifyPathBuffer","parallel","addToIndex","currentFilepath","isIgnored","child","settledPromises","allSettled","rejectedPromises","settle","_getConfig","normalizeAuthorObject","Date","now","getTimezoneOffset","normalizeCommitterObject","addNote","_author","_committer","_addRemote","cleanGitRef","save","addRemote","_annotatedTag","tagObject","annotatedTag","_tagger","_branch","checkout","writeSymbolicRef","branch","worthWalking","_checkout","noCheckout","noUpdateHead","track","ops","analyze","conflicts","chmod","folders","_clone","noTags","maxRetries","clone","currentBranch","_deleteBranch","deleteRef","deleteBranch","_deleteRemote","deleteRemote","_deleteTag","deleteTag","expandOidLoose","prefix","suffix","expandOidPacked","_expandOid","packedOids","packedOid","expandOid","expandRef","_findMergeBase","visits","passes","newheads","_merge","fastForward","fastForwardOnly","baseOids","alreadyMerged","mergeCommit","_pull","thisWillNotBeUsed","fetch","findMergeBase","_findRoot","findRoot","getConfig","_getConfigAll","getConfigAll","getRemoteInfo","forPush","part","symref","formatInfoRefs","peelTags","_key","getRemoteInfo2","_indexPack","indexPack","_isDescendent","ancestor","searchdepth","isDescendent","listBranches","_listFiles","filenames","accumulateFilesFromOid","listFiles","_listNotes","listNotes","_listRemotes","remoteNames","listRemotes","parseListRefsResponse","attrs","attr","writeListRefsRequest","delim","listServerRefs","listTags","resolveCommit","_readCommit","commitOid","compareAge","EMPTY_OID","resolveFileIdInTree","fileId","_resolveFileId","parentPath","walks","_log","follow","sinceTimestamp","commits","shallowCommits","tips","lastFileOid","lastCommit","isOk","endCommit","vFileOid","lastFound","merge","packObjects","pull","_push","_delete","httpRemote","fullRemoteRef","expandAgainstMap","thinPack","objects","skipObjects","mergebase","packstream1","packstream2","resolveBlob","_readBlob","readBlob","readCommit","_readNote","readNote","_format","_readTag","readTag","readTree","remove","_removeNote","removeNote","_renameBranch","oldref","fulloldref","fullnewref","fullCurrentBranchRef","renameBranch","resetIndex","workdirOid","resolveRef","setConfig","headTree","getHeadTree","getOidAtPath","indexEntry","I","getWorkdirOid","statusMatrix","shouldIgnore","headType","workdirType","stageType","isBlob","headOid","stageOid","updateIndex","fileStats","writeBlob","_writeCommit","writeCommit","symbolic","_writeTag","writeTag","writeTree","Errors"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,S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aACAC,aACAM,eACAO,SACAC,iBACAE,YACAI,iBACAO,kBACAjH,cACAmH,aACA9iC,QACAkjC,gBACA1F,aACA2F,gBACAI,aACAE,aACAG,eACAM,kBACAC,YACAjxD,OACAwyD,SACAC,eACAC,QACAhsD,QACA8sD,YACAC,cACAE,YACA50C,cACA+0C,WACAC,YACAC,UACAE,cACAM,gBACAC,cACAkB,eACAhB,cACAnwB,UACA2wB,gBACAtvD,OACAwc,WACAxB,QACAg1C,aACAE,eACA7iC,iBACAC,YACA+iC,YACAC","file":"index.umd.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"git\"] = factory();\n\telse\n\t\troot[\"git\"] = factory();\n})(self, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 160);\n","import { MissingParameterError } from '../errors/MissingParameterError.js'\n\nexport function assertParameter(name, value) {\n if (value === undefined) {\n throw new MissingParameterError(name)\n }\n}\n","const memo = new Map()\nexport function normalizePath(path) {\n let normalizedPath = memo.get(path)\n if (!normalizedPath) {\n normalizedPath = normalizePathInternal(path)\n memo.set(path, normalizedPath)\n }\n return normalizedPath\n}\n\nfunction normalizePathInternal(path) {\n path = path\n .split('/./')\n .join('/') // Replace '/./' with '/'\n .replace(/\\/{2,}/g, '/') // Replace consecutive '/'\n\n if (path === '/.') return '/' // if path === '/.' return '/'\n if (path === './') return '.' // if path === './' return '.'\n\n if (path.startsWith('./')) path = path.slice(2) // Remove leading './'\n if (path.endsWith('/.')) path = path.slice(0, -2) // Remove trailing '/.'\n if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1) // Remove trailing '/'\n\n if (path === '') return '.' // if path === '' return '.'\n\n return path\n}\n","// For some reason path.posix.join is undefined in webpack\n// Also, this is just much smaller\nimport { normalizePath } from './normalizePath.js'\n\nexport function join(...parts) {\n return normalizePath(parts.map(normalizePath).join('/'))\n}\n","export class BaseError extends Error {\n constructor(message) {\n super(message)\n // Setting this here allows TS to infer that all git errors have a `caller` property and\n // that its type is string.\n this.caller = ''\n }\n\n toJSON() {\n // Error objects aren't normally serializable. So we do something about that.\n return {\n code: this.code,\n data: this.data,\n caller: this.caller,\n message: this.message,\n stack: this.stack,\n }\n }\n\n fromJSON(json) {\n const e = new BaseError(json.message)\n e.code = json.code\n e.data = json.data\n e.caller = json.caller\n e.stack = json.stack\n return e\n }\n\n get isIsomorphicGitError() {\n return true\n }\n}\n","import pify from 'pify'\n\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { dirname } from '../utils/dirname.js'\nimport { rmRecursive } from '../utils/rmRecursive.js'\nimport { isPromiseLike } from '../utils/types.js'\n\nfunction isPromiseFs(fs) {\n const test = targetFs => {\n try {\n // If readFile returns a promise then we can probably assume the other\n // commands do as well\n return targetFs.readFile().catch(e => e)\n } catch (e) {\n return e\n }\n }\n return isPromiseLike(test(fs))\n}\n\n// List of commands all filesystems are expected to provide. `rm` is not\n// included since it may not exist and must be handled as a special case\nconst commands = [\n 'readFile',\n 'writeFile',\n 'mkdir',\n 'rmdir',\n 'unlink',\n 'stat',\n 'lstat',\n 'readdir',\n 'readlink',\n 'symlink',\n]\n\nfunction bindFs(target, fs) {\n if (isPromiseFs(fs)) {\n for (const command of commands) {\n target[`_${command}`] = fs[command].bind(fs)\n }\n } else {\n for (const command of commands) {\n target[`_${command}`] = pify(fs[command].bind(fs))\n }\n }\n\n // Handle the special case of `rm`\n if (isPromiseFs(fs)) {\n if (fs.rm) target._rm = fs.rm.bind(fs)\n else if (fs.rmdir.length > 1) target._rm = fs.rmdir.bind(fs)\n else target._rm = rmRecursive.bind(null, target)\n } else {\n if (fs.rm) target._rm = pify(fs.rm.bind(fs))\n else if (fs.rmdir.length > 2) target._rm = pify(fs.rmdir.bind(fs))\n else target._rm = rmRecursive.bind(null, target)\n }\n}\n\n/**\n * This is just a collection of helper functions really. At least that's how it started.\n */\nexport class FileSystem {\n constructor(fs) {\n if (typeof fs._original_unwrapped_fs !== 'undefined') return fs\n\n const promises = Object.getOwnPropertyDescriptor(fs, 'promises')\n if (promises && promises.enumerable) {\n bindFs(this, fs.promises)\n } else {\n bindFs(this, fs)\n }\n this._original_unwrapped_fs = fs\n }\n\n /**\n * Return true if a file exists, false if it doesn't exist.\n * Rethrows errors that aren't related to file existence.\n */\n async exists(filepath, options = {}) {\n try {\n await this._stat(filepath)\n return true\n } catch (err) {\n if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {\n return false\n } else {\n console.log('Unhandled error in \"FileSystem.exists()\" function', err)\n throw err\n }\n }\n }\n\n /**\n * Return the contents of a file if it exists, otherwise returns null.\n *\n * @param {string} filepath\n * @param {object} [options]\n *\n * @returns {Promise}\n */\n async read(filepath, options = {}) {\n try {\n let buffer = await this._readFile(filepath, options)\n // Convert plain ArrayBuffers to Buffers\n if (typeof buffer !== 'string') {\n buffer = Buffer.from(buffer)\n }\n return buffer\n } catch (err) {\n return null\n }\n }\n\n /**\n * Write a file (creating missing directories if need be) without throwing errors.\n *\n * @param {string} filepath\n * @param {Buffer|Uint8Array|string} contents\n * @param {object|string} [options]\n */\n async write(filepath, contents, options = {}) {\n try {\n await this._writeFile(filepath, contents, options)\n return\n } catch (err) {\n // Hmm. Let's try mkdirp and try again.\n await this.mkdir(dirname(filepath))\n await this._writeFile(filepath, contents, options)\n }\n }\n\n /**\n * Make a directory (or series of nested directories) without throwing an error if it already exists.\n */\n async mkdir(filepath, _selfCall = false) {\n try {\n await this._mkdir(filepath)\n return\n } catch (err) {\n // If err is null then operation succeeded!\n if (err === null) return\n // If the directory already exists, that's OK!\n if (err.code === 'EEXIST') return\n // Avoid infinite loops of failure\n if (_selfCall) throw err\n // If we got a \"no such file or directory error\" backup and try again.\n if (err.code === 'ENOENT') {\n const parent = dirname(filepath)\n // Check to see if we've gone too far\n if (parent === '.' || parent === '/' || parent === filepath) throw err\n // Infinite recursion, what could go wrong?\n await this.mkdir(parent)\n await this.mkdir(filepath, true)\n }\n }\n }\n\n /**\n * Delete a file without throwing an error if it is already deleted.\n */\n async rm(filepath) {\n try {\n await this._unlink(filepath)\n } catch (err) {\n if (err.code !== 'ENOENT') throw err\n }\n }\n\n /**\n * Delete a directory without throwing an error if it is already deleted.\n */\n async rmdir(filepath, opts) {\n try {\n if (opts && opts.recursive) {\n await this._rm(filepath, opts)\n } else {\n await this._rmdir(filepath)\n }\n } catch (err) {\n if (err.code !== 'ENOENT') throw err\n }\n }\n\n /**\n * Read a directory without throwing an error is the directory doesn't exist\n */\n async readdir(filepath) {\n try {\n const names = await this._readdir(filepath)\n // Ordering is not guaranteed, and system specific (Windows vs Unix)\n // so we must sort them ourselves.\n names.sort(compareStrings)\n return names\n } catch (err) {\n if (err.code === 'ENOTDIR') return null\n return []\n }\n }\n\n /**\n * Return a flast list of all the files nested inside a directory\n *\n * Based on an elegant concurrent recursive solution from SO\n * https://stackoverflow.com/a/45130990/2168416\n */\n async readdirDeep(dir) {\n const subdirs = await this._readdir(dir)\n const files = await Promise.all(\n subdirs.map(async subdir => {\n const res = dir + '/' + subdir\n return (await this._stat(res)).isDirectory()\n ? this.readdirDeep(res)\n : res\n })\n )\n return files.reduce((a, f) => a.concat(f), [])\n }\n\n /**\n * Return the Stats of a file/symlink if it exists, otherwise returns null.\n * Rethrows errors that aren't related to file existence.\n */\n async lstat(filename) {\n try {\n const stats = await this._lstat(filename)\n return stats\n } catch (err) {\n if (err.code === 'ENOENT') {\n return null\n }\n throw err\n }\n }\n\n /**\n * Reads the contents of a symlink if it exists, otherwise returns null.\n * Rethrows errors that aren't related to file existence.\n */\n async readlink(filename, opts = { encoding: 'buffer' }) {\n // Note: FileSystem.readlink returns a buffer by default\n // so we can dump it into GitObject.write just like any other file.\n try {\n const link = await this._readlink(filename, opts)\n return Buffer.isBuffer(link) ? link : Buffer.from(link)\n } catch (err) {\n if (err.code === 'ENOENT') {\n return null\n }\n throw err\n }\n }\n\n /**\n * Write the contents of buffer to a symlink.\n */\n async writelink(filename, buffer) {\n return this._symlink(buffer.toString('utf8'), filename)\n }\n}\n","export class GitPackedRefs {\n constructor(text) {\n this.refs = new Map()\n this.parsedConfig = []\n if (text) {\n let key = null\n this.parsedConfig = text\n .trim()\n .split('\\n')\n .map(line => {\n if (/^\\s*#/.test(line)) {\n return { line, comment: true }\n }\n const i = line.indexOf(' ')\n if (line.startsWith('^')) {\n // This is a oid for the commit associated with the annotated tag immediately preceding this line.\n // Trim off the '^'\n const value = line.slice(1)\n // The tagname^{} syntax is based on the output of `git show-ref --tags -d`\n this.refs.set(key + '^{}', value)\n return { line, ref: key, peeled: value }\n } else {\n // This is an oid followed by the ref name\n const value = line.slice(0, i)\n key = line.slice(i + 1)\n this.refs.set(key, value)\n return { line, ref: key, oid: value }\n }\n })\n }\n return this\n }\n\n static from(text) {\n return new GitPackedRefs(text)\n }\n\n delete(ref) {\n this.parsedConfig = this.parsedConfig.filter(entry => entry.ref !== ref)\n this.refs.delete(ref)\n }\n\n toString() {\n return this.parsedConfig.map(({ line }) => line).join('\\n') + '\\n'\n }\n}\n","export function compareRefNames(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n const _a = a.replace(/\\^\\{\\}$/, '')\n const _b = b.replace(/\\^\\{\\}$/, '')\n const tmp = -(_a < _b) || +(_a > _b)\n if (tmp === 0) {\n return a.endsWith('^{}') ? 1 : -1\n }\n return tmp\n}\n","// This is a convenience wrapper for reading and writing files in the 'refs' directory.\nimport AsyncLock from 'async-lock'\n\nimport { InvalidOidError } from '../errors/InvalidOidError.js'\nimport { NoRefspecError } from '../errors/NoRefspecError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitPackedRefs } from '../models/GitPackedRefs.js'\nimport { GitRefSpecSet } from '../models/GitRefSpecSet.js'\nimport { compareRefNames } from '../utils/compareRefNames.js'\nimport { join } from '../utils/join.js'\n\nimport { GitConfigManager } from './GitConfigManager'\n\n// @see https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions\nconst refpaths = ref => [\n `${ref}`,\n `refs/${ref}`,\n `refs/tags/${ref}`,\n `refs/heads/${ref}`,\n `refs/remotes/${ref}`,\n `refs/remotes/${ref}/HEAD`,\n]\n\n// @see https://git-scm.com/docs/gitrepository-layout\nconst GIT_FILES = ['config', 'description', 'index', 'shallow', 'commondir']\n\nlet lock\n\nasync function acquireLock(ref, callback) {\n if (lock === undefined) lock = new AsyncLock()\n return lock.acquire(ref, callback)\n}\n\nexport class GitRefManager {\n static async updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs,\n symrefs,\n tags,\n refspecs = undefined,\n prune = false,\n pruneTags = false,\n }) {\n // Validate input\n for (const value of refs.values()) {\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new InvalidOidError(value)\n }\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n if (!refspecs) {\n refspecs = await config.getall(`remote.${remote}.fetch`)\n if (refspecs.length === 0) {\n throw new NoRefspecError(remote)\n }\n // There's some interesting behavior with HEAD that doesn't follow the refspec.\n refspecs.unshift(`+HEAD:refs/remotes/${remote}/HEAD`)\n }\n const refspec = GitRefSpecSet.from(refspecs)\n const actualRefsToWrite = new Map()\n // Delete all current tags if the pruneTags argument is true.\n if (pruneTags) {\n const tags = await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: 'refs/tags',\n })\n await GitRefManager.deleteRefs({\n fs,\n gitdir,\n refs: tags.map(tag => `refs/tags/${tag}`),\n })\n }\n // Add all tags if the fetch tags argument is true.\n if (tags) {\n for (const serverRef of refs.keys()) {\n if (serverRef.startsWith('refs/tags') && !serverRef.endsWith('^{}')) {\n // Git's behavior is to only fetch tags that do not conflict with tags already present.\n if (!(await GitRefManager.exists({ fs, gitdir, ref: serverRef }))) {\n // Always use the object id of the tag itself, and not the peeled object id.\n const oid = refs.get(serverRef)\n actualRefsToWrite.set(serverRef, oid)\n }\n }\n }\n }\n // Combine refs and symrefs giving symrefs priority\n const refTranslations = refspec.translate([...refs.keys()])\n for (const [serverRef, translatedRef] of refTranslations) {\n const value = refs.get(serverRef)\n actualRefsToWrite.set(translatedRef, value)\n }\n const symrefTranslations = refspec.translate([...symrefs.keys()])\n for (const [serverRef, translatedRef] of symrefTranslations) {\n const value = symrefs.get(serverRef)\n const symtarget = refspec.translateOne(value)\n if (symtarget) {\n actualRefsToWrite.set(translatedRef, `ref: ${symtarget}`)\n }\n }\n // If `prune` argument is true, clear out the existing local refspec roots\n const pruned = []\n if (prune) {\n for (const filepath of refspec.localNamespaces()) {\n const refs = (\n await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath,\n })\n ).map(file => `${filepath}/${file}`)\n for (const ref of refs) {\n if (!actualRefsToWrite.has(ref)) {\n pruned.push(ref)\n }\n }\n }\n if (pruned.length > 0) {\n await GitRefManager.deleteRefs({ fs, gitdir, refs: pruned })\n }\n }\n // Update files\n // TODO: For large repos with a history of thousands of pull requests\n // (i.e. gitlab-ce) it would be vastly more efficient to write them\n // to .git/packed-refs.\n // The trick is to make sure we a) don't write a packed ref that is\n // already shadowed by a loose ref and b) don't loose any refs already\n // in packed-refs. Doing this efficiently may be difficult. A\n // solution that might work is\n // a) load the current packed-refs file\n // b) add actualRefsToWrite, overriding the existing values if present\n // c) enumerate all the loose refs currently in .git/refs/remotes/${remote}\n // d) overwrite their value with the new value.\n // Examples of refs we need to avoid writing in loose format for efficieny's sake\n // are .git/refs/remotes/origin/refs/remotes/remote_mirror_3059\n // and .git/refs/remotes/origin/refs/merge-requests\n for (const [key, value] of actualRefsToWrite) {\n await acquireLock(key, async () =>\n fs.write(join(gitdir, key), `${value.trim()}\\n`, 'utf8')\n )\n }\n return { pruned }\n }\n\n // TODO: make this less crude?\n static async writeRef({ fs, gitdir, ref, value }) {\n // Validate input\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new InvalidOidError(value)\n }\n await acquireLock(ref, async () =>\n fs.write(join(gitdir, ref), `${value.trim()}\\n`, 'utf8')\n )\n }\n\n static async writeSymbolicRef({ fs, gitdir, ref, value }) {\n await acquireLock(ref, async () =>\n fs.write(join(gitdir, ref), 'ref: ' + `${value.trim()}\\n`, 'utf8')\n )\n }\n\n static async deleteRef({ fs, gitdir, ref }) {\n return GitRefManager.deleteRefs({ fs, gitdir, refs: [ref] })\n }\n\n static async deleteRefs({ fs, gitdir, refs }) {\n // Delete regular ref\n await Promise.all(refs.map(ref => fs.rm(join(gitdir, ref))))\n // Delete any packed ref\n let text = await acquireLock('packed-refs', async () =>\n fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\n )\n const packed = GitPackedRefs.from(text)\n const beforeSize = packed.refs.size\n for (const ref of refs) {\n if (packed.refs.has(ref)) {\n packed.delete(ref)\n }\n }\n if (packed.refs.size < beforeSize) {\n text = packed.toString()\n await acquireLock('packed-refs', async () =>\n fs.write(`${gitdir}/packed-refs`, text, { encoding: 'utf8' })\n )\n }\n }\n\n /**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {number} [args.depth]\n * @returns {Promise}\n */\n static async resolve({ fs, gitdir, ref, depth = undefined }) {\n if (depth !== undefined) {\n depth--\n if (depth === -1) {\n return ref\n }\n }\n\n // Is it a ref pointer?\n if (ref.startsWith('ref: ')) {\n ref = ref.slice('ref: '.length)\n return GitRefManager.resolve({ fs, gitdir, ref, depth })\n }\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return ref\n }\n // We need to alternate between the file system and the packed-refs\n const packedMap = await GitRefManager.packedRefs({ fs, gitdir })\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref).filter(p => !GIT_FILES.includes(p)) // exclude git system files (#709)\n\n for (const ref of allpaths) {\n const sha = await acquireLock(\n ref,\n async () =>\n (await fs.read(`${gitdir}/${ref}`, { encoding: 'utf8' })) ||\n packedMap.get(ref)\n )\n if (sha) {\n return GitRefManager.resolve({ fs, gitdir, ref: sha.trim(), depth })\n }\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async exists({ fs, gitdir, ref }) {\n try {\n await GitRefManager.expand({ fs, gitdir, ref })\n return true\n } catch (err) {\n return false\n }\n }\n\n static async expand({ fs, gitdir, ref }) {\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return ref\n }\n // We need to alternate between the file system and the packed-refs\n const packedMap = await GitRefManager.packedRefs({ fs, gitdir })\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n const refExists = await acquireLock(ref, async () =>\n fs.exists(`${gitdir}/${ref}`)\n )\n if (refExists) return ref\n if (packedMap.has(ref)) return ref\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async expandAgainstMap({ ref, map }) {\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n if (await map.has(ref)) return ref\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static resolveAgainstMap({ ref, fullref = ref, depth = undefined, map }) {\n if (depth !== undefined) {\n depth--\n if (depth === -1) {\n return { fullref, oid: ref }\n }\n }\n // Is it a ref pointer?\n if (ref.startsWith('ref: ')) {\n ref = ref.slice('ref: '.length)\n return GitRefManager.resolveAgainstMap({ ref, fullref, depth, map })\n }\n // Is it a complete and valid SHA?\n if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {\n return { fullref, oid: ref }\n }\n // Look in all the proper paths, in this order\n const allpaths = refpaths(ref)\n for (const ref of allpaths) {\n const sha = map.get(ref)\n if (sha) {\n return GitRefManager.resolveAgainstMap({\n ref: sha.trim(),\n fullref: ref,\n depth,\n map,\n })\n }\n }\n // Do we give up?\n throw new NotFoundError(ref)\n }\n\n static async packedRefs({ fs, gitdir }) {\n const text = await acquireLock('packed-refs', async () =>\n fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\n )\n const packed = GitPackedRefs.from(text)\n return packed.refs\n }\n\n // List all the refs that match the `filepath` prefix\n static async listRefs({ fs, gitdir, filepath }) {\n const packedMap = GitRefManager.packedRefs({ fs, gitdir })\n let files = null\n try {\n files = await fs.readdirDeep(`${gitdir}/${filepath}`)\n files = files.map(x => x.replace(`${gitdir}/${filepath}/`, ''))\n } catch (err) {\n files = []\n }\n\n for (let key of (await packedMap).keys()) {\n // filter by prefix\n if (key.startsWith(filepath)) {\n // remove prefix\n key = key.replace(filepath + '/', '')\n // Don't include duplicates; the loose files have precedence anyway\n if (!files.includes(key)) {\n files.push(key)\n }\n }\n }\n // since we just appended things onto an array, we need to sort them now\n files.sort(compareRefNames)\n return files\n }\n\n static async listBranches({ fs, gitdir, remote }) {\n if (remote) {\n return GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs/remotes/${remote}`,\n })\n } else {\n return GitRefManager.listRefs({ fs, gitdir, filepath: `refs/heads` })\n }\n }\n\n static async listTags({ fs, gitdir }) {\n const tags = await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs/tags`,\n })\n return tags.filter(x => !x.endsWith('^{}'))\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class InternalError extends BaseError {\n /**\n * @param {string} message\n */\n constructor(message) {\n super(\n `An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${message}`\n )\n this.code = this.name = InternalError.code\n this.data = { message }\n }\n}\n/** @type {'InternalError'} */\nInternalError.code = 'InternalError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitObject } from '../models/GitObject.js'\nimport { readObjectLoose } from '../storage/readObjectLoose.js'\nimport { readObjectPacked } from '../storage/readObjectPacked.js'\nimport { inflate } from '../utils/inflate.js'\nimport { shasum } from '../utils/shasum.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.format]\n */\nexport async function _readObject({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n}) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => _readObject({ fs, cache, gitdir, oid })\n\n let result\n // Empty tree - hard-coded so we can use it as a shorthand.\n // Note: I think the canonical git implementation must do this too because\n // `git cat-file -t 4b825dc642cb6eb9a060e54bf8d69288fbee4904` prints \"tree\" even in empty repos.\n if (oid === '4b825dc642cb6eb9a060e54bf8d69288fbee4904') {\n result = { format: 'wrapped', object: Buffer.from(`tree 0\\x00`) }\n }\n // Look for it in the loose object directory.\n if (!result) {\n result = await readObjectLoose({ fs, gitdir, oid })\n }\n // Check to see if it's in a packfile.\n if (!result) {\n result = await readObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n })\n }\n // Finally\n if (!result) {\n throw new NotFoundError(oid)\n }\n\n if (format === 'deflated') {\n return result\n }\n\n if (result.format === 'deflated') {\n result.object = Buffer.from(await inflate(result.object))\n result.format = 'wrapped'\n }\n\n if (result.format === 'wrapped') {\n if (format === 'wrapped' && result.format === 'wrapped') {\n return result\n }\n const sha = await shasum(result.object)\n if (sha !== oid) {\n throw new InternalError(\n `SHA check failed! Expected ${oid}, computed ${sha}`\n )\n }\n const { object, type } = GitObject.unwrap(result.object)\n result.type = type\n result.object = object\n result.format = 'content'\n }\n\n if (result.format === 'content') {\n if (format === 'content') return result\n return\n }\n\n throw new InternalError(`invalid format \"${result.format}\"`)\n}\n","/**\npkt-line Format\n---------------\n\nMuch (but not all) of the payload is described around pkt-lines.\n\nA pkt-line is a variable length binary string. The first four bytes\nof the line, the pkt-len, indicates the total length of the line,\nin hexadecimal. The pkt-len includes the 4 bytes used to contain\nthe length's hexadecimal representation.\n\nA pkt-line MAY contain binary data, so implementers MUST ensure\npkt-line parsing/formatting routines are 8-bit clean.\n\nA non-binary line SHOULD BE terminated by an LF, which if present\nMUST be included in the total length. Receivers MUST treat pkt-lines\nwith non-binary data the same whether or not they contain the trailing\nLF (stripping the LF if present, and not complaining when it is\nmissing).\n\nThe maximum length of a pkt-line's data component is 65516 bytes.\nImplementations MUST NOT send pkt-line whose length exceeds 65520\n(65516 bytes of payload + 4 bytes of length data).\n\nImplementations SHOULD NOT send an empty pkt-line (\"0004\").\n\nA pkt-line with a length field of 0 (\"0000\"), called a flush-pkt,\nis a special case and MUST be handled differently than an empty\npkt-line (\"0004\").\n\n----\n pkt-line = data-pkt / flush-pkt\n\n data-pkt = pkt-len pkt-payload\n pkt-len = 4*(HEXDIG)\n pkt-payload = (pkt-len - 4)*(OCTET)\n\n flush-pkt = \"0000\"\n----\n\nExamples (as C-style strings):\n\n----\n pkt-line actual value\n ---------------------------------\n \"0006a\\n\" \"a\\n\"\n \"0005a\" \"a\"\n \"000bfoobar\\n\" \"foobar\\n\"\n \"0004\" \"\"\n----\n*/\nimport { StreamReader } from '../utils/StreamReader.js'\nimport { padHex } from '../utils/padHex.js'\n\n// I'm really using this more as a namespace.\n// There's not a lot of \"state\" in a pkt-line\n\nexport class GitPktLine {\n static flush() {\n return Buffer.from('0000', 'utf8')\n }\n\n static delim() {\n return Buffer.from('0001', 'utf8')\n }\n\n static encode(line) {\n if (typeof line === 'string') {\n line = Buffer.from(line)\n }\n const length = line.length + 4\n const hexlength = padHex(4, length)\n return Buffer.concat([Buffer.from(hexlength, 'utf8'), line])\n }\n\n static streamReader(stream) {\n const reader = new StreamReader(stream)\n return async function read() {\n try {\n let length = await reader.read(4)\n if (length == null) return true\n length = parseInt(length.toString('utf8'), 16)\n if (length === 0) return null\n if (length === 1) return null // delim packets\n const buffer = await reader.read(length - 4)\n if (buffer == null) return true\n return buffer\n } catch (err) {\n stream.error = err\n return true\n }\n }\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class NotFoundError extends BaseError {\n /**\n * @param {string} what\n */\n constructor(what) {\n super(`Could not find ${what}.`)\n this.code = this.name = NotFoundError.code\n this.data = { what }\n }\n}\n/** @type {'NotFoundError'} */\nNotFoundError.code = 'NotFoundError'\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { UnsafeFilepathError } from '../errors/UnsafeFilepathError.js'\nimport { comparePath } from '../utils/comparePath.js'\nimport { compareTreeEntryPath } from '../utils/compareTreeEntryPath.js'\n\n/**\n *\n * @typedef {Object} TreeEntry\n * @property {string} mode - the 6 digit hexadecimal mode\n * @property {string} path - the name of the file or directory\n * @property {string} oid - the SHA-1 object id of the blob or tree\n * @property {'commit'|'blob'|'tree'} type - the type of object\n */\n\nfunction mode2type(mode) {\n // prettier-ignore\n switch (mode) {\n case '040000': return 'tree'\n case '100644': return 'blob'\n case '100755': return 'blob'\n case '120000': return 'blob'\n case '160000': return 'commit'\n }\n throw new InternalError(`Unexpected GitTree entry mode: ${mode}`)\n}\n\nfunction parseBuffer(buffer) {\n const _entries = []\n let cursor = 0\n while (cursor < buffer.length) {\n const space = buffer.indexOf(32, cursor)\n if (space === -1) {\n throw new InternalError(\n `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next space character.`\n )\n }\n const nullchar = buffer.indexOf(0, cursor)\n if (nullchar === -1) {\n throw new InternalError(\n `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next null character.`\n )\n }\n let mode = buffer.slice(cursor, space).toString('utf8')\n if (mode === '40000') mode = '040000' // makes it line up neater in printed output\n const type = mode2type(mode)\n const path = buffer.slice(space + 1, nullchar).toString('utf8')\n\n // Prevent malicious git repos from writing to \"..\\foo\" on clone etc\n if (path.includes('\\\\') || path.includes('/')) {\n throw new UnsafeFilepathError(path)\n }\n\n const oid = buffer.slice(nullchar + 1, nullchar + 21).toString('hex')\n cursor = nullchar + 21\n _entries.push({ mode, path, oid, type })\n }\n return _entries\n}\n\nfunction limitModeToAllowed(mode) {\n if (typeof mode === 'number') {\n mode = mode.toString(8)\n }\n // tree\n if (mode.match(/^0?4.*/)) return '040000' // Directory\n if (mode.match(/^1006.*/)) return '100644' // Regular non-executable file\n if (mode.match(/^1007.*/)) return '100755' // Regular executable file\n if (mode.match(/^120.*/)) return '120000' // Symbolic link\n if (mode.match(/^160.*/)) return '160000' // Commit (git submodule reference)\n throw new InternalError(`Could not understand file mode: ${mode}`)\n}\n\nfunction nudgeIntoShape(entry) {\n if (!entry.oid && entry.sha) {\n entry.oid = entry.sha // Github\n }\n entry.mode = limitModeToAllowed(entry.mode) // index\n if (!entry.type) {\n entry.type = mode2type(entry.mode) // index\n }\n return entry\n}\n\nexport class GitTree {\n constructor(entries) {\n if (Buffer.isBuffer(entries)) {\n this._entries = parseBuffer(entries)\n } else if (Array.isArray(entries)) {\n this._entries = entries.map(nudgeIntoShape)\n } else {\n throw new InternalError('invalid type passed to GitTree constructor')\n }\n // Tree entries are not sorted alphabetically in the usual sense (see `compareTreeEntryPath`)\n // but it is important later on that these be sorted in the same order as they would be returned from readdir.\n this._entries.sort(comparePath)\n }\n\n static from(tree) {\n return new GitTree(tree)\n }\n\n render() {\n return this._entries\n .map(entry => `${entry.mode} ${entry.type} ${entry.oid} ${entry.path}`)\n .join('\\n')\n }\n\n toObject() {\n // Adjust the sort order to match git's\n const entries = [...this._entries]\n entries.sort(compareTreeEntryPath)\n return Buffer.concat(\n entries.map(entry => {\n const mode = Buffer.from(entry.mode.replace(/^0/, ''))\n const space = Buffer.from(' ')\n const path = Buffer.from(entry.path, 'utf8')\n const nullchar = Buffer.from([0])\n const oid = Buffer.from(entry.oid, 'hex')\n return Buffer.concat([mode, space, path, nullchar, oid])\n })\n )\n }\n\n /**\n * @returns {TreeEntry[]}\n */\n entries() {\n return this._entries\n }\n\n *[Symbol.iterator]() {\n for (const entry of this._entries) {\n yield entry\n }\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { formatAuthor } from '../utils/formatAuthor.js'\nimport { indent } from '../utils/indent.js'\nimport { normalizeNewlines } from '../utils/normalizeNewlines.js'\nimport { outdent } from '../utils/outdent.js'\nimport { parseAuthor } from '../utils/parseAuthor.js'\n\nexport class GitCommit {\n constructor(commit) {\n if (typeof commit === 'string') {\n this._commit = commit\n } else if (Buffer.isBuffer(commit)) {\n this._commit = commit.toString('utf8')\n } else if (typeof commit === 'object') {\n this._commit = GitCommit.render(commit)\n } else {\n throw new InternalError('invalid type passed to GitCommit constructor')\n }\n }\n\n static fromPayloadSignature({ payload, signature }) {\n const headers = GitCommit.justHeaders(payload)\n const message = GitCommit.justMessage(payload)\n const commit = normalizeNewlines(\n headers + '\\ngpgsig' + indent(signature) + '\\n' + message\n )\n return new GitCommit(commit)\n }\n\n static from(commit) {\n return new GitCommit(commit)\n }\n\n toObject() {\n return Buffer.from(this._commit, 'utf8')\n }\n\n // Todo: allow setting the headers and message\n headers() {\n return this.parseHeaders()\n }\n\n // Todo: allow setting the headers and message\n message() {\n return GitCommit.justMessage(this._commit)\n }\n\n parse() {\n return Object.assign({ message: this.message() }, this.headers())\n }\n\n static justMessage(commit) {\n return normalizeNewlines(commit.slice(commit.indexOf('\\n\\n') + 2))\n }\n\n static justHeaders(commit) {\n return commit.slice(0, commit.indexOf('\\n\\n'))\n }\n\n parseHeaders() {\n const headers = GitCommit.justHeaders(this._commit).split('\\n')\n const hs = []\n for (const h of headers) {\n if (h[0] === ' ') {\n // combine with previous header (without space indent)\n hs[hs.length - 1] += '\\n' + h.slice(1)\n } else {\n hs.push(h)\n }\n }\n const obj = {\n parent: [],\n }\n for (const h of hs) {\n const key = h.slice(0, h.indexOf(' '))\n const value = h.slice(h.indexOf(' ') + 1)\n if (Array.isArray(obj[key])) {\n obj[key].push(value)\n } else {\n obj[key] = value\n }\n }\n if (obj.author) {\n obj.author = parseAuthor(obj.author)\n }\n if (obj.committer) {\n obj.committer = parseAuthor(obj.committer)\n }\n return obj\n }\n\n static renderHeaders(obj) {\n let headers = ''\n if (obj.tree) {\n headers += `tree ${obj.tree}\\n`\n } else {\n headers += `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\\n` // the null tree\n }\n if (obj.parent) {\n if (obj.parent.length === undefined) {\n throw new InternalError(`commit 'parent' property should be an array`)\n }\n for (const p of obj.parent) {\n headers += `parent ${p}\\n`\n }\n }\n const author = obj.author\n headers += `author ${formatAuthor(author)}\\n`\n const committer = obj.committer || obj.author\n headers += `committer ${formatAuthor(committer)}\\n`\n if (obj.gpgsig) {\n headers += 'gpgsig' + indent(obj.gpgsig)\n }\n return headers\n }\n\n static render(obj) {\n return GitCommit.renderHeaders(obj) + '\\n' + normalizeNewlines(obj.message)\n }\n\n render() {\n return this._commit\n }\n\n withoutSignature() {\n const commit = normalizeNewlines(this._commit)\n if (commit.indexOf('\\ngpgsig') === -1) return commit\n const headers = commit.slice(0, commit.indexOf('\\ngpgsig'))\n const message = commit.slice(\n commit.indexOf('-----END PGP SIGNATURE-----\\n') +\n '-----END PGP SIGNATURE-----\\n'.length\n )\n return normalizeNewlines(headers + '\\n' + message)\n }\n\n isolateSignature() {\n const signature = this._commit.slice(\n this._commit.indexOf('-----BEGIN PGP SIGNATURE-----'),\n this._commit.indexOf('-----END PGP SIGNATURE-----') +\n '-----END PGP SIGNATURE-----'.length\n )\n return outdent(signature)\n }\n\n static async sign(commit, sign, secretKey) {\n const payload = commit.withoutSignature()\n const message = GitCommit.justMessage(commit._commit)\n let { signature } = await sign({ payload, secretKey })\n // renormalize the line endings to the one true line-ending\n signature = normalizeNewlines(signature)\n const headers = GitCommit.justHeaders(commit._commit)\n const signedCommit =\n headers + '\\n' + 'gpgsig' + indent(signature) + '\\n' + message\n // return a new commit object\n return GitCommit.from(signedCommit)\n }\n}\n","// import LockManager from 'travix-lock-manager'\nimport AsyncLock from 'async-lock'\n\nimport { UnmergedPathsError } from '../errors/UnmergedPathsError.js'\nimport { GitIndex } from '../models/GitIndex.js'\nimport { compareStats } from '../utils/compareStats.js'\n\n// import Lock from '../utils.js'\n\n// const lm = new LockManager()\nlet lock = null\n\nconst IndexCache = Symbol('IndexCache')\n\nfunction createCache() {\n return {\n map: new Map(),\n stats: new Map(),\n }\n}\n\nasync function updateCachedIndexFile(fs, filepath, cache) {\n const stat = await fs.lstat(filepath)\n const rawIndexFile = await fs.read(filepath)\n const index = await GitIndex.from(rawIndexFile)\n // cache the GitIndex object so we don't need to re-read it every time.\n cache.map.set(filepath, index)\n // Save the stat data for the index so we know whether the cached file is stale (modified by an outside process).\n cache.stats.set(filepath, stat)\n}\n\n// Determine whether our copy of the index file is stale\nasync function isIndexStale(fs, filepath, cache) {\n const savedStats = cache.stats.get(filepath)\n if (savedStats === undefined) return true\n const currStats = await fs.lstat(filepath)\n if (savedStats === null) return false\n if (currStats === null) return false\n return compareStats(savedStats, currStats)\n}\n\nexport class GitIndexManager {\n /**\n *\n * @param {object} opts\n * @param {import('../models/FileSystem.js').FileSystem} opts.fs\n * @param {string} opts.gitdir\n * @param {object} opts.cache\n * @param {bool} opts.allowUnmerged\n * @param {function(GitIndex): any} closure\n */\n static async acquire({ fs, gitdir, cache, allowUnmerged = true }, closure) {\n if (!cache[IndexCache]) cache[IndexCache] = createCache()\n\n const filepath = `${gitdir}/index`\n if (lock === null) lock = new AsyncLock({ maxPending: Infinity })\n let result\n let unmergedPaths = []\n await lock.acquire(filepath, async () => {\n // Acquire a file lock while we're reading the index\n // to make sure other processes aren't writing to it\n // simultaneously, which could result in a corrupted index.\n // const fileLock = await Lock(filepath)\n if (await isIndexStale(fs, filepath, cache[IndexCache])) {\n await updateCachedIndexFile(fs, filepath, cache[IndexCache])\n }\n const index = cache[IndexCache].map.get(filepath)\n unmergedPaths = index.unmergedPaths\n\n if (unmergedPaths.length && !allowUnmerged)\n throw new UnmergedPathsError(unmergedPaths)\n\n result = await closure(index)\n if (index._dirty) {\n // Acquire a file lock while we're writing the index file\n // let fileLock = await Lock(filepath)\n const buffer = await index.toObject()\n await fs.write(filepath, buffer)\n // Update cached stat value\n cache[IndexCache].stats.set(filepath, await fs.lstat(filepath))\n index._dirty = false\n }\n })\n\n return result\n }\n}\n","import { GitConfig } from '../models/GitConfig.js'\n\nexport class GitConfigManager {\n static async get({ fs, gitdir }) {\n // We can improve efficiency later if needed.\n // TODO: read from full list of git config files\n const text = await fs.read(`${gitdir}/config`, { encoding: 'utf8' })\n return GitConfig.from(text)\n }\n\n static async save({ fs, gitdir, config }) {\n // We can improve efficiency later if needed.\n // TODO: handle saving to the correct global/user/repo location\n await fs.write(`${gitdir}/config`, config.toString(), {\n encoding: 'utf8',\n })\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class ObjectTypeError extends BaseError {\n /**\n * @param {string} oid\n * @param {'blob'|'commit'|'tag'|'tree'} actual\n * @param {'blob'|'commit'|'tag'|'tree'} expected\n * @param {string} [filepath]\n */\n constructor(oid, actual, expected, filepath) {\n super(\n `Object ${oid} ${\n filepath ? `at ${filepath}` : ''\n }was anticipated to be a ${expected} but it is a ${actual}.`\n )\n this.code = this.name = ObjectTypeError.code\n this.data = { oid, actual, expected, filepath }\n }\n}\n/** @type {'ObjectTypeError'} */\nObjectTypeError.code = 'ObjectTypeError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { formatAuthor } from '../utils/formatAuthor.js'\nimport { normalizeNewlines } from '../utils/normalizeNewlines.js'\nimport { parseAuthor } from '../utils/parseAuthor.js'\n\nexport class GitAnnotatedTag {\n constructor(tag) {\n if (typeof tag === 'string') {\n this._tag = tag\n } else if (Buffer.isBuffer(tag)) {\n this._tag = tag.toString('utf8')\n } else if (typeof tag === 'object') {\n this._tag = GitAnnotatedTag.render(tag)\n } else {\n throw new InternalError(\n 'invalid type passed to GitAnnotatedTag constructor'\n )\n }\n }\n\n static from(tag) {\n return new GitAnnotatedTag(tag)\n }\n\n static render(obj) {\n return `object ${obj.object}\ntype ${obj.type}\ntag ${obj.tag}\ntagger ${formatAuthor(obj.tagger)}\n\n${obj.message}\n${obj.gpgsig ? obj.gpgsig : ''}`\n }\n\n justHeaders() {\n return this._tag.slice(0, this._tag.indexOf('\\n\\n'))\n }\n\n message() {\n const tag = this.withoutSignature()\n return tag.slice(tag.indexOf('\\n\\n') + 2)\n }\n\n parse() {\n return Object.assign(this.headers(), {\n message: this.message(),\n gpgsig: this.gpgsig(),\n })\n }\n\n render() {\n return this._tag\n }\n\n headers() {\n const headers = this.justHeaders().split('\\n')\n const hs = []\n for (const h of headers) {\n if (h[0] === ' ') {\n // combine with previous header (without space indent)\n hs[hs.length - 1] += '\\n' + h.slice(1)\n } else {\n hs.push(h)\n }\n }\n const obj = {}\n for (const h of hs) {\n const key = h.slice(0, h.indexOf(' '))\n const value = h.slice(h.indexOf(' ') + 1)\n if (Array.isArray(obj[key])) {\n obj[key].push(value)\n } else {\n obj[key] = value\n }\n }\n if (obj.tagger) {\n obj.tagger = parseAuthor(obj.tagger)\n }\n if (obj.committer) {\n obj.committer = parseAuthor(obj.committer)\n }\n return obj\n }\n\n withoutSignature() {\n const tag = normalizeNewlines(this._tag)\n if (tag.indexOf('\\n-----BEGIN PGP SIGNATURE-----') === -1) return tag\n return tag.slice(0, tag.lastIndexOf('\\n-----BEGIN PGP SIGNATURE-----'))\n }\n\n gpgsig() {\n if (this._tag.indexOf('\\n-----BEGIN PGP SIGNATURE-----') === -1) return\n const signature = this._tag.slice(\n this._tag.indexOf('-----BEGIN PGP SIGNATURE-----'),\n this._tag.indexOf('-----END PGP SIGNATURE-----') +\n '-----END PGP SIGNATURE-----'.length\n )\n return normalizeNewlines(signature)\n }\n\n payload() {\n return this.withoutSignature() + '\\n'\n }\n\n toObject() {\n return Buffer.from(this._tag, 'utf8')\n }\n\n static async sign(tag, sign, secretKey) {\n const payload = tag.payload()\n let { signature } = await sign({ payload, secretKey })\n // renormalize the line endings to the one true line-ending\n signature = normalizeNewlines(signature)\n const signedTag = payload + signature\n // return a new tag object\n return GitAnnotatedTag.from(signedTag)\n }\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { writeObjectLoose } from '../storage/writeObjectLoose.js'\nimport { deflate } from '../utils/deflate.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function _writeObject({\n fs,\n gitdir,\n type,\n object,\n format = 'content',\n oid = undefined,\n dryRun = false,\n}) {\n if (format !== 'deflated') {\n if (format !== 'wrapped') {\n object = GitObject.wrap({ type, object })\n }\n oid = await shasum(object)\n object = Buffer.from(await deflate(object))\n }\n if (!dryRun) {\n await writeObjectLoose({ fs, gitdir, object, format: 'deflated', oid })\n }\n return oid\n}\n","export function toHex(buffer) {\n let hex = ''\n for (const byte of new Uint8Array(buffer)) {\n if (byte < 16) hex += '0'\n hex += byte.toString(16)\n }\n return hex\n}\n","/* eslint-env node, browser */\nimport Hash from 'sha.js/sha1.js'\n\nimport { toHex } from './toHex.js'\n\nlet supportsSubtleSHA1 = null\n\nexport async function shasum(buffer) {\n if (supportsSubtleSHA1 === null) {\n supportsSubtleSHA1 = await testSubtleSHA1()\n }\n return supportsSubtleSHA1 ? subtleSHA1(buffer) : shasumSync(buffer)\n}\n\n// This is modeled after @dominictarr's \"shasum\" module,\n// but without the 'json-stable-stringify' dependency and\n// extra type-casting features.\nfunction shasumSync(buffer) {\n return new Hash().update(buffer).digest('hex')\n}\n\nasync function subtleSHA1(buffer) {\n const hash = await crypto.subtle.digest('SHA-1', buffer)\n return toHex(hash)\n}\n\nasync function testSubtleSHA1() {\n // I'm using a rather crude method of progressive enhancement, because\n // some browsers that have crypto.subtle.digest don't actually implement SHA-1.\n try {\n const hash = await subtleSHA1(new Uint8Array([]))\n if (hash === 'da39a3ee5e6b4b0d3255bfef95601890afd80709') return true\n } catch (_) {\n // no bother\n }\n return false\n}\n","// Modeled after https://github.com/tjfontaine/node-buffercursor\n// but with the goal of being much lighter weight.\nexport class BufferCursor {\n constructor(buffer) {\n this.buffer = buffer\n this._start = 0\n }\n\n eof() {\n return this._start >= this.buffer.length\n }\n\n tell() {\n return this._start\n }\n\n seek(n) {\n this._start = n\n }\n\n slice(n) {\n const r = this.buffer.slice(this._start, this._start + n)\n this._start += n\n return r\n }\n\n toString(enc, length) {\n const r = this.buffer.toString(enc, this._start, this._start + length)\n this._start += length\n return r\n }\n\n write(value, length, enc) {\n const r = this.buffer.write(value, this._start, length, enc)\n this._start += length\n return r\n }\n\n copy(source, start, end) {\n const r = source.copy(this.buffer, this._start, start, end)\n this._start += r\n return r\n }\n\n readUInt8() {\n const r = this.buffer.readUInt8(this._start)\n this._start += 1\n return r\n }\n\n writeUInt8(value) {\n const r = this.buffer.writeUInt8(value, this._start)\n this._start += 1\n return r\n }\n\n readUInt16BE() {\n const r = this.buffer.readUInt16BE(this._start)\n this._start += 2\n return r\n }\n\n writeUInt16BE(value) {\n const r = this.buffer.writeUInt16BE(value, this._start)\n this._start += 2\n return r\n }\n\n readUInt32BE() {\n const r = this.buffer.readUInt32BE(this._start)\n this._start += 4\n return r\n }\n\n writeUInt32BE(value) {\n const r = this.buffer.writeUInt32BE(value, this._start)\n this._start += 4\n return r\n }\n}\n","export function normalizeNewlines(str) {\n // remove all \n str = str.replace(/\\r/g, '')\n // no extra newlines up front\n str = str.replace(/^\\n+/, '')\n // and a single newline at the end\n str = str.replace(/\\n+$/, '') + '\\n'\n return str\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MissingNameError extends BaseError {\n /**\n * @param {'author'|'committer'|'tagger'} role\n */\n constructor(role) {\n super(\n `No name was provided for ${role} in the argument or in the .git/config file.`\n )\n this.code = this.name = MissingNameError.code\n this.data = { role }\n }\n}\n/** @type {'MissingNameError'} */\nMissingNameError.code = 'MissingNameError'\n","import { InternalError } from '../errors/InternalError.js'\n\nexport class GitObject {\n static wrap({ type, object }) {\n return Buffer.concat([\n Buffer.from(`${type} ${object.byteLength.toString()}\\x00`),\n Buffer.from(object),\n ])\n }\n\n static unwrap(buffer) {\n const s = buffer.indexOf(32) // first space\n const i = buffer.indexOf(0) // first null value\n const type = buffer.slice(0, s).toString('utf8') // get type of object\n const length = buffer.slice(s + 1, i).toString('utf8') // get type of object\n const actualLength = buffer.length - (i + 1)\n // verify length\n if (parseInt(length) !== actualLength) {\n throw new InternalError(\n `Length mismatch: expected ${length} bytes but got ${actualLength} instead.`\n )\n }\n return {\n type,\n object: Buffer.from(buffer.slice(i + 1)),\n }\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MissingParameterError extends BaseError {\n /**\n * @param {string} parameter\n */\n constructor(parameter) {\n super(\n `The function requires a \"${parameter}\" parameter but none was provided.`\n )\n this.code = this.name = MissingParameterError.code\n this.data = { parameter }\n }\n}\n/** @type {'MissingParameterError'} */\nMissingParameterError.code = 'MissingParameterError'\n","import { BaseError } from './BaseError.js'\n\nexport class AlreadyExistsError extends BaseError {\n /**\n * @param {'note'|'remote'|'tag'|'branch'} noun\n * @param {string} where\n * @param {boolean} canForce\n */\n constructor(noun, where, canForce = true) {\n super(\n `Failed to create ${noun} at ${where} because it already exists.${\n canForce\n ? ` (Hint: use 'force: true' parameter to overwrite existing ${noun}.)`\n : ''\n }`\n )\n this.code = this.name = AlreadyExistsError.code\n this.data = { noun, where, canForce }\n }\n}\n/** @type {'AlreadyExistsError'} */\nAlreadyExistsError.code = 'AlreadyExistsError'\n","export function dirname(path) {\n const last = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\\\'))\n if (last === -1) return '.'\n if (last === 0) return '/'\n return path.slice(0, last)\n}\n","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidOidError extends BaseError {\n /**\n * @param {string} value\n */\n constructor(value) {\n super(`Expected a 40-char hex object id but saw \"${value}\".`)\n this.code = this.name = InvalidOidError.code\n this.data = { value }\n }\n}\n/** @type {'InvalidOidError'} */\nInvalidOidError.code = 'InvalidOidError'\n","import { normalizeMode } from './normalizeMode'\n\nconst MAX_UINT32 = 2 ** 32\n\nfunction SecondsNanoseconds(\n givenSeconds,\n givenNanoseconds,\n milliseconds,\n date\n) {\n if (givenSeconds !== undefined && givenNanoseconds !== undefined) {\n return [givenSeconds, givenNanoseconds]\n }\n if (milliseconds === undefined) {\n milliseconds = date.valueOf()\n }\n const seconds = Math.floor(milliseconds / 1000)\n const nanoseconds = (milliseconds - seconds * 1000) * 1000000\n return [seconds, nanoseconds]\n}\n\nexport function normalizeStats(e) {\n const [ctimeSeconds, ctimeNanoseconds] = SecondsNanoseconds(\n e.ctimeSeconds,\n e.ctimeNanoseconds,\n e.ctimeMs,\n e.ctime\n )\n const [mtimeSeconds, mtimeNanoseconds] = SecondsNanoseconds(\n e.mtimeSeconds,\n e.mtimeNanoseconds,\n e.mtimeMs,\n e.mtime\n )\n\n return {\n ctimeSeconds: ctimeSeconds % MAX_UINT32,\n ctimeNanoseconds: ctimeNanoseconds % MAX_UINT32,\n mtimeSeconds: mtimeSeconds % MAX_UINT32,\n mtimeNanoseconds: mtimeNanoseconds % MAX_UINT32,\n dev: e.dev % MAX_UINT32,\n ino: e.ino % MAX_UINT32,\n mode: normalizeMode(e.mode % MAX_UINT32),\n uid: e.uid % MAX_UINT32,\n gid: e.gid % MAX_UINT32,\n // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers\n // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat\n size: e.size > -1 ? e.size % MAX_UINT32 : 0,\n }\n}\n","import { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join'\nimport { normalizeMode } from '../utils/normalizeMode.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\nexport class GitWalkerRepo {\n constructor({ fs, gitdir, ref, cache }) {\n this.fs = fs\n this.cache = cache\n this.gitdir = gitdir\n this.mapPromise = (async () => {\n const map = new Map()\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref })\n } catch (e) {\n if (e instanceof NotFoundError) {\n // Handle fresh branches with no commits\n oid = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'\n }\n }\n const tree = await resolveTree({ fs, cache: this.cache, gitdir, oid })\n tree.type = 'tree'\n tree.mode = '40000'\n map.set('.', tree)\n return map\n })()\n const walker = this\n this.ConstructEntry = class TreeEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._content = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const { fs, cache, gitdir } = this\n const map = await this.mapPromise\n const obj = map.get(filepath)\n if (!obj) throw new Error(`No obj for ${filepath}`)\n const oid = obj.oid\n if (!oid) throw new Error(`No oid for obj ${JSON.stringify(obj)}`)\n if (obj.type !== 'tree') {\n // TODO: support submodules (type === 'commit')\n return null\n }\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type !== obj.type) {\n throw new ObjectTypeError(oid, type, obj.type)\n }\n const tree = GitTree.from(object)\n // cache all entries\n for (const entry of tree) {\n map.set(join(filepath, entry.path), entry)\n }\n return tree.entries().map(entry => join(filepath, entry.path))\n }\n\n async type(entry) {\n if (entry._type === false) {\n const map = await this.mapPromise\n const { type } = map.get(entry._fullpath)\n entry._type = type\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n const map = await this.mapPromise\n const { mode } = map.get(entry._fullpath)\n entry._mode = normalizeMode(parseInt(mode, 8))\n }\n return entry._mode\n }\n\n async stat(_entry) {}\n\n async content(entry) {\n if (entry._content === false) {\n const map = await this.mapPromise\n const { fs, cache, gitdir } = this\n const obj = map.get(entry._fullpath)\n const oid = obj.oid\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type !== 'blob') {\n entry._content = undefined\n } else {\n entry._content = new Uint8Array(object)\n }\n }\n return entry._content\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const map = await this.mapPromise\n const obj = map.get(entry._fullpath)\n entry._oid = obj.oid\n }\n return entry._oid\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerRepo } from '../models/GitWalkerRepo.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @param {object} args\n * @param {string} [args.ref='HEAD']\n * @returns {Walker}\n */\nexport function TREE({ ref = 'HEAD' } = {}) {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, gitdir, cache }) {\n return new GitWalkerRepo({ fs, gitdir, ref, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","import { BaseError } from './BaseError.js'\n\nexport class ParseError extends BaseError {\n /**\n * @param {string} expected\n * @param {string} actual\n */\n constructor(expected, actual) {\n super(`Expected \"${expected}\" but received \"${actual}\".`)\n this.code = this.name = ParseError.code\n this.data = { expected, actual }\n }\n}\n/** @type {'ParseError'} */\nParseError.code = 'ParseError'\n","// This is part of an elaborate system to facilitate code-splitting / tree-shaking.\n// commands/walk.js can depend on only this, and the actual Walker classes exported\n// can be opaque - only having a single property (this symbol) that is not enumerable,\n// and thus the constructor can be passed as an argument to walk while being \"unusable\"\n// outside of it.\nexport const GitWalkSymbol = Symbol('GitWalkSymbol')\n","export function compareStrings(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n return -(a < b) || +(a > b)\n}\n","import { getIterator } from './getIterator.js'\n\n// Currently 'for await' upsets my linters.\nexport async function forAwait(iterable, cb) {\n const iter = getIterator(iterable)\n while (true) {\n const { value, done } = await iter.next()\n if (value) await cb(value)\n if (done) break\n }\n if (iter.return) iter.return()\n}\n","'use strict';\nmodule.exports = require('./lib');\n","export function basename(path) {\n const last = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\\\'))\n if (last > -1) {\n path = path.slice(last + 1)\n }\n return path\n}\n","// https://dev.to/namirsab/comment/2050\nexport function arrayRange(start, end) {\n const length = end - start\n return Array.from({ length }, (_, i) => start + i)\n}\n","// This is convenient for computing unions/joins of sorted lists.\nexport class RunningMinimum {\n constructor() {\n // Using a getter for 'value' would just bloat the code.\n // You know better than to set it directly right?\n this.value = null\n }\n\n consider(value) {\n if (value === null || value === undefined) return\n if (this.value === null) {\n this.value = value\n } else if (value < this.value) {\n this.value = value\n }\n }\n\n reset() {\n this.value = null\n }\n}\n","import { RunningMinimum } from '../models/RunningMinimum'\n\n// Take an array of length N of\n// iterators of length Q_n\n// of strings\n// and return an iterator of length max(Q_n) for all n\n// of arrays of length N\n// of string|null who all have the same string value\nexport function* unionOfIterators(sets) {\n /* NOTE: We can assume all arrays are sorted.\n * Indexes are sorted because they are defined that way:\n *\n * > Index entries are sorted in ascending order on the name field,\n * > interpreted as a string of unsigned bytes (i.e. memcmp() order, no\n * > localization, no special casing of directory separator '/'). Entries\n * > with the same name are sorted by their stage field.\n *\n * Trees should be sorted because they are created directly from indexes.\n * They definitely should be sorted, or else they wouldn't have a unique SHA1.\n * So that would be very naughty on the part of the tree-creator.\n *\n * Lastly, the working dir entries are sorted because I choose to sort them\n * in my FileSystem.readdir() implementation.\n */\n\n // Init\n const min = new RunningMinimum()\n let minimum\n const heads = []\n const numsets = sets.length\n for (let i = 0; i < numsets; i++) {\n // Abuse the fact that iterators continue to return 'undefined' for value\n // once they are done\n heads[i] = sets[i].next().value\n if (heads[i] !== undefined) {\n min.consider(heads[i])\n }\n }\n if (min.value === null) return\n // Iterate\n while (true) {\n const result = []\n minimum = min.value\n min.reset()\n for (let i = 0; i < numsets; i++) {\n if (heads[i] !== undefined && heads[i] === minimum) {\n result[i] = heads[i]\n heads[i] = sets[i].next().value\n } else {\n // A little hacky, but eh\n result[i] = null\n }\n if (heads[i] !== undefined) {\n min.consider(heads[i])\n }\n }\n yield result\n if (min.value === null) return\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { arrayRange } from '../utils/arrayRange.js'\nimport { flat } from '../utils/flat.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\nimport { unionOfIterators } from '../utils/unionOfIterators.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} [args.dir]\n * @param {string} [args.gitdir=join(dir,'.git')]\n * @param {Walker[]} args.trees\n * @param {WalkerMap} [args.map]\n * @param {WalkerReduce} [args.reduce]\n * @param {WalkerIterate} [args.iterate]\n *\n * @returns {Promise} The finished tree-walking result\n *\n * @see {WalkerMap}\n *\n */\nexport async function _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees,\n // @ts-ignore\n map = async (_, entry) => entry,\n // The default reducer is a flatmap that filters out undefineds.\n reduce = async (parent, children) => {\n const flatten = flat(children)\n if (parent !== undefined) flatten.unshift(parent)\n return flatten\n },\n // The default iterate function walks all children concurrently\n iterate = (walk, children) => Promise.all([...children].map(walk)),\n}) {\n const walkers = trees.map(proxy =>\n proxy[GitWalkSymbol]({ fs, dir, gitdir, cache })\n )\n\n const root = new Array(walkers.length).fill('.')\n const range = arrayRange(0, walkers.length)\n const unionWalkerFromReaddir = async entries => {\n range.map(i => {\n entries[i] = entries[i] && new walkers[i].ConstructEntry(entries[i])\n })\n const subdirs = await Promise.all(\n range.map(i => (entries[i] ? walkers[i].readdir(entries[i]) : []))\n )\n // Now process child directories\n const iterators = subdirs\n .map(array => (array === null ? [] : array))\n .map(array => array[Symbol.iterator]())\n return {\n entries,\n children: unionOfIterators(iterators),\n }\n }\n\n const walk = async root => {\n const { entries, children } = await unionWalkerFromReaddir(root)\n const fullpath = entries.find(entry => entry && entry._fullpath)._fullpath\n const parent = await map(fullpath, entries)\n if (parent !== null) {\n let walkedChildren = await iterate(walk, children)\n walkedChildren = walkedChildren.filter(x => x !== undefined)\n return reduce(parent, walkedChildren)\n }\n }\n return walk(root)\n}\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidRefNameError extends BaseError {\n /**\n * @param {string} ref\n * @param {string} suggestion\n * @param {boolean} canForce\n */\n constructor(ref, suggestion) {\n super(\n `\"${ref}\" would be an invalid git reference. (Hint: a valid alternative would be \"${suggestion}\".)`\n )\n this.code = this.name = InvalidRefNameError.code\n this.data = { ref, suggestion }\n }\n}\n/** @type {'InvalidRefNameError'} */\nInvalidRefNameError.code = 'InvalidRefNameError'\n","import AsyncLock from 'async-lock'\n\nimport { join } from '../utils/join.js'\n\nlet lock = null\n\nexport class GitShallowManager {\n static async read({ fs, gitdir }) {\n if (lock === null) lock = new AsyncLock()\n const filepath = join(gitdir, 'shallow')\n const oids = new Set()\n await lock.acquire(filepath, async function() {\n const text = await fs.read(filepath, { encoding: 'utf8' })\n if (text === null) return oids // no file\n if (text.trim() === '') return oids // empty file\n text\n .trim()\n .split('\\n')\n .map(oid => oids.add(oid))\n })\n return oids\n }\n\n static async write({ fs, gitdir, oids }) {\n if (lock === null) lock = new AsyncLock()\n const filepath = join(gitdir, 'shallow')\n if (oids.size > 0) {\n const text = [...oids].join('\\n') + '\\n'\n await lock.acquire(filepath, async function() {\n await fs.write(filepath, text, {\n encoding: 'utf8',\n })\n })\n } else {\n // No shallows\n await lock.acquire(filepath, async function() {\n await fs.rm(filepath)\n })\n }\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {boolean} [args.fullname = false] - Return the full path (e.g. \"refs/heads/main\") instead of the abbreviated form.\n * @param {boolean} [args.test = false] - If the current branch doesn't actually exist (such as right after git init) then return `undefined`.\n *\n * @returns {Promise} The name of the current branch or undefined if the HEAD is detached.\n *\n */\nexport async function _currentBranch({\n fs,\n gitdir,\n fullname = false,\n test = false,\n}) {\n const ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2,\n })\n if (test) {\n try {\n await GitRefManager.resolve({ fs, gitdir, ref })\n } catch (_) {\n return\n }\n }\n // Return `undefined` for detached HEAD\n if (!ref.startsWith('refs/')) return\n return fullname ? ref : abbreviateRef(ref)\n}\n","'use strict';\n\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str, search, replacement) {\n search = search instanceof RegExp ? search : new RegExp(escapeRegExp(search), 'g');\n\n return str.replace(search, replacement);\n}\n\nvar CleanGitRef = {\n clean: function clean(value) {\n if (typeof value !== 'string') {\n throw new Error('Expected a string, received: ' + value);\n }\n\n value = replaceAll(value, './', '/');\n value = replaceAll(value, '..', '.');\n value = replaceAll(value, ' ', '-');\n value = replaceAll(value, /^[~^:?*\\\\\\-]/g, '');\n value = replaceAll(value, /[~^:?*\\\\]/g, '-');\n value = replaceAll(value, /[~^:?*\\\\\\-]$/g, '');\n value = replaceAll(value, '@{', '-');\n value = replaceAll(value, /\\.$/g, '');\n value = replaceAll(value, /\\/$/g, '');\n value = replaceAll(value, /\\.lock$/g, '');\n return value;\n }\n};\n\nmodule.exports = CleanGitRef;","import { BaseError } from './BaseError.js'\n\nexport class UnsafeFilepathError extends BaseError {\n /**\n * @param {string} filepath\n */\n constructor(filepath) {\n super(`The filepath \"${filepath}\" contains unsafe character sequences`)\n this.code = this.name = UnsafeFilepathError.code\n this.data = { filepath }\n }\n}\n/** @type {'UnsafeFilepathError'} */\nUnsafeFilepathError.code = 'UnsafeFilepathError'\n","import { ObjectTypeError } from '../errors/index.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\n\nexport async function resolveTree({ fs, cache, gitdir, oid }) {\n // Empty tree - bypass `readObject`\n if (oid === '4b825dc642cb6eb9a060e54bf8d69288fbee4904') {\n return { tree: GitTree.from([]), oid }\n }\n const { type, object } = await _readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveTree({ fs, cache, gitdir, oid })\n }\n // Resolve commits to trees\n if (type === 'commit') {\n oid = GitCommit.from(object).parse().tree\n return resolveTree({ fs, cache, gitdir, oid })\n }\n if (type !== 'tree') {\n throw new ObjectTypeError(oid, type, 'tree')\n }\n return { tree: GitTree.from(object), oid }\n}\n","export const pkg = {\n name: 'isomorphic-git',\n version: '1.25.7',\n agent: 'git/isomorphic-git@1.25.7',\n}\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","export function padHex(b, n) {\n const s = n.toString(16)\n return '0'.repeat(b - s.length) + s\n}\n","export function parseAuthor(author) {\n const [, name, email, timestamp, offset] = author.match(\n /^(.*) <(.*)> (.*) (.*)$/\n )\n return {\n name: name,\n email: email,\n timestamp: Number(timestamp),\n timezoneOffset: parseTimezoneOffset(offset),\n }\n}\n\n// The amount of effort that went into crafting these cases to handle\n// -0 (just so we don't lose that information when parsing and reconstructing)\n// but can also default to +0 was extraordinary.\n\nfunction parseTimezoneOffset(offset) {\n let [, sign, hours, minutes] = offset.match(/(\\+|-)(\\d\\d)(\\d\\d)/)\n minutes = (sign === '+' ? 1 : -1) * (Number(hours) * 60 + Number(minutes))\n return negateExceptForZero(minutes)\n}\n\nfunction negateExceptForZero(n) {\n return n === 0 ? n : -n\n}\n","import { forAwait } from './forAwait.js'\n\nexport async function collect(iterable) {\n let size = 0\n const buffers = []\n // This will be easier once `for await ... of` loops are available.\n await forAwait(iterable, value => {\n buffers.push(value)\n size += value.byteLength\n })\n const result = new Uint8Array(size)\n let nextIndex = 0\n for (const buffer of buffers) {\n result.set(buffer, nextIndex)\n nextIndex += buffer.byteLength\n }\n return result\n}\n","// @ts-check\n/**\n *\n * @param {WalkerEntry} entry\n * @param {WalkerEntry} base\n *\n */\nexport async function modified(entry, base) {\n if (!entry && !base) return false\n if (entry && !base) return true\n if (!entry && base) return true\n if ((await entry.type()) === 'tree' && (await base.type()) === 'tree') {\n return false\n }\n if (\n (await entry.type()) === (await base.type()) &&\n (await entry.mode()) === (await base.mode()) &&\n (await entry.oid()) === (await base.oid())\n ) {\n return false\n }\n return true\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\n/**\n *\n * @typedef {Object} ReadTreeResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tree\n * @property {TreeObject} tree - the parsed tree object\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.filepath]\n *\n * @returns {Promise}\n */\nexport async function _readTree({\n fs,\n cache,\n gitdir,\n oid,\n filepath = undefined,\n}) {\n if (filepath !== undefined) {\n oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath })\n }\n const { tree, oid: treeOid } = await resolveTree({ fs, cache, gitdir, oid })\n const result = {\n oid: treeOid,\n tree: tree.entries(),\n }\n return result\n}\n","import '../typedefs.js'\n\nimport { HttpError } from '../errors/HttpError.js'\nimport { SmartHttpError } from '../errors/SmartHttpError.js'\nimport { UserCanceledError } from '../errors/UserCanceledError.js'\nimport { calculateBasicAuthHeader } from '../utils/calculateBasicAuthHeader.js'\nimport { collect } from '../utils/collect.js'\nimport { extractAuthFromUrl } from '../utils/extractAuthFromUrl.js'\nimport { parseRefsAdResponse } from '../wire/parseRefsAdResponse.js'\n\n// Try to accommodate known CORS proxy implementations:\n// - https://jcubic.pl/proxy.php? <-- uses query string\n// - https://cors.isomorphic-git.org <-- uses path\nconst corsProxify = (corsProxy, url) =>\n corsProxy.endsWith('?')\n ? `${corsProxy}${url}`\n : `${corsProxy}/${url.replace(/^https?:\\/\\//, '')}`\n\nconst updateHeaders = (headers, auth) => {\n // Update the basic auth header\n if (auth.username || auth.password) {\n headers.Authorization = calculateBasicAuthHeader(auth)\n }\n // but any manually provided headers take precedence\n if (auth.headers) {\n Object.assign(headers, auth.headers)\n }\n}\n\n/**\n * @param {GitHttpResponse} res\n *\n * @returns {{ preview: string, response: string, data: Buffer }}\n */\nconst stringifyBody = async res => {\n try {\n // Some services provide a meaningful error message in the body of 403s like \"token lacks the scopes necessary to perform this action\"\n const data = Buffer.from(await collect(res.body))\n const response = data.toString('utf8')\n const preview =\n response.length < 256 ? response : response.slice(0, 256) + '...'\n return { preview, response, data }\n } catch (e) {\n return {}\n }\n}\n\nexport class GitRemoteHTTP {\n static async capabilities() {\n return ['discover', 'connect']\n }\n\n /**\n * @param {Object} args\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} [args.corsProxy]\n * @param {string} args.service\n * @param {string} args.url\n * @param {Object} args.headers\n * @param {1 | 2} args.protocolVersion - Git Protocol Version\n */\n static async discover({\n http,\n onProgress,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service,\n url: _origUrl,\n headers,\n protocolVersion,\n }) {\n let { url, auth } = extractAuthFromUrl(_origUrl)\n const proxifiedURL = corsProxy ? corsProxify(corsProxy, url) : url\n if (auth.username || auth.password) {\n headers.Authorization = calculateBasicAuthHeader(auth)\n }\n if (protocolVersion === 2) {\n headers['Git-Protocol'] = 'version=2'\n }\n\n let res\n let tryAgain\n let providedAuthBefore = false\n do {\n res = await http.request({\n onProgress,\n method: 'GET',\n url: `${proxifiedURL}/info/refs?service=${service}`,\n headers,\n })\n\n // the default loop behavior\n tryAgain = false\n\n // 401 is the \"correct\" response for access denied. 203 is Non-Authoritative Information and comes from Azure DevOps, which\n // apparently doesn't realize this is a git request and is returning the HTML for the \"Azure DevOps Services | Sign In\" page.\n if (res.statusCode === 401 || res.statusCode === 203) {\n // On subsequent 401s, call `onAuthFailure` instead of `onAuth`.\n // This is so that naive `onAuth` callbacks that return a fixed value don't create an infinite loop of retrying.\n const getAuth = providedAuthBefore ? onAuthFailure : onAuth\n if (getAuth) {\n // Acquire credentials and try again\n // TODO: read `useHttpPath` value from git config and pass along?\n auth = await getAuth(url, {\n ...auth,\n headers: { ...headers },\n })\n if (auth && auth.cancel) {\n throw new UserCanceledError()\n } else if (auth) {\n updateHeaders(headers, auth)\n providedAuthBefore = true\n tryAgain = true\n }\n }\n } else if (\n res.statusCode === 200 &&\n providedAuthBefore &&\n onAuthSuccess\n ) {\n await onAuthSuccess(url, auth)\n }\n } while (tryAgain)\n\n if (res.statusCode !== 200) {\n const { response } = await stringifyBody(res)\n throw new HttpError(res.statusCode, res.statusMessage, response)\n }\n // Git \"smart\" HTTP servers should respond with the correct Content-Type header.\n if (\n res.headers['content-type'] === `application/x-${service}-advertisement`\n ) {\n const remoteHTTP = await parseRefsAdResponse(res.body, { service })\n remoteHTTP.auth = auth\n return remoteHTTP\n } else {\n // If they don't send the correct content-type header, that's a good indicator it is either a \"dumb\" HTTP\n // server, or the user specified an incorrect remote URL and the response is actually an HTML page.\n // In this case, we save the response as plain text so we can generate a better error message if needed.\n const { preview, response, data } = await stringifyBody(res)\n // For backwards compatibility, try to parse it anyway.\n // TODO: maybe just throw instead of trying?\n try {\n const remoteHTTP = await parseRefsAdResponse([data], { service })\n remoteHTTP.auth = auth\n return remoteHTTP\n } catch (e) {\n throw new SmartHttpError(preview, response)\n }\n }\n }\n\n /**\n * @param {Object} args\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} [args.corsProxy]\n * @param {string} args.service\n * @param {string} args.url\n * @param {Object} [args.headers]\n * @param {any} args.body\n * @param {any} args.auth\n */\n static async connect({\n http,\n onProgress,\n corsProxy,\n service,\n url,\n auth,\n body,\n headers,\n }) {\n // We already have the \"correct\" auth value at this point, but\n // we need to strip out the username/password from the URL yet again.\n const urlAuth = extractAuthFromUrl(url)\n if (urlAuth) url = urlAuth.url\n\n if (corsProxy) url = corsProxify(corsProxy, url)\n\n headers['content-type'] = `application/x-${service}-request`\n headers.accept = `application/x-${service}-result`\n updateHeaders(headers, auth)\n\n const res = await http.request({\n onProgress,\n method: 'POST',\n url: `${url}/${service}`,\n body,\n headers,\n })\n if (res.statusCode !== 200) {\n const { response } = stringifyBody(res)\n throw new HttpError(res.statusCode, res.statusMessage, response)\n }\n return res\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class MergeNotSupportedError extends BaseError {\n constructor() {\n super(`Merges with conflicts are not supported yet.`)\n this.code = this.name = MergeNotSupportedError.code\n this.data = {}\n }\n}\n/** @type {'MergeNotSupportedError'} */\nMergeNotSupportedError.code = 'MergeNotSupportedError'\n","import { BaseError } from './BaseError.js'\n\nexport class MergeConflictError extends BaseError {\n /**\n * @param {Array} filepaths\n * @param {Array} bothModified\n * @param {Array} deleteByUs\n * @param {Array} deleteByTheirs\n */\n constructor(filepaths, bothModified, deleteByUs, deleteByTheirs) {\n super(\n `Automatic merge failed with one or more merge conflicts in the following files: ${filepaths.toString()}. Fix conflicts then commit the result.`\n )\n this.code = this.name = MergeConflictError.code\n this.data = { filepaths, bothModified, deleteByUs, deleteByTheirs }\n }\n}\n/** @type {'MergeConflictError'} */\nMergeConflictError.code = 'MergeConflictError'\n","import { BaseError } from './BaseError.js'\n\nexport class HttpError extends BaseError {\n /**\n * @param {number} statusCode\n * @param {string} statusMessage\n * @param {string} response\n */\n constructor(statusCode, statusMessage, response) {\n super(`HTTP Error: ${statusCode} ${statusMessage}`)\n this.code = this.name = HttpError.code\n this.data = { statusCode, statusMessage, response }\n }\n}\n/** @type {'HttpError'} */\nHttpError.code = 'HttpError'\n","import { BaseError } from './BaseError.js'\n\nexport class InvalidFilepathError extends BaseError {\n /**\n * @param {'leading-slash'|'trailing-slash'|'directory'} [reason]\n */\n constructor(reason) {\n let message = 'invalid filepath'\n if (reason === 'leading-slash' || reason === 'trailing-slash') {\n message = `\"filepath\" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.`\n } else if (reason === 'directory') {\n message = `\"filepath\" should not be a directory.`\n }\n super(message)\n this.code = this.name = InvalidFilepathError.code\n this.data = { reason }\n }\n}\n/** @type {'InvalidFilepathError'} */\nInvalidFilepathError.code = 'InvalidFilepathError'\n","import { compareStrings } from './compareStrings'\n\nexport function comparePath(a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n return compareStrings(a.path, b.path)\n}\n","import crc32 from 'crc-32'\n\nimport { InternalError } from '../errors/InternalError.js'\nimport { GitObject } from '../models/GitObject'\nimport { BufferCursor } from '../utils/BufferCursor.js'\nimport { applyDelta } from '../utils/applyDelta.js'\nimport { listpack } from '../utils/git-list-pack.js'\nimport { inflate } from '../utils/inflate.js'\nimport { shasum } from '../utils/shasum.js'\n\nfunction decodeVarInt(reader) {\n const bytes = []\n let byte = 0\n let multibyte = 0\n do {\n byte = reader.readUInt8()\n // We keep bits 6543210\n const lastSeven = byte & 0b01111111\n bytes.push(lastSeven)\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n multibyte = byte & 0b10000000\n } while (multibyte)\n // Now that all the bytes are in big-endian order,\n // alternate shifting the bits left by 7 and OR-ing the next byte.\n // And... do a weird increment-by-one thing that I don't quite understand.\n return bytes.reduce((a, b) => ((a + 1) << 7) | b, -1)\n}\n\n// I'm pretty much copying this one from the git C source code,\n// because it makes no sense.\nfunction otherVarIntDecode(reader, startWith) {\n let result = startWith\n let shift = 4\n let byte = null\n do {\n byte = reader.readUInt8()\n result |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n return result\n}\n\nexport class GitPackIndex {\n constructor(stuff) {\n Object.assign(this, stuff)\n this.offsetCache = {}\n }\n\n static async fromIdx({ idx, getExternalRefDelta }) {\n const reader = new BufferCursor(idx)\n const magic = reader.slice(4).toString('hex')\n // Check for IDX v2 magic number\n if (magic !== 'ff744f63') {\n return // undefined\n }\n const version = reader.readUInt32BE()\n if (version !== 2) {\n throw new InternalError(\n `Unable to read version ${version} packfile IDX. (Only version 2 supported)`\n )\n }\n if (idx.byteLength > 2048 * 1024 * 1024) {\n throw new InternalError(\n `To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.`\n )\n }\n // Skip over fanout table\n reader.seek(reader.tell() + 4 * 255)\n // Get hashes\n const size = reader.readUInt32BE()\n const hashes = []\n for (let i = 0; i < size; i++) {\n const hash = reader.slice(20).toString('hex')\n hashes[i] = hash\n }\n reader.seek(reader.tell() + 4 * size)\n // Skip over CRCs\n // Get offsets\n const offsets = new Map()\n for (let i = 0; i < size; i++) {\n offsets.set(hashes[i], reader.readUInt32BE())\n }\n const packfileSha = reader.slice(20).toString('hex')\n return new GitPackIndex({\n hashes,\n crcs: {},\n offsets,\n packfileSha,\n getExternalRefDelta,\n })\n }\n\n static async fromPack({ pack, getExternalRefDelta, onProgress }) {\n const listpackTypes = {\n 1: 'commit',\n 2: 'tree',\n 3: 'blob',\n 4: 'tag',\n 6: 'ofs-delta',\n 7: 'ref-delta',\n }\n const offsetToObject = {}\n\n // Older packfiles do NOT use the shasum of the pack itself,\n // so it is recommended to just use whatever bytes are in the trailer.\n // Source: https://github.com/git/git/commit/1190a1acf800acdcfd7569f87ac1560e2d077414\n const packfileSha = pack.slice(-20).toString('hex')\n\n const hashes = []\n const crcs = {}\n const offsets = new Map()\n let totalObjectCount = null\n let lastPercent = null\n\n await listpack([pack], async ({ data, type, reference, offset, num }) => {\n if (totalObjectCount === null) totalObjectCount = num\n const percent = Math.floor(\n ((totalObjectCount - num) * 100) / totalObjectCount\n )\n if (percent !== lastPercent) {\n if (onProgress) {\n await onProgress({\n phase: 'Receiving objects',\n loaded: totalObjectCount - num,\n total: totalObjectCount,\n })\n }\n }\n lastPercent = percent\n // Change type from a number to a meaningful string\n type = listpackTypes[type]\n\n if (['commit', 'tree', 'blob', 'tag'].includes(type)) {\n offsetToObject[offset] = {\n type,\n offset,\n }\n } else if (type === 'ofs-delta') {\n offsetToObject[offset] = {\n type,\n offset,\n }\n } else if (type === 'ref-delta') {\n offsetToObject[offset] = {\n type,\n offset,\n }\n }\n })\n\n // We need to know the lengths of the slices to compute the CRCs.\n const offsetArray = Object.keys(offsetToObject).map(Number)\n for (const [i, start] of offsetArray.entries()) {\n const end =\n i + 1 === offsetArray.length ? pack.byteLength - 20 : offsetArray[i + 1]\n const o = offsetToObject[start]\n const crc = crc32.buf(pack.slice(start, end)) >>> 0\n o.end = end\n o.crc = crc\n }\n\n // We don't have the hashes yet. But we can generate them using the .readSlice function!\n const p = new GitPackIndex({\n pack: Promise.resolve(pack),\n packfileSha,\n crcs,\n hashes,\n offsets,\n getExternalRefDelta,\n })\n\n // Resolve deltas and compute the oids\n lastPercent = null\n let count = 0\n const objectsByDepth = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n for (let offset in offsetToObject) {\n offset = Number(offset)\n const percent = Math.floor((count * 100) / totalObjectCount)\n if (percent !== lastPercent) {\n if (onProgress) {\n await onProgress({\n phase: 'Resolving deltas',\n loaded: count,\n total: totalObjectCount,\n })\n }\n }\n count++\n lastPercent = percent\n\n const o = offsetToObject[offset]\n if (o.oid) continue\n try {\n p.readDepth = 0\n p.externalReadDepth = 0\n const { type, object } = await p.readSlice({ start: offset })\n objectsByDepth[p.readDepth] += 1\n const oid = await shasum(GitObject.wrap({ type, object }))\n o.oid = oid\n hashes.push(oid)\n offsets.set(oid, offset)\n crcs[oid] = o.crc\n } catch (err) {\n continue\n }\n }\n\n hashes.sort()\n return p\n }\n\n async toBuffer() {\n const buffers = []\n const write = (str, encoding) => {\n buffers.push(Buffer.from(str, encoding))\n }\n // Write out IDX v2 magic number\n write('ff744f63', 'hex')\n // Write out version number 2\n write('00000002', 'hex')\n // Write fanout table\n const fanoutBuffer = new BufferCursor(Buffer.alloc(256 * 4))\n for (let i = 0; i < 256; i++) {\n let count = 0\n for (const hash of this.hashes) {\n if (parseInt(hash.slice(0, 2), 16) <= i) count++\n }\n fanoutBuffer.writeUInt32BE(count)\n }\n buffers.push(fanoutBuffer.buffer)\n // Write out hashes\n for (const hash of this.hashes) {\n write(hash, 'hex')\n }\n // Write out crcs\n const crcsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4))\n for (const hash of this.hashes) {\n crcsBuffer.writeUInt32BE(this.crcs[hash])\n }\n buffers.push(crcsBuffer.buffer)\n // Write out offsets\n const offsetsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4))\n for (const hash of this.hashes) {\n offsetsBuffer.writeUInt32BE(this.offsets.get(hash))\n }\n buffers.push(offsetsBuffer.buffer)\n // Write out packfile checksum\n write(this.packfileSha, 'hex')\n // Write out shasum\n const totalBuffer = Buffer.concat(buffers)\n const sha = await shasum(totalBuffer)\n const shaBuffer = Buffer.alloc(20)\n shaBuffer.write(sha, 'hex')\n return Buffer.concat([totalBuffer, shaBuffer])\n }\n\n async load({ pack }) {\n this.pack = pack\n }\n\n async unload() {\n this.pack = null\n }\n\n async read({ oid }) {\n if (!this.offsets.get(oid)) {\n if (this.getExternalRefDelta) {\n this.externalReadDepth++\n return this.getExternalRefDelta(oid)\n } else {\n throw new InternalError(`Could not read object ${oid} from packfile`)\n }\n }\n const start = this.offsets.get(oid)\n return this.readSlice({ start })\n }\n\n async readSlice({ start }) {\n if (this.offsetCache[start]) {\n return Object.assign({}, this.offsetCache[start])\n }\n this.readDepth++\n const types = {\n 0b0010000: 'commit',\n 0b0100000: 'tree',\n 0b0110000: 'blob',\n 0b1000000: 'tag',\n 0b1100000: 'ofs_delta',\n 0b1110000: 'ref_delta',\n }\n if (!this.pack) {\n throw new InternalError(\n 'Tried to read from a GitPackIndex with no packfile loaded into memory'\n )\n }\n const raw = (await this.pack).slice(start)\n const reader = new BufferCursor(raw)\n const byte = reader.readUInt8()\n // Object type is encoded in bits 654\n const btype = byte & 0b1110000\n let type = types[btype]\n if (type === undefined) {\n throw new InternalError('Unrecognized type: 0b' + btype.toString(2))\n }\n // The length encoding get complicated.\n // Last four bits of length is encoded in bits 3210\n const lastFour = byte & 0b1111\n let length = lastFour\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n const multibyte = byte & 0b10000000\n if (multibyte) {\n length = otherVarIntDecode(reader, lastFour)\n }\n let base = null\n let object = null\n // Handle deltified objects\n if (type === 'ofs_delta') {\n const offset = decodeVarInt(reader)\n const baseOffset = start - offset\n ;({ object: base, type } = await this.readSlice({ start: baseOffset }))\n }\n if (type === 'ref_delta') {\n const oid = reader.slice(20).toString('hex')\n ;({ object: base, type } = await this.read({ oid }))\n }\n // Handle undeltified objects\n const buffer = raw.slice(reader.tell())\n object = Buffer.from(await inflate(buffer))\n // Assert that the object length is as expected.\n if (object.byteLength !== length) {\n throw new InternalError(\n `Packfile told us object would have length ${length} but it had length ${object.byteLength}`\n )\n }\n if (base) {\n object = Buffer.from(applyDelta(object, base))\n }\n // Cache the result based on depth.\n if (this.readDepth > 3) {\n // hand tuned for speed / memory usage tradeoff\n this.offsetCache[start] = { type, object }\n }\n return { type, format: 'content', object }\n }\n}\n","import ignore from 'ignore'\n\nimport { basename } from '../utils/basename.js'\nimport { dirname } from '../utils/dirname.js'\nimport { join } from '../utils/join.js'\n\n// I'm putting this in a Manager because I reckon it could benefit\n// from a LOT of caching.\nexport class GitIgnoreManager {\n static async isIgnored({ fs, dir, gitdir = join(dir, '.git'), filepath }) {\n // ALWAYS ignore \".git\" folders.\n if (basename(filepath) === '.git') return true\n // '.' is not a valid gitignore entry, so '.' is never ignored\n if (filepath === '.') return false\n // Check and load exclusion rules from project exclude file (.git/info/exclude)\n let excludes = ''\n const excludesFile = join(gitdir, 'info', 'exclude')\n if (await fs.exists(excludesFile)) {\n excludes = await fs.read(excludesFile, 'utf8')\n }\n // Find all the .gitignore files that could affect this file\n const pairs = [\n {\n gitignore: join(dir, '.gitignore'),\n filepath,\n },\n ]\n const pieces = filepath.split('/').filter(Boolean)\n for (let i = 1; i < pieces.length; i++) {\n const folder = pieces.slice(0, i).join('/')\n const file = pieces.slice(i).join('/')\n pairs.push({\n gitignore: join(dir, folder, '.gitignore'),\n filepath: file,\n })\n }\n let ignoredStatus = false\n for (const p of pairs) {\n let file\n try {\n file = await fs.read(p.gitignore, 'utf8')\n } catch (err) {\n if (err.code === 'NOENT') continue\n }\n const ign = ignore().add(excludes)\n ign.add(file)\n // If the parent directory is excluded, we are done.\n // \"It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.\"\n // source: https://git-scm.com/docs/gitignore\n const parentdir = dirname(p.filepath)\n if (parentdir !== '.' && ign.ignores(parentdir)) return true\n // If the file is currently ignored, test for UNignoring.\n if (ignoredStatus) {\n ignoredStatus = !ign.test(p.filepath).unignored\n } else {\n ignoredStatus = ign.test(p.filepath).ignored\n }\n }\n return ignoredStatus\n }\n}\n","import { UnknownTransportError } from '../errors/UnknownTransportError.js'\nimport { UrlParseError } from '../errors/UrlParseError.js'\nimport { translateSSHtoHTTP } from '../utils/translateSSHtoHTTP.js'\n\nimport { GitRemoteHTTP } from './GitRemoteHTTP'\n\nfunction parseRemoteUrl({ url }) {\n // the stupid \"shorter scp-like syntax\"\n if (url.startsWith('git@')) {\n return {\n transport: 'ssh',\n address: url,\n }\n }\n const matches = url.match(/(\\w+)(:\\/\\/|::)(.*)/)\n if (matches === null) return\n /*\n * When git encounters a URL of the form ://
, where is\n * a protocol that it cannot handle natively, it automatically invokes git remote-\n * with the full URL as the second argument.\n *\n * @see https://git-scm.com/docs/git-remote-helpers\n */\n if (matches[2] === '://') {\n return {\n transport: matches[1],\n address: matches[0],\n }\n }\n /*\n * A URL of the form ::
explicitly instructs git to invoke\n * git remote- with
as the second argument.\n *\n * @see https://git-scm.com/docs/git-remote-helpers\n */\n if (matches[2] === '::') {\n return {\n transport: matches[1],\n address: matches[3],\n }\n }\n}\n\nexport class GitRemoteManager {\n static getRemoteHelperFor({ url }) {\n // TODO: clean up the remoteHelper API and move into PluginCore\n const remoteHelpers = new Map()\n remoteHelpers.set('http', GitRemoteHTTP)\n remoteHelpers.set('https', GitRemoteHTTP)\n\n const parts = parseRemoteUrl({ url })\n if (!parts) {\n throw new UrlParseError(url)\n }\n if (remoteHelpers.has(parts.transport)) {\n return remoteHelpers.get(parts.transport)\n }\n throw new UnknownTransportError(\n url,\n parts.transport,\n parts.transport === 'ssh' ? translateSSHtoHTTP(url) : undefined\n )\n }\n}\n","export function translateSSHtoHTTP(url) {\n // handle \"shorter scp-like syntax\"\n url = url.replace(/^git@([^:]+):/, 'https://$1/')\n // handle proper SSH URLs\n url = url.replace(/^ssh:\\/\\//, 'https://')\n return url\n}\n","export function formatAuthor({ name, email, timestamp, timezoneOffset }) {\n timezoneOffset = formatTimezoneOffset(timezoneOffset)\n return `${name} <${email}> ${timestamp} ${timezoneOffset}`\n}\n\n// The amount of effort that went into crafting these cases to handle\n// -0 (just so we don't lose that information when parsing and reconstructing)\n// but can also default to +0 was extraordinary.\n\nfunction formatTimezoneOffset(minutes) {\n const sign = simpleSign(negateExceptForZero(minutes))\n minutes = Math.abs(minutes)\n const hours = Math.floor(minutes / 60)\n minutes -= hours * 60\n let strHours = String(hours)\n let strMinutes = String(minutes)\n if (strHours.length < 2) strHours = '0' + strHours\n if (strMinutes.length < 2) strMinutes = '0' + strMinutes\n return (sign === -1 ? '-' : '+') + strHours + strMinutes\n}\n\nfunction simpleSign(n) {\n return Math.sign(n) || (Object.is(n, -0) ? -1 : 1)\n}\n\nfunction negateExceptForZero(n) {\n return n === 0 ? n : -n\n}\n","export class FIFO {\n constructor() {\n this._queue = []\n }\n\n write(chunk) {\n if (this._ended) {\n throw Error('You cannot write to a FIFO that has already been ended!')\n }\n if (this._waiting) {\n const resolve = this._waiting\n this._waiting = null\n resolve({ value: chunk })\n } else {\n this._queue.push(chunk)\n }\n }\n\n end() {\n this._ended = true\n if (this._waiting) {\n const resolve = this._waiting\n this._waiting = null\n resolve({ done: true })\n }\n }\n\n destroy(err) {\n this.error = err\n this.end()\n }\n\n async next() {\n if (this._queue.length > 0) {\n return { value: this._queue.shift() }\n }\n if (this._ended) {\n return { done: true }\n }\n if (this._waiting) {\n throw Error(\n 'You cannot call read until the previous call to read has returned!'\n )\n }\n return new Promise(resolve => {\n this._waiting = resolve\n })\n }\n}\n","import { BaseError } from './BaseError.js'\n\nexport class RemoteCapabilityError extends BaseError {\n /**\n * @param {'shallow'|'deepen-since'|'deepen-not'|'deepen-relative'} capability\n * @param {'depth'|'since'|'exclude'|'relative'} parameter\n */\n constructor(capability, parameter) {\n super(\n `Remote does not support the \"${capability}\" so the \"${parameter}\" parameter cannot be used.`\n )\n this.code = this.name = RemoteCapabilityError.code\n this.data = { capability, parameter }\n }\n}\n/** @type {'RemoteCapabilityError'} */\nRemoteCapabilityError.code = 'RemoteCapabilityError'\n","import { normalizeStats } from './normalizeStats.js'\n\nexport function compareStats(entry, stats) {\n // Comparison based on the description in Paragraph 4 of\n // https://www.kernel.org/pub/software/scm/git/docs/technical/racy-git.txt\n const e = normalizeStats(entry)\n const s = normalizeStats(stats)\n const staleness =\n e.mode !== s.mode ||\n e.mtimeSeconds !== s.mtimeSeconds ||\n e.ctimeSeconds !== s.ctimeSeconds ||\n e.uid !== s.uid ||\n e.gid !== s.gid ||\n e.ino !== s.ino ||\n e.size !== s.size\n return staleness\n}\n","// @ts-check\nimport { InvalidFilepathError } from '../errors/InvalidFilepathError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\nexport async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {\n // Ensure there are no leading or trailing directory separators.\n // I was going to do this automatically, but then found that the Git Terminal for Windows\n // auto-expands --filepath=/src/utils to --filepath=C:/Users/Will/AppData/Local/Programs/Git/src/utils\n // so I figured it would be wise to promote the behavior in the application layer not just the library layer.\n if (filepath.startsWith('/')) {\n throw new InvalidFilepathError('leading-slash')\n } else if (filepath.endsWith('/')) {\n throw new InvalidFilepathError('trailing-slash')\n }\n const _oid = oid\n const result = await resolveTree({ fs, cache, gitdir, oid })\n const tree = result.tree\n if (filepath === '') {\n oid = result.oid\n } else {\n const pathArray = filepath.split('/')\n oid = await _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid: _oid,\n filepath,\n })\n }\n return oid\n}\n\nasync function _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid,\n filepath,\n}) {\n const name = pathArray.shift()\n for (const entry of tree) {\n if (entry.path === name) {\n if (pathArray.length === 0) {\n return entry.oid\n } else {\n const { type, object } = await readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n })\n if (type !== 'tree') {\n throw new ObjectTypeError(oid, type, 'tree', filepath)\n }\n tree = GitTree.from(object)\n return _resolveFilepath({\n fs,\n cache,\n gitdir,\n tree,\n pathArray,\n oid,\n filepath,\n })\n }\n }\n }\n throw new NotFoundError(`file or directory found at \"${oid}:${filepath}\"`)\n}\n","import { BaseError } from './BaseError.js'\n\nexport class EmptyServerResponseError extends BaseError {\n constructor() {\n super(`Empty response from git server.`)\n this.code = this.name = EmptyServerResponseError.code\n this.data = {}\n }\n}\n/** @type {'EmptyServerResponseError'} */\nEmptyServerResponseError.code = 'EmptyServerResponseError'\n","import { BaseError } from './BaseError.js'\n\nexport class NoRefspecError extends BaseError {\n /**\n * @param {string} remote\n */\n constructor(remote) {\n super(`Could not find a fetch refspec for remote \"${remote}\". Make sure the config file has an entry like the following:\n[remote \"${remote}\"]\n\\tfetch = +refs/heads/*:refs/remotes/origin/*\n`)\n this.code = this.name = NoRefspecError.code\n this.data = { remote }\n }\n}\n/** @type {'NoRefspecError'} */\nNoRefspecError.code = 'NoRefspecError'\n","import { BaseError } from './BaseError.js'\n\nexport class SmartHttpError extends BaseError {\n /**\n * @param {string} preview\n * @param {string} response\n */\n constructor(preview, response) {\n super(\n `Remote did not reply using the \"smart\" HTTP protocol. Expected \"001e# service=git-upload-pack\" but received: ${preview}`\n )\n this.code = this.name = SmartHttpError.code\n this.data = { preview, response }\n }\n}\n/** @type {'SmartHttpError'} */\nSmartHttpError.code = 'SmartHttpError'\n","import { BaseError } from './BaseError.js'\n\nexport class UnknownTransportError extends BaseError {\n /**\n * @param {string} url\n * @param {string} transport\n * @param {string} [suggestion]\n */\n constructor(url, transport, suggestion) {\n super(\n `Git remote \"${url}\" uses an unrecognized transport protocol: \"${transport}\"`\n )\n this.code = this.name = UnknownTransportError.code\n this.data = { url, transport, suggestion }\n }\n}\n/** @type {'UnknownTransportError'} */\nUnknownTransportError.code = 'UnknownTransportError'\n","import { BaseError } from './BaseError.js'\n\nexport class UrlParseError extends BaseError {\n /**\n * @param {string} url\n */\n constructor(url) {\n super(`Cannot parse remote URL: \"${url}\"`)\n this.code = this.name = UrlParseError.code\n this.data = { url }\n }\n}\n/** @type {'UrlParseError'} */\nUrlParseError.code = 'UrlParseError'\n","import { BaseError } from './BaseError.js'\n\nexport class UserCanceledError extends BaseError {\n constructor() {\n super(`The operation was canceled.`)\n this.code = this.name = UserCanceledError.code\n this.data = {}\n }\n}\n/** @type {'UserCanceledError'} */\nUserCanceledError.code = 'UserCanceledError'\n","import { BaseError } from './BaseError.js'\n\nexport class UnmergedPathsError extends BaseError {\n /**\n * @param {Array} filepaths\n */\n constructor(filepaths) {\n super(\n `Modifying the index is not possible because you have unmerged files: ${filepaths.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`\n )\n this.code = this.name = UnmergedPathsError.code\n this.data = { filepaths }\n }\n}\n/** @type {'UnmergedPathsError'} */\nUnmergedPathsError.code = 'UnmergedPathsError'\n","/*\nIf 'side-band' or 'side-band-64k' capabilities have been specified by\nthe client, the server will send the packfile data multiplexed.\n\nEach packet starting with the packet-line length of the amount of data\nthat follows, followed by a single byte specifying the sideband the\nfollowing data is coming in on.\n\nIn 'side-band' mode, it will send up to 999 data bytes plus 1 control\ncode, for a total of up to 1000 bytes in a pkt-line. In 'side-band-64k'\nmode it will send up to 65519 data bytes plus 1 control code, for a\ntotal of up to 65520 bytes in a pkt-line.\n\nThe sideband byte will be a '1', '2' or a '3'. Sideband '1' will contain\npackfile data, sideband '2' will be used for progress information that the\nclient will generally print to stderr and sideband '3' is used for error\ninformation.\n\nIf no 'side-band' capability was specified, the server will stream the\nentire packfile without multiplexing.\n*/\nimport { FIFO } from '../utils/FIFO.js'\n\nimport { GitPktLine } from './GitPktLine.js'\n\nexport class GitSideBand {\n static demux(input) {\n const read = GitPktLine.streamReader(input)\n // And now for the ridiculous side-band or side-band-64k protocol\n const packetlines = new FIFO()\n const packfile = new FIFO()\n const progress = new FIFO()\n // TODO: Use a proper through stream?\n const nextBit = async function() {\n const line = await read()\n // Skip over flush packets\n if (line === null) return nextBit()\n // A made up convention to signal there's no more to read.\n if (line === true) {\n packetlines.end()\n progress.end()\n input.error ? packfile.destroy(input.error) : packfile.end()\n return\n }\n // Examine first byte to determine which output \"stream\" to use\n switch (line[0]) {\n case 1: {\n // pack data\n packfile.write(line.slice(1))\n break\n }\n case 2: {\n // progress message\n progress.write(line.slice(1))\n break\n }\n case 3: {\n // fatal error message just before stream aborts\n const error = line.slice(1)\n progress.write(error)\n packetlines.end()\n progress.end()\n packfile.destroy(new Error(error.toString('utf8')))\n return\n }\n default: {\n // Not part of the side-band-64k protocol\n packetlines.write(line)\n }\n }\n // Careful not to blow up the stack.\n // I think Promises in a tail-call position should be OK.\n nextBit()\n }\n nextBit()\n return {\n packetlines,\n packfile,\n progress,\n }\n }\n // static mux ({\n // protocol, // 'side-band' or 'side-band-64k'\n // packetlines,\n // packfile,\n // progress,\n // error\n // }) {\n // const MAX_PACKET_LENGTH = protocol === 'side-band-64k' ? 999 : 65519\n // let output = new PassThrough()\n // packetlines.on('data', data => {\n // if (data === null) {\n // output.write(GitPktLine.flush())\n // } else {\n // output.write(GitPktLine.encode(data))\n // }\n // })\n // let packfileWasEmpty = true\n // let packfileEnded = false\n // let progressEnded = false\n // let errorEnded = false\n // let goodbye = Buffer.concat([\n // GitPktLine.encode(Buffer.from('010A', 'hex')),\n // GitPktLine.flush()\n // ])\n // packfile\n // .on('data', data => {\n // packfileWasEmpty = false\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('01', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // packfileEnded = true\n // if (!packfileWasEmpty) output.write(goodbye)\n // if (progressEnded && errorEnded) output.end()\n // })\n // progress\n // .on('data', data => {\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('02', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // progressEnded = true\n // if (packfileEnded && errorEnded) output.end()\n // })\n // error\n // .on('data', data => {\n // const buffers = splitBuffer(data, MAX_PACKET_LENGTH)\n // for (const buffer of buffers) {\n // output.write(\n // GitPktLine.encode(Buffer.concat([Buffer.from('03', 'hex'), buffer]))\n // )\n // }\n // })\n // .on('end', () => {\n // errorEnded = true\n // if (progressEnded && packfileEnded) output.end()\n // })\n // return output\n // }\n}\n","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha1 () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl1 (num) {\n return (num << 1) | (num >>> 31)\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n","/**\n * From https://github.com/git/git/blob/master/Documentation/technical/index-format.txt\n *\n * 32-bit mode, split into (high to low bits)\n *\n * 4-bit object type\n * valid values in binary are 1000 (regular file), 1010 (symbolic link)\n * and 1110 (gitlink)\n *\n * 3-bit unused\n *\n * 9-bit unix permission. Only 0755 and 0644 are valid for regular files.\n * Symbolic links and gitlinks have value 0 in this field.\n */\nexport function normalizeMode(mode) {\n // Note: BrowserFS will use -1 for \"unknown\"\n // I need to make it non-negative for these bitshifts to work.\n let type = mode > 0 ? mode >> 12 : 0\n // If it isn't valid, assume it as a \"regular file\"\n // 0100 = directory\n // 1000 = regular file\n // 1010 = symlink\n // 1110 = gitlink\n if (\n type !== 0b0100 &&\n type !== 0b1000 &&\n type !== 0b1010 &&\n type !== 0b1110\n ) {\n type = 0b1000\n }\n let permissions = mode & 0o777\n // Is the file executable? then 755. Else 644.\n if (permissions & 0b001001001) {\n permissions = 0o755\n } else {\n permissions = 0o644\n }\n // If it's not a regular file, scrub all permissions\n if (type !== 0b1000) permissions = 0\n return (type << 12) + permissions\n}\n","import { InternalError } from '../errors/InternalError.js'\n\nexport class GitRefSpec {\n constructor({ remotePath, localPath, force, matchPrefix }) {\n Object.assign(this, {\n remotePath,\n localPath,\n force,\n matchPrefix,\n })\n }\n\n static from(refspec) {\n const [\n forceMatch,\n remotePath,\n remoteGlobMatch,\n localPath,\n localGlobMatch,\n ] = refspec.match(/^(\\+?)(.*?)(\\*?):(.*?)(\\*?)$/).slice(1)\n const force = forceMatch === '+'\n const remoteIsGlob = remoteGlobMatch === '*'\n const localIsGlob = localGlobMatch === '*'\n // validate\n // TODO: Make this check more nuanced, and depend on whether this is a fetch refspec or a push refspec\n if (remoteIsGlob !== localIsGlob) {\n throw new InternalError('Invalid refspec')\n }\n return new GitRefSpec({\n remotePath,\n localPath,\n force,\n matchPrefix: remoteIsGlob,\n })\n // TODO: We need to run resolveRef on both paths to expand them to their full name.\n }\n\n translate(remoteBranch) {\n if (this.matchPrefix) {\n if (remoteBranch.startsWith(this.remotePath)) {\n return this.localPath + remoteBranch.replace(this.remotePath, '')\n }\n } else {\n if (remoteBranch === this.remotePath) return this.localPath\n }\n return null\n }\n\n reverseTranslate(localBranch) {\n if (this.matchPrefix) {\n if (localBranch.startsWith(this.localPath)) {\n return this.remotePath + localBranch.replace(this.localPath, '')\n }\n } else {\n if (localBranch === this.localPath) return this.remotePath\n }\n return null\n }\n}\n","import { GitPackIndex } from '../models/GitPackIndex.js'\n\nconst PackfileCache = Symbol('PackfileCache')\n\nasync function loadPackIndex({\n fs,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n}) {\n const idx = await fs.read(filename)\n return GitPackIndex.fromIdx({ idx, getExternalRefDelta })\n}\n\nexport function readPackIndex({\n fs,\n cache,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n}) {\n // Try to get the packfile index from the in-memory cache\n if (!cache[PackfileCache]) cache[PackfileCache] = new Map()\n let p = cache[PackfileCache].get(filename)\n if (!p) {\n p = loadPackIndex({\n fs,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix,\n })\n cache[PackfileCache].set(filename, p)\n }\n return p\n}\n","import { getIterator } from './getIterator.js'\n\n// inspired by 'gartal' but lighter-weight and more battle-tested.\nexport class StreamReader {\n constructor(stream) {\n this.stream = getIterator(stream)\n this.buffer = null\n this.cursor = 0\n this.undoCursor = 0\n this.started = false\n this._ended = false\n this._discardedBytes = 0\n }\n\n eof() {\n return this._ended && this.cursor === this.buffer.length\n }\n\n tell() {\n return this._discardedBytes + this.cursor\n }\n\n async byte() {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor === this.buffer.length) {\n await this._loadnext()\n if (this._ended) return\n }\n this._moveCursor(1)\n return this.buffer[this.undoCursor]\n }\n\n async chunk() {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor === this.buffer.length) {\n await this._loadnext()\n if (this._ended) return\n }\n this._moveCursor(this.buffer.length)\n return this.buffer.slice(this.undoCursor, this.cursor)\n }\n\n async read(n) {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor + n > this.buffer.length) {\n this._trim()\n await this._accumulate(n)\n }\n this._moveCursor(n)\n return this.buffer.slice(this.undoCursor, this.cursor)\n }\n\n async skip(n) {\n if (this.eof()) return\n if (!this.started) await this._init()\n if (this.cursor + n > this.buffer.length) {\n this._trim()\n await this._accumulate(n)\n }\n this._moveCursor(n)\n }\n\n async undo() {\n this.cursor = this.undoCursor\n }\n\n async _next() {\n this.started = true\n let { done, value } = await this.stream.next()\n if (done) {\n this._ended = true\n if (!value) return Buffer.alloc(0)\n }\n if (value) {\n value = Buffer.from(value)\n }\n return value\n }\n\n _trim() {\n // Throw away parts of the buffer we don't need anymore\n // assert(this.cursor <= this.buffer.length)\n this.buffer = this.buffer.slice(this.undoCursor)\n this.cursor -= this.undoCursor\n this._discardedBytes += this.undoCursor\n this.undoCursor = 0\n }\n\n _moveCursor(n) {\n this.undoCursor = this.cursor\n this.cursor += n\n if (this.cursor > this.buffer.length) {\n this.cursor = this.buffer.length\n }\n }\n\n async _accumulate(n) {\n if (this._ended) return\n // Expand the buffer until we have N bytes of data\n // or we've reached the end of the stream\n const buffers = [this.buffer]\n while (this.cursor + n > lengthBuffers(buffers)) {\n const nextbuffer = await this._next()\n if (this._ended) break\n buffers.push(nextbuffer)\n }\n this.buffer = Buffer.concat(buffers)\n }\n\n async _loadnext() {\n this._discardedBytes += this.buffer.length\n this.undoCursor = 0\n this.cursor = 0\n this.buffer = await this._next()\n }\n\n async _init() {\n this.buffer = await this._next()\n }\n}\n\n// This helper function helps us postpone concatenating buffers, which\n// would create intermediate buffer objects,\nfunction lengthBuffers(buffers) {\n return buffers.reduce((acc, buffer) => acc + buffer.length, 0)\n}\n","/* eslint-env node, browser */\n/* global DecompressionStream */\nimport pako from 'pako'\n\nlet supportsDecompressionStream = false\n\nexport async function inflate(buffer) {\n if (supportsDecompressionStream === null) {\n supportsDecompressionStream = testDecompressionStream()\n }\n return supportsDecompressionStream\n ? browserInflate(buffer)\n : pako.inflate(buffer)\n}\n\nasync function browserInflate(buffer) {\n const ds = new DecompressionStream('deflate')\n const d = new Blob([buffer]).stream().pipeThrough(ds)\n return new Uint8Array(await new Response(d).arrayBuffer())\n}\n\nfunction testDecompressionStream() {\n try {\n const ds = new DecompressionStream('deflate')\n if (ds) return true\n } catch (_) {\n // no bother\n }\n return false\n}\n","/* eslint-env node, browser */\n/* global CompressionStream */\nimport pako from 'pako'\n\nlet supportsCompressionStream = null\n\nexport async function deflate(buffer) {\n if (supportsCompressionStream === null) {\n supportsCompressionStream = testCompressionStream()\n }\n return supportsCompressionStream\n ? browserDeflate(buffer)\n : pako.deflate(buffer)\n}\n\nasync function browserDeflate(buffer) {\n const cs = new CompressionStream('deflate')\n const c = new Blob([buffer]).stream().pipeThrough(cs)\n return new Uint8Array(await new Response(c).arrayBuffer())\n}\n\nfunction testCompressionStream() {\n try {\n const cs = new CompressionStream('deflate')\n cs.writable.close()\n // Test if `Blob.stream` is present. React Native does not have the `stream` method\n const stream = new Blob([]).stream()\n stream.cancel()\n return true\n } catch (_) {\n return false\n }\n}\n","export function calculateBasicAuthHeader({ username = '', password = '' }) {\n return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`\n}\n","// @ts-check\n\n/**\n * @param {function} read\n */\nexport async function parseCapabilitiesV2(read) {\n /** @type {Object} */\n const capabilities2 = {}\n\n let line\n while (true) {\n line = await read()\n if (line === true) break\n if (line === null) continue\n line = line.toString('utf8').replace(/\\n$/, '')\n const i = line.indexOf('=')\n if (i > -1) {\n const key = line.slice(0, i)\n const value = line.slice(i + 1)\n capabilities2[key] = value\n } else {\n capabilities2[line] = true\n }\n }\n return { protocolVersion: 2, capabilities2 }\n}\n","import { EmptyServerResponseError } from '../errors/EmptyServerResponseError.js'\nimport { ParseError } from '../errors/ParseError.js'\nimport { GitPktLine } from '../models/GitPktLine.js'\nimport { parseCapabilitiesV2 } from '../wire/parseCapabilitiesV2.js'\n\nexport async function parseRefsAdResponse(stream, { service }) {\n const capabilities = new Set()\n const refs = new Map()\n const symrefs = new Map()\n\n // There is probably a better way to do this, but for now\n // let's just throw the result parser inline here.\n const read = GitPktLine.streamReader(stream)\n let lineOne = await read()\n // skip past any flushes\n while (lineOne === null) lineOne = await read()\n\n if (lineOne === true) throw new EmptyServerResponseError()\n\n // Handle protocol v2 responses (Bitbucket Server doesn't include a `# service=` line)\n if (lineOne.includes('version 2')) {\n return parseCapabilitiesV2(read)\n }\n\n // Clients MUST ignore an LF at the end of the line.\n if (lineOne.toString('utf8').replace(/\\n$/, '') !== `# service=${service}`) {\n throw new ParseError(`# service=${service}\\\\n`, lineOne.toString('utf8'))\n }\n let lineTwo = await read()\n // skip past any flushes\n while (lineTwo === null) lineTwo = await read()\n // In the edge case of a brand new repo, zero refs (and zero capabilities)\n // are returned.\n if (lineTwo === true) return { capabilities, refs, symrefs }\n lineTwo = lineTwo.toString('utf8')\n\n // Handle protocol v2 responses\n if (lineTwo.includes('version 2')) {\n return parseCapabilitiesV2(read)\n }\n\n const [firstRef, capabilitiesLine] = splitAndAssert(lineTwo, '\\x00', '\\\\x00')\n capabilitiesLine.split(' ').map(x => capabilities.add(x))\n // see no-refs in https://git-scm.com/docs/pack-protocol#_reference_discovery (since git 2.41.0)\n if (firstRef !== '0000000000000000000000000000000000000000 capabilities^{}') {\n const [ref, name] = splitAndAssert(firstRef, ' ', ' ')\n refs.set(name, ref)\n while (true) {\n const line = await read()\n if (line === true) break\n if (line !== null) {\n const [ref, name] = splitAndAssert(line.toString('utf8'), ' ', ' ')\n refs.set(name, ref)\n }\n }\n }\n // Symrefs are thrown into the \"capabilities\" unfortunately.\n for (const cap of capabilities) {\n if (cap.startsWith('symref=')) {\n const m = cap.match(/symref=([^:]+):(.*)/)\n if (m.length === 3) {\n symrefs.set(m[1], m[2])\n }\n }\n }\n return { protocolVersion: 1, capabilities, refs, symrefs }\n}\n\nfunction splitAndAssert(line, sep, expected) {\n const split = line.trim().split(sep)\n if (split.length !== 2) {\n throw new ParseError(\n `Two strings separated by '${expected}'`,\n line.toString('utf8')\n )\n }\n return split\n}\n","import { fromValue } from '../utils/fromValue.js'\n\nexport function getIterator(iterable) {\n if (iterable[Symbol.asyncIterator]) {\n return iterable[Symbol.asyncIterator]()\n }\n if (iterable[Symbol.iterator]) {\n return iterable[Symbol.iterator]()\n }\n if (iterable.next) {\n return iterable\n }\n return fromValue(iterable)\n}\n","// Convert a value to an Async Iterator\n// This will be easier with async generator functions.\nexport function fromValue(value) {\n let queue = [value]\n return {\n next() {\n return Promise.resolve({ done: queue.length === 0, value: queue.pop() })\n },\n return() {\n queue = []\n return {}\n },\n [Symbol.asyncIterator]() {\n return this\n },\n }\n}\n","export function indent(str) {\n return (\n str\n .trim()\n .split('\\n')\n .map(x => ' ' + x)\n .join('\\n') + '\\n'\n )\n}\n","'use strict';\n\nconst processFn = (fn, options) => function (...args) {\n\tconst P = options.promiseModule;\n\n\treturn new P((resolve, reject) => {\n\t\tif (options.multiArgs) {\n\t\t\targs.push((...result) => {\n\t\t\t\tif (options.errorFirst) {\n\t\t\t\t\tif (result[0]) {\n\t\t\t\t\t\treject(result);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.shift();\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (options.errorFirst) {\n\t\t\targs.push((error, result) => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\targs.push(resolve);\n\t\t}\n\n\t\tfn.apply(this, args);\n\t});\n};\n\nmodule.exports = (input, options) => {\n\toptions = Object.assign({\n\t\texclude: [/.+(Sync|Stream)$/],\n\t\terrorFirst: true,\n\t\tpromiseModule: Promise\n\t}, options);\n\n\tconst objType = typeof input;\n\tif (!(input !== null && (objType === 'object' || objType === 'function'))) {\n\t\tthrow new TypeError(`Expected \\`input\\` to be a \\`Function\\` or \\`Object\\`, got \\`${input === null ? 'null' : objType}\\``);\n\t}\n\n\tconst filter = key => {\n\t\tconst match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key);\n\t\treturn options.include ? options.include.some(match) : !options.exclude.some(match);\n\t};\n\n\tlet ret;\n\tif (objType === 'function') {\n\t\tret = function (...args) {\n\t\t\treturn options.excludeMain ? input(...args) : processFn(input, options).apply(this, args);\n\t\t};\n\t} else {\n\t\tret = Object.create(Object.getPrototypeOf(input));\n\t}\n\n\tfor (const key in input) { // eslint-disable-line guard-for-in\n\t\tconst property = input[key];\n\t\tret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property;\n\t}\n\n\treturn ret;\n};\n","// @see https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions\nconst abbreviateRx = new RegExp('^refs/(heads/|tags/|remotes/)?(.*)')\n\nexport function abbreviateRef(ref) {\n const match = abbreviateRx.exec(ref)\n if (match) {\n if (match[1] === 'remotes/' && ref.endsWith('/HEAD')) {\n return match[2].slice(0, -5)\n } else {\n return match[2]\n }\n }\n return ref\n}\n","export * from './AlreadyExistsError.js'\nexport * from './AmbiguousError.js'\n// BaseError.js\nexport * from './CheckoutConflictError.js'\nexport * from './CommitNotFetchedError.js'\nexport * from './EmptyServerResponseError.js'\nexport * from './FastForwardError.js'\nexport * from './GitPushError.js'\nexport * from './HttpError.js'\n// index.js\nexport * from './InternalError.js'\nexport * from './InvalidFilepathError.js'\nexport * from './InvalidOidError.js'\nexport * from './InvalidRefNameError.js'\nexport * from './MaxDepthError.js'\nexport * from './MergeNotSupportedError.js'\nexport * from './MergeConflictError.js'\nexport * from './MissingNameError.js'\nexport * from './MissingParameterError.js'\nexport * from './MultipleGitError.js'\nexport * from './NoRefspecError.js'\nexport * from './NotFoundError.js'\nexport * from './ObjectTypeError.js'\nexport * from './ParseError.js'\nexport * from './PushRejectedError.js'\nexport * from './RemoteCapabilityError.js'\nexport * from './SmartHttpError.js'\nexport * from './UnknownTransportError.js'\nexport * from './UnsafeFilepathError.js'\nexport * from './UrlParseError.js'\nexport * from './UserCanceledError.js'\nexport * from './UnmergedPathsError.js'\nexport * from './IndexResetError.js'\n","import { BaseError } from './BaseError.js'\n\nexport class PushRejectedError extends BaseError {\n /**\n * @param {'not-fast-forward'|'tag-exists'} reason\n */\n constructor(reason) {\n let message = ''\n if (reason === 'not-fast-forward') {\n message = ' because it was not a simple fast-forward'\n } else if (reason === 'tag-exists') {\n message = ' because tag already exists'\n }\n super(`Push rejected${message}. Use \"force: true\" to override.`)\n this.code = this.name = PushRejectedError.code\n this.data = { reason }\n }\n}\n/** @type {'PushRejectedError'} */\nPushRejectedError.code = 'PushRejectedError'\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\n\n/**\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.message\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n * @param {boolean} [args.dryRun = false]\n * @param {boolean} [args.noUpdateBranch = false]\n * @param {string} [args.ref]\n * @param {string[]} [args.parent]\n * @param {string} [args.tree]\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly created commit.\n */\nexport async function _commit({\n fs,\n cache,\n onSign,\n gitdir,\n message,\n author,\n committer,\n signingKey,\n dryRun = false,\n noUpdateBranch = false,\n ref,\n parent,\n tree,\n}) {\n if (!ref) {\n ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2,\n })\n }\n\n return GitIndexManager.acquire(\n { fs, gitdir, cache, allowUnmerged: false },\n async function(index) {\n const inodes = flatFileListToDirectoryStructure(index.entries)\n const inode = inodes.get('.')\n if (!tree) {\n tree = await constructTree({ fs, gitdir, inode, dryRun })\n }\n if (!parent) {\n try {\n parent = [\n await GitRefManager.resolve({\n fs,\n gitdir,\n ref,\n }),\n ]\n } catch (err) {\n // Probably an initial commit\n parent = []\n }\n } else {\n // ensure that the parents are oids, not refs\n parent = await Promise.all(\n parent.map(p => {\n return GitRefManager.resolve({ fs, gitdir, ref: p })\n })\n )\n }\n\n let comm = GitCommit.from({\n tree,\n parent,\n author,\n committer,\n message,\n })\n if (signingKey) {\n comm = await GitCommit.sign(comm, onSign, signingKey)\n }\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object: comm.toObject(),\n dryRun,\n })\n if (!noUpdateBranch && !dryRun) {\n // Update branch pointer\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref,\n value: oid,\n })\n }\n return oid\n }\n )\n}\n\nasync function constructTree({ fs, gitdir, inode, dryRun }) {\n // use depth first traversal\n const children = inode.children\n for (const inode of children) {\n if (inode.type === 'tree') {\n inode.metadata.mode = '040000'\n inode.metadata.oid = await constructTree({ fs, gitdir, inode, dryRun })\n }\n }\n const entries = children.map(inode => ({\n mode: inode.metadata.mode,\n path: inode.basename,\n oid: inode.metadata.oid,\n type: inode.type,\n }))\n const tree = GitTree.from(entries)\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object: tree.toObject(),\n dryRun,\n })\n return oid\n}\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","import { BaseError } from './BaseError.js'\n\nexport class AmbiguousError extends BaseError {\n /**\n * @param {'oids'|'refs'} nouns\n * @param {string} short\n * @param {string[]} matches\n */\n constructor(nouns, short, matches) {\n super(\n `Found multiple ${nouns} matching \"${short}\" (${matches.join(\n ', '\n )}). Use a longer abbreviation length to disambiguate them.`\n )\n this.code = this.name = AmbiguousError.code\n this.data = { nouns, short, matches }\n }\n}\n/** @type {'AmbiguousError'} */\nAmbiguousError.code = 'AmbiguousError'\n","import { BaseError } from './BaseError.js'\n\nexport class CheckoutConflictError extends BaseError {\n /**\n * @param {string[]} filepaths\n */\n constructor(filepaths) {\n super(\n `Your local changes to the following files would be overwritten by checkout: ${filepaths.join(\n ', '\n )}`\n )\n this.code = this.name = CheckoutConflictError.code\n this.data = { filepaths }\n }\n}\n/** @type {'CheckoutConflictError'} */\nCheckoutConflictError.code = 'CheckoutConflictError'\n","import { BaseError } from './BaseError.js'\n\nexport class CommitNotFetchedError extends BaseError {\n /**\n * @param {string} ref\n * @param {string} oid\n */\n constructor(ref, oid) {\n super(\n `Failed to checkout \"${ref}\" because commit ${oid} is not available locally. Do a git fetch to make the branch available locally.`\n )\n this.code = this.name = CommitNotFetchedError.code\n this.data = { ref, oid }\n }\n}\n/** @type {'CommitNotFetchedError'} */\nCommitNotFetchedError.code = 'CommitNotFetchedError'\n","import { BaseError } from './BaseError.js'\n\nexport class FastForwardError extends BaseError {\n constructor() {\n super(`A simple fast-forward merge was not possible.`)\n this.code = this.name = FastForwardError.code\n this.data = {}\n }\n}\n/** @type {'FastForwardError'} */\nFastForwardError.code = 'FastForwardError'\n","import '../typedefs.js'\nimport { BaseError } from './BaseError.js'\n\nexport class GitPushError extends BaseError {\n /**\n * @param {string} prettyDetails\n * @param {PushResult} result\n */\n constructor(prettyDetails, result) {\n super(`One or more branches were not updated: ${prettyDetails}`)\n this.code = this.name = GitPushError.code\n this.data = { prettyDetails, result }\n }\n}\n/** @type {'GitPushError'} */\nGitPushError.code = 'GitPushError'\n","import { BaseError } from './BaseError.js'\n\nexport class MaxDepthError extends BaseError {\n /**\n * @param {number} depth\n */\n constructor(depth) {\n super(`Maximum search depth of ${depth} exceeded.`)\n this.code = this.name = MaxDepthError.code\n this.data = { depth }\n }\n}\n/** @type {'MaxDepthError'} */\nMaxDepthError.code = 'MaxDepthError'\n","import { BaseError } from './BaseError.js'\n\nexport class MultipleGitError extends BaseError {\n /**\n * @param {Error[]} errors\n * @param {string} message\n */\n constructor(errors) {\n super(\n `There are multiple errors that were thrown by the method. Please refer to the \"errors\" property to see more`\n )\n this.code = this.name = MultipleGitError.code\n this.data = { errors }\n this.errors = errors\n }\n}\n/** @type {'MultipleGitError'} */\nMultipleGitError.code = 'MultipleGitError'\n","import { BaseError } from './BaseError.js'\n\nexport class IndexResetError extends BaseError {\n /**\n * @param {Array} filepaths\n */\n constructor(filepath) {\n super(\n `Could not merge index: Entry for '${filepath}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`\n )\n this.code = this.name = IndexResetError.code\n this.data = { filepath }\n }\n}\n/** @type {'IndexResetError'} */\nIndexResetError.code = 'IndexResetError'\n","import { InternalError } from '../errors/InternalError.js'\nimport { UnsafeFilepathError } from '../errors/UnsafeFilepathError.js'\nimport { BufferCursor } from '../utils/BufferCursor.js'\nimport { comparePath } from '../utils/comparePath.js'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\n// Extract 1-bit assume-valid, 1-bit extended flag, 2-bit merge state flag, 12-bit path length flag\nfunction parseCacheEntryFlags(bits) {\n return {\n assumeValid: Boolean(bits & 0b1000000000000000),\n extended: Boolean(bits & 0b0100000000000000),\n stage: (bits & 0b0011000000000000) >> 12,\n nameLength: bits & 0b0000111111111111,\n }\n}\n\nfunction renderCacheEntryFlags(entry) {\n const flags = entry.flags\n // 1-bit extended flag (must be zero in version 2)\n flags.extended = false\n // 12-bit name length if the length is less than 0xFFF; otherwise 0xFFF\n // is stored in this field.\n flags.nameLength = Math.min(Buffer.from(entry.path).length, 0xfff)\n return (\n (flags.assumeValid ? 0b1000000000000000 : 0) +\n (flags.extended ? 0b0100000000000000 : 0) +\n ((flags.stage & 0b11) << 12) +\n (flags.nameLength & 0b111111111111)\n )\n}\n\nexport class GitIndex {\n /*::\n _entries: Map\n _dirty: boolean // Used to determine if index needs to be saved to filesystem\n */\n constructor(entries, unmergedPaths) {\n this._dirty = false\n this._unmergedPaths = unmergedPaths || new Set()\n this._entries = entries || new Map()\n }\n\n _addEntry(entry) {\n if (entry.flags.stage === 0) {\n entry.stages = [entry]\n this._entries.set(entry.path, entry)\n this._unmergedPaths.delete(entry.path)\n } else {\n let existingEntry = this._entries.get(entry.path)\n if (!existingEntry) {\n this._entries.set(entry.path, entry)\n existingEntry = entry\n }\n existingEntry.stages[entry.flags.stage] = entry\n this._unmergedPaths.add(entry.path)\n }\n }\n\n static async from(buffer) {\n if (Buffer.isBuffer(buffer)) {\n return GitIndex.fromBuffer(buffer)\n } else if (buffer === null) {\n return new GitIndex(null)\n } else {\n throw new InternalError('invalid type passed to GitIndex.from')\n }\n }\n\n static async fromBuffer(buffer) {\n if (buffer.length === 0) {\n throw new InternalError('Index file is empty (.git/index)')\n }\n\n const index = new GitIndex()\n const reader = new BufferCursor(buffer)\n const magic = reader.toString('utf8', 4)\n if (magic !== 'DIRC') {\n throw new InternalError(`Invalid dircache magic file number: ${magic}`)\n }\n\n // Verify shasum after we ensured that the file has a magic number\n const shaComputed = await shasum(buffer.slice(0, -20))\n const shaClaimed = buffer.slice(-20).toString('hex')\n if (shaClaimed !== shaComputed) {\n throw new InternalError(\n `Invalid checksum in GitIndex buffer: expected ${shaClaimed} but saw ${shaComputed}`\n )\n }\n\n const version = reader.readUInt32BE()\n if (version !== 2) {\n throw new InternalError(`Unsupported dircache version: ${version}`)\n }\n const numEntries = reader.readUInt32BE()\n let i = 0\n while (!reader.eof() && i < numEntries) {\n const entry = {}\n entry.ctimeSeconds = reader.readUInt32BE()\n entry.ctimeNanoseconds = reader.readUInt32BE()\n entry.mtimeSeconds = reader.readUInt32BE()\n entry.mtimeNanoseconds = reader.readUInt32BE()\n entry.dev = reader.readUInt32BE()\n entry.ino = reader.readUInt32BE()\n entry.mode = reader.readUInt32BE()\n entry.uid = reader.readUInt32BE()\n entry.gid = reader.readUInt32BE()\n entry.size = reader.readUInt32BE()\n entry.oid = reader.slice(20).toString('hex')\n const flags = reader.readUInt16BE()\n entry.flags = parseCacheEntryFlags(flags)\n // TODO: handle if (version === 3 && entry.flags.extended)\n const pathlength = buffer.indexOf(0, reader.tell() + 1) - reader.tell()\n if (pathlength < 1) {\n throw new InternalError(`Got a path length of: ${pathlength}`)\n }\n // TODO: handle pathnames larger than 12 bits\n entry.path = reader.toString('utf8', pathlength)\n\n // Prevent malicious paths like \"..\\foo\"\n if (entry.path.includes('..\\\\') || entry.path.includes('../')) {\n throw new UnsafeFilepathError(entry.path)\n }\n\n // The next bit is awkward. We expect 1 to 8 null characters\n // such that the total size of the entry is a multiple of 8 bits.\n // (Hence subtract 12 bytes for the header.)\n let padding = 8 - ((reader.tell() - 12) % 8)\n if (padding === 0) padding = 8\n while (padding--) {\n const tmp = reader.readUInt8()\n if (tmp !== 0) {\n throw new InternalError(\n `Expected 1-8 null characters but got '${tmp}' after ${entry.path}`\n )\n } else if (reader.eof()) {\n throw new InternalError('Unexpected end of file')\n }\n }\n // end of awkward part\n entry.stages = []\n\n index._addEntry(entry)\n\n i++\n }\n return index\n }\n\n get unmergedPaths() {\n return [...this._unmergedPaths]\n }\n\n get entries() {\n return [...this._entries.values()].sort(comparePath)\n }\n\n get entriesMap() {\n return this._entries\n }\n\n get entriesFlat() {\n return [...this.entries].flatMap(entry => {\n return entry.stages.length > 1 ? entry.stages.filter(x => x) : entry\n })\n }\n\n *[Symbol.iterator]() {\n for (const entry of this.entries) {\n yield entry\n }\n }\n\n insert({ filepath, stats, oid, stage = 0 }) {\n if (!stats) {\n stats = {\n ctimeSeconds: 0,\n ctimeNanoseconds: 0,\n mtimeSeconds: 0,\n mtimeNanoseconds: 0,\n dev: 0,\n ino: 0,\n mode: 0,\n uid: 0,\n gid: 0,\n size: 0,\n }\n }\n stats = normalizeStats(stats)\n const bfilepath = Buffer.from(filepath)\n const entry = {\n ctimeSeconds: stats.ctimeSeconds,\n ctimeNanoseconds: stats.ctimeNanoseconds,\n mtimeSeconds: stats.mtimeSeconds,\n mtimeNanoseconds: stats.mtimeNanoseconds,\n dev: stats.dev,\n ino: stats.ino,\n // We provide a fallback value for `mode` here because not all fs\n // implementations assign it, but we use it in GitTree.\n // '100644' is for a \"regular non-executable file\"\n mode: stats.mode || 0o100644,\n uid: stats.uid,\n gid: stats.gid,\n size: stats.size,\n path: filepath,\n oid: oid,\n flags: {\n assumeValid: false,\n extended: false,\n stage,\n nameLength: bfilepath.length < 0xfff ? bfilepath.length : 0xfff,\n },\n stages: [],\n }\n\n this._addEntry(entry)\n\n this._dirty = true\n }\n\n delete({ filepath }) {\n if (this._entries.has(filepath)) {\n this._entries.delete(filepath)\n } else {\n for (const key of this._entries.keys()) {\n if (key.startsWith(filepath + '/')) {\n this._entries.delete(key)\n }\n }\n }\n\n if (this._unmergedPaths.has(filepath)) {\n this._unmergedPaths.delete(filepath)\n }\n this._dirty = true\n }\n\n clear() {\n this._entries.clear()\n this._dirty = true\n }\n\n has({ filepath }) {\n return this._entries.has(filepath)\n }\n\n render() {\n return this.entries\n .map(entry => `${entry.mode.toString(8)} ${entry.oid} ${entry.path}`)\n .join('\\n')\n }\n\n static async _entryToBuffer(entry) {\n const bpath = Buffer.from(entry.path)\n // the fixed length + the filename + at least one null char => align by 8\n const length = Math.ceil((62 + bpath.length + 1) / 8) * 8\n const written = Buffer.alloc(length)\n const writer = new BufferCursor(written)\n const stat = normalizeStats(entry)\n writer.writeUInt32BE(stat.ctimeSeconds)\n writer.writeUInt32BE(stat.ctimeNanoseconds)\n writer.writeUInt32BE(stat.mtimeSeconds)\n writer.writeUInt32BE(stat.mtimeNanoseconds)\n writer.writeUInt32BE(stat.dev)\n writer.writeUInt32BE(stat.ino)\n writer.writeUInt32BE(stat.mode)\n writer.writeUInt32BE(stat.uid)\n writer.writeUInt32BE(stat.gid)\n writer.writeUInt32BE(stat.size)\n writer.write(entry.oid, 20, 'hex')\n writer.writeUInt16BE(renderCacheEntryFlags(entry))\n writer.write(entry.path, bpath.length, 'utf8')\n return written\n }\n\n async toObject() {\n const header = Buffer.alloc(12)\n const writer = new BufferCursor(header)\n writer.write('DIRC', 4, 'utf8')\n writer.writeUInt32BE(2)\n writer.writeUInt32BE(this.entriesFlat.length)\n\n let entryBuffers = []\n for (const entry of this.entries) {\n entryBuffers.push(GitIndex._entryToBuffer(entry))\n if (entry.stages.length > 1) {\n for (const stage of entry.stages) {\n if (stage && stage !== entry) {\n entryBuffers.push(GitIndex._entryToBuffer(stage))\n }\n }\n }\n }\n entryBuffers = await Promise.all(entryBuffers)\n\n const body = Buffer.concat(entryBuffers)\n const main = Buffer.concat([header, body])\n const sum = await shasum(main)\n return Buffer.concat([main, Buffer.from(sum, 'hex')])\n }\n}\n","import { basename } from '../utils/basename.js'\nimport { dirname } from '../utils/dirname.js'\n\n/*::\ntype Node = {\n type: string,\n fullpath: string,\n basename: string,\n metadata: Object, // mode, oid\n parent?: Node,\n children: Array\n}\n*/\n\nexport function flatFileListToDirectoryStructure(files) {\n const inodes = new Map()\n const mkdir = function(name) {\n if (!inodes.has(name)) {\n const dir = {\n type: 'tree',\n fullpath: name,\n basename: basename(name),\n metadata: {},\n children: [],\n }\n inodes.set(name, dir)\n // This recursively generates any missing parent folders.\n // We do it after we've added the inode to the set so that\n // we don't recurse infinitely trying to create the root '.' dirname.\n dir.parent = mkdir(dirname(name))\n if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir)\n }\n return inodes.get(name)\n }\n\n const mkfile = function(name, metadata) {\n if (!inodes.has(name)) {\n const file = {\n type: 'blob',\n fullpath: name,\n basename: basename(name),\n metadata: metadata,\n // This recursively generates any missing parent folders.\n parent: mkdir(dirname(name)),\n children: [],\n }\n if (file.parent) file.parent.children.push(file)\n inodes.set(name, file)\n }\n return inodes.get(name)\n }\n\n mkdir('.')\n for (const file of files) {\n mkfile(file.path, file)\n }\n return inodes\n}\n","// This is straight from parse_unit_factor in config.c of canonical git\nconst num = val => {\n val = val.toLowerCase()\n let n = parseInt(val)\n if (val.endsWith('k')) n *= 1024\n if (val.endsWith('m')) n *= 1024 * 1024\n if (val.endsWith('g')) n *= 1024 * 1024 * 1024\n return n\n}\n\n// This is straight from git_parse_maybe_bool_text in config.c of canonical git\nconst bool = val => {\n val = val.trim().toLowerCase()\n if (val === 'true' || val === 'yes' || val === 'on') return true\n if (val === 'false' || val === 'no' || val === 'off') return false\n throw Error(\n `Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${val}`\n )\n}\n\nconst schema = {\n core: {\n filemode: bool,\n bare: bool,\n logallrefupdates: bool,\n symlinks: bool,\n ignorecase: bool,\n bigFileThreshold: num,\n },\n}\n\n// https://git-scm.com/docs/git-config#_syntax\n\n// section starts with [ and ends with ]\n// section is alphanumeric (ASCII) with - and .\n// section is case insensitive\n// subsection is optional\n// subsection is specified after section and one or more spaces\n// subsection is specified between double quotes\nconst SECTION_LINE_REGEX = /^\\[([A-Za-z0-9-.]+)(?: \"(.*)\")?\\]$/\nconst SECTION_REGEX = /^[A-Za-z0-9-.]+$/\n\n// variable lines contain a name, and equal sign and then a value\n// variable lines can also only contain a name (the implicit value is a boolean true)\n// variable name is alphanumeric (ASCII) with -\n// variable name starts with an alphabetic character\n// variable name is case insensitive\nconst VARIABLE_LINE_REGEX = /^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/\nconst VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/\n\nconst VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/\n\nconst extractSectionLine = line => {\n const matches = SECTION_LINE_REGEX.exec(line)\n if (matches != null) {\n const [section, subsection] = matches.slice(1)\n return [section, subsection]\n }\n return null\n}\n\nconst extractVariableLine = line => {\n const matches = VARIABLE_LINE_REGEX.exec(line)\n if (matches != null) {\n const [name, rawValue = 'true'] = matches.slice(1)\n const valueWithoutComments = removeComments(rawValue)\n const valueWithoutQuotes = removeQuotes(valueWithoutComments)\n return [name, valueWithoutQuotes]\n }\n return null\n}\n\nconst removeComments = rawValue => {\n const commentMatches = VARIABLE_VALUE_COMMENT_REGEX.exec(rawValue)\n if (commentMatches == null) {\n return rawValue\n }\n const [valueWithoutComment, comment] = commentMatches.slice(1)\n // if odd number of quotes before and after comment => comment is escaped\n if (\n hasOddNumberOfQuotes(valueWithoutComment) &&\n hasOddNumberOfQuotes(comment)\n ) {\n return `${valueWithoutComment}${comment}`\n }\n return valueWithoutComment\n}\n\nconst hasOddNumberOfQuotes = text => {\n const numberOfQuotes = (text.match(/(?:^|[^\\\\])\"/g) || []).length\n return numberOfQuotes % 2 !== 0\n}\n\nconst removeQuotes = text => {\n return text.split('').reduce((newText, c, idx, text) => {\n const isQuote = c === '\"' && text[idx - 1] !== '\\\\'\n const isEscapeForQuote = c === '\\\\' && text[idx + 1] === '\"'\n if (isQuote || isEscapeForQuote) {\n return newText\n }\n return newText + c\n }, '')\n}\n\nconst lower = text => {\n return text != null ? text.toLowerCase() : null\n}\n\nconst getPath = (section, subsection, name) => {\n return [lower(section), subsection, lower(name)]\n .filter(a => a != null)\n .join('.')\n}\n\nconst normalizePath = path => {\n const pathSegments = path.split('.')\n const section = pathSegments.shift()\n const name = pathSegments.pop()\n const subsection = pathSegments.length ? pathSegments.join('.') : undefined\n\n return {\n section,\n subsection,\n name,\n path: getPath(section, subsection, name),\n sectionPath: getPath(section, subsection, null),\n }\n}\n\nconst findLastIndex = (array, callback) => {\n return array.reduce((lastIndex, item, index) => {\n return callback(item) ? index : lastIndex\n }, -1)\n}\n\n// Note: there are a LOT of edge cases that aren't covered (e.g. keys in sections that also\n// have subsections, [include] directives, etc.\nexport class GitConfig {\n constructor(text) {\n let section = null\n let subsection = null\n this.parsedConfig = text.split('\\n').map(line => {\n let name = null\n let value = null\n\n const trimmedLine = line.trim()\n const extractedSection = extractSectionLine(trimmedLine)\n const isSection = extractedSection != null\n if (isSection) {\n ;[section, subsection] = extractedSection\n } else {\n const extractedVariable = extractVariableLine(trimmedLine)\n const isVariable = extractedVariable != null\n if (isVariable) {\n ;[name, value] = extractedVariable\n }\n }\n\n const path = getPath(section, subsection, name)\n return { line, isSection, section, subsection, name, value, path }\n })\n }\n\n static from(text) {\n return new GitConfig(text)\n }\n\n async get(path, getall = false) {\n const normalizedPath = normalizePath(path).path\n const allValues = this.parsedConfig\n .filter(config => config.path === normalizedPath)\n .map(({ section, name, value }) => {\n const fn = schema[section] && schema[section][name]\n return fn ? fn(value) : value\n })\n return getall ? allValues : allValues.pop()\n }\n\n async getall(path) {\n return this.get(path, true)\n }\n\n async getSubsections(section) {\n return this.parsedConfig\n .filter(config => config.section === section && config.isSection)\n .map(config => config.subsection)\n }\n\n async deleteSection(section, subsection) {\n this.parsedConfig = this.parsedConfig.filter(\n config =>\n !(config.section === section && config.subsection === subsection)\n )\n }\n\n async append(path, value) {\n return this.set(path, value, true)\n }\n\n async set(path, value, append = false) {\n const {\n section,\n subsection,\n name,\n path: normalizedPath,\n sectionPath,\n } = normalizePath(path)\n const configIndex = findLastIndex(\n this.parsedConfig,\n config => config.path === normalizedPath\n )\n if (value == null) {\n if (configIndex !== -1) {\n this.parsedConfig.splice(configIndex, 1)\n }\n } else {\n if (configIndex !== -1) {\n const config = this.parsedConfig[configIndex]\n // Name should be overwritten in case the casing changed\n const modifiedConfig = Object.assign({}, config, {\n name,\n value,\n modified: true,\n })\n if (append) {\n this.parsedConfig.splice(configIndex + 1, 0, modifiedConfig)\n } else {\n this.parsedConfig[configIndex] = modifiedConfig\n }\n } else {\n const sectionIndex = this.parsedConfig.findIndex(\n config => config.path === sectionPath\n )\n const newConfig = {\n section,\n subsection,\n name,\n value,\n modified: true,\n path: normalizedPath,\n }\n if (SECTION_REGEX.test(section) && VARIABLE_NAME_REGEX.test(name)) {\n if (sectionIndex >= 0) {\n // Reuse existing section\n this.parsedConfig.splice(sectionIndex + 1, 0, newConfig)\n } else {\n // Add a new section\n const newSection = {\n section,\n subsection,\n modified: true,\n path: sectionPath,\n }\n this.parsedConfig.push(newSection, newConfig)\n }\n }\n }\n }\n }\n\n toString() {\n return this.parsedConfig\n .map(({ line, section, subsection, name, value, modified = false }) => {\n if (!modified) {\n return line\n }\n if (name != null && value != null) {\n if (typeof value === 'string' && /[#;]/.test(value)) {\n // A `#` or `;` symbol denotes a comment, so we have to wrap it in double quotes\n return `\\t${name} = \"${value}\"`\n }\n return `\\t${name} = ${value}`\n }\n if (subsection != null) {\n return `[${section} \"${subsection}\"]`\n }\n return `[${section}]`\n })\n .join('\\n')\n }\n}\n","import { GitRefSpec } from './GitRefSpec'\n\nexport class GitRefSpecSet {\n constructor(rules = []) {\n this.rules = rules\n }\n\n static from(refspecs) {\n const rules = []\n for (const refspec of refspecs) {\n rules.push(GitRefSpec.from(refspec)) // might throw\n }\n return new GitRefSpecSet(rules)\n }\n\n add(refspec) {\n const rule = GitRefSpec.from(refspec) // might throw\n this.rules.push(rule)\n }\n\n translate(remoteRefs) {\n const result = []\n for (const rule of this.rules) {\n for (const remoteRef of remoteRefs) {\n const localRef = rule.translate(remoteRef)\n if (localRef) {\n result.push([remoteRef, localRef])\n }\n }\n }\n return result\n }\n\n translateOne(remoteRef) {\n let result = null\n for (const rule of this.rules) {\n const localRef = rule.translate(remoteRef)\n if (localRef) {\n result = localRef\n }\n }\n return result\n }\n\n localNamespaces() {\n return this.rules\n .filter(rule => rule.matchPrefix)\n .map(rule => rule.localPath.replace(/\\/$/, ''))\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function readObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n getExternalRefDelta,\n}) {\n // Check to see if it's in a packfile.\n // Iterate through all the .idx files\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // If the packfile DOES have the oid we're looking for...\n if (p.offsets.has(oid)) {\n // Get the resolved git object from the packfile\n if (!p.pack) {\n const packFile = indexFile.replace(/idx$/, 'pack')\n p.pack = fs.read(packFile)\n }\n const result = await p.read({ oid, getExternalRefDelta })\n result.format = 'content'\n result.source = `objects/pack/${filename.replace(/idx$/, 'pack')}`\n return result\n }\n }\n // Failed to find it\n return null\n}\n","import diff3Merge from 'diff3'\n\nconst LINEBREAKS = /^.*(\\r?\\n|$)/gm\n\nexport function mergeFile({ branches, contents }) {\n const ourName = branches[1]\n const theirName = branches[2]\n\n const baseContent = contents[0]\n const ourContent = contents[1]\n const theirContent = contents[2]\n\n const ours = ourContent.match(LINEBREAKS)\n const base = baseContent.match(LINEBREAKS)\n const theirs = theirContent.match(LINEBREAKS)\n\n // Here we let the diff3 library do the heavy lifting.\n const result = diff3Merge(ours, base, theirs)\n\n const markerSize = 7\n\n // Here we note whether there are conflicts and format the results\n let mergedText = ''\n let cleanMerge = true\n\n for (const item of result) {\n if (item.ok) {\n mergedText += item.ok.join('')\n }\n if (item.conflict) {\n cleanMerge = false\n mergedText += `${'<'.repeat(markerSize)} ${ourName}\\n`\n mergedText += item.conflict.a.join('')\n\n mergedText += `${'='.repeat(markerSize)}\\n`\n mergedText += item.conflict.b.join('')\n mergedText += `${'>'.repeat(markerSize)} ${theirName}\\n`\n }\n }\n return { cleanMerge, mergedText }\n}\n","import Hash from 'sha.js/sha1.js'\n\nimport { types } from '../commands/types.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { deflate } from '../utils/deflate.js'\nimport { join } from '../utils/join.js'\nimport { padHex } from '../utils/padHex.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids\n */\nexport async function _pack({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n}) {\n const hash = new Hash()\n const outputStream = []\n function write(chunk, enc) {\n const buff = Buffer.from(chunk, enc)\n outputStream.push(buff)\n hash.update(buff)\n }\n async function writeObject({ stype, object }) {\n // Object type is encoded in bits 654\n const type = types[stype]\n // The length encoding gets complicated.\n let length = object.length\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n let multibyte = length > 0b1111 ? 0b10000000 : 0b0\n // Last four bits of length is encoded in bits 3210\n const lastFour = length & 0b1111\n // Discard those bits\n length = length >>> 4\n // The first byte is then (1-bit multibyte?), (3-bit type), (4-bit least sig 4-bits of length)\n let byte = (multibyte | type | lastFour).toString(16)\n write(byte, 'hex')\n // Now we keep chopping away at length 7-bits at a time until its zero,\n // writing out the bytes in what amounts to little-endian order.\n while (multibyte) {\n multibyte = length > 0b01111111 ? 0b10000000 : 0b0\n byte = multibyte | (length & 0b01111111)\n write(padHex(2, byte), 'hex')\n length = length >>> 7\n }\n // Lastly, we can compress and write the object.\n write(Buffer.from(await deflate(object)))\n }\n write('PACK')\n write('00000002', 'hex')\n // Write a 4 byte (32-bit) int\n write(padHex(8, oids.length), 'hex')\n for (const oid of oids) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n await writeObject({ write, object, stype: type })\n }\n // Write SHA1 checksum\n const digest = hash.digest()\n outputStream.push(digest)\n return outputStream\n}\n","// TODO: Should I just polyfill Array.flat?\nexport const flat =\n typeof Array.prototype.flat === 'undefined'\n ? entries => entries.reduce((acc, x) => acc.concat(x), [])\n : entries => entries.flat()\n","import { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {Iterable} args.oids\n * @returns {Promise>}\n */\nexport async function listObjects({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n}) {\n const visited = new Set()\n // We don't do the purest simplest recursion, because we can\n // avoid reading Blob objects entirely since the Tree objects\n // tell us which oids are Blobs and which are Trees.\n async function walk(oid) {\n if (visited.has(oid)) return\n visited.add(oid)\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n if (type === 'tag') {\n const tag = GitAnnotatedTag.from(object)\n const obj = tag.headers().object\n await walk(obj)\n } else if (type === 'commit') {\n const commit = GitCommit.from(object)\n const tree = commit.headers().tree\n await walk(tree)\n } else if (type === 'tree') {\n const tree = GitTree.from(object)\n for (const entry of tree) {\n // add blobs to the set\n // skip over submodules whose type is 'commit'\n if (entry.type === 'blob') {\n visited.add(entry.oid)\n }\n // recurse for trees\n if (entry.type === 'tree') {\n await walk(entry.oid)\n }\n }\n }\n }\n // Let's go walking!\n for (const oid of oids) {\n await walk(oid)\n }\n return visited\n}\n","import { join } from './join'\n\n/**\n * Removes the directory at the specified filepath recursively. Used internally to replicate the behavior of\n * fs.promises.rm({ recursive: true, force: true }) from Node.js 14 and above when not available. If the provided\n * filepath resolves to a file, it will be removed.\n *\n * @param {import('../models/FileSystem.js').FileSystem} fs\n * @param {string} filepath - The file or directory to remove.\n */\nexport async function rmRecursive(fs, filepath) {\n const entries = await fs.readdir(filepath)\n if (entries == null) {\n await fs.rm(filepath)\n } else if (entries.length) {\n await Promise.all(\n entries.map(entry => {\n const subpath = join(filepath, entry)\n return fs.lstat(subpath).then(stat => {\n if (!stat) return\n return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath)\n })\n })\n ).then(() => fs.rmdir(filepath))\n } else {\n await fs.rmdir(filepath)\n }\n}\n","export function extractAuthFromUrl(url) {\n // For whatever reason, the `fetch` API does not convert credentials embedded in the URL\n // into Basic Authentication headers automatically. Instead it throws an error!\n // So we must manually parse the URL, rip out the user:password portion if it is present\n // and compute the Authorization header.\n // Note: I tried using new URL(url) but that throws a security exception in Edge. :rolleyes:\n let userpass = url.match(/^https?:\\/\\/([^/]+)@/)\n // No credentials, return the url unmodified and an empty auth object\n if (userpass == null) return { url, auth: {} }\n userpass = userpass[1]\n const [username, password] = userpass.split(':')\n // Remove credentials from URL\n url = url.replace(`${userpass}@`, '')\n // Has credentials, return the fetch-safe URL and the parsed credentials\n return { url, auth: { username, password } }\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {TreeObject} args.tree\n *\n * @returns {Promise}\n */\nexport async function _writeTree({ fs, gitdir, tree }) {\n // Convert object to buffer\n const object = GitTree.from(tree).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { RemoteCapabilityError } from '../errors/RemoteCapabilityError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { hasObject } from '../storage/hasObject.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { collect } from '../utils/collect.js'\nimport { emptyPackfile } from '../utils/emptyPackfile.js'\nimport { filterCapabilities } from '../utils/filterCapabilities.js'\nimport { forAwait } from '../utils/forAwait.js'\nimport { join } from '../utils/join.js'\nimport { pkg } from '../utils/pkg.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseUploadPackResponse } from '../wire/parseUploadPackResponse.js'\nimport { writeUploadPackRequest } from '../wire/writeUploadPackRequest.js'\n\n/**\n *\n * @typedef {object} FetchResult - The object returned has the following schema:\n * @property {string | null} defaultBranch - The branch that is cloned if no branch is specified\n * @property {string | null} fetchHead - The SHA-1 object id of the fetched head commit\n * @property {string | null} fetchHeadDescription - a textual description of the branch that was fetched\n * @property {Object} [headers] - The HTTP response headers returned by the git server\n * @property {string[]} [pruned] - A list of branches that were pruned, if you provided the `prune` parameter\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.gitdir\n * @param {string|void} [args.url]\n * @param {string} [args.corsProxy]\n * @param {string} [args.ref]\n * @param {string} [args.remoteRef]\n * @param {string} [args.remote]\n * @param {boolean} [args.singleBranch = false]\n * @param {boolean} [args.tags = false]\n * @param {number} [args.depth]\n * @param {Date} [args.since]\n * @param {string[]} [args.exclude = []]\n * @param {boolean} [args.relative = false]\n * @param {Object} [args.headers]\n * @param {boolean} [args.prune]\n * @param {boolean} [args.pruneTags]\n *\n * @returns {Promise}\n * @see FetchResult\n */\nexport async function _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref: _ref,\n remoteRef: _remoteRef,\n remote: _remote,\n url: _url,\n corsProxy,\n depth = null,\n since = null,\n exclude = [],\n relative = false,\n tags = false,\n singleBranch = false,\n headers = {},\n prune = false,\n pruneTags = false,\n}) {\n const ref = _ref || (await _currentBranch({ fs, gitdir, test: true }))\n const config = await GitConfigManager.get({ fs, gitdir })\n // Figure out what remote to use.\n const remote =\n _remote || (ref && (await config.get(`branch.${ref}.remote`))) || 'origin'\n // Lookup the URL for the given remote.\n const url = _url || (await config.get(`remote.${remote}.url`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remote OR url')\n }\n // Figure out what remote ref to use.\n const remoteRef =\n _remoteRef ||\n (ref && (await config.get(`branch.${ref}.merge`))) ||\n _ref ||\n 'HEAD'\n\n if (corsProxy === undefined) {\n corsProxy = await config.get('http.corsProxy')\n }\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remoteHTTP = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: 'git-upload-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n const auth = remoteHTTP.auth // hack to get new credentials from CredentialManager API\n const remoteRefs = remoteHTTP.refs\n // For the special case of an empty repository with no refs, return null.\n if (remoteRefs.size === 0) {\n return {\n defaultBranch: null,\n fetchHead: null,\n fetchHeadDescription: null,\n }\n }\n // Check that the remote supports the requested features\n if (depth !== null && !remoteHTTP.capabilities.has('shallow')) {\n throw new RemoteCapabilityError('shallow', 'depth')\n }\n if (since !== null && !remoteHTTP.capabilities.has('deepen-since')) {\n throw new RemoteCapabilityError('deepen-since', 'since')\n }\n if (exclude.length > 0 && !remoteHTTP.capabilities.has('deepen-not')) {\n throw new RemoteCapabilityError('deepen-not', 'exclude')\n }\n if (relative === true && !remoteHTTP.capabilities.has('deepen-relative')) {\n throw new RemoteCapabilityError('deepen-relative', 'relative')\n }\n // Figure out the SHA for the requested ref\n const { oid, fullref } = GitRefManager.resolveAgainstMap({\n ref: remoteRef,\n map: remoteRefs,\n })\n // Filter out refs we want to ignore: only keep ref we're cloning, HEAD, branches, and tags (if we're keeping them)\n for (const remoteRef of remoteRefs.keys()) {\n if (\n remoteRef === fullref ||\n remoteRef === 'HEAD' ||\n remoteRef.startsWith('refs/heads/') ||\n (tags && remoteRef.startsWith('refs/tags/'))\n ) {\n continue\n }\n remoteRefs.delete(remoteRef)\n }\n // Assemble the application/x-git-upload-pack-request\n const capabilities = filterCapabilities(\n [...remoteHTTP.capabilities],\n [\n 'multi_ack_detailed',\n 'no-done',\n 'side-band-64k',\n // Note: I removed 'thin-pack' option since our code doesn't \"fatten\" packfiles,\n // which is necessary for compatibility with git. It was the cause of mysterious\n // 'fatal: pack has [x] unresolved deltas' errors that plagued us for some time.\n // isomorphic-git is perfectly happy with thin packfiles in .git/objects/pack but\n // canonical git it turns out is NOT.\n 'ofs-delta',\n `agent=${pkg.agent}`,\n ]\n )\n if (relative) capabilities.push('deepen-relative')\n // Start figuring out which oids from the remote we want to request\n const wants = singleBranch ? [oid] : remoteRefs.values()\n // Come up with a reasonable list of oids to tell the remote we already have\n // (preferably oids that are close ancestors of the branch heads we're fetching)\n const haveRefs = singleBranch\n ? [ref]\n : await GitRefManager.listRefs({\n fs,\n gitdir,\n filepath: `refs`,\n })\n let haves = []\n for (let ref of haveRefs) {\n try {\n ref = await GitRefManager.expand({ fs, gitdir, ref })\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n if (await hasObject({ fs, cache, gitdir, oid })) {\n haves.push(oid)\n }\n } catch (err) {}\n }\n haves = [...new Set(haves)]\n const oids = await GitShallowManager.read({ fs, gitdir })\n const shallows = remoteHTTP.capabilities.has('shallow') ? [...oids] : []\n const packstream = writeUploadPackRequest({\n capabilities,\n wants,\n haves,\n shallows,\n depth,\n since,\n exclude,\n })\n // CodeCommit will hang up if we don't send a Content-Length header\n // so we can't stream the body.\n const packbuffer = Buffer.from(await collect(packstream))\n const raw = await GitRemoteHTTP.connect({\n http,\n onProgress,\n corsProxy,\n service: 'git-upload-pack',\n url,\n auth,\n body: [packbuffer],\n headers,\n })\n const response = await parseUploadPackResponse(raw.body)\n if (raw.headers) {\n response.headers = raw.headers\n }\n // Apply all the 'shallow' and 'unshallow' commands\n for (const oid of response.shallows) {\n if (!oids.has(oid)) {\n // this is in a try/catch mostly because my old test fixtures are missing objects\n try {\n // server says it's shallow, but do we have the parents?\n const { object } = await readObject({ fs, cache, gitdir, oid })\n const commit = new GitCommit(object)\n const hasParents = await Promise.all(\n commit\n .headers()\n .parent.map(oid => hasObject({ fs, cache, gitdir, oid }))\n )\n const haveAllParents =\n hasParents.length === 0 || hasParents.every(has => has)\n if (!haveAllParents) {\n oids.add(oid)\n }\n } catch (err) {\n oids.add(oid)\n }\n }\n }\n for (const oid of response.unshallows) {\n oids.delete(oid)\n }\n await GitShallowManager.write({ fs, gitdir, oids })\n // Update local remote refs\n if (singleBranch) {\n const refs = new Map([[fullref, oid]])\n // But wait, maybe it was a symref, like 'HEAD'!\n // We need to save all the refs in the symref chain (sigh).\n const symrefs = new Map()\n let bail = 10\n let key = fullref\n while (bail--) {\n const value = remoteHTTP.symrefs.get(key)\n if (value === undefined) break\n symrefs.set(key, value)\n key = value\n }\n // final value must not be a symref but a real ref\n const realRef = remoteRefs.get(key)\n // There may be no ref at all if we've fetched a specific commit hash\n if (realRef) {\n refs.set(key, realRef)\n }\n const { pruned } = await GitRefManager.updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs,\n symrefs,\n tags,\n prune,\n })\n if (prune) {\n response.pruned = pruned\n }\n } else {\n const { pruned } = await GitRefManager.updateRemoteRefs({\n fs,\n gitdir,\n remote,\n refs: remoteRefs,\n symrefs: remoteHTTP.symrefs,\n tags,\n prune,\n pruneTags,\n })\n if (prune) {\n response.pruned = pruned\n }\n }\n // We need this value later for the `clone` command.\n response.HEAD = remoteHTTP.symrefs.get('HEAD')\n // AWS CodeCommit doesn't list HEAD as a symref, but we can reverse engineer it\n // Find the SHA of the branch called HEAD\n if (response.HEAD === undefined) {\n const { oid } = GitRefManager.resolveAgainstMap({\n ref: 'HEAD',\n map: remoteRefs,\n })\n // Use the name of the first branch that's not called HEAD that has\n // the same SHA as the branch called HEAD.\n for (const [key, value] of remoteRefs.entries()) {\n if (key !== 'HEAD' && value === oid) {\n response.HEAD = key\n break\n }\n }\n }\n const noun = fullref.startsWith('refs/tags') ? 'tag' : 'branch'\n response.FETCH_HEAD = {\n oid,\n description: `${noun} '${abbreviateRef(fullref)}' of ${url}`,\n }\n\n if (onProgress || onMessage) {\n const lines = splitLines(response.progress)\n forAwait(lines, async line => {\n if (onMessage) await onMessage(line)\n if (onProgress) {\n const matches = line.match(/([^:]*).*\\((\\d+?)\\/(\\d+?)\\)/)\n if (matches) {\n await onProgress({\n phase: matches[1].trim(),\n loaded: parseInt(matches[2], 10),\n total: parseInt(matches[3], 10),\n })\n }\n }\n })\n }\n const packfile = Buffer.from(await collect(response.packfile))\n if (raw.body.error) throw raw.body.error\n const packfileSha = packfile.slice(-20).toString('hex')\n const res = {\n defaultBranch: response.HEAD,\n fetchHead: response.FETCH_HEAD.oid,\n fetchHeadDescription: response.FETCH_HEAD.description,\n }\n if (response.headers) {\n res.headers = response.headers\n }\n if (prune) {\n res.pruned = response.pruned\n }\n // This is a quick fix for the empty .git/objects/pack/pack-.pack file error,\n // which due to the way `git-list-pack` works causes the program to hang when it tries to read it.\n // TODO: Longer term, we should actually:\n // a) NOT concatenate the entire packfile into memory (line 78),\n // b) compute the SHA of the stream except for the last 20 bytes, using the same library used in push.js, and\n // c) compare the computed SHA with the last 20 bytes of the stream before saving to disk, and throwing a \"packfile got corrupted during download\" error if the SHA doesn't match.\n if (packfileSha !== '' && !emptyPackfile(packfile)) {\n res.packfile = `objects/pack/pack-${packfileSha}.pack`\n const fullpath = join(gitdir, res.packfile)\n await fs.write(fullpath, packfile)\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack: packfile,\n getExternalRefDelta,\n onProgress,\n })\n await fs.write(fullpath.replace(/\\.pack$/, '.idx'), await idx.toBuffer())\n }\n return res\n}\n","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","import { GitPktLine } from '../models/GitPktLine.js'\n\nexport function writeUploadPackRequest({\n capabilities = [],\n wants = [],\n haves = [],\n shallows = [],\n depth = null,\n since = null,\n exclude = [],\n}) {\n const packstream = []\n wants = [...new Set(wants)] // remove duplicates\n let firstLineCapabilities = ` ${capabilities.join(' ')}`\n for (const oid of wants) {\n packstream.push(GitPktLine.encode(`want ${oid}${firstLineCapabilities}\\n`))\n firstLineCapabilities = ''\n }\n for (const oid of shallows) {\n packstream.push(GitPktLine.encode(`shallow ${oid}\\n`))\n }\n if (depth !== null) {\n packstream.push(GitPktLine.encode(`deepen ${depth}\\n`))\n }\n if (since !== null) {\n packstream.push(\n GitPktLine.encode(`deepen-since ${Math.floor(since.valueOf() / 1000)}\\n`)\n )\n }\n for (const oid of exclude) {\n packstream.push(GitPktLine.encode(`deepen-not ${oid}\\n`))\n }\n packstream.push(GitPktLine.flush())\n for (const oid of haves) {\n packstream.push(GitPktLine.encode(`have ${oid}\\n`))\n }\n packstream.push(GitPktLine.encode(`done\\n`))\n return packstream\n}\n","import { InvalidOidError } from '../errors/InvalidOidError.js'\nimport { GitSideBand } from '../models/GitSideBand.js'\nimport { forAwait } from '../utils/forAwait.js'\n\nexport async function parseUploadPackResponse(stream) {\n const { packetlines, packfile, progress } = GitSideBand.demux(stream)\n const shallows = []\n const unshallows = []\n const acks = []\n let nak = false\n let done = false\n return new Promise((resolve, reject) => {\n // Parse the response\n forAwait(packetlines, data => {\n const line = data.toString('utf8').trim()\n if (line.startsWith('shallow')) {\n const oid = line.slice(-41).trim()\n if (oid.length !== 40) {\n reject(new InvalidOidError(oid))\n }\n shallows.push(oid)\n } else if (line.startsWith('unshallow')) {\n const oid = line.slice(-41).trim()\n if (oid.length !== 40) {\n reject(new InvalidOidError(oid))\n }\n unshallows.push(oid)\n } else if (line.startsWith('ACK')) {\n const [, oid, status] = line.split(' ')\n acks.push({ oid, status })\n if (!status) done = true\n } else if (line.startsWith('NAK')) {\n nak = true\n done = true\n } else {\n done = true\n nak = true\n }\n if (done) {\n stream.error\n ? reject(stream.error)\n : resolve({ shallows, unshallows, acks, nak, packfile, progress })\n }\n }).finally(() => {\n if (!done) {\n stream.error\n ? reject(stream.error)\n : resolve({ shallows, unshallows, acks, nak, packfile, progress })\n }\n })\n })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { TREE } from '../commands/TREE.js'\nimport { _walk } from '../commands/walk.js'\nimport { MergeConflictError } from '../errors/MergeConflictError.js'\nimport { MergeNotSupportedError } from '../errors/MergeNotSupportedError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\nimport { basename } from './basename.js'\nimport { join } from './join.js'\nimport { mergeFile } from './mergeFile.js'\nimport { modified } from './modified.js'\n\n/**\n * Create a merged tree\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ourOid - The SHA-1 object id of our tree\n * @param {string} args.baseOid - The SHA-1 object id of the base tree\n * @param {string} args.theirOid - The SHA-1 object id of their tree\n * @param {string} [args.ourName='ours'] - The name to use in conflicted files for our hunks\n * @param {string} [args.baseName='base'] - The name to use in conflicted files (in diff3 format) for the base hunks\n * @param {string} [args.theirName='theirs'] - The name to use in conflicted files for their hunks\n * @param {boolean} [args.dryRun=false]\n * @param {boolean} [args.abortOnConflict=false]\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n * @returns {Promise} - The SHA-1 object id of the merged tree\n *\n */\nexport async function mergeTree({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n index,\n ourOid,\n baseOid,\n theirOid,\n ourName = 'ours',\n baseName = 'base',\n theirName = 'theirs',\n dryRun = false,\n abortOnConflict = true,\n mergeDriver,\n}) {\n const ourTree = TREE({ ref: ourOid })\n const baseTree = TREE({ ref: baseOid })\n const theirTree = TREE({ ref: theirOid })\n\n const unmergedFiles = []\n const bothModified = []\n const deleteByUs = []\n const deleteByTheirs = []\n\n const results = await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [ourTree, baseTree, theirTree],\n map: async function(filepath, [ours, base, theirs]) {\n const path = basename(filepath)\n // What we did, what they did\n const ourChange = await modified(ours, base)\n const theirChange = await modified(theirs, base)\n switch (`${ourChange}-${theirChange}`) {\n case 'false-false': {\n return {\n mode: await base.mode(),\n path,\n oid: await base.oid(),\n type: await base.type(),\n }\n }\n case 'false-true': {\n return theirs\n ? {\n mode: await theirs.mode(),\n path,\n oid: await theirs.oid(),\n type: await theirs.type(),\n }\n : undefined\n }\n case 'true-false': {\n return ours\n ? {\n mode: await ours.mode(),\n path,\n oid: await ours.oid(),\n type: await ours.type(),\n }\n : undefined\n }\n case 'true-true': {\n // Modifications\n if (\n ours &&\n base &&\n theirs &&\n (await ours.type()) === 'blob' &&\n (await base.type()) === 'blob' &&\n (await theirs.type()) === 'blob'\n ) {\n return mergeBlobs({\n fs,\n gitdir,\n path,\n ours,\n base,\n theirs,\n ourName,\n baseName,\n theirName,\n mergeDriver,\n }).then(async r => {\n if (!r.cleanMerge) {\n unmergedFiles.push(filepath)\n bothModified.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const ourOid = await ours.oid()\n const theirOid = await theirs.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: ourOid, stage: 2 })\n index.insert({ filepath, oid: theirOid, stage: 3 })\n }\n } else if (!abortOnConflict) {\n index.insert({ filepath, oid: r.mergeResult.oid, stage: 0 })\n }\n return r.mergeResult\n })\n }\n\n // deleted by us\n if (\n base &&\n !ours &&\n theirs &&\n (await base.type()) === 'blob' &&\n (await theirs.type()) === 'blob'\n ) {\n unmergedFiles.push(filepath)\n deleteByUs.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const theirOid = await theirs.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: theirOid, stage: 3 })\n }\n\n return {\n mode: await theirs.mode(),\n oid: await theirs.oid(),\n type: 'blob',\n path,\n }\n }\n\n // deleted by theirs\n if (\n base &&\n ours &&\n !theirs &&\n (await base.type()) === 'blob' &&\n (await ours.type()) === 'blob'\n ) {\n unmergedFiles.push(filepath)\n deleteByTheirs.push(filepath)\n if (!abortOnConflict) {\n const baseOid = await base.oid()\n const ourOid = await ours.oid()\n\n index.delete({ filepath })\n\n index.insert({ filepath, oid: baseOid, stage: 1 })\n index.insert({ filepath, oid: ourOid, stage: 2 })\n }\n\n return {\n mode: await ours.mode(),\n oid: await ours.oid(),\n type: 'blob',\n path,\n }\n }\n\n // deleted by both\n if (base && !ours && !theirs && (await base.type()) === 'blob') {\n return undefined\n }\n\n // all other types of conflicts fail\n // TODO: Merge conflicts involving additions\n throw new MergeNotSupportedError()\n }\n }\n },\n /**\n * @param {TreeEntry} [parent]\n * @param {Array} children\n */\n reduce:\n unmergedFiles.length !== 0 && (!dir || abortOnConflict)\n ? undefined\n : async (parent, children) => {\n const entries = children.filter(Boolean) // remove undefineds\n\n // if the parent was deleted, the children have to go\n if (!parent) return\n\n // automatically delete directories if they have been emptied\n if (parent && parent.type === 'tree' && entries.length === 0) return\n\n if (entries.length > 0) {\n const tree = new GitTree(entries)\n const object = tree.toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tree',\n object,\n dryRun,\n })\n parent.oid = oid\n }\n return parent\n },\n })\n\n if (unmergedFiles.length !== 0) {\n if (dir && !abortOnConflict) {\n await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref: results.oid })],\n map: async function(filepath, [entry]) {\n const path = `${dir}/${filepath}`\n if ((await entry.type()) === 'blob') {\n const mode = await entry.mode()\n const content = new TextDecoder().decode(await entry.content())\n await fs.write(path, content, { mode })\n }\n return true\n },\n })\n }\n return new MergeConflictError(\n unmergedFiles,\n bothModified,\n deleteByUs,\n deleteByTheirs\n )\n }\n\n return results.oid\n}\n\n/**\n *\n * @param {Object} args\n * @param {import('../models/FileSystem').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n * @param {WalkerEntry} args.ours\n * @param {WalkerEntry} args.base\n * @param {WalkerEntry} args.theirs\n * @param {string} [args.ourName]\n * @param {string} [args.baseName]\n * @param {string} [args.theirName]\n * @param {boolean} [args.dryRun = false]\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n */\nasync function mergeBlobs({\n fs,\n gitdir,\n path,\n ours,\n base,\n theirs,\n ourName,\n theirName,\n baseName,\n dryRun,\n mergeDriver = mergeFile,\n}) {\n const type = 'blob'\n // Compute the new mode.\n // Since there are ONLY two valid blob modes ('100755' and '100644') it boils down to this\n const mode =\n (await base.mode()) === (await ours.mode())\n ? await theirs.mode()\n : await ours.mode()\n // The trivial case: nothing to merge except maybe mode\n if ((await ours.oid()) === (await theirs.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await ours.oid(), type },\n }\n }\n // if only one side made oid changes, return that side's oid\n if ((await ours.oid()) === (await base.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await theirs.oid(), type },\n }\n }\n if ((await theirs.oid()) === (await base.oid())) {\n return {\n cleanMerge: true,\n mergeResult: { mode, path, oid: await ours.oid(), type },\n }\n }\n // if both sides made changes do a merge\n const ourContent = Buffer.from(await ours.content()).toString('utf8')\n const baseContent = Buffer.from(await base.content()).toString('utf8')\n const theirContent = Buffer.from(await theirs.content()).toString('utf8')\n const { mergedText, cleanMerge } = await mergeDriver({\n branches: [baseName, ourName, theirName],\n contents: [baseContent, ourContent, theirContent],\n path,\n })\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'blob',\n object: Buffer.from(mergedText, 'utf8'),\n dryRun,\n })\n\n return { cleanMerge, mergeResult: { mode, path, oid, type } }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {Iterable} args.start\n * @param {Iterable} args.finish\n * @returns {Promise>}\n */\nexport async function listCommitsAndTags({\n fs,\n cache,\n dir,\n gitdir = join(dir, '.git'),\n start,\n finish,\n}) {\n const shallows = await GitShallowManager.read({ fs, gitdir })\n const startingSet = new Set()\n const finishingSet = new Set()\n for (const ref of start) {\n startingSet.add(await GitRefManager.resolve({ fs, gitdir, ref }))\n }\n for (const ref of finish) {\n // We may not have these refs locally so we must try/catch\n try {\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n finishingSet.add(oid)\n } catch (err) {}\n }\n const visited = new Set()\n // Because git commits are named by their hash, there is no\n // way to construct a cycle. Therefore we won't worry about\n // setting a default recursion limit.\n async function walk(oid) {\n visited.add(oid)\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Recursively resolve annotated tags\n if (type === 'tag') {\n const tag = GitAnnotatedTag.from(object)\n const commit = tag.headers().object\n return walk(commit)\n }\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n if (!shallows.has(oid)) {\n const commit = GitCommit.from(object)\n const parents = commit.headers().parent\n for (oid of parents) {\n if (!finishingSet.has(oid) && !visited.has(oid)) {\n await walk(oid)\n }\n }\n }\n }\n // Let's go walking!\n for (const oid of startingSet) {\n await walk(oid)\n }\n return visited\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\n\nexport async function writeReceivePackRequest({\n capabilities = [],\n triplets = [],\n}) {\n const packstream = []\n let capsFirstLine = `\\x00 ${capabilities.join(' ')}`\n for (const trip of triplets) {\n packstream.push(\n GitPktLine.encode(\n `${trip.oldoid} ${trip.oid} ${trip.fullRef}${capsFirstLine}\\n`\n )\n )\n capsFirstLine = ''\n }\n packstream.push(GitPktLine.flush())\n return packstream\n}\n","import '../typedefs.js'\n\nimport { ParseError } from '../errors/ParseError.js'\nimport { GitPktLine } from '../models/GitPktLine.js'\n\nexport async function parseReceivePackResponse(packfile) {\n /** @type PushResult */\n const result = {}\n let response = ''\n const read = GitPktLine.streamReader(packfile)\n let line = await read()\n while (line !== true) {\n if (line !== null) response += line.toString('utf8') + '\\n'\n line = await read()\n }\n\n const lines = response.toString('utf8').split('\\n')\n // We're expecting \"unpack {unpack-result}\"\n line = lines.shift()\n if (!line.startsWith('unpack ')) {\n throw new ParseError('unpack ok\" or \"unpack [error message]', line)\n }\n result.ok = line === 'unpack ok'\n if (!result.ok) {\n result.error = line.slice('unpack '.length)\n }\n result.refs = {}\n for (const line of lines) {\n if (line.trim() === '') continue\n const status = line.slice(0, 2)\n const refAndMessage = line.slice(3)\n let space = refAndMessage.indexOf(' ')\n if (space === -1) space = refAndMessage.length\n const ref = refAndMessage.slice(0, space)\n const error = refAndMessage.slice(space + 1)\n result.refs[ref] = {\n ok: status === 'ok',\n error,\n }\n }\n return result\n}\n","import { compareStrings } from './compareStrings'\n\nexport function compareTreeEntryPath(a, b) {\n // Git sorts tree entries as if there is a trailing slash on directory names.\n return compareStrings(appendSlashIfDir(a), appendSlashIfDir(b))\n}\n\nfunction appendSlashIfDir(entry) {\n return entry.mode === '040000' ? entry.path + '/' : entry.path\n}\n","export async function readObjectLoose({ fs, gitdir, oid }) {\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n const file = await fs.read(`${gitdir}/${source}`)\n if (!file) {\n return null\n }\n return { object: file, format: 'deflated', source }\n}\n","/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */\n/* vim: set ts=2: */\n/*exported CRC32 */\nvar CRC32;\n(function (factory) {\n\t/*jshint ignore:start */\n\t/*eslint-disable */\n\tif(typeof DO_NOT_EXPORT_CRC === 'undefined') {\n\t\tif('object' === typeof exports) {\n\t\t\tfactory(exports);\n\t\t} else if ('function' === typeof define && define.amd) {\n\t\t\tdefine(function () {\n\t\t\t\tvar module = {};\n\t\t\t\tfactory(module);\n\t\t\t\treturn module;\n\t\t\t});\n\t\t} else {\n\t\t\tfactory(CRC32 = {});\n\t\t}\n\t} else {\n\t\tfactory(CRC32 = {});\n\t}\n\t/*eslint-enable */\n\t/*jshint ignore:end */\n}(function(CRC32) {\nCRC32.version = '1.2.0';\n/* see perf/crc32table.js */\n/*global Int32Array */\nfunction signed_crc_table() {\n\tvar c = 0, table = new Array(256);\n\n\tfor(var n =0; n != 256; ++n){\n\t\tc = n;\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\ttable[n] = c;\n\t}\n\n\treturn typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;\n}\n\nvar T = signed_crc_table();\nfunction crc32_bstr(bstr, seed) {\n\tvar C = seed ^ -1, L = bstr.length - 1;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];\n\t\tC = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];\n\t}\n\tif(i === L) C = (C>>>8) ^ T[(C ^ bstr.charCodeAt(i))&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_buf(buf, seed) {\n\tif(buf.length > 10000) return crc32_buf_8(buf, seed);\n\tvar C = seed ^ -1, L = buf.length - 3;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t}\n\twhile(i < L+3) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_buf_8(buf, seed) {\n\tvar C = seed ^ -1, L = buf.length - 7;\n\tfor(var i = 0; i < L;) {\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t\tC = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\t}\n\twhile(i < L+7) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];\n\treturn C ^ -1;\n}\n\nfunction crc32_str(str, seed) {\n\tvar C = seed ^ -1;\n\tfor(var i = 0, L=str.length, c, d; i < L;) {\n\t\tc = str.charCodeAt(i++);\n\t\tif(c < 0x80) {\n\t\t\tC = (C>>>8) ^ T[(C ^ c)&0xFF];\n\t\t} else if(c < 0x800) {\n\t\t\tC = (C>>>8) ^ T[(C ^ (192|((c>>6)&31)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];\n\t\t} else if(c >= 0xD800 && c < 0xE000) {\n\t\t\tc = (c&1023)+64; d = str.charCodeAt(i++)&1023;\n\t\t\tC = (C>>>8) ^ T[(C ^ (240|((c>>8)&7)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((c>>2)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(d&63)))&0xFF];\n\t\t} else {\n\t\t\tC = (C>>>8) ^ T[(C ^ (224|((c>>12)&15)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|((c>>6)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];\n\t\t}\n\t}\n\treturn C ^ -1;\n}\nCRC32.table = T;\n// $FlowIgnore\nCRC32.bstr = crc32_bstr;\n// $FlowIgnore\nCRC32.buf = crc32_buf;\n// $FlowIgnore\nCRC32.str = crc32_str;\n}));\n","// My version of git-list-pack - roughly 15x faster than the original\n// It's used slightly differently - instead of returning a through stream it wraps a stream.\n// (I tried to make it API identical, but that ended up being 2x slower than this version.)\nimport pako from 'pako'\n\nimport { InternalError } from '../errors/InternalError.js'\nimport { StreamReader } from '../utils/StreamReader.js'\n\nexport async function listpack(stream, onData) {\n const reader = new StreamReader(stream)\n let PACK = await reader.read(4)\n PACK = PACK.toString('utf8')\n if (PACK !== 'PACK') {\n throw new InternalError(`Invalid PACK header '${PACK}'`)\n }\n\n let version = await reader.read(4)\n version = version.readUInt32BE(0)\n if (version !== 2) {\n throw new InternalError(`Invalid packfile version: ${version}`)\n }\n\n let numObjects = await reader.read(4)\n numObjects = numObjects.readUInt32BE(0)\n // If (for some godforsaken reason) this is an empty packfile, abort now.\n if (numObjects < 1) return\n\n while (!reader.eof() && numObjects--) {\n const offset = reader.tell()\n const { type, length, ofs, reference } = await parseHeader(reader)\n const inflator = new pako.Inflate()\n while (!inflator.result) {\n const chunk = await reader.chunk()\n if (!chunk) break\n inflator.push(chunk, false)\n if (inflator.err) {\n throw new InternalError(`Pako error: ${inflator.msg}`)\n }\n if (inflator.result) {\n if (inflator.result.length !== length) {\n throw new InternalError(\n `Inflated object size is different from that stated in packfile.`\n )\n }\n\n // Backtrack parser to where deflated data ends\n await reader.undo()\n await reader.read(chunk.length - inflator.strm.avail_in)\n const end = reader.tell()\n await onData({\n data: inflator.result,\n type,\n num: numObjects,\n offset,\n end,\n reference,\n ofs,\n })\n }\n }\n }\n}\n\nasync function parseHeader(reader) {\n // Object type is encoded in bits 654\n let byte = await reader.byte()\n const type = (byte >> 4) & 0b111\n // The length encoding get complicated.\n // Last four bits of length is encoded in bits 3210\n let length = byte & 0b1111\n // Whether the next byte is part of the variable-length encoded number\n // is encoded in bit 7\n if (byte & 0b10000000) {\n let shift = 4\n do {\n byte = await reader.byte()\n length |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n }\n // Handle deltified objects\n let ofs\n let reference\n if (type === 6) {\n let shift = 0\n ofs = 0\n const bytes = []\n do {\n byte = await reader.byte()\n ofs |= (byte & 0b01111111) << shift\n shift += 7\n bytes.push(byte)\n } while (byte & 0b10000000)\n reference = Buffer.from(bytes)\n }\n if (type === 7) {\n const buf = await reader.read(20)\n reference = buf\n }\n return { type, length, ofs, reference }\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { BufferCursor } from '../utils/BufferCursor.js'\n\n/**\n * @param {Buffer} delta\n * @param {Buffer} source\n * @returns {Buffer}\n */\nexport function applyDelta(delta, source) {\n const reader = new BufferCursor(delta)\n const sourceSize = readVarIntLE(reader)\n\n if (sourceSize !== source.byteLength) {\n throw new InternalError(\n `applyDelta expected source buffer to be ${sourceSize} bytes but the provided buffer was ${source.length} bytes`\n )\n }\n const targetSize = readVarIntLE(reader)\n let target\n\n const firstOp = readOp(reader, source)\n // Speed optimization - return raw buffer if it's just single simple copy\n if (firstOp.byteLength === targetSize) {\n target = firstOp\n } else {\n // Otherwise, allocate a fresh buffer and slices\n target = Buffer.alloc(targetSize)\n const writer = new BufferCursor(target)\n writer.copy(firstOp)\n\n while (!reader.eof()) {\n writer.copy(readOp(reader, source))\n }\n\n const tell = writer.tell()\n if (targetSize !== tell) {\n throw new InternalError(\n `applyDelta expected target buffer to be ${targetSize} bytes but the resulting buffer was ${tell} bytes`\n )\n }\n }\n return target\n}\n\nfunction readVarIntLE(reader) {\n let result = 0\n let shift = 0\n let byte = null\n do {\n byte = reader.readUInt8()\n result |= (byte & 0b01111111) << shift\n shift += 7\n } while (byte & 0b10000000)\n return result\n}\n\nfunction readCompactLE(reader, flags, size) {\n let result = 0\n let shift = 0\n while (size--) {\n if (flags & 0b00000001) {\n result |= reader.readUInt8() << shift\n }\n flags >>= 1\n shift += 8\n }\n return result\n}\n\nfunction readOp(reader, source) {\n /** @type {number} */\n const byte = reader.readUInt8()\n const COPY = 0b10000000\n const OFFS = 0b00001111\n const SIZE = 0b01110000\n if (byte & COPY) {\n // copy consists of 4 byte offset, 3 byte size (in LE order)\n const offset = readCompactLE(reader, byte & OFFS, 4)\n let size = readCompactLE(reader, (byte & SIZE) >> 4, 3)\n // Yup. They really did this optimization.\n if (size === 0) size = 0x10000\n return source.slice(offset, offset + size)\n } else {\n // insert\n return reader.slice(byte)\n }\n}\n","export function outdent(str) {\n return str\n .split('\\n')\n .map(x => x.replace(/^ /, ''))\n .join('\\n')\n}\n","export function isPromiseLike(obj) {\n return isObject(obj) && isFunction(obj.then) && isFunction(obj.catch)\n}\n\nexport function isObject(obj) {\n return obj && typeof obj === 'object'\n}\n\nexport function isFunction(obj) {\n return typeof obj === 'function'\n}\n","// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\nconst EMPTY = ''\nconst SPACE = ' '\nconst ESCAPE = '\\\\'\nconst REGEX_TEST_BLANK_LINE = /^\\s+$/\nconst REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\\\!/\nconst REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\\\#/\nconst REGEX_SPLITALL_CRLF = /\\r?\\n/g\n// /foo,\n// ./foo,\n// ../foo,\n// .\n// ..\nconst REGEX_TEST_INVALID_PATH = /^\\.*\\/|^\\.+$/\n\nconst SLASH = '/'\nconst KEY_IGNORE = typeof Symbol !== 'undefined'\n ? Symbol.for('node-ignore')\n /* istanbul ignore next */\n : 'node-ignore'\n\nconst define = (object, key, value) =>\n Object.defineProperty(object, key, {value})\n\nconst REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g\n\nconst RETURN_FALSE = () => false\n\n// Sanitize the range of a regular expression\n// The cases are complicated, see test cases for details\nconst sanitizeRange = range => range.replace(\n REGEX_REGEXP_RANGE,\n (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)\n ? match\n // Invalid range (out of order) which is ok for gitignore rules but\n // fatal for JavaScript regular expression, so eliminate it.\n : EMPTY\n)\n\n// See fixtures #59\nconst cleanRangeBackSlash = slashes => {\n const {length} = slashes\n return slashes.slice(0, length - length % 2)\n}\n\n// > If the pattern ends with a slash,\n// > it is removed for the purpose of the following description,\n// > but it would only find a match with a directory.\n// > In other words, foo/ will match a directory foo and paths underneath it,\n// > but will not match a regular file or a symbolic link foo\n// > (this is consistent with the way how pathspec works in general in Git).\n// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'\n// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call\n// you could use option `mark: true` with `glob`\n\n// '`foo/`' should not continue with the '`..`'\nconst REPLACERS = [\n\n // > Trailing spaces are ignored unless they are quoted with backslash (\"\\\")\n [\n // (a\\ ) -> (a )\n // (a ) -> (a)\n // (a \\ ) -> (a )\n /\\\\?\\s+$/,\n match => match.indexOf('\\\\') === 0\n ? SPACE\n : EMPTY\n ],\n\n // replace (\\ ) with ' '\n [\n /\\\\\\s/g,\n () => SPACE\n ],\n\n // Escape metacharacters\n // which is written down by users but means special for regular expressions.\n\n // > There are 12 characters with special meanings:\n // > - the backslash \\,\n // > - the caret ^,\n // > - the dollar sign $,\n // > - the period or dot .,\n // > - the vertical bar or pipe symbol |,\n // > - the question mark ?,\n // > - the asterisk or star *,\n // > - the plus sign +,\n // > - the opening parenthesis (,\n // > - the closing parenthesis ),\n // > - and the opening square bracket [,\n // > - the opening curly brace {,\n // > These special characters are often called \"metacharacters\".\n [\n /[\\\\$.|*+(){^]/g,\n match => `\\\\${match}`\n ],\n\n [\n // > a question mark (?) matches a single character\n /(?!\\\\)\\?/g,\n () => '[^/]'\n ],\n\n // leading slash\n [\n\n // > A leading slash matches the beginning of the pathname.\n // > For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n // A leading slash matches the beginning of the pathname\n /^\\//,\n () => '^'\n ],\n\n // replace special metacharacter slash after the leading slash\n [\n /\\//g,\n () => '\\\\/'\n ],\n\n [\n // > A leading \"**\" followed by a slash means match in all directories.\n // > For example, \"**/foo\" matches file or directory \"foo\" anywhere,\n // > the same as pattern \"foo\".\n // > \"**/foo/bar\" matches file or directory \"bar\" anywhere that is directly\n // > under directory \"foo\".\n // Notice that the '*'s have been replaced as '\\\\*'\n /^\\^*\\\\\\*\\\\\\*\\\\\\//,\n\n // '**/foo' <-> 'foo'\n () => '^(?:.*\\\\/)?'\n ],\n\n // starting\n [\n // there will be no leading '/'\n // (which has been replaced by section \"leading slash\")\n // If starts with '**', adding a '^' to the regular expression also works\n /^(?=[^^])/,\n function startingReplacer () {\n // If has a slash `/` at the beginning or middle\n return !/\\/(?!$)/.test(this)\n // > Prior to 2.22.1\n // > If the pattern does not contain a slash /,\n // > Git treats it as a shell glob pattern\n // Actually, if there is only a trailing slash,\n // git also treats it as a shell glob pattern\n\n // After 2.22.1 (compatible but clearer)\n // > If there is a separator at the beginning or middle (or both)\n // > of the pattern, then the pattern is relative to the directory\n // > level of the particular .gitignore file itself.\n // > Otherwise the pattern may also match at any level below\n // > the .gitignore level.\n ? '(?:^|\\\\/)'\n\n // > Otherwise, Git treats the pattern as a shell glob suitable for\n // > consumption by fnmatch(3)\n : '^'\n }\n ],\n\n // two globstars\n [\n // Use lookahead assertions so that we could match more than one `'/**'`\n /\\\\\\/\\\\\\*\\\\\\*(?=\\\\\\/|$)/g,\n\n // Zero, one or several directories\n // should not use '*', or it will be replaced by the next replacer\n\n // Check if it is not the last `'/**'`\n (_, index, str) => index + 6 < str.length\n\n // case: /**/\n // > A slash followed by two consecutive asterisks then a slash matches\n // > zero or more directories.\n // > For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n // '/**/'\n ? '(?:\\\\/[^\\\\/]+)*'\n\n // case: /**\n // > A trailing `\"/**\"` matches everything inside.\n\n // #21: everything inside but it should not include the current folder\n : '\\\\/.+'\n ],\n\n // intermediate wildcards\n [\n // Never replace escaped '*'\n // ignore rule '\\*' will match the path '*'\n\n // 'abc.*/' -> go\n // 'abc.*' -> skip this rule\n /(^|[^\\\\]+)\\\\\\*(?=.+)/g,\n\n // '*.js' matches '.js'\n // '*.js' doesn't match 'abc'\n (_, p1) => `${p1}[^\\\\/]*`\n ],\n\n [\n // unescape, revert step 3 except for back slash\n // For example, if a user escape a '\\\\*',\n // after step 3, the result will be '\\\\\\\\\\\\*'\n /\\\\\\\\\\\\(?=[$.|*+(){^])/g,\n () => ESCAPE\n ],\n\n [\n // '\\\\\\\\' -> '\\\\'\n /\\\\\\\\/g,\n () => ESCAPE\n ],\n\n [\n // > The range notation, e.g. [a-zA-Z],\n // > can be used to match one of the characters in a range.\n\n // `\\` is escaped by step 3\n /(\\\\)?\\[([^\\]/]*?)(\\\\*)($|\\])/g,\n (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE\n // '\\\\[bar]' -> '\\\\\\\\[bar\\\\]'\n ? `\\\\[${range}${cleanRangeBackSlash(endEscape)}${close}`\n : close === ']'\n ? endEscape.length % 2 === 0\n // A normal case, and it is a range notation\n // '[bar]'\n // '[bar\\\\\\\\]'\n ? `[${sanitizeRange(range)}${endEscape}]`\n // Invalid range notaton\n // '[bar\\\\]' -> '[bar\\\\\\\\]'\n : '[]'\n : '[]'\n ],\n\n // ending\n [\n // 'js' will not match 'js.'\n // 'ab' will not match 'abc'\n /(?:[^*])$/,\n\n // WTF!\n // https://git-scm.com/docs/gitignore\n // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)\n // which re-fixes #24, #38\n\n // > If there is a separator at the end of the pattern then the pattern\n // > will only match directories, otherwise the pattern can match both\n // > files and directories.\n\n // 'js*' will not match 'a.js'\n // 'js/' will not match 'a.js'\n // 'js' will match 'a.js' and 'a.js/'\n match => /\\/$/.test(match)\n // foo/ will not match 'foo'\n ? `${match}$`\n // foo matches 'foo' and 'foo/'\n : `${match}(?=$|\\\\/$)`\n ],\n\n // trailing wildcard\n [\n /(\\^|\\\\\\/)?\\\\\\*$/,\n (_, p1) => {\n const prefix = p1\n // '\\^':\n // '/*' does not match EMPTY\n // '/*' does not match everything\n\n // '\\\\\\/':\n // 'abc/*' does not match 'abc/'\n ? `${p1}[^/]+`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n }\n ],\n]\n\n// A simple cache, because an ignore rule only has only one certain meaning\nconst regexCache = Object.create(null)\n\n// @param {pattern}\nconst makeRegex = (pattern, ignoreCase) => {\n let source = regexCache[pattern]\n\n if (!source) {\n source = REPLACERS.reduce(\n (prev, current) => prev.replace(current[0], current[1].bind(pattern)),\n pattern\n )\n regexCache[pattern] = source\n }\n\n return ignoreCase\n ? new RegExp(source, 'i')\n : new RegExp(source)\n}\n\nconst isString = subject => typeof subject === 'string'\n\n// > A blank line matches no files, so it can serve as a separator for readability.\nconst checkPattern = pattern => pattern\n && isString(pattern)\n && !REGEX_TEST_BLANK_LINE.test(pattern)\n\n // > A line starting with # serves as a comment.\n && pattern.indexOf('#') !== 0\n\nconst splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)\n\nclass IgnoreRule {\n constructor (\n origin,\n pattern,\n negative,\n regex\n ) {\n this.origin = origin\n this.pattern = pattern\n this.negative = negative\n this.regex = regex\n }\n}\n\nconst createRule = (pattern, ignoreCase) => {\n const origin = pattern\n let negative = false\n\n // > An optional prefix \"!\" which negates the pattern;\n if (pattern.indexOf('!') === 0) {\n negative = true\n pattern = pattern.substr(1)\n }\n\n pattern = pattern\n // > Put a backslash (\"\\\") in front of the first \"!\" for patterns that\n // > begin with a literal \"!\", for example, `\"\\!important!.txt\"`.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')\n // > Put a backslash (\"\\\") in front of the first hash for patterns that\n // > begin with a hash.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')\n\n const regex = makeRegex(pattern, ignoreCase)\n\n return new IgnoreRule(\n origin,\n pattern,\n negative,\n regex\n )\n}\n\nconst throwError = (message, Ctor) => {\n throw new Ctor(message)\n}\n\nconst checkPath = (path, originalPath, doThrow) => {\n if (!isString(path)) {\n return doThrow(\n `path must be a string, but got \\`${originalPath}\\``,\n TypeError\n )\n }\n\n // We don't know if we should ignore EMPTY, so throw\n if (!path) {\n return doThrow(`path must not be empty`, TypeError)\n }\n\n // Check if it is a relative path\n if (checkPath.isNotRelative(path)) {\n const r = '`path.relative()`d'\n return doThrow(\n `path should be a ${r} string, but got \"${originalPath}\"`,\n RangeError\n )\n }\n\n return true\n}\n\nconst isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)\n\ncheckPath.isNotRelative = isNotRelative\ncheckPath.convert = p => p\n\nclass Ignore {\n constructor ({\n ignorecase = true,\n ignoreCase = ignorecase,\n allowRelativePaths = false\n } = {}) {\n define(this, KEY_IGNORE, true)\n\n this._rules = []\n this._ignoreCase = ignoreCase\n this._allowRelativePaths = allowRelativePaths\n this._initCache()\n }\n\n _initCache () {\n this._ignoreCache = Object.create(null)\n this._testCache = Object.create(null)\n }\n\n _addPattern (pattern) {\n // #32\n if (pattern && pattern[KEY_IGNORE]) {\n this._rules = this._rules.concat(pattern._rules)\n this._added = true\n return\n }\n\n if (checkPattern(pattern)) {\n const rule = createRule(pattern, this._ignoreCase)\n this._added = true\n this._rules.push(rule)\n }\n }\n\n // @param {Array | string | Ignore} pattern\n add (pattern) {\n this._added = false\n\n makeArray(\n isString(pattern)\n ? splitPattern(pattern)\n : pattern\n ).forEach(this._addPattern, this)\n\n // Some rules have just added to the ignore,\n // making the behavior changed.\n if (this._added) {\n this._initCache()\n }\n\n return this\n }\n\n // legacy\n addPattern (pattern) {\n return this.add(pattern)\n }\n\n // | ignored : unignored\n // negative | 0:0 | 0:1 | 1:0 | 1:1\n // -------- | ------- | ------- | ------- | --------\n // 0 | TEST | TEST | SKIP | X\n // 1 | TESTIF | SKIP | TEST | X\n\n // - SKIP: always skip\n // - TEST: always test\n // - TESTIF: only test if checkUnignored\n // - X: that never happen\n\n // @param {boolean} whether should check if the path is unignored,\n // setting `checkUnignored` to `false` could reduce additional\n // path matching.\n\n // @returns {TestResult} true if a file is ignored\n _testOne (path, checkUnignored) {\n let ignored = false\n let unignored = false\n\n this._rules.forEach(rule => {\n const {negative} = rule\n if (\n unignored === negative && ignored !== unignored\n || negative && !ignored && !unignored && !checkUnignored\n ) {\n return\n }\n\n const matched = rule.regex.test(path)\n\n if (matched) {\n ignored = !negative\n unignored = negative\n }\n })\n\n return {\n ignored,\n unignored\n }\n }\n\n // @returns {TestResult}\n _test (originalPath, cache, checkUnignored, slices) {\n const path = originalPath\n // Supports nullable path\n && checkPath.convert(originalPath)\n\n checkPath(\n path,\n originalPath,\n this._allowRelativePaths\n ? RETURN_FALSE\n : throwError\n )\n\n return this._t(path, cache, checkUnignored, slices)\n }\n\n _t (path, cache, checkUnignored, slices) {\n if (path in cache) {\n return cache[path]\n }\n\n if (!slices) {\n // path/to/a.js\n // ['path', 'to', 'a.js']\n slices = path.split(SLASH)\n }\n\n slices.pop()\n\n // If the path has no parent directory, just test it\n if (!slices.length) {\n return cache[path] = this._testOne(path, checkUnignored)\n }\n\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n cache,\n checkUnignored,\n slices\n )\n\n // If the path contains a parent directory, check the parent first\n return cache[path] = parent.ignored\n // > It is not possible to re-include a file if a parent directory of\n // > that file is excluded.\n ? parent\n : this._testOne(path, checkUnignored)\n }\n\n ignores (path) {\n return this._test(path, this._ignoreCache, false).ignored\n }\n\n createFilter () {\n return path => !this.ignores(path)\n }\n\n filter (paths) {\n return makeArray(paths).filter(this.createFilter())\n }\n\n // @returns {TestResult}\n test (path) {\n return this._test(path, this._testCache, true)\n }\n}\n\nconst factory = options => new Ignore(options)\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, RETURN_FALSE)\n\nfactory.isPathValid = isPathValid\n\n// Fixes typescript\nfactory.default = factory\n\nmodule.exports = factory\n\n// Windows\n// --------------------------------------------------------------\n/* istanbul ignore if */\nif (\n // Detect `process` so that it can run in browsers.\n typeof process !== 'undefined'\n && (\n process.env && process.env.IGNORE_TEST_WIN32\n || process.platform === 'win32'\n )\n) {\n /* eslint no-control-regex: \"off\" */\n const makePosix = str => /^\\\\\\\\\\?\\\\/.test(str)\n || /[\"<>|\\u0000-\\u001F]+/u.test(str)\n ? str\n : str.replace(/\\\\/g, '/')\n\n checkPath.convert = makePosix\n\n // 'C:\\\\foo' <- 'C:\\\\foo' has been converted to 'C:/'\n // 'd:\\\\foo'\n const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\\//i\n checkPath.isNotRelative = path =>\n REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)\n || isNotRelative(path)\n}\n","import { InternalError } from '../errors/InternalError.js'\n\nexport async function writeObjectLoose({ fs, gitdir, object, format, oid }) {\n if (format !== 'deflated') {\n throw new InternalError(\n 'GitObjectStoreLoose expects objects to write to be in deflated format'\n )\n }\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n const filepath = `${gitdir}/${source}`\n // Don't overwrite existing git objects - this helps avoid EPERM errors.\n // Although I don't know how we'd fix corrupted objects then. Perhaps delete them\n // on read?\n if (!(await fs.exists(filepath))) await fs.write(filepath, object)\n}\n","// Copyright (c) 2006, 2008 Tony Garnock-Jones \n// Copyright (c) 2006, 2008 LShift Ltd. \n//\n// Permission is hereby granted, free of charge, to any person\n// obtaining a copy of this software and associated documentation files\n// (the \"Software\"), to deal in the Software without restriction,\n// including without limitation the rights to use, copy, modify, merge,\n// publish, distribute, sublicense, and/or sell copies of the Software,\n// and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nvar onp = require('./onp');\n\nfunction longestCommonSubsequence(file1, file2) {\n var diff = new onp(file1, file2);\n diff.compose();\n var ses = diff.getses();\n\n var root;\n var prev;\n var file1RevIdx = file1.length - 1,\n file2RevIdx = file2.length - 1;\n for (var i = ses.length - 1; i >= 0; --i) {\n if (ses[i].t === diff.SES_COMMON) {\n if (prev) {\n prev.chain = {\n file1index: file1RevIdx,\n file2index: file2RevIdx,\n chain: null\n };\n prev = prev.chain;\n } else {\n root = {\n file1index: file1RevIdx,\n file2index: file2RevIdx,\n chain: null\n };\n prev = root;\n }\n file1RevIdx--;\n file2RevIdx--;\n } else if (ses[i].t === diff.SES_DELETE) {\n file1RevIdx--;\n } else if (ses[i].t === diff.SES_ADD) {\n file2RevIdx--;\n }\n }\n\n var tail = {\n file1index: -1,\n file2index: -1,\n chain: null\n };\n\n if (!prev) {\n return tail;\n }\n\n prev.chain = tail;\n\n return root;\n}\n\nfunction diffIndices(file1, file2) {\n // We apply the LCS to give a simple representation of the\n // offsets and lengths of mismatched chunks in the input\n // files. This is used by diff3_merge_indices below.\n\n var result = [];\n var tail1 = file1.length;\n var tail2 = file2.length;\n\n for (var candidate = longestCommonSubsequence(file1, file2); candidate !== null; candidate = candidate.chain) {\n var mismatchLength1 = tail1 - candidate.file1index - 1;\n var mismatchLength2 = tail2 - candidate.file2index - 1;\n tail1 = candidate.file1index;\n tail2 = candidate.file2index;\n\n if (mismatchLength1 || mismatchLength2) {\n result.push({\n file1: [tail1 + 1, mismatchLength1],\n file2: [tail2 + 1, mismatchLength2]\n });\n }\n }\n\n result.reverse();\n return result;\n}\n\nfunction diff3MergeIndices(a, o, b) {\n // Given three files, A, O, and B, where both A and B are\n // independently derived from O, returns a fairly complicated\n // internal representation of merge decisions it's taken. The\n // interested reader may wish to consult\n //\n // Sanjeev Khanna, Keshav Kunal, and Benjamin C. Pierce. \"A\n // Formal Investigation of Diff3.\" In Arvind and Prasad,\n // editors, Foundations of Software Technology and Theoretical\n // Computer Science (FSTTCS), December 2007.\n //\n // (http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf)\n var i;\n\n var m1 = diffIndices(o, a);\n var m2 = diffIndices(o, b);\n\n var hunks = [];\n\n function addHunk(h, side) {\n hunks.push([h.file1[0], side, h.file1[1], h.file2[0], h.file2[1]]);\n }\n for (i = 0; i < m1.length; i++) {\n addHunk(m1[i], 0);\n }\n for (i = 0; i < m2.length; i++) {\n addHunk(m2[i], 2);\n }\n hunks.sort(function(x, y) {\n return x[0] - y[0]\n });\n\n var result = [];\n var commonOffset = 0;\n\n function copyCommon(targetOffset) {\n if (targetOffset > commonOffset) {\n result.push([1, commonOffset, targetOffset - commonOffset]);\n commonOffset = targetOffset;\n }\n }\n\n for (var hunkIndex = 0; hunkIndex < hunks.length; hunkIndex++) {\n var firstHunkIndex = hunkIndex;\n var hunk = hunks[hunkIndex];\n var regionLhs = hunk[0];\n var regionRhs = regionLhs + hunk[2];\n while (hunkIndex < hunks.length - 1) {\n var maybeOverlapping = hunks[hunkIndex + 1];\n var maybeLhs = maybeOverlapping[0];\n if (maybeLhs > regionRhs) break;\n regionRhs = Math.max(regionRhs, maybeLhs + maybeOverlapping[2]);\n hunkIndex++;\n }\n\n copyCommon(regionLhs);\n if (firstHunkIndex == hunkIndex) {\n // The \"overlap\" was only one hunk long, meaning that\n // there's no conflict here. Either a and o were the\n // same, or b and o were the same.\n if (hunk[4] > 0) {\n result.push([hunk[1], hunk[3], hunk[4]]);\n }\n } else {\n // A proper conflict. Determine the extents of the\n // regions involved from a, o and b. Effectively merge\n // all the hunks on the left into one giant hunk, and\n // do the same for the right; then, correct for skew\n // in the regions of o that each side changed, and\n // report appropriate spans for the three sides.\n var regions = {\n 0: [a.length, -1, o.length, -1],\n 2: [b.length, -1, o.length, -1]\n };\n for (i = firstHunkIndex; i <= hunkIndex; i++) {\n hunk = hunks[i];\n var side = hunk[1];\n var r = regions[side];\n var oLhs = hunk[0];\n var oRhs = oLhs + hunk[2];\n var abLhs = hunk[3];\n var abRhs = abLhs + hunk[4];\n r[0] = Math.min(abLhs, r[0]);\n r[1] = Math.max(abRhs, r[1]);\n r[2] = Math.min(oLhs, r[2]);\n r[3] = Math.max(oRhs, r[3]);\n }\n var aLhs = regions[0][0] + (regionLhs - regions[0][2]);\n var aRhs = regions[0][1] + (regionRhs - regions[0][3]);\n var bLhs = regions[2][0] + (regionLhs - regions[2][2]);\n var bRhs = regions[2][1] + (regionRhs - regions[2][3]);\n result.push([-1,\n aLhs, aRhs - aLhs,\n regionLhs, regionRhs - regionLhs,\n bLhs, bRhs - bLhs\n ]);\n }\n commonOffset = regionRhs;\n }\n\n copyCommon(o.length);\n return result;\n}\n\nfunction diff3Merge(a, o, b) {\n // Applies the output of Diff.diff3_merge_indices to actually\n // construct the merged file; the returned result alternates\n // between \"ok\" and \"conflict\" blocks.\n\n var result = [];\n var files = [a, o, b];\n var indices = diff3MergeIndices(a, o, b);\n\n var okLines = [];\n\n function flushOk() {\n if (okLines.length) {\n result.push({\n ok: okLines\n });\n }\n okLines = [];\n }\n\n function pushOk(xs) {\n for (var j = 0; j < xs.length; j++) {\n okLines.push(xs[j]);\n }\n }\n\n function isTrueConflict(rec) {\n if (rec[2] != rec[6]) return true;\n var aoff = rec[1];\n var boff = rec[5];\n for (var j = 0; j < rec[2]; j++) {\n if (a[j + aoff] != b[j + boff]) return true;\n }\n return false;\n }\n\n for (var i = 0; i < indices.length; i++) {\n var x = indices[i];\n var side = x[0];\n if (side == -1) {\n if (!isTrueConflict(x)) {\n pushOk(files[0].slice(x[1], x[1] + x[2]));\n } else {\n flushOk();\n result.push({\n conflict: {\n a: a.slice(x[1], x[1] + x[2]),\n aIndex: x[1],\n o: o.slice(x[3], x[3] + x[4]),\n oIndex: x[3],\n b: b.slice(x[5], x[5] + x[6]),\n bIndex: x[5]\n }\n });\n }\n } else {\n pushOk(files[side].slice(x[1], x[1] + x[2]));\n }\n }\n\n flushOk();\n return result;\n}\n\nmodule.exports = diff3Merge;\n","/**\n * @enum {number}\n */\nexport const types = {\n commit: 0b0010000,\n tree: 0b0100000,\n blob: 0b0110000,\n tag: 0b1000000,\n ofs_delta: 0b1100000,\n ref_delta: 0b1110000,\n}\n","export function filterCapabilities(server, client) {\n const serverNames = server.map(cap => cap.split('=', 1)[0])\n return client.filter(cap => {\n const name = cap.split('=', 1)[0]\n return serverNames.includes(name)\n })\n}\n","import { FIFO } from './FIFO.js'\nimport { forAwait } from './forAwait.js'\n\n// Note: progress messages are designed to be written directly to the terminal,\n// so they are often sent with just a carriage return to overwrite the last line of output.\n// But there are also messages delimited with newlines.\n// I also include CRLF just in case.\nfunction findSplit(str) {\n const r = str.indexOf('\\r')\n const n = str.indexOf('\\n')\n if (r === -1 && n === -1) return -1\n if (r === -1) return n + 1 // \\n\n if (n === -1) return r + 1 // \\r\n if (n === r + 1) return n + 1 // \\r\\n\n return Math.min(r, n) + 1 // \\r or \\n\n}\n\nexport function splitLines(input) {\n const output = new FIFO()\n let tmp = ''\n ;(async () => {\n await forAwait(input, chunk => {\n chunk = chunk.toString('utf8')\n tmp += chunk\n while (true) {\n const i = findSplit(tmp)\n if (i === -1) break\n output.write(tmp.slice(0, i))\n tmp = tmp.slice(i)\n }\n })\n if (tmp.length > 0) {\n output.write(tmp)\n }\n output.end()\n })()\n return output\n}\n","'use strict';\n\nvar AsyncLock = function (opts) {\n\topts = opts || {};\n\n\tthis.Promise = opts.Promise || Promise;\n\n\t// format: {key : [fn, fn]}\n\t// queues[key] = null indicates no job running for key\n\tthis.queues = {};\n\n\t// domain of current running func {key : fn}\n\tthis.domains = {};\n\n\t// lock is reentrant for same domain\n\tthis.domainReentrant = opts.domainReentrant || false;\n\n\tthis.timeout = opts.timeout || AsyncLock.DEFAULT_TIMEOUT;\n\tthis.maxPending = opts.maxPending || AsyncLock.DEFAULT_MAX_PENDING;\n};\n\nAsyncLock.DEFAULT_TIMEOUT = 0; //Never\nAsyncLock.DEFAULT_MAX_PENDING = 1000;\n\n/**\n * Acquire Locks\n *\n * @param {String|Array} key \tresource key or keys to lock\n * @param {function} fn \tasync function\n * @param {function} cb \tcallback function, otherwise will return a promise\n * @param {Object} opts \toptions\n */\nAsyncLock.prototype.acquire = function (key, fn, cb, opts) {\n\tif (Array.isArray(key)) {\n\t\treturn this._acquireBatch(key, fn, cb, opts);\n\t}\n\n\tif (typeof (fn) !== 'function') {\n\t\tthrow new Error('You must pass a function to execute');\n\t}\n\n\t// faux-deferred promise using new Promise() (as Promise.defer is deprecated)\n\tvar deferredResolve = null;\n\tvar deferredReject = null;\n\tvar deferred = null;\n\n\tif (typeof (cb) !== 'function') {\n\t\topts = cb;\n\t\tcb = null;\n\n\t\t// will return a promise\n\t\tdeferred = new this.Promise(function(resolve, reject) {\n\t\t\tdeferredResolve = resolve;\n\t\t\tdeferredReject = reject;\n\t\t});\n\t}\n\n\topts = opts || {};\n\n\tvar resolved = false;\n\tvar timer = null;\n\tvar self = this;\n\n\tvar done = function (locked, err, ret) {\n\t\tif (locked) {\n\t\t\tif (self.queues[key].length === 0) {\n\t\t\t\tdelete self.queues[key];\n\t\t\t}\n\t\t\tdelete self.domains[key];\n\t\t}\n\n\t\tif (!resolved) {\n\t\t\tif (!deferred) {\n\t\t\t\tif (typeof (cb) === 'function') {\n\t\t\t\t\tcb(err, ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//promise mode\n\t\t\t\tif (err) {\n\t\t\t\t\tdeferredReject(err);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdeferredResolve(ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolved = true;\n\t\t}\n\n\t\tif (locked) {\n\t\t\t//run next func\n\t\t\tif (!!self.queues[key] && self.queues[key].length > 0) {\n\t\t\t\tself.queues[key].shift()();\n\t\t\t}\n\t\t}\n\t};\n\n\tvar exec = function (locked) {\n\t\tif (resolved) { // may due to timed out\n\t\t\treturn done(locked);\n\t\t}\n\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = null;\n\t\t}\n\n\t\tif (locked) {\n\t\t\tself.domains[key] = process.domain;\n\t\t}\n\n\t\t// Callback mode\n\t\tif (fn.length === 1) {\n\t\t\tvar called = false;\n\t\t\tfn(function (err, ret) {\n\t\t\t\tif (!called) {\n\t\t\t\t\tcalled = true;\n\t\t\t\t\tdone(locked, err, ret);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\t// Promise mode\n\t\t\tself._promiseTry(function () {\n\t\t\t\treturn fn();\n\t\t\t})\n\t\t\t.then(function(ret){\n\t\t\t\tdone(locked, undefined, ret);\n\t\t\t}, function(error){\n\t\t\t\tdone(locked, error);\n\t\t\t});\n\t\t}\n\t};\n\tif (!!process.domain) {\n\t\texec = process.domain.bind(exec);\n\t}\n\n\tif (!self.queues[key]) {\n\t\tself.queues[key] = [];\n\t\texec(true);\n\t}\n\telse if (self.domainReentrant && !!process.domain && process.domain === self.domains[key]) {\n\t\t// If code is in the same domain of current running task, run it directly\n\t\t// Since lock is re-enterable\n\t\texec(false);\n\t}\n\telse if (self.queues[key].length >= self.maxPending) {\n\t\tdone(false, new Error('Too much pending tasks'));\n\t}\n\telse {\n\t\tvar taskFn = function () {\n\t\t\texec(true);\n\t\t};\n\t\tif (opts.skipQueue) {\n\t\t\tself.queues[key].unshift(taskFn);\n\t\t} else {\n\t\t\tself.queues[key].push(taskFn);\n\t\t}\n\n\t\tvar timeout = opts.timeout || self.timeout;\n\t\tif (timeout) {\n\t\t\ttimer = setTimeout(function () {\n\t\t\t\ttimer = null;\n\t\t\t\tdone(false, new Error('async-lock timed out'));\n\t\t\t}, timeout);\n\t\t}\n\t}\n\n\tif (deferred) {\n\t\treturn deferred;\n\t}\n};\n\n/*\n * Below is how this function works:\n *\n * Equivalent code:\n * self.acquire(key1, function(cb){\n * self.acquire(key2, function(cb){\n * self.acquire(key3, fn, cb);\n * }, cb);\n * }, cb);\n *\n * Equivalent code:\n * var fn3 = getFn(key3, fn);\n * var fn2 = getFn(key2, fn3);\n * var fn1 = getFn(key1, fn2);\n * fn1(cb);\n */\nAsyncLock.prototype._acquireBatch = function (keys, fn, cb, opts) {\n\tif (typeof (cb) !== 'function') {\n\t\topts = cb;\n\t\tcb = null;\n\t}\n\n\tvar self = this;\n\tvar getFn = function (key, fn) {\n\t\treturn function (cb) {\n\t\t\tself.acquire(key, fn, cb, opts);\n\t\t};\n\t};\n\n\tvar fnx = fn;\n\tkeys.reverse().forEach(function (key) {\n\t\tfnx = getFn(key, fnx);\n\t});\n\n\tif (typeof (cb) === 'function') {\n\t\tfnx(cb);\n\t}\n\telse {\n\t\treturn new this.Promise(function (resolve, reject) {\n\t\t\t// check for promise mode in case keys is empty array\n\t\t\tif (fnx.length === 1) {\n\t\t\t\tfnx(function (err, ret) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(ret);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve(fnx());\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\n *\tWhether there is any running or pending asyncFunc\n *\n *\t@param {String} key\n */\nAsyncLock.prototype.isBusy = function (key) {\n\tif (!key) {\n\t\treturn Object.keys(this.queues).length > 0;\n\t}\n\telse {\n\t\treturn !!this.queues[key];\n\t}\n};\n\n/**\n * Promise.try() implementation to become independent of Q-specific methods\n */\nAsyncLock.prototype._promiseTry = function(fn) {\n\ttry {\n\t\treturn this.Promise.resolve(fn());\n\t} catch (e) {\n\t\treturn this.Promise.reject(e);\n\t}\n};\n\nmodule.exports = AsyncLock;\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","var Buffer = require('safe-buffer').Buffer\n\n// prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = Buffer.alloc(blockSize)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (typeof data === 'string') {\n enc = enc || 'utf8'\n data = Buffer.from(data, enc)\n }\n\n var block = this._block\n var blockSize = this._blockSize\n var length = data.length\n var accum = this._len\n\n for (var offset = 0; offset < length;) {\n var assigned = accum % blockSize\n var remainder = Math.min(length - offset, blockSize - assigned)\n\n for (var i = 0; i < remainder; i++) {\n block[assigned + i] = data[offset + i]\n }\n\n accum += remainder\n offset += remainder\n\n if ((accum % blockSize) === 0) {\n this._update(block)\n }\n }\n\n this._len += length\n return this\n}\n\nHash.prototype.digest = function (enc) {\n var rem = this._len % this._blockSize\n\n this._block[rem] = 0x80\n\n // zero (rem + 1) trailing bits, where (rem + 1) is the smallest\n // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize\n this._block.fill(0, rem + 1)\n\n if (rem >= this._finalSize) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n var bits = this._len * 8\n\n // uint32\n if (bits <= 0xffffffff) {\n this._block.writeUInt32BE(bits, this._blockSize - 4)\n\n // uint64\n } else {\n var lowBits = (bits & 0xffffffff) >>> 0\n var highBits = (bits - lowBits) / 0x100000000\n\n this._block.writeUInt32BE(highBits, this._blockSize - 8)\n this._block.writeUInt32BE(lowBits, this._blockSize - 4)\n }\n\n this._update(this._block)\n var hash = this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","/*\n * URL: https://github.com/cubicdaiya/onp\n *\n * Copyright (c) 2013 Tatsuhiko Kubo \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * The algorithm implemented here is based on \"An O(NP) Sequence Comparison Algorithm\"\n * by described by Sun Wu, Udi Manber and Gene Myers\n*/\nmodule.exports = function (a_, b_) {\n var a = a_,\n b = b_,\n m = a.length,\n n = b.length,\n reverse = false,\n ed = null,\n offset = m + 1,\n path = [],\n pathposi = [],\n ses = [],\n lcs = \"\",\n SES_DELETE = -1,\n SES_COMMON = 0,\n SES_ADD = 1;\n\n var tmp1,\n tmp2;\n\n var init = function () {\n if (m >= n) {\n tmp1 = a;\n tmp2 = m;\n a = b;\n b = tmp1;\n m = n;\n n = tmp2;\n reverse = true;\n offset = m + 1;\n }\n };\n\n var P = function (x, y, k) {\n return {\n 'x' : x,\n 'y' : y,\n 'k' : k,\n };\n };\n\n var seselem = function (elem, t) {\n return {\n 'elem' : elem,\n 't' : t,\n };\n };\n\n var snake = function (k, p, pp) {\n var r, x, y;\n if (p > pp) {\n r = path[k-1+offset];\n } else {\n r = path[k+1+offset];\n }\n\n y = Math.max(p, pp);\n x = y - k;\n while (x < m && y < n && a[x] === b[y]) {\n ++x;\n ++y;\n }\n\n path[k+offset] = pathposi.length;\n pathposi[pathposi.length] = new P(x, y, r);\n return y;\n };\n\n var recordseq = function (epc) {\n var x_idx, y_idx, px_idx, py_idx, i;\n x_idx = y_idx = 1;\n px_idx = py_idx = 0;\n for (i=epc.length-1;i>=0;--i) {\n while(px_idx < epc[i].x || py_idx < epc[i].y) {\n if (epc[i].y - epc[i].x > py_idx - px_idx) {\n if (reverse) {\n ses[ses.length] = new seselem(b[py_idx], SES_DELETE);\n } else {\n ses[ses.length] = new seselem(b[py_idx], SES_ADD);\n }\n ++y_idx;\n ++py_idx;\n } else if (epc[i].y - epc[i].x < py_idx - px_idx) {\n if (reverse) {\n ses[ses.length] = new seselem(a[px_idx], SES_ADD);\n } else {\n ses[ses.length] = new seselem(a[px_idx], SES_DELETE);\n }\n ++x_idx;\n ++px_idx;\n } else {\n ses[ses.length] = new seselem(a[px_idx], SES_COMMON);\n lcs += a[px_idx];\n ++x_idx;\n ++y_idx;\n ++px_idx;\n ++py_idx;\n }\n }\n }\n };\n\n init();\n\n return {\n SES_DELETE : -1,\n SES_COMMON : 0,\n SES_ADD : 1,\n editdistance : function () {\n return ed;\n },\n getlcs : function () {\n return lcs;\n },\n getses : function () {\n return ses;\n },\n compose : function () {\n var delta, size, fp, p, r, epc, i, k;\n delta = n - m;\n size = m + n + 3;\n fp = {};\n for (i=0;i=delta+1;--k) {\n fp[k+offset] = snake(k, fp[k-1+offset]+1, fp[k+1+offset]);\n }\n fp[delta+offset] = snake(delta, fp[delta-1+offset]+1, fp[delta+1+offset]);\n } while (fp[delta+offset] !== n);\n\n ed = delta + 2 * p;\n\n r = path[delta+offset];\n\n epc = [];\n while (r !== -1) {\n epc[epc.length] = new P(pathposi[r].x, pathposi[r].y, null);\n r = pathposi[r].k;\n }\n recordseq(epc);\n }\n };\n};\n","// @ts-check\nimport { hashObject } from '../storage/hashObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n *\n * @typedef {object} HashBlobResult - The object returned has the following schema:\n * @property {string} oid - The SHA-1 object id\n * @property {'blob'} type - The type of the object\n * @property {Uint8Array} object - The wrapped git object (the thing that is hashed)\n * @property {'wrapped'} format - The format of the object\n *\n */\n\n/**\n * Compute what the SHA-1 object id of a file would be\n *\n * @param {object} args\n * @param {Uint8Array|string} args.object - The object to write. If `object` is a String then it will be converted to a Uint8Array using UTF-8 encoding.\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id and the wrapped object Uint8Array.\n * @see HashBlobResult\n *\n * @example\n * let { oid, type, object, format } = await git.hashBlob({\n * object: 'Hello world!',\n * })\n *\n * console.log('oid', oid)\n * console.log('type', type)\n * console.log('object', object)\n * console.log('format', format)\n *\n */\nexport async function hashBlob({ object }) {\n try {\n assertParameter('object', object)\n\n // Convert object to buffer\n if (typeof object === 'string') {\n object = Buffer.from(object, 'utf8')\n } else {\n object = Buffer.from(object)\n }\n\n const type = 'blob'\n const { oid, object: _object } = await hashObject({\n type: 'blob',\n format: 'content',\n object,\n })\n return { oid, type, object: new Uint8Array(_object), format: 'wrapped' }\n } catch (err) {\n err.caller = 'git.hashBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a git object directly\n *\n * `format` can have the following values:\n *\n * | param | description |\n * | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | 'deflated' | Treat `object` as the raw deflate-compressed buffer for an object, meaning can be written to `.git/objects/**` as-is. |\n * | 'wrapped' | Treat `object` as the inflated object buffer wrapped in the git object header. This is the raw buffer used when calculating the SHA-1 object id of a git object. |\n * | 'content' | Treat `object` as the object buffer without the git header. |\n * | 'parsed' | Treat `object` as a parsed representation of the object. |\n *\n * If `format` is `'parsed'`, then `object` must match one of the schemas for `CommitObject`, `TreeObject`, `TagObject`, or a `string` (for blobs).\n *\n * {@link CommitObject typedef}\n *\n * {@link TreeObject typedef}\n *\n * {@link TagObject typedef}\n *\n * If `format` is `'content'`, `'wrapped'`, or `'deflated'`, `object` should be a `Uint8Array`.\n *\n * @deprecated\n * > This command is overly complicated.\n * >\n * > If you know the type of object you are writing, use [`writeBlob`](./writeBlob.md), [`writeCommit`](./writeCommit.md), [`writeTag`](./writeTag.md), or [`writeTree`](./writeTree.md).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string | Uint8Array | CommitObject | TreeObject | TagObject} args.object - The object to write.\n * @param {'blob'|'tree'|'commit'|'tag'} [args.type] - The kind of object to write.\n * @param {'deflated' | 'wrapped' | 'content' | 'parsed'} [args.format = 'parsed'] - What format the object is in. The possible choices are listed below.\n * @param {string} [args.oid] - If `format` is `'deflated'` then this param is required. Otherwise it is calculated.\n * @param {string} [args.encoding] - If `type` is `'blob'` then `object` will be converted to a Uint8Array using `encoding`.\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly written object.\n *\n * @example\n * // Manually create an annotated tag.\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log('commit', sha)\n *\n * let oid = await git.writeObject({\n * fs,\n * dir: '/tutorial',\n * type: 'tag',\n * object: {\n * object: sha,\n * type: 'commit',\n * tag: 'my-tag',\n * tagger: {\n * name: 'your name',\n * email: 'email@example.com',\n * timestamp: Math.floor(Date.now()/1000),\n * timezoneOffset: new Date().getTimezoneOffset()\n * },\n * message: 'Optional message'\n * }\n * })\n *\n * console.log('tag', oid)\n *\n */\nexport async function writeObject({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n type,\n object,\n format = 'parsed',\n oid,\n encoding = undefined,\n}) {\n try {\n const fs = new FileSystem(_fs)\n // Convert object to buffer\n if (format === 'parsed') {\n switch (type) {\n case 'commit':\n object = GitCommit.from(object).toObject()\n break\n case 'tree':\n object = GitTree.from(object).toObject()\n break\n case 'blob':\n object = Buffer.from(object, encoding)\n break\n case 'tag':\n object = GitAnnotatedTag.from(object).toObject()\n break\n default:\n throw new ObjectTypeError(oid || '', type, 'blob|commit|tag|tree')\n }\n // GitObjectManager does not know how to serialize content, so we tweak that parameter before passing it.\n format = 'content'\n }\n oid = await _writeObject({\n fs,\n gitdir,\n type,\n object,\n oid,\n format,\n })\n return oid\n } catch (err) {\n err.caller = 'git.writeObject'\n throw err\n }\n}\n","export async function hasObjectLoose({ fs, gitdir, oid }) {\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n return fs.exists(`${gitdir}/${source}`)\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function hasObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n}) {\n // Check to see if it's in a packfile.\n // Iterate through all the .idx files\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // If the packfile DOES have the oid we're looking for...\n if (p.offsets.has(oid)) {\n return true\n }\n }\n // Failed to find it\n return false\n}\n","import { hasObjectLoose } from '../storage/hasObjectLoose.js'\nimport { hasObjectPacked } from '../storage/hasObjectPacked.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function hasObject({\n fs,\n cache,\n gitdir,\n oid,\n format = 'content',\n}) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n\n // Look for it in the loose object directory.\n let result = await hasObjectLoose({ fs, gitdir, oid })\n // Check to see if it's in a packfile.\n if (!result) {\n result = await hasObjectPacked({\n fs,\n cache,\n gitdir,\n oid,\n getExternalRefDelta,\n })\n }\n // Finally\n return result\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit.js'\nimport { _readTree } from '../commands/readTree.js'\nimport { _writeTree } from '../commands/writeTree.js'\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} args.oid\n * @param {string|Uint8Array} args.note\n * @param {boolean} [args.force]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise}\n */\n\nexport async function _addNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n note,\n force,\n author,\n committer,\n signingKey,\n}) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n throw err\n }\n }\n\n // I'm using the \"empty tree\" magic number here for brevity\n const result = await _readTree({\n fs,\n cache,\n gitdir,\n oid: parent || '4b825dc642cb6eb9a060e54bf8d69288fbee4904',\n })\n let tree = result.tree\n\n // Handle the case where a note already exists\n if (force) {\n tree = tree.filter(entry => entry.path !== oid)\n } else {\n for (const entry of tree) {\n if (entry.path === oid) {\n throw new AlreadyExistsError('note', oid)\n }\n }\n }\n\n // Create the note blob\n if (typeof note === 'string') {\n note = Buffer.from(note, 'utf8')\n }\n const noteOid = await writeObject({\n fs,\n gitdir,\n type: 'blob',\n object: note,\n format: 'content',\n })\n\n // Create the new note tree\n tree.push({ mode: '100644', path: oid, oid: noteOid, type: 'blob' })\n const treeOid = await _writeTree({\n fs,\n gitdir,\n tree,\n })\n\n // Create the new note commit\n const commitOid = await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tree: treeOid,\n parent: parent && [parent],\n message: `Note added by 'isomorphic-git addNote'\\n`,\n author,\n committer,\n signingKey,\n })\n\n return commitOid\n}\n","// TODO: make a function that just returns obCount. then emptyPackfile = () => sizePack(pack) === 0\nexport function emptyPackfile(pack) {\n const pheader = '5041434b'\n const version = '00000002'\n const obCount = '00000000'\n const header = pheader + version + obCount\n return pack.slice(0, 12).toString('hex') === header\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function hashObject({\n type,\n object,\n format = 'content',\n oid = undefined,\n}) {\n if (format !== 'deflated') {\n if (format !== 'wrapped') {\n object = GitObject.wrap({ type, object })\n }\n oid = await shasum(object)\n }\n return { oid, object }\n}\n","// @ts-check\nimport { collect } from '../utils/collect.js'\nimport { join } from '../utils/join.js'\n\nimport { _pack } from './pack'\n\n/**\n *\n * @typedef {Object} PackObjectsResult The packObjects command returns an object with two properties:\n * @property {string} filename - The suggested filename for the packfile if you want to save it to disk somewhere. It includes the packfile SHA.\n * @property {Uint8Array} [packfile] - The packfile contents. Not present if `write` parameter was true, in which case the packfile was written straight to disk.\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string[]} args.oids\n * @param {boolean} args.write\n *\n * @returns {Promise}\n * @see PackObjectsResult\n */\nexport async function _packObjects({ fs, cache, gitdir, oids, write }) {\n const buffers = await _pack({ fs, cache, gitdir, oids })\n const packfile = Buffer.from(await collect(buffers))\n const packfileSha = packfile.slice(-20).toString('hex')\n const filename = `pack-${packfileSha}.pack`\n if (write) {\n await fs.write(join(gitdir, `objects/pack/${filename}`), packfile)\n return { filename }\n }\n return {\n filename,\n packfile: new Uint8Array(packfile),\n }\n}\n","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\nimport { mode2type } from '../utils/mode2type'\nimport { normalizeStats } from '../utils/normalizeStats'\n\nexport class GitWalkerIndex {\n constructor({ fs, gitdir, cache }) {\n this.treePromise = GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n return flatFileListToDirectoryStructure(index.entries)\n }\n )\n const walker = this\n this.ConstructEntry = class StageEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const tree = await this.treePromise\n const inode = tree.get(filepath)\n if (!inode) return null\n if (inode.type === 'blob') return null\n if (inode.type !== 'tree') {\n throw new Error(`ENOTDIR: not a directory, scandir '${filepath}'`)\n }\n const names = inode.children.map(inode => inode.fullpath)\n names.sort(compareStrings)\n return names\n }\n\n async type(entry) {\n if (entry._type === false) {\n await entry.stat()\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n await entry.stat()\n }\n return entry._mode\n }\n\n async stat(entry) {\n if (entry._stat === false) {\n const tree = await this.treePromise\n const inode = tree.get(entry._fullpath)\n if (!inode) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry._fullpath}'`\n )\n }\n const stats = inode.type === 'tree' ? {} : normalizeStats(inode.metadata)\n entry._type = inode.type === 'tree' ? 'tree' : mode2type(stats.mode)\n entry._mode = stats.mode\n if (inode.type === 'tree') {\n entry._stat = undefined\n } else {\n entry._stat = stats\n }\n }\n return entry._stat\n }\n\n async content(_entry) {\n // Cannot get content for an index entry\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const tree = await this.treePromise\n const inode = tree.get(entry._fullpath)\n entry._oid = inode.metadata.oid\n }\n return entry._oid\n }\n}\n","import { InternalError } from '../errors/InternalError.js'\n\n/**\n *\n * @param {number} mode\n */\nexport function mode2type(mode) {\n // prettier-ignore\n switch (mode) {\n case 0o040000: return 'tree'\n case 0o100644: return 'blob'\n case 0o100755: return 'blob'\n case 0o120000: return 'blob'\n case 0o160000: return 'commit'\n }\n throw new InternalError(`Unexpected GitTree entry mode: ${mode.toString(8)}`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerIndex } from '../models/GitWalkerIndex.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @returns {Walker}\n */\nexport function STAGE() {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, gitdir, cache }) {\n return new GitWalkerIndex({ fs, gitdir, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { join } from '../utils/join'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\nimport { GitObject } from './GitObject.js'\n\nexport class GitWalkerFs {\n constructor({ fs, dir, gitdir, cache }) {\n this.fs = fs\n this.cache = cache\n this.dir = dir\n this.gitdir = gitdir\n const walker = this\n this.ConstructEntry = class WorkdirEntry {\n constructor(fullpath) {\n this._fullpath = fullpath\n this._type = false\n this._mode = false\n this._stat = false\n this._content = false\n this._oid = false\n }\n\n async type() {\n return walker.type(this)\n }\n\n async mode() {\n return walker.mode(this)\n }\n\n async stat() {\n return walker.stat(this)\n }\n\n async content() {\n return walker.content(this)\n }\n\n async oid() {\n return walker.oid(this)\n }\n }\n }\n\n async readdir(entry) {\n const filepath = entry._fullpath\n const { fs, dir } = this\n const names = await fs.readdir(join(dir, filepath))\n if (names === null) return null\n return names.map(name => join(filepath, name))\n }\n\n async type(entry) {\n if (entry._type === false) {\n await entry.stat()\n }\n return entry._type\n }\n\n async mode(entry) {\n if (entry._mode === false) {\n await entry.stat()\n }\n return entry._mode\n }\n\n async stat(entry) {\n if (entry._stat === false) {\n const { fs, dir } = this\n let stat = await fs.lstat(`${dir}/${entry._fullpath}`)\n if (!stat) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry._fullpath}'`\n )\n }\n let type = stat.isDirectory() ? 'tree' : 'blob'\n if (type === 'blob' && !stat.isFile() && !stat.isSymbolicLink()) {\n type = 'special'\n }\n entry._type = type\n stat = normalizeStats(stat)\n entry._mode = stat.mode\n // workaround for a BrowserFS edge case\n if (stat.size === -1 && entry._actualSize) {\n stat.size = entry._actualSize\n }\n entry._stat = stat\n }\n return entry._stat\n }\n\n async content(entry) {\n if (entry._content === false) {\n const { fs, dir } = this\n if ((await entry.type()) === 'tree') {\n entry._content = undefined\n } else {\n const content = await fs.read(`${dir}/${entry._fullpath}`)\n // workaround for a BrowserFS edge case\n entry._actualSize = content.length\n if (entry._stat && entry._stat.size === -1) {\n entry._stat.size = entry._actualSize\n }\n entry._content = new Uint8Array(content)\n }\n }\n return entry._content\n }\n\n async oid(entry) {\n if (entry._oid === false) {\n const { fs, gitdir, cache } = this\n let oid\n // See if we can use the SHA1 hash in the index.\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n const stage = index.entriesMap.get(entry._fullpath)\n const stats = await entry.stat()\n if (!stage || compareStats(stats, stage)) {\n const content = await entry.content()\n if (content === undefined) {\n oid = undefined\n } else {\n oid = await shasum(\n GitObject.wrap({ type: 'blob', object: await entry.content() })\n )\n // Update the stats in the index so we will get a \"cache hit\" next time\n // 1) if we can (because the oid and mode are the same)\n // 2) and only if we need to (because other stats differ)\n if (\n stage &&\n oid === stage.oid &&\n stats.mode === stage.mode &&\n compareStats(stats, stage)\n ) {\n index.insert({\n filepath: entry._fullpath,\n stats,\n oid: oid,\n })\n }\n }\n } else {\n // Use the index SHA1 rather than compute it\n oid = stage.oid\n }\n })\n entry._oid = oid\n }\n return entry._oid\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitWalkerFs } from '../models/GitWalkerFs.js'\nimport { GitWalkSymbol } from '../utils/symbols.js'\n\n/**\n * @returns {Walker}\n */\nexport function WORKDIR() {\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkSymbol, {\n value: function({ fs, dir, gitdir, cache }) {\n return new GitWalkerFs({ fs, dir, gitdir, cache })\n },\n })\n Object.freeze(o)\n return o\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { IndexResetError } from '../errors/IndexResetError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { modified } from '../utils/modified.js'\n\n/**\n * Abort a merge in progress.\n *\n * Based on the behavior of git reset --merge, i.e. \"Resets the index and updates the files in the working tree that are different between and HEAD, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). If a file that is different between and the index has unstaged changes, reset is aborted.\"\n *\n * Essentially, abortMerge will reset any files affected by merge conflicts to their last known good version at HEAD.\n * Any unstaged changes are saved and any staged changes are reset as well.\n *\n * NOTE: The behavior of this command differs slightly from canonical git in that an error will be thrown if a file exists in the index and nowhere else.\n * Canonical git will reset the file and continue aborting the merge in this case.\n *\n * **WARNING:** Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.\n * If there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), `git.abortMerge` will in some cases be unable to reconstruct the original (pre-merge) changes.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.commit='HEAD'] - commit to reset the index and worktree to, defaults to HEAD\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n */\nexport async function abortMerge({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n commit = 'HEAD',\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n\n const fs = new FileSystem(_fs)\n const trees = [TREE({ ref: commit }), WORKDIR(), STAGE()]\n let unmergedPaths = []\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n unmergedPaths = index.unmergedPaths\n })\n\n const results = await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees,\n map: async function(path, [head, workdir, index]) {\n const staged = !(await modified(workdir, index))\n const unmerged = unmergedPaths.includes(path)\n const unmodified = !(await modified(index, head))\n\n if (staged || unmerged) {\n return head\n ? {\n path,\n mode: await head.mode(),\n oid: await head.oid(),\n type: await head.type(),\n content: await head.content(),\n }\n : undefined\n }\n\n if (unmodified) return false\n else throw new IndexResetError(path)\n },\n })\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n // Reset paths in index and worktree, this can't be done in _walk because the\n // STAGE walker acquires its own index lock.\n\n for (const entry of results) {\n if (entry === false) continue\n\n // entry is not false, so from here we can assume index = workdir\n if (!entry) {\n await fs.rmdir(`${dir}/${entry.path}`, { recursive: true })\n index.delete({ filepath: entry.path })\n continue\n }\n\n if (entry.type === 'blob') {\n const content = new TextDecoder().decode(entry.content)\n await fs.write(`${dir}/${entry.path}`, content, { mode: entry.mode })\n index.insert({\n filepath: entry.path,\n oid: entry.oid,\n stage: 0,\n })\n }\n }\n })\n } catch (err) {\n err.caller = 'git.abortMerge'\n throw err\n }\n}\n","export function posixifyPathBuffer(buffer) {\n let idx\n while (~(idx = buffer.indexOf(92))) buffer[idx] = 47\n return buffer\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { MultipleGitError } from '../errors/MultipleGitError'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { posixifyPathBuffer } from '../utils/posixifyPathBuffer.js'\n\n/**\n * Add a file to the git index (aka staging area)\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string|string[]} args.filepath - The path to the file to add to the index\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {boolean} [args.force=false] - add to index even if matches gitignore. Think `git add --force`\n * @param {boolean} [args.parallel=false] - process each input file in parallel. Parallel processing will result in more memory consumption but less process time\n *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await fs.promises.writeFile('/tutorial/README.md', `# TEST`)\n * await git.add({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function add({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n force = false,\n parallel = true,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {\n return addToIndex({\n dir,\n gitdir,\n fs,\n filepath,\n index,\n force,\n parallel,\n })\n })\n } catch (err) {\n err.caller = 'git.add'\n throw err\n }\n}\n\nasync function addToIndex({\n dir,\n gitdir,\n fs,\n filepath,\n index,\n force,\n parallel,\n}) {\n // TODO: Should ignore UNLESS it's already in the index.\n filepath = Array.isArray(filepath) ? filepath : [filepath]\n const promises = filepath.map(async currentFilepath => {\n if (!force) {\n const ignored = await GitIgnoreManager.isIgnored({\n fs,\n dir,\n gitdir,\n filepath: currentFilepath,\n })\n if (ignored) return\n }\n const stats = await fs.lstat(join(dir, currentFilepath))\n if (!stats) throw new NotFoundError(currentFilepath)\n\n if (stats.isDirectory()) {\n const children = await fs.readdir(join(dir, currentFilepath))\n if (parallel) {\n const promises = children.map(child =>\n addToIndex({\n dir,\n gitdir,\n fs,\n filepath: [join(currentFilepath, child)],\n index,\n force,\n parallel,\n })\n )\n await Promise.all(promises)\n } else {\n for (const child of children) {\n await addToIndex({\n dir,\n gitdir,\n fs,\n filepath: [join(currentFilepath, child)],\n index,\n force,\n parallel,\n })\n }\n }\n } else {\n const object = stats.isSymbolicLink()\n ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)\n : await fs.read(join(dir, currentFilepath))\n if (object === null) throw new NotFoundError(currentFilepath)\n const oid = await _writeObject({ fs, gitdir, type: 'blob', object })\n index.insert({ filepath: currentFilepath, stats, oid })\n }\n })\n\n const settledPromises = await Promise.allSettled(promises)\n const rejectedPromises = settledPromises\n .filter(settle => settle.status === 'rejected')\n .map(settle => settle.reason)\n if (rejectedPromises.length > 1) {\n throw new MultipleGitError(rejectedPromises)\n }\n if (rejectedPromises.length === 1) {\n throw rejectedPromises[0]\n }\n\n const fulfilledPromises = settledPromises\n .filter(settle => settle.status === 'fulfilled' && settle.value)\n .map(settle => settle.value)\n\n return fulfilledPromises\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n *\n * @returns {Promise} Resolves with the config value\n *\n * @example\n * // Read config value\n * let value = await git.getConfig({\n * dir: '$input((/))',\n * path: '$input((user.name))'\n * })\n * console.log(value)\n *\n */\nexport async function _getConfig({ fs, gitdir, path }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n return config.get(path)\n}\n","import { _getConfig } from '../commands/getConfig'\n\n/**\n *\n * @returns {Promise}\n */\nexport async function normalizeAuthorObject({ fs, gitdir, author = {} }) {\n let { name, email, timestamp, timezoneOffset } = author\n name = name || (await _getConfig({ fs, gitdir, path: 'user.name' }))\n email = email || (await _getConfig({ fs, gitdir, path: 'user.email' })) || ''\n\n if (name === undefined) {\n return undefined\n }\n\n timestamp = timestamp != null ? timestamp : Math.floor(Date.now() / 1000)\n timezoneOffset =\n timezoneOffset != null\n ? timezoneOffset\n : new Date(timestamp * 1000).getTimezoneOffset()\n\n return { name, email, timestamp, timezoneOffset }\n}\n","import { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\n\n/**\n *\n * @returns {Promise}\n */\nexport async function normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer,\n}) {\n committer = Object.assign({}, committer || author)\n // Match committer's date to author's one, if omitted\n if (author) {\n committer.timestamp = committer.timestamp || author.timestamp\n committer.timezoneOffset = committer.timezoneOffset || author.timezoneOffset\n }\n committer = await normalizeAuthorObject({ fs, gitdir, author: committer })\n return committer\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addNote } from '../commands/addNote.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Add or update an object note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to add the note to.\n * @param {string|Uint8Array} args.note - The note to add\n * @param {boolean} [args.force] - Over-write note if it already exists.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the note commit using this private PGP key.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the commit object for the added note.\n */\n\nexport async function addNote({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n note,\n force,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n assertParameter('note', note)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _addNote({\n fs: new FileSystem(fs),\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n note,\n force,\n author,\n committer,\n signingKey,\n })\n } catch (err) {\n err.caller = 'git.addNote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.remote\n * @param {string} args.url\n * @param {boolean} args.force\n *\n * @returns {Promise}\n *\n */\nexport async function _addRemote({ fs, gitdir, remote, url, force }) {\n if (remote !== cleanGitRef.clean(remote)) {\n throw new InvalidRefNameError(remote, cleanGitRef.clean(remote))\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n if (!force) {\n // Check that setting it wouldn't overwrite.\n const remoteNames = await config.getSubsections('remote')\n if (remoteNames.includes(remote)) {\n // Throw an error if it would overwrite an existing remote,\n // but not if it's simply setting the same value again.\n if (url !== (await config.get(`remote.${remote}.url`))) {\n throw new AlreadyExistsError('remote', remote)\n }\n }\n }\n await config.set(`remote.${remote}.url`, url)\n await config.set(\n `remote.${remote}.fetch`,\n `+refs/heads/*:refs/remotes/${remote}/*`\n )\n await GitConfigManager.save({ fs, gitdir, config })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addRemote } from '../commands/addRemote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Add or update a remote\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.remote - The name of the remote\n * @param {string} args.url - The URL of the remote\n * @param {boolean} [args.force = false] - Instead of throwing an error if a remote named `remote` already exists, overwrite the existing remote.\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.addRemote({\n * fs,\n * dir: '/tutorial',\n * remote: 'upstream',\n * url: 'https://github.com/isomorphic-git/isomorphic-git'\n * })\n * console.log('done')\n *\n */\nexport async function addRemote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n url,\n force = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('remote', remote)\n assertParameter('url', url)\n return await _addRemote({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n url,\n force,\n })\n } catch (err) {\n err.caller = 'git.addRemote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * Create an annotated tag.\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.message = ref]\n * @param {string} [args.object = 'HEAD']\n * @param {object} [args.tagger]\n * @param {string} args.tagger.name\n * @param {string} args.tagger.email\n * @param {number} args.tagger.timestamp\n * @param {number} args.tagger.timezoneOffset\n * @param {string} [args.gpgsig]\n * @param {string} [args.signingKey]\n * @param {boolean} [args.force = false]\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.annotatedTag({\n * dir: '$input((/))',\n * ref: '$input((test-tag))',\n * message: '$input((This commit is awesome))',\n * tagger: {\n * name: '$input((Mr. Test))',\n * email: '$input((mrtest@example.com))'\n * }\n * })\n * console.log('done')\n *\n */\nexport async function _annotatedTag({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tagger,\n message = ref,\n gpgsig,\n object,\n signingKey,\n force = false,\n}) {\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('tag', ref)\n }\n\n // Resolve passed value\n const oid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: object || 'HEAD',\n })\n\n const { type } = await readObject({ fs, cache, gitdir, oid })\n let tagObject = GitAnnotatedTag.from({\n object: oid,\n type,\n tag: ref.replace('refs/tags/', ''),\n tagger,\n message,\n gpgsig,\n })\n if (signingKey) {\n tagObject = await GitAnnotatedTag.sign(tagObject, onSign, signingKey)\n }\n const value = await writeObject({\n fs,\n gitdir,\n type: 'tag',\n object: tagObject.toObject(),\n })\n\n await GitRefManager.writeRef({ fs, gitdir, ref, value })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _annotatedTag } from '../commands/annotatedTag.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\n\n/**\n * Create an annotated tag.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the tag\n * @param {string} [args.message = ref] - The tag message to use.\n * @param {string} [args.object = 'HEAD'] - The SHA-1 object id the tag points to. (Will resolve to a SHA-1 object id if value is a ref.) By default, the commit object which is referred by the current `HEAD` is used.\n * @param {object} [args.tagger] - The details about the tagger.\n * @param {string} [args.tagger.name] - Default is `user.name` config.\n * @param {string} [args.tagger.email] - Default is `user.email` config.\n * @param {number} [args.tagger.timestamp=Math.floor(Date.now()/1000)] - Set the tagger timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.tagger.timezoneOffset] - Set the tagger timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.gpgsig] - The gpgsig attached to the tag object. (Mutually exclusive with the `signingKey` option.)\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key. (Mutually exclusive with the `gpgsig` option.)\n * @param {boolean} [args.force = false] - Instead of throwing an error if a tag named `ref` already exists, overwrite the existing tag. Note that this option does not modify the original tag object itself.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.annotatedTag({\n * fs,\n * dir: '/tutorial',\n * ref: 'test-tag',\n * message: 'This commit is awesome',\n * tagger: {\n * name: 'Mr. Test',\n * email: 'mrtest@example.com'\n * }\n * })\n * console.log('done')\n *\n */\nexport async function annotatedTag({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n tagger: _tagger,\n message = ref,\n gpgsig,\n object,\n signingKey,\n force = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n // Fill in missing arguments with default values\n const tagger = await normalizeAuthorObject({ fs, gitdir, author: _tagger })\n if (!tagger) throw new MissingNameError('tagger')\n\n return await _annotatedTag({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tagger,\n message,\n gpgsig,\n object,\n signingKey,\n force,\n })\n } catch (err) {\n err.caller = 'git.annotatedTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * Create a branch\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.object = 'HEAD']\n * @param {boolean} [args.checkout = false]\n * @param {boolean} [args.force = false]\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.branch({ dir: '$input((/))', ref: '$input((develop))' })\n * console.log('done')\n *\n */\nexport async function _branch({\n fs,\n gitdir,\n ref,\n object,\n checkout = false,\n force = false,\n}) {\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n const fullref = `refs/heads/${ref}`\n\n if (!force) {\n const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref })\n if (exist) {\n throw new AlreadyExistsError('branch', ref, false)\n }\n }\n\n // Get current HEAD tree oid\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref: object || 'HEAD' })\n } catch (e) {\n // Probably an empty repo\n }\n\n // Create a new ref that points at the current commit\n if (oid) {\n await GitRefManager.writeRef({ fs, gitdir, ref: fullref, value: oid })\n }\n\n if (checkout) {\n // Update HEAD\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullref,\n })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _branch } from '../commands/branch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Create a branch\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the branch\n * @param {string} [args.object = 'HEAD'] - What oid to use as the start point. Accepts a symbolic ref.\n * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch\n * @param {boolean} [args.force = false] - Instead of throwing an error if a branched named `ref` already exists, overwrite the existing branch.\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.branch({ fs, dir: '/tutorial', ref: 'develop' })\n * console.log('done')\n *\n */\nexport async function branch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n object,\n checkout = false,\n force = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n return await _branch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n object,\n checkout,\n force,\n })\n } catch (err) {\n err.caller = 'git.branch'\n throw err\n }\n}\n","export const worthWalking = (filepath, root) => {\n if (filepath === '.' || root == null || root.length === 0 || root === '.') {\n return true\n }\n if (root.length >= filepath.length) {\n return root.startsWith(filepath)\n } else {\n return filepath.startsWith(root)\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { CheckoutConflictError } from '../errors/CheckoutConflictError.js'\nimport { CommitNotFetchedError } from '../errors/CommitNotFetchedError.js'\nimport { InternalError } from '../errors/InternalError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { flat } from '../utils/flat.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string[]} [args.filepaths]\n * @param {string} args.remote\n * @param {boolean} args.noCheckout\n * @param {boolean} [args.noUpdateHead]\n * @param {boolean} [args.dryRun]\n * @param {boolean} [args.force]\n * @param {boolean} [args.track]\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n */\nexport async function _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n remote,\n ref,\n filepaths,\n noCheckout,\n noUpdateHead,\n dryRun,\n force,\n track = true,\n}) {\n // Get tree oid\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref })\n // TODO: Figure out what to do if both 'ref' and 'remote' are specified, ref already exists,\n // and is configured to track a different remote.\n } catch (err) {\n if (ref === 'HEAD') throw err\n // If `ref` doesn't exist, create a new remote tracking branch\n // Figure out the commit to checkout\n const remoteRef = `${remote}/${ref}`\n oid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: remoteRef,\n })\n if (track) {\n // Set up remote tracking branch\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.set(`branch.${ref}.remote`, remote)\n await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`)\n await GitConfigManager.save({ fs, gitdir, config })\n }\n // Create a new branch that points at that same commit\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref: `refs/heads/${ref}`,\n value: oid,\n })\n }\n\n // Update working dir\n if (!noCheckout) {\n let ops\n // First pass - just analyze files (not directories) and figure out what needs to be done\n try {\n ops = await analyze({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n force,\n filepaths,\n })\n } catch (err) {\n // Throw a more helpful error message for this common mistake.\n if (err instanceof NotFoundError && err.data.what === oid) {\n throw new CommitNotFetchedError(ref, oid)\n } else {\n throw err\n }\n }\n\n // Report conflicts\n const conflicts = ops\n .filter(([method]) => method === 'conflict')\n .map(([method, fullpath]) => fullpath)\n if (conflicts.length > 0) {\n throw new CheckoutConflictError(conflicts)\n }\n\n // Collect errors\n const errors = ops\n .filter(([method]) => method === 'error')\n .map(([method, fullpath]) => fullpath)\n if (errors.length > 0) {\n throw new InternalError(errors.join(', '))\n }\n\n if (dryRun) {\n // Since the format of 'ops' is in flux, I really would rather folk besides myself not start relying on it\n // return ops\n return\n }\n\n // Second pass - execute planned changes\n // The cheapest semi-parallel solution without computing a full dependency graph will be\n // to just do ops in 4 dumb phases: delete files, delete dirs, create dirs, write files\n\n let count = 0\n const total = ops.length\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n await Promise.all(\n ops\n .filter(\n ([method]) => method === 'delete' || method === 'delete-index'\n )\n .map(async function([method, fullpath]) {\n const filepath = `${dir}/${fullpath}`\n if (method === 'delete') {\n await fs.rm(filepath)\n }\n index.delete({ filepath: fullpath })\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n })\n )\n })\n\n // Note: this is cannot be done naively in parallel\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n for (const [method, fullpath] of ops) {\n if (method === 'rmdir' || method === 'rmdir-index') {\n const filepath = `${dir}/${fullpath}`\n try {\n if (method === 'rmdir-index') {\n index.delete({ filepath: fullpath })\n }\n await fs.rmdir(filepath)\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n } catch (e) {\n if (e.code === 'ENOTEMPTY') {\n console.log(\n `Did not delete ${fullpath} because directory is not empty`\n )\n } else {\n throw e\n }\n }\n }\n }\n })\n\n await Promise.all(\n ops\n .filter(([method]) => method === 'mkdir' || method === 'mkdir-index')\n .map(async function([_, fullpath]) {\n const filepath = `${dir}/${fullpath}`\n await fs.mkdir(filepath)\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n })\n )\n\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n await Promise.all(\n ops\n .filter(\n ([method]) =>\n method === 'create' ||\n method === 'create-index' ||\n method === 'update' ||\n method === 'mkdir-index'\n )\n .map(async function([method, fullpath, oid, mode, chmod]) {\n const filepath = `${dir}/${fullpath}`\n try {\n if (method !== 'create-index' && method !== 'mkdir-index') {\n const { object } = await readObject({ fs, cache, gitdir, oid })\n if (chmod) {\n // Note: the mode option of fs.write only works when creating files,\n // not updating them. Since the `fs` plugin doesn't expose `chmod` this\n // is our only option.\n await fs.rm(filepath)\n }\n if (mode === 0o100644) {\n // regular file\n await fs.write(filepath, object)\n } else if (mode === 0o100755) {\n // executable file\n await fs.write(filepath, object, { mode: 0o777 })\n } else if (mode === 0o120000) {\n // symlink\n await fs.writelink(filepath, object)\n } else {\n throw new InternalError(\n `Invalid mode 0o${mode.toString(8)} detected in blob ${oid}`\n )\n }\n }\n\n const stats = await fs.lstat(filepath)\n // We can't trust the executable bit returned by lstat on Windows,\n // so we need to preserve this value from the TREE.\n // TODO: Figure out how git handles this internally.\n if (mode === 0o100755) {\n stats.mode = 0o755\n }\n // Submodules are present in the git index but use a unique mode different from trees\n if (method === 'mkdir-index') {\n stats.mode = 0o160000\n }\n index.insert({\n filepath: fullpath,\n stats,\n oid,\n })\n if (onProgress) {\n await onProgress({\n phase: 'Updating workdir',\n loaded: ++count,\n total,\n })\n }\n } catch (e) {\n console.log(e)\n }\n })\n )\n })\n }\n\n // Update HEAD\n if (!noUpdateHead) {\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n if (fullRef.startsWith('refs/heads')) {\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullRef,\n })\n } else {\n // detached head\n await GitRefManager.writeRef({ fs, gitdir, ref: 'HEAD', value: oid })\n }\n }\n}\n\nasync function analyze({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n force,\n filepaths,\n}) {\n let count = 0\n return _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref }), WORKDIR(), STAGE()],\n map: async function(fullpath, [commit, workdir, stage]) {\n if (fullpath === '.') return\n // match against base paths\n if (filepaths && !filepaths.some(base => worthWalking(fullpath, base))) {\n return null\n }\n // Emit progress event\n if (onProgress) {\n await onProgress({ phase: 'Analyzing workdir', loaded: ++count })\n }\n\n // This is a kind of silly pattern but it worked so well for me in the past\n // and it makes intuitively demonstrating exhaustiveness so *easy*.\n // This checks for the presence and/or absence of each of the 3 entries,\n // converts that to a 3-bit binary representation, and then handles\n // every possible combination (2^3 or 8 cases) with a lookup table.\n const key = [!!stage, !!commit, !!workdir].map(Number).join('')\n switch (key) {\n // Impossible case.\n case '000':\n return\n // Ignore workdir files that are not tracked and not part of the new commit.\n case '001':\n // OK, make an exception for explicitly named files.\n if (force && filepaths && filepaths.includes(fullpath)) {\n return ['delete', fullpath]\n }\n return\n // New entries\n case '010': {\n switch (await commit.type()) {\n case 'tree': {\n return ['mkdir', fullpath]\n }\n case 'blob': {\n return [\n 'create',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n case 'commit': {\n return [\n 'mkdir-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n default: {\n return [\n 'error',\n `new entry Unhandled type ${await commit.type()}`,\n ]\n }\n }\n }\n // New entries but there is already something in the workdir there.\n case '011': {\n switch (`${await commit.type()}-${await workdir.type()}`) {\n case 'tree-tree': {\n return // noop\n }\n case 'tree-blob':\n case 'blob-tree': {\n return ['conflict', fullpath]\n }\n case 'blob-blob': {\n // Is the incoming file different?\n if ((await commit.oid()) !== (await workdir.oid())) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await workdir.mode()),\n ]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n // Is the incoming file a different mode?\n if ((await commit.mode()) !== (await workdir.mode())) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n true,\n ]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n return [\n 'create-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n }\n }\n case 'commit-tree': {\n // TODO: submodule\n // We'll ignore submodule directories for now.\n // Users prefer we not throw an error for lack of submodule support.\n // gitlinks\n return\n }\n case 'commit-blob': {\n // TODO: submodule\n // But... we'll complain if there is a *file* where we would\n // put a submodule if we had submodule support.\n return ['conflict', fullpath]\n }\n default: {\n return ['error', `new entry Unhandled type ${commit.type}`]\n }\n }\n }\n // Something in stage but not in the commit OR the workdir.\n // Note: I verified this behavior against canonical git.\n case '100': {\n return ['delete-index', fullpath]\n }\n // Deleted entries\n // TODO: How to handle if stage type and workdir type mismatch?\n case '101': {\n switch (await stage.type()) {\n case 'tree': {\n return ['rmdir', fullpath]\n }\n case 'blob': {\n // Git checks that the workdir.oid === stage.oid before deleting file\n if ((await stage.oid()) !== (await workdir.oid())) {\n if (force) {\n return ['delete', fullpath]\n } else {\n return ['conflict', fullpath]\n }\n } else {\n return ['delete', fullpath]\n }\n }\n case 'commit': {\n return ['rmdir-index', fullpath]\n }\n default: {\n return [\n 'error',\n `delete entry Unhandled type ${await stage.type()}`,\n ]\n }\n }\n }\n /* eslint-disable no-fallthrough */\n // File missing from workdir\n case '110':\n // Possibly modified entries\n case '111': {\n /* eslint-enable no-fallthrough */\n switch (`${await stage.type()}-${await commit.type()}`) {\n case 'tree-tree': {\n return\n }\n case 'blob-blob': {\n // If the file hasn't changed, there is no need to do anything.\n // Existing file modifications in the workdir can be be left as is.\n if (\n (await stage.oid()) === (await commit.oid()) &&\n (await stage.mode()) === (await commit.mode()) &&\n !force\n ) {\n return\n }\n\n // Check for local changes that would be lost\n if (workdir) {\n // Note: canonical git only compares with the stage. But we're smart enough\n // to compare to the stage AND the incoming commit.\n if (\n (await workdir.oid()) !== (await stage.oid()) &&\n (await workdir.oid()) !== (await commit.oid())\n ) {\n if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await workdir.mode()),\n ]\n } else {\n return ['conflict', fullpath]\n }\n }\n } else if (force) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n (await commit.mode()) !== (await stage.mode()),\n ]\n }\n // Has file mode changed?\n if ((await commit.mode()) !== (await stage.mode())) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n true,\n ]\n }\n // TODO: HANDLE SYMLINKS\n // Has the file content changed?\n if ((await commit.oid()) !== (await stage.oid())) {\n return [\n 'update',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n false,\n ]\n } else {\n return\n }\n }\n case 'tree-blob': {\n return ['update-dir-to-blob', fullpath, await commit.oid()]\n }\n case 'blob-tree': {\n return ['update-blob-to-tree', fullpath]\n }\n case 'commit-commit': {\n return [\n 'mkdir-index',\n fullpath,\n await commit.oid(),\n await commit.mode(),\n ]\n }\n default: {\n return [\n 'error',\n `update entry Unhandled type ${await stage.type()}-${await commit.type()}`,\n ]\n }\n }\n }\n }\n },\n // Modify the default flat mapping\n reduce: async function(parent, children) {\n children = flat(children)\n if (!parent) {\n return children\n } else if (parent && parent[0] === 'rmdir') {\n children.push(parent)\n return children\n } else {\n children.unshift(parent)\n return children\n }\n },\n })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _checkout } from '../commands/checkout.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Checkout a branch\n *\n * If the branch already exists it will check out that branch. Otherwise, it will create a new remote tracking branch set to track the remote branch of that name.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref = 'HEAD'] - Source to checkout files from\n * @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories\n * @param {string} [args.remote = 'origin'] - Which remote repository to use\n * @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory\n * @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.\n * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.\n * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.\n * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * // switch to the main branch\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * ref: 'main'\n * })\n * console.log('done')\n *\n * @example\n * // restore the 'docs' and 'src/docs' folders to the way they were, overwriting any changes\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * force: true,\n * filepaths: ['docs', 'src/docs']\n * })\n * console.log('done')\n *\n * @example\n * // restore the 'docs' and 'src/docs' folders to the way they are in the 'develop' branch, overwriting any changes\n * await git.checkout({\n * fs,\n * dir: '/tutorial',\n * ref: 'develop',\n * noUpdateHead: true,\n * force: true,\n * filepaths: ['docs', 'src/docs']\n * })\n * console.log('done')\n */\nexport async function checkout({\n fs,\n onProgress,\n dir,\n gitdir = join(dir, '.git'),\n remote = 'origin',\n ref: _ref,\n filepaths,\n noCheckout = false,\n noUpdateHead = _ref === undefined,\n dryRun = false,\n force = false,\n track = true,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n\n const ref = _ref || 'HEAD'\n return await _checkout({\n fs: new FileSystem(fs),\n cache,\n onProgress,\n dir,\n gitdir,\n remote,\n ref,\n filepaths,\n noCheckout,\n noUpdateHead,\n dryRun,\n force,\n track,\n })\n } catch (err) {\n err.caller = 'git.checkout'\n throw err\n }\n}\n","// @ts-check\nimport { join } from '../utils/join.js'\n\n/**\n * Initialize a new repository\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} [args.dir]\n * @param {string} [args.gitdir]\n * @param {boolean} [args.bare = false]\n * @param {string} [args.defaultBranch = 'master']\n * @returns {Promise}\n */\nexport async function _init({\n fs,\n bare = false,\n dir,\n gitdir = bare ? dir : join(dir, '.git'),\n defaultBranch = 'master',\n}) {\n // Don't overwrite an existing config\n if (await fs.exists(gitdir + '/config')) return\n\n let folders = [\n 'hooks',\n 'info',\n 'objects/info',\n 'objects/pack',\n 'refs/heads',\n 'refs/tags',\n ]\n folders = folders.map(dir => gitdir + '/' + dir)\n for (const folder of folders) {\n await fs.mkdir(folder)\n }\n\n await fs.write(\n gitdir + '/config',\n '[core]\\n' +\n '\\trepositoryformatversion = 0\\n' +\n '\\tfilemode = false\\n' +\n `\\tbare = ${bare}\\n` +\n (bare ? '' : '\\tlogallrefupdates = true\\n') +\n '\\tsymlinks = false\\n' +\n '\\tignorecase = true\\n'\n )\n await fs.write(gitdir + '/HEAD', `ref: refs/heads/${defaultBranch}\\n`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _addRemote } from '../commands/addRemote.js'\nimport { _checkout } from '../commands/checkout.js'\nimport { _fetch } from '../commands/fetch.js'\nimport { _init } from '../commands/init.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} [args.dir]\n * @param {string} args.gitdir\n * @param {string} args.url\n * @param {string} args.corsProxy\n * @param {string} args.ref\n * @param {boolean} args.singleBranch\n * @param {boolean} args.noCheckout\n * @param {boolean} args.noTags\n * @param {string} args.remote\n * @param {number} args.depth\n * @param {Date} args.since\n * @param {string[]} args.exclude\n * @param {boolean} args.relative\n * @param {Object} args.headers\n *\n * @returns {Promise} Resolves successfully when clone completes\n *\n */\nexport async function _clone({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n url,\n corsProxy,\n ref,\n remote,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n noCheckout,\n noTags,\n headers,\n}) {\n try {\n await _init({ fs, gitdir })\n await _addRemote({ fs, gitdir, remote, url, force: false })\n if (corsProxy) {\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.set(`http.corsProxy`, corsProxy)\n await GitConfigManager.save({ fs, gitdir, config })\n }\n const { defaultBranch, fetchHead } = await _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remote,\n corsProxy,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n headers,\n tags: !noTags,\n })\n if (fetchHead === null) return\n ref = ref || defaultBranch\n ref = ref.replace('refs/heads/', '')\n // Checkout that branch\n await _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n remote,\n noCheckout,\n })\n } catch (err) {\n // Remove partial local repository, see #1283\n // Ignore any error as we are already failing.\n // The catch is necessary so the original error is not masked.\n await fs\n .rmdir(gitdir, { recursive: true, maxRetries: 10 })\n .catch(() => undefined)\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _clone } from '../commands/clone.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Clone a repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.url - The URL of the remote repository\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Value is stored in the git config file for that repo.\n * @param {string} [args.ref] - Which branch to checkout. By default this is the designated \"main branch\" of the repository.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {boolean} [args.noCheckout = false] - If true, clone will only fetch the repo, not check out a branch. Skipping checkout can save a lot of time normally spent writing files to disk.\n * @param {boolean} [args.noTags = false] - By default clone will fetch all tags. `noTags` disables that behavior.\n * @param {string} [args.remote = 'origin'] - What to name the remote that is created.\n * @param {number} [args.depth] - Integer. Determines how much of the git repository's history to retrieve\n * @param {Date} [args.since] - Only fetch commits created after the given date. Mutually exclusive with `depth`.\n * @param {string[]} [args.exclude = []] - A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.\n * @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.\n * @param {Object} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when clone completes\n *\n * @example\n * await git.clone({\n * fs,\n * http,\n * dir: '/tutorial',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: 'https://github.com/isomorphic-git/isomorphic-git',\n * singleBranch: true,\n * depth: 1\n * })\n * console.log('done')\n *\n */\nexport async function clone({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n url,\n corsProxy = undefined,\n ref = undefined,\n remote = 'origin',\n depth = undefined,\n since = undefined,\n exclude = [],\n relative = false,\n singleBranch = false,\n noCheckout = false,\n noTags = false,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n if (!noCheckout) {\n assertParameter('dir', dir)\n }\n assertParameter('url', url)\n\n return await _clone({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n url,\n corsProxy,\n ref,\n remote,\n depth,\n since,\n exclude,\n relative,\n singleBranch,\n noCheckout,\n noTags,\n headers,\n })\n } catch (err) {\n err.caller = 'git.clone'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Create a new commit\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.message - The commit message to use.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key.\n * @param {boolean} [args.dryRun = false] - If true, simulates making a commit so you can test whether it would succeed. Implies `noUpdateBranch`.\n * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.\n * @param {string} [args.ref] - The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)\n * @param {string[]} [args.parent] - The SHA-1 object ids of the commits to use as parents. If not specified, the commit pointed to by `ref` is used.\n * @param {string} [args.tree] - The SHA-1 object id of the tree to use. If not specified, a new tree object is created from the current git index.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly created commit.\n *\n * @example\n * let sha = await git.commit({\n * fs,\n * dir: '/tutorial',\n * author: {\n * name: 'Mr. Test',\n * email: 'mrtest@example.com',\n * },\n * message: 'Added the a.txt file'\n * })\n * console.log(sha)\n *\n */\nexport async function commit({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n message,\n author: _author,\n committer: _committer,\n signingKey,\n dryRun = false,\n noUpdateBranch = false,\n ref,\n parent,\n tree,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('message', message)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n message,\n author,\n committer,\n signingKey,\n dryRun,\n noUpdateBranch,\n ref,\n parent,\n tree,\n })\n } catch (err) {\n err.caller = 'git.commit'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get the name of the branch currently pointed to by .git/HEAD\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {boolean} [args.fullname = false] - Return the full path (e.g. \"refs/heads/main\") instead of the abbreviated form.\n * @param {boolean} [args.test = false] - If the current branch doesn't actually exist (such as right after git init) then return `undefined`.\n *\n * @returns {Promise} The name of the current branch or undefined if the HEAD is detached.\n *\n * @example\n * // Get the current branch name\n * let branch = await git.currentBranch({\n * fs,\n * dir: '/tutorial',\n * fullname: false\n * })\n * console.log(branch)\n *\n */\nexport async function currentBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n fullname = false,\n test = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n return await _currentBranch({\n fs: new FileSystem(fs),\n gitdir,\n fullname,\n test,\n })\n } catch (err) {\n err.caller = 'git.currentBranch'\n throw err\n }\n}\n","// @ts-check\nimport { _currentBranch } from '../commands/currentBranch'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref\n *\n * @returns {Promise}\n */\nexport async function _deleteBranch({ fs, gitdir, ref }) {\n ref = ref.startsWith('refs/heads/') ? ref : `refs/heads/${ref}`\n const exist = await GitRefManager.exists({ fs, gitdir, ref })\n if (!exist) {\n throw new NotFoundError(ref)\n }\n\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n const currentRef = await _currentBranch({ fs, gitdir, fullname: true })\n if (fullRef === currentRef) {\n // detach HEAD\n const value = await GitRefManager.resolve({ fs, gitdir, ref: fullRef })\n await GitRefManager.writeRef({ fs, gitdir, ref: 'HEAD', value })\n }\n\n // Delete a specified branch\n await GitRefManager.deleteRef({ fs, gitdir, ref: fullRef })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteBranch } from '../commands/deleteBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local branch\n *\n * > Note: This only deletes loose branches - it should be fixed in the future to delete packed branches as well.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The branch to delete\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteBranch({ fs, dir: '/tutorial', ref: 'local-branch' })\n * console.log('done')\n *\n */\nexport async function deleteBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n return await _deleteBranch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.deleteBranch'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local ref\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to delete\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteRef({ fs, dir: '/tutorial', ref: 'refs/tags/test-tag' })\n * console.log('done')\n *\n */\nexport async function deleteRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n await GitRefManager.deleteRef({ fs: new FileSystem(fs), gitdir, ref })\n } catch (err) {\n err.caller = 'git.deleteRef'\n throw err\n }\n}\n","// @ts-check\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.remote\n *\n * @returns {Promise}\n */\nexport async function _deleteRemote({ fs, gitdir, remote }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.deleteSection('remote', remote)\n await GitConfigManager.save({ fs, gitdir, config })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteRemote } from '../commands/deleteRemote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Removes the local config entry for a given remote\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.remote - The name of the remote to delete\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteRemote({ fs, dir: '/tutorial', remote: 'upstream' })\n * console.log('done')\n *\n */\nexport async function deleteRemote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('remote', remote)\n return await _deleteRemote({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n })\n } catch (err) {\n err.caller = 'git.deleteRemote'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * Delete a local tag ref\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref - The tag to delete\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteTag({ dir: '$input((/))', ref: '$input((test-tag))' })\n * console.log('done')\n *\n */\nexport async function _deleteTag({ fs, gitdir, ref }) {\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n await GitRefManager.deleteRef({ fs, gitdir, ref })\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _deleteTag } from '../commands/deleteTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Delete a local tag ref\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The tag to delete\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.deleteTag({ fs, dir: '/tutorial', ref: 'test-tag' })\n * console.log('done')\n *\n */\nexport async function deleteTag({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('ref', ref)\n return await _deleteTag({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.deleteTag'\n throw err\n }\n}\n","export async function expandOidLoose({ fs, gitdir, oid: short }) {\n const prefix = short.slice(0, 2)\n const objectsSuffixes = await fs.readdir(`${gitdir}/objects/${prefix}`)\n return objectsSuffixes\n .map(suffix => `${prefix}${suffix}`)\n .filter(_oid => _oid.startsWith(short))\n}\n","import { InternalError } from '../errors/InternalError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function expandOidPacked({\n fs,\n cache,\n gitdir,\n oid: short,\n getExternalRefDelta,\n}) {\n // Iterate through all the .pack files\n const results = []\n let list = await fs.readdir(join(gitdir, 'objects/pack'))\n list = list.filter(x => x.endsWith('.idx'))\n for (const filename of list) {\n const indexFile = `${gitdir}/objects/pack/${filename}`\n const p = await readPackIndex({\n fs,\n cache,\n filename: indexFile,\n getExternalRefDelta,\n })\n if (p.error) throw new InternalError(p.error)\n // Search through the list of oids in the packfile\n for (const oid of p.offsets.keys()) {\n if (oid.startsWith(short)) results.push(oid)\n }\n }\n return results\n}\n","import { AmbiguousError } from '../errors/AmbiguousError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { expandOidLoose } from '../storage/expandOidLoose.js'\nimport { expandOidPacked } from '../storage/expandOidPacked.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function _expandOid({ fs, cache, gitdir, oid: short }) {\n // Curry the current read method so that the packfile un-deltification\n // process can acquire external ref-deltas.\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n\n const results = await expandOidLoose({ fs, gitdir, oid: short })\n const packedOids = await expandOidPacked({\n fs,\n cache,\n gitdir,\n oid: short,\n getExternalRefDelta,\n })\n // Objects can exist in a pack file as well as loose, make sure we only get a list of unique oids.\n for (const packedOid of packedOids) {\n if (results.indexOf(packedOid) === -1) {\n results.push(packedOid)\n }\n }\n\n if (results.length === 1) {\n return results[0]\n }\n if (results.length > 1) {\n throw new AmbiguousError('oids', short, results)\n }\n throw new NotFoundError(`an object matching \"${short}\"`)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _expandOid } from '../storage/expandOid.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Expand and resolve a short oid into a full oid\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The shortened oid prefix to expand (like \"0414d2a\")\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with the full oid (like \"0414d2a286d7bbc7a4a326a61c1f9f888a8ab87f\")\n *\n * @example\n * let oid = await git.expandOid({ fs, dir: '/tutorial', oid: '0414d2a'})\n * console.log(oid)\n *\n */\nexport async function expandOid({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n return await _expandOid({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.expandOid'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Expand an abbreviated ref to its full name\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to expand (like \"v1.0.0\")\n *\n * @returns {Promise} Resolves successfully with a full ref name (\"refs/tags/v1.0.0\")\n *\n * @example\n * let fullRef = await git.expandRef({ fs, dir: '/tutorial', ref: 'main'})\n * console.log(fullRef)\n *\n */\nexport async function expandRef({ fs, dir, gitdir = join(dir, '.git'), ref }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n return await GitRefManager.expand({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.expandRef'\n throw err\n }\n}\n","// @ts-check\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string[]} args.oids\n *\n */\nexport async function _findMergeBase({ fs, cache, gitdir, oids }) {\n // Note: right now, the tests are geared so that the output should match that of\n // `git merge-base --all --octopus`\n // because without the --octopus flag, git's output seems to depend on the ORDER of the oids,\n // and computing virtual merge bases is just too much for me to fathom right now.\n\n // If we start N independent walkers, one at each of the given `oids`, and walk backwards\n // through ancestors, eventually we'll discover a commit where each one of these N walkers\n // has passed through. So we just need to keep track of which walkers have visited each commit\n // until we find a commit that N distinct walkers has visited.\n const visits = {}\n const passes = oids.length\n let heads = oids.map((oid, index) => ({ index, oid }))\n while (heads.length) {\n // Count how many times we've passed each commit\n const result = new Set()\n for (const { oid, index } of heads) {\n if (!visits[oid]) visits[oid] = new Set()\n visits[oid].add(index)\n if (visits[oid].size === passes) {\n result.add(oid)\n }\n }\n if (result.size > 0) {\n return [...result]\n }\n // We haven't found a common ancestor yet\n const newheads = new Map()\n for (const { oid, index } of heads) {\n try {\n const { object } = await readObject({ fs, cache, gitdir, oid })\n const commit = GitCommit.from(object)\n const { parent } = commit.parseHeaders()\n for (const oid of parent) {\n if (!visits[oid] || !visits[oid].has(index)) {\n newheads.set(oid + ':' + index, { oid, index })\n }\n }\n } catch (err) {\n // do nothing\n }\n }\n heads = Array.from(newheads.values())\n }\n return []\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _commit } from '../commands/commit'\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { FastForwardError } from '../errors/FastForwardError.js'\nimport { MergeConflictError } from '../errors/MergeConflictError.js'\nimport { MergeNotSupportedError } from '../errors/MergeNotSupportedError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { mergeTree } from '../utils/mergeTree.js'\n\n// import diff3 from 'node-diff3'\n/**\n *\n * @typedef {Object} MergeResult - Returns an object with a schema like this:\n * @property {string} [oid] - The SHA-1 object id that is now at the head of the branch. Absent only if `dryRun` was specified and `mergeCommit` is true.\n * @property {boolean} [alreadyMerged] - True if the branch was already merged so no changes were made\n * @property {boolean} [fastForward] - True if it was a fast-forward merge\n * @property {boolean} [mergeCommit] - True if merge resulted in a merge commit\n * @property {string} [tree] - The SHA-1 object id of the tree resulting from a merge commit\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ours]\n * @param {string} args.theirs\n * @param {boolean} args.fastForward\n * @param {boolean} args.fastForwardOnly\n * @param {boolean} args.dryRun\n * @param {boolean} args.noUpdateBranch\n * @param {boolean} args.abortOnConflict\n * @param {string} [args.message]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {MergeDriverCallback} [args.mergeDriver]\n *\n * @returns {Promise} Resolves to a description of the merge operation\n *\n */\nexport async function _merge({\n fs,\n cache,\n dir,\n gitdir,\n ours,\n theirs,\n fastForward = true,\n fastForwardOnly = false,\n dryRun = false,\n noUpdateBranch = false,\n abortOnConflict = true,\n message,\n author,\n committer,\n signingKey,\n onSign,\n mergeDriver,\n}) {\n if (ours === undefined) {\n ours = await _currentBranch({ fs, gitdir, fullname: true })\n }\n ours = await GitRefManager.expand({\n fs,\n gitdir,\n ref: ours,\n })\n theirs = await GitRefManager.expand({\n fs,\n gitdir,\n ref: theirs,\n })\n const ourOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: ours,\n })\n const theirOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: theirs,\n })\n // find most recent common ancestor of ref a and ref b\n const baseOids = await _findMergeBase({\n fs,\n cache,\n gitdir,\n oids: [ourOid, theirOid],\n })\n if (baseOids.length !== 1) {\n // TODO: Recursive Merge strategy\n throw new MergeNotSupportedError()\n }\n const baseOid = baseOids[0]\n // handle fast-forward case\n if (baseOid === theirOid) {\n return {\n oid: ourOid,\n alreadyMerged: true,\n }\n }\n if (fastForward && baseOid === ourOid) {\n if (!dryRun && !noUpdateBranch) {\n await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid })\n }\n return {\n oid: theirOid,\n fastForward: true,\n }\n } else {\n // not a simple fast-forward\n if (fastForwardOnly) {\n throw new FastForwardError()\n }\n // try a fancier merge\n const tree = await GitIndexManager.acquire(\n { fs, gitdir, cache, allowUnmerged: false },\n async index => {\n return mergeTree({\n fs,\n cache,\n dir,\n gitdir,\n index,\n ourOid,\n theirOid,\n baseOid,\n ourName: abbreviateRef(ours),\n baseName: 'base',\n theirName: abbreviateRef(theirs),\n dryRun,\n abortOnConflict,\n mergeDriver,\n })\n }\n )\n\n // Defer throwing error until the index lock is relinquished and index is\n // written to filsesystem\n if (tree instanceof MergeConflictError) throw tree\n\n if (!message) {\n message = `Merge branch '${abbreviateRef(theirs)}' into ${abbreviateRef(\n ours\n )}`\n }\n const oid = await _commit({\n fs,\n cache,\n gitdir,\n message,\n ref: ours,\n tree,\n parent: [ourOid, theirOid],\n author,\n committer,\n signingKey,\n onSign,\n dryRun,\n noUpdateBranch,\n })\n return {\n oid,\n tree,\n mergeCommit: true,\n }\n }\n}\n","// @ts-check\n\nimport { _checkout } from '../commands/checkout.js'\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _fetch } from '../commands/fetch.js'\nimport { _merge } from '../commands/merge.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.ref\n * @param {string} [args.url]\n * @param {string} [args.remote]\n * @param {string} [args.remoteRef]\n * @param {boolean} [args.prune]\n * @param {boolean} [args.pruneTags]\n * @param {string} [args.corsProxy]\n * @param {boolean} args.singleBranch\n * @param {boolean} args.fastForward\n * @param {boolean} args.fastForwardOnly\n * @param {Object} [args.headers]\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise} Resolves successfully when pull operation completes\n *\n */\nexport async function _pull({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n prune,\n pruneTags,\n fastForward,\n fastForwardOnly,\n corsProxy,\n singleBranch,\n headers,\n author,\n committer,\n signingKey,\n}) {\n try {\n // If ref is undefined, use 'HEAD'\n if (!ref) {\n const head = await _currentBranch({ fs, gitdir })\n // TODO: use a better error.\n if (!head) {\n throw new MissingParameterError('ref')\n }\n ref = head\n }\n\n const { fetchHead, fetchHeadDescription } = await _fetch({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n corsProxy,\n ref,\n url,\n remote,\n remoteRef,\n singleBranch,\n headers,\n prune,\n pruneTags,\n })\n // Merge the remote tracking branch into the local one.\n await _merge({\n fs,\n cache,\n gitdir,\n ours: ref,\n theirs: fetchHead,\n fastForward,\n fastForwardOnly,\n message: `Merge ${fetchHeadDescription}`,\n author,\n committer,\n signingKey,\n dryRun: false,\n noUpdateBranch: false,\n })\n await _checkout({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n ref,\n remote,\n noCheckout: false,\n })\n } catch (err) {\n err.caller = 'git.pull'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _pull } from '../commands/pull.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Like `pull`, but hard-coded with `fastForward: true` so there is no need for an `author` parameter.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to merge into. By default this is the currently checked out branch.\n * @param {string} [args.url] - (Added in 1.1.0) The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - (Added in 1.1.0) If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when pull operation completes\n *\n * @example\n * await git.fastForward({\n * fs,\n * http,\n * dir: '/tutorial',\n * ref: 'main',\n * singleBranch: true\n * })\n * console.log('done')\n *\n */\nexport async function fastForward({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n url,\n remote,\n remoteRef,\n corsProxy,\n singleBranch,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n const thisWillNotBeUsed = {\n name: '',\n email: '',\n timestamp: Date.now(),\n timezoneOffset: 0,\n }\n\n return await _pull({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n fastForwardOnly: true,\n corsProxy,\n singleBranch,\n headers,\n author: thisWillNotBeUsed,\n committer: thisWillNotBeUsed,\n })\n } catch (err) {\n err.caller = 'git.fastForward'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _fetch } from '../commands/fetch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {object} FetchResult - The object returned has the following schema:\n * @property {string | null} defaultBranch - The branch that is cloned if no branch is specified\n * @property {string | null} fetchHead - The SHA-1 object id of the fetched head commit\n * @property {string | null} fetchHeadDescription - a textual description of the branch that was fetched\n * @property {Object} [headers] - The HTTP response headers returned by the git server\n * @property {string[]} [pruned] - A list of branches that were pruned, if you provided the `prune` parameter\n *\n */\n\n/**\n * Fetch commits from a remote repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - If URL is not specified, determines which remote to use.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {string} [args.ref] - Which branch to fetch if `singleBranch` is true. By default this is the current branch or the remote's default branch.\n * @param {string} [args.remoteRef] - The name of the branch on the remote to fetch if `singleBranch` is true. By default this is the configured remote tracking branch.\n * @param {boolean} [args.tags = false] - Also fetch tags\n * @param {number} [args.depth] - Integer. Determines how much of the git repository's history to retrieve\n * @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.\n * @param {Date} [args.since] - Only fetch commits created after the given date. Mutually exclusive with `depth`.\n * @param {string[]} [args.exclude = []] - A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.\n * @param {boolean} [args.prune = false] - Delete local remote-tracking branches that are not present on the remote\n * @param {boolean} [args.pruneTags = false] - Prune local tags that don’t exist on the remote, and force-update those tags that differ\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when fetch completes\n * @see FetchResult\n *\n * @example\n * let result = await git.fetch({\n * fs,\n * http,\n * dir: '/tutorial',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: 'https://github.com/isomorphic-git/isomorphic-git',\n * ref: 'main',\n * depth: 1,\n * singleBranch: true,\n * tags: false\n * })\n * console.log(result)\n *\n */\nexport async function fetch({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n remote,\n remoteRef,\n url,\n corsProxy,\n depth = null,\n since = null,\n exclude = [],\n relative = false,\n tags = false,\n singleBranch = false,\n headers = {},\n prune = false,\n pruneTags = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n return await _fetch({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remote,\n remoteRef,\n url,\n corsProxy,\n depth,\n since,\n exclude,\n relative,\n tags,\n singleBranch,\n headers,\n prune,\n pruneTags,\n })\n } catch (err) {\n err.caller = 'git.fetch'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Find the merge base for a set of commits\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids - Which commits\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n */\nexport async function findMergeBase({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oids', oids)\n\n return await _findMergeBase({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oids,\n })\n } catch (err) {\n err.caller = 'git.findMergeBase'\n throw err\n }\n}\n","// @ts-check\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { dirname } from '../utils/dirname.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Find the root git directory\n *\n * Starting at `filepath`, walks upward until it finds a directory that contains a subdirectory called '.git'.\n *\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.filepath\n *\n * @returns {Promise} Resolves successfully with a root git directory path\n */\nexport async function _findRoot({ fs, filepath }) {\n if (await fs.exists(join(filepath, '.git'))) {\n return filepath\n } else {\n const parent = dirname(filepath)\n if (parent === filepath) {\n throw new NotFoundError(`git root for ${filepath}`)\n }\n return _findRoot({ fs, filepath: parent })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _findRoot } from '../commands/findRoot.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n * Find the root git directory\n *\n * Starting at `filepath`, walks upward until it finds a directory that contains a subdirectory called '.git'.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.filepath - The file directory to start searching in.\n *\n * @returns {Promise} Resolves successfully with a root git directory path\n * @throws {NotFoundError}\n *\n * @example\n * let gitroot = await git.findRoot({\n * fs,\n * filepath: '/tutorial/src/utils'\n * })\n * console.log(gitroot)\n *\n */\nexport async function findRoot({ fs, filepath }) {\n try {\n assertParameter('fs', fs)\n assertParameter('filepath', filepath)\n\n return await _findRoot({ fs: new FileSystem(fs), filepath })\n } catch (err) {\n err.caller = 'git.findRoot'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _getConfig } from '../commands/getConfig.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read an entry from the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n *\n * @returns {Promise} Resolves with the config value\n *\n * @example\n * // Read config value\n * let value = await git.getConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'remote.origin.url'\n * })\n * console.log(value)\n *\n */\nexport async function getConfig({ fs, dir, gitdir = join(dir, '.git'), path }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n\n return await _getConfig({\n fs: new FileSystem(fs),\n gitdir,\n path,\n })\n } catch (err) {\n err.caller = 'git.getConfig'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {Object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.path\n *\n * @returns {Promise>} Resolves with an array of the config value\n *\n */\nexport async function _getConfigAll({ fs, gitdir, path }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n return config.getall(path)\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _getConfigAll } from '../commands/getConfigAll.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read a multi-valued entry from the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n *\n * @returns {Promise>} Resolves with the config value\n *\n */\nexport async function getConfigAll({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n path,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n\n return await _getConfigAll({\n fs: new FileSystem(fs),\n gitdir,\n path,\n })\n } catch (err) {\n err.caller = 'git.getConfigAll'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { assertParameter } from '../utils/assertParameter.js'\n\n/**\n *\n * @typedef {Object} GetRemoteInfoResult - The object returned has the following schema:\n * @property {string[]} capabilities - The list of capabilities returned by the server (part of the Git protocol)\n * @property {Object} [refs]\n * @property {string} [HEAD] - The default branch of the remote\n * @property {Object} [refs.heads] - The branches on the remote\n * @property {Object} [refs.pull] - The special branches representing pull requests (non-standard)\n * @property {Object} [refs.tags] - The tags on the remote\n *\n */\n\n/**\n * List a remote servers branches, tags, and capabilities.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just communicates to a remote git server, using the first step of the `git-upload-pack` handshake, but stopping short of fetching the packfile.\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n *\n * @returns {Promise} Resolves successfully with an object listing the branches, tags, and capabilities of the remote.\n * @see GetRemoteInfoResult\n *\n * @example\n * let info = await git.getRemoteInfo({\n * http,\n * url:\n * \"https://cors.isomorphic-git.org/github.com/isomorphic-git/isomorphic-git.git\"\n * });\n * console.log(info);\n *\n */\nexport async function getRemoteInfo({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n\n // Note: remote.capabilities, remote.refs, and remote.symrefs are Set and Map objects,\n // but one of the objectives of the public API is to always return JSON-compatible objects\n // so we must JSONify them.\n const result = {\n capabilities: [...remote.capabilities],\n }\n // Convert the flat list into an object tree, because I figure 99% of the time\n // that will be easier to use.\n for (const [ref, oid] of remote.refs) {\n const parts = ref.split('/')\n const last = parts.pop()\n let o = result\n for (const part of parts) {\n o[part] = o[part] || {}\n o = o[part]\n }\n o[last] = oid\n }\n // Merge symrefs on top of refs to more closely match actual git repo layouts\n for (const [symref, ref] of remote.symrefs) {\n const parts = symref.split('/')\n const last = parts.pop()\n let o = result\n for (const part of parts) {\n o[part] = o[part] || {}\n o = o[part]\n }\n o[last] = ref\n }\n return result\n } catch (err) {\n err.caller = 'git.getRemoteInfo'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\n/**\n * @param {any} remote\n * @param {string} prefix\n * @param {boolean} symrefs\n * @param {boolean} peelTags\n * @returns {ServerRef[]}\n */\nexport function formatInfoRefs(remote, prefix, symrefs, peelTags) {\n const refs = []\n for (const [key, value] of remote.refs) {\n if (prefix && !key.startsWith(prefix)) continue\n\n if (key.endsWith('^{}')) {\n if (peelTags) {\n const _key = key.replace('^{}', '')\n // Peeled tags are almost always listed immediately after the original tag\n const last = refs[refs.length - 1]\n const r = last.ref === _key ? last : refs.find(x => x.ref === _key)\n if (r === undefined) {\n throw new Error('I did not expect this to happen')\n }\n r.peeled = value\n }\n continue\n }\n /** @type ServerRef */\n const ref = { ref: key, oid: value }\n if (symrefs) {\n if (remote.symrefs.has(key)) {\n ref.target = remote.symrefs.get(key)\n }\n }\n refs.push(ref)\n }\n return refs\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { formatInfoRefs } from '../utils/formatInfoRefs.js'\n\n/**\n * @typedef {Object} GetRemoteInfo2Result - This object has the following schema:\n * @property {1 | 2} protocolVersion - Git protocol version the server supports\n * @property {Object} capabilities - An object of capabilities represented as keys and values\n * @property {ServerRef[]} [refs] - Server refs (they get returned by protocol version 1 whether you want them or not)\n */\n\n/**\n * List a remote server's capabilities.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just communicates to a remote git server, determining what protocol version, commands, and features it supports.\n *\n * > The successor to [`getRemoteInfo`](./getRemoteInfo.md), this command supports Git Wire Protocol Version 2.\n * > Therefore its return type is more complicated as either:\n * >\n * > - v1 capabilities (and refs) or\n * > - v2 capabilities (and no refs)\n * >\n * > are returned.\n * > If you just care about refs, use [`listServerRefs`](./listServerRefs.md)\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {1 | 2} [args.protocolVersion = 2] - Which version of the Git Protocol to use.\n *\n * @returns {Promise} Resolves successfully with an object listing the capabilities of the remote.\n * @see GetRemoteInfo2Result\n * @see ServerRef\n *\n * @example\n * let info = await git.getRemoteInfo2({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\"\n * });\n * console.log(info);\n *\n */\nexport async function getRemoteInfo2({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n protocolVersion = 2,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion,\n })\n\n if (remote.protocolVersion === 2) {\n /** @type GetRemoteInfo2Result */\n return {\n protocolVersion: remote.protocolVersion,\n capabilities: remote.capabilities2,\n }\n }\n\n // Note: remote.capabilities, remote.refs, and remote.symrefs are Set and Map objects,\n // but one of the objectives of the public API is to always return JSON-compatible objects\n // so we must JSONify them.\n /** @type Object */\n const capabilities = {}\n for (const cap of remote.capabilities) {\n const [key, value] = cap.split('=')\n if (value) {\n capabilities[key] = value\n } else {\n capabilities[key] = true\n }\n }\n /** @type GetRemoteInfo2Result */\n return {\n protocolVersion: 1,\n capabilities,\n refs: formatInfoRefs(remote, undefined, true, true),\n }\n } catch (err) {\n err.caller = 'git.getRemoteInfo2'\n throw err\n }\n}\n","// @ts-check\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {ProgressCallback} [args.onProgress]\n * @param {string} args.dir\n * @param {string} args.gitdir\n * @param {string} args.filepath\n *\n * @returns {Promise<{oids: string[]}>}\n */\nexport async function _indexPack({\n fs,\n cache,\n onProgress,\n dir,\n gitdir,\n filepath,\n}) {\n try {\n filepath = join(dir, filepath)\n const pack = await fs.read(filepath)\n const getExternalRefDelta = oid => readObject({ fs, cache, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack,\n getExternalRefDelta,\n onProgress,\n })\n await fs.write(filepath.replace(/\\.pack$/, '.idx'), await idx.toBuffer())\n return {\n oids: [...idx.hashes],\n }\n } catch (err) {\n err.caller = 'git.indexPack'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _indexPack } from '../commands/indexPack.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Create the .idx file for a given .pack file\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the .pack file to index\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<{oids: string[]}>} Resolves with a list of the SHA-1 object ids contained in the packfile\n *\n * @example\n * let packfiles = await fs.promises.readdir('/tutorial/.git/objects/pack')\n * packfiles = packfiles.filter(name => name.endsWith('.pack'))\n * console.log('packfiles', packfiles)\n *\n * const { oids } = await git.indexPack({\n * fs,\n * dir: '/tutorial',\n * filepath: `.git/objects/pack/${packfiles[0]}`,\n * async onProgress (evt) {\n * console.log(`${evt.phase}: ${evt.loaded} / ${evt.total}`)\n * }\n * })\n * console.log(oids)\n *\n */\nexport async function indexPack({\n fs,\n onProgress,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', dir)\n assertParameter('filepath', filepath)\n\n return await _indexPack({\n fs: new FileSystem(fs),\n cache,\n onProgress,\n dir,\n gitdir,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.indexPack'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _init } from '../commands/init.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Initialize a new repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {boolean} [args.bare = false] - Initialize a bare repository\n * @param {string} [args.defaultBranch = 'master'] - The name of the default branch (might be changed to a required argument in 2.0.0)\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.init({ fs, dir: '/tutorial' })\n * console.log('done')\n *\n */\nexport async function init({\n fs,\n bare = false,\n dir,\n gitdir = bare ? dir : join(dir, '.git'),\n defaultBranch = 'master',\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n if (!bare) {\n assertParameter('dir', dir)\n }\n\n return await _init({\n fs: new FileSystem(fs),\n bare,\n dir,\n gitdir,\n defaultBranch,\n })\n } catch (err) {\n err.caller = 'git.init'\n throw err\n }\n}\n","// @ts-check\nimport { MaxDepthError } from '../errors/MaxDepthError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject } from '../storage/readObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} args.ancestor\n * @param {number} args.depth - Maximum depth to search before giving up. -1 means no maximum depth.\n *\n * @returns {Promise}\n */\nexport async function _isDescendent({\n fs,\n cache,\n gitdir,\n oid,\n ancestor,\n depth,\n}) {\n const shallows = await GitShallowManager.read({ fs, gitdir })\n if (!oid) {\n throw new MissingParameterError('oid')\n }\n if (!ancestor) {\n throw new MissingParameterError('ancestor')\n }\n // If you don't like this behavior, add your own check.\n // Edge cases are hard to define a perfect solution.\n if (oid === ancestor) return false\n // We do not use recursion here, because that would lead to depth-first traversal,\n // and we want to maintain a breadth-first traversal to avoid hitting shallow clone depth cutoffs.\n const queue = [oid]\n const visited = new Set()\n let searchdepth = 0\n while (queue.length) {\n if (searchdepth++ === depth) {\n throw new MaxDepthError(depth)\n }\n const oid = queue.shift()\n const { type, object } = await _readObject({\n fs,\n cache,\n gitdir,\n oid,\n })\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n const commit = GitCommit.from(object).parse()\n // Are any of the parents the sought-after ancestor?\n for (const parent of commit.parent) {\n if (parent === ancestor) return true\n }\n // If not, add them to heads (unless we know this is a shallow commit)\n if (!shallows.has(oid)) {\n for (const parent of commit.parent) {\n if (!visited.has(parent)) {\n queue.push(parent)\n visited.add(parent)\n }\n }\n }\n // Eventually, we'll travel entire tree to the roots where all the parents are empty arrays,\n // or hit the shallow depth and throw an error. Excluding the possibility of grafts, or\n // different branches cloned to different depths, you would hit this error at the same time\n // for all parents, so trying to continue is futile.\n }\n return false\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _isDescendent } from '../commands/isDescendent.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Check whether a git commit is descended from another\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The descendent commit\n * @param {string} args.ancestor - The (proposed) ancestor commit\n * @param {number} [args.depth = -1] - Maximum depth to search before giving up. -1 means no maximum depth.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves to true if `oid` is a descendent of `ancestor`\n *\n * @example\n * let oid = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * let ancestor = await git.resolveRef({ fs, dir: '/tutorial', ref: 'v0.20.0' })\n * console.log(oid, ancestor)\n * await git.isDescendent({ fs, dir: '/tutorial', oid, ancestor, depth: -1 })\n *\n */\nexport async function isDescendent({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n ancestor,\n depth = -1,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n assertParameter('ancestor', ancestor)\n\n return await _isDescendent({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n ancestor,\n depth,\n })\n } catch (err) {\n err.caller = 'git.isDescendent'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Test whether a filepath should be ignored (because of .gitignore or .git/exclude)\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The filepath to test\n *\n * @returns {Promise} Resolves to true if the file should be ignored\n *\n * @example\n * await git.isIgnored({ fs, dir: '/tutorial', filepath: 'docs/add.md' })\n *\n */\nexport async function isIgnored({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('dir', dir)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n return GitIgnoreManager.isIgnored({\n fs: new FileSystem(fs),\n dir,\n gitdir,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.isIgnored'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List branches\n *\n * By default it lists local branches. If a 'remote' is specified, it lists the remote's branches. When listing remote branches, the HEAD branch is not filtered out, so it may be included in the list of results.\n *\n * Note that specifying a remote does not actually contact the server and update the list of branches.\n * If you want an up-to-date list, first do a `fetch` to that remote.\n * (Which branch you fetch doesn't matter - the list of branches available on the remote is updated during the fetch handshake.)\n *\n * Also note, that a branch is a reference to a commit. If you initialize a new repository it has no commits, so the\n * `listBranches` function will return an empty list, until you create the first commit.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.remote] - Instead of the branches in `refs/heads`, list the branches in `refs/remotes/${remote}`.\n *\n * @returns {Promise>} Resolves successfully with an array of branch names\n *\n * @example\n * let branches = await git.listBranches({ fs, dir: '/tutorial' })\n * console.log(branches)\n * let remoteBranches = await git.listBranches({ fs, dir: '/tutorial', remote: 'origin' })\n * console.log(remoteBranches)\n *\n */\nexport async function listBranches({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n remote,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return GitRefManager.listBranches({\n fs: new FileSystem(fs),\n gitdir,\n remote,\n })\n } catch (err) {\n err.caller = 'git.listBranches'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { join } from '../utils/join'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ref]\n *\n * @returns {Promise>}\n */\nexport async function _listFiles({ fs, gitdir, ref, cache }) {\n if (ref) {\n const oid = await GitRefManager.resolve({ gitdir, fs, ref })\n const filenames = []\n await accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid,\n filenames,\n prefix: '',\n })\n return filenames\n } else {\n return GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n return index.entries.map(x => x.path)\n })\n }\n}\n\nasync function accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid,\n filenames,\n prefix,\n}) {\n const { tree } = await _readTree({ fs, cache, gitdir, oid })\n // TODO: Use `walk` to do this. Should be faster.\n for (const entry of tree) {\n if (entry.type === 'tree') {\n await accumulateFilesFromOid({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n filenames,\n prefix: join(prefix, entry.path),\n })\n } else {\n filenames.push(join(prefix, entry.path))\n }\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listFiles } from '../commands/listFiles'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\n\n/**\n * List all the files in the git index or a commit\n *\n * > Note: This function is efficient for listing the files in the staging area, but listing all the files in a commit requires recursively walking through the git object store.\n * > If you do not require a complete list of every file, better performance can be achieved by using [walk](./walk) and ignoring subdirectories you don't care about.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Return a list of all the files in the commit at `ref` instead of the files currently in the git index (aka staging area)\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise>} Resolves successfully with an array of filepaths\n *\n * @example\n * // All the files in the previous commit\n * let files = await git.listFiles({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log(files)\n * // All the files in the current staging area\n * files = await git.listFiles({ fs, dir: '/tutorial' })\n * console.log(files)\n *\n */\nexport async function listFiles({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return await _listFiles({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.listFiles'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * List all the object notes\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.ref\n *\n * @returns {Promise>}\n */\n\nexport async function _listNotes({ fs, cache, gitdir, ref }) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (err instanceof NotFoundError) {\n return []\n }\n }\n\n // Create the current note tree\n const result = await _readTree({\n fs,\n cache,\n gitdir,\n oid: parent,\n })\n\n // Format the tree entries\n const notes = result.tree.map(entry => ({\n target: entry.path,\n note: entry.oid,\n }))\n return notes\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listNotes } from '../commands/listNotes.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join'\n\n/**\n * List all the object notes\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise>} Resolves successfully with an array of entries containing SHA-1 object ids of the note and the object the note targets\n */\n\nexport async function listNotes({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n return await _listNotes({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n })\n } catch (err) {\n err.caller = 'git.listNotes'\n throw err\n }\n}\n","// @ts-check\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n *\n * @returns {Promise>}\n */\nexport async function _listRemotes({ fs, gitdir }) {\n const config = await GitConfigManager.get({ fs, gitdir })\n const remoteNames = await config.getSubsections('remote')\n const remotes = Promise.all(\n remoteNames.map(async remote => {\n const url = await config.get(`remote.${remote}.url`)\n return { remote, url }\n })\n )\n return remotes\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _listRemotes } from '../commands/listRemotes.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List remotes\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n *\n * @returns {Promise>} Resolves successfully with an array of `{remote, url}` objects\n *\n * @example\n * let remotes = await git.listRemotes({ fs, dir: '/tutorial' })\n * console.log(remotes)\n *\n */\nexport async function listRemotes({ fs, dir, gitdir = join(dir, '.git') }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n\n return await _listRemotes({\n fs: new FileSystem(fs),\n gitdir,\n })\n } catch (err) {\n err.caller = 'git.listRemotes'\n throw err\n }\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\n\n/**\n * @typedef {Object} ServerRef - This object has the following schema:\n * @property {string} ref - The name of the ref\n * @property {string} oid - The SHA-1 object id the ref points to\n * @property {string} [target] - The target ref pointed to by a symbolic ref\n * @property {string} [peeled] - If the oid is the SHA-1 object id of an annotated tag, this is the SHA-1 object id that the annotated tag points to\n */\n\nexport async function parseListRefsResponse(stream) {\n const read = GitPktLine.streamReader(stream)\n\n // TODO: when we re-write everything to minimize memory usage,\n // we could make this a generator\n const refs = []\n\n let line\n while (true) {\n line = await read()\n if (line === true) break\n if (line === null) continue\n line = line.toString('utf8').replace(/\\n$/, '')\n const [oid, ref, ...attrs] = line.split(' ')\n const r = { ref, oid }\n for (const attr of attrs) {\n const [name, value] = attr.split(':')\n if (name === 'symref-target') {\n r.target = value\n } else if (name === 'peeled') {\n r.peeled = value\n }\n }\n refs.push(r)\n }\n\n return refs\n}\n","import { GitPktLine } from '../models/GitPktLine.js'\nimport { pkg } from '../utils/pkg.js'\n\n/**\n * @param {object} args\n * @param {string} [args.prefix] - Only list refs that start with this prefix\n * @param {boolean} [args.symrefs = false] - Include symbolic ref targets\n * @param {boolean} [args.peelTags = false] - Include peeled tags values\n * @returns {Uint8Array[]}\n */\nexport async function writeListRefsRequest({ prefix, symrefs, peelTags }) {\n const packstream = []\n // command\n packstream.push(GitPktLine.encode('command=ls-refs\\n'))\n // capability-list\n packstream.push(GitPktLine.encode(`agent=${pkg.agent}\\n`))\n // [command-args]\n if (peelTags || symrefs || prefix) {\n packstream.push(GitPktLine.delim())\n }\n if (peelTags) packstream.push(GitPktLine.encode('peel'))\n if (symrefs) packstream.push(GitPktLine.encode('symrefs'))\n if (prefix) packstream.push(GitPktLine.encode(`ref-prefix ${prefix}`))\n packstream.push(GitPktLine.flush())\n return packstream\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitRemoteHTTP } from '../managers/GitRemoteHTTP.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { formatInfoRefs } from '../utils/formatInfoRefs.js'\nimport { parseListRefsResponse } from '../wire/parseListRefsResponse.js'\nimport { writeListRefsRequest } from '../wire/writeListRefsRequest.js'\n\n/**\n * Fetch a list of refs (branches, tags, etc) from a server.\n *\n * This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.\n * It just requires an `http` argument.\n *\n * ### About `protocolVersion`\n *\n * There's a rather fun trade-off between Git Protocol Version 1 and Git Protocol Version 2.\n * Version 2 actually requires 2 HTTP requests instead of 1, making it similar to fetch or push in that regard.\n * However, version 2 supports server-side filtering by prefix, whereas that filtering is done client-side in version 1.\n * Which protocol is most efficient therefore depends on the number of refs on the remote, the latency of the server, and speed of the network connection.\n * For an small repos (or fast Internet connections), the requirement to make two trips to the server makes protocol 2 slower.\n * But for large repos (or slow Internet connections), the decreased payload size of the second request makes up for the additional request.\n *\n * Hard numbers vary by situation, but here's some numbers from my machine:\n *\n * Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://github.com/isomorphic-git/isomorphic-git\n * - Protocol Version 1 took ~300ms and transferred 84 KB.\n * - Protocol Version 2 took ~500ms and transferred 4.1 KB.\n *\n * Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://gitlab.com/gitlab-org/gitlab\n * - Protocol Version 1 took ~4900ms and transferred 9.41 MB.\n * - Protocol Version 2 took ~1280ms and transferred 433 KB.\n *\n * Finally, there is a fun quirk regarding the `symrefs` parameter.\n * Protocol Version 1 will generally only return the `HEAD` symref and not others.\n * Historically, this meant that servers don't use symbolic refs except for `HEAD`, which is used to point at the \"default branch\".\n * However Protocol Version 2 can return *all* the symbolic refs on the server.\n * So if you are running your own git server, you could take advantage of that I guess.\n *\n * #### TL;DR\n * If you are _not_ taking advantage of `prefix` I would recommend `protocolVersion: 1`.\n * Otherwise, I recommend to use the default which is `protocolVersion: 2`.\n *\n * @param {object} args\n * @param {HttpClient} args.http - an HTTP client\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {1 | 2} [args.protocolVersion = 2] - Which version of the Git Protocol to use.\n * @param {string} [args.prefix] - Only list refs that start with this prefix\n * @param {boolean} [args.symrefs = false] - Include symbolic ref targets\n * @param {boolean} [args.peelTags = false] - Include annotated tag peeled targets\n *\n * @returns {Promise} Resolves successfully with an array of ServerRef objects\n * @see ServerRef\n *\n * @example\n * // List all the branches on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/heads/\",\n * });\n * console.log(refs);\n *\n * @example\n * // Get the default branch on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"HEAD\",\n * symrefs: true,\n * });\n * console.log(refs);\n *\n * @example\n * // List all the tags on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/tags/\",\n * peelTags: true,\n * });\n * console.log(refs);\n *\n * @example\n * // List all the pull requests on a repo\n * let refs = await git.listServerRefs({\n * http,\n * corsProxy: \"https://cors.isomorphic-git.org\",\n * url: \"https://github.com/isomorphic-git/isomorphic-git.git\",\n * prefix: \"refs/pull/\",\n * });\n * console.log(refs);\n *\n */\nexport async function listServerRefs({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n url,\n headers = {},\n forPush = false,\n protocolVersion = 2,\n prefix,\n symrefs,\n peelTags,\n}) {\n try {\n assertParameter('http', http)\n assertParameter('url', url)\n\n const remote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n headers,\n protocolVersion,\n })\n\n if (remote.protocolVersion === 1) {\n return formatInfoRefs(remote, prefix, symrefs, peelTags)\n }\n\n // Protocol Version 2\n const body = await writeListRefsRequest({ prefix, symrefs, peelTags })\n\n const res = await GitRemoteHTTP.connect({\n http,\n auth: remote.auth,\n headers,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n body,\n })\n\n return parseListRefsResponse(res.body)\n } catch (err) {\n err.caller = 'git.listServerRefs'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * List tags\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n *\n * @returns {Promise>} Resolves successfully with an array of tag names\n *\n * @example\n * let tags = await git.listTags({ fs, dir: '/tutorial' })\n * console.log(tags)\n *\n */\nexport async function listTags({ fs, dir, gitdir = join(dir, '.git') }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n return GitRefManager.listTags({ fs: new FileSystem(fs), gitdir })\n } catch (err) {\n err.caller = 'git.listTags'\n throw err\n }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function resolveCommit({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveCommit({ fs, cache, gitdir, oid })\n }\n if (type !== 'commit') {\n throw new ObjectTypeError(oid, type, 'commit')\n }\n return { commit: GitCommit.from(object), oid }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { resolveCommit } from '../utils/resolveCommit.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n *\n * @returns {Promise} Resolves successfully with a git commit object\n * @see ReadCommitResult\n * @see CommitObject\n *\n */\nexport async function _readCommit({ fs, cache, gitdir, oid }) {\n const { commit, oid: commitOid } = await resolveCommit({\n fs,\n cache,\n gitdir,\n oid,\n })\n const result = {\n oid: commitOid,\n commit: commit.parse(),\n payload: commit.withoutSignature(),\n }\n // @ts-ignore\n return result\n}\n","export function compareAge(a, b) {\n return a.committer.timestamp - b.committer.timestamp\n}\n","// @ts-check\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nimport { join } from './join.js'\nimport { resolveTree } from './resolveTree.js'\n\n// the empty file content object id\nconst EMPTY_OID = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'\n\nexport async function resolveFileIdInTree({ fs, cache, gitdir, oid, fileId }) {\n if (fileId === EMPTY_OID) return\n const _oid = oid\n let filepath\n const result = await resolveTree({ fs, cache, gitdir, oid })\n const tree = result.tree\n if (fileId === result.oid) {\n filepath = result.path\n } else {\n filepath = await _resolveFileId({\n fs,\n cache,\n gitdir,\n tree,\n fileId,\n oid: _oid,\n })\n if (Array.isArray(filepath)) {\n if (filepath.length === 0) filepath = undefined\n else if (filepath.length === 1) filepath = filepath[0]\n }\n }\n return filepath\n}\n\nasync function _resolveFileId({\n fs,\n cache,\n gitdir,\n tree,\n fileId,\n oid,\n filepaths = [],\n parentPath = '',\n}) {\n const walks = tree.entries().map(function(entry) {\n let result\n if (entry.oid === fileId) {\n result = join(parentPath, entry.path)\n filepaths.push(result)\n } else if (entry.type === 'tree') {\n result = readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n }).then(function({ object }) {\n return _resolveFileId({\n fs,\n cache,\n gitdir,\n tree: GitTree.from(object),\n fileId,\n oid,\n filepaths,\n parentPath: join(parentPath, entry.path),\n })\n })\n }\n return result\n })\n\n await Promise.all(walks)\n return filepaths\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readCommit } from '../commands/readCommit.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { compareAge } from '../utils/compareAge.js'\nimport { resolveFileIdInTree } from '../utils/resolveFileIdInTree.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n * Get commit descriptions from the git history\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string=} args.filepath optional get the commit for the filepath only\n * @param {string} args.ref\n * @param {number|void} args.depth\n * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false\n * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n * @param {boolean=} args.follow Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n *\n * @returns {Promise>} Resolves to an array of ReadCommitResult objects\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * let commits = await git.log({ dir: '$input((/))', depth: $input((5)), ref: '$input((master))' })\n * console.log(commits)\n *\n */\nexport async function _log({\n fs,\n cache,\n gitdir,\n filepath,\n ref,\n depth,\n since,\n force,\n follow,\n}) {\n const sinceTimestamp =\n typeof since === 'undefined'\n ? undefined\n : Math.floor(since.valueOf() / 1000)\n // TODO: In the future, we may want to have an API where we return a\n // async iterator that emits commits.\n const commits = []\n const shallowCommits = await GitShallowManager.read({ fs, gitdir })\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n const tips = [await _readCommit({ fs, cache, gitdir, oid })]\n let lastFileOid\n let lastCommit\n let isOk\n\n function endCommit(commit) {\n if (isOk && filepath) commits.push(commit)\n }\n\n while (tips.length > 0) {\n const commit = tips.pop()\n\n // Stop the log if we've hit the age limit\n if (\n sinceTimestamp !== undefined &&\n commit.commit.committer.timestamp <= sinceTimestamp\n ) {\n break\n }\n\n if (filepath) {\n let vFileOid\n try {\n vFileOid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid: commit.commit.tree,\n filepath,\n })\n if (lastCommit && lastFileOid !== vFileOid) {\n commits.push(lastCommit)\n }\n lastFileOid = vFileOid\n lastCommit = commit\n isOk = true\n } catch (e) {\n if (e instanceof NotFoundError) {\n let found = follow && lastFileOid\n if (found) {\n found = await resolveFileIdInTree({\n fs,\n cache,\n gitdir,\n oid: commit.commit.tree,\n fileId: lastFileOid,\n })\n if (found) {\n if (Array.isArray(found)) {\n if (lastCommit) {\n const lastFound = await resolveFileIdInTree({\n fs,\n cache,\n gitdir,\n oid: lastCommit.commit.tree,\n fileId: lastFileOid,\n })\n if (Array.isArray(lastFound)) {\n found = found.filter(p => lastFound.indexOf(p) === -1)\n if (found.length === 1) {\n found = found[0]\n filepath = found\n if (lastCommit) commits.push(lastCommit)\n } else {\n found = false\n if (lastCommit) commits.push(lastCommit)\n break\n }\n }\n }\n } else {\n filepath = found\n if (lastCommit) commits.push(lastCommit)\n }\n }\n }\n if (!found) {\n if (isOk && lastFileOid) {\n commits.push(lastCommit)\n if (!force) break\n }\n if (!force && !follow) throw e\n }\n lastCommit = commit\n isOk = false\n } else throw e\n }\n } else {\n commits.push(commit)\n }\n\n // Stop the loop if we have enough commits now.\n if (depth !== undefined && commits.length === depth) {\n endCommit(commit)\n break\n }\n\n // If this is not a shallow commit...\n if (!shallowCommits.has(commit.oid)) {\n // Add the parents of this commit to the queue\n // Note: for the case of a commit with no parents, it will concat an empty array, having no net effect.\n for (const oid of commit.commit.parent) {\n const commit = await _readCommit({ fs, cache, gitdir, oid })\n if (!tips.map(commit => commit.oid).includes(commit.oid)) {\n tips.push(commit)\n }\n }\n }\n\n // Stop the loop if there are no more commit parents\n if (tips.length === 0) {\n endCommit(commit)\n }\n\n // Process tips in order by age\n tips.sort((a, b) => compareAge(a.commit, b.commit))\n }\n return commits\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _log } from '../commands/log.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get commit descriptions from the git history\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string=} args.filepath optional get the commit for the filepath only\n * @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from\n * @param {number=} [args.depth] - Limit the number of commits returned. No limit by default.\n * @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.\n * @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false\n * @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise>} Resolves to an array of ReadCommitResult objects\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * let commits = await git.log({\n * fs,\n * dir: '/tutorial',\n * depth: 5,\n * ref: 'main'\n * })\n * console.log(commits)\n *\n */\nexport async function log({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n ref = 'HEAD',\n depth,\n since, // Date\n force,\n follow,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n return await _log({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n filepath,\n ref,\n depth,\n since,\n force,\n follow,\n })\n } catch (err) {\n err.caller = 'git.log'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _merge } from '../commands/merge.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n *\n * @typedef {Object} MergeResult - Returns an object with a schema like this:\n * @property {string} [oid] - The SHA-1 object id that is now at the head of the branch. Absent only if `dryRun` was specified and `mergeCommit` is true.\n * @property {boolean} [alreadyMerged] - True if the branch was already merged so no changes were made\n * @property {boolean} [fastForward] - True if it was a fast-forward merge\n * @property {boolean} [mergeCommit] - True if merge resulted in a merge commit\n * @property {string} [tree] - The SHA-1 object id of the tree resulting from a merge commit\n *\n */\n\n/**\n * Merge two branches\n *\n * Currently it will fail if multiple candidate merge bases are found. (It doesn't yet implement the recursive merge strategy.)\n *\n * Currently it does not support selecting alternative merge strategies.\n *\n * Currently it is not possible to abort an incomplete merge. To restore the worktree to a clean state, you will need to checkout an earlier commit.\n *\n * Currently it does not directly support the behavior of `git merge --continue`. To complete a merge after manual conflict resolution, you will need to add and commit the files manually, and specify the appropriate parent commits.\n *\n * ## Manually resolving merge conflicts\n * By default, if isomorphic-git encounters a merge conflict it cannot resolve using the builtin diff3 algorithm or provided merge driver, it will abort and throw a `MergeNotSupportedError`.\n * This leaves the index and working tree untouched.\n *\n * When `abortOnConflict` is set to `false`, and a merge conflict cannot be automatically resolved, a `MergeConflictError` is thrown and the results of the incomplete merge will be written to the working directory.\n * This includes conflict markers in files with unresolved merge conflicts.\n *\n * To complete the merge, edit the conflicting files as you see fit, and then add and commit the resolved merge.\n *\n * For a proper merge commit, be sure to specify the branches or commits you are merging in the `parent` argument to `git.commit`.\n * For example, say we are merging the branch `feature` into the branch `main` and there is a conflict we want to resolve manually.\n * The flow would look like this:\n *\n * ```\n * await git.merge({\n * fs,\n * dir,\n * ours: 'main',\n * theirs: 'feature',\n * abortOnConflict: false,\n * }).catch(e => {\n * if (e instanceof Errors.MergeConflictError) {\n * console.log(\n * 'Automatic merge failed for the following files: '\n * + `${e.data}. `\n * + 'Resolve these conflicts and then commit your changes.'\n * )\n * } else throw e\n * })\n *\n * // This is the where we manually edit the files that have been written to the working directory\n * // ...\n * // Files have been edited and we are ready to commit\n *\n * await git.add({\n * fs,\n * dir,\n * filepath: '.',\n * })\n *\n * await git.commit({\n * fs,\n * dir,\n * ref: 'main',\n * message: \"Merge branch 'feature' into main\",\n * parent: ['main', 'feature'], // Be sure to specify the parents when creating a merge commit\n * })\n * ```\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.\n * @param {string} args.theirs - The branch to be merged\n * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.\n * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.\n * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.\n * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.\n * @param {boolean} [args.abortOnConflict = true] - If true, merges with conflicts will not update the worktree or index.\n * @param {string} [args.message] - Overrides the default auto-generated merge commit message\n * @param {Object} [args.author] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {MergeDriverCallback} [args.mergeDriver] - a [merge driver](mergeDriver.md) implementation\n *\n * @returns {Promise} Resolves to a description of the merge operation\n * @see MergeResult\n *\n * @example\n * let m = await git.merge({\n * fs,\n * dir: '/tutorial',\n * ours: 'main',\n * theirs: 'remotes/origin/main'\n * })\n * console.log(m)\n *\n */\nexport async function merge({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ours,\n theirs,\n fastForward = true,\n fastForwardOnly = false,\n dryRun = false,\n noUpdateBranch = false,\n abortOnConflict = true,\n message,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n mergeDriver,\n}) {\n try {\n assertParameter('fs', _fs)\n if (signingKey) {\n assertParameter('onSign', onSign)\n }\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author && (!fastForwardOnly || !fastForward)) {\n throw new MissingNameError('author')\n }\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer && (!fastForwardOnly || !fastForward)) {\n throw new MissingNameError('committer')\n }\n\n return await _merge({\n fs,\n cache,\n dir,\n gitdir,\n ours,\n theirs,\n fastForward,\n fastForwardOnly,\n dryRun,\n noUpdateBranch,\n abortOnConflict,\n message,\n author,\n committer,\n signingKey,\n onSign,\n mergeDriver,\n })\n } catch (err) {\n err.caller = 'git.merge'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _packObjects } from '../commands/packObjects.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} PackObjectsResult The packObjects command returns an object with two properties:\n * @property {string} filename - The suggested filename for the packfile if you want to save it to disk somewhere. It includes the packfile SHA.\n * @property {Uint8Array} [packfile] - The packfile contents. Not present if `write` parameter was true, in which case the packfile was written straight to disk.\n */\n\n/**\n * Create a packfile from an array of SHA-1 object ids\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string[]} args.oids - An array of SHA-1 object ids to be included in the packfile\n * @param {boolean} [args.write = false] - Whether to save the packfile to disk or not\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when the packfile is ready with the filename and buffer\n * @see PackObjectsResult\n *\n * @example\n * // Create a packfile containing only an empty tree\n * let { packfile } = await git.packObjects({\n * fs,\n * dir: '/tutorial',\n * oids: ['4b825dc642cb6eb9a060e54bf8d69288fbee4904']\n * })\n * console.log(packfile)\n *\n */\nexport async function packObjects({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oids,\n write = false,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oids', oids)\n\n return await _packObjects({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oids,\n write,\n })\n } catch (err) {\n err.caller = 'git.packObjects'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _pull } from '../commands/pull.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Fetch and merge commits from a remote repository\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to merge into. By default this is the currently checked out branch.\n * @param {string} [args.url] - (Added in 1.1.0) The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - (Added in 1.1.0) If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.\n * @param {boolean} [args.prune = false] - Delete local remote-tracking branches that are not present on the remote\n * @param {boolean} [args.pruneTags = false] - Prune local tags that don’t exist on the remote, and force-update those tags that differ\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.\n * @param {boolean} [args.fastForward = true] - If false, only create merge commits.\n * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when pull operation completes\n *\n * @example\n * await git.pull({\n * fs,\n * http,\n * dir: '/tutorial',\n * ref: 'main',\n * singleBranch: true\n * })\n * console.log('done')\n *\n */\nexport async function pull({\n fs: _fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n url,\n remote,\n remoteRef,\n prune = false,\n pruneTags = false,\n fastForward = true,\n fastForwardOnly = false,\n corsProxy,\n singleBranch,\n headers = {},\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _pull({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir,\n ref,\n url,\n remote,\n remoteRef,\n fastForward,\n fastForwardOnly,\n corsProxy,\n singleBranch,\n headers,\n author,\n committer,\n signingKey,\n prune,\n pruneTags,\n })\n } catch (err) {\n err.caller = 'git.pull'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { _findMergeBase } from '../commands/findMergeBase.js'\nimport { _isDescendent } from '../commands/isDescendent.js'\nimport { listCommitsAndTags } from '../commands/listCommitsAndTags.js'\nimport { listObjects } from '../commands/listObjects.js'\nimport { _pack } from '../commands/pack.js'\nimport { GitPushError } from '../errors/GitPushError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { PushRejectedError } from '../errors/PushRejectedError.js'\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { GitSideBand } from '../models/GitSideBand.js'\nimport { filterCapabilities } from '../utils/filterCapabilities.js'\nimport { forAwait } from '../utils/forAwait.js'\nimport { pkg } from '../utils/pkg.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseReceivePackResponse } from '../wire/parseReceivePackResponse.js'\nimport { writeReceivePackRequest } from '../wire/writeReceivePackRequest.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {HttpClient} args.http\n * @param {ProgressCallback} [args.onProgress]\n * @param {MessageCallback} [args.onMessage]\n * @param {AuthCallback} [args.onAuth]\n * @param {AuthFailureCallback} [args.onAuthFailure]\n * @param {AuthSuccessCallback} [args.onAuthSuccess]\n * @param {string} args.gitdir\n * @param {string} [args.ref]\n * @param {string} [args.remoteRef]\n * @param {string} [args.remote]\n * @param {boolean} [args.force = false]\n * @param {boolean} [args.delete = false]\n * @param {string} [args.url]\n * @param {string} [args.corsProxy]\n * @param {Object} [args.headers]\n *\n * @returns {Promise}\n */\nexport async function _push({\n fs,\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref: _ref,\n remoteRef: _remoteRef,\n remote,\n url: _url,\n force = false,\n delete: _delete = false,\n corsProxy,\n headers = {},\n}) {\n const ref = _ref || (await _currentBranch({ fs, gitdir }))\n if (typeof ref === 'undefined') {\n throw new MissingParameterError('ref')\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n // Figure out what remote to use.\n remote =\n remote ||\n (await config.get(`branch.${ref}.pushRemote`)) ||\n (await config.get('remote.pushDefault')) ||\n (await config.get(`branch.${ref}.remote`)) ||\n 'origin'\n // Lookup the URL for the given remote.\n const url =\n _url ||\n (await config.get(`remote.${remote}.pushurl`)) ||\n (await config.get(`remote.${remote}.url`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remote OR url')\n }\n // Figure out what remote ref to use.\n const remoteRef = _remoteRef || (await config.get(`branch.${ref}.merge`))\n if (typeof url === 'undefined') {\n throw new MissingParameterError('remoteRef')\n }\n\n if (corsProxy === undefined) {\n corsProxy = await config.get('http.corsProxy')\n }\n\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n const oid = _delete\n ? '0000000000000000000000000000000000000000'\n : await GitRefManager.resolve({ fs, gitdir, ref: fullRef })\n\n /** @type typeof import(\"../managers/GitRemoteHTTP\").GitRemoteHTTP */\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const httpRemote = await GitRemoteHTTP.discover({\n http,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n corsProxy,\n service: 'git-receive-pack',\n url,\n headers,\n protocolVersion: 1,\n })\n const auth = httpRemote.auth // hack to get new credentials from CredentialManager API\n let fullRemoteRef\n if (!remoteRef) {\n fullRemoteRef = fullRef\n } else {\n try {\n fullRemoteRef = await GitRefManager.expandAgainstMap({\n ref: remoteRef,\n map: httpRemote.refs,\n })\n } catch (err) {\n if (err instanceof NotFoundError) {\n // The remote reference doesn't exist yet.\n // If it is fully specified, use that value. Otherwise, treat it as a branch.\n fullRemoteRef = remoteRef.startsWith('refs/')\n ? remoteRef\n : `refs/heads/${remoteRef}`\n } else {\n throw err\n }\n }\n }\n const oldoid =\n httpRemote.refs.get(fullRemoteRef) ||\n '0000000000000000000000000000000000000000'\n\n // Remotes can always accept thin-packs UNLESS they specify the 'no-thin' capability\n const thinPack = !httpRemote.capabilities.has('no-thin')\n\n let objects = new Set()\n if (!_delete) {\n const finish = [...httpRemote.refs.values()]\n let skipObjects = new Set()\n\n // If remote branch is present, look for a common merge base.\n if (oldoid !== '0000000000000000000000000000000000000000') {\n // trick to speed up common force push scenarios\n const mergebase = await _findMergeBase({\n fs,\n cache,\n gitdir,\n oids: [oid, oldoid],\n })\n for (const oid of mergebase) finish.push(oid)\n if (thinPack) {\n skipObjects = await listObjects({ fs, cache, gitdir, oids: mergebase })\n }\n }\n\n // If remote does not have the commit, figure out the objects to send\n if (!finish.includes(oid)) {\n const commits = await listCommitsAndTags({\n fs,\n cache,\n gitdir,\n start: [oid],\n finish,\n })\n objects = await listObjects({ fs, cache, gitdir, oids: commits })\n }\n\n if (thinPack) {\n // If there's a default branch for the remote lets skip those objects too.\n // Since this is an optional optimization, we just catch and continue if there is\n // an error (because we can't find a default branch, or can't find a commit, etc)\n try {\n // Sadly, the discovery phase with 'forPush' doesn't return symrefs, so we have to\n // rely on existing ones.\n const ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: `refs/remotes/${remote}/HEAD`,\n depth: 2,\n })\n const { oid } = await GitRefManager.resolveAgainstMap({\n ref: ref.replace(`refs/remotes/${remote}/`, ''),\n fullref: ref,\n map: httpRemote.refs,\n })\n const oids = [oid]\n for (const oid of await listObjects({ fs, cache, gitdir, oids })) {\n skipObjects.add(oid)\n }\n } catch (e) {}\n\n // Remove objects that we know the remote already has\n for (const oid of skipObjects) {\n objects.delete(oid)\n }\n }\n\n if (oid === oldoid) force = true\n if (!force) {\n // Is it a tag that already exists?\n if (\n fullRef.startsWith('refs/tags') &&\n oldoid !== '0000000000000000000000000000000000000000'\n ) {\n throw new PushRejectedError('tag-exists')\n }\n // Is it a non-fast-forward commit?\n if (\n oid !== '0000000000000000000000000000000000000000' &&\n oldoid !== '0000000000000000000000000000000000000000' &&\n !(await _isDescendent({\n fs,\n cache,\n gitdir,\n oid,\n ancestor: oldoid,\n depth: -1,\n }))\n ) {\n throw new PushRejectedError('not-fast-forward')\n }\n }\n }\n // We can only safely use capabilities that the server also understands.\n // For instance, AWS CodeCommit aborts a push if you include the `agent`!!!\n const capabilities = filterCapabilities(\n [...httpRemote.capabilities],\n ['report-status', 'side-band-64k', `agent=${pkg.agent}`]\n )\n const packstream1 = await writeReceivePackRequest({\n capabilities,\n triplets: [{ oldoid, oid, fullRef: fullRemoteRef }],\n })\n const packstream2 = _delete\n ? []\n : await _pack({\n fs,\n cache,\n gitdir,\n oids: [...objects],\n })\n const res = await GitRemoteHTTP.connect({\n http,\n onProgress,\n corsProxy,\n service: 'git-receive-pack',\n url,\n auth,\n headers,\n body: [...packstream1, ...packstream2],\n })\n const { packfile, progress } = await GitSideBand.demux(res.body)\n if (onMessage) {\n const lines = splitLines(progress)\n forAwait(lines, async line => {\n await onMessage(line)\n })\n }\n // Parse the response!\n const result = await parseReceivePackResponse(packfile)\n if (res.headers) {\n result.headers = res.headers\n }\n\n // Update the local copy of the remote ref\n if (remote && result.ok && result.refs[fullRemoteRef].ok) {\n // TODO: I think this should actually be using a refspec transform rather than assuming 'refs/remotes/{remote}'\n const ref = `refs/remotes/${remote}/${fullRemoteRef.replace(\n 'refs/heads',\n ''\n )}`\n if (_delete) {\n await GitRefManager.deleteRef({ fs, gitdir, ref })\n } else {\n await GitRefManager.writeRef({ fs, gitdir, ref, value: oid })\n }\n }\n if (result.ok && Object.values(result.refs).every(result => result.ok)) {\n return result\n } else {\n const prettyDetails = Object.entries(result.refs)\n .filter(([k, v]) => !v.ok)\n .map(([k, v]) => `\\n - ${k}: ${v.error}`)\n .join('')\n throw new GitPushError(prettyDetails, result)\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _push } from '../commands/push.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Push a branch or tag\n *\n * The push command returns an object that describes the result of the attempted push operation.\n * *Notes:* If there were no errors, then there will be no `errors` property. There can be a mix of `ok` messages and `errors` messages.\n *\n * | param | type [= default] | description |\n * | ------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | ok | Array\\ | The first item is \"unpack\" if the overall operation was successful. The remaining items are the names of refs that were updated successfully. |\n * | errors | Array\\ | If the overall operation threw and error, the first item will be \"unpack {Overall error message}\". The remaining items are individual refs that failed to be updated in the format \"{ref name} {error message}\". |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {HttpClient} args.http - an HTTP client\n * @param {ProgressCallback} [args.onProgress] - optional progress event callback\n * @param {MessageCallback} [args.onMessage] - optional message event callback\n * @param {AuthCallback} [args.onAuth] - optional auth fill callback\n * @param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback\n * @param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.\n * @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.\n * @param {string} [args.remote] - If URL is not specified, determines which remote to use.\n * @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.\n * @param {boolean} [args.force = false] - If true, behaves the same as `git push --force`\n * @param {boolean} [args.delete = false] - If true, delete the remote ref\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {Object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully when push completes with a detailed description of the operation from the server.\n * @see PushResult\n * @see RefUpdateStatus\n *\n * @example\n * let pushResult = await git.push({\n * fs,\n * http,\n * dir: '/tutorial',\n * remote: 'origin',\n * ref: 'main',\n * onAuth: () => ({ username: process.env.GITHUB_TOKEN }),\n * })\n * console.log(pushResult)\n *\n */\nexport async function push({\n fs,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n remoteRef,\n remote = 'origin',\n url,\n force = false,\n delete: _delete = false,\n corsProxy,\n headers = {},\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('http', http)\n assertParameter('gitdir', gitdir)\n\n return await _push({\n fs: new FileSystem(fs),\n cache,\n http,\n onProgress,\n onMessage,\n onAuth,\n onAuthSuccess,\n onAuthFailure,\n gitdir,\n ref,\n remoteRef,\n remote,\n url,\n force,\n delete: _delete,\n corsProxy,\n headers,\n })\n } catch (err) {\n err.caller = 'git.push'\n throw err\n }\n}\n","import { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\nexport async function resolveBlob({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({ fs, cache, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveBlob({ fs, cache, gitdir, oid })\n }\n if (type !== 'blob') {\n throw new ObjectTypeError(oid, type, 'blob')\n }\n return { oid, blob: new Uint8Array(object) }\n}\n","// @ts-check\nimport { resolveBlob } from '../utils/resolveBlob.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n *\n * @typedef {Object} ReadBlobResult - The object returned has the following schema:\n * @property {string} oid\n * @property {Uint8Array} blob\n *\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n * @param {string} [args.filepath]\n *\n * @returns {Promise} Resolves successfully with a blob object description\n * @see ReadBlobResult\n */\nexport async function _readBlob({\n fs,\n cache,\n gitdir,\n oid,\n filepath = undefined,\n}) {\n if (filepath !== undefined) {\n oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath })\n }\n const blob = await resolveBlob({\n fs,\n cache,\n gitdir,\n oid,\n })\n return blob\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readBlob } from '../commands/readBlob.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadBlobResult - The object returned has the following schema:\n * @property {string} oid\n * @property {Uint8Array} blob\n *\n */\n\n/**\n * Read a blob object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags, commits, and trees are peeled.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the blob object at that filepath.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with a blob object description\n * @see ReadBlobResult\n *\n * @example\n * // Get the contents of 'README.md' in the main branch.\n * let commitOid = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * console.log(commitOid)\n * let { blob } = await git.readBlob({\n * fs,\n * dir: '/tutorial',\n * oid: commitOid,\n * filepath: 'README.md'\n * })\n * console.log(Buffer.from(blob).toString('utf8'))\n *\n */\nexport async function readBlob({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readBlob({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.readBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readCommit } from '../commands/readCommit.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read a commit object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags are peeled.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with a git commit object\n * @see ReadCommitResult\n * @see CommitObject\n *\n * @example\n * // Read a commit object\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'main' })\n * console.log(sha)\n * let commit = await git.readCommit({ fs, dir: '/tutorial', oid: sha })\n * console.log(commit)\n *\n */\nexport async function readCommit({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readCommit({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readCommit'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\nimport { _readBlob } from './readBlob'\n\n/**\n * Read the contents of a note\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid\n *\n * @returns {Promise} Resolves successfully with note contents as a Buffer.\n */\n\nexport async function _readNote({\n fs,\n cache,\n gitdir,\n ref = 'refs/notes/commits',\n oid,\n}) {\n const parent = await GitRefManager.resolve({ gitdir, fs, ref })\n const { blob } = await _readBlob({\n fs,\n cache,\n gitdir,\n oid: parent,\n filepath: oid,\n })\n\n return blob\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readNote } from '../commands/readNote.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Read the contents of a note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to get the note for.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with note contents as a Buffer.\n */\n\nexport async function readNote({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('oid', oid)\n\n return await _readNote({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n ref,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readNote'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n *\n * @typedef {Object} DeflatedObject\n * @property {string} oid\n * @property {'deflated'} type\n * @property {'deflated'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} WrappedObject\n * @property {string} oid\n * @property {'wrapped'} type\n * @property {'wrapped'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} RawObject\n * @property {string} oid\n * @property {'blob'|'commit'|'tree'|'tag'} type\n * @property {'content'} format\n * @property {Uint8Array} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedBlobObject\n * @property {string} oid\n * @property {'blob'} type\n * @property {'parsed'} format\n * @property {string} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedCommitObject\n * @property {string} oid\n * @property {'commit'} type\n * @property {'parsed'} format\n * @property {CommitObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedTreeObject\n * @property {string} oid\n * @property {'tree'} type\n * @property {'parsed'} format\n * @property {TreeObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {Object} ParsedTagObject\n * @property {string} oid\n * @property {'tag'} type\n * @property {'parsed'} format\n * @property {TagObject} object\n * @property {string} [source]\n *\n */\n\n/**\n *\n * @typedef {ParsedBlobObject | ParsedCommitObject | ParsedTreeObject | ParsedTagObject} ParsedObject\n */\n\n/**\n *\n * @typedef {DeflatedObject | WrappedObject | RawObject | ParsedObject } ReadObjectResult\n */\n\n/**\n * Read a git object directly by its SHA-1 object id\n *\n * Regarding `ReadObjectResult`:\n *\n * - `oid` will be the same as the `oid` argument unless the `filepath` argument is provided, in which case it will be the oid of the tree or blob being returned.\n * - `type` of deflated objects is `'deflated'`, and `type` of wrapped objects is `'wrapped'`\n * - `format` is usually, but not always, the format you requested. Packfiles do not store each object individually compressed so if you end up reading the object from a packfile it will be returned in format 'content' even if you requested 'deflated' or 'wrapped'.\n * - `object` will be an actual Object if format is 'parsed' and the object is a commit, tree, or annotated tag. Blobs are still formatted as Buffers unless an encoding is provided in which case they'll be strings. If format is anything other than 'parsed', object will be a Buffer.\n * - `source` is the name of the packfile or loose object file where the object was found.\n *\n * The `format` parameter can have the following values:\n *\n * | param | description |\n * | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n * | 'deflated' | Return the raw deflate-compressed buffer for an object if possible. Useful for efficiently shuffling around loose objects when you don't care about the contents and can save time by not inflating them. |\n * | 'wrapped' | Return the inflated object buffer wrapped in the git object header if possible. This is the raw data used when calculating the SHA-1 object id of a git object. |\n * | 'content' | Return the object buffer without the git header. |\n * | 'parsed' | Returns a parsed representation of the object. |\n *\n * The result will be in one of the following schemas:\n *\n * ## `'deflated'` format\n *\n * {@link DeflatedObject typedef}\n *\n * ## `'wrapped'` format\n *\n * {@link WrappedObject typedef}\n *\n * ## `'content'` format\n *\n * {@link RawObject typedef}\n *\n * ## `'parsed'` format\n *\n * ### parsed `'blob'` type\n *\n * {@link ParsedBlobObject typedef}\n *\n * ### parsed `'commit'` type\n *\n * {@link ParsedCommitObject typedef}\n * {@link CommitObject typedef}\n *\n * ### parsed `'tree'` type\n *\n * {@link ParsedTreeObject typedef}\n * {@link TreeObject typedef}\n * {@link TreeEntry typedef}\n *\n * ### parsed `'tag'` type\n *\n * {@link ParsedTagObject typedef}\n * {@link TagObject typedef}\n *\n * @deprecated\n * > This command is overly complicated.\n * >\n * > If you know the type of object you are reading, use [`readBlob`](./readBlob.md), [`readCommit`](./readCommit.md), [`readTag`](./readTag.md), or [`readTree`](./readTree.md).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get\n * @param {'deflated' | 'wrapped' | 'content' | 'parsed'} [args.format = 'parsed'] - What format to return the object in. The choices are described in more detail below.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the object at that filepath. To return the root directory of a tree set filepath to `''`\n * @param {string} [args.encoding] - A convenience argument that only affects blobs. Instead of returning `object` as a buffer, it returns a string parsed using the given encoding.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with a git object description\n * @see ReadObjectResult\n *\n * @example\n * // Given a ransom SHA-1 object id, figure out what it is\n * let { type, object } = await git.readObject({\n * fs,\n * dir: '/tutorial',\n * oid: '0698a781a02264a6f37ba3ff41d78067eaf0f075'\n * })\n * switch (type) {\n * case 'commit': {\n * console.log(object)\n * break\n * }\n * case 'tree': {\n * console.log(object)\n * break\n * }\n * case 'blob': {\n * console.log(object)\n * break\n * }\n * case 'tag': {\n * console.log(object)\n * break\n * }\n * }\n *\n */\nexport async function readObject({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n format = 'parsed',\n filepath = undefined,\n encoding = undefined,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n const fs = new FileSystem(_fs)\n if (filepath !== undefined) {\n oid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid,\n filepath,\n })\n }\n // GitObjectManager does not know how to parse content, so we tweak that parameter before passing it.\n const _format = format === 'parsed' ? 'content' : format\n const result = await _readObject({\n fs,\n cache,\n gitdir,\n oid,\n format: _format,\n })\n result.oid = oid\n if (format === 'parsed') {\n result.format = 'parsed'\n switch (result.type) {\n case 'commit':\n result.object = GitCommit.from(result.object).parse()\n break\n case 'tree':\n result.object = GitTree.from(result.object).entries()\n break\n case 'blob':\n // Here we consider returning a raw Buffer as the 'content' format\n // and returning a string as the 'parsed' format\n if (encoding) {\n result.object = result.object.toString(encoding)\n } else {\n result.object = new Uint8Array(result.object)\n result.format = 'content'\n }\n break\n case 'tag':\n result.object = GitAnnotatedTag.from(result.object).parse()\n break\n default:\n throw new ObjectTypeError(\n result.oid,\n result.type,\n 'blob|commit|tag|tree'\n )\n }\n } else if (result.format === 'deflated' || result.format === 'wrapped') {\n result.type = result.format\n }\n return result\n } catch (err) {\n err.caller = 'git.readObject'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { ObjectTypeError } from '../errors/ObjectTypeError.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _readObject as readObject } from '../storage/readObject.js'\n\n/**\n *\n * @typedef {Object} ReadTagResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tag\n * @property {TagObject} tag - the parsed tag object\n * @property {string} payload - PGP signing payload\n */\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {any} args.cache\n * @param {string} args.gitdir\n * @param {string} args.oid\n *\n * @returns {Promise}\n */\nexport async function _readTag({ fs, cache, gitdir, oid }) {\n const { type, object } = await readObject({\n fs,\n cache,\n gitdir,\n oid,\n format: 'content',\n })\n if (type !== 'tag') {\n throw new ObjectTypeError(oid, type, 'tag')\n }\n const tag = GitAnnotatedTag.from(object)\n const result = {\n oid,\n tag: tag.parse(),\n payload: tag.payload(),\n }\n // @ts-ignore\n return result\n}\n","import '../typedefs.js'\n\nimport { _readTag } from '../commands/readTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadTagResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tag\n * @property {TagObject} tag - the parsed tag object\n * @property {string} payload - PGP signing payload\n */\n\n/**\n * Read an annotated tag object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with a git object description\n * @see ReadTagResult\n * @see TagObject\n *\n */\nexport async function readTag({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readTag({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n })\n } catch (err) {\n err.caller = 'git.readTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _readTree } from '../commands/readTree.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n *\n * @typedef {Object} ReadTreeResult - The object returned has the following schema:\n * @property {string} oid - SHA-1 object id of this tree\n * @property {TreeObject} tree - the parsed tree object\n */\n\n/**\n * Read a tree object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.oid - The SHA-1 object id to get. Annotated tags and commits are peeled.\n * @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the tree object at that filepath.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with a git tree object\n * @see ReadTreeResult\n * @see TreeObject\n * @see TreeEntry\n *\n */\nexport async function readTree({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n oid,\n filepath = undefined,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n return await _readTree({\n fs: new FileSystem(fs),\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (err) {\n err.caller = 'git.readTree'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Remove a file from the git index (aka staging area)\n *\n * Note that this does NOT delete the file in the working directory.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to remove from the index\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.remove({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function remove({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n await GitIndexManager.acquire(\n { fs: new FileSystem(_fs), gitdir, cache },\n async function(index) {\n index.delete({ filepath })\n }\n )\n } catch (err) {\n err.caller = 'git.remove'\n throw err\n }\n}\n","// @ts-check\nimport { _commit } from '../commands/commit.js'\nimport { _readTree } from '../commands/readTree.js'\nimport { _writeTree } from '../commands/writeTree.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {object} args.cache\n * @param {SignCallback} [args.onSign]\n * @param {string} [args.dir]\n * @param {string} [args.gitdir=join(dir,'.git')]\n * @param {string} [args.ref]\n * @param {string} args.oid\n * @param {Object} args.author\n * @param {string} args.author.name\n * @param {string} args.author.email\n * @param {number} args.author.timestamp\n * @param {number} args.author.timezoneOffset\n * @param {Object} args.committer\n * @param {string} args.committer.name\n * @param {string} args.committer.email\n * @param {number} args.committer.timestamp\n * @param {number} args.committer.timezoneOffset\n * @param {string} [args.signingKey]\n *\n * @returns {Promise}\n */\n\nexport async function _removeNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref = 'refs/notes/commits',\n oid,\n author,\n committer,\n signingKey,\n}) {\n // Get the current note commit\n let parent\n try {\n parent = await GitRefManager.resolve({ gitdir, fs, ref })\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n throw err\n }\n }\n\n // I'm using the \"empty tree\" magic number here for brevity\n const result = await _readTree({\n fs,\n gitdir,\n oid: parent || '4b825dc642cb6eb9a060e54bf8d69288fbee4904',\n })\n let tree = result.tree\n\n // Remove the note blob entry from the tree\n tree = tree.filter(entry => entry.path !== oid)\n\n // Create the new note tree\n const treeOid = await _writeTree({\n fs,\n gitdir,\n tree,\n })\n\n // Create the new note commit\n const commitOid = await _commit({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n tree: treeOid,\n parent: parent && [parent],\n message: `Note removed by 'isomorphic-git removeNote'\\n`,\n author,\n committer,\n signingKey,\n })\n\n return commitOid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _removeNote } from '../commands/removeNote.js'\nimport { MissingNameError } from '../errors/MissingNameError.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'\n\n/**\n * Remove an object note\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {SignCallback} [args.onSign] - a PGP signing implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref] - The notes ref to look under\n * @param {string} args.oid - The SHA-1 object id of the object to remove the note from.\n * @param {Object} [args.author] - The details about the author.\n * @param {string} [args.author.name] - Default is `user.name` config.\n * @param {string} [args.author.email] - Default is `user.email` config.\n * @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.\n * @param {string} [args.committer.name] - Default is `user.name` config.\n * @param {string} [args.committer.email] - Default is `user.email` config.\n * @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).\n * @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.\n * @param {string} [args.signingKey] - Sign the tag object using this private PGP key.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the commit object for the note removal.\n */\n\nexport async function removeNote({\n fs: _fs,\n onSign,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'refs/notes/commits',\n oid,\n author: _author,\n committer: _committer,\n signingKey,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('oid', oid)\n\n const fs = new FileSystem(_fs)\n\n const author = await normalizeAuthorObject({ fs, gitdir, author: _author })\n if (!author) throw new MissingNameError('author')\n\n const committer = await normalizeCommitterObject({\n fs,\n gitdir,\n author,\n committer: _committer,\n })\n if (!committer) throw new MissingNameError('committer')\n\n return await _removeNote({\n fs,\n cache,\n onSign,\n gitdir,\n ref,\n oid,\n author,\n committer,\n signingKey,\n })\n } catch (err) {\n err.caller = 'git.removeNote'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { _currentBranch } from '../commands/currentBranch.js'\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport '../typedefs.js'\n\n/**\n * Rename a branch\n *\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {string} args.ref - The name of the new branch\n * @param {string} args.oldref - The name of the old branch\n * @param {boolean} [args.checkout = false]\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n */\nexport async function _renameBranch({\n fs,\n gitdir,\n oldref,\n ref,\n checkout = false,\n}) {\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n if (oldref !== cleanGitRef.clean(oldref)) {\n throw new InvalidRefNameError(oldref, cleanGitRef.clean(oldref))\n }\n\n const fulloldref = `refs/heads/${oldref}`\n const fullnewref = `refs/heads/${ref}`\n\n const newexist = await GitRefManager.exists({ fs, gitdir, ref: fullnewref })\n\n if (newexist) {\n throw new AlreadyExistsError('branch', ref, false)\n }\n\n const value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: fulloldref,\n depth: 1,\n })\n\n await GitRefManager.writeRef({ fs, gitdir, ref: fullnewref, value })\n await GitRefManager.deleteRef({ fs, gitdir, ref: fulloldref })\n\n const fullCurrentBranchRef = await _currentBranch({\n fs,\n gitdir,\n fullname: true,\n })\n const isCurrentBranch = fullCurrentBranchRef === fulloldref\n\n if (checkout || isCurrentBranch) {\n // Update HEAD\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref: 'HEAD',\n value: fullnewref,\n })\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _renameBranch } from '../commands/renameBranch.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Rename a branch\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the branch\n * @param {string} args.oldref - What the name of the branch was\n * @param {boolean} [args.checkout = false] - Update `HEAD` to point at the newly created branch\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.renameBranch({ fs, dir: '/tutorial', ref: 'main', oldref: 'master' })\n * console.log('done')\n *\n */\nexport async function renameBranch({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n oldref,\n checkout = false,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('oldref', oldref)\n return await _renameBranch({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n oldref,\n checkout,\n })\n } catch (err) {\n err.caller = 'git.renameBranch'\n throw err\n }\n}\n","import { GitObject } from '../models/GitObject.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function hashObject({ gitdir, type, object }) {\n return shasum(GitObject.wrap({ type, object }))\n}\n","// @ts-check\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\nimport { resolveFilepath } from '../utils/resolveFilepath.js'\n\n/**\n * Reset a file in the git index (aka staging area)\n *\n * Note that this does NOT modify the file in the working directory.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to reset in the index\n * @param {string} [args.ref = 'HEAD'] - A ref to the commit to use\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.resetIndex({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log('done')\n *\n */\nexport async function resetIndex({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n ref,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n\n let oid\n let workdirOid\n\n try {\n // Resolve commit\n oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' })\n } catch (e) {\n if (ref) {\n // Only throw the error if a ref is explicitly provided\n throw e\n }\n }\n\n // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git\n // repository. If that happens, we can skip resolving the file path.\n if (oid) {\n try {\n // Resolve blob\n oid = await resolveFilepath({\n fs,\n cache,\n gitdir,\n oid,\n filepath,\n })\n } catch (e) {\n // This means we're resetting the file to a \"deleted\" state\n oid = null\n }\n }\n\n // For files that aren't in the workdir use zeros\n let stats = {\n ctime: new Date(0),\n mtime: new Date(0),\n dev: 0,\n ino: 0,\n mode: 0,\n uid: 0,\n gid: 0,\n size: 0,\n }\n // If the file exists in the workdir...\n const object = dir && (await fs.read(join(dir, filepath)))\n if (object) {\n // ... and has the same hash as the desired state...\n workdirOid = await hashObject({\n gitdir,\n type: 'blob',\n object,\n })\n if (oid === workdirOid) {\n // ... use the workdir Stats object\n stats = await fs.lstat(join(dir, filepath))\n }\n }\n await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {\n index.delete({ filepath })\n if (oid) {\n index.insert({ filepath, stats, oid })\n }\n })\n } catch (err) {\n err.caller = 'git.reset'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Get the value of a symbolic ref or resolve a ref to its SHA-1 object id\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The ref to resolve\n * @param {number} [args.depth = undefined] - How many symbolic references to follow before returning\n *\n * @returns {Promise} Resolves successfully with a SHA-1 object id or the value of a symbolic ref\n *\n * @example\n * let currentCommit = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log(currentCommit)\n * let currentBranch = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD', depth: 2 })\n * console.log(currentBranch)\n *\n */\nexport async function resolveRef({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n depth,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const oid = await GitRefManager.resolve({\n fs: new FileSystem(fs),\n gitdir,\n ref,\n depth,\n })\n return oid\n } catch (err) {\n err.caller = 'git.resolveRef'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write an entry to the git config files.\n *\n * *Caveats:*\n * - Currently only the local `$GIT_DIR/config` file can be read or written. However support for the global `~/.gitconfig` and system `$(prefix)/etc/gitconfig` will be added in the future.\n * - The current parser does not support the more exotic features of the git-config file format such as `[include]` and `[includeIf]`.\n *\n * @param {Object} args\n * @param {FsClient} args.fs - a file system implementation\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.path - The key of the git config entry\n * @param {string | boolean | number | void} args.value - A value to store at that path. (Use `undefined` as the value to delete a config entry.)\n * @param {boolean} [args.append = false] - If true, will append rather than replace when setting (use with multi-valued config options).\n *\n * @returns {Promise} Resolves successfully when operation completed\n *\n * @example\n * // Write config value\n * await git.setConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'user.name',\n * value: 'Mr. Test'\n * })\n *\n * // Print out config file\n * let file = await fs.promises.readFile('/tutorial/.git/config', 'utf8')\n * console.log(file)\n *\n * // Delete a config entry\n * await git.setConfig({\n * fs,\n * dir: '/tutorial',\n * path: 'user.name',\n * value: undefined\n * })\n *\n * // Print out config file\n * file = await fs.promises.readFile('/tutorial/.git/config', 'utf8')\n * console.log(file)\n */\nexport async function setConfig({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n path,\n value,\n append = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('path', path)\n // assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete\n\n const fs = new FileSystem(_fs)\n const config = await GitConfigManager.get({ fs, gitdir })\n if (append) {\n await config.append(path, value)\n } else {\n await config.set(path, value)\n }\n await GitConfigManager.save({ fs, gitdir, config })\n } catch (err) {\n err.caller = 'git.setConfig'\n throw err\n }\n}\n","// @ts-check\nimport { _readTree } from '../commands/readTree.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { ObjectTypeError } from '../errors/ObjectTypeError'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { _readObject } from '../storage/readObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Tell whether a file has been changed\n *\n * The possible resolve values are:\n *\n * | status | description |\n * | --------------------- | ------------------------------------------------------------------------------------- |\n * | `\"ignored\"` | file ignored by a .gitignore rule |\n * | `\"unmodified\"` | file unchanged from HEAD commit |\n * | `\"*modified\"` | file has modifications, not yet staged |\n * | `\"*deleted\"` | file has been removed, but the removal is not yet staged |\n * | `\"*added\"` | file is untracked, not yet staged |\n * | `\"absent\"` | file not present in HEAD commit, staging area, or working dir |\n * | `\"modified\"` | file has modifications, staged |\n * | `\"deleted\"` | file has been removed, staged |\n * | `\"added\"` | previously untracked file, staged |\n * | `\"*unmodified\"` | working dir and HEAD commit match, but index differs |\n * | `\"*absent\"` | file not present in working dir or HEAD commit, but present in the index |\n * | `\"*undeleted\"` | file was deleted from the index, but is still in the working dir |\n * | `\"*undeletemodified\"` | file was deleted from the index, but is present with modifications in the working dir |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - The path to the file to query\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status\n *\n * @example\n * let status = await git.status({ fs, dir: '/tutorial', filepath: 'README.md' })\n * console.log(status)\n *\n */\nexport async function status({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath,\n cache = {},\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n const ignored = await GitIgnoreManager.isIgnored({\n fs,\n gitdir,\n dir,\n filepath,\n })\n if (ignored) {\n return 'ignored'\n }\n const headTree = await getHeadTree({ fs, cache, gitdir })\n const treeOid = await getOidAtPath({\n fs,\n cache,\n gitdir,\n tree: headTree,\n path: filepath,\n })\n const indexEntry = await GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n for (const entry of index) {\n if (entry.path === filepath) return entry\n }\n return null\n }\n )\n const stats = await fs.lstat(join(dir, filepath))\n\n const H = treeOid !== null // head\n const I = indexEntry !== null // index\n const W = stats !== null // working dir\n\n const getWorkdirOid = async () => {\n if (I && !compareStats(indexEntry, stats)) {\n return indexEntry.oid\n } else {\n const object = await fs.read(join(dir, filepath))\n const workdirOid = await hashObject({\n gitdir,\n type: 'blob',\n object,\n })\n // If the oid in the index === working dir oid but stats differed update cache\n if (I && indexEntry.oid === workdirOid) {\n // and as long as our fs.stats aren't bad.\n // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers\n // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat\n if (stats.size !== -1) {\n // We don't await this so we can return faster for one-off cases.\n GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n index.insert({ filepath, stats, oid: workdirOid })\n })\n }\n }\n return workdirOid\n }\n }\n\n if (!H && !W && !I) return 'absent' // ---\n if (!H && !W && I) return '*absent' // -A-\n if (!H && W && !I) return '*added' // --A\n if (!H && W && I) {\n const workdirOid = await getWorkdirOid()\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'added' : '*added' // -AA : -AB\n }\n if (H && !W && !I) return 'deleted' // A--\n if (H && !W && I) {\n // @ts-ignore\n return treeOid === indexEntry.oid ? '*deleted' : '*deleted' // AA- : AB-\n }\n if (H && W && !I) {\n const workdirOid = await getWorkdirOid()\n return workdirOid === treeOid ? '*undeleted' : '*undeletemodified' // A-A : A-B\n }\n if (H && W && I) {\n const workdirOid = await getWorkdirOid()\n if (workdirOid === treeOid) {\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'unmodified' : '*unmodified' // AAA : ABA\n } else {\n // @ts-ignore\n return workdirOid === indexEntry.oid ? 'modified' : '*modified' // ABB : AAB\n }\n }\n /*\n ---\n -A-\n --A\n -AA\n -AB\n A--\n AA-\n AB-\n A-A\n A-B\n AAA\n ABA\n ABB\n AAB\n */\n } catch (err) {\n err.caller = 'git.status'\n throw err\n }\n}\n\nasync function getOidAtPath({ fs, cache, gitdir, tree, path }) {\n if (typeof path === 'string') path = path.split('/')\n const dirname = path.shift()\n for (const entry of tree) {\n if (entry.path === dirname) {\n if (path.length === 0) {\n return entry.oid\n }\n const { type, object } = await _readObject({\n fs,\n cache,\n gitdir,\n oid: entry.oid,\n })\n if (type === 'tree') {\n const tree = GitTree.from(object)\n return getOidAtPath({ fs, cache, gitdir, tree, path })\n }\n if (type === 'blob') {\n throw new ObjectTypeError(entry.oid, type, 'blob', path.join('/'))\n }\n }\n }\n return null\n}\n\nasync function getHeadTree({ fs, cache, gitdir }) {\n // Get the tree from the HEAD commit.\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' })\n } catch (e) {\n // Handle fresh branches with no commits\n if (e instanceof NotFoundError) {\n return []\n }\n }\n const { tree } = await _readTree({ fs, cache, gitdir, oid })\n return tree\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { STAGE } from '../commands/STAGE.js'\nimport { TREE } from '../commands/TREE.js'\nimport { WORKDIR } from '../commands/WORKDIR.js'\nimport { _walk } from '../commands/walk.js'\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\n/**\n * Efficiently get the status of multiple files at once.\n *\n * The returned `StatusMatrix` is admittedly not the easiest format to read.\n * However it conveys a large amount of information in dense format that should make it easy to create reports about the current state of the repository;\n * without having to do multiple, time-consuming isomorphic-git calls.\n * My hope is that the speed and flexibility of the function will make up for the learning curve of interpreting the return value.\n *\n * ```js live\n * // get the status of all the files in 'src'\n * let status = await git.statusMatrix({\n * fs,\n * dir: '/tutorial',\n * filter: f => f.startsWith('src/')\n * })\n * console.log(status)\n * ```\n *\n * ```js live\n * // get the status of all the JSON and Markdown files\n * let status = await git.statusMatrix({\n * fs,\n * dir: '/tutorial',\n * filter: f => f.endsWith('.json') || f.endsWith('.md')\n * })\n * console.log(status)\n * ```\n *\n * The result is returned as a 2D array.\n * The outer array represents the files and/or blobs in the repo, in alphabetical order.\n * The inner arrays describe the status of the file:\n * the first value is the filepath, and the next three are integers\n * representing the HEAD status, WORKDIR status, and STAGE status of the entry.\n *\n * ```js\n * // example StatusMatrix\n * [\n * [\"a.txt\", 0, 2, 0], // new, untracked\n * [\"b.txt\", 0, 2, 2], // added, staged\n * [\"c.txt\", 0, 2, 3], // added, staged, with unstaged changes\n * [\"d.txt\", 1, 1, 1], // unmodified\n * [\"e.txt\", 1, 2, 1], // modified, unstaged\n * [\"f.txt\", 1, 2, 2], // modified, staged\n * [\"g.txt\", 1, 2, 3], // modified, staged, with unstaged changes\n * [\"h.txt\", 1, 0, 1], // deleted, unstaged\n * [\"i.txt\", 1, 0, 0], // deleted, staged\n * [\"j.txt\", 1, 2, 0], // deleted, staged, with unstaged-modified changes (new file of the same name)\n * [\"k.txt\", 1, 1, 0], // deleted, staged, with unstaged changes (new file of the same name)\n * ]\n * ```\n *\n * - The HEAD status is either absent (0) or present (1).\n * - The WORKDIR status is either absent (0), identical to HEAD (1), or different from HEAD (2).\n * - The STAGE status is either absent (0), identical to HEAD (1), identical to WORKDIR (2), or different from WORKDIR (3).\n *\n * ```ts\n * type Filename = string\n * type HeadStatus = 0 | 1\n * type WorkdirStatus = 0 | 1 | 2\n * type StageStatus = 0 | 1 | 2 | 3\n *\n * type StatusRow = [Filename, HeadStatus, WorkdirStatus, StageStatus]\n *\n * type StatusMatrix = StatusRow[]\n * ```\n *\n * > Think of the natural progression of file modifications as being from HEAD (previous) -> WORKDIR (current) -> STAGE (next).\n * > Then HEAD is \"version 1\", WORKDIR is \"version 2\", and STAGE is \"version 3\".\n * > Then, imagine a \"version 0\" which is before the file was created.\n * > Then the status value in each column corresponds to the oldest version of the file it is identical to.\n * > (For a file to be identical to \"version 0\" means the file is deleted.)\n *\n * Here are some examples of queries you can answer using the result:\n *\n * #### Q: What files have been deleted?\n * ```js\n * const FILE = 0, WORKDIR = 2\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[WORKDIR] === 0)\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files have unstaged changes?\n * ```js\n * const FILE = 0, WORKDIR = 2, STAGE = 3\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[WORKDIR] !== row[STAGE])\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files have been modified since the last commit?\n * ```js\n * const FILE = 0, HEAD = 1, WORKDIR = 2\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[HEAD] !== row[WORKDIR])\n * .map(row => row[FILE])\n * ```\n *\n * #### Q: What files will NOT be changed if I commit right now?\n * ```js\n * const FILE = 0, HEAD = 1, STAGE = 3\n *\n * const filenames = (await statusMatrix({ dir }))\n * .filter(row => row[HEAD] === row[STAGE])\n * .map(row => row[FILE])\n * ```\n *\n * For reference, here are all possible combinations:\n *\n * | HEAD | WORKDIR | STAGE | `git status --short` equivalent |\n * | ---- | ------- | ----- | ------------------------------- |\n * | 0 | 0 | 0 | `` |\n * | 0 | 0 | 3 | `AD` |\n * | 0 | 2 | 0 | `??` |\n * | 0 | 2 | 2 | `A ` |\n * | 0 | 2 | 3 | `AM` |\n * | 1 | 0 | 0 | `D ` |\n * | 1 | 0 | 1 | ` D` |\n * | 1 | 0 | 3 | `MD` |\n * | 1 | 1 | 0 | `D ` + `??` |\n * | 1 | 1 | 1 | `` |\n * | 1 | 1 | 3 | `MM` |\n * | 1 | 2 | 0 | `D ` + `??` |\n * | 1 | 2 | 1 | ` M` |\n * | 1 | 2 | 2 | `M ` |\n * | 1 | 2 | 3 | `MM` |\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} [args.ref = 'HEAD'] - Optionally specify a different commit to compare against the workdir and stage instead of the HEAD\n * @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories\n * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.\n * @param {object} [args.cache] - a [cache](cache.md) object\n * @param {boolean} [args.ignored = false] - include ignored files in the result\n *\n * @returns {Promise>} Resolves with a status matrix, described below.\n * @see StatusRow\n */\nexport async function statusMatrix({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref = 'HEAD',\n filepaths = ['.'],\n filter,\n cache = {},\n ignored: shouldIgnore = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const fs = new FileSystem(_fs)\n return await _walk({\n fs,\n cache,\n dir,\n gitdir,\n trees: [TREE({ ref }), WORKDIR(), STAGE()],\n map: async function(filepath, [head, workdir, stage]) {\n // Ignore ignored files, but only if they are not already tracked.\n if (!head && !stage && workdir) {\n if (!shouldIgnore) {\n const isIgnored = await GitIgnoreManager.isIgnored({\n fs,\n dir,\n filepath,\n })\n if (isIgnored) {\n return null\n }\n }\n }\n // match against base paths\n if (!filepaths.some(base => worthWalking(filepath, base))) {\n return null\n }\n // Late filter against file names\n if (filter) {\n if (!filter(filepath)) return\n }\n\n const [headType, workdirType, stageType] = await Promise.all([\n head && head.type(),\n workdir && workdir.type(),\n stage && stage.type(),\n ])\n\n const isBlob = [headType, workdirType, stageType].includes('blob')\n\n // For now, bail on directories unless the file is also a blob in another tree\n if ((headType === 'tree' || headType === 'special') && !isBlob) return\n if (headType === 'commit') return null\n\n if ((workdirType === 'tree' || workdirType === 'special') && !isBlob)\n return\n\n if (stageType === 'commit') return null\n if ((stageType === 'tree' || stageType === 'special') && !isBlob) return\n\n // Figure out the oids for files, using the staged oid for the working dir oid if the stats match.\n const headOid = headType === 'blob' ? await head.oid() : undefined\n const stageOid = stageType === 'blob' ? await stage.oid() : undefined\n let workdirOid\n if (\n headType !== 'blob' &&\n workdirType === 'blob' &&\n stageType !== 'blob'\n ) {\n // We don't actually NEED the sha. Any sha will do\n // TODO: update this logic to handle N trees instead of just 3.\n workdirOid = '42'\n } else if (workdirType === 'blob') {\n workdirOid = await workdir.oid()\n }\n const entry = [undefined, headOid, workdirOid, stageOid]\n const result = entry.map(value => entry.indexOf(value))\n result.shift() // remove leading undefined entry\n return [filepath, ...result]\n },\n })\n } catch (err) {\n err.caller = 'git.statusMatrix'\n throw err\n }\n}\n","// @ts-check\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { MissingParameterError } from '../errors/MissingParameterError.js'\nimport { GitRefManager } from '../managers/GitRefManager'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter'\nimport { join } from '../utils/join.js'\n\n/**\n * Create a lightweight tag\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - What to name the tag\n * @param {string} [args.object = 'HEAD'] - What oid the tag refers to. (Will resolve to oid if value is a ref.) By default, the commit object which is referred by the current `HEAD` is used.\n * @param {boolean} [args.force = false] - Instead of throwing an error if a tag named `ref` already exists, overwrite the existing tag.\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.tag({ fs, dir: '/tutorial', ref: 'test-tag' })\n * console.log('done')\n *\n */\nexport async function tag({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n object,\n force = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n\n const fs = new FileSystem(_fs)\n\n if (ref === undefined) {\n throw new MissingParameterError('ref')\n }\n\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n\n // Resolve passed object\n const value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: object || 'HEAD',\n })\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('tag', ref)\n }\n\n await GitRefManager.writeRef({ fs, gitdir, ref, value })\n } catch (err) {\n err.caller = 'git.tag'\n throw err\n }\n}\n","// @ts-check\nimport { InvalidFilepathError } from '../errors/InvalidFilepathError.js'\nimport { NotFoundError } from '../errors/NotFoundError.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Register file contents in the working tree or object database to the git index (aka staging area).\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.filepath - File to act upon.\n * @param {string} [args.oid] - OID of the object in the object database to add to the index with the specified filepath.\n * @param {number} [args.mode = 100644] - The file mode to add the file to the index.\n * @param {boolean} [args.add] - Adds the specified file to the index if it does not yet exist in the index.\n * @param {boolean} [args.remove] - Remove the specified file from the index if it does not exist in the workspace anymore.\n * @param {boolean} [args.force] - Remove the specified file from the index, even if it still exists in the workspace.\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the object written or updated in the index, or nothing if the file was removed.\n *\n * @example\n * await git.updateIndex({\n * fs,\n * dir: '/tutorial',\n * filepath: 'readme.md'\n * })\n *\n * @example\n * // Manually create a blob in the object database.\n * let oid = await git.writeBlob({\n * fs,\n * dir: '/tutorial',\n * blob: new Uint8Array([])\n * })\n *\n * // Write the object in the object database to the index.\n * await git.updateIndex({\n * fs,\n * dir: '/tutorial',\n * add: true,\n * filepath: 'readme.md',\n * oid\n * })\n */\nexport async function updateIndex({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n cache = {},\n filepath,\n oid,\n mode,\n add,\n remove,\n force,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('filepath', filepath)\n\n const fs = new FileSystem(_fs)\n\n if (remove) {\n return await GitIndexManager.acquire(\n { fs, gitdir, cache },\n async function(index) {\n let fileStats\n\n if (!force) {\n // Check if the file is still present in the working directory\n fileStats = await fs.lstat(join(dir, filepath))\n\n if (fileStats) {\n if (fileStats.isDirectory()) {\n // Removing directories should not work\n throw new InvalidFilepathError('directory')\n }\n\n // Do nothing if we don't force and the file still exists in the workdir\n return\n }\n }\n\n // Directories are not allowed, so we make sure the provided filepath exists in the index\n if (index.has({ filepath })) {\n index.delete({\n filepath,\n })\n }\n }\n )\n }\n\n // Test if it is a file and exists on disk if `remove` is not provided, only of no oid is provided\n let fileStats\n\n if (!oid) {\n fileStats = await fs.lstat(join(dir, filepath))\n\n if (!fileStats) {\n throw new NotFoundError(\n `file at \"${filepath}\" on disk and \"remove\" not set`\n )\n }\n\n if (fileStats.isDirectory()) {\n throw new InvalidFilepathError('directory')\n }\n }\n\n return await GitIndexManager.acquire({ fs, gitdir, cache }, async function(\n index\n ) {\n if (!add && !index.has({ filepath })) {\n // If the index does not contain the filepath yet and `add` is not set, we should throw\n throw new NotFoundError(\n `file at \"${filepath}\" in index and \"add\" not set`\n )\n }\n\n // By default we use 0 for the stats of the index file\n let stats = {\n ctime: new Date(0),\n mtime: new Date(0),\n dev: 0,\n ino: 0,\n mode,\n uid: 0,\n gid: 0,\n size: 0,\n }\n\n if (!oid) {\n stats = fileStats\n\n // Write the file to the object database\n const object = stats.isSymbolicLink()\n ? await fs.readlink(join(dir, filepath))\n : await fs.read(join(dir, filepath))\n\n oid = await _writeObject({\n fs,\n gitdir,\n type: 'blob',\n format: 'content',\n object,\n })\n }\n\n index.insert({\n filepath,\n oid: oid,\n stats,\n })\n\n return oid\n })\n } catch (err) {\n err.caller = 'git.updateIndex'\n throw err\n }\n}\n","// @ts-check\nimport { pkg } from '../utils/pkg.js'\n\n/**\n * Return the version number of isomorphic-git\n *\n * I don't know why you might need this. I added it just so I could check that I was getting\n * the correct version of the library and not a cached version.\n *\n * @returns {string} the version string taken from package.json at publication time\n *\n * @example\n * console.log(git.version())\n *\n */\nexport function version() {\n try {\n return pkg.version\n } catch (err) {\n err.caller = 'git.version'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _walk } from '../commands/walk.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * @callback WalkerMap\n * @param {string} filename\n * @param {Array} entries\n * @returns {Promise}\n */\n\n/**\n * @callback WalkerReduce\n * @param {any} parent\n * @param {any[]} children\n * @returns {Promise}\n */\n\n/**\n * @callback WalkerIterateCallback\n * @param {WalkerEntry[]} entries\n * @returns {Promise}\n */\n\n/**\n * @callback WalkerIterate\n * @param {WalkerIterateCallback} walk\n * @param {IterableIterator} children\n * @returns {Promise}\n */\n\n/**\n * A powerful recursive tree-walking utility.\n *\n * The `walk` API simplifies gathering detailed information about a tree or comparing all the filepaths in two or more trees.\n * Trees can be git commits, the working directory, or the or git index (staging area).\n * As long as a file or directory is present in at least one of the trees, it will be traversed.\n * Entries are traversed in alphabetical order.\n *\n * The arguments to `walk` are the `trees` you want to traverse, and 3 optional transform functions:\n * `map`, `reduce`, and `iterate`.\n *\n * ## `TREE`, `WORKDIR`, and `STAGE`\n *\n * Tree walkers are represented by three separate functions that can be imported:\n *\n * ```js\n * import { TREE, WORKDIR, STAGE } from 'isomorphic-git'\n * ```\n *\n * These functions return opaque handles called `Walker`s.\n * The only thing that `Walker` objects are good for is passing into `walk`.\n * Here are the three `Walker`s passed into `walk` by the `statusMatrix` command for example:\n *\n * ```js\n * let ref = 'HEAD'\n *\n * let trees = [TREE({ ref }), WORKDIR(), STAGE()]\n * ```\n *\n * For the arguments, see the doc pages for [TREE](./TREE.md), [WORKDIR](./WORKDIR.md), and [STAGE](./STAGE.md).\n *\n * `map`, `reduce`, and `iterate` allow you control the recursive walk by pruning and transforming `WalkerEntry`s into the desired result.\n *\n * ## WalkerEntry\n *\n * {@link WalkerEntry typedef}\n *\n * `map` receives an array of `WalkerEntry[]` as its main argument, one `WalkerEntry` for each `Walker` in the `trees` argument.\n * The methods are memoized per `WalkerEntry` so calling them multiple times in a `map` function does not adversely impact performance.\n * By only computing these values if needed, you build can build lean, mean, efficient walking machines.\n *\n * ### WalkerEntry#type()\n *\n * Returns the kind as a string. This is normally either `tree` or `blob`.\n *\n * `TREE`, `STAGE`, and `WORKDIR` walkers all return a string.\n *\n * Possible values:\n *\n * - `'tree'` directory\n * - `'blob'` file\n * - `'special'` used by `WORKDIR` to represent irregular files like sockets and FIFOs\n * - `'commit'` used by `TREE` to represent submodules\n *\n * ```js\n * await entry.type()\n * ```\n *\n * ### WalkerEntry#mode()\n *\n * Returns the file mode as a number. Use this to distinguish between regular files, symlinks, and executable files.\n *\n * `TREE`, `STAGE`, and `WORKDIR` walkers all return a number for all `type`s of entries.\n *\n * It has been normalized to one of the 4 values that are allowed in git commits:\n *\n * - `0o40000` directory\n * - `0o100644` file\n * - `0o100755` file (executable)\n * - `0o120000` symlink\n *\n * Tip: to make modes more readable, you can print them to octal using `.toString(8)`.\n *\n * ```js\n * await entry.mode()\n * ```\n *\n * ### WalkerEntry#oid()\n *\n * Returns the SHA-1 object id for blobs and trees.\n *\n * `TREE` walkers return a string for `blob` and `tree` entries.\n *\n * `STAGE` and `WORKDIR` walkers return a string for `blob` entries and `undefined` for `tree` entries.\n *\n * ```js\n * await entry.oid()\n * ```\n *\n * ### WalkerEntry#content()\n *\n * Returns the file contents as a Buffer.\n *\n * `TREE` and `WORKDIR` walkers return a Buffer for `blob` entries and `undefined` for `tree` entries.\n *\n * `STAGE` walkers always return `undefined` since the file contents are never stored in the stage.\n *\n * ```js\n * await entry.content()\n * ```\n *\n * ### WalkerEntry#stat()\n *\n * Returns a normalized subset of filesystem Stat data.\n *\n * `WORKDIR` walkers return a `Stat` for `blob` and `tree` entries.\n *\n * `STAGE` walkers return a `Stat` for `blob` entries and `undefined` for `tree` entries.\n *\n * `TREE` walkers return `undefined` for all entry types.\n *\n * ```js\n * await entry.stat()\n * ```\n *\n * {@link Stat typedef}\n *\n * ## map(string, Array) => Promise\n *\n * {@link WalkerMap typedef}\n *\n * This is the function that is called once per entry BEFORE visiting the children of that node.\n *\n * If you return `null` for a `tree` entry, then none of the children of that `tree` entry will be walked.\n *\n * This is a good place for query logic, such as examining the contents of a file.\n * Ultimately, compare all the entries and return any values you are interested in.\n * If you do not return a value (or return undefined) that entry will be filtered from the results.\n *\n * Example 1: Find all the files containing the word 'foo'.\n * ```js\n * async function map(filepath, [head, workdir]) {\n * let content = (await workdir.content()).toString('utf8')\n * if (content.contains('foo')) {\n * return {\n * filepath,\n * content\n * }\n * }\n * }\n * ```\n *\n * Example 2: Return the difference between the working directory and the HEAD commit\n * ```js\n * const map = async (filepath, [head, workdir]) => {\n * return {\n * filepath,\n * oid: await head?.oid(),\n * diff: diff(\n * (await head?.content())?.toString('utf8') || '',\n * (await workdir?.content())?.toString('utf8') || ''\n * )\n * }\n * }\n * ```\n *\n * Example 3:\n * ```js\n * let path = require('path')\n * // Only examine files in the directory `cwd`\n * let cwd = 'src/app'\n * async function map (filepath, [head, workdir, stage]) {\n * if (\n * // don't skip the root directory\n * head.fullpath !== '.' &&\n * // return true for 'src' and 'src/app'\n * !cwd.startsWith(filepath) &&\n * // return true for 'src/app/*'\n * path.dirname(filepath) !== cwd\n * ) {\n * return null\n * } else {\n * return filepath\n * }\n * }\n * ```\n *\n * ## reduce(parent, children)\n *\n * {@link WalkerReduce typedef}\n *\n * This is the function that is called once per entry AFTER visiting the children of that node.\n *\n * Default: `async (parent, children) => parent === undefined ? children.flat() : [parent, children].flat()`\n *\n * The default implementation of this function returns all directories and children in a giant flat array.\n * You can define a different accumulation method though.\n *\n * Example: Return a hierarchical structure\n * ```js\n * async function reduce (parent, children) {\n * return Object.assign(parent, { children })\n * }\n * ```\n *\n * ## iterate(walk, children)\n *\n * {@link WalkerIterate typedef}\n *\n * {@link WalkerIterateCallback typedef}\n *\n * Default: `(walk, children) => Promise.all([...children].map(walk))`\n *\n * The default implementation recurses all children concurrently using Promise.all.\n * However you could use a custom function to traverse children serially or use a global queue to throttle recursion.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {Walker[]} args.trees - The trees you want to traverse\n * @param {WalkerMap} [args.map] - Transform `WalkerEntry`s into a result form\n * @param {WalkerReduce} [args.reduce] - Control how mapped entries are combined with their parent result\n * @param {WalkerIterate} [args.iterate] - Fine-tune how entries within a tree are iterated over\n * @param {object} [args.cache] - a [cache](cache.md) object\n *\n * @returns {Promise} The finished tree-walking result\n */\nexport async function walk({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n trees,\n map,\n reduce,\n iterate,\n cache = {},\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('trees', trees)\n\n return await _walk({\n fs: new FileSystem(fs),\n cache,\n dir,\n gitdir,\n trees,\n map,\n reduce,\n iterate,\n })\n } catch (err) {\n err.caller = 'git.walk'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { _writeObject } from '../storage/writeObject'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a blob object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {Uint8Array} args.blob - The blob object to write\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly written object\n *\n * @example\n * // Manually create a blob.\n * let oid = await git.writeBlob({\n * fs,\n * dir: '/tutorial',\n * blob: new Uint8Array([])\n * })\n *\n * console.log('oid', oid) // should be 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'\n *\n */\nexport async function writeBlob({ fs, dir, gitdir = join(dir, '.git'), blob }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('blob', blob)\n\n return await _writeObject({\n fs: new FileSystem(fs),\n gitdir,\n type: 'blob',\n object: blob,\n format: 'content',\n })\n } catch (err) {\n err.caller = 'git.writeBlob'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitCommit } from '../models/GitCommit.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {CommitObject} args.commit\n *\n * @returns {Promise}\n * @see CommitObject\n *\n */\nexport async function _writeCommit({ fs, gitdir, commit }) {\n // Convert object to buffer\n const object = GitCommit.from(commit).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeCommit } from '../commands/writeCommit.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a commit object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {CommitObject} args.commit - The object to write\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly written object\n * @see CommitObject\n *\n */\nexport async function writeCommit({\n fs,\n dir,\n gitdir = join(dir, '.git'),\n commit,\n}) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('commit', commit)\n\n return await _writeCommit({\n fs: new FileSystem(fs),\n gitdir,\n commit,\n })\n } catch (err) {\n err.caller = 'git.writeCommit'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { AlreadyExistsError } from '../errors/AlreadyExistsError.js'\nimport { InvalidRefNameError } from '../errors/InvalidRefNameError.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a ref which refers to the specified SHA-1 object id, or a symbolic ref which refers to the specified ref.\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {string} args.ref - The name of the ref to write\n * @param {string} args.value - When `symbolic` is false, a ref or an SHA-1 object id. When true, a ref starting with `refs/`.\n * @param {boolean} [args.force = false] - Instead of throwing an error if a ref named `ref` already exists, overwrite the existing ref.\n * @param {boolean} [args.symbolic = false] - Whether the ref is symbolic or not.\n *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.writeRef({\n * fs,\n * dir: '/tutorial',\n * ref: 'refs/heads/another-branch',\n * value: 'HEAD'\n * })\n * await git.writeRef({\n * fs,\n * dir: '/tutorial',\n * ref: 'HEAD',\n * value: 'refs/heads/another-branch',\n * force: true,\n * symbolic: true\n * })\n * console.log('done')\n *\n */\nexport async function writeRef({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n ref,\n value,\n force = false,\n symbolic = false,\n}) {\n try {\n assertParameter('fs', _fs)\n assertParameter('gitdir', gitdir)\n assertParameter('ref', ref)\n assertParameter('value', value)\n\n const fs = new FileSystem(_fs)\n\n if (ref !== cleanGitRef.clean(ref)) {\n throw new InvalidRefNameError(ref, cleanGitRef.clean(ref))\n }\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new AlreadyExistsError('ref', ref)\n }\n\n if (symbolic) {\n await GitRefManager.writeSymbolicRef({\n fs,\n gitdir,\n ref,\n value,\n })\n } else {\n value = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: value,\n })\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref,\n value,\n })\n }\n } catch (err) {\n err.caller = 'git.writeRef'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { _writeObject as writeObject } from '../storage/writeObject.js'\n\n/**\n * @param {object} args\n * @param {import('../models/FileSystem.js').FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {TagObject} args.tag\n *\n * @returns {Promise}\n */\nexport async function _writeTag({ fs, gitdir, tag }) {\n // Convert object to buffer\n const object = GitAnnotatedTag.from(tag).toObject()\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'tag',\n object,\n format: 'content',\n })\n return oid\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeTag } from '../commands/writeTag.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write an annotated tag object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {TagObject} args.tag - The object to write\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly written object\n * @see TagObject\n *\n * @example\n * // Manually create an annotated tag.\n * let sha = await git.resolveRef({ fs, dir: '/tutorial', ref: 'HEAD' })\n * console.log('commit', sha)\n *\n * let oid = await git.writeTag({\n * fs,\n * dir: '/tutorial',\n * tag: {\n * object: sha,\n * type: 'commit',\n * tag: 'my-tag',\n * tagger: {\n * name: 'your name',\n * email: 'email@example.com',\n * timestamp: Math.floor(Date.now()/1000),\n * timezoneOffset: new Date().getTimezoneOffset()\n * },\n * message: 'Optional message'\n * }\n * })\n *\n * console.log('tag', oid)\n *\n */\nexport async function writeTag({ fs, dir, gitdir = join(dir, '.git'), tag }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('tag', tag)\n\n return await _writeTag({\n fs: new FileSystem(fs),\n gitdir,\n tag,\n })\n } catch (err) {\n err.caller = 'git.writeTag'\n throw err\n }\n}\n","// @ts-check\nimport '../typedefs.js'\n\nimport { _writeTree } from '../commands/writeTree.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { assertParameter } from '../utils/assertParameter.js'\nimport { join } from '../utils/join.js'\n\n/**\n * Write a tree object directly\n *\n * @param {object} args\n * @param {FsClient} args.fs - a file system client\n * @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path\n * @param {TreeObject} args.tree - The object to write\n *\n * @returns {Promise} Resolves successfully with the SHA-1 object id of the newly written object.\n * @see TreeObject\n * @see TreeEntry\n *\n */\nexport async function writeTree({ fs, dir, gitdir = join(dir, '.git'), tree }) {\n try {\n assertParameter('fs', fs)\n assertParameter('gitdir', gitdir)\n assertParameter('tree', tree)\n\n return await _writeTree({\n fs: new FileSystem(fs),\n gitdir,\n tree,\n })\n } catch (err) {\n err.caller = 'git.writeTree'\n throw err\n }\n}\n","import './typedefs.js'\n\nimport { STAGE } from './api/STAGE.js'\nimport { TREE } from './api/TREE.js'\nimport { WORKDIR } from './api/WORKDIR.js'\nimport { abortMerge } from './api/abortMerge.js'\nimport { add } from './api/add.js'\nimport { addNote } from './api/addNote.js'\nimport { addRemote } from './api/addRemote.js'\nimport { annotatedTag } from './api/annotatedTag.js'\nimport { branch } from './api/branch.js'\nimport { checkout } from './api/checkout.js'\nimport { clone } from './api/clone.js'\nimport { commit } from './api/commit.js'\nimport { currentBranch } from './api/currentBranch.js'\nimport { deleteBranch } from './api/deleteBranch.js'\nimport { deleteRef } from './api/deleteRef.js'\nimport { deleteRemote } from './api/deleteRemote.js'\nimport { deleteTag } from './api/deleteTag.js'\nimport { expandOid } from './api/expandOid.js'\nimport { expandRef } from './api/expandRef.js'\nimport { fastForward } from './api/fastForward.js'\nimport { fetch } from './api/fetch.js'\nimport { findMergeBase } from './api/findMergeBase.js'\nimport { findRoot } from './api/findRoot.js'\nimport { getConfig } from './api/getConfig.js'\nimport { getConfigAll } from './api/getConfigAll.js'\nimport { getRemoteInfo } from './api/getRemoteInfo.js'\nimport { getRemoteInfo2 } from './api/getRemoteInfo2.js'\nimport { hashBlob } from './api/hashBlob.js'\nimport { indexPack } from './api/indexPack.js'\nimport { init } from './api/init.js'\nimport { isDescendent } from './api/isDescendent.js'\nimport { isIgnored } from './api/isIgnored.js'\nimport { listBranches } from './api/listBranches.js'\nimport { listFiles } from './api/listFiles.js'\nimport { listNotes } from './api/listNotes.js'\nimport { listRemotes } from './api/listRemotes.js'\nimport { listServerRefs } from './api/listServerRefs.js'\nimport { listTags } from './api/listTags.js'\nimport { log } from './api/log.js'\nimport { merge } from './api/merge.js'\nimport { packObjects } from './api/packObjects.js'\nimport { pull } from './api/pull.js'\nimport { push } from './api/push.js'\nimport { readBlob } from './api/readBlob.js'\nimport { readCommit } from './api/readCommit.js'\nimport { readNote } from './api/readNote.js'\nimport { readObject } from './api/readObject.js'\nimport { readTag } from './api/readTag.js'\nimport { readTree } from './api/readTree.js'\nimport { remove } from './api/remove.js'\nimport { removeNote } from './api/removeNote.js'\nimport { renameBranch } from './api/renameBranch.js'\nimport { resetIndex } from './api/resetIndex.js'\nimport { resolveRef } from './api/resolveRef.js'\nimport { setConfig } from './api/setConfig.js'\nimport { status } from './api/status.js'\nimport { statusMatrix } from './api/statusMatrix.js'\nimport { tag } from './api/tag.js'\nimport { updateIndex } from './api/updateIndex.js'\nimport { version } from './api/version.js'\nimport { walk } from './api/walk.js'\nimport { writeBlob } from './api/writeBlob.js'\nimport { writeCommit } from './api/writeCommit.js'\nimport { writeObject } from './api/writeObject.js'\nimport { writeRef } from './api/writeRef.js'\nimport { writeTag } from './api/writeTag.js'\nimport { writeTree } from './api/writeTree.js'\nimport * as Errors from './errors/index.js'\n\n// named exports\nexport {\n Errors,\n STAGE,\n TREE,\n WORKDIR,\n abortMerge,\n add,\n addNote,\n addRemote,\n annotatedTag,\n branch,\n checkout,\n clone,\n commit,\n getConfig,\n getConfigAll,\n setConfig,\n currentBranch,\n deleteBranch,\n deleteRef,\n deleteRemote,\n deleteTag,\n expandOid,\n expandRef,\n fastForward,\n fetch,\n findMergeBase,\n findRoot,\n getRemoteInfo,\n getRemoteInfo2,\n hashBlob,\n indexPack,\n init,\n isDescendent,\n isIgnored,\n listBranches,\n listFiles,\n listNotes,\n listRemotes,\n listServerRefs,\n listTags,\n log,\n merge,\n packObjects,\n pull,\n push,\n readBlob,\n readCommit,\n readNote,\n readObject,\n readTag,\n readTree,\n remove,\n removeNote,\n renameBranch,\n resetIndex,\n updateIndex,\n resolveRef,\n status,\n statusMatrix,\n tag,\n version,\n walk,\n writeBlob,\n writeCommit,\n writeObject,\n writeRef,\n writeTag,\n writeTree,\n}\n\n// default export\nexport default {\n Errors,\n STAGE,\n TREE,\n WORKDIR,\n add,\n abortMerge,\n addNote,\n addRemote,\n annotatedTag,\n branch,\n checkout,\n clone,\n commit,\n getConfig,\n getConfigAll,\n setConfig,\n currentBranch,\n deleteBranch,\n deleteRef,\n deleteRemote,\n deleteTag,\n expandOid,\n expandRef,\n fastForward,\n fetch,\n findMergeBase,\n findRoot,\n getRemoteInfo,\n getRemoteInfo2,\n hashBlob,\n indexPack,\n init,\n isDescendent,\n isIgnored,\n listBranches,\n listFiles,\n listNotes,\n listRemotes,\n listServerRefs,\n listTags,\n log,\n merge,\n packObjects,\n pull,\n push,\n readBlob,\n readCommit,\n readNote,\n readObject,\n readTag,\n readTree,\n remove,\n removeNote,\n renameBranch,\n resetIndex,\n updateIndex,\n resolveRef,\n status,\n statusMatrix,\n tag,\n version,\n walk,\n writeBlob,\n writeCommit,\n writeObject,\n writeRef,\n writeTag,\n writeTree,\n}\n"],"sourceRoot":""}