{"version":3,"sources":["webpack://git/webpack/universalModuleDefinition","webpack://git/webpack/bootstrap","webpack://git/./src/models/GitError.js","webpack://git/./src/models/FileSystem.js","webpack://git/./src/utils/normalizePath.js","webpack://git/./src/utils/join.js","webpack://git/./src/utils/plugins.js","webpack://git/./src/models/GitPackedRefs.js","webpack://git/./src/utils/compareRefNames.js","webpack://git/./src/managers/GitRefManager.js","webpack://git/./src/storage/readObject.js","webpack://git/./node_modules/marky/lib/marky.browser.es.js","webpack://git/./src/models/GitCommit.js","webpack://git/./src/utils/log.js","webpack://git/./src/models/GitPktLine.js","webpack://git/(webpack)/node_modules/buffer/index.js","webpack://git/./src/models/GitTree.js","webpack://git/./src/utils/shasum.js","webpack://git/./src/utils/normalizeNewlines.js","webpack://git/./src/models/GitAnnotatedTag.js","webpack://git/./node_modules/pify/index.js","webpack://git/./src/utils/DeepMap.js","webpack://git/./src/managers/GitIndexManager.js","webpack://git/./src/models/GitObject.js","webpack://git/./node_modules/pako/index.js","webpack://git/./src/utils/BufferCursor.js","webpack://git/./src/storage/writeObject.js","webpack://git/./src/utils/dirname.js","webpack://git/./src/managers/GitConfigManager.js","webpack://git/./node_modules/pako/lib/utils/common.js","webpack://git/./src/utils/pkg.js","webpack://git/./src/utils/normalizeMode.js","webpack://git/./src/utils/normalizeStats.js","webpack://git/./src/utils/symbols.js","webpack://git/./src/utils/forAwait.js","webpack://git/./src/utils/basename.js","webpack://git/./src/models/GitWalkerRepo.js","webpack://git/./src/commands/TREE.js","webpack://git/./node_modules/sha.js/sha1.js","webpack://git/./src/utils/padHex.js","webpack://git/./src/utils/parseAuthor.js","webpack://git/./src/utils/indent.js","webpack://git/./src/utils/collect.js","webpack://git/./node_modules/clean-git-ref/lib/index.js","webpack://git/./src/utils/comparePath.js","webpack://git/./src/models/GitPackIndex.js","webpack://git/./src/utils/flat.js","webpack://git/./src/models/RunningMinimum.js","webpack://git/./src/utils/unionOfIterators.js","webpack://git/./src/commands/walkBeta1.js","webpack://git/./src/utils/arrayRange.js","webpack://git/./src/utils/compareStrings.js","webpack://git/./src/utils/extractAuthFromUrl.js","webpack://git/./src/managers/GitRemoteHTTP.js","webpack://git/./node_modules/async-lock/index.js","webpack://git/./src/utils/formatAuthor.js","webpack://git/./src/utils/calculateBasicAuthUsernamePasswordPair.js","webpack://git/./src/utils/calculateBasicAuthHeader.js","webpack://git/./src/utils/FIFO.js","webpack://git/./node_modules/process/browser.js","webpack://git/./src/managers/GitIgnoreManager.js","webpack://git/./src/utils/resolveTree.js","webpack://git/./src/utils/oauth2.js","webpack://git/./src/models/GitSideBand.js","webpack://git/./src/utils/compareStats.js","webpack://git/./src/models/GitRefSpec.js","webpack://git/./src/storage/readPackIndex.js","webpack://git/./src/utils/StreamReader.js","webpack://git/./src/utils/getIterator.js","webpack://git/./src/utils/AsyncIterator.js","webpack://git/./src/utils/http-browser.js","webpack://git/./src/managers/GitShallowManager.js","webpack://git/./node_modules/base64-js/lib/b64.js","webpack://git/./node_modules/pako/lib/zlib/messages.js","webpack://git/./src/utils/sleep.js","webpack://git/./src/models/GitIndex.js","webpack://git/./src/models/GitConfig.js","webpack://git/./src/models/GitRefSpecSet.js","webpack://git/./src/managers/GitRemoteManager.js","webpack://git/./src/wire/parseRefsAdResponse.js","webpack://git/./src/utils/flatFileListToDirectoryStructure.js","webpack://git/./src/utils/mergeFile.js","webpack://git/./src/commands/pack.js","webpack://git/./src/models/SignedGitCommit.js","webpack://git/(webpack)/node_modules/path-browserify/index.js","webpack://git/(webpack)/buildin/global.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/./node_modules/bops/typedarray/mapped.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/commands/listObjects.js","webpack://git/./src/wire/writeReceivePackRequest.js","webpack://git/./src/wire/parseReceivePackResponse.js","webpack://git/./src/utils/auth.js","webpack://git/./node_modules/ignore/index.js","webpack://git/./src/storage/writeObjectLoose.js","webpack://git/./src/storage/readObjectLoose.js","webpack://git/./src/storage/readObjectPacked.js","webpack://git/./node_modules/crc-32/crc32.js","webpack://git/./node_modules/git-apply-delta/index.js","webpack://git/./src/utils/git-list-pack.js","webpack://git/./src/utils/outdent.js","webpack://git/./node_modules/diff3/diff3.js","webpack://git/./src/commands/types.js","webpack://git/./node_modules/globrex/index.js","webpack://git/./node_modules/ieee754/index.js","webpack://git/./node_modules/isarray/index.js","webpack://git/./node_modules/async-lock/lib/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/bops/index.js","webpack://git/./node_modules/bops/typedarray/from.js","webpack://git/./node_modules/bops/typedarray/to.js","webpack://git/./node_modules/to-utf8/index.js","webpack://git/./node_modules/bops/typedarray/is.js","webpack://git/./node_modules/bops/typedarray/subarray.js","webpack://git/./node_modules/bops/typedarray/join.js","webpack://git/./node_modules/bops/typedarray/copy.js","webpack://git/./node_modules/bops/typedarray/create.js","webpack://git/./node_modules/bops/typedarray/read.js","webpack://git/./node_modules/bops/typedarray/write.js","webpack://git/./node_modules/varint/decode.js","webpack://git/./node_modules/diff3/onp.js","webpack://git/./src/commands/hashBlob.js","webpack://git/./src/commands/writeObject.js","webpack://git/./node_modules/globalyzer/src/index.js","webpack://git/./src/storage/hashObject.js","webpack://git/./src/commands/add.js","webpack://git/./src/commands/addRemote.js","webpack://git/./src/commands/config.js","webpack://git/./src/utils/normalizeAuthorObject.js","webpack://git/./src/commands/annotatedTag.js","webpack://git/./src/commands/branch.js","webpack://git/./src/utils/patternRoot.js","webpack://git/./src/utils/worthWalking.js","webpack://git/./src/models/GitWalkerFs.js","webpack://git/./src/commands/WORKDIR.js","webpack://git/./src/commands/checkout.js","webpack://git/./src/storage/hasObjectLoose.js","webpack://git/./src/storage/hasObjectPacked.js","webpack://git/./src/storage/hasObject.js","webpack://git/./src/utils/abbreviateRef.js","webpack://git/./src/utils/filterCapabilities.js","webpack://git/./src/utils/splitLines.js","webpack://git/./src/commands/fetch.js","webpack://git/./src/utils/emptyPackfile.js","webpack://git/./src/commands/init.js","webpack://git/./src/commands/clone.js","webpack://git/./src/commands/commit.js","webpack://git/./src/commands/currentBranch.js","webpack://git/./src/commands/deleteBranch.js","webpack://git/./src/commands/deleteRef.js","webpack://git/./src/commands/deleteRemote.js","webpack://git/./src/commands/deleteTag.js","webpack://git/./src/storage/expandOidLoose.js","webpack://git/./src/storage/expandOidPacked.js","webpack://git/./src/storage/expandOid.js","webpack://git/./src/commands/expandOid.js","webpack://git/./src/commands/expandRef.js","webpack://git/./src/commands/findMergeBase.js","webpack://git/./src/commands/findRoot.js","webpack://git/./src/commands/getRemoteInfo.js","webpack://git/./src/commands/indexPack.js","webpack://git/./src/commands/isDescendent.js","webpack://git/./src/commands/listBranches.js","webpack://git/./src/commands/readObject.js","webpack://git/./src/commands/listFiles.js","webpack://git/./src/commands/listRemotes.js","webpack://git/./src/commands/listTags.js","webpack://git/./src/utils/compareAge.js","webpack://git/./src/utils/logCommit.js","webpack://git/./src/commands/log.js","webpack://git/./src/commands/merge.js","webpack://git/./src/commands/packObjects.js","webpack://git/./src/commands/pull.js","webpack://git/./src/commands/push.js","webpack://git/./src/commands/remove.js","webpack://git/./src/utils/hashObject.js","webpack://git/./src/commands/resetIndex.js","webpack://git/./src/commands/resolveRef.js","webpack://git/./src/commands/sign.js","webpack://git/./src/commands/status.js","webpack://git/./src/models/GitWalkerIndex.js","webpack://git/./src/commands/STAGE.js","webpack://git/./src/commands/statusMatrix.js","webpack://git/./src/commands/tag.js","webpack://git/./src/commands/verify.js","webpack://git/./src/commands/version.js","webpack://git/./src/commands/writeRef.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","messages","FileReadError","MissingRequiredParameterError","InvalidRefNameError","InvalidParameterCombinationError","RefExistsError","RefNotExistsError","BranchDeleteError","NoHeadCommitError","CommitNotFetchedError","ObjectTypeUnknownFail","ObjectTypeAssertionFail","ObjectTypeAssertionInTreeFail","ObjectTypeAssertionInRefFail","ObjectTypeAssertionInPathFail","MissingAuthorError","MissingCommitterError","MissingTaggerError","GitRootNotFoundError","UnparseableServerResponseFail","InvalidDepthParameterError","RemoteDoesNotSupportShallowFail","RemoteDoesNotSupportDeepenSinceFail","RemoteDoesNotSupportDeepenNotFail","RemoteDoesNotSupportDeepenRelativeFail","RemoteDoesNotSupportSmartHTTP","CorruptShallowOidFail","FastForwardFail","MergeNotSupportedFail","DirectorySeparatorsError","ResolveTreeError","ResolveCommitError","DirectoryIsAFileError","TreeOrBlobNotFoundError","NotImplementedFail","ReadObjectFail","NotAnOidFail","NoRefspecConfiguredError","MismatchRefValueError","ResolveRefError","ExpandRefError","EmptyServerResponseFail","AssertServerResponseFail","HTTPError","RemoteUrlParseError","UnknownTransportError","AcquireLockFileFail","DoubleReleaseLockFileFail","InternalFail","UnknownOauth2Format","MissingPasswordTokenError","MissingUsernameError","MixPasswordTokenError","MixUsernamePasswordTokenError","MissingTokenError","MixUsernameOauth2formatMissingTokenError","MixPasswordOauth2formatMissingTokenError","MixUsernamePasswordOauth2formatMissingTokenError","MixUsernameOauth2formatTokenError","MixPasswordOauth2formatTokenError","MixUsernamePasswordOauth2formatTokenError","MaxSearchDepthExceeded","PushRejectedNonFastForward","PushRejectedTagExists","AddingRemoteWouldOverwrite","PluginUndefined","CoreNotFound","PluginSchemaViolation","PluginUnrecognized","AmbiguousShortOid","ShortOidNotFound","E","GitError","Error","constructor","code","data","super","this","message","template","values","result","keys","subs","Array","isArray","join","String","replace","RegExp","renderTemplate","captureStackTrace","toJSON","caller","toString","stack","delayedReleases","Map","fsmap","WeakMap","FileSystem","fs","undefined","plugin","has","_original_unwrapped_fs","getOwnPropertyDescriptor","_readFile","promises","readFile","_writeFile","writeFile","_mkdir","mkdir","_rmdir","rmdir","_unlink","unlink","_stat","stat","_lstat","lstat","_readdir","readdir","_readlink","readlink","_symlink","symlink","pify","set","exists","filepath","options","err","console","log","read","buffer","Buffer","from","write","contents","dirname","_selfCall","parent","rm","names","sort","compareStrings","readdirDeep","dir","subdirs","Promise","all","map","subdir","res","isDirectory","reduce","a","f","concat","filename","opts","encoding","writelink","lock","triesLeft","clearTimeout","delete","sleep","unlock","delayRelease","setTimeout","normalizePath","path","parts","plugins","pluginSchemas","credentialManager","emitter","pgp","http","method","verifySchema","critical","Set","_cores","cores","core","GitPackedRefs","text","refs","parsedConfig","trim","split","line","test","comment","indexOf","startsWith","slice","ref","peeled","oid","filter","entry","compareRefNames","b","_a","_b","tmp","endsWith","refpaths","GIT_FILES","GitRefManager","_fs","gitdir","remote","symrefs","tags","refspecs","prune","match","config","GitConfigManager","getall","length","unshift","refspec","GitRefSpecSet","actualRefsToWrite","serverRef","refTranslations","translate","translatedRef","symrefTranslations","symtarget","translateOne","pruned","localNamespaces","listRefs","file","deleteRef","push","packed","depth","sha","resolve","packedMap","packedRefs","allpaths","includes","expand","fullref","resolveAgainstMap","files","x","readObject","format","getExternalRefDelta","readObjectLoose","readObjectPacked","pako","inflate","shasum","type","GitObject","unwrap","mark","stop","perf","performance","now","Date","throwIfEmpty","measure","entries","getEntriesByName","getEntriesByType","clearMarks","clearMeasures","marks","startTime","endTime","duration","entryType","arr","item","mid","low","high","splice","insertSorted","GitCommit","commit","_commit","isBuffer","render","payload","signature","headers","justHeaders","justMessage","normalizeNewlines","indent","toObject","parseHeaders","parse","assign","hs","h","obj","author","parseAuthor","committer","tree","formatAuthor","gpgsig","renderHeaders","withoutSignature","isolateSignature","outdent","secretKey","sign","signedCommit","publicKey","verify","shouldLog","args","process","env","DEBUG","window","localStorage","debug","GitPktLine","hexlength","padHex","stream","reader","StreamReader","parseInt","base64","ieee754","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","allocUnsafe","TypeError","ArrayBuffer","array","byteOffset","byteLength","fromArrayLike","fromArrayBuffer","string","isEncoding","actual","fromString","len","checked","copy","val","fromObject","assertSize","size","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","isNaN","arrayIndexOf","lastIndexOf","indexSize","arrLength","valLength","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","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","decodeCodePointsArray","SlowBuffer","alloc","INSPECT_MAX_BYTES","global","foo","subarray","e","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","y","list","pos","swap16","swap32","swap64","arguments","equals","inspect","max","target","thisStart","thisEnd","thisCopy","targetCopy","isFinite","_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","cursor","space","nullchar","parseBuffer","comparePath","iterator","Hash","update","digest","GitAnnotatedTag","tag","_tag","tagger","signedTag","processFn","fn","P","promiseModule","reject","multiArgs","errorFirst","shift","error","input","exclude","objType","pattern","include","some","excludeMain","getPrototypeOf","deepget","DeepMap","_root","lastKey","pop","stats","rawIndexFile","index","GitIndex","savedStats","currStats","compareStats","GitIndexManager","closure","AsyncLock","maxPending","acquire","isIndexStale","updateCachedIndexFile","_dirty","actualLength","BufferCursor","_start","eof","tell","seek","enc","writeObject","dryRun","wrap","deflate","writeObjectLoose","last","GitConfig","TYPED_OK","Uint16Array","Int32Array","_has","sources","source","shrinkBuf","fnTyped","arraySet","dest","src_offs","dest_offs","flattenChunks","chunks","chunk","fnUntyped","setTyped","on","Buf8","Buf16","Buf32","pkg","version","agent","normalizeMode","permissions","MAX_UINT32","SecondsNanoseconds","givenSeconds","givenNanoseconds","milliseconds","date","valueOf","seconds","normalizeStats","ctimeSeconds","ctimeNanoseconds","ctimeMs","ctime","mtimeSeconds","mtimeNanoseconds","mtimeMs","mtime","dev","ino","uid","gid","GitWalkerSymbol","forAwait","iterable","cb","iter","getIterator","done","next","return","basename","GitWalkerRepo","mapPromise","resolveTree","walker","ConstructEntry","populateStat","populateContent","populateHash","fullpath","JSON","stringify","content","TREE","freeze","inherits","K","W","Sha1","init","_w","rotl5","num","rotl30","ft","_c","_d","_e","_update","M","_hash","H","repeat","email","timestamp","timezoneOffset","parseTimezoneOffset","hours","minutes","collect","buffers","replaceAll","search","replacement","CleanGitRef","clean","GitPackIndex","stuff","offsetCache","idx","marky","hashes","hash","offsets","packfileSha","crcs","pack","emitterPrefix","listpackTypes","1","2","3","4","6","7","offsetToObject","totalObjectCount","lastPercent","times","readSlice","histogram","blob","bytesProcessed","listpack","reference","percent","emit","phase","loaded","total","lengthComputable","offsetArray","crc","crc32","count","callsToReadSlice","callsToGetExternal","timeByDepth","objectsByDepth","readDepth","externalReadDepth","time","totalElapsedTime","misc","toBuffer","fanoutBuffer","crcsBuffer","offsetsBuffer","totalBuffer","shaBuffer","load","unload","raw","byte","btype","lastFour","startWith","otherVarIntDecode","base","multibyte","lastSeven","decodeVarInt","baseOffset","applyDelta","flat","acc","RunningMinimum","consider","reset","unionOfIterators","sets","minimum","heads","numsets","walkBeta1","trees","children","flatten","iterate","walk","walkers","proxy","range","_","arrayRange","unionWalkerFromReaddir","iterators","walkedChildren","extractAuthFromUrl","url","userpass","username","password","corsProxify","corsProxy","GitRemoteHTTP","service","noGitSuffix","auth","_origUrl","urlAuth","builtinHttp","_auth","calculateBasicAuthUsernamePasswordPair","calculateBasicAuthHeader","statusCode","rejected","approved","statusMessage","remoteHTTP","parseRefsAdResponse","body","expected","is","simpleSign","abs","strHours","strMinutes","formatTimezoneOffset","token","oauth2format","allowEmptyPassword","oauth2","FIFO","_queue","_ended","_waiting","destroy","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","argv","versions","addListener","once","off","removeListener","removeAllListeners","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","GitIgnoreManager","pairs","gitignore","pieces","folder","ignoredStatus","ign","ignore","add","parentdir","ignores","unignored","ignored","company","GitSideBand","streamReader","packetlines","packfile","progress","nextBit","staleness","enabled","table","justWhatMatters","GitRefSpec","remotePath","localPath","force","matchPrefix","forceMatch","remoteGlobMatch","localGlobMatch","remoteIsGlob","remoteBranch","reverseTranslate","localBranch","PackfileCache","fromIdx","readPackIndex","loadPackIndex","undoCursor","started","_discardedBytes","_init","_loadnext","_moveCursor","_trim","_accumulate","skip","undo","_next","lengthBuffers","nextbuffer","asyncIterator","fromValue","fromStream","getReader","releaseLock","fetch","arrayBuffer","status","statusText","GitShallowManager","oids","lookup","b64","placeHolders","uint8","temp","extraBytes","output","0","ms","shaComputed","shaClaimed","magic","numEntries","flags","bits","assumeValid","Boolean","extended","stage","nameLength","pathlength","padding","insert","bfilepath","clear","header","writer","bpath","ceil","written","renderCacheEntryFlags","main","sum","bool","schema","filemode","bare","logallrefupdates","symlinks","ignorecase","bigFileThreshold","SECTION_LINE_REGEX","SECTION_REGEX","VARIABLE_LINE_REGEX","VARIABLE_NAME_REGEX","VARIABLE_VALUE_COMMENT_REGEX","extractSectionLine","matches","exec","section","subsection","extractVariableLine","rawValue","valueWithoutComments","removeComments","removeQuotes","commentMatches","valueWithoutComment","hasOddNumberOfQuotes","newText","isQuote","isEscapeForQuote","lower","getPath","findLastIndex","callback","lastIndex","trimmedLine","extractedSection","isSection","extractedVariable","allValues","getSubsections","deleteSection","append","configIndex","modifiedConfig","modified","sectionPath","sectionIndex","findIndex","newConfig","newSection","rules","rule","remoteRefs","remoteRef","localRef","GitRemoteManager","remoteHelpers","transport","address","parseRemoteUrl","capabilities","lineOne","lineTwo","firstRef","capabilitiesLine","cap","flatFileListToDirectoryStructure","inodes","metadata","mkfile","LINEBREAKS","mergeFile","ourContent","baseContent","theirContent","ourName","baseName","theirName","markerSize","ours","theirs","diff3Merge","mergedText","cleanMerge","ok","conflict","outputStream","buff","stype","types","SignedGitCommit","openpgp","privateKeys","privKeyObj","readArmored","util","str2Uint8Array","detached","armor","listSigningKeys","readSignedContent","getSigningKeyIds","keyid","publicKeys","pubKeyObj","valid","normalizeArray","allowAboveRoot","up","xs","resolvedPath","resolvedAbsolute","charAt","normalize","isAbsolute","trailingSlash","paths","relative","to","fromParts","toParts","samePartsLength","outputParts","sep","delimiter","hasRoot","matchedSlash","extname","startDot","startPart","preDotState","g","Function","copyProps","SafeBuffer","adler","s1","s2","crcTable","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","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","proto","DataView","writeUploadPackRequest","wants","haves","shallows","since","packstream","firstLineCapabilities","encode","flush","parseUploadPackResponse","demux","unshallows","acks","nak","mergeTree","ourOid","baseOid","theirOid","ourTree","baseTree","theirTree","mergeBlobs","listCommitsAndTags","finish","startingSet","finishingSet","visited","parents","listObjects","writeReceivePackRequest","triplets","capsFirstLine","trip","oldoid","fullRef","parseReceivePackResponse","response","lines","errors","refAndMessage","makeArray","subject","REGEX_TEST_BLANK_LINE","REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION","REGEX_REPLACE_LEADING_EXCAPED_HASH","REGEX_SPLITALL_CRLF","REGEX_TEST_INVALID_PATH","SLASH","KEY_IGNORE","for","REGEX_REGEXP_RANGE","REPLACERS","p1","p2","sanitizeRange","regexCache","isString","checkPattern","splitPattern","IgnoreRule","origin","negative","regex","createRule","prev","current","makeRegex","throwError","Ctor","checkPath","originalPath","doThrow","isNotRelative","convert","Ignore","_rules","_ignorecase","_initCache","_ignoreCache","_testCache","_added","forEach","_addPattern","checkUnignored","cache","slices","_t","_testOne","_test","createFilter","returnFalse","isPathValid","default","IGNORE_TEST_WIN32","platform","makePosix","REGIX_IS_WINDOWS_PATH_ABSOLUTE","indexFile","packFile","CRC32","T","signed_crc_table","bstr","seed","C","L","crc32_buf_8","DO_NOT_EXPORT_CRC","delta","output_buffer","out_idx","command","base_size_info","resized_size_info","delta_header","binary","OFFSET_BUFFER","LENGTH_BUFFER","check","vi","ondata","onData","PACK","numObjects","ofs","parseHeader","inflator","Inflate","ended","strm","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","isTrueConflict","rec","aoff","boff","aIndex","oIndex","bIndex","ofs_delta","ref_delta","SEP","isWin","SEP_ESC","GLOBSTAR","WILDCARD","GLOBSTAR_SEGMENT","WILDCARD_SEGMENT","glob","globstar","strict","segment","segments","inGroup","inRange","only","prevChar","starCount","nextChar","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","LN2","queues","domains","domainReentrant","DEFAULT_TIMEOUT","DEFAULT_MAX_PENDING","_acquireBatch","deferred","_deferPromise","resolved","timer","locked","domain","called","_promiseTry","then","taskFn","skipQueue","promise","fnx","getFn","isBusy","defer","ctor","superCtor","super_","writable","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","deflateInit2","deflateSetHeader","dictionary","dict","deflateSetDictionary","_dict_set","deflator","_mode","onEnd","deflateEnd","deflateRaw","configuration_table","adler32","MAX_MEM_LEVEL","MAX_WBITS","DEF_MEM_LEVEL","L_CODES","LITERALS","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","MIN_MATCH","MAX_MATCH","MIN_LOOKAHEAD","PRESET_DICT","INIT_STATE","EXTRA_STATE","NAME_STATE","COMMENT_STATE","HCRC_STATE","BUSY_STATE","FINISH_STATE","BS_NEED_MORE","BS_BLOCK_DONE","BS_FINISH_STARTED","BS_FINISH_DONE","OS_CODE","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","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","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","bl_count","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","os","bstate","deflate_huff","deflate_rle","_tr_align","_tr_stored_block","avail","tmpDict","dictLength","deflateInfo","STORED_BLOCK","STATIC_TREES","DYN_TREES","LENGTH_CODES","Buf_size","MAX_BL_BITS","END_BLOCK","REP_3_6","REPZ_3_10","REPZ_11_138","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","_dist_code","_length_code","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","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","send_tree","static_init_done","stored_len","copy_block","tr_static_init","opt_lenb","static_lenb","max_blindex","black_mask","detect_data_type","build_bl_tree","lcodes","dcodes","blcodes","send_all_trees","bi_flush","zlib_inflate","GZheader","inflateInit2","inflateGetHeader","inflateSetDictionary","next_out_utf8","utf8str","allowBufError","inflateEnd","inflateRaw","ungzip","inflate_fast","inflate_table","CODES","LENS","DISTS","Z_MEM_ERROR","HEAD","FLAGS","TIME","OS","EXLEN","EXTRA","NAME","COMMENT","HCRC","DICTID","DICT","TYPE","TYPEDO","STORED","COPY_","COPY","TABLE","LENLENS","CODELENS","LEN_","LEN","LENEXT","DIST","DISTEXT","MATCH","LIT","CHECK","LENGTH","DONE","BAD","MEM","SYNC","ENOUGH_LENS","ENOUGH_DISTS","DEF_WBITS","zswap32","InflateState","havedict","dmax","wbits","wsize","whave","wnext","hold","lencode","distcode","lenbits","distbits","ncode","nlen","ndist","have","lens","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","mask","curr","drop","used","huff","base_index","MAXBITS","offs","extra_index","mix","into","decoders","hex","character","utf8","ch","encodeURIComponent","jlen","encoders","toutf8","byt","by","collecting","col","find_pad_position","unmask","fcc","reduced","targets","hint","get_length","cur","curidx","curoff","target_start","source_start","source_end","fast_copy","jend","iend","slow_copy","at","getUint16","getUint32","getInt16","getInt32","getFloat32","getFloat64","setUint16","setUint32","setInt16","setInt32","setFloat32","setFloat64","Decoder","MSB","REST","msb","a_","b_","tmp1","tmp2","ed","pathposi","lcs","seselem","elem","snake","pp","editdistance","getlcs","fp","epc","px_idx","py_idx","recordseq","hashBlob","_object","hashObject","_format","_writeObject","CHARS","STRICT","RELAXED","isglob","rgx","open","close","isGlob","addToIndex","isIgnored","child","isSymbolicLink","addRemote","function","parameter","cleanGitRef","verb","noun","suggestion","save","normalizeAuthorObject","getTimezoneOffset","annotatedTag","signingKey","parameters","tagObject","writeRef","branch","checkout","writeSymbolicRef","patternRoot","globalyzer","worthWalking","GitWalkerFs","isFile","entriesMap","WORKDIR","filepaths","noCheckout","patternGlobrex","patternPart","globrex","bases","workdir","partToMatch","thing","entrypath","hasObject","hasObjectLoose","hasObjectPacked","abbreviateRx","abbreviateRef","filterCapabilities","server","client","serverNames","findSplit","splitLines","authUsername","authPassword","singleBranch","onprogress","warn","fetchPackfile","defaultBranch","fetchHead","fetchHeadDescription","FETCH_HEAD","description","pheader","fromPack","getRemoteHelperFor","discover","haveRefs","packbuffer","connect","hasParents","every","bail","updateRemoteRefs","folders","clone","noTags","noUpdateBranch","inode","constructTree","comm","currentBranch","fullname","deleteBranch","deleteRemote","deleteTag","short","prefix","suffix","_oid","results","results1","expandOidLoose","results2","expandOidPacked","expandOid","_expandOid","expandRef","findMergeBase","visits","passes","newheads","findRoot","_findRoot","getRemoteInfo","forPush","part","symref","indexPack","isDescendent","ancestor","searchdepth","listBranches","pathArray","resolveFile","_readObject","listFiles","filenames","accumulateFilesFromOid","listRemotes","remoteNames","listTags","compareAge","logCommit","signing","sinceTimestamp","commits","shallowCommits","tips","merge","fastForwardOnly","baseOids","alreadyMerged","fastForward","mergeCommit","packObjects","pull","httpRemote","fullRemoteRef","expandAgainstMap","mergebase","objects","packstream1","packstream2","remove","resetIndex","workdirOid","resolveRef","newOid","headTree","getHeadTree","treeOid","getOidAtPath","indexEntry","I","getWorkdirOid","getTree","GitWalkerIndex","treePromise","STAGE","statusMatrix","invalid","symbolic"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,IARhB,CASGK,KAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAStB,GACX,oBAAXuB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAenB,EAASuB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAenB,EAAS,aAAc,CAAEyB,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG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1N,WAGJ,MAAOqJ,GAEP,MADAA,EAAIxC,OAAS,eACPwC,K,wMCxFV,whEAoDO,MAAMk9B,GAAQ,CAAE/S,SAAMwB","file":"bundle.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 = 129);\n","// modeled after Therror https://github.com/therror/therror/\n// but with the goal of being much lighter weight.\n\nconst messages = {\n FileReadError: `Could not read file \"{ filepath }\".`,\n MissingRequiredParameterError: `The function \"{ function }\" requires a \"{ parameter }\" parameter but none was provided.`,\n InvalidRefNameError: `Failed to { verb } { noun } \"{ ref }\" because that name would not be a valid git reference. A valid alternative would be \"{ suggestion }\".`,\n InvalidParameterCombinationError: `The function \"{ function }\" doesn't take these parameters simultaneously: { parameters }`,\n RefExistsError: `Failed to create { noun } \"{ ref }\" because { noun } \"{ ref }\" already exists.`,\n RefNotExistsError: `Failed to { verb } { noun } \"{ ref }\" because { noun } \"{ ref }\" does not exists.`,\n BranchDeleteError: `Failed to delete branch \"{ ref }\" because branch \"{ ref }\" checked out now.`,\n NoHeadCommitError: `Failed to create { noun } \"{ ref }\" because the HEAD ref could not be resolved to a commit.`,\n CommitNotFetchedError: `Failed to checkout \"{ ref }\" because commit { oid } is not available locally. Do a git fetch to make the branch available locally.`,\n ObjectTypeUnknownFail: `Object { oid } has unknown type \"{ type }\".`,\n ObjectTypeAssertionFail: `Object { oid } was anticipated to be a { expected } but it is a { type }. This is probably a bug deep in isomorphic-git!`,\n ObjectTypeAssertionInTreeFail: `Object { oid } in tree for \"{ entrypath }\" was an unexpected object type \"{ type }\".`,\n ObjectTypeAssertionInRefFail: `{ ref } is not pointing to a \"{ expected }\" object but a \"{ type }\" object.`,\n ObjectTypeAssertionInPathFail: `Found a blob { oid } in the path \"{ path }\" where a tree was expected.`,\n MissingAuthorError: `Author name and email must be specified as an argument or in the .git/config file.`,\n MissingCommitterError: `Committer name and email must be specified if a committer object is passed.`,\n MissingTaggerError: `Tagger name and email must be specified as an argument or in the .git/config file.`,\n GitRootNotFoundError: `Unable to find git root for { filepath }.`,\n UnparseableServerResponseFail: `Unparsable response from server! Expected \"unpack ok\" or \"unpack [error message]\" but received \"{ line }\".`,\n InvalidDepthParameterError: `Invalid value for depth parameter: { depth }`,\n RemoteDoesNotSupportShallowFail: `Remote does not support shallow fetches.`,\n RemoteDoesNotSupportDeepenSinceFail: `Remote does not support shallow fetches by date.`,\n RemoteDoesNotSupportDeepenNotFail: `Remote does not support shallow fetches excluding commits reachable by refs.`,\n RemoteDoesNotSupportDeepenRelativeFail: `Remote does not support shallow fetches relative to the current shallow depth.`,\n RemoteDoesNotSupportSmartHTTP: `Remote does not support the \"smart\" HTTP protocol, and isomorphic-git does not support the \"dumb\" HTTP protocol, so they are incompatible.`,\n CorruptShallowOidFail: `non-40 character shallow oid: { oid }`,\n FastForwardFail: `A simple fast-forward merge was not possible.`,\n MergeNotSupportedFail: `Merges with conflicts are not supported yet.`,\n DirectorySeparatorsError: `\"filepath\" parameter should not include leading or trailing directory separators because these can cause problems on some platforms`,\n ResolveTreeError: `Could not resolve { oid } to a tree.`,\n ResolveCommitError: `Could not resolve { oid } to a commit.`,\n DirectoryIsAFileError: `Unable to read \"{ oid }:{ filepath }\" because encountered a file where a directory was expected.`,\n TreeOrBlobNotFoundError: `No file or directory found at \"{ oid }:{ filepath }\".`,\n NotImplementedFail: `TODO: { thing } still needs to be implemented!`,\n ReadObjectFail: `Failed to read git object with oid { oid }`,\n NotAnOidFail: `Expected a 40-char hex object id but saw \"{ value }\".`,\n NoRefspecConfiguredError: `Could not find a fetch refspec for remote \"{ remote }\".\\\\nMake sure the config file has an entry like the following:\\\\n[remote \"{ remote }\"]\\\\nfetch = +refs/heads/*:refs/remotes/origin/*`,\n MismatchRefValueError: `Provided oldValue doesn\\\\'t match the actual value of \"{ ref }\".`,\n ResolveRefError: `Could not resolve reference \"{ ref }\".`,\n ExpandRefError: `Could not expand reference \"{ ref }\".`,\n EmptyServerResponseFail: `Empty response from git server.`,\n AssertServerResponseFail: `Expected \"{ expected }\" but got \"{ actual }\".`,\n HTTPError: `HTTP Error: { statusCode } { statusMessage }`,\n RemoteUrlParseError: `Cannot parse remote URL: \"{ url }\"`,\n UnknownTransportError: `Git remote \"{ url }\" uses an unrecognized transport protocol: \"{ transport }\"`,\n AcquireLockFileFail: `Unable to acquire lockfile \"{ filename }\". Exhausted tries.`,\n DoubleReleaseLockFileFail: `Cannot double-release lockfile \"{ filename }\".`,\n InternalFail: `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 UnknownOauth2Format: `I do not know how { company } expects its Basic Auth headers to be formatted for OAuth2 usage. If you do, you can use the regular username and password parameters to set the basic auth header yourself.`,\n MissingPasswordTokenError: `Missing password or token`,\n MissingUsernameError: `Missing username`,\n MixPasswordTokenError: `Cannot mix \"password\" with \"token\"`,\n MixUsernamePasswordTokenError: `Cannot mix \"username\" and \"password\" with \"token\"`,\n MissingTokenError: `Missing token`,\n MixUsernameOauth2formatMissingTokenError: `Cannot mix \"username\" with \"oauth2format\". Missing token.`,\n MixPasswordOauth2formatMissingTokenError: `Cannot mix \"password\" with \"oauth2format\". Missing token.`,\n MixUsernamePasswordOauth2formatMissingTokenError: `Cannot mix \"username\" and \"password\" with \"oauth2format\". Missing token.`,\n MixUsernameOauth2formatTokenError: `Cannot mix \"username\" with \"oauth2format\" and \"token\"`,\n MixPasswordOauth2formatTokenError: `Cannot mix \"password\" with \"oauth2format\" and \"token\"`,\n MixUsernamePasswordOauth2formatTokenError: `Cannot mix \"username\" and \"password\" with \"oauth2format\" and \"token\"`,\n MaxSearchDepthExceeded: `Maximum search depth of { depth } exceeded.`,\n PushRejectedNonFastForward: `Push rejected because it was not a simple fast-forward. Use \"force: true\" to override.`,\n PushRejectedTagExists: `Push rejected because tag already exists. Use \"force: true\" to override.`,\n AddingRemoteWouldOverwrite: `Adding remote { remote } would overwrite the existing remote. Use \"force: true\" to override.`,\n PluginUndefined: `A command required the \"{ plugin }\" plugin but it was undefined.`,\n CoreNotFound: `No plugin core with the name \"{ core }\" is registered.`,\n PluginSchemaViolation: `Schema check failed for \"{ plugin }\" plugin; missing { method } method.`,\n PluginUnrecognized: `Unrecognized plugin type \"{ plugin }\"`,\n AmbiguousShortOid: `Found multiple oids matching \"{ short }\" ({ matches }). Use a longer abbreviation length to disambiguate them.`,\n ShortOidNotFound: `Could not find an object matching \"{ short }\".`\n}\n\nexport const E = {\n FileReadError: `FileReadError`,\n MissingRequiredParameterError: `MissingRequiredParameterError`,\n InvalidRefNameError: `InvalidRefNameError`,\n InvalidParameterCombinationError: `InvalidParameterCombinationError`,\n RefExistsError: `RefExistsError`,\n RefNotExistsError: `RefNotExistsError`,\n BranchDeleteError: `BranchDeleteError`,\n NoHeadCommitError: `NoHeadCommitError`,\n CommitNotFetchedError: `CommitNotFetchedError`,\n ObjectTypeUnknownFail: `ObjectTypeUnknownFail`,\n ObjectTypeAssertionFail: `ObjectTypeAssertionFail`,\n ObjectTypeAssertionInTreeFail: `ObjectTypeAssertionInTreeFail`,\n ObjectTypeAssertionInRefFail: `ObjectTypeAssertionInRefFail`,\n ObjectTypeAssertionInPathFail: `ObjectTypeAssertionInPathFail`,\n MissingAuthorError: `MissingAuthorError`,\n MissingCommitterError: `MissingCommitterError`,\n MissingTaggerError: `MissingTaggerError`,\n GitRootNotFoundError: `GitRootNotFoundError`,\n UnparseableServerResponseFail: `UnparseableServerResponseFail`,\n InvalidDepthParameterError: `InvalidDepthParameterError`,\n RemoteDoesNotSupportShallowFail: `RemoteDoesNotSupportShallowFail`,\n RemoteDoesNotSupportDeepenSinceFail: `RemoteDoesNotSupportDeepenSinceFail`,\n RemoteDoesNotSupportDeepenNotFail: `RemoteDoesNotSupportDeepenNotFail`,\n RemoteDoesNotSupportDeepenRelativeFail: `RemoteDoesNotSupportDeepenRelativeFail`,\n RemoteDoesNotSupportSmartHTTP: `RemoteDoesNotSupportSmartHTTP`,\n CorruptShallowOidFail: `CorruptShallowOidFail`,\n FastForwardFail: `FastForwardFail`,\n MergeNotSupportedFail: `MergeNotSupportedFail`,\n DirectorySeparatorsError: `DirectorySeparatorsError`,\n ResolveTreeError: `ResolveTreeError`,\n ResolveCommitError: `ResolveCommitError`,\n DirectoryIsAFileError: `DirectoryIsAFileError`,\n TreeOrBlobNotFoundError: `TreeOrBlobNotFoundError`,\n NotImplementedFail: `NotImplementedFail`,\n ReadObjectFail: `ReadObjectFail`,\n NotAnOidFail: `NotAnOidFail`,\n NoRefspecConfiguredError: `NoRefspecConfiguredError`,\n MismatchRefValueError: `MismatchRefValueError`,\n ResolveRefError: `ResolveRefError`,\n ExpandRefError: `ExpandRefError`,\n EmptyServerResponseFail: `EmptyServerResponseFail`,\n AssertServerResponseFail: `AssertServerResponseFail`,\n HTTPError: `HTTPError`,\n RemoteUrlParseError: `RemoteUrlParseError`,\n UnknownTransportError: `UnknownTransportError`,\n AcquireLockFileFail: `AcquireLockFileFail`,\n DoubleReleaseLockFileFail: `DoubleReleaseLockFileFail`,\n InternalFail: `InternalFail`,\n UnknownOauth2Format: `UnknownOauth2Format`,\n MissingPasswordTokenError: `MissingPasswordTokenError`,\n MissingUsernameError: `MissingUsernameError`,\n MixPasswordTokenError: `MixPasswordTokenError`,\n MixUsernamePasswordTokenError: `MixUsernamePasswordTokenError`,\n MissingTokenError: `MissingTokenError`,\n MixUsernameOauth2formatMissingTokenError: `MixUsernameOauth2formatMissingTokenError`,\n MixPasswordOauth2formatMissingTokenError: `MixPasswordOauth2formatMissingTokenError`,\n MixUsernamePasswordOauth2formatMissingTokenError: `MixUsernamePasswordOauth2formatMissingTokenError`,\n MixUsernameOauth2formatTokenError: `MixUsernameOauth2formatTokenError`,\n MixPasswordOauth2formatTokenError: `MixPasswordOauth2formatTokenError`,\n MixUsernamePasswordOauth2formatTokenError: `MixUsernamePasswordOauth2formatTokenError`,\n MaxSearchDepthExceeded: `MaxSearchDepthExceeded`,\n PushRejectedNonFastForward: `PushRejectedNonFastForward`,\n PushRejectedTagExists: `PushRejectedTagExists`,\n AddingRemoteWouldOverwrite: `AddingRemoteWouldOverwrite`,\n PluginUndefined: `PluginUndefined`,\n CoreNotFound: `CoreNotFound`,\n PluginSchemaViolation: `PluginSchemaViolation`,\n PluginUnrecognized: `PluginUnrecognized`,\n AmbiguousShortOid: `AmbiguousShortOid`,\n ShortOidNotFound: `ShortOidNotFound`\n}\n\nfunction renderTemplate (template, values) {\n let result = template\n for (const key of Object.keys(values)) {\n let subs\n if (Array.isArray(values[key])) {\n subs = values[key].join(', ')\n } else {\n subs = String(values[key])\n }\n result = result.replace(new RegExp(`{ ${key} }`, 'g'), subs)\n }\n return result\n}\n\nexport class GitError extends Error {\n constructor (code, data) {\n super()\n this.name = code\n this.code = code\n this.data = data\n this.message = renderTemplate(messages[code], data || {})\n if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor)\n }\n\n toJSON () {\n return {\n code: this.code,\n data: this.data,\n caller: this.caller,\n message: this.message\n }\n }\n\n toString () {\n return this.stack.toString()\n }\n}\n","import pify from 'pify'\n\nimport { E, GitError } from '../models/GitError.js'\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { dirname } from '../utils/dirname.js'\nimport { sleep } from '../utils/sleep.js'\n\nconst delayedReleases = new Map()\nconst fsmap = new WeakMap()\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 // This is not actually the most logical place to put this, but in practice\n // putting the check here should work great.\n if (fs === undefined) {\n throw new GitError(E.PluginUndefined, { plugin: 'fs' })\n }\n // This is sad... but preserving reference equality is now necessary\n // to deal with cache invalidation in GitIndexManager.\n if (fsmap.has(fs)) {\n return fsmap.get(fs)\n }\n if (fsmap.has(fs._original_unwrapped_fs)) {\n return fsmap.get(fs._original_unwrapped_fs)\n }\n\n if (typeof fs._original_unwrapped_fs !== 'undefined') return fs\n\n if (\n Object.getOwnPropertyDescriptor(fs, 'promises') &&\n Object.getOwnPropertyDescriptor(fs, 'promises').enumerable\n ) {\n this._readFile = fs.promises.readFile.bind(fs.promises)\n this._writeFile = fs.promises.writeFile.bind(fs.promises)\n this._mkdir = fs.promises.mkdir.bind(fs.promises)\n this._rmdir = fs.promises.rmdir.bind(fs.promises)\n this._unlink = fs.promises.unlink.bind(fs.promises)\n this._stat = fs.promises.stat.bind(fs.promises)\n this._lstat = fs.promises.lstat.bind(fs.promises)\n this._readdir = fs.promises.readdir.bind(fs.promises)\n this._readlink = fs.promises.readlink.bind(fs.promises)\n this._symlink = fs.promises.symlink.bind(fs.promises)\n } else {\n this._readFile = pify(fs.readFile.bind(fs))\n this._writeFile = pify(fs.writeFile.bind(fs))\n this._mkdir = pify(fs.mkdir.bind(fs))\n this._rmdir = pify(fs.rmdir.bind(fs))\n this._unlink = pify(fs.unlink.bind(fs))\n this._stat = pify(fs.stat.bind(fs))\n this._lstat = pify(fs.lstat.bind(fs))\n this._readdir = pify(fs.readdir.bind(fs))\n this._readlink = pify(fs.readlink.bind(fs))\n this._symlink = pify(fs.symlink.bind(fs))\n }\n this._original_unwrapped_fs = fs\n fsmap.set(fs, this)\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 existance.\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 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 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 * 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 existance.\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 existance.\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 return this._readlink(filename, opts)\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 async lock (filename, triesLeft = 3) {\n // check to see if we still have it\n if (delayedReleases.has(filename)) {\n clearTimeout(delayedReleases.get(filename))\n delayedReleases.delete(filename)\n return\n }\n if (triesLeft === 0) {\n throw new GitError(E.AcquireLockFileFail, { filename })\n }\n try {\n await this._mkdir(`${filename}.lock`)\n } catch (err) {\n if (err.code === 'EEXIST') {\n await sleep(100)\n await this.lock(filename, triesLeft - 1)\n }\n }\n }\n\n async unlock (filename, delayRelease = 50) {\n if (delayedReleases.has(filename)) {\n throw new GitError(E.DoubleReleaseLockFileFail, { filename })\n }\n // Basically, we lie and say it was deleted ASAP.\n // But really we wait a bit to see if you want to acquire it again.\n delayedReleases.set(\n filename,\n setTimeout(async () => {\n delayedReleases.delete(filename)\n await this._rmdir(`${filename}.lock`)\n }, delayRelease)\n )\n }\n}\n","export function normalizePath (path) {\n return path\n .replace(/\\/\\.\\//g, '/') // Replace '/./' with '/'\n .replace(/\\/{2,}/g, '/') // Replace consecutive '/'\n .replace(/^\\/\\.$/, '/') // if path === '/.' return '/'\n .replace(/^\\.\\/$/, '.') // if path === './' return '.'\n .replace(/^\\.\\//, '') // Remove leading './'\n .replace(/\\/\\.$/, '') // Remove trailing '/.'\n .replace(/(.+)\\/$/, '$1') // Remove trailing '/'\n .replace(/^$/, '.') // if path === '' return '.'\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","import { E, GitError } from '../models/GitError'\n\n// A collection of plugins is called a core.\n// 99.99% of the time you will only need a single core,\n// Because if you load isomorphic-git in an entirely new execution context\n// (say a WebWorker) you'll have an entirely separate instance of the module itself\n// and therefore a separate core. HOWEVER, for testing purposes, or a weird\n// multi-tenant environment where you need two distinct instances of isomorphic-git's\n// plugin stack but they share the same module instance - IDK maybe you are writing\n// a tool that copies git objects between different filesystems so you want two\n// cores with different filesystem modules. Anyway, it is architected that way.\n\nclass PluginCore extends Map {\n set (key, value) {\n const verifySchema = (key, value) => {\n // ugh. this sucks\n if (\n key === 'fs' &&\n Object.getOwnPropertyDescriptor(value, 'promises') &&\n Object.getOwnPropertyDescriptor(value, 'promises').enumerable\n ) {\n value = value.promises\n }\n const pluginSchemas = {\n credentialManager: ['fill', 'approved', 'rejected'],\n emitter: ['emit'],\n fs: [\n 'lstat',\n 'mkdir',\n 'readdir',\n 'readFile',\n 'rmdir',\n 'stat',\n 'unlink',\n 'writeFile'\n ],\n pgp: ['sign', 'verify'],\n http: []\n }\n if (!Object.prototype.hasOwnProperty.call(pluginSchemas, key)) {\n throw new GitError(E.PluginUnrecognized, { plugin: key })\n }\n for (const method of pluginSchemas[key]) {\n if (value[method] === undefined) {\n throw new GitError(E.PluginSchemaViolation, { plugin: key, method })\n }\n }\n }\n verifySchema(key, value)\n // There can be only one.\n super.set(key, value)\n }\n\n get (key) {\n // Critical plugins throw an error instead of returning undefined.\n const critical = new Set(['credentialManager', 'fs', 'pgp'])\n if (!super.has(key) && critical.has(key)) {\n throw new GitError(E.PluginUndefined, { plugin: key })\n }\n return super.get(key)\n }\n}\n\n// 99.99% of the time you can simply import { plugins } instead of cores.\nexport const plugins = new PluginCore()\n\nconst _cores = new Map([['default', plugins]])\n\nexport const cores = {\n // 'get' validates that a core has been registered\n get (key) {\n if (_cores.has(key)) {\n return _cores.get(key)\n } else {\n throw new GitError(E.CoreNotFound, { core: key })\n }\n },\n // 'create' works just like get but will create the core if it doesn't exist yet\n create (key) {\n if (_cores.has(key)) {\n return _cores.get(key)\n } else {\n _cores.set(key, new Map())\n return _cores.get(key)\n }\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 { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.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\nexport class GitRefManager {\n static async updateRemoteRefs ({\n fs: _fs,\n gitdir,\n remote,\n refs,\n symrefs,\n tags,\n refspecs = undefined,\n prune = false\n }) {\n const fs = new FileSystem(_fs)\n // Validate input\n for (const value of refs.values()) {\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new GitError(E.NotAnOidFail, { 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 GitError(E.NoRefspecConfiguredError, { 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 // 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 const filename = join(gitdir, serverRef)\n // Git's behavior is to only fetch tags that do not conflict with tags already present.\n if (!(await fs.exists(filename))) {\n // If there is a dereferenced an annotated tag value available, prefer that.\n const oid = refs.get(serverRef + '^{}') || 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 = (await this.listRefs({ fs, gitdir, filepath })).map(\n file => `${filepath}/${file}`\n )\n for (const ref of refs) {\n if (!actualRefsToWrite.has(ref)) {\n this.deleteRef({ fs, gitdir, ref })\n pruned.push(ref)\n }\n }\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 fs.write(join(gitdir, key), `${value.trim()}\\n`, 'utf8')\n }\n return { pruned }\n }\n\n // TODO: make this less crude?\n static async writeRef ({ fs: _fs, gitdir, ref, value }) {\n const fs = new FileSystem(_fs)\n // Validate input\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new GitError(E.NotAnOidFail, { value })\n }\n await fs.write(join(gitdir, ref), `${value.trim()}\\n`, 'utf8')\n }\n\n static async writeSymbolicRef ({ fs: _fs, gitdir, ref, value }) {\n const fs = new FileSystem(_fs)\n await fs.write(join(gitdir, ref), 'ref: ' + `${value.trim()}\\n`, 'utf8')\n }\n\n static async deleteRef ({ fs: _fs, gitdir, ref }) {\n const fs = new FileSystem(_fs)\n // Delete regular ref\n await fs.rm(join(gitdir, ref))\n // Delete any packed ref\n let text = await fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\n const packed = GitPackedRefs.from(text)\n if (packed.refs.has(ref)) {\n packed.delete(ref)\n text = packed.toString()\n await fs.write(`${gitdir}/packed-refs`, text, { encoding: 'utf8' })\n }\n }\n\n static async resolve ({ fs: _fs, gitdir, ref, depth = undefined }) {\n const fs = new FileSystem(_fs)\n if (depth !== undefined) {\n depth--\n if (depth === -1) {\n return ref\n }\n }\n let sha\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 sha =\n (await fs.read(`${gitdir}/${ref}`, { encoding: 'utf8' })) ||\n packedMap.get(ref)\n if (sha) {\n return GitRefManager.resolve({ fs, gitdir, ref: sha.trim(), depth })\n }\n }\n // Do we give up?\n throw new GitError(E.ResolveRefError, { 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: _fs, gitdir, ref }) {\n const fs = new FileSystem(_fs)\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 if (await fs.exists(`${gitdir}/${ref}`)) return ref\n if (packedMap.has(ref)) return ref\n }\n // Do we give up?\n throw new GitError(E.ExpandRefError, { 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 GitError(E.ExpandRefError, { 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 GitError(E.ResolveRefError, { ref })\n }\n\n static async packedRefs ({ fs: _fs, gitdir }) {\n const fs = new FileSystem(_fs)\n const text = await fs.read(`${gitdir}/packed-refs`, { encoding: 'utf8' })\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: _fs, gitdir, filepath }) {\n const fs = new FileSystem(_fs)\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: _fs, gitdir, remote }) {\n const fs = new FileSystem(_fs)\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: _fs, gitdir }) {\n const fs = new FileSystem(_fs)\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 pako from 'pako'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitObject } from '../models/GitObject.js'\nimport { readObjectLoose } from '../storage/readObjectLoose.js'\nimport { readObjectPacked } from '../storage/readObjectPacked.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function readObject ({ fs: _fs, gitdir, oid, format = 'content' }) {\n const fs = new FileSystem(_fs)\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, 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({ fs, gitdir, oid, getExternalRefDelta })\n }\n // Finally\n if (!result) {\n throw new GitError(E.ReadObjectFail, { oid })\n }\n\n if (format === 'deflated') {\n return result\n }\n\n // BEHOLD! THE ONLY TIME I'VE EVER WANTED TO USE A CASE STATEMENT WITH FOLLOWTHROUGH!\n // eslint-ignore\n /* eslint-disable no-fallthrough */\n switch (result.format) {\n case 'deflated':\n result.object = Buffer.from(pako.inflate(result.object))\n result.format = 'wrapped'\n case 'wrapped':\n if (format === 'wrapped' && result.format === 'wrapped') {\n return result\n }\n const sha = shasum(result.object)\n if (sha !== oid) {\n throw new GitError(E.InternalFail, {\n message: `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 case 'content':\n if (format === 'content') return result\n break\n default:\n throw new GitError(E.InternalFail, {\n message: `invalid format \"${result.format}\"`\n })\n }\n /* eslint-enable no-fallthrough */\n}\n","/* global performance */\nvar perf = typeof performance !== 'undefined' && performance;\n\nvar now = perf && perf.now ? function () { return perf.now(); } : function () { return Date.now(); };\n\nfunction throwIfEmpty (name) {\n if (!name) {\n throw new Error('name must be non-empty')\n }\n}\n\n// simple binary sort insertion\nfunction insertSorted (arr, item) {\n var low = 0;\n var high = arr.length;\n var mid;\n while (low < high) {\n mid = (low + high) >>> 1; // like (num / 2) but faster\n if (arr[mid].startTime < item.startTime) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n arr.splice(low, 0, item);\n}\n\nvar mark;\nvar stop;\nvar getEntries;\nvar clear;\n\nif (perf && perf.mark) {\n mark = function (name) {\n throwIfEmpty(name);\n perf.mark((\"start \" + name));\n };\n stop = function (name) {\n throwIfEmpty(name);\n perf.mark((\"end \" + name));\n perf.measure(name, (\"start \" + name), (\"end \" + name));\n var entries = perf.getEntriesByName(name);\n return entries[entries.length - 1]\n };\n getEntries = function () { return perf.getEntriesByType('measure'); };\n clear = function () {\n perf.clearMarks();\n perf.clearMeasures();\n };\n} else {\n var marks = {};\n var entries = [];\n mark = function (name) {\n throwIfEmpty(name);\n var startTime = now();\n marks['$' + name] = startTime;\n };\n stop = function (name) {\n throwIfEmpty(name);\n var endTime = now();\n var startTime = marks['$' + name];\n if (!startTime) {\n throw new Error((\"no known mark: \" + name))\n }\n var entry = {\n startTime: startTime,\n name: name,\n duration: endTime - startTime,\n entryType: 'measure'\n };\n // per the spec this should be at least 150:\n // https://www.w3.org/TR/resource-timing-1/#extensions-performance-interface\n // we just have no limit, per Chrome and Edge's de-facto behavior\n insertSorted(entries, entry);\n return entry\n };\n getEntries = function () { return entries; };\n clear = function () {\n marks = {};\n entries = [];\n };\n}\n\nexport { mark, stop, getEntries, clear };\n","import { E, GitError } from '../models/GitError.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 GitError(E.InternalFail, {\n message: 'invalid type passed to GitCommit constructor'\n })\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 GitError(E.InternalFail, {\n message: `commit 'parent' property should be an array`\n })\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, pgp, secretKey) {\n const payload = commit.withoutSignature()\n const message = GitCommit.justMessage(commit._commit)\n let { signature } = await pgp.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 static async verify (commit, pgp, publicKey) {\n const payload = commit.withoutSignature()\n const signature = commit.isolateSignature()\n return pgp.verify({ payload, publicKey, signature })\n }\n}\n","let shouldLog = null\n\nexport function log (...args) {\n if (shouldLog === null) {\n shouldLog =\n (process &&\n process.env &&\n process.env.DEBUG &&\n (process.env.DEBUG === '*' ||\n process.env.DEBUG === 'isomorphic-git')) ||\n (typeof window !== 'undefined' &&\n typeof window.localStorage !== 'undefined' &&\n (window.localStorage.debug === '*' ||\n window.localStorage.debug === 'isomorphic-git'))\n }\n if (shouldLog) {\n console.log(...args)\n }\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 implementors 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 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 const buffer = await reader.read(length - 4)\n if (buffer == null) return true\n return buffer\n } catch (err) {\n console.log('error', err)\n return true\n }\n }\n }\n}\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 { E, GitError } from '../models/GitError.js'\nimport { comparePath } from '../utils/comparePath.js'\n\n/*::\ntype TreeEntry = {\n mode: string,\n path: string,\n oid: string,\n type?: string\n}\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 GitError(E.InternalFail, {\n message: `Unexpected GitTree entry mode: ${mode}`\n })\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 GitError(E.InternalFail, {\n message: `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 GitError(E.InternalFail, {\n message: `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 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 GitError(E.InternalFail, {\n message: `Could not understand file mode: ${mode}`\n })\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 = 'blob' // index\n }\n return entry\n}\n\nexport class GitTree {\n /*::\n _entries: Array\n */\n constructor (entries) {\n if (Buffer.isBuffer(entries)) {\n this._entries = parseBuffer(entries)\n // There appears to be an edge case (in this repo no less) where\n // the tree is NOT sorted as expected if some directories end with \".git\"\n this._entries.sort(comparePath)\n } else if (Array.isArray(entries)) {\n this._entries = entries.map(nudgeIntoShape)\n } else {\n throw new GitError(E.InternalFail, {\n message: 'invalid type passed to GitTree constructor'\n })\n }\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 return Buffer.concat(\n this._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 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 Hash from 'sha.js/sha1'\n\n// This is modeled after @dominictarr's \"shasum\" module,\n// but without the 'json-stable-stringify' dependency and\n// extra type-casting features.\nexport function shasum (buffer) {\n return new Hash().update(buffer).digest('hex')\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 { E, GitError } from '../models/GitError.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 GitError(E.InternalFail, {\n message: '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.signature ? obj.signature : ''}`\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 signature: this.signature()\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 signature () {\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 toObject () {\n return Buffer.from(this._tag, 'utf8')\n }\n\n static async sign (tag, pgp, secretKey) {\n const payload = tag.withoutSignature() + '\\n'\n let { signature } = await pgp.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 static async verify (tag, pgp, publicKey) {\n const payload = tag.withoutSignature() + '\\n'\n const signature = tag.signature()\n return pgp.verify({ payload, publicKey, signature })\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","const deepget = (keys, map) => {\n for (const key of keys) {\n if (!map.has(key)) map.set(key, new Map())\n map = map.get(key)\n }\n return map\n}\n\nexport class DeepMap {\n constructor () {\n this._root = new Map()\n }\n\n set (keys, value) {\n const lastKey = keys.pop()\n const lastMap = deepget(keys, this._root)\n lastMap.set(lastKey, value)\n }\n\n get (keys) {\n const lastKey = keys.pop()\n const lastMap = deepget(keys, this._root)\n return lastMap.get(lastKey)\n }\n\n has (keys) {\n const lastKey = keys.pop()\n const lastMap = deepget(keys, this._root)\n return lastMap.has(lastKey)\n }\n}\n","// import LockManager from 'travix-lock-manager'\nimport AsyncLock from 'async-lock'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitIndex } from '../models/GitIndex.js'\nimport { DeepMap } from '../utils/DeepMap.js'\nimport { compareStats } from '../utils/compareStats.js'\n\n// import Lock from '../utils.js'\n\n// TODO: replace with an LRU cache?\nconst map = new DeepMap()\nconst stats = new DeepMap()\n// const lm = new LockManager()\nlet lock = null\n\nasync function updateCachedIndexFile (fs, filepath) {\n const stat = await fs.lstat(filepath)\n const rawIndexFile = await fs.read(filepath)\n const index = GitIndex.from(rawIndexFile)\n // cache the GitIndex object so we don't need to re-read it\n // every time.\n map.set([fs, filepath], index)\n // Save the stat data for the index so we know whether\n // the cached file is stale (modified by an outside process).\n stats.set([fs, filepath], stat)\n}\n\n// Determine whether our copy of the index file is stale\nasync function isIndexStale (fs, filepath) {\n const savedStats = stats.get([fs, 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 static async acquire ({ fs: _fs, filepath }, closure) {\n const fs = new FileSystem(_fs)\n if (lock === null) lock = new AsyncLock({ maxPending: Infinity })\n await lock.acquire(filepath, async function () {\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)) {\n await updateCachedIndexFile(fs, filepath)\n }\n const index = map.get([fs, filepath])\n 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 = index.toObject()\n await fs.write(filepath, buffer)\n // Update cached stat value\n stats.set([fs, filepath], await fs.lstat(filepath))\n index._dirty = false\n }\n })\n }\n}\n","import { E, GitError } from '../models/GitError.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 GitError(E.InternalFail, {\n message: `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","// 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","// 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 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","import pako from 'pako'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitObject } from '../models/GitObject.js'\nimport { writeObjectLoose } from '../storage/writeObjectLoose.js'\nimport { shasum } from '../utils/shasum.js'\n\nexport async function writeObject ({\n fs: _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 = shasum(object)\n object = Buffer.from(pako.deflate(object))\n }\n if (!dryRun) {\n const fs = new FileSystem(_fs)\n await writeObjectLoose({ fs, gitdir, object, format: 'deflated', oid })\n }\n return oid\n}\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","import { FileSystem } from '../models/FileSystem.js'\nimport { GitConfig } from '../models/GitConfig.js'\n\nexport class GitConfigManager {\n static async get ({ fs: _fs, gitdir }) {\n const fs = new FileSystem(_fs)\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: _fs, gitdir, config }) {\n const fs = new FileSystem(_fs)\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","'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","export const pkg = {\n name: 'isomorphic-git',\n version: '0.65.1',\n agent: 'git/isomorphic-git@0.65.1'\n}\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 { 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","// 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 GitWalkerSymbol = Symbol('GitWalkerSymbol')\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","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","import { GitRefManager } from '../managers/GitRefManager.js'\nimport { E } from '../models/GitError.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join'\nimport { resolveTree } from '../utils/resolveTree.js'\n\nimport { FileSystem } from './FileSystem.js'\nimport { GitTree } from './GitTree.js'\n\nexport class GitWalkerRepo {\n constructor ({ fs: _fs, gitdir, ref }) {\n const fs = new FileSystem(_fs)\n this.fs = fs\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 // Handle fresh branches with no commits\n if (e.code === E.ResolveRefError) {\n oid = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'\n }\n }\n const tree = await resolveTree({ fs, gitdir, oid })\n tree.type = 'tree'\n map.set('.', tree)\n return map\n })()\n const walker = this\n this.ConstructEntry = class RepoEntry {\n constructor (entry) {\n Object.assign(this, entry)\n }\n\n async populateStat () {\n if (!this.exists) return\n await walker.populateStat(this)\n }\n\n async populateContent () {\n if (!this.exists) return\n await walker.populateContent(this)\n }\n\n async populateHash () {\n if (!this.exists) return\n await walker.populateHash(this)\n }\n }\n }\n\n async readdir (entry) {\n if (!entry.exists) return []\n const filepath = entry.fullpath\n const { fs, 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 === 'commit') {\n // TODO: support submodules\n return null\n }\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type === 'blob') return null\n if (type !== 'tree') {\n throw new Error(`ENOTDIR: not a directory, scandir '${filepath}'`)\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 => ({\n fullpath: join(filepath, entry.path),\n basename: entry.path,\n exists: true\n }))\n }\n\n async populateStat (entry) {\n // All we can add here is mode and type.\n const map = await this.mapPromise\n const stats = map.get(entry.fullpath)\n if (!stats) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry.fullpath}'`\n )\n }\n const { mode, type } = stats\n Object.assign(entry, { mode, type })\n }\n\n async populateContent (entry) {\n const map = await this.mapPromise\n const { fs, gitdir } = this\n const obj = map.get(entry.fullpath)\n if (!obj) throw new Error(`No obj for ${entry.fullpath}`)\n const oid = obj.oid\n if (!oid) throw new Error(`No oid for entry ${JSON.stringify(obj)}`)\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type === 'tree') {\n throw new Error(`EISDIR: illegal operation on a directory, read`)\n }\n Object.assign(entry, { content: object })\n }\n\n async populateHash (entry) {\n const map = await this.mapPromise\n const obj = map.get(entry.fullpath)\n if (!obj) {\n throw new Error(\n `ENOENT: no such file or directory, open '${entry.fullpath}'`\n )\n }\n const oid = obj.oid\n Object.assign(entry, { oid })\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitWalkerRepo } from '../models/GitWalkerRepo.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\nimport { GitWalkerSymbol } from '../utils/symbols.js'\n\n/**\n *\n * @typedef Walker\n * @property {Symbol} Symbol('GitWalkerSymbol')\n */\n\n/**\n * Get a git commit Walker\n *\n * See [walkBeta1](./walkBeta1.md)\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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'] - [required] The commit to walk\n *\n * @returns {Walker} Returns a git commit Walker\n *\n */\nexport function TREE ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref = 'HEAD'\n}) {\n const fs = new FileSystem(_fs)\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkerSymbol, {\n value: function () {\n return new GitWalkerRepo({ fs, gitdir, ref })\n }\n })\n Object.freeze(o)\n return o\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","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","export function indent (str) {\n return (\n str\n .trim()\n .split('\\n')\n .map(x => ' ' + x)\n .join('\\n') + '\\n'\n )\n}\n","import { forAwait } from './forAwait.js'\n\nexport async function collect (iterable) {\n const buffers = []\n // This will be easier once `for await ... of` loops are available.\n await forAwait(iterable, value => buffers.push(Buffer.from(value)))\n return Buffer.concat(buffers)\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 { 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'\nimport applyDelta from 'git-apply-delta'\nimport * as marky from 'marky'\nimport pako from 'pako'\n\nimport { E, GitError } from '../models/GitError.js'\nimport { BufferCursor } from '../utils/BufferCursor.js'\nimport { listpack } from '../utils/git-list-pack.js'\nimport { log } from '../utils/log.js'\nimport { shasum } from '../utils/shasum.js'\n\nimport { GitObject } from './GitObject'\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 marky.mark('fromIdx')\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 GitError(E.InternalFail, {\n message: `Unable to read version ${version} packfile IDX. (Only version 2 supported)`\n })\n }\n if (idx.byteLength > 2048 * 1024 * 1024) {\n throw new GitError(E.InternalFail, {\n message: `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 marky.mark('hashes')\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 log(`hashes ${marky.stop('hashes').duration}`)\n reader.seek(reader.tell() + 4 * size)\n // Skip over CRCs\n marky.mark('offsets')\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 log(`offsets ${marky.stop('offsets').duration}`)\n const packfileSha = reader.slice(20).toString('hex')\n log(`fromIdx ${marky.stop('fromIdx').duration}`)\n return new GitPackIndex({\n hashes,\n crcs: {},\n offsets,\n packfileSha,\n getExternalRefDelta\n })\n }\n\n static async fromPack ({ pack, getExternalRefDelta, emitter, emitterPrefix }) {\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 const times = {\n hash: 0,\n readSlice: 0,\n offsets: 0,\n crcs: 0,\n sort: 0\n }\n let histogram = {\n commit: 0,\n tree: 0,\n blob: 0,\n tag: 0,\n 'ofs-delta': 0,\n 'ref-delta': 0\n }\n let bytesProcessed = 0\n\n log('Indexing objects')\n log(\n `percent\\tmilliseconds\\tbytesProcessed\\tcommits\\ttrees\\tblobs\\ttags\\tofs-deltas\\tref-deltas`\n )\n marky.mark('total')\n marky.mark('offsets')\n marky.mark('percent')\n await listpack([pack], ({ 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 (emitter) {\n emitter.emit(`${emitterPrefix}progress`, {\n phase: 'Receiving objects',\n loaded: totalObjectCount - num,\n total: totalObjectCount,\n lengthComputable: true\n })\n }\n log(\n `${percent}%\\t${Math.floor(\n marky.stop('percent').duration\n )}\\t${bytesProcessed}\\t${histogram.commit}\\t${histogram.tree}\\t${\n histogram.blob\n }\\t${histogram.tag}\\t${histogram['ofs-delta']}\\t${\n histogram['ref-delta']\n }`\n )\n\n histogram = {\n commit: 0,\n tree: 0,\n blob: 0,\n tag: 0,\n 'ofs-delta': 0,\n 'ref-delta': 0\n }\n bytesProcessed = 0\n marky.mark('percent')\n }\n lastPercent = percent\n // Change type from a number to a meaningful string\n type = listpackTypes[type]\n\n histogram[type]++\n bytesProcessed += data.byteLength\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 times['offsets'] = Math.floor(marky.stop('offsets').duration)\n\n log('Computing CRCs')\n marky.mark('crcs')\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 times['crcs'] = Math.floor(marky.stop('crcs').duration)\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 log('Resolving deltas')\n log(`percent2\\tmilliseconds2\\tcallsToReadSlice\\tcallsToGetExternal`)\n marky.mark('percent')\n lastPercent = null\n let count = 0\n let callsToReadSlice = 0\n let callsToGetExternal = 0\n const timeByDepth = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 log(\n `${percent}%\\t${Math.floor(\n marky.stop('percent').duration\n )}\\t${callsToReadSlice}\\t${callsToGetExternal}`\n )\n if (emitter) {\n emitter.emit(`${emitterPrefix}progress`, {\n phase: 'Resolving deltas',\n loaded: count,\n total: totalObjectCount,\n lengthComputable: true\n })\n }\n marky.mark('percent')\n callsToReadSlice = 0\n callsToGetExternal = 0\n }\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 marky.mark('readSlice')\n const { type, object } = await p.readSlice({ start: offset })\n const time = marky.stop('readSlice').duration\n times.readSlice += time\n callsToReadSlice += p.readDepth\n callsToGetExternal += p.externalReadDepth\n timeByDepth[p.readDepth] += time\n objectsByDepth[p.readDepth] += 1\n marky.mark('hash')\n const oid = shasum(GitObject.wrap({ type, object }))\n times.hash += marky.stop('hash').duration\n o.oid = oid\n hashes.push(oid)\n offsets.set(oid, offset)\n crcs[oid] = o.crc\n } catch (err) {\n log('ERROR', err)\n continue\n }\n }\n\n marky.mark('sort')\n hashes.sort()\n times['sort'] = Math.floor(marky.stop('sort').duration)\n const totalElapsedTime = marky.stop('total').duration\n times.hash = Math.floor(times.hash)\n times.readSlice = Math.floor(times.readSlice)\n times.misc = Math.floor(\n Object.values(times).reduce((a, b) => a - b, totalElapsedTime)\n )\n log(Object.keys(times).join('\\t'))\n log(Object.values(times).join('\\t'))\n log('by depth:')\n log([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].join('\\t'))\n log(objectsByDepth.slice(0, 12).join('\\t'))\n log(\n timeByDepth\n .map(Math.floor)\n .slice(0, 12)\n .join('\\t')\n )\n return p\n }\n\n 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 = 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 GitError(E.InternalFail, {\n message: `Could not read object ${oid} from packfile`\n })\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 GitError(E.InternalFail, {\n message:\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 GitError(E.InternalFail, {\n message: 'Unrecognized type: 0b' + btype.toString(2)\n })\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(pako.inflate(buffer))\n // Assert that the object length is as expected.\n if (object.byteLength !== length) {\n throw new GitError(E.InternalFail, {\n message: `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","// 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","// 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'\nimport { basename } from '../utils/basename.js'\n\n// Take an array of length N of\n// iterators of length Q_n\n// of objects with a property 'fullname'\n// and return an iterator of length max(Q_n) for all n\n// of arrays of length N\n// of objects who all have the same value for 'fullname'\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].fullpath)\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].fullpath === minimum) {\n result[i] = heads[i]\n heads[i] = sets[i].next().value\n } else {\n // A little hacky, but eh\n result[i] = {\n fullpath: minimum,\n basename: basename(minimum),\n exists: false\n }\n }\n if (heads[i] !== undefined) {\n min.consider(heads[i].fullpath)\n }\n }\n // if (result.reduce((y, a) => y && (a === null), true)) {\n // return\n // }\n yield result\n if (min.value === null) return\n }\n}\n","// @ts-check\nimport { arrayRange } from '../utils/arrayRange.js'\nimport { flat } from '../utils/flat.js'\nimport { GitWalkerSymbol } from '../utils/symbols.js'\nimport { unionOfIterators } from '../utils/unionOfIterators.js'\n\n/**\n *\n * @typedef {Object} Walker\n * @property {Symbol} Symbol('GitWalkerSymbol')\n */\n\n/**\n *\n * @typedef {Object} WalkerEntry The `WalkerEntry` is an interface that abstracts computing many common tree / blob stats.\n * @property {string} fullpath\n * @property {string} basename\n * @property {boolean} exists\n * @property {Function} populateStat\n * @property {'tree'|'blob'|'special'|'commit'} [type]\n * @property {number} [ctimeSeconds]\n * @property {number} [ctimeNanoseconds]\n * @property {number} [mtimeSeconds]\n * @property {number} [mtimeNanoseconds]\n * @property {number} [dev]\n * @property {number} [ino]\n * @property {number|string} [mode] WORKDIR and STAGE return numbers, TREE returns a string... I'll fix this in walkBeta2\n * @property {number} [uid]\n * @property {number} [gid]\n * @property {number} [size]\n * @property {Function} populateContent\n * @property {Buffer} [content]\n * @property {Function} populateHash\n * @property {string} [oid]\n */\n\n/**\n * A powerful recursive tree-walking utility.\n *\n * The `walk` API (tentatively named `walkBeta1`) simplifies gathering detailed information about a tree or comparing all the filepaths in two or more trees.\n * Trees can be file directories, git commits, or git indexes (aka staging areas).\n * So you can compare two file directories, or 10 commits, or the stage of one repo with the working directory of another repo... etc.\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 4 optional transform functions:\n * `filter`, `map`, `reduce`, and `iterate`.\n *\n * The trees are represented by three magic functions that can be imported:\n * ```js\n * import { TREE, WORKDIR, STAGE } from 'isomorphic-git'\n * ```\n *\n * These functions return objects that implement the `Walker` interface.\n * The only thing they are good for is passing into `walkBeta1`'s `trees` argument.\n * Here are the three `Walker`s passed into `walkBeta1` by the `statusMatrix` command for example:\n *\n * ```js\n * let gitdir = '.git'\n * let dir = '.'\n * let ref = 'HEAD'\n *\n * let trees = [\n * TREE({fs, gitdir, ref}),\n * WORKDIR({fs, dir, gitdir}),\n * STAGE({fs, gitdir})\n * ]\n * ```\n *\n * See the doc pages for [TREE](./TREE.md), [WORKDIR](./WORKDIR.md), and [STAGE](./STAGE.md).\n *\n * `filter`, `map`, `reduce`, and `iterate` allow you control the recursive walk by pruning and transforming `WalkerTree`s into the desired result.\n *\n * ## WalkerEntry\n * The `WalkerEntry` is an interface that abstracts computing many common tree / blob stats.\n * `filter` and `map` each receive an array of `WalkerEntry[]` as their main argument, one `WalkerEntry` for each `Walker` in the `trees` argument.\n *\n * By default, `WalkerEntry`s only have three properties:\n * ```js\n * {\n * fullpath: string;\n * basename: string;\n * exists: boolean;\n * }\n * ```\n *\n * Additional properties can be computed only when needed. This lets you build lean, mean, efficient walking machines.\n * ```js\n * await entry.populateStat()\n * // populates\n * entry.type // 'tree', 'blob'\n * // and where applicable, these properties:\n * entry.ctimeSeconds // number;\n * entry.ctimeNanoseconds // number;\n * entry.mtimeSeconds // number;\n * entry.mtimeNanoseconds // number;\n * entry.dev // number;\n * entry.ino // number;\n * entry.mode // number;\n * entry.uid // number;\n * entry.gid // number;\n * entry.size // number;\n * ```\n *\n * ```js\n * await entry.populateContent()\n * // populates\n * entry.content // Buffer\n * // except for STAGE which does not currently provide content\n * ```\n *\n * ```js\n * await entry.populateHash()\n * // populates\n * entry.oid // SHA1 string\n * ```\n *\n * ## filter(WalkerEntry[]) => boolean\n *\n * Default: `async () => true`.\n *\n * This is a good place to put limiting logic such as skipping entries with certain filenames.\n * If you return false for directories, then none of the children of that directory will be walked.\n *\n * Example:\n * ```js\n * let path = require('path')\n * let cwd = 'src/app'\n * // Only examine files in the directory `cwd`\n * async function filter ([head, workdir, stage]) {\n * // It doesn't matter which tree (head, workdir, or stage) you use here.\n * return (\n * // return true for the root directory\n * head.fullpath === '.' ||\n * // return true for 'src' and 'src/app'\n * cwd.startsWith(head.fullpath) ||\n * // return true for 'src/app/*'\n * path.dirname(head.fullpath) === cwd\n * )\n * }\n * ```\n *\n * ## map(WalkerEntry[]) => any\n *\n * Default: `async entry => entry`\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([head, workdir]) {\n * await workdir.populateContent()\n * let content = workdir.content.toString('utf8')\n * if (content.contains('foo')) {\n * return {\n * fullpath: workdir.fullpath,\n * content\n * }\n * }\n * }\n *\n * ```\n *\n * Example 2: Return the difference between the working directory and the HEAD commit\n * ```js\n * const diff = require('diff-lines')\n * async function map([head, workdir]) {\n * await head.populateContent()\n * await head.populateHash()\n * await workdir.populateContent()\n * return {\n * filename: head.fullpath,\n * oid: head.oid,\n * diff: diff(head.content.toString('utf8'), workdir.content.toString('utf8'))\n * }\n * }\n * ```\n *\n * ## reduce(parent, children)\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 * 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 * > Note: For a complete example, look at the implementation of `statusMatrix`.\n *\n * @param {object} args\n * @param {Walker[]} args.trees - The trees you want to traverse\n * @param {function(WalkerEntry[]): Promise} [args.filter] - Filter which `WalkerEntry`s to process\n * @param {function(WalkerEntry[]): Promise} [args.map] - Transform `WalkerEntry`s into a result form\n * @param {function(any, any[]): Promise} [args.reduce] - Control how mapped entries are combined with their parent result\n * @param {function(function(WalkerEntry[]): Promise, IterableIterator): Promise} [args.iterate] - Fine-tune how entries within a tree are iterated over\n *\n * @returns {Promise} The finished tree-walking result\n *\n * @see WalkerEntry\n *\n */\nexport async function walkBeta1 ({\n trees,\n filter = async () => true,\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 try {\n const walkers = trees.map(proxy => proxy[GitWalkerSymbol]())\n\n const root = new Array(walkers.length).fill({\n fullpath: '.',\n basename: '.',\n exists: true\n })\n const range = arrayRange(0, walkers.length)\n const unionWalkerFromReaddir = async entry => {\n const subdirs = await Promise.all(\n range.map(i => walkers[i].readdir(entry[i]))\n )\n range.map(i => {\n entry[i] = new walkers[i].ConstructEntry(entry[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 entry,\n children: unionOfIterators(iterators)\n }\n }\n\n const walk = async root => {\n const { children, entry } = await unionWalkerFromReaddir(root)\n if (await filter(entry)) {\n const parent = await map(entry)\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 } catch (err) {\n err.caller = 'git.walk'\n throw err\n }\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","export function compareStrings (a, b) {\n // https://stackoverflow.com/a/40355107/2168416\n return -(a < b) || +(a > b)\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 if (userpass == null) return null\n userpass = userpass[1]\n const [username, password] = userpass.split(':')\n url = url.replace(`${userpass}@`, '')\n return { url, username, password }\n}\n","import { E, GitError } from '../models/GitError.js'\nimport { calculateBasicAuthHeader } from '../utils/calculateBasicAuthHeader.js'\nimport { calculateBasicAuthUsernamePasswordPair } from '../utils/calculateBasicAuthUsernamePasswordPair.js'\nimport { extractAuthFromUrl } from '../utils/extractAuthFromUrl.js'\nimport { http as builtinHttp } from '../utils/http.js'\nimport { pkg } from '../utils/pkg.js'\nimport { cores } from '../utils/plugins.js'\nimport { parseRefsAdResponse } from '../wire/parseRefsAdResponse.js'\n\n// Try to accomodate 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\nexport class GitRemoteHTTP {\n static async capabilities () {\n return ['discover', 'connect']\n }\n\n static async discover ({\n core,\n corsProxy,\n service,\n url,\n noGitSuffix,\n auth,\n headers\n }) {\n const _origUrl = url\n // Auto-append the (necessary) .git if it's missing.\n if (!url.endsWith('.git') && !noGitSuffix) url = url += '.git'\n const urlAuth = extractAuthFromUrl(url)\n if (urlAuth) {\n url = urlAuth.url\n // To try to be backwards compatible with simple-get's behavior, which uses Node's http.request\n // setting an Authorization header will override what is in the URL.\n // Ergo manually specified auth parameters will override those in the URL.\n auth.username = auth.username || urlAuth.username\n auth.password = auth.password || urlAuth.password\n }\n if (corsProxy) {\n url = corsProxify(corsProxy, url)\n }\n // Get the 'http' plugin\n const http = cores.get(core).get('http') || builtinHttp\n // headers['Accept'] = `application/x-${service}-advertisement`\n // Only send a user agent in Node and to CORS proxies by default,\n // because Gogs and others might not whitelist 'user-agent' in allowed headers.\n // Solutions using 'process.browser' can't be used as they rely on bundler shims,\n // ans solutions using 'process.versions.node' had to be discarded because the\n // BrowserFS 'process' shim is too complete.\n if (typeof window === 'undefined' || corsProxy) {\n headers['user-agent'] = headers['user-agent'] || pkg.agent\n }\n // If the username came from the URL, we want to allow the password to be missing.\n // This is because Github allows using the token as the username with an empty password\n // so that is a style of git clone URL we might encounter and we don't want to throw a \"Missing password or token\" error.\n // Also, we don't want to prematurely throw an error before the credentialManager plugin has\n // had an opportunity to provide the password.\n const _auth = calculateBasicAuthUsernamePasswordPair(auth, !!urlAuth)\n if (_auth) {\n headers['Authorization'] = calculateBasicAuthHeader(_auth)\n }\n let res = await http({\n core,\n method: 'GET',\n url: `${url}/info/refs?service=${service}`,\n headers\n })\n if (res.statusCode === 401 && cores.get(core).has('credentialManager')) {\n // Acquire credentials and try again\n const credentialManager = cores.get(core).get('credentialManager')\n auth = await credentialManager.fill({ url: _origUrl })\n const _auth = calculateBasicAuthUsernamePasswordPair(auth)\n if (_auth) {\n headers['Authorization'] = calculateBasicAuthHeader(_auth)\n }\n res = await http({\n core,\n method: 'GET',\n url: `${url}/info/refs?service=${service}`,\n headers\n })\n // Tell credential manager if the credentials were no good\n if (res.statusCode === 401) {\n await credentialManager.rejected({ url: _origUrl, auth })\n } else if (res.statusCode === 200) {\n await credentialManager.approved({ url: _origUrl, auth })\n }\n }\n if (res.statusCode !== 200) {\n throw new GitError(E.HTTPError, {\n statusCode: res.statusCode,\n statusMessage: res.statusMessage\n })\n }\n // I'm going to be nice and ignore the content-type requirement unless there is a problem.\n try {\n const remoteHTTP = await parseRefsAdResponse(res.body, {\n service\n })\n remoteHTTP.auth = auth\n return remoteHTTP\n } catch (err) {\n // Detect \"dumb\" HTTP protocol responses and throw more specific error message\n if (\n err.code === E.AssertServerResponseFail &&\n err.data.expected === `# service=${service}\\\\n` &&\n res.headers['content-type'] !== `application/x-${service}-advertisement`\n ) {\n // Ooooooh that's why it failed.\n throw new GitError(E.RemoteDoesNotSupportSmartHTTP, {})\n }\n throw err\n }\n }\n\n static async connect ({\n core,\n emitter,\n emitterPrefix,\n corsProxy,\n service,\n url,\n noGitSuffix,\n auth,\n body,\n headers\n }) {\n // Auto-append the (necessary) .git if it's missing.\n if (!url.endsWith('.git') && !noGitSuffix) url = url += '.git'\n const urlAuth = extractAuthFromUrl(url)\n if (urlAuth) {\n url = urlAuth.url\n // To try to be backwards compatible with simple-get's behavior, which uses Node's http.request\n // setting an Authorization header will override what is in the URL.\n // Ergo manually specified auth parameters will override those in the URL.\n auth.username = auth.username || urlAuth.username\n auth.password = auth.password || urlAuth.password\n }\n if (corsProxy) {\n url = corsProxify(corsProxy, url)\n }\n headers['content-type'] = `application/x-${service}-request`\n headers['accept'] = `application/x-${service}-result`\n // Get the 'http' plugin\n const http = cores.get(core).get('http') || builtinHttp\n // Only send a user agent in Node and to CORS proxies by default,\n // because Gogs and others might not whitelist 'user-agent' in allowed headers.\n // Solutions using 'process.browser' can't be used as they rely on bundler shims,\n // ans solutions using 'process.versions.node' had to be discarded because the\n // BrowserFS 'process' shim is too complete.\n if (typeof window === 'undefined' || corsProxy) {\n headers['user-agent'] = headers['user-agent'] || pkg.agent\n }\n // If the username came from the URL, we want to allow the password to be missing.\n // This is because Github allows using the token as the username with an empty password\n // so that is a style of git clone URL we might encounter and we don't want to throw a \"Missing password or token\" error.\n // Also, we don't want to prematurely throw an error before the credentialManager plugin has\n // had an opportunity to provide the password.\n auth = calculateBasicAuthUsernamePasswordPair(auth, !!urlAuth)\n if (auth) {\n headers['Authorization'] = calculateBasicAuthHeader(auth)\n }\n const res = await http({\n core,\n emitter,\n emitterPrefix,\n method: 'POST',\n url: `${url}/${service}`,\n body,\n headers\n })\n if (res.statusCode !== 200) {\n throw new GitError(E.HTTPError, {\n statusCode: res.statusCode,\n statusMessage: res.statusMessage\n })\n }\n return res\n }\n}\n","'use strict';\nmodule.exports = require('./lib');\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","import { E, GitError } from '../models/GitError.js'\n\nimport { oauth2 } from './oauth2'\n\nexport function calculateBasicAuthUsernamePasswordPair (\n { username, password, token, oauth2format } = {},\n allowEmptyPassword = false\n) {\n // This checks for the presense and/or absense of each of the 4 parameters,\n // converts that to a 4-bit binary representation, and then handles\n // every possible combination (2^4 or 16 cases) with a lookup table.\n const key = [!!username, !!password, !!token, !!oauth2format]\n .map(Number)\n .join('')\n // See the truth table on https://isomorphic-git.github.io/docs/authentication.html\n // prettier-ignore\n switch (key) {\n case '0000': return null\n case '1000':\n if (allowEmptyPassword) return { username, password: '' }\n else throw new GitError(E.MissingPasswordTokenError)\n case '0100': throw new GitError(E.MissingUsernameError)\n case '1100': return { username, password }\n case '0010': return { username: token, password: '' } // Github's alternative format\n case '1010': return { username, password: token }\n case '0110': throw new GitError(E.MixPasswordTokenError)\n case '1110': throw new GitError(E.MixUsernamePasswordTokenError)\n case '0001': throw new GitError(E.MissingTokenError)\n case '1001': throw new GitError(E.MixUsernameOauth2formatMissingTokenError)\n case '0101': throw new GitError(E.MixPasswordOauth2formatMissingTokenError)\n case '1101': throw new GitError(E.MixUsernamePasswordOauth2formatMissingTokenError)\n case '0011': return oauth2(oauth2format, token)\n case '1011': throw new GitError(E.MixUsernameOauth2formatTokenError)\n case '0111': throw new GitError(E.MixPasswordOauth2formatTokenError)\n case '1111': throw new GitError(E.MixUsernamePasswordOauth2formatTokenError)\n }\n}\n","export function calculateBasicAuthHeader ({ username, password }) {\n return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`\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._ended = true\n this.error = err\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","// 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","import ignore from 'ignore'\n\nimport { FileSystem } from '../models/FileSystem.js'\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 cacheing.\n\n// TODO: Implement .git/info/exclude\n\nexport class GitIgnoreManager {\n static async isIgnored ({\n fs: _fs,\n dir,\n gitdir = join(dir, '.git'),\n filepath\n }) {\n const fs = new FileSystem(_fs)\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 // 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('/')\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(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 { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { readObject } from '../storage/readObject.js'\n\nexport async function resolveTree ({ fs, 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, gitdir, oid })\n // Resolve annotated tag objects to whatever\n if (type === 'tag') {\n oid = GitAnnotatedTag.from(object).parse().object\n return resolveTree({ fs, gitdir, oid })\n }\n // Resolve commits to trees\n if (type === 'commit') {\n oid = GitCommit.from(object).parse().tree\n return resolveTree({ fs, gitdir, oid })\n }\n if (type !== 'tree') {\n throw new GitError(E.ResolveTreeError, { oid })\n }\n return { tree: GitTree.from(object), oid }\n}\n","import { E, GitError } from '../models/GitError.js'\n\n/**\n * Use with push and fetch to set Basic Authentication headers.\n *\n * @link https://isomorphic-git.github.io/docs/utils_oauth2.html\n */\nexport function oauth2 (company, token) {\n switch (company) {\n case 'github':\n return {\n username: token,\n password: 'x-oauth-basic'\n }\n case 'githubapp':\n return {\n username: 'x-access-token',\n password: token\n }\n case 'bitbucket':\n return {\n username: 'x-token-auth',\n password: token\n }\n case 'gitlab':\n return {\n username: 'oauth2',\n password: token\n }\n default:\n throw new GitError(E.UnknownOauth2Format, { company })\n }\n}\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 packfile.end()\n return\n }\n // Examine first byte to determine which output \"stream\" to use\n switch (line[0]) {\n case 1: // pack data\n packfile.write(line.slice(1))\n break\n case 2: // progress message\n progress.write(line.slice(1))\n break\n case 3: // fatal error message just before stream aborts\n const error = line.slice(1)\n progress.write(error)\n packfile.destroy(new Error(error.toString('utf8')))\n return\n default:\n // Not part of the side-band-64k protocol\n packetlines.write(line.slice(0))\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","import { log } from './log.js'\nimport { 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 // console.log(staleness ? 'stale:' : 'fresh:')\n if (staleness && log.enabled) {\n console.table([justWhatMatters(e), justWhatMatters(s)])\n }\n return staleness\n}\n\nfunction justWhatMatters (e) {\n return {\n mode: e.mode,\n mtimeSeconds: e.mtimeSeconds,\n ctimeSeconds: e.ctimeSeconds,\n uid: e.uid,\n gid: e.gid,\n ino: e.ino,\n size: e.size\n }\n}\n","import { E, GitError } from '../models/GitError.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 GitError(E.InternalFail, { message: '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 = new Map()\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 filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix\n}) {\n // Try to get the packfile index from the in-memory cache\n let p = PackfileCache.get(filename)\n if (!p) {\n p = loadPackIndex({\n fs,\n filename,\n getExternalRefDelta,\n emitter,\n emitterPrefix\n })\n 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 }\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","import { fromValue } from './AsyncIterator.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 web ReadableStream (not Node stream!) to an Async Iterator\n// adapted from https://jakearchibald.com/2017/async-iterators-and-generators/\nexport function fromStream (stream) {\n // Use native async iteration if it's available.\n if (stream[Symbol.asyncIterator]) return stream\n const reader = stream.getReader()\n return {\n next () {\n return reader.read()\n },\n return () {\n reader.releaseLock()\n return {}\n },\n [Symbol.asyncIterator] () {\n return this\n }\n }\n}\n\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\n// Convert a Node stream to an Async Iterator\nexport function fromNodeStream (stream) {\n // Use native async iteration if it's available.\n if (\n Object.getOwnPropertyDescriptor(stream, Symbol.asyncIterator) &&\n Object.getOwnPropertyDescriptor(stream, Symbol.asyncIterator).enumerable\n ) {\n return stream\n }\n // Author's Note\n // I tried many MANY ways to do this.\n // I tried two npm modules (stream-to-async-iterator and streams-to-async-iterator) with no luck.\n // I tried using 'readable' and .read(), and .pause() and .resume()\n // It took me two loooong evenings to get to this point.\n // So if you are horrified that this solution just builds up a queue with no backpressure,\n // and turns Promises inside out, too bad. This is the first code that worked reliably.\n let ended = false\n const queue = []\n let defer = {}\n stream.on('data', chunk => {\n queue.push(chunk)\n if (defer.resolve) {\n defer.resolve({ value: queue.shift(), done: false })\n defer = {}\n }\n })\n stream.on('error', err => {\n if (defer.reject) {\n defer.reject(err)\n defer = {}\n }\n })\n stream.on('end', () => {\n ended = true\n if (defer.resolve) {\n defer.resolve({ done: true })\n defer = {}\n }\n })\n return {\n next () {\n return new Promise((resolve, reject) => {\n if (queue.length === 0 && ended) {\n return resolve({ done: true })\n } else if (queue.length > 0) {\n return resolve({ value: queue.shift(), done: false })\n } else if (queue.length === 0 && !ended) {\n defer = { resolve, reject }\n }\n })\n },\n return () {\n stream.removeAllListeners()\n if (stream.destroy) stream.destroy()\n },\n [Symbol.asyncIterator] () {\n return this\n }\n }\n}\n","import { fromStream } from './AsyncIterator.js'\nimport { collect } from './collect.js'\n\nexport async function http ({\n core,\n emitter,\n emitterPrefix,\n url,\n method = 'GET',\n headers = {},\n body\n}) {\n // streaming uploads aren't possible yet in the browser\n if (body) {\n body = await collect(body)\n }\n const res = await global.fetch(url, { method, headers, body })\n const iter =\n res.body && res.body.getReader\n ? fromStream(res.body)\n : [new Uint8Array(await res.arrayBuffer())]\n // convert Header object to ordinary JSON\n headers = {}\n for (const [key, value] of res.headers.entries()) {\n headers[key] = value\n }\n return {\n url: res.url,\n method: res.method,\n statusCode: res.status,\n statusMessage: res.statusText,\n body: iter,\n headers: headers\n }\n}\n","import AsyncLock from 'async-lock'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\n\nlet lock = null\n\nexport class GitShallowManager {\n static async read ({ fs: _fs, gitdir }) {\n const fs = new FileSystem(_fs)\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: _fs, gitdir, oids }) {\n const fs = new FileSystem(_fs)\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","(function (exports) {\n\t'use strict';\n\n\tvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n\tfunction b64ToByteArray(b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr;\n\t\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow 'Invalid string. Length must be a multiple of 4';\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tplaceHolders = b64.indexOf('=');\n\t\tplaceHolders = placeHolders > 0 ? b64.length - placeHolders : 0;\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = [];//new Uint8Array(b64.length * 3 / 4 - placeHolders);\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length;\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (lookup.indexOf(b64[i]) << 18) | (lookup.indexOf(b64[i + 1]) << 12) | (lookup.indexOf(b64[i + 2]) << 6) | lookup.indexOf(b64[i + 3]);\n\t\t\tarr.push((tmp & 0xFF0000) >> 16);\n\t\t\tarr.push((tmp & 0xFF00) >> 8);\n\t\t\tarr.push(tmp & 0xFF);\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (lookup.indexOf(b64[i]) << 2) | (lookup.indexOf(b64[i + 1]) >> 4);\n\t\t\tarr.push(tmp & 0xFF);\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (lookup.indexOf(b64[i]) << 10) | (lookup.indexOf(b64[i + 1]) << 4) | (lookup.indexOf(b64[i + 2]) >> 2);\n\t\t\tarr.push((tmp >> 8) & 0xFF);\n\t\t\tarr.push(tmp & 0xFF);\n\t\t}\n\n\t\treturn arr;\n\t}\n\n\tfunction uint8ToBase64(uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length;\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];\n\t\t};\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);\n\t\t\toutput += tripletToBase64(temp);\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1];\n\t\t\t\toutput += lookup[temp >> 2];\n\t\t\t\toutput += lookup[(temp << 4) & 0x3F];\n\t\t\t\toutput += '==';\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]);\n\t\t\t\toutput += lookup[temp >> 10];\n\t\t\t\toutput += lookup[(temp >> 4) & 0x3F];\n\t\t\t\toutput += lookup[(temp << 2) & 0x3F];\n\t\t\t\toutput += '=';\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\tmodule.exports.toByteArray = b64ToByteArray;\n\tmodule.exports.fromByteArray = uint8ToBase64;\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","export async function sleep (ms) {\n return new Promise((resolve, reject) => setTimeout(resolve, ms))\n}\n","import { BufferCursor } from '../utils/BufferCursor.js'\nimport { comparePath } from '../utils/comparePath.js'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\nimport { E, GitError } from './GitError.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\nfunction parseBuffer (buffer) {\n // Verify shasum\n const shaComputed = shasum(buffer.slice(0, -20))\n const shaClaimed = buffer.slice(-20).toString('hex')\n if (shaClaimed !== shaComputed) {\n throw new GitError(E.InternalFail, {\n message: `Invalid checksum in GitIndex buffer: expected ${shaClaimed} but saw ${shaComputed}`\n })\n }\n const reader = new BufferCursor(buffer)\n const _entries = new Map()\n const magic = reader.toString('utf8', 4)\n if (magic !== 'DIRC') {\n throw new GitError(E.InternalFail, {\n message: `Inavlid dircache magic file number: ${magic}`\n })\n }\n const version = reader.readUInt32BE()\n if (version !== 2) {\n throw new GitError(E.InternalFail, {\n message: `Unsupported dircache version: ${version}`\n })\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 GitError(E.InternalFail, {\n message: `Got a path length of: ${pathlength}`\n })\n }\n // TODO: handle pathnames larger than 12 bits\n entry.path = reader.toString('utf8', pathlength)\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 GitError(E.InternalFail, {\n message: `Expected 1-8 null characters but got '${tmp}' after ${entry.path}`\n })\n } else if (reader.eof()) {\n throw new GitError(E.InternalFail, {\n message: 'Unexpected end of file'\n })\n }\n }\n // end of awkward part\n _entries.set(entry.path, entry)\n i++\n }\n return _entries\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 (index) {\n this._dirty = false\n if (Buffer.isBuffer(index)) {\n this._entries = parseBuffer(index)\n } else if (index === null) {\n this._entries = new Map()\n } else {\n throw new GitError(E.InternalFail, {\n message: 'invalid type passed to GitIndex constructor'\n })\n }\n }\n\n static from (buffer) {\n return new GitIndex(buffer)\n }\n\n get entries () {\n return [...this._entries.values()].sort(comparePath)\n }\n\n get entriesMap () {\n return this._entries\n }\n\n * [Symbol.iterator] () {\n for (const entry of this.entries) {\n yield entry\n }\n }\n\n insert ({ filepath, stats, oid }) {\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: 0,\n nameLength: bfilepath.length < 0xfff ? bfilepath.length : 0xfff\n }\n }\n this._entries.set(entry.path, entry)\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 this._dirty = true\n }\n\n clear () {\n this._entries.clear()\n this._dirty = true\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 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.entries.length)\n const body = Buffer.concat(\n this.entries.map(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 const main = Buffer.concat([header, body])\n const sum = shasum(main)\n return Buffer.concat([main, Buffer.from(sum, 'hex')])\n }\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\n\n// section starts with [ and ends with ]\n// section is alphanumeric (ASCII) with _ and .\n// section is case insensitive\n// subsection is optionnal\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]\\w*)(?: *= *(.*))?$/\nconst VARIABLE_NAME_REGEX = /^[A-Za-z]\\w*$/\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 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 allValues = this.parsedConfig\n .filter(config => config.path === path.toLowerCase())\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 configIndex = findLastIndex(\n this.parsedConfig,\n config => config.path === path.toLowerCase()\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 const modifiedConfig = Object.assign({}, config, {\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 sectionPath = path\n .split('.')\n .slice(0, -1)\n .join('.')\n .toLowerCase()\n const sectionIndex = this.parsedConfig.findIndex(\n config => config.path === sectionPath\n )\n const [section, subsection] = sectionPath.split('.')\n const name = path.split('.').pop()\n const newConfig = {\n section,\n subsection,\n name,\n value,\n modified: true,\n path: getPath(section, subsection, name)\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: getPath(section, subsection, null)\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 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 { E, GitError } from '../models/GitError.js'\n\nimport { GitRemoteHTTP } from './GitRemoteHTTP'\n\nfunction parseRemoteUrl ({ url }) {\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 GitError(E.RemoteUrlParseError, { url })\n }\n if (remoteHelpers.has(parts.transport)) {\n return remoteHelpers.get(parts.transport)\n }\n throw new GitError(E.UnknownTransportError, {\n url,\n transport: parts.transport\n })\n }\n}\n","import { E, GitError } from '../models/GitError.js'\nimport { GitPktLine } from '../models/GitPktLine.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 if (lineOne === true) throw new GitError(E.EmptyServerResponseFail)\n // Clients MUST ignore an LF at the end of the line.\n if (lineOne.toString('utf8').replace(/\\n$/, '') !== `# service=${service}`) {\n throw new GitError(E.AssertServerResponseFail, {\n expected: `# service=${service}\\\\n`,\n actual: lineOne.toString('utf8')\n })\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 const [firstRef, capabilitiesLine] = lineTwo\n .toString('utf8')\n .trim()\n .split('\\x00')\n capabilitiesLine.split(' ').map(x => capabilities.add(x))\n const [ref, name] = firstRef.split(' ')\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] = line\n .toString('utf8')\n .trim()\n .split(' ')\n refs.set(name, ref)\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 { capabilities, refs, symrefs }\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","import diff3Merge from 'diff3'\n\nconst LINEBREAKS = /^.*(\\r?\\n|$)/gm\n\nexport function mergeFile ({\n ourContent,\n baseContent,\n theirContent,\n ourName = 'ours',\n baseName = 'base',\n theirName = 'theirs',\n format = 'diff',\n markerSize = 7\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 // Here we note whether there are conflicts and format the results\n let mergedText = ''\n let cleanMerge = true\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 if (format === 'diff3') {\n mergedText += `${'|'.repeat(markerSize)} ${baseName}\\n`\n mergedText += item.conflict.o.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 pako from 'pako'\nimport Hash from 'sha.js/sha1'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { padHex } from '../utils/padHex.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { types } from './types'\n\n/**\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oids\n}) {\n const fs = new FileSystem(_fs)\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 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(pako.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, gitdir, oid })\n writeObject({ write, object, stype: type })\n }\n // Write SHA1 checksum\n const digest = hash.digest()\n outputStream.push(digest)\n return outputStream\n}\n","import { indent } from '../utils/indent.js'\nimport { normalizeNewlines } from '../utils/normalizeNewlines.js'\n\nimport { GitCommit } from './GitCommit'\n\nexport class SignedGitCommit extends GitCommit {\n static from (commit) {\n return new SignedGitCommit(commit)\n }\n\n async sign (openpgp, privateKeys) {\n const commit = this.withoutSignature()\n const headers = GitCommit.justHeaders(this._commit)\n const message = GitCommit.justMessage(this._commit)\n const privKeyObj = openpgp.key.readArmored(privateKeys).keys\n let { signature } = await openpgp.sign({\n data: openpgp.util.str2Uint8Array(commit),\n privateKeys: privKeyObj,\n detached: true,\n armor: true\n })\n // renormalize the line endings to the one true line-ending\n signature = normalizeNewlines(signature)\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 async listSigningKeys (openpgp) {\n const msg = openpgp.message.readSignedContent(\n this.withoutSignature(),\n this.isolateSignature()\n )\n return msg.getSigningKeyIds().map(keyid => keyid.toHex())\n }\n\n async verify (openpgp, publicKeys) {\n const pubKeyObj = openpgp.key.readArmored(publicKeys).keys\n const msg = openpgp.message.readSignedContent(\n this.withoutSignature(),\n this.isolateSignature()\n )\n const results = msg.verify(pubKeyObj)\n const validity = results.reduce((a, b) => a.valid && b.valid, {\n valid: true\n })\n return validity\n }\n}\n","// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\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","/* 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","var proto\n , map\n\nmodule.exports = proto = {}\n\nmap = typeof WeakMap === 'undefined' ? null : new WeakMap\n\nproto.get = !map ? no_weakmap_get : get\n\nfunction no_weakmap_get(target) {\n return new DataView(target.buffer, 0)\n}\n\nfunction get(target) {\n var out = map.get(target.buffer)\n if(!out) {\n map.set(target.buffer, out = new DataView(target.buffer, 0))\n }\n return out\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 { E, GitError } from '../models/GitError.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 GitError(E.CorruptShallowOidFail, { 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 GitError(E.CorruptShallowOidFail, { 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 }\n if (done) {\n resolve({ shallows, unshallows, acks, nak, packfile, progress })\n }\n })\n })\n}\n","// @ts-check\nimport { TREE } from '../commands/TREE.js'\nimport { walkBeta1 } from '../commands/walkBeta1.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { writeObject } from '../storage/writeObject.js'\n\nimport { join } from './join.js'\nimport { mergeFile } from './mergeFile.js'\nimport { cores } from './plugins.js'\n\n/**\n *\n * @typedef {import('../commands/readObject').TreeEntry} TreeEntry\n */\n\n/**\n * Create a merged tree\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} - The SHA-1 object id of the merged tree\n *\n */\nexport async function mergeTree ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ourOid,\n baseOid,\n theirOid,\n ourName = 'ours',\n baseName = 'base',\n theirName = 'theirs',\n dryRun = false\n}) {\n const fs = new FileSystem(_fs)\n const ourTree = TREE({ core, dir, gitdir, fs, ref: ourOid })\n const baseTree = TREE({ core, dir, gitdir, fs, ref: baseOid })\n const theirTree = TREE({ core, dir, gitdir, fs, ref: theirOid })\n\n const results = await walkBeta1({\n trees: [ourTree, baseTree, theirTree],\n map: async function ([ours, base, theirs]) {\n await Promise.all([\n ours.populateStat(),\n base.populateStat(),\n theirs.populateStat(),\n ours.populateHash(),\n base.populateHash(),\n theirs.populateHash()\n ])\n // What we did, what they did\n const ourChange = modified(ours, base)\n const theirChange = modified(theirs, base)\n switch (`${ourChange}-${theirChange}`) {\n case 'false-false': {\n return {\n mode: base.mode,\n path: base.basename,\n oid: base.oid,\n type: base.type\n }\n }\n case 'false-true': {\n return theirs.exists\n ? {\n mode: theirs.mode,\n path: theirs.basename,\n oid: theirs.oid,\n type: theirs.type\n }\n : void 0\n }\n case 'true-false': {\n return ours.exists\n ? {\n mode: ours.mode,\n path: ours.basename,\n oid: ours.oid,\n type: ours.type\n }\n : void 0\n }\n case 'true-true': {\n // Modifications\n if (\n ours.type === 'blob' &&\n base.type === 'blob' &&\n theirs.type === 'blob'\n ) {\n return mergeBlobs({\n fs,\n gitdir,\n ours,\n base,\n theirs,\n ourName,\n baseName,\n theirName\n })\n }\n // all other types of conflicts fail\n throw new GitError(E.MergeNotSupportedFail)\n }\n }\n },\n /**\n * @param {TreeEntry} [parent]\n * @param {Array} children\n */\n reduce: async (parent, children) => {\n const entries = children.filter(Boolean) // remove undefineds\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 return results.oid\n}\n\n/**\n *\n * @param {import('../commands/walkBeta1.js').WalkerEntry} entry\n * @param {import('../commands/walkBeta1.js').WalkerEntry} base\n *\n */\nfunction modified (entry, base) {\n if (entry.exists && !base.exists) return true\n if (!entry.exists && base.exists) return true\n if (entry.type === 'tree' && base.type === 'tree') return false\n if (\n entry.type === base.type &&\n entry.mode === base.mode &&\n entry.oid === base.oid\n ) {\n return false\n }\n return true\n}\n\n/**\n *\n * @param {Object} args\n * @param {FileSystem} args.fs\n * @param {string} args.gitdir\n * @param {import('../commands/walkBeta1.js').WalkerEntry} args.ours\n * @param {import('../commands/walkBeta1.js').WalkerEntry} args.base\n * @param {import('../commands/walkBeta1.js').WalkerEntry} args.theirs\n * @param {string} [args.ourName]\n * @param {string} [args.baseName]\n * @param {string} [args.theirName]\n * @param {string} [args.format]\n * @param {number} [args.markerSize]\n * @param {boolean} [args.dryRun = false]\n *\n */\nasync function mergeBlobs ({\n fs,\n gitdir,\n ours,\n base,\n theirs,\n ourName,\n theirName,\n baseName,\n format,\n markerSize,\n dryRun\n}) {\n const type = 'blob'\n // this might change if we figure out rename detection\n const path = base.basename\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 = base.mode === ours.mode ? theirs.mode : ours.mode\n // The trivial case: nothing to merge except maybe mode\n if (ours.oid === theirs.oid) return { mode, path, oid: ours.oid, type }\n // if only one side made oid changes, return that side's oid\n if (ours.oid === base.oid) return { mode, path, oid: theirs.oid, type }\n if (theirs.oid === base.oid) return { mode, path, oid: ours.oid, type }\n // if both sides made changes do a merge\n await Promise.all([\n ours.populateContent(),\n base.populateContent(),\n theirs.populateContent()\n ])\n const { mergedText, cleanMerge } = mergeFile({\n ourContent: ours.content.toString('utf8'),\n baseContent: base.content.toString('utf8'),\n theirContent: theirs.content.toString('utf8'),\n ourName,\n theirName,\n baseName,\n format,\n markerSize\n })\n if (!cleanMerge) {\n // all other types of conflicts fail\n throw new GitError(E.MergeNotSupportedFail)\n }\n const oid = await writeObject({\n fs,\n gitdir,\n type: 'blob',\n object: Buffer.from(mergedText, 'utf8'),\n dryRun\n })\n return { mode, path, oid, type }\n}\n","import { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nexport async function listCommitsAndTags ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n start,\n finish\n}) {\n const fs = new FileSystem(_fs)\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, 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 GitError(E.ObjectTypeAssertionFail, {\n oid,\n type,\n expected: 'commit'\n })\n }\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 // Let's go walking!\n for (const oid of startingSet) {\n await walk(oid)\n }\n return visited\n}\n","import { 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 { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nexport async function listObjects ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oids\n}) {\n const fs = new FileSystem(_fs)\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 visited.add(oid)\n const { type, object } = await readObject({ fs, 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 // only add blobs and trees to the set,\n // skipping over submodules whose type is 'commit'\n if (entry.type === 'blob' || entry.type === 'tree') {\n visited.add(entry.oid)\n }\n // only 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 { 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 { E, GitError } from '../models/GitError.js'\nimport { GitPktLine } from '../models/GitPktLine.js'\n\nexport async function parseReceivePackResponse (packfile) {\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 GitError(E.UnparseableServerResponseFail, { line })\n }\n if (line === 'unpack ok') {\n result.ok = ['unpack']\n } else {\n result.errors = [line.trim()]\n }\n for (const line of lines) {\n const status = line.slice(0, 2)\n const refAndMessage = line.slice(3)\n if (status === 'ok') {\n result.ok = result.ok || []\n result.ok.push(refAndMessage)\n } else if (status === 'ng') {\n result.errors = result.errors || []\n result.errors.push(refAndMessage)\n }\n }\n return result\n}\n","/**\n * Use with push and fetch to set Basic Authentication headers.\n *\n * @link https://isomorphic-git.github.io/docs/utils_auth.html\n */\nexport function auth (username, password) {\n // Allow specifying it as one argument (mostly for CLI inputability)\n if (password === undefined) {\n const i = username.indexOf(':')\n if (i > -1) {\n password = username.slice(i + 1)\n username = username.slice(0, i)\n } else {\n password = '' // Enables the .auth(GITHUB_TOKEN) no-username shorthand\n }\n }\n return { username, password }\n}\n","// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\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\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 : ''\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 ? ' '\n : ''\n ],\n\n // replace (\\ ) with ' '\n [\n /\\\\\\s/g,\n () => ' '\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 // > [abc] matches any character inside the brackets\n // > (in this case a, b, or c);\n /\\[([^\\]/]*)($|\\])/g,\n (match, p1, p2) => p2 === ']'\n ? `[${sanitizeRange(p1)}]`\n : `\\\\${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 // 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 // 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 // trailing wildcard\n [\n /(\\^|\\\\\\/)?\\\\\\*$/,\n (_, p1) => {\n const prefix = p1\n // '\\^':\n // '/*' does not match ''\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 // unescape\n /\\\\\\\\\\\\/g,\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, negative, ignorecase) => {\n const r = regexCache[pattern]\n if (r) {\n return r\n }\n\n // const replacers = negative\n // ? NEGATIVE_REPLACERS\n // : POSITIVE_REPLACERS\n\n const source = REPLACERS.reduce(\n (prev, current) => prev.replace(current[0], current[1].bind(pattern)),\n pattern\n )\n\n return regexCache[pattern] = 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, negative, 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 '', 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 } = {}) {\n this._rules = []\n this._ignorecase = ignorecase\n define(this, KEY_IGNORE, true)\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(path, originalPath, throwError)\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 returnFalse = () => false\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, returnFalse)\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 { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\n\nexport async function writeObjectLoose ({\n fs: _fs,\n gitdir,\n type,\n object,\n format,\n oid\n}) {\n const fs = new FileSystem(_fs)\n if (format !== 'deflated') {\n throw new GitError(E.InternalFail, {\n message:\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","import { FileSystem } from '../models/FileSystem.js'\n\nexport async function readObjectLoose ({ fs: _fs, gitdir, oid }) {\n const fs = new FileSystem(_fs)\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","import { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function readObjectPacked ({\n fs: _fs,\n gitdir,\n oid,\n format = 'content',\n getExternalRefDelta\n}) {\n const fs = new FileSystem(_fs)\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 filename: indexFile,\n getExternalRefDelta\n })\n if (p.error) throw new GitError(E.InternalFail, { message: 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","/* 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","module.exports = apply_delta\n\nvar binary = require('bops')\n , Decoder = require('varint/decode.js')\n , vi = new Decoder\n\n// we use writeUint[8|32][LE|BE] instead of indexing\n// into buffers so that we get buffer-browserify compat.\nvar OFFSET_BUFFER = binary.create(4)\n , LENGTH_BUFFER = binary.create(4)\n\nfunction apply_delta(delta, target) {\n var base_size_info = {size: null, buffer: null}\n , resized_size_info = {size: null, buffer: null}\n , output_buffer\n , out_idx\n , command\n , len\n , idx\n\n delta_header(delta, base_size_info)\n delta_header(base_size_info.buffer, resized_size_info)\n\n delta = resized_size_info.buffer\n\n idx =\n out_idx = 0\n output_buffer = binary.create(resized_size_info.size)\n\n len = delta.length\n\n while(idx < len) {\n command = delta[idx++]\n command & 0x80 ? copy() : insert()\n }\n\n return output_buffer\n\n function copy() {\n binary.writeUInt32LE(OFFSET_BUFFER, 0, 0)\n binary.writeUInt32LE(LENGTH_BUFFER, 0, 0)\n\n var check = 1\n , length\n , offset\n\n for(var x = 0; x < 4; ++x) {\n if(command & check) {\n OFFSET_BUFFER[3 - x] = delta[idx++]\n }\n check <<= 1\n }\n\n for(var x = 0; x < 3; ++x) {\n if(command & check) {\n LENGTH_BUFFER[3 - x] = delta[idx++]\n }\n check <<= 1\n }\n LENGTH_BUFFER[0] = 0\n\n length = binary.readUInt32BE(LENGTH_BUFFER, 0) || 0x10000\n offset = binary.readUInt32BE(OFFSET_BUFFER, 0)\n\n binary.copy(target, output_buffer, out_idx, offset, offset + length)\n out_idx += length\n }\n\n function insert() {\n binary.copy(delta, output_buffer, out_idx, idx, command + idx)\n idx += command\n out_idx += command\n }\n}\n\nfunction delta_header(buf, output) {\n var done = false\n , idx = 0\n , size = 0\n\n vi.ondata = function(s) {\n size = s\n done = true\n }\n\n do {\n vi.write(buf[idx++])\n } while(!done)\n\n output.size = size\n output.buffer = binary.subarray(buf, idx)\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'\nimport Hash from 'sha.js/sha1'\n\nimport { E, GitError } from '../models/GitError.js'\n\nimport { StreamReader } from './StreamReader.js'\n\nexport async function listpack (stream, onData) {\n const reader = new StreamReader(stream)\n const hash = new Hash()\n let PACK = await reader.read(4)\n hash.update(PACK)\n PACK = PACK.toString('utf8')\n if (PACK !== 'PACK') {\n throw new GitError(E.InternalFail, {\n message: `Invalid PACK header '${PACK}'`\n })\n }\n\n let version = await reader.read(4)\n hash.update(version)\n version = version.readUInt32BE(0)\n if (version !== 2) {\n throw new GitError(E.InternalFail, {\n message: `Invalid packfile version: ${version}`\n })\n }\n\n let numObjects = await reader.read(4)\n hash.update(numObjects)\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, hash)\n const inflator = new pako.Inflate()\n while (!inflator.result) {\n const chunk = await reader.chunk()\n if (reader.ended) break\n inflator.push(chunk, false)\n if (inflator.err) {\n throw new GitError(E.InternalFail, {\n message: `Pako error: ${inflator.msg}`\n })\n }\n if (inflator.result) {\n if (inflator.result.length !== length) {\n throw new GitError(E.InternalFail, {\n message: `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 const buf = await reader.read(chunk.length - inflator.strm.avail_in)\n hash.update(buf)\n const end = reader.tell()\n onData({\n data: inflator.result,\n type,\n num: numObjects,\n offset,\n end,\n reference,\n ofs\n })\n } else {\n hash.update(chunk)\n }\n }\n }\n}\n\nasync function parseHeader (reader, hash) {\n // Object type is encoded in bits 654\n let byte = await reader.byte()\n hash.update(Buffer.from([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 hash.update(Buffer.from([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 hash.update(Buffer.from([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 hash.update(buf)\n reference = buf\n }\n return { type, length, ofs, reference }\n}\n","export function outdent (str) {\n return str\n .split('\\n')\n .map(x => x.replace(/^ /, ''))\n .join('\\n')\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","export const types = {\n commit: 0b0010000,\n tree: 0b0100000,\n blob: 0b0110000,\n tag: 0b1000000,\n ofs_delta: 0b1100000,\n ref_delta: 0b1110000\n}\n","const isWin = process.platform === 'win32';\nconst SEP = isWin ? `\\\\\\\\+` : `\\\\/`;\nconst SEP_ESC = isWin ? `\\\\\\\\` : `/`;\nconst GLOBSTAR = `((?:[^/]*(?:/|$))*)`;\nconst WILDCARD = `([^/]*)`;\nconst GLOBSTAR_SEGMENT = `((?:[^${SEP_ESC}]*(?:${SEP_ESC}|$))*)`;\nconst WILDCARD_SEGMENT = `([^${SEP_ESC}]*)`;\n\n/**\n * Convert any glob pattern to a JavaScript Regexp object\n * @param {String} glob Glob pattern to convert\n * @param {Object} opts Configuration object\n * @param {Boolean} [opts.extended=false] Support advanced ext globbing\n * @param {Boolean} [opts.globstar=false] Support globstar\n * @param {Boolean} [opts.strict=true] be laissez faire about mutiple slashes\n * @param {Boolean} [opts.filepath=''] Parse as filepath for extra path related features\n * @param {String} [opts.flags=''] RegExp globs\n * @returns {Object} converted object with string, segments and RegExp object\n */\nfunction globrex(glob, {extended = false, globstar = false, strict = false, filepath = false, flags = ''} = {}) {\n let regex = '';\n let segment = '';\n let path = { regex: '', segments: [] };\n\n // If we are doing extended matching, this boolean is true when we are inside\n // a group (eg {*.html,*.js}), and false otherwise.\n let inGroup = false;\n let inRange = false;\n\n // extglob stack. Keep track of scope\n const ext = [];\n\n // Helper function to build string and segments\n function add(str, {split, last, only}={}) {\n if (only !== 'path') regex += str;\n if (filepath && only !== 'regex') {\n path.regex += (str === '\\\\/' ? SEP : str);\n if (split) {\n if (last) segment += str;\n if (segment !== '') {\n if (!flags.includes('g')) segment = `^${segment}$`; // change it 'includes'\n path.segments.push(new RegExp(segment, flags));\n }\n segment = '';\n } else {\n segment += str;\n }\n }\n }\n\n let c, n;\n for (let i = 0; i < glob.length; i++) {\n c = glob[i];\n n = glob[i + 1];\n\n if (['\\\\', '$', '^', '.', '='].includes(c)) {\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '/') {\n add(`\\\\${c}`, {split: true});\n if (n === '/' && !strict) regex += '?';\n continue;\n }\n\n if (c === '(') {\n if (ext.length) {\n add(c);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === ')') {\n if (ext.length) {\n add(c);\n let type = ext.pop();\n if (type === '@') {\n add('{1}');\n } else if (type === '!') {\n add('([^\\/]*)');\n } else {\n add(type);\n }\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n \n if (c === '|') {\n if (ext.length) {\n add(c);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '+') {\n if (n === '(' && extended) {\n ext.push(c);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '@' && extended) {\n if (n === '(') {\n ext.push(c);\n continue;\n }\n }\n\n if (c === '!') {\n if (extended) {\n if (inRange) {\n add('^');\n continue\n }\n if (n === '(') {\n ext.push(c);\n add('(?!');\n i++;\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '?') {\n if (extended) {\n if (n === '(') {\n ext.push(c);\n } else {\n add('.');\n }\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '[') {\n if (inRange && n === ':') {\n i++; // skip [\n let value = '';\n while(glob[++i] !== ':') value += glob[i];\n if (value === 'alnum') add('(\\\\w|\\\\d)');\n else if (value === 'space') add('\\\\s');\n else if (value === 'digit') add('\\\\d');\n i++; // skip last ]\n continue;\n }\n if (extended) {\n inRange = true;\n add(c);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === ']') {\n if (extended) {\n inRange = false;\n add(c);\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '{') {\n if (extended) {\n inGroup = true;\n add('(');\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '}') {\n if (extended) {\n inGroup = false;\n add(')');\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === ',') {\n if (inGroup) {\n add('|');\n continue;\n }\n add(`\\\\${c}`);\n continue;\n }\n\n if (c === '*') {\n if (n === '(' && extended) {\n ext.push(c);\n continue;\n }\n // Move over all consecutive \"*\"'s.\n // Also store the previous and next characters\n let prevChar = glob[i - 1];\n let starCount = 1;\n while (glob[i + 1] === '*') {\n starCount++;\n i++;\n }\n let nextChar = glob[i + 1];\n if (!globstar) {\n // globstar is disabled, so treat any number of \"*\" as one\n add('.*');\n } else {\n // globstar is enabled, so determine if this is a globstar segment\n let isGlobstar =\n starCount > 1 && // multiple \"*\"'s\n (prevChar === '/' || prevChar === undefined) && // from the start of the segment\n (nextChar === '/' || nextChar === undefined); // to the end of the segment\n if (isGlobstar) {\n // it's a globstar, so match zero or more path segments\n add(GLOBSTAR, {only:'regex'});\n add(GLOBSTAR_SEGMENT, {only:'path', last:true, split:true});\n i++; // move over the \"/\"\n } else {\n // it's not a globstar, so only match one path segment\n add(WILDCARD, {only:'regex'});\n add(WILDCARD_SEGMENT, {only:'path'});\n }\n }\n continue;\n }\n\n add(c);\n }\n\n\n // When regexp 'g' flag is specified don't\n // constrain the regular expression with ^ & $\n if (!flags.includes('g')) {\n regex = `^${regex}$`;\n segment = `^${segment}$`;\n if (filepath) path.regex = `^${path.regex}$`;\n }\n\n const result = {regex: new RegExp(regex, flags)};\n\n // Push the last segment\n if (filepath) {\n path.segments.push(new RegExp(segment, flags));\n path.regex = new RegExp(path.regex, flags);\n path.globstar = new RegExp(!flags.includes('g') ? `^${GLOBSTAR_SEGMENT}$` : GLOBSTAR_SEGMENT, flags);\n result.path = path;\n }\n\n return result;\n}\n\nmodule.exports = globrex;\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","'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\tvar deferred = null;\n\tif (typeof (cb) !== 'function') {\n\t\topts = cb;\n\t\tcb = null;\n\n\t\t// will return a promise\n\t\tdeferred = this._deferPromise();\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\tdeferred.reject(err);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdeferred.resolve(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.promise;\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\tvar deferred = this._deferPromise();\n\t\t// check for promise mode in case keys is empty array\n\t\tif (fnx.length === 1) {\n\t\t\tfnx(function (err, ret) {\n\t\t\t\tif (err) {\n\t\t\t\t\tdeferred.reject(err);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdeferred.resolve(ret);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tdeferred.resolve(fnx());\n\t\t}\n\t\treturn deferred.promise;\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\n/**\n * Promise.defer() implementation to become independent of Q-specific methods\n */\nAsyncLock.prototype._deferPromise = function() {\n\tif (typeof this.Promise.defer === 'function') {\n\t\t// note that Q does not have a constructor with reject/resolve functions so we have no option but use its defer() method\n\t\treturn this.Promise.defer();\n\t} else {\n\t\t// for promise implementations that don't have a defer() method we create one ourselves\n\t\tvar result = {\n\t\t\treject: function(err) {\n\t\t\t\t// some promise libraries e.g. Q take some time setting the reject property while others do it synchronously\n\t\t\t\treturn Promise.resolve().then(function() {\n\t\t\t\t\tresult.reject(err);\n\t\t\t\t});\n\t\t\t},\n\t\t\tresolve: function(ret) {\n\t\t\t\t// some promise libraries e.g. Q take some time setting the reject property while others do it synchronously\n\t\t\t\treturn Promise.resolve().then(function() {\n\t\t\t\t\tresult.resolve(ret);\n\t\t\t\t});\n\t\t\t},\n\t\t\tpromise: undefined\n\t\t};\n\t\tresult.promise = new this.Promise(function(resolve, reject) {\n\t\t\tresult.reject = reject;\n\t\t\tresult.resolve = resolve;\n\t\t});\n\t\treturn result;\n\t}\n};\n\nmodule.exports = AsyncLock;\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","var proto = {}\nmodule.exports = proto\n\nproto.from = require('./from.js')\nproto.to = require('./to.js')\nproto.is = require('./is.js')\nproto.subarray = require('./subarray.js')\nproto.join = require('./join.js')\nproto.copy = require('./copy.js')\nproto.create = require('./create.js')\n\nmix(require('./read.js'), proto)\nmix(require('./write.js'), proto)\n\nfunction mix(from, into) {\n for(var key in from) {\n into[key] = from[key]\n }\n}\n","module.exports = from\n\nvar base64 = require('base64-js')\n\nvar decoders = {\n hex: from_hex\n , utf8: from_utf\n , base64: from_base64\n}\n\nfunction from(source, encoding) {\n if(Array.isArray(source)) {\n return new Uint8Array(source)\n }\n\n return decoders[encoding || 'utf8'](source)\n}\n\nfunction from_hex(str) {\n var size = str.length / 2\n , buf = new Uint8Array(size)\n , character = ''\n\n for(var i = 0, len = str.length; i < len; ++i) {\n character += str.charAt(i)\n\n if(i > 0 && (i % 2) === 1) {\n buf[i>>>1] = parseInt(character, 16)\n character = '' \n }\n }\n\n return buf \n}\n\nfunction from_utf(str) {\n var bytes = []\n , tmp\n , ch\n\n for(var i = 0, len = str.length; i < len; ++i) {\n ch = str.charCodeAt(i)\n if(ch & 0x80) {\n tmp = encodeURIComponent(str.charAt(i)).substr(1).split('%')\n for(var j = 0, jlen = tmp.length; j < jlen; ++j) {\n bytes[bytes.length] = parseInt(tmp[j], 16)\n }\n } else {\n bytes[bytes.length] = ch \n }\n }\n\n return new Uint8Array(bytes)\n}\n\nfunction from_base64(str) {\n return new Uint8Array(base64.toByteArray(str)) \n}\n","module.exports = to\n\nvar base64 = require('base64-js')\n , toutf8 = require('to-utf8')\n\nvar encoders = {\n hex: to_hex\n , utf8: to_utf\n , base64: to_base64\n}\n\nfunction to(buf, encoding) {\n return encoders[encoding || 'utf8'](buf)\n}\n\nfunction to_hex(buf) {\n var str = ''\n , byt\n\n for(var i = 0, len = buf.length; i < len; ++i) {\n byt = buf[i]\n str += ((byt & 0xF0) >>> 4).toString(16)\n str += (byt & 0x0F).toString(16)\n }\n\n return str\n}\n\nfunction to_utf(buf) {\n return toutf8(buf)\n}\n\nfunction to_base64(buf) {\n return base64.fromByteArray(buf)\n}\n\n","module.exports = to_utf8\n\nvar out = []\n , col = []\n , fcc = String.fromCharCode\n , mask = [0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01]\n , unmask = [\n 0x00\n , 0x01\n , 0x02 | 0x01\n , 0x04 | 0x02 | 0x01\n , 0x08 | 0x04 | 0x02 | 0x01\n , 0x10 | 0x08 | 0x04 | 0x02 | 0x01\n , 0x20 | 0x10 | 0x08 | 0x04 | 0x02 | 0x01\n , 0x40 | 0x20 | 0x10 | 0x08 | 0x04 | 0x02 | 0x01\n ]\n\nfunction to_utf8(bytes, start, end) {\n start = start === undefined ? 0 : start\n end = end === undefined ? bytes.length : end\n\n var idx = 0\n , hi = 0x80\n , collecting = 0\n , pos\n , by\n\n col.length =\n out.length = 0\n\n while(idx < bytes.length) {\n by = bytes[idx]\n if(!collecting && by & hi) {\n pos = find_pad_position(by)\n collecting += pos\n if(pos < 8) {\n col[col.length] = by & unmask[6 - pos]\n }\n } else if(collecting) {\n col[col.length] = by & unmask[6]\n --collecting\n if(!collecting && col.length) {\n out[out.length] = fcc(reduced(col, pos))\n col.length = 0\n }\n } else { \n out[out.length] = fcc(by)\n }\n ++idx\n }\n if(col.length && !collecting) {\n out[out.length] = fcc(reduced(col, pos))\n col.length = 0\n }\n return out.join('')\n}\n\nfunction find_pad_position(byt) {\n for(var i = 0; i < 7; ++i) {\n if(!(byt & mask[i])) {\n break\n }\n }\n return i\n}\n\nfunction reduced(list) {\n var out = 0\n for(var i = 0, len = list.length; i < len; ++i) {\n out |= list[i] << ((len - i - 1) * 6)\n }\n return out\n}\n","\nmodule.exports = function(buffer) {\n return buffer instanceof Uint8Array;\n}\n","module.exports = subarray\n\nfunction subarray(buf, from, to) {\n return buf.subarray(from || 0, to || buf.length)\n}\n","module.exports = join\n\nfunction join(targets, hint) {\n if(!targets.length) {\n return new Uint8Array(0)\n }\n\n var len = hint !== undefined ? hint : get_length(targets)\n , out = new Uint8Array(len)\n , cur = targets[0]\n , curlen = cur.length\n , curidx = 0\n , curoff = 0\n , i = 0\n\n while(i < len) {\n if(curoff === curlen) {\n curoff = 0\n ++curidx\n cur = targets[curidx]\n curlen = cur && cur.length\n continue\n }\n out[i++] = cur[curoff++] \n }\n\n return out\n}\n\nfunction get_length(targets) {\n var size = 0\n for(var i = 0, len = targets.length; i < len; ++i) {\n size += targets[i].byteLength\n }\n return size\n}\n","module.exports = copy\n\nvar slice = [].slice\n\nfunction copy(source, target, target_start, source_start, source_end) {\n target_start = arguments.length < 3 ? 0 : target_start\n source_start = arguments.length < 4 ? 0 : source_start\n source_end = arguments.length < 5 ? source.length : source_end\n\n if(source_end === source_start) {\n return\n }\n\n if(target.length === 0 || source.length === 0) {\n return\n }\n\n if(source_end > source.length) {\n source_end = source.length\n }\n\n if(target.length - target_start < source_end - source_start) {\n source_end = target.length - target_start + source_start\n }\n\n if(source.buffer !== target.buffer) {\n return fast_copy(source, target, target_start, source_start, source_end)\n }\n return slow_copy(source, target, target_start, source_start, source_end)\n}\n\nfunction fast_copy(source, target, target_start, source_start, source_end) {\n var len = (source_end - source_start) + target_start\n\n for(var i = target_start, j = source_start;\n i < len;\n ++i,\n ++j) {\n target[i] = source[j]\n }\n}\n\nfunction slow_copy(from, to, j, i, jend) {\n // the buffers could overlap.\n var iend = jend + i\n , tmp = new Uint8Array(slice.call(from, i, iend))\n , x = 0\n\n for(; i < iend; ++i, ++x) {\n to[j++] = tmp[x]\n }\n}\n","module.exports = function(size) {\n return new Uint8Array(size)\n}\n","module.exports = {\n readUInt8: read_uint8\n , readInt8: read_int8\n , readUInt16LE: read_uint16_le\n , readUInt32LE: read_uint32_le\n , readInt16LE: read_int16_le\n , readInt32LE: read_int32_le\n , readFloatLE: read_float_le\n , readDoubleLE: read_double_le\n , readUInt16BE: read_uint16_be\n , readUInt32BE: read_uint32_be\n , readInt16BE: read_int16_be\n , readInt32BE: read_int32_be\n , readFloatBE: read_float_be\n , readDoubleBE: read_double_be\n}\n\nvar map = require('./mapped.js')\n\nfunction read_uint8(target, at) {\n return target[at]\n}\n\nfunction read_int8(target, at) {\n var v = target[at];\n return v < 0x80 ? v : v - 0x100\n}\n\nfunction read_uint16_le(target, at) {\n var dv = map.get(target);\n return dv.getUint16(at + target.byteOffset, true)\n}\n\nfunction read_uint32_le(target, at) {\n var dv = map.get(target);\n return dv.getUint32(at + target.byteOffset, true)\n}\n\nfunction read_int16_le(target, at) {\n var dv = map.get(target);\n return dv.getInt16(at + target.byteOffset, true)\n}\n\nfunction read_int32_le(target, at) {\n var dv = map.get(target);\n return dv.getInt32(at + target.byteOffset, true)\n}\n\nfunction read_float_le(target, at) {\n var dv = map.get(target);\n return dv.getFloat32(at + target.byteOffset, true)\n}\n\nfunction read_double_le(target, at) {\n var dv = map.get(target);\n return dv.getFloat64(at + target.byteOffset, true)\n}\n\nfunction read_uint16_be(target, at) {\n var dv = map.get(target);\n return dv.getUint16(at + target.byteOffset, false)\n}\n\nfunction read_uint32_be(target, at) {\n var dv = map.get(target);\n return dv.getUint32(at + target.byteOffset, false)\n}\n\nfunction read_int16_be(target, at) {\n var dv = map.get(target);\n return dv.getInt16(at + target.byteOffset, false)\n}\n\nfunction read_int32_be(target, at) {\n var dv = map.get(target);\n return dv.getInt32(at + target.byteOffset, false)\n}\n\nfunction read_float_be(target, at) {\n var dv = map.get(target);\n return dv.getFloat32(at + target.byteOffset, false)\n}\n\nfunction read_double_be(target, at) {\n var dv = map.get(target);\n return dv.getFloat64(at + target.byteOffset, false)\n}\n","module.exports = {\n writeUInt8: write_uint8\n , writeInt8: write_int8\n , writeUInt16LE: write_uint16_le\n , writeUInt32LE: write_uint32_le\n , writeInt16LE: write_int16_le\n , writeInt32LE: write_int32_le\n , writeFloatLE: write_float_le\n , writeDoubleLE: write_double_le\n , writeUInt16BE: write_uint16_be\n , writeUInt32BE: write_uint32_be\n , writeInt16BE: write_int16_be\n , writeInt32BE: write_int32_be\n , writeFloatBE: write_float_be\n , writeDoubleBE: write_double_be\n}\n\nvar map = require('./mapped.js')\n\nfunction write_uint8(target, value, at) {\n return target[at] = value\n}\n\nfunction write_int8(target, value, at) {\n return target[at] = value < 0 ? value + 0x100 : value\n}\n\nfunction write_uint16_le(target, value, at) {\n var dv = map.get(target);\n return dv.setUint16(at + target.byteOffset, value, true)\n}\n\nfunction write_uint32_le(target, value, at) {\n var dv = map.get(target);\n return dv.setUint32(at + target.byteOffset, value, true)\n}\n\nfunction write_int16_le(target, value, at) {\n var dv = map.get(target);\n return dv.setInt16(at + target.byteOffset, value, true)\n}\n\nfunction write_int32_le(target, value, at) {\n var dv = map.get(target);\n return dv.setInt32(at + target.byteOffset, value, true)\n}\n\nfunction write_float_le(target, value, at) {\n var dv = map.get(target);\n return dv.setFloat32(at + target.byteOffset, value, true)\n}\n\nfunction write_double_le(target, value, at) {\n var dv = map.get(target);\n return dv.setFloat64(at + target.byteOffset, value, true)\n}\n\nfunction write_uint16_be(target, value, at) {\n var dv = map.get(target);\n return dv.setUint16(at + target.byteOffset, value, false)\n}\n\nfunction write_uint32_be(target, value, at) {\n var dv = map.get(target);\n return dv.setUint32(at + target.byteOffset, value, false)\n}\n\nfunction write_int16_be(target, value, at) {\n var dv = map.get(target);\n return dv.setInt16(at + target.byteOffset, value, false)\n}\n\nfunction write_int32_be(target, value, at) {\n var dv = map.get(target);\n return dv.setInt32(at + target.byteOffset, value, false)\n}\n\nfunction write_float_be(target, value, at) {\n var dv = map.get(target);\n return dv.setFloat32(at + target.byteOffset, value, false)\n}\n\nfunction write_double_be(target, value, at) {\n var dv = map.get(target);\n return dv.setFloat64(at + target.byteOffset, value, false)\n}\n","module.exports = Decoder\n\nvar MSB = 0x80\n , REST = 0x7F\n\n\nfunction Decoder() {\n this.accum = []\n}\nDecoder.prototype.write = write;\n\nfunction write(byte) {\n var msb = byte & MSB\n , accum = this.accum\n , len\n , out\n\n accum[accum.length] = byte & REST\n if(msb) {\n return\n }\n\n len = accum.length\n out = 0\n\n for(var i = 0; i < len; ++i) {\n out |= accum[i] << (7 * i)\n }\n\n accum.length = 0\n this.ondata(out)\n return\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'\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 {Buffer} 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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {Buffer|string} args.object - The object to write. If `object` is a String then it will be converted to a Buffer using UTF-8 encoding.\n *\n * @returns {Promise<{HashBlobResult}>} Resolves successfully with the SHA-1 object id and the wrapped object Buffer.\n * @see HashBlobResult\n *\n * @example\n * let { oid, type, object, format } = await git.hashBlob({\n * object: '$input((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 ({ core = 'default', object }) {\n try {\n // Convert object to buffer\n if (typeof object === 'string') {\n object = Buffer.from(object, 'utf8')\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: _object, format: 'wrapped' }\n } catch (err) {\n err.caller = 'git.hashBlob'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { writeObject as _writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 `CommitDescription`, `TreeDescription`, or `TagDescription` described in...\n * shucks I haven't written that page yet. :( Well, described in the [TypeScript definition](https://github.com/isomorphic-git/isomorphic-git/blob/master/src/index.d.ts) for now.\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {Buffer|string|Object} 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.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] - If `type` is `'blob'` then `content` will be converted to a Buffer 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({ dir: '$input((/))', ref: '$input((HEAD))' })\n * console.log('commit', sha)\n *\n * let oid = await git.writeObject({\n * dir: '$input((/))',\n * type: 'tag',\n * object: {\n * object: sha,\n * type: 'commit',\n * tag: '$input((my-tag))',\n * tagger: {\n * name: '$input((your name))',\n * email: '$input((email@example.com))',\n * timestamp: Math.floor(Date.now()/1000),\n * timezoneOffset: new Date().getTimezoneOffset()\n * },\n * message: '$input((Optional message))',\n * signature: ''\n * }\n * })\n *\n * console.log('tag', oid)\n *\n */\nexport async function writeObject ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\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.entries).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 GitError(E.ObjectTypeUnknownFail, { type })\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 oid = await _writeObject({\n fs,\n gitdir,\n type,\n object,\n oid,\n format: _format\n })\n return oid\n } catch (err) {\n err.caller = 'git.writeObject'\n throw err\n }\n}\n","const path = require('path');\nconst CHARS = { '{': '}', '(': ')', '[': ']'};\nconst STRICT = /\\\\(.)|(^!|\\*|[\\].+)]\\?|\\[[^\\\\\\]]+\\]|\\{[^\\\\}]+\\}|\\(\\?[:!=][^\\\\)]+\\)|\\([^|]+\\|[^\\\\)]+\\)|(\\\\).|([@?!+*]\\(.*\\)))/;\nconst RELAXED = /\\\\(.)|(^!|[*?{}()[\\]]|\\(\\?)/;\n\n/**\n * Detect if a string cointains glob\n * @param {String} str Input string\n * @param {Object} [options] Configuration object\n * @param {Boolean} [options.strict=true] Use relaxed regex if true\n * @returns {Boolean} true if string contains glob\n */\nfunction isglob(str, { strict = true } = {}) {\n if (str === '') return false;\n let match, rgx = strict ? STRICT : RELAXED;\n\n while ((match = rgx.exec(str))) {\n if (match[2]) return true;\n let idx = match.index + match[0].length;\n\n // if an open bracket/brace/paren is escaped,\n // set the index to the next closing character\n let open = match[1];\n let close = open ? CHARS[open] : null;\n if (open && close) {\n let n = str.indexOf(close, idx);\n if (n !== -1) idx = n + 1;\n }\n\n str = str.slice(idx);\n }\n return false;\n}\n\n\n/**\n * Find the static part of a glob-path,\n * split path and return path part\n * @param {String} str Path/glob string\n * @returns {String} static path section of glob\n */\nfunction parent(str, { strict = false } = {}) {\n str = path.normalize(str).replace(/\\/|\\\\/, '/');\n\n // special case for strings ending in enclosure containing path separator\n if (/[\\{\\[].*[\\/]*.*[\\}\\]]$/.test(str)) str += '/';\n\n // preserves full path in case of trailing path separator\n str += 'a';\n\n do {str = path.dirname(str)}\n while (isglob(str, {strict}) || /(^|[^\\\\])([\\{\\[]|\\([^\\)]+$)/.test(str));\n\n // remove escape chars and return result\n return str.replace(/\\\\([\\*\\?\\|\\[\\]\\(\\)\\{\\}])/g, '$1');\n};\n\n\n/**\n * Parse a glob path, and split it by static/glob part\n * @param {String} pattern String path\n * @param {Object} [opts] Options\n * @param {Object} [opts.strict=false] Use strict parsing\n * @returns {Object} object with parsed path\n */\nfunction globalyzer(pattern, opts = {}) {\n let base = parent(pattern, opts);\n let isGlob = isglob(pattern, opts);\n let glob;\n\n if (base != '.') {\n glob = pattern.substr(base.length);\n if (glob.startsWith('/')) glob = glob.substr(1);\n } else {\n glob = pattern;\n }\n\n if (!isGlob) {\n base = path.dirname(pattern);\n glob = base !== '.' ? pattern.substr(base.length) : pattern;\n }\n\n if (glob.startsWith('./')) glob = glob.substr(2);\n if (glob.startsWith('/')) glob = glob.substr(1);\n\n return { base, glob, isGlob };\n}\n\n\nmodule.exports = globalyzer;\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 = shasum(object)\n }\n return { oid, object }\n}\n","// @ts-check\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Add a file to the git index (aka staging area)\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 add to the index\n *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await new Promise((resolve, reject) => fs.writeFile(\n * '$input((/README.md))',\n * `$textarea((# TEST))`,\n * (err) => err ? reject(err) : resolve()\n * ))\n * await git.add({ dir: '$input((/))', filepath: '$input((README.md))' })\n * console.log('done')\n *\n */\nexport async function add ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs)\n\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n await addToIndex({ dir, gitdir, fs, filepath, index })\n }\n )\n // TODO: return all oids for all files added?\n } catch (err) {\n err.caller = 'git.add'\n throw err\n }\n}\n\nasync function addToIndex ({ dir, gitdir, fs, filepath, index }) {\n // TODO: Should ignore UNLESS it's already in the index.\n const ignored = await GitIgnoreManager.isIgnored({\n fs,\n dir,\n gitdir,\n filepath\n })\n if (ignored) return\n const stats = await fs.lstat(join(dir, filepath))\n if (!stats) throw new GitError(E.FileReadError, { filepath })\n if (stats.isDirectory()) {\n const children = await fs.readdir(join(dir, filepath))\n const promises = children.map(child =>\n addToIndex({ dir, gitdir, fs, filepath: join(filepath, child), index })\n )\n await Promise.all(promises)\n } else {\n const object = stats.isSymbolicLink()\n ? await fs.readlink(join(dir, filepath))\n : await fs.read(join(dir, filepath))\n if (object === null) throw new GitError(E.FileReadError, { filepath })\n const oid = await writeObject({ fs, gitdir, type: 'blob', object })\n index.insert({ filepath, stats, oid })\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Add or update a remote\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', remote: '$input((upstream))', url: '$input((https://github.com/isomorphic-git/isomorphic-git))' })\n * console.log('done')\n *\n */\nexport async function addRemote ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n remote,\n url,\n force = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (remote === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'addRemote',\n parameter: 'remote'\n })\n }\n if (url === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'addRemote',\n parameter: 'url'\n })\n }\n if (remote !== cleanGitRef.clean(remote)) {\n throw new GitError(E.InvalidRefNameError, {\n verb: 'add',\n noun: 'remote',\n ref: remote,\n suggestion: cleanGitRef.clean(remote)\n })\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 GitError(E.AddingRemoteWouldOverwrite, { 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 } catch (err) {\n err.caller = 'git.addRemote'\n throw err\n }\n}\n","// @ts-check\nimport { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Read and/or write 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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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} [args.value] - (Optional) A value to store at that path\n * @param {boolean} [args.all = false] - If the config file contains multiple values, return them all as an array.\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 with the config value\n *\n * @example\n * // Write config value\n * await git.config({\n * dir: '$input((/))',\n * path: '$input((user.name))',\n * value: '$input((Mr. Test))'\n * })\n *\n * // Read config value\n * let value = await git.config({\n * dir: '$input((/))',\n * path: '$input((user.name))'\n * })\n * console.log(value)\n *\n */\nexport async function config (args) {\n // These arguments are not in the function signature but destructured separately\n // as a result of a bit of a design flaw that requires the un-destructured argument object\n // in order to call args.hasOwnProperty('value') later on.\n const {\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n all = false,\n append = false,\n path,\n value\n } = args\n try {\n const fs = new FileSystem(_fs)\n const config = await GitConfigManager.get({ fs, gitdir })\n // This carefully distinguishes between\n // 1) there is no 'value' argument (do a \"get\")\n // 2) there is a 'value' argument with a value of undefined (do a \"set\")\n // Because setting a key to undefined is how we delete entries from the ini.\n if (\n value === undefined &&\n !Object.prototype.hasOwnProperty.call(args, 'value')\n ) {\n if (all) {\n return config.getall(path)\n } else {\n return config.get(path)\n }\n } else {\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 }\n } catch (err) {\n err.caller = 'git.config'\n throw err\n }\n}\n","import { config } from '../commands/config'\n\nexport async function normalizeAuthorObject ({ fs, gitdir, author = {} }) {\n let { name, email, date, timestamp, timezoneOffset } = author\n name = name || (await config({ fs, gitdir, path: 'user.name' }))\n email = email || (await config({ fs, gitdir, path: 'user.email' }))\n\n if (name === undefined || email === undefined) {\n return undefined\n }\n\n date = date || new Date()\n timestamp = timestamp != null ? timestamp : Math.floor(date.valueOf() / 1000)\n timezoneOffset =\n timezoneOffset != null ? timezoneOffset : date.getTimezoneOffset()\n\n return { name, email, date, timestamp, timezoneOffset }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag'\nimport { E, GitError } from '../models/GitError.js'\nimport { readObject } from '../storage/readObject.js'\nimport { writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create an annotated tag.\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 = ''] - 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 {string} [args.tagger.date] - Set the tagger timestamp field. Default is the current date.\n * @param {string} [args.tagger.timestamp] - Set the tagger timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.\n * @param {string} [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.signature] - The signature attatched 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 `signature` 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 *\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 core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n tagger,\n message = ref,\n signature,\n object,\n signingKey,\n force = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'annotatedTag',\n parameter: 'ref'\n })\n }\n\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new GitError(E.RefExistsError, { noun: '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 if (signature && signingKey) {\n throw new GitError(E.InvalidParameterCombinationError, {\n function: 'annotatedTag',\n parameters: ['signature', 'signingKey']\n })\n }\n\n // Fill in missing arguments with default values\n tagger = await normalizeAuthorObject({ fs, gitdir, author: tagger })\n if (tagger === undefined) {\n throw new GitError(E.MissingTaggerError)\n }\n\n const { type } = await readObject({ fs, gitdir, oid })\n let tagObject = GitAnnotatedTag.from({\n object: oid,\n type,\n tag: ref.replace('refs/tags/', ''),\n tagger,\n message,\n signature\n })\n if (signingKey) {\n const pgp = cores.get(core).get('pgp')\n tagObject = await GitAnnotatedTag.sign(tagObject, pgp, 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 } catch (err) {\n err.caller = 'git.annotatedTag'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create a branch\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {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.branch({ dir: '$input((/))', ref: '$input((develop))' })\n * console.log('done')\n *\n */\nexport async function branch ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n checkout = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'branch',\n parameter: 'ref'\n })\n }\n\n if (ref !== cleanGitRef.clean(ref)) {\n throw new GitError(E.InvalidRefNameError, {\n verb: 'create',\n noun: 'branch',\n ref,\n suggestion: cleanGitRef.clean(ref)\n })\n }\n\n const fullref = `refs/heads/${ref}`\n\n const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref })\n if (exist) {\n throw new GitError(E.RefExistsError, { noun: 'branch', ref })\n }\n\n // Get current HEAD tree oid\n let oid\n try {\n oid = await GitRefManager.resolve({ fs, gitdir, ref: '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 } catch (err) {\n err.caller = 'git.branch'\n throw err\n }\n}\n","import globalyzer from 'globalyzer'\n\nexport const patternRoot = pattern => {\n // return pattern.split('*', 1)[0]\n const base = globalyzer(pattern).base\n return base === '.' ? '' : base\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","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { join } from '../utils/join'\nimport { log } from '../utils/log.js'\nimport { normalizeStats } from '../utils/normalizeStats.js'\nimport { shasum } from '../utils/shasum.js'\n\nimport { FileSystem } from './FileSystem.js'\nimport { GitObject } from './GitObject.js'\n\nexport class GitWalkerFs {\n constructor ({ fs: _fs, dir, gitdir }) {\n const fs = new FileSystem(_fs)\n this.fs = fs\n this.dir = dir\n this.gitdir = gitdir\n const walker = this\n this.ConstructEntry = class FSEntry {\n constructor (entry) {\n Object.assign(this, entry)\n }\n\n async populateStat () {\n if (!this.exists) return\n await walker.populateStat(this)\n }\n\n async populateContent () {\n if (!this.exists) return\n await walker.populateContent(this)\n }\n\n async populateHash () {\n if (!this.exists) return\n await walker.populateHash(this)\n }\n }\n }\n\n async readdir (entry) {\n if (!entry.exists) return []\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 => ({\n fullpath: join(filepath, name),\n basename: name,\n exists: true\n }))\n }\n\n async populateStat (entry) {\n if (!entry.exists) return\n const { fs, dir } = this\n let stats = await fs.lstat(`${dir}/${entry.fullpath}`)\n let type = stats.isDirectory() ? 'tree' : 'blob'\n if (type === 'blob' && !stats.isFile() && !stats.isSymbolicLink()) {\n type = 'special'\n }\n if (!stats) {\n throw new Error(\n `ENOENT: no such file or directory, lstat '${entry.fullpath}'`\n )\n }\n stats = normalizeStats(stats)\n Object.assign(entry, { type }, stats)\n }\n\n async populateContent (entry) {\n if (!entry.exists) return\n const { fs, dir } = this\n const content = await fs.read(`${dir}/${entry.fullpath}`)\n // workaround for a BrowserFS edge case\n if (entry.size === -1) entry.size = content.length\n Object.assign(entry, { content })\n }\n\n async populateHash (entry) {\n if (!entry.exists) return\n const { fs, gitdir } = this\n let oid\n // See if we can use the SHA1 hash in the index.\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n const stage = index.entriesMap.get(entry.fullpath)\n if (!stage || compareStats(entry, stage)) {\n log(`INDEX CACHE MISS: calculating SHA for ${entry.fullpath}`)\n if (!entry.content) await entry.populateContent()\n oid = shasum(GitObject.wrap({ type: 'blob', object: entry.content }))\n if (stage && oid === stage.oid) {\n index.insert({\n filepath: entry.fullpath,\n stats: entry,\n oid: oid\n })\n }\n } else {\n // Use the index SHA1 rather than compute it\n oid = stage.oid\n }\n }\n )\n Object.assign(entry, { oid })\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitWalkerFs } from '../models/GitWalkerFs.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\nimport { GitWalkerSymbol } from '../utils/symbols.js'\n\n/**\n *\n * @typedef Walker\n * @property {Symbol} Symbol('GitWalkerSymbol')\n */\n\n/**\n * Get a working directory Walker\n *\n * See [walkBeta1](./walkBeta1.md)\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\n * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path\n * @param {string} [args.gitdir=join(dir, '.git')] - The [git directory](dir-vs-gitdir.md) path\n *\n * @returns {Walker} Returns a working directory Walker\n *\n */\nexport function WORKDIR ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs')\n}) {\n const fs = new FileSystem(_fs)\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkerSymbol, {\n value: function () {\n return new GitWalkerFs({ fs, dir, gitdir })\n }\n })\n Object.freeze(o)\n return o\n}\n","// @ts-check\nimport globrex from 'globrex'\n\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { patternRoot } from '../utils/patternRoot.js'\nimport { cores } from '../utils/plugins.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\nimport { TREE } from './TREE.js'\nimport { WORKDIR } from './WORKDIR'\nimport { config } from './config'\nimport { walkBeta1 } from './walkBeta1.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md)\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name\n * @param {string} args.ref - Which branch to checkout\n * @param {string[]} [args.filepaths = ['.']] - Limit the checkout to the given files and directories\n * @param {string} [args.pattern = null] - Only checkout the files that match a glob pattern. (Pattern is relative to `filepaths` if `filepaths` is provided.)\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 *\n * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * // checkout the master branch\n * await git.checkout({ dir: '$input((/))', ref: '$input((master))' })\n * console.log('done')\n *\n * @example\n * // checkout only JSON and Markdown files from master branch\n * await git.checkout({ dir: '$input((/))', ref: '$input((master))', pattern: '$input((**\\/*.{json,md}))' })\n * console.log('done')\n *\n */\nexport async function checkout ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n remote = 'origin',\n ref,\n filepaths = ['.'],\n pattern = null,\n noCheckout = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'checkout',\n parameter: 'ref'\n })\n }\n let patternPart = ''\n let patternGlobrex\n if (pattern) {\n patternPart = patternRoot(pattern)\n if (patternPart) {\n pattern = pattern.replace(patternPart + '/', '')\n }\n patternGlobrex = globrex(pattern, { globstar: true, extended: true })\n }\n const bases = filepaths.map(filepath => join(filepath, patternPart))\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` 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 // Set up remote tracking branch\n await config({\n gitdir,\n fs,\n path: `branch.${ref}.remote`,\n value: `${remote}`\n })\n await config({\n gitdir,\n fs,\n path: `branch.${ref}.merge`,\n value: `refs/heads/${ref}`\n })\n // Create a new branch that points at that same commit\n await fs.write(`${gitdir}/refs/heads/${ref}`, oid + '\\n')\n }\n const fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n\n if (!noCheckout) {\n let count = 0\n // Acquire a lock on the index\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n // TODO: Big optimization possible here.\n // Instead of deleting and rewriting everything, only delete files\n // that are not present in the new branch, and only write files that\n // are not in the index or are in the index but have the wrong SHA.\n for (const entry of index) {\n try {\n await fs.rm(join(dir, entry.path))\n if (emitter) {\n emitter.emit(`${emitterPrefix}progress`, {\n phase: 'Updating workdir',\n loaded: ++count,\n lengthComputable: false\n })\n }\n } catch (err) {}\n }\n index.clear()\n try {\n await walkBeta1({\n trees: [TREE({ fs, gitdir, ref }), WORKDIR({ fs, dir, gitdir })],\n filter: async function ([head, workdir]) {\n // match against base paths\n return bases.some(base => worthWalking(head.fullpath, base))\n },\n map: async function ([head, workdir]) {\n if (head.fullpath === '.') return\n if (!head.exists) return\n // Late filter against file names\n if (patternGlobrex) {\n let match = false\n for (const base of bases) {\n const partToMatch = head.fullpath.replace(base + '/', '')\n if (patternGlobrex.regex.test(partToMatch)) {\n match = true\n break\n }\n }\n if (!match) return\n }\n await head.populateStat()\n const filepath = `${dir}/${head.fullpath}`\n switch (head.type) {\n case 'tree': {\n // ignore directories for now\n if (!workdir.exists) await fs.mkdir(filepath)\n break\n }\n case 'commit': {\n // gitlinks\n console.log(\n new GitError(E.NotImplementedFail, {\n thing: 'submodule support'\n })\n )\n break\n }\n case 'blob': {\n await head.populateContent()\n await head.populateHash()\n if (head.mode === '100644') {\n // regular file\n await fs.write(filepath, head.content)\n } else if (head.mode === '100755') {\n // executable file\n await fs.write(filepath, head.content, { mode: 0o777 })\n } else if (head.mode === '120000') {\n // symlink\n await fs.writelink(filepath, head.content)\n } else {\n throw new GitError(E.InternalFail, {\n message: `Invalid mode \"${head.mode}\" detected in blob ${head.oid}`\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 (head.mode === '100755') {\n stats.mode = 0o755\n }\n index.insert({\n filepath: head.fullpath,\n stats,\n oid: head.oid\n })\n if (emitter) {\n emitter.emit(`${emitterPrefix}progress`, {\n phase: 'Updating workdir',\n loaded: ++count,\n lengthComputable: false\n })\n }\n break\n }\n default: {\n throw new GitError(E.ObjectTypeAssertionInTreeFail, {\n type: head.type,\n oid: head.oid,\n entrypath: head.fullpath\n })\n }\n }\n }\n })\n } catch (err) {\n // Throw a more helpful error message for this common mistake.\n if (err.code === E.ReadObjectFail && err.data.oid === oid) {\n throw new GitError(E.CommitNotFetchedError, { ref, oid })\n } else {\n throw err\n }\n }\n }\n )\n }\n // Update HEAD\n const content = fullRef.startsWith('refs/heads') ? `ref: ${fullRef}` : oid\n await fs.write(`${gitdir}/HEAD`, `${content}\\n`)\n } catch (err) {\n err.caller = 'git.checkout'\n throw err\n }\n}\n","import { FileSystem } from '../models/FileSystem.js'\n\nexport async function hasObjectLoose ({ fs: _fs, gitdir, oid }) {\n const fs = new FileSystem(_fs)\n const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`\n return fs.exists(`${gitdir}/${source}`)\n}\n","import { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function hasObjectPacked ({\n fs: _fs,\n gitdir,\n oid,\n getExternalRefDelta\n}) {\n const fs = new FileSystem(_fs)\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 filename: indexFile,\n getExternalRefDelta\n })\n if (p.error) throw new GitError(E.InternalFail, { message: 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 { FileSystem } from '../models/FileSystem.js'\nimport { hasObjectLoose } from '../storage/hasObjectLoose.js'\nimport { hasObjectPacked } from '../storage/hasObjectPacked.js'\nimport { readObject } from '../storage/readObject.js'\n\nexport async function hasObject ({ fs: _fs, gitdir, oid, format = 'content' }) {\n const fs = new FileSystem(_fs)\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, 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({ fs, gitdir, oid, getExternalRefDelta })\n }\n // Finally\n return result\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 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","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { hasObject } from '../storage/hasObject.js'\nimport { 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 { cores } from '../utils/plugins.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseUploadPackResponse } from '../wire/parseUploadPackResponse.js'\nimport { writeUploadPackRequest } from '../wire/writeUploadPackRequest.js'\n\nimport { config } from './config'\n\n/**\n *\n * @typedef {object} FetchResponse - The object returned has the following schema:\n * @property {string | null} defaultBranch - The branch that is cloned if no branch is specified (typically \"master\")\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 * Future versions of isomorphic-git might return additional metadata.\n *\n * To monitor progress events, see the documentation for the [`'emitter'` plugin](./plugin_emitter.md).\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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. 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 {string} [args.ref = 'HEAD'] - Which branch to fetch. By default this is the currently checked out branch.\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.noGitSuffix = false] - If true, clone will not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**)\n * @param {boolean} [args.tags = false] - Also fetch tags\n * @param {string} [args.remote] - 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 {string} [args.username] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.password] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.token] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.oauth2format] - See the [Authentication](./authentication.html) documentation\n * @param {object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {boolean} [args.prune] - Delete local remote-tracking branches that are not present on the remote\n * @param {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md).\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name.\n *\n * @returns {Promise} Resolves successfully when fetch completes\n * @see FetchResponse\n *\n * @example\n * await git.fetch({\n * dir: '$input((/))',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: '$input((https://github.com/isomorphic-git/isomorphic-git))',\n * ref: '$input((master))',\n * depth: $input((1)),\n * singleBranch: $input((true)),\n * tags: $input((false))\n * })\n * console.log('done')\n *\n */\nexport async function fetch ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n ref = 'HEAD',\n // @ts-ignore\n refs,\n remote,\n url,\n noGitSuffix = false,\n corsProxy,\n // @ts-ignore\n authUsername,\n // @ts-ignore\n authPassword,\n username = authUsername,\n password = authPassword,\n token,\n oauth2format,\n depth = null,\n since = null,\n exclude = [],\n relative = false,\n tags = false,\n singleBranch = false,\n headers = {},\n prune = false,\n // @ts-ignore\n onprogress // deprecated\n}) {\n try {\n if (onprogress !== undefined) {\n console.warn(\n 'The `onprogress` callback has been deprecated. Please use the more generic `emitter` EventEmitter argument instead.'\n )\n }\n const fs = new FileSystem(_fs)\n const response = await fetchPackfile({\n core,\n gitdir,\n fs,\n emitter,\n emitterPrefix,\n ref,\n refs,\n remote,\n url,\n noGitSuffix,\n corsProxy,\n username,\n password,\n token,\n oauth2format,\n depth,\n since,\n exclude,\n relative,\n tags,\n singleBranch,\n headers,\n prune\n })\n if (response === null) {\n return {\n defaultBranch: null,\n fetchHead: null,\n fetchHeadDescription: null\n }\n }\n if (emitter) {\n const lines = splitLines(response.progress)\n forAwait(lines, line => {\n // As a historical accident, 'message' events were trimmed removing valuable information,\n // such as \\r by itself which was a single to update the existing line instead of appending a new one.\n // TODO NEXT BREAKING RELEASE: make 'message' behave like 'rawmessage' and remove 'rawmessage'.\n emitter.emit(`${emitterPrefix}message`, line.trim())\n emitter.emit(`${emitterPrefix}rawmessage`, line)\n const matches = line.match(/([^:]*).*\\((\\d+?)\\/(\\d+?)\\)/)\n if (matches) {\n emitter.emit(`${emitterPrefix}progress`, {\n phase: matches[1].trim(),\n loaded: parseInt(matches[2], 10),\n total: parseInt(matches[3], 10),\n lengthComputable: true\n })\n }\n })\n }\n const packfile = await collect(response.packfile)\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, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack: packfile,\n getExternalRefDelta,\n emitter,\n emitterPrefix\n })\n await fs.write(fullpath.replace(/\\.pack$/, '.idx'), idx.toBuffer())\n }\n return res\n } catch (err) {\n err.caller = 'git.fetch'\n throw err\n }\n}\n\nasync function fetchPackfile ({\n core,\n gitdir,\n fs: _fs,\n emitter,\n emitterPrefix,\n ref,\n refs = [ref],\n remote,\n url,\n noGitSuffix,\n corsProxy,\n username,\n password,\n token,\n oauth2format,\n depth,\n since,\n exclude,\n relative,\n tags,\n singleBranch,\n headers,\n prune\n}) {\n const fs = new FileSystem(_fs)\n // Sanity checks\n if (depth !== null) {\n if (Number.isNaN(parseInt(depth))) {\n throw new GitError(E.InvalidDepthParameterError, { depth })\n }\n depth = parseInt(depth)\n }\n // Set missing values\n remote = remote || 'origin'\n if (url === undefined) {\n url = await config({\n fs,\n gitdir,\n path: `remote.${remote}.url`\n })\n }\n if (corsProxy === undefined) {\n corsProxy = await config({ fs, gitdir, path: 'http.corsProxy' })\n }\n let auth = { username, password, token, oauth2format }\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const remoteHTTP = await GitRemoteHTTP.discover({\n core,\n corsProxy,\n service: 'git-upload-pack',\n url,\n noGitSuffix,\n auth,\n headers\n })\n 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 null\n }\n // Check that the remote supports the requested features\n if (depth !== null && !remoteHTTP.capabilities.has('shallow')) {\n throw new GitError(E.RemoteDoesNotSupportShallowFail)\n }\n if (since !== null && !remoteHTTP.capabilities.has('deepen-since')) {\n throw new GitError(E.RemoteDoesNotSupportDeepenSinceFail)\n }\n if (exclude.length > 0 && !remoteHTTP.capabilities.has('deepen-not')) {\n throw new GitError(E.RemoteDoesNotSupportDeepenNotFail)\n }\n if (relative === true && !remoteHTTP.capabilities.has('deepen-relative')) {\n throw new GitError(E.RemoteDoesNotSupportDeepenRelativeFail)\n }\n // Figure out the SHA for the requested ref\n const { oid, fullref } = GitRefManager.resolveAgainstMap({\n ref,\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 'thin-pack',\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 ? refs\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, 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 = await collect(packstream)\n const raw = await GitRemoteHTTP.connect({\n core,\n emitter,\n emitterPrefix,\n corsProxy,\n service: 'git-upload-pack',\n url,\n noGitSuffix,\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, gitdir, oid })\n const commit = new GitCommit(object)\n const hasParents = await Promise.all(\n commit.headers().parent.map(oid => hasObject({ fs, 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 refs.set(key, remoteRefs.get(key))\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 })\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 return response\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","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Initialize a new repository\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 * @returns {Promise} Resolves successfully when filesystem operations are complete\n *\n * @example\n * await git.init({ dir: '$input((/))' })\n * console.log('done')\n *\n */\nexport async function init ({\n core = 'default',\n bare = false,\n dir,\n gitdir = bare ? dir : join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs')\n}) {\n try {\n const fs = new FileSystem(_fs)\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 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/master\\n')\n } catch (err) {\n err.caller = 'git.init'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { checkout } from './checkout.js'\nimport { config } from './config.js'\nimport { fetch } from './fetch.js'\nimport { init } from './init.js'\n\n/**\n * Clone a repository\n *\n * To monitor progress events, see the documentation for the [`'emitter'` plugin](./plugin_emitter.md).\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 clone. 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.noGitSuffix = false] - If true, clone will not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**.)\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 {string} [args.username] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.password] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.token] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.oauth2format] - See the [Authentication](./authentication.html) documentation\n * @param {object} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md)\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name\n *\n * @returns {Promise} Resolves successfully when clone completes\n *\n * @example\n * await git.clone({\n * dir: '$input((/))',\n * corsProxy: 'https://cors.isomorphic-git.org',\n * url: '$input((https://github.com/isomorphic-git/isomorphic-git))',\n * $textarea((singleBranch: true,\n * depth: 1))\n * })\n * console.log('done')\n *\n */\nexport async function clone ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n url,\n noGitSuffix = false,\n corsProxy = undefined,\n ref = undefined,\n remote = 'origin',\n // @ts-ignore\n authUsername,\n // @ts-ignore\n authPassword,\n username = undefined,\n password = undefined,\n token = undefined,\n oauth2format = undefined,\n depth = undefined,\n since = undefined,\n exclude = [],\n relative = false,\n singleBranch = false,\n noCheckout = false,\n noTags = false,\n headers = {},\n // @ts-ignore\n onprogress\n}) {\n try {\n if (onprogress !== undefined) {\n console.warn(\n 'The `onprogress` callback has been deprecated. Please use the more generic `emitter` EventEmitter argument instead.'\n )\n }\n const fs = new FileSystem(_fs)\n username = username === undefined ? authUsername : username\n password = password === undefined ? authPassword : password\n await init({ gitdir, fs })\n // Add remote\n await config({\n gitdir,\n fs,\n path: `remote.${remote}.url`,\n value: url\n })\n await config({\n gitdir,\n fs,\n path: `remote.${remote}.fetch`,\n value: `+refs/heads/*:refs/remotes/${remote}/*`\n })\n if (corsProxy) {\n await config({\n gitdir,\n fs,\n path: `http.corsProxy`,\n value: corsProxy\n })\n }\n // Fetch commits\n const { defaultBranch, fetchHead } = await fetch({\n core,\n gitdir,\n fs,\n emitter,\n emitterPrefix,\n noGitSuffix,\n ref,\n remote,\n username,\n password,\n token,\n oauth2format,\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 dir,\n gitdir,\n fs,\n emitter,\n emitterPrefix,\n ref,\n remote,\n noCheckout\n })\n } catch (err) {\n err.caller = 'git.clone'\n throw err\n }\n}\n","// @ts-check\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { writeObject } from '../storage/writeObject.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\nimport { join } from '../utils/join.js'\nimport { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create a new commit\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {string} [args.author.date] - Set the author timestamp field. Default is the current date.\n * @param {string} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.\n * @param {string} [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.signingKey] - Sign the tag object using this private PGP key.\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 *\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 * dir: '$input((/))',\n * author: {\n * name: '$input((Mr. Test))',\n * email: '$input((mrtest@example.com))'\n * },\n * message: '$input((Added the a.txt file))'\n * })\n * console.log(sha)\n *\n */\nexport async function commit ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n message,\n author,\n committer,\n signingKey,\n noUpdateBranch = false,\n ref,\n parent,\n tree\n}) {\n try {\n const fs = new FileSystem(_fs)\n\n if (!ref) {\n ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2\n })\n }\n\n if (message === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'commit',\n parameter: 'message'\n })\n }\n\n // Fill in missing arguments with default values\n author = await normalizeAuthorObject({ fs, gitdir, author })\n if (author === undefined) {\n throw new GitError(E.MissingAuthorError)\n }\n\n committer = Object.assign({}, committer || author)\n // Match committer's date to author's one, if omitted\n committer.date = committer.date || author.date\n committer = await normalizeAuthorObject({ fs, gitdir, author: committer })\n if (committer === undefined) {\n throw new GitError(E.MissingCommitterError)\n }\n\n let oid\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\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 })\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 }\n let comm = GitCommit.from({\n tree,\n parent,\n author,\n committer,\n message\n })\n if (signingKey) {\n const pgp = cores.get(core).get('pgp')\n comm = await GitCommit.sign(comm, pgp, signingKey)\n }\n oid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object: comm.toObject()\n })\n if (!noUpdateBranch) {\n // Update branch pointer\n await GitRefManager.writeRef({\n fs,\n gitdir,\n ref,\n value: oid\n })\n }\n }\n )\n return oid\n } catch (err) {\n err.caller = 'git.commit'\n throw err\n }\n}\n\nasync function constructTree ({ fs, gitdir, inode }) {\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 })\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 })\n return oid\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Get the name of the branch currently pointed to by .git/HEAD\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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/master\") instead of the abbreviated form.\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({ dir: '$input((/))', fullname: $input((false)) })\n * console.log(branch)\n *\n */\nexport async function currentBranch ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n fullname = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n const ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2\n })\n // Return `undefined` for detached HEAD\n if (!ref.startsWith('refs/')) return\n return fullname ? ref : abbreviateRef(ref)\n } catch (err) {\n err.caller = 'git.currentBranch'\n throw err\n }\n}\n","// @ts-check\nimport cleanGitRef from 'clean-git-ref'\n\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { currentBranch } from './currentBranch'\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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((local-branch))' })\n * console.log('done')\n *\n */\nexport async function deleteBranch ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'deleteBranch',\n parameter: 'ref'\n })\n }\n\n if (ref !== cleanGitRef.clean(ref)) {\n throw new GitError(E.InvalidRefNameError, {\n verb: 'delete',\n noun: 'branch',\n ref,\n suggestion: cleanGitRef.clean(ref)\n })\n }\n\n const exist = await fs.exists(`${gitdir}/refs/heads/${ref}`)\n if (!exist) {\n throw new GitError(E.RefNotExistsError, {\n verb: 'delete',\n noun: 'branch',\n ref\n })\n }\n\n const currentRef = await currentBranch({ fs, gitdir })\n if (ref === currentRef) {\n throw new GitError(E.BranchDeleteError, { ref })\n }\n\n // Delete a specified branch\n await fs.rm(`${gitdir}/refs/heads/${ref}`)\n } catch (err) {\n err.caller = 'git.deleteBranch'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Delete a local ref\n *\n * > Note: This only deletes loose refs - it should be fixed in the future to delete packed refs as well.\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((refs/tags/test-tag))' })\n * console.log('done')\n *\n */\nexport async function deleteRef ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref\n}) {\n try {\n const fs = new FileSystem(_fs)\n await GitRefManager.deleteRef({ 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'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Removes the local config entry for a given remote\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', remote: '$input((upstream))' })\n * console.log('done')\n *\n */\nexport async function deleteRemote ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n remote\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (remote === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'deleteRemote',\n parameter: 'remote'\n })\n }\n const config = await GitConfigManager.get({ fs, gitdir })\n await config.deleteSection('remote', remote)\n await GitConfigManager.save({ fs, gitdir, config })\n } catch (err) {\n err.caller = 'git.deleteRemote'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { deleteRef } from './deleteRef'\n\n/**\n * Delete a local tag ref\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((test-tag))' })\n * console.log('done')\n *\n */\nexport async function deleteTag ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'deleteTag',\n parameter: 'ref'\n })\n }\n ref = ref.startsWith('refs/tags/') ? ref : `refs/tags/${ref}`\n await deleteRef({ fs, gitdir, ref })\n } catch (err) {\n err.caller = 'git.deleteTag'\n throw err\n }\n}\n","import { FileSystem } from '../models/FileSystem.js'\n\nexport async function expandOidLoose ({ fs: _fs, gitdir, oid: short }) {\n const fs = new FileSystem(_fs)\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 { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readPackIndex } from '../storage/readPackIndex.js'\nimport { join } from '../utils/join.js'\n\nexport async function expandOidPacked ({\n fs: _fs,\n gitdir,\n oid: short,\n getExternalRefDelta\n}) {\n const fs = new FileSystem(_fs)\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 filename: indexFile,\n getExternalRefDelta\n })\n if (p.error) throw new GitError(E.InternalFail, { message: 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 { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { expandOidLoose } from '../storage/expandOidLoose.js'\nimport { expandOidPacked } from '../storage/expandOidPacked.js'\nimport { readObject } from '../storage/readObject.js'\n\nexport async function expandOid ({ fs: _fs, gitdir, oid: short }) {\n const fs = new FileSystem(_fs)\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: _fs, gitdir, oid })\n\n const results1 = await expandOidLoose({ fs, gitdir, oid: short })\n const results2 = await expandOidPacked({\n fs,\n gitdir,\n oid: short,\n getExternalRefDelta\n })\n const results = results1.concat(results2)\n\n if (results.length === 1) {\n return results[0]\n }\n if (results.length > 1) {\n throw new GitError(E.AmbiguousShortOid, {\n short,\n matches: results.join(', ')\n })\n }\n throw new GitError(E.ShortOidNotFound, { short })\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { expandOid as _expandOid } from '../storage/expandOid.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Expand and resolve a short oid into a full oid\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully with the full oid (like \"0414d2a286d7bbc7a4a326a61c1f9f888a8ab87f\")\n *\n * @example\n * let oid = await git.expandOid({ dir: '$input((/))', oid: '$input((0414d2a))'})\n * console.log(oid)\n *\n */\nexport async function expandOid ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oid\n}) {\n try {\n const fs = new FileSystem(_fs)\n const fullOid = await _expandOid({\n fs,\n gitdir,\n oid\n })\n return fullOid\n } catch (err) {\n err.caller = 'git.expandOid'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Expand an abbreviated ref to its full name\n *\n * @param {Object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((master))'})\n * console.log(fullRef)\n *\n */\nexport async function expandRef ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref\n}) {\n try {\n const fs = new FileSystem(_fs)\n const fullref = await GitRefManager.expand({\n fs,\n gitdir,\n ref\n })\n return fullref\n } catch (err) {\n err.caller = 'git.expandRef'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Find the merge base for a set of commits\n *\n * @link https://isomorphic-git.github.io/docs/findMergeBase.html\n */\n// TODO: Should I rename this nearestCommonAncestor?\nexport async function findMergeBase ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oids\n}) {\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 try {\n const fs = new FileSystem(_fs)\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 = []\n for (const { oid, index } of heads) {\n try {\n const { object } = await readObject({ fs, gitdir, oid })\n const commit = GitCommit.from(object)\n const { parent } = commit.parseHeaders()\n for (const oid of parent) {\n newheads.push({ oid, index })\n }\n } catch (err) {\n // do nothing\n }\n }\n heads = newheads\n }\n return []\n } catch (err) {\n err.caller = 'git.findMergeBase'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { dirname } from '../utils/dirname.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {GitRootNotFoundError}\n *\n * @example\n * let gitroot = await git.findRoot({\n * filepath: '$input((/path/to/some/gitrepo/path/to/some/file.txt))'\n * })\n * console.log(gitroot) // '/path/to/some/gitrepo'\n *\n */\nexport async function findRoot ({\n core = 'default',\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs)\n return _findRoot(fs, filepath)\n } catch (err) {\n err.caller = 'git.findRoot'\n throw err\n }\n}\n\nasync 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 GitError(E.GitRootNotFoundError, { filepath })\n }\n return _findRoot(fs, parent)\n }\n}\n","// @ts-check\nimport { GitRemoteHTTP } from '../managers/GitRemoteHTTP.js'\n\n/**\n *\n * @typedef {Object} RemoteDescription - 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 {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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\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 {boolean} [args.noGitSuffix = false] - If true, clone will not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**)\n * @param {string} [args.username] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.password] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.token] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.oauth2format] - See the [Authentication](./authentication.html) documentation\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 RemoteDescription\n *\n * @example\n * let info = await git.getRemoteInfo({\n * url:\n * \"$input((https://cors.isomorphic-git.org/github.com/isomorphic-git/isomorphic-git.git))\"\n * });\n * console.log(info);\n *\n */\nexport async function getRemoteInfo ({\n core = 'default',\n corsProxy,\n url,\n // @ts-ignore\n authUsername,\n // @ts-ignore\n authPassword,\n noGitSuffix = false,\n username = authUsername,\n password = authPassword,\n token,\n oauth2format,\n headers = {},\n forPush = false\n}) {\n try {\n let auth = { username, password, token, oauth2format }\n const remote = await GitRemoteHTTP.discover({\n core,\n corsProxy,\n service: forPush ? 'git-receive-pack' : 'git-upload-pack',\n url,\n noGitSuffix,\n auth,\n headers\n })\n auth = remote.auth // hack to get new credentials from CredentialManager API\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 { FileSystem } from '../models/FileSystem.js'\nimport { GitPackIndex } from '../models/GitPackIndex.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create the .idx file for a given .pack file\n *\n * To monitor progress events, see the documentation for the [`'emitter'` plugin](./plugin_emitter.md).\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md).\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name.\n *\n * @returns {Promise} Resolves when filesystem operations are complete\n *\n * @example\n * await git.indexPack({ dir: '$input((/))', filepath: '$input((pack-9cbd243a1caa4cb4bef976062434a958d82721a9.pack))' })\n * console.log('done')\n *\n */\nexport async function indexPack ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs)\n filepath = join(dir, filepath)\n const pack = await fs.read(filepath)\n const getExternalRefDelta = oid => readObject({ fs, gitdir, oid })\n const idx = await GitPackIndex.fromPack({\n pack,\n getExternalRefDelta,\n emitter,\n emitterPrefix\n })\n await fs.write(filepath.replace(/\\.pack$/, '.idx'), idx.toBuffer())\n } catch (err) {\n err.caller = 'git.indexPack'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Check whether a git commit is descended from another\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves to true if `oid` is a descendent of `ancestor`\n *\n * @example\n * let oid = await git.resolveRef({ dir: '$input((/))', ref: '$input((master))' })\n * let ancestor = await git.resolveRef({ dir: '$input((/))', ref: '$input((v0.20.0))' })\n * console.log(oid, ancestor)\n * await git.isDescendent({ dir: '$input((/))', oid, ancestor, depth: $input((-1)) })\n *\n */\nexport async function isDescendent ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oid,\n ancestor,\n depth = -1\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (!oid) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'isDescendent',\n parameter: 'oid'\n })\n }\n if (!ancestor) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'isDescendent',\n parameter: 'ancestor'\n })\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 GitError(E.MaxSearchDepthExceeded, { depth })\n }\n const oid = queue.shift()\n const { type, object } = await readObject({\n fs,\n gitdir,\n oid\n })\n if (type !== 'commit') {\n throw new GitError(E.ResolveCommitError, { oid })\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\n for (const parent of commit.parent) {\n if (!visited.has(parent)) {\n queue.push(parent)\n visited.add(parent)\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 } catch (err) {\n err.caller = 'git.isDescendent'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))' })\n * console.log(branches)\n * let remoteBranches = await git.listBranches({ dir: '$input((/))', remote: '$input((origin))' })\n * console.log(remoteBranches)\n *\n */\nexport async function listBranches ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n remote = undefined\n}) {\n try {\n const fs = new FileSystem(_fs)\n return GitRefManager.listBranches({ fs, gitdir, remote })\n } catch (err) {\n err.caller = 'git.listBranches'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { readObject as _readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\nimport { resolveTree } from '../utils/resolveTree.js'\n\n/**\n *\n * @typedef {Object} CommitDescription\n * @property {string} oid - SHA-1 object id of this commit\n * @property {string} message - commit message\n * @property {string} tree - SHA-1 object id of corresponding file tree\n * @property {string[]} parent - an array of zero or more SHA-1 object ids\n * @property {Object} author\n * @property {string} author.name - the author's name\n * @property {string} author.email - the author's email\n * @property {number} author.timestamp - UTC Unix timestamp in seconds\n * @property {number} author.timezoneOffset - timezone difference from UTC in minutes\n * @property {Object} committer\n * @property {string} committer.name - the committer's name\n * @property {string} committer.email - the committer's email\n * @property {number} committer.timestamp - UTC Unix timestamp in seconds\n * @property {number} committer.timezoneOffset - timezone difference from UTC in minutes\n * @property {string} [gpgsig] - PGP signature (if present)\n */\n\n/**\n *\n * @typedef {Object} TreeEntry\n * @property {string} mode\n * @property {string} path\n * @property {string} oid\n * @property {string} [type]\n */\n\n/**\n *\n * @typedef {Object} TreeDescription\n * @property {TreeEntry[]} entries\n */\n\n/**\n *\n * @typedef {Object} GitObjectDescription - The object returned has the following schema:\n * @property {string} oid\n * @property {'blob' | 'tree' | 'commit' | 'tag'} [type]\n * @property {'deflated' | 'wrapped' | 'content' | 'parsed'} format\n * @property {Buffer | String | CommitDescription | TreeDescription} object\n * @property {string} [source]\n *\n */\n\n/**\n * Read a git object directly by its SHA-1 object id\n *\n * Regarding `GitObjectDescription`:\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` is not included for 'deflated' and 'wrapped' formatted objects because you likely don't care or plan to decode that information yourself.\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 * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully with a git object description\n * @see GitObjectDescription\n *\n * @example\n * // Get the contents of 'README.md' in the master branch.\n * let sha = await git.resolveRef({ dir: '$input((/))', ref: '$input((master))' })\n * console.log(sha)\n * let { object: blob } = await git.readObject({\n * dir: '$input((/))',\n * oid: $input((sha)),\n * $textarea((filepath: 'README.md',\n * encoding: 'utf8'))\n * })\n * console.log(blob)\n *\n * @example\n * // Find all the .js files in the current master branch containing the word 'commit'\n * let sha = await git.resolveRef({ dir: '$input((/))', ref: '$input((master))' })\n * console.log(sha)\n * let { object: commit } = await git.readObject({ dir: '$input((/))', oid: sha })\n * console.log(commit)\n *\n * const searchTree = async ({oid, prefix = ''}) => {\n * let { object: tree } = await git.readObject({ dir: '$input((/))', oid })\n * for (let entry of tree.entries) {\n * if (entry.type === 'tree') {\n * await searchTree({oid: entry.oid, prefix: `${prefix}/${entry.path}`})\n * } else if (entry.type === 'blob') {\n * if ($input((entry.path.endsWith('.js')))) {\n * let { object: blob } = await git.readObject({ dir: '$input((/))', oid: entry.oid })\n * if ($input((blob.toString('utf8').includes('commit')))) {\n * console.log(`${prefix}/${entry.path}`)\n * }\n * }\n * }\n * }\n * }\n *\n * await searchTree({oid: commit.tree})\n * console.log('done')\n *\n */\nexport async function readObject ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oid,\n format = 'parsed',\n filepath = undefined,\n encoding = undefined\n}) {\n try {\n const fs = new FileSystem(_fs)\n if (filepath !== undefined) {\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('/') || filepath.endsWith('/')) {\n throw new GitError(E.DirectorySeparatorsError)\n }\n const _oid = oid\n const result = await resolveTree({ fs, gitdir, oid })\n const tree = result.tree\n if (filepath === '') {\n oid = result.oid\n } else {\n const pathArray = filepath.split('/')\n oid = await resolveFile({\n fs,\n gitdir,\n tree,\n pathArray,\n oid: _oid,\n filepath\n })\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 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 = { entries: 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.format = 'content'\n }\n break\n case 'tag':\n result.object = GitAnnotatedTag.from(result.object).parse()\n break\n default:\n throw new GitError(E.ObjectTypeUnknownFail, { type: result.type })\n }\n }\n // @ts-ignore\n return result\n } catch (err) {\n err.caller = 'git.readObject'\n throw err\n }\n}\n\nasync function resolveFile ({ fs, gitdir, tree, pathArray, oid, filepath }) {\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 gitdir,\n oid: entry.oid\n })\n if (type === 'blob') {\n throw new GitError(E.DirectoryIsAFileError, { oid, filepath })\n }\n if (type !== 'tree') {\n throw new GitError(E.ObjectTypeAssertionInTreeFail, {\n oid: entry.oid,\n entrypath: filepath,\n type\n })\n }\n tree = GitTree.from(object)\n return resolveFile({ fs, gitdir, tree, pathArray, oid, filepath })\n }\n }\n }\n throw new GitError(E.TreeOrBlobNotFoundError, { oid, filepath })\n}\n","// @ts-check\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join'\nimport { cores } from '../utils/plugins.js'\n\nimport { readObject } from './readObject'\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 can be achieved by using [readObject](./readObject.html) directly and ignoring subdirectories you don't care about.\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\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({ dir: '$input((/))', ref: '$input((HEAD))' })\n * console.log(files)\n * // All the files in the current staging area\n * files = await git.listFiles({ dir: '$input((/))' })\n * console.log(files)\n *\n */\nexport async function listFiles ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref\n}) {\n try {\n const fs = new FileSystem(_fs)\n let filenames\n if (ref) {\n const oid = await GitRefManager.resolve({ gitdir, fs, ref })\n filenames = []\n await accumulateFilesFromOid({ gitdir, fs, oid, filenames, prefix: '' })\n } else {\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n filenames = index.entries.map(x => x.path)\n }\n )\n }\n return filenames\n } catch (err) {\n err.caller = 'git.listFiles'\n throw err\n }\n}\n\nasync function accumulateFilesFromOid ({ gitdir, fs, oid, filenames, prefix }) {\n const { object } = await readObject({ gitdir, fs, oid, filepath: '' })\n // Note: this isn't parallelized because I'm too lazy to figure that out right now\n // @ts-ignore\n for (const entry of object.entries) {\n if (entry.type === 'tree') {\n await accumulateFilesFromOid({\n gitdir,\n fs,\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 { GitConfigManager } from '../managers/GitConfigManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * List remotes\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))' })\n * console.log(remotes)\n *\n */\nexport async function listRemotes ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs')\n}) {\n try {\n const fs = new FileSystem(_fs)\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 } catch (err) {\n err.caller = 'git.listRemotes'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * List tags\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))' })\n * console.log(tags)\n *\n */\nexport async function listTags ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs')\n}) {\n try {\n const fs = new FileSystem(_fs)\n return GitRefManager.listTags({ fs, gitdir })\n } catch (err) {\n err.caller = 'git.listTags'\n throw err\n }\n}\n","export function compareAge (a, b) {\n return a.committer.timestamp - b.committer.timestamp\n}\n","import { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { readObject } from '../storage/readObject.js'\n\nexport async function logCommit ({ fs, gitdir, oid, signing }) {\n try {\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type !== 'commit') {\n throw new GitError(E.ObjectTypeAssertionFail, {\n oid,\n expected: 'commit',\n type\n })\n }\n const commit = GitCommit.from(object)\n const result = Object.assign({ oid }, commit.parse())\n if (signing) {\n result.payload = commit.withoutSignature()\n }\n return result\n } catch (err) {\n return {\n oid,\n error: err\n }\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitShallowManager } from '../managers/GitShallowManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { compareAge } from '../utils/compareAge.js'\nimport { join } from '../utils/join.js'\nimport { logCommit } from '../utils/logCommit.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n *\n * @typedef {Object} CommitDescription - Returns an array of objects with a schema like this:\n * @property {string} oid - SHA-1 object id of this commit\n * @property {string} message - Commit message\n * @property {string} tree - SHA-1 object id of corresponding file tree\n * @property {string[]} parent - an array of zero or more SHA-1 object ids\n * @property {Object} author\n * @property {string} author.name - The author's name\n * @property {string} author.email - The author's email\n * @property {number} author.timestamp - UTC Unix timestamp in seconds\n * @property {number} author.timezoneOffset - Timezone difference from UTC in minutes\n * @property {Object} committer\n * @property {string} committer.name - The committer's name\n * @property {string} committer.email - The committer's email\n * @property {number} committer.timestamp - UTC Unix timestamp in seconds\n * @property {number} committer.timezoneOffset - Timezone difference from UTC in minutes\n * @property {string} [gpgsig] - PGP signature (if present)\n * @property {string} [payload] - PGP signing payload (if requested)\n */\n\n/**\n * Get commit descriptions from the git history\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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'] - 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.signing = false] - Include the PGP signing payload\n *\n * @returns {Promise>} Resolves to an array of CommitDescription objects\n * @see CommitDescription\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 core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref = 'HEAD',\n depth = undefined,\n since = undefined, // Date\n signing = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n const sinceTimestamp =\n since === undefined ? undefined : 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 /*: Array */ = [await logCommit({ fs, gitdir, oid, signing })]\n\n while (true) {\n const commit = tips.pop()\n\n // Stop the loop if we encounter an error\n if (commit.error) {\n commits.push(commit)\n break\n }\n\n // Stop the log if we've hit the age limit\n if (\n sinceTimestamp !== undefined &&\n commit.committer.timestamp <= sinceTimestamp\n ) {\n break\n }\n\n commits.push(commit)\n\n // Stop the loop if we have enough commits now.\n if (depth !== undefined && commits.length === depth) break\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.parent) {\n const commit = await logCommit({ fs, gitdir, oid, signing })\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) break\n\n // Process tips in order by age\n tips.sort(compareAge)\n }\n // @ts-ignore\n return commits\n } catch (err) {\n err.caller = 'git.log'\n throw err\n }\n}\n","// @ts-check\n// import diff3 from 'node-diff3'\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { abbreviateRef } from '../utils/abbreviateRef.js'\nimport { join } from '../utils/join.js'\nimport { mergeTree } from '../utils/mergeTree.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { commit } from './commit'\nimport { currentBranch } from './currentBranch.js'\nimport { findMergeBase } from './findMergeBase.js'\n\n/**\n *\n * @typedef {Object} MergeReport - 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 one or more branches *(Currently, only very simple cases are handled.)*\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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.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 {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 {Object} [args.committer] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n *\n * @returns {Promise} Resolves to a description of the merge operation\n * @see MergeReport\n *\n * @example\n * let m = await git.merge({ dir: '$input((/))', ours: '$input((master))', theirs: '$input((remotes/origin/master))' })\n * console.log(m)\n *\n */\nexport async function merge ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ours,\n theirs,\n fastForwardOnly = false,\n dryRun = false,\n message,\n author,\n committer,\n signingKey\n}) {\n try {\n const fs = new FileSystem(_fs)\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 core,\n dir,\n gitdir,\n fs,\n oids: [ourOid, theirOid]\n })\n if (baseOids.length !== 1) {\n throw new GitError(E.MergeNotSupportedFail)\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 (baseOid === ourOid) {\n if (!dryRun) {\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 GitError(E.FastForwardFail)\n }\n // try a fancier merge\n const tree = await mergeTree({\n core,\n fs,\n gitdir,\n ourOid,\n theirOid,\n baseOid,\n ourName: ours,\n baseName: 'base',\n theirName: theirs,\n dryRun\n })\n if (!message) {\n message = `Merge branch '${abbreviateRef(theirs)}' into ${abbreviateRef(\n ours\n )}`\n }\n if (!dryRun) {\n const oid = await commit({\n fs,\n gitdir,\n message,\n ref: ours,\n tree,\n parent: [ourOid, theirOid],\n author,\n committer,\n signingKey\n })\n return {\n oid,\n tree,\n mergeCommit: true\n }\n }\n return {\n tree,\n mergeCommit: true\n }\n }\n } catch (err) {\n err.caller = 'git.merge'\n throw err\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { collect } from '../utils/collect.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { pack } from './pack'\n\n/**\n *\n * @typedef {Object} PackObjectsResponse 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 {Buffer} [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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully when the packfile is ready with the filename and buffer\n * @see PackObjectsResponse\n *\n * @example\n * // Create a packfile containing only an empty tree\n * let { packfile } = await git.packObjects({\n * dir: '$input((/))',\n * oids: [$input(('4b825dc642cb6eb9a060e54bf8d69288fbee4904'))]\n * })\n * console.log(packfile)\n *\n */\nexport async function packObjects ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oids,\n write = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n const buffers = await pack({ core, gitdir, fs, oids })\n const packfile = 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\n }\n } catch (err) {\n err.caller = 'git.packObjects'\n throw err\n }\n}\n","// @ts-check\n// import diff3 from 'node-diff3'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { checkout } from './checkout'\nimport { config } from './config'\nimport { currentBranch } from './currentBranch'\nimport { fetch } from './fetch'\nimport { merge } from './merge'\n\n/**\n * Fetch and merge commits from a remote repository *(Currently, only fast-forward merges are implemented.)*\n *\n * To monitor progress events, see the documentation for the [`'emitter'` plugin](./plugin_emitter.md).\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 fetch. By default this is the currently checked out 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 {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)\n * @param {boolean} [args.noGitSuffix = false] - If true, do not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**)\n * @param {string} [args.username] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.password] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.token] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.oauth2format] - See the [Authentication](./authentication.html) documentation\n * @param {object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md).\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name.\n * @param {Object} [args.author] - passed to [commit](commit.md) when creating a merge commit\n * @param {Object} [args.committer] - passed to [commit](commit.md) when creating a merge commit\n * @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit\n *\n * @returns {Promise} Resolves successfully when pull operation completes\n *\n * @example\n * await git.pull({\n * dir: '$input((/))',\n * ref: '$input((master))',\n * singleBranch: $input((true))\n * })\n * console.log('done')\n *\n */\nexport async function pull ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n fastForwardOnly = false,\n noGitSuffix = false,\n corsProxy,\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n // @ts-ignore\n authUsername,\n // @ts-ignore\n authPassword,\n username = authUsername,\n password = authPassword,\n token,\n oauth2format,\n singleBranch,\n headers = {},\n author,\n committer,\n signingKey\n}) {\n try {\n const fs = new FileSystem(_fs)\n // If ref is undefined, use 'HEAD'\n if (!ref) {\n ref = await currentBranch({ fs, gitdir })\n }\n // Fetch from the correct remote.\n const remote = await config({\n gitdir,\n fs,\n path: `branch.${ref}.remote`\n })\n const { fetchHead, fetchHeadDescription } = await fetch({\n dir,\n gitdir,\n fs,\n emitter,\n emitterPrefix,\n noGitSuffix,\n corsProxy,\n ref,\n remote,\n username,\n password,\n token,\n oauth2format,\n singleBranch,\n headers\n })\n // Merge the remote tracking branch into the local one.\n await merge({\n gitdir,\n fs,\n ours: ref,\n theirs: fetchHead,\n fastForwardOnly,\n message: `Merge ${fetchHeadDescription}`,\n author,\n committer,\n signingKey\n })\n await checkout({\n dir,\n gitdir,\n fs,\n ref,\n emitter,\n emitterPrefix\n })\n } catch (err) {\n err.caller = 'git.pull'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { GitRemoteManager } from '../managers/GitRemoteManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitSideBand } from '../models/GitSideBand.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 { cores } from '../utils/plugins.js'\nimport { splitLines } from '../utils/splitLines.js'\nimport { parseReceivePackResponse } from '../wire/parseReceivePackResponse.js'\nimport { writeReceivePackRequest } from '../wire/writeReceivePackRequest.js'\n\nimport { config } from './config.js'\nimport { findMergeBase } from './findMergeBase.js'\nimport { isDescendent } from './isDescendent.js'\nimport { listCommitsAndTags } from './listCommitsAndTags.js'\nimport { listObjects } from './listObjects.js'\nimport { pack } from './pack.js'\n\n/**\n *\n * @typedef {Object} PushResponse - Returns an object with a schema like this:\n * @property {string[]} [ok]\n * @property {string[]} [errors]\n * @property {object} [headers]\n *\n */\n\n/**\n * Push a branch or tag\n *\n * > *Note:* The behavior of `remoteRef` is reasonable but not the _correct_ behavior. It _should_ be using the configured remote tracking branch! TODO: I need to fix this\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 * To monitor progress events, see the documentation for the [`'emitter'` plugin](./plugin_emitter.md).\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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.remoteRef] - The name of the receiving branch on the remote. By default this is the same as `ref`. (See note below)\n * @param {string} [args.remote] - If URL is not specified, determines which remote to use.\n * @param {boolean} [args.force = false] - If true, behaves the same as `git push --force`\n * @param {boolean} [args.noGitSuffix = false] - If true, do not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**)\n * @param {string} [args.url] - The URL of the remote git server. The default is the value set in the git config for that remote.\n * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.\n * @param {string} [args.username] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.password] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.token] - See the [Authentication](./authentication.html) documentation\n * @param {string} [args.oauth2format] - See the [Authentication](./authentication.html) documentation\n * @param {object} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config\n * @param {import('events').EventEmitter} [args.emitter] - [deprecated] Overrides the emitter set via the ['emitter' plugin](./plugin_emitter.md).\n * @param {string} [args.emitterPrefix = ''] - Scope emitted events by prepending `emitterPrefix` to the event name.\n *\n * @returns {Promise} Resolves successfully when push completes with a detailed description of the operation from the server.\n * @see PushResponse\n *\n * @example\n * let pushResponse = await git.push({\n * dir: '$input((/))',\n * remote: '$input((origin))',\n * ref: '$input((master))',\n * token: $input((process.env.GITHUB_TOKEN)),\n * })\n * console.log(pushResponse)\n *\n */\nexport async function push ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n emitter = cores.get(core).get('emitter'),\n emitterPrefix = '',\n ref,\n remoteRef,\n remote = 'origin',\n url,\n force = false,\n noGitSuffix = false,\n corsProxy,\n // @ts-ignore\n authUsername,\n // @ts-ignore\n authPassword,\n username = authUsername,\n password = authPassword,\n token,\n oauth2format,\n headers = {}\n}) {\n try {\n const fs = new FileSystem(_fs)\n // TODO: Figure out how pushing tags works. (This only works for branches.)\n if (url === undefined) {\n url = await config({ fs, gitdir, path: `remote.${remote}.url` })\n }\n if (corsProxy === undefined) {\n corsProxy = await config({ fs, gitdir, path: 'http.corsProxy' })\n }\n let fullRef\n if (!ref) {\n fullRef = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2\n })\n } else {\n fullRef = await GitRefManager.expand({ fs, gitdir, ref })\n }\n const oid = await GitRefManager.resolve({ fs, gitdir, ref: fullRef })\n let auth = { username, password, token, oauth2format }\n const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url })\n const httpRemote = await GitRemoteHTTP.discover({\n core,\n corsProxy,\n service: 'git-receive-pack',\n url,\n noGitSuffix,\n auth,\n headers\n })\n 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.code === E.ExpandRefError) {\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 const finish = [...httpRemote.refs.values()]\n // hack to speed up common force push scenarios\n // @ts-ignore\n const mergebase = await findMergeBase({ fs, gitdir, oids: [oid, oldoid] })\n for (const oid of mergebase) finish.push(oid)\n // @ts-ignore\n const commits = await listCommitsAndTags({\n fs,\n gitdir,\n start: [oid],\n finish\n })\n // @ts-ignore\n const objects = await listObjects({ fs, gitdir, oids: commits })\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 GitError(E.PushRejectedTagExists, {})\n }\n // Is it a non-fast-forward commit?\n if (\n oid !== '0000000000000000000000000000000000000000' &&\n oldoid !== '0000000000000000000000000000000000000000' &&\n !(await isDescendent({ fs, gitdir, oid, ancestor: oldoid }))\n ) {\n throw new GitError(E.PushRejectedNonFastForward, {})\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 = await pack({\n fs,\n gitdir,\n oids: [...objects]\n })\n const res = await GitRemoteHTTP.connect({\n core,\n emitter,\n emitterPrefix,\n corsProxy,\n service: 'git-receive-pack',\n url,\n noGitSuffix,\n auth,\n headers,\n body: [...packstream1, ...packstream2]\n })\n const { packfile, progress } = await GitSideBand.demux(res.body)\n if (emitter) {\n const lines = splitLines(progress)\n forAwait(lines, line => {\n emitter.emit(`${emitterPrefix}message`, line)\n })\n }\n // Parse the response!\n const result = await parseReceivePackResponse(packfile)\n if (res.headers) {\n result.headers = res.headers\n }\n return result\n } catch (err) {\n err.caller = 'git.push'\n throw err\n }\n}\n","// @ts-check\nimport { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.remove({ dir: '$input((/))', filepath: '$input((README.md))' })\n * console.log('done')\n *\n */\nexport async function remove ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs)\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n index.delete({ filepath })\n }\n )\n // TODO: return oid?\n } catch (err) {\n err.caller = 'git.remove'\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 { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\nimport { readObject } from './readObject.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully once the git index has been updated\n *\n * @example\n * await git.resetIndex({ dir: '$input((/))', filepath: '$input((README.md))' })\n * console.log('done')\n *\n */\nexport async function resetIndex ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath,\n ref = 'HEAD'\n}) {\n try {\n const fs = new FileSystem(_fs)\n // Resolve commit\n let oid = await GitRefManager.resolve({ fs, gitdir, ref })\n let workdirOid\n try {\n // Resolve blob\n const obj = await readObject({\n gitdir,\n fs,\n oid,\n filepath,\n format: 'deflated'\n })\n oid = obj && obj.oid\n } catch (e) {\n // This means we're resetting the file to a \"deleted\" state\n oid = null\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(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n index.delete({ filepath })\n if (oid) {\n index.insert({ filepath, stats, oid })\n }\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 { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((HEAD))' })\n * console.log(currentCommit)\n * let currentBranch = await git.resolveRef({ dir: '$input((/))', ref: '$input((HEAD))', depth: $input((2)) })\n * console.log(currentBranch)\n *\n */\nexport async function resolveRef ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n depth\n}) {\n try {\n const fs = new FileSystem(_fs)\n const oid = await GitRefManager.resolve({\n 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 { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { SignedGitCommit } from '../models/SignedGitCommit.js'\nimport { readObject } from '../storage/readObject.js'\nimport { writeObject } from '../storage/writeObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create a signed commit\n *\n * \n *\n * It creates a signed version of whatever commit HEAD currently points to, and then updates the current branch,\n * leaving the original commit dangling.\n *\n * The `privateKeys` argument is a single string in ASCII armor format. However, it is plural \"keys\" because\n * you can technically have multiple private keys in a single ASCII armor string. The openpgp.sign() function accepts\n * multiple keys, so while I haven't tested it, it should support signing a single commit with multiple keys.\n *\n * @deprecated\n * > **Deprecated**\n * > This command will be removed in the 1.0.0 version of `isomorphic-git` as it is no longer necessary.\n * >\n * > Previously, to sign commits you needed two steps, `commit` and then `sign`.\n * > Now commits can be signed when they are created with the [`commit`](./commit.md) command, provided you use a [`pgp`](./plugin_pgp.md) plugin.\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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.openpgp - An instance of the [OpenPGP library](https://unpkg.com/openpgp%402.6.2)\n * @param {string} args.privateKeys - A PGP private key in ASCII armor format\n *\n * @returns {Promise} Resolves successfully when filesystem operations are completed\n *\n * @example\n * let sha = await git.sign({\n * dir: '$input((/))',\n * openpgp,\n * privateKeys: `$textarea((\n * -----BEGIN PGP PRIVATE KEY BLOCK-----\n * ...\n * ))`\n * })\n * console.log(sha)\n *\n */\nexport async function sign ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n privateKeys,\n openpgp\n}) {\n try {\n const fs = new FileSystem(_fs)\n const oid = await GitRefManager.resolve({ fs, gitdir, ref: 'HEAD' })\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type !== 'commit') {\n throw new GitError(E.ObjectTypeAssertionInRefFail, {\n expected: 'commit',\n ref: 'HEAD',\n type\n })\n }\n let commit\n if (openpgp) {\n // Old API\n commit = SignedGitCommit.from(object)\n commit = await commit.sign(openpgp, privateKeys)\n } else {\n // Newer plugin API\n const pgp = cores.get(core).get('pgp')\n commit = GitCommit.from(object)\n commit = await GitCommit.sign(commit, pgp, privateKeys)\n }\n const newOid = await writeObject({\n fs,\n gitdir,\n type: 'commit',\n object: commit.toObject()\n })\n // Update branch pointer\n // TODO: Use an updateBranch function instead of this.\n const branch = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 2\n })\n await fs.write(join(gitdir, branch), newOid + '\\n')\n } catch (err) {\n err.caller = 'git.sign'\n throw err\n }\n}\n","// @ts-check\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 { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { GitTree } from '../models/GitTree.js'\nimport { readObject } from '../storage/readObject.js'\nimport { compareStats } from '../utils/compareStats.js'\nimport { hashObject } from '../utils/hashObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 *\n * @returns {Promise} Resolves successfully with the file's git status\n *\n * @example\n * let status = await git.status({ dir: '$input((/))', filepath: '$input((README.md))' })\n * console.log(status)\n *\n */\nexport async function status ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs)\n const ignored = await GitIgnoreManager.isIgnored({\n gitdir,\n dir,\n filepath,\n fs\n })\n if (ignored) {\n return 'ignored'\n }\n const headTree = await getHeadTree({ fs, gitdir })\n const treeOid = await getOidAtPath({\n fs,\n gitdir,\n tree: headTree,\n path: filepath\n })\n let indexEntry = null\n // Acquire a lock on the index\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n for (const entry of index) {\n if (entry.path === filepath) {\n indexEntry = entry\n break\n }\n }\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(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n index.insert({ filepath, stats, oid: workdirOid })\n }\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, 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 gitdir,\n oid: entry.oid\n })\n if (type === 'tree') {\n const tree = GitTree.from(object)\n return getOidAtPath({ fs, gitdir, tree, path })\n }\n if (type === 'blob') {\n throw new GitError(E.ObjectTypeAssertionInPathFail, {\n oid: entry.oid,\n path: path.join('/')\n })\n }\n }\n }\n return null\n}\n\nasync function getHeadTree ({ fs, 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.code === E.ResolveRefError) {\n return []\n }\n }\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type !== 'commit') {\n throw new GitError(E.ResolveCommitError, { oid })\n }\n const commit = GitCommit.from(object)\n oid = commit.parseHeaders().tree\n return getTree({ fs, gitdir, oid })\n}\n\nasync function getTree ({ fs, gitdir, oid }) {\n const { type, object } = await readObject({\n fs,\n gitdir,\n oid\n })\n if (type !== 'tree') {\n throw new GitError(E.ResolveTreeError, { oid })\n }\n const tree = GitTree.from(object).entries()\n return tree\n}\n","import { GitIndexManager } from '../managers/GitIndexManager.js'\nimport { compareStrings } from '../utils/compareStrings.js'\nimport { flatFileListToDirectoryStructure } from '../utils/flatFileListToDirectoryStructure.js'\nimport { normalizeStats } from '../utils/normalizeStats'\n\nimport { FileSystem } from './FileSystem.js'\n\nexport class GitWalkerIndex {\n constructor ({ fs: _fs, gitdir }) {\n const fs = new FileSystem(_fs)\n this.treePromise = (async () => {\n let result\n await GitIndexManager.acquire(\n { fs, filepath: `${gitdir}/index` },\n async function (index) {\n result = flatFileListToDirectoryStructure(index.entries)\n }\n )\n return result\n })()\n const walker = this\n this.ConstructEntry = class IndexEntry {\n constructor (entry) {\n Object.assign(this, entry)\n }\n\n async populateStat () {\n if (!this.exists) return\n await walker.populateStat(this)\n }\n\n async populateContent () {\n if (!this.exists) return\n await walker.populateContent(this)\n }\n\n async populateHash () {\n if (!this.exists) return\n await walker.populateHash(this)\n }\n }\n }\n\n async readdir (entry) {\n if (!entry.exists) return []\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 return inode.children\n .map(inode => ({\n fullpath: inode.fullpath,\n basename: inode.basename,\n exists: true\n // TODO: Figure out why flatFileListToDirectoryStructure is not returning children\n // sorted correctly for \"__tests__/__fixtures__/test-push.git\"\n }))\n .sort((a, b) => compareStrings(a.fullpath, b.fullpath))\n }\n\n async populateStat (entry) {\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 Object.assign(entry, { type: inode.type }, stats)\n }\n\n async populateContent (entry) {\n // Cannot get content for an index entry\n }\n\n async populateHash (entry) {\n const tree = await this.treePromise\n const inode = tree.get(entry.fullpath)\n if (!inode) return null\n if (inode.type === 'tree') {\n throw new Error(`EISDIR: illegal operation on a directory, read`)\n }\n Object.assign(entry, {\n oid: inode.metadata.oid\n })\n }\n}\n","// @ts-check\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitWalkerIndex } from '../models/GitWalkerIndex.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\nimport { GitWalkerSymbol } from '../utils/symbols.js'\n\n/**\n *\n * @typedef Walker\n * @property {Symbol} Symbol('GitWalkerSymbol')\n */\n\n/**\n * Get a git index Walker\n *\n * See [walkBeta1](./walkBeta1.md)\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {Walker} Returns a git index Walker\n *\n */\nexport function STAGE ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs')\n}) {\n const fs = new FileSystem(_fs)\n const o = Object.create(null)\n Object.defineProperty(o, GitWalkerSymbol, {\n value: function () {\n return new GitWalkerIndex({ fs, gitdir })\n }\n })\n Object.freeze(o)\n return o\n}\n","// @ts-check\nimport globrex from 'globrex'\n\nimport { GitIgnoreManager } from '../managers/GitIgnoreManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { join } from '../utils/join.js'\nimport { patternRoot } from '../utils/patternRoot.js'\nimport { cores } from '../utils/plugins.js'\nimport { worthWalking } from '../utils/worthWalking.js'\n\nimport { STAGE } from './STAGE.js'\nimport { TREE } from './TREE.js'\nimport { WORKDIR } from './WORKDIR.js'\nimport { walkBeta1 } from './walkBeta1.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({ dir: '$input((/))', pattern: '$input((src/**))' })\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({ dir: '$input((/))', pattern: '$input((**\\/*.{json,md}))' })\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 * ]\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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 {string} [args.pattern = null] - Filter the results to only those whose filepath matches a glob pattern. (Pattern is relative to `filepaths` if `filepaths` is provided.)\n *\n * @returns {Promise} Resolves with a status matrix, described below.\n */\nexport async function statusMatrix ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref = 'HEAD',\n filepaths = ['.'],\n pattern = null\n}) {\n try {\n const fs = new FileSystem(_fs)\n let patternPart = ''\n let patternGlobrex\n if (pattern) {\n patternPart = patternRoot(pattern)\n if (patternPart) {\n pattern = pattern.replace(patternPart + '/', '')\n }\n patternGlobrex = globrex(pattern, { globstar: true, extended: true })\n }\n const bases = filepaths.map(filepath => join(filepath, patternPart))\n const results = await walkBeta1({\n trees: [\n TREE({ fs, gitdir, ref }),\n WORKDIR({ fs, dir, gitdir }),\n STAGE({ fs, gitdir })\n ],\n filter: async function ([head, workdir, stage]) {\n // Ignore ignored files, but only if they are not already tracked.\n if (!head.exists && !stage.exists && workdir.exists) {\n if (\n await GitIgnoreManager.isIgnored({\n fs,\n dir,\n filepath: workdir.fullpath\n })\n ) {\n return false\n }\n }\n // match against base paths\n return bases.some(base => worthWalking(head.fullpath, base))\n },\n map: async function ([head, workdir, stage]) {\n // Late filter against file names\n if (patternGlobrex) {\n let match = false\n for (const base of bases) {\n const partToMatch = head.fullpath.replace(base + '/', '')\n if (patternGlobrex.regex.test(partToMatch)) {\n match = true\n break\n }\n }\n if (!match) return\n }\n // For now, just bail on directories\n await head.populateStat()\n if (head.type === 'tree' || head.type === 'special') return\n await workdir.populateStat()\n if (workdir.type === 'tree' || workdir.type === 'special') return\n await stage.populateStat()\n if (stage.type === 'tree' || stage.type === 'special') return\n // Figure out the oids, using the staged oid for the working dir oid if the stats match.\n await head.populateHash()\n await stage.populateHash()\n if (!head.exists && workdir.exists && !stage.exists) {\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 workdir.oid = '42'\n } else if (workdir.exists) {\n await workdir.populateHash()\n }\n const entry = [undefined, head.oid, workdir.oid, stage.oid]\n const result = entry.map(value => entry.indexOf(value))\n result.shift() // remove leading undefined entry\n const fullpath = head.fullpath || workdir.fullpath || stage.fullpath\n return [fullpath, ...result]\n }\n })\n return results\n } catch (err) {\n err.caller = 'git.statusMatrix'\n throw err\n }\n}\n","// @ts-check\nimport { GitRefManager } from '../managers/GitRefManager'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Create a lightweight tag\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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({ dir: '$input((/))', ref: '$input((test-tag))' })\n * console.log('done')\n *\n */\nexport async function tag ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n object,\n force = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n\n if (ref === undefined) {\n throw new GitError(E.MissingRequiredParameterError, {\n function: 'tag',\n parameter: 'ref'\n })\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 GitError(E.RefExistsError, { noun: '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 { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { GitAnnotatedTag } from '../models/GitAnnotatedTag.js'\nimport { GitCommit } from '../models/GitCommit.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { SignedGitCommit } from '../models/SignedGitCommit.js'\nimport { readObject } from '../storage/readObject.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.js'\n\n/**\n * Verify a signed commit or tag\n *\n * For now, key management is beyond the scope of isomorphic-git's PGP features.\n * It is up to you to figure out what the commit's or tag's public key _should_ be.\n * I would use the \"author\" or \"committer\" name and email, and look up\n * that person's public key from a trusted source such as the GitHub API.\n *\n * The function returns `false` if any of the signatures on a signed git commit are invalid.\n * Otherwise, it returns an array of the key ids that were used to sign it.\n *\n * The `publicKeys` argument is a single string in ASCII armor format. However, it is plural \"keys\" because\n * you can technically have multiple public keys in a single ASCII armor string. While I haven't tested it, it\n * should support verifying a single commit signed with multiple keys. Hence why the returned result is an array of key ids.\n *\n * @param {object} args\n * @param {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 - A reference to the commit or tag to verify\n * @param {string} args.publicKeys - A PGP public key in ASCII armor format.\n * @param {OpenPGP} [args.openpgp] - [deprecated] An instance of the [OpenPGP library](https://unpkg.com/openpgp@2.6.2). Deprecated in favor of using a [PGP plugin](./plugin_pgp.md).\n *\n * @returns {Promise} The value `false` or the valid key ids (in hex format) used to sign the commit.\n *\n * @example\n * let keyids = await git.verify({\n * dir: '$input((/))',\n * openpgp,\n * ref: '$input((HEAD))',\n * publicKeys: `$textarea((\n * -----BEGIN PGP PUBLIC KEY BLOCK-----\n * ...\n * ))`\n * })\n * console.log(keyids)\n *\n */\nexport async function verify ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n publicKeys,\n openpgp\n}) {\n try {\n const fs = new FileSystem(_fs)\n const oid = await GitRefManager.resolve({ fs, gitdir, ref })\n const { type, object } = await readObject({ fs, gitdir, oid })\n if (type !== 'commit' && type !== 'tag') {\n throw new GitError(E.ObjectTypeAssertionInRefFail, {\n expected: 'commit/tag',\n ref,\n type\n })\n }\n if (openpgp) {\n // Old API\n const commit = SignedGitCommit.from(object)\n const keys = await commit.listSigningKeys(openpgp)\n const validity = await commit.verify(openpgp, publicKeys)\n if (!validity) return false\n return keys\n } else {\n // Newer plugin API\n const pgp = cores.get(core).get('pgp')\n if (type === 'commit') {\n const commit = GitCommit.from(object)\n const { valid, invalid } = await GitCommit.verify(\n commit,\n pgp,\n publicKeys\n )\n if (invalid.length > 0) return false\n return valid\n } else if (type === 'tag') {\n const tag = GitAnnotatedTag.from(object)\n const { valid, invalid } = await GitAnnotatedTag.verify(\n tag,\n pgp,\n publicKeys\n )\n if (invalid.length > 0) return false\n return valid\n }\n }\n } catch (err) {\n err.caller = 'git.verify'\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 cleanGitRef from 'clean-git-ref'\n\nimport { GitRefManager } from '../managers/GitRefManager.js'\nimport { FileSystem } from '../models/FileSystem.js'\nimport { E, GitError } from '../models/GitError.js'\nimport { join } from '../utils/join.js'\nimport { cores } from '../utils/plugins.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 {string} [args.core = 'default'] - The plugin core identifier to use for plugin injection\n * @param {FileSystem} [args.fs] - [deprecated] The filesystem containing the git repo. Overrides the fs provided by the [plugin system](./plugin_fs.md).\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 * dir: '$input((/))',\n * ref: '$input((refs/heads/another-branch))',\n * value: '$input((HEAD))'\n * })\n * await git.writeRef({\n * dir: '$input((/))',\n * ref: '$input((HEAD))',\n * value: '$input((refs/heads/another-branch))',\n * force: $input((true)),\n * symbolic: $input((true))\n * })\n * console.log('done')\n *\n */\nexport async function writeRef ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n ref,\n value,\n force = false,\n symbolic = false\n}) {\n try {\n const fs = new FileSystem(_fs)\n\n if (ref !== cleanGitRef.clean(ref)) {\n throw new GitError(E.InvalidRefNameError, {\n verb: 'write',\n noun: 'ref',\n ref,\n suggestion: cleanGitRef.clean(ref)\n })\n }\n\n if (!force && (await GitRefManager.exists({ fs, gitdir, ref }))) {\n throw new GitError(E.RefExistsError, { noun: '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","import { auth } from './utils/auth.js'\nimport { oauth2 } from './utils/oauth2.js'\n\nexport * from './commands/add.js'\nexport * from './commands/addRemote.js'\nexport * from './commands/annotatedTag.js'\nexport * from './commands/branch.js'\nexport * from './commands/checkout.js'\nexport * from './commands/clone.js'\nexport * from './commands/commit.js'\nexport * from './commands/config.js'\nexport * from './commands/currentBranch.js'\nexport * from './commands/deleteBranch.js'\nexport * from './commands/deleteRef.js'\nexport * from './commands/deleteRemote.js'\nexport * from './commands/deleteTag.js'\nexport * from './commands/expandOid.js'\nexport * from './commands/expandRef.js'\nexport * from './commands/fetch.js'\nexport * from './commands/findMergeBase.js'\nexport * from './commands/findRoot.js'\nexport * from './commands/getRemoteInfo.js'\nexport * from './commands/hashBlob.js'\nexport * from './commands/indexPack.js'\nexport * from './commands/init.js'\nexport * from './commands/isDescendent.js'\nexport * from './commands/listBranches.js'\nexport * from './commands/listFiles.js'\nexport * from './commands/listRemotes.js'\nexport * from './commands/listTags.js'\nexport * from './commands/log.js'\nexport * from './commands/merge.js'\nexport * from './commands/packObjects.js'\nexport * from './commands/pull.js'\nexport * from './commands/push.js'\nexport * from './commands/readObject.js'\nexport * from './commands/remove.js'\nexport * from './commands/resetIndex.js'\nexport * from './commands/resolveRef.js'\nexport * from './commands/sign.js'\nexport * from './commands/status.js'\nexport * from './commands/statusMatrix.js'\nexport * from './commands/tag.js'\nexport * from './commands/verify.js'\nexport * from './commands/version.js'\nexport * from './commands/walkBeta1.js'\nexport * from './commands/writeObject.js'\nexport * from './commands/writeRef.js'\nexport * from './commands/WORKDIR.js'\nexport * from './commands/STAGE.js'\nexport * from './commands/TREE.js'\n\nexport const utils = { auth, oauth2 }\nexport { E } from './models/GitError'\n\nexport * from './utils/plugins.js'\n"],"sourceRoot":""}