@withgraphite/graphite-cli 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.CHANGELOG.md +7 -0
- package/check-node-version.js +1 -1
- package/graphite.js +1 -1
- package/package.json +1 -1
- package/686.js +0 -3
- package/686.js.LICENSE.txt +0 -604
- package/691.js +0 -3
- package/child.js +0 -3
package/691.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";exports.id=691,exports.ids=[691],exports.modules={8352:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getEnvironmentStage=t.ENV_STAGES=void 0,t.ENV_STAGES=["DEV","PROD","STG","LOCAL"],t.getEnvironmentStage=function(){var e;switch(null===(e=process.env.STAGE)||void 0===e?void 0:e.toLocaleLowerCase()){case"prod":default:return"PROD";case"stg":return"STG";case"dev":return"DEV"}}},68263:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SERVER_MODES=t.getCurrentServerMode=t.getEnvironmentStage=t.ENV_STAGES=void 0;var r=n(8352);Object.defineProperty(t,"ENV_STAGES",{enumerable:!0,get:function(){return r.ENV_STAGES}}),Object.defineProperty(t,"getEnvironmentStage",{enumerable:!0,get:function(){return r.getEnvironmentStage}});var o=n(46655);Object.defineProperty(t,"getCurrentServerMode",{enumerable:!0,get:function(){return o.getCurrentServerMode}}),Object.defineProperty(t,"SERVER_MODES",{enumerable:!0,get:function(){return o.SERVER_MODES}})},46655:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCurrentServerMode=t.SERVER_MODES=void 0,t.SERVER_MODES=["SERVER_MODE_LAMBDA","SERVER_MODE_SYNC","SERVER_MODE_WEBHOOKS","SERVER_MODE_WEBHOOK_STATUS","SERVER_MODE_SUBWOOFER","SERVER_MODE_MERGE_QUEUE","SERVER_MODE_MANAGE_COMMAND","SERVER_MODE_INSIGHTS","SERVER_MODE_UNKNOWN","SERVER_MODE_E2E_TEST","SERVER_MODE_SPLASH","SERVER_MODE_AI_SPLASH","SERVER_MODE_APP","SERVER_MODE_ASYNC_WORKER"],t.getCurrentServerMode=function(){const e=process.env.SERVER_MODE;return t.SERVER_MODES.find((t=>t===e))?e:"SERVER_MODE_UNKNOWN"}},80725:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.xit=t.sinon=t.setNockRecordFixturesPath=t.nockFixture=t.nock=t.it=t.expect=t.describe=t.chaiJestSnapshot=t.chaiAsPromised=t.beforeEach=t.before=t.afterEach=t.after=void 0;const s=n(54701);Object.defineProperty(t,"expect",{enumerable:!0,get:function(){return s.expect}});const c=i(n(77846));t.chaiAsPromised=c;const u=i(n(62010));t.chaiJestSnapshot=u;const l=a(n(81309));t.nock=l.default;const d=a(n(75685));t.sinon=d.default;const f=n(68802);Object.defineProperty(t,"nockFixture",{enumerable:!0,get:function(){return f.nockFixture}}),Object.defineProperty(t,"setNockRecordFixturesPath",{enumerable:!0,get:function(){return f.setNockRecordFixturesPath}});const h=n(66179);Object.defineProperty(t,"after",{enumerable:!0,get:function(){return h.gestAfter}});const p=n(26675);Object.defineProperty(t,"afterEach",{enumerable:!0,get:function(){return p.gestAfterEach}});const m=n(79226);Object.defineProperty(t,"before",{enumerable:!0,get:function(){return m.gestBefore}});const g=n(62828);Object.defineProperty(t,"beforeEach",{enumerable:!0,get:function(){return g.gestBeforeEach}});const v=n(36628);Object.defineProperty(t,"describe",{enumerable:!0,get:function(){return v.gestDescribe}});const b=n(86648);Object.defineProperty(t,"it",{enumerable:!0,get:function(){return b.gestIt}});const y=n(69844);Object.defineProperty(t,"xit",{enumerable:!0,get:function(){return y.gestXit}}),(0,s.use)(c.default)},68802:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.setNockRecordFixturesPath=t.nockFixture=void 0;const i=o(n(81309));t.setNockRecordFixturesPath=e=>{i.default.back.fixtures=e},t.nockFixture=(e,t,n)=>r(void 0,void 0,void 0,(function*(){if(!i.default.back.fixtures)throw new Error('No fixtures path configured for nockRecord(). Make sure to call setNockRecordFixturesPath("path/to/fixtures/dir") somewhere in your package.');if(process.env.CI&&"record"===e)throw new Error("`record` mode is not allowed in CI when calling nockFixture(). You probably accidentally committed and pushed this change. To fix, change the mode to `playback`.");const r=i.default.back.currentMode;switch(e){case"playback":i.default.back.setMode("lockdown");break;case"record":i.default.back.setMode("record")}const{nockDone:o}=yield i.default.back(t);try{return yield n()}finally{o(),i.default.back.setMode(r)}}))},41456:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.gestLogger=void 0;const i=o(n(80701)),a=n(90856),s=()=>"true"===process.env.VERBOSE,c=e=>t=>{const n=a.DateTime.now();return e&&console.log(l(i.default.cyan(t))),({endMessage:r,unit:o})=>{const s=null!=o?o:"milliseconds",c=a.DateTime.now().diff(n).as(s),u=null!=r?r:`'${t}' complete`;e&&console.log(l(i.default.cyan(`${u}: ${c} ${s}`)))}},u=e=>t=>r(void 0,[t],void 0,(function*({fn:t,message:n,endMessage:r,unit:o}){const i=c(e)(n),a=t(),s=a instanceof Promise?yield a:a;return i({endMessage:r,unit:o}),s}));t.gestLogger={info:e=>{console.log(l(i.default.blue(e)))},success:e=>{console.log(l(i.default.green(e)))},warn:e=>{console.log(l(i.default.yellow(e)))},error:e=>{console.log(l(i.default.red(e)))},details:e=>{console.log(l(i.default.dim.italic(e)))},verbose:e=>{s()&&console.log(l(i.default.cyan(e)))},logDuration:c(!0),logDurationVerbose:e=>c(s())(e),logFnDuration:u(!0),logFnDurationVerbose:u(s())};const l=e=>`${(new Date).toISOString()}: ${e}`},66179:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.gestAfter=void 0;const o=n(16650);t.gestAfter=function(e){after((()=>r(this,void 0,void 0,(function*(){yield e(o.gestContext)}))))}},26675:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.gestAfterEach=void 0;const o=n(16650);t.gestAfterEach=function(e){afterEach((()=>r(this,void 0,void 0,(function*(){yield e(o.gestContext)}))))}},79226:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.gestBefore=void 0;const i=n(54701),a=o(n(77846)),s=o(n(62010)),c=n(16650);(0,i.use)(s.default),t.gestBefore=function(e){(0,i.use)(a.default),s.default.resetSnapshotRegistry(),before((()=>r(this,void 0,void 0,(function*(){yield e(c.gestContext)}))))}},62828:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.gestBeforeEach=void 0;const o=n(16650);t.gestBeforeEach=function(e){beforeEach((()=>r(this,void 0,void 0,(function*(){yield e(o.gestContext)}))))}},16650:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.gestContext=void 0;const r=n(41456);t.gestContext={gestLogger:r.gestLogger}},36628:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.gestDescribe=void 0;const o=r(n(62010)),i=n(16650);process.on("warning",(e=>console.warn(e.stack)));const{emitWarning:a}=process;process.emitWarning=(e,...t)=>{if("TimeoutOverflowWarning"!==t[0]&&(!t[0]||"object"!=typeof t[0]||"TimeoutOverflowWarning"!==t[0].type))return a(e,...t)},t.gestDescribe=function(e,t){beforeEach((function(){o.default.configureUsingMochaContext(this)})),describe(e,(function(){t(i.gestContext)}))}},86648:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.gestIt=void 0,t.gestIt=function(e,t){it(e,t)}},69844:(e,t)=>{function n(e,t){xit(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.gestXit=void 0,t.gestXit=n,n.each=e=>(t,r)=>{e.forEach(((e,o)=>{n(`${t}: ${o}`,(()=>r(...e)))}))}},72920:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.API_ROUTES=t.pullRequestInfoShape=void 0;const a=n(55086),s=i(n(74374)),c={repoOwner:s.string,repoName:s.string,prNumbers:s.array(s.number),prHeadRefNames:s.optional(s.array(s.string)),trunkBranchNames:s.optional(s.array(s.string)),consistent:s.optional(s.boolean),callsite:s.optional(s.string)};t.pullRequestInfoShape=s.shape({prNumber:s.number,title:s.string,body:s.string,state:s.literals(["OPEN","CLOSED","MERGED"]),reviewDecision:s.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED",null,void 0]),headRefName:s.string,baseRefName:s.string,isBaseRefGraphiteBase:s.optional(s.boolean),url:s.string,isDraft:s.boolean,versions:s.array(s.shape({headSha:s.string,baseSha:s.string,baseName:s.string,createdAt:s.string,authorGithubHandle:s.optional(s.string),isGraphiteGenerated:s.optional(s.boolean)})),dependentPrNumber:s.optional(s.number),mergeCommitSha:s.optional(s.string),cliTrunk:s.optional(s.string)}),t.API_ROUTES={logActions:{method:"POST",url:"/graphite/cli/log-actions",params:{actions:s.array(s.shape({name:s.string,details:s.optional(s.shape({})),timestamp:s.string}))}},logCommand:{method:"POST",url:"/graphite/log-command",params:{commandName:s.string,durationMiliSeconds:s.number,user:s.string,version:s.optional(s.string),err:s.optional(s.shape({name:s.string,message:s.string,stackTrace:s.string,debugContext:s.optional(s.string)}))}},downstackDependencies:{method:"GET",url:"/graphite/downstack-dependencies",queryParams:{org:s.string,repo:s.string,trunkName:s.string,branchName:s.string},response:{downstackBranchNames:s.array(s.string)}},upgradePrompt:{method:"GET",url:"/graphite/upgrade",queryParams:{currentVersion:s.string,installationMethod:s.optional(s.string)},response:{prompt:s.optional(s.shape({message:s.string,blocking:s.boolean}))}},featureFlags:{method:"GET",url:"/graphite/feature-flags",queryParams:{currentVersion:s.string},response:{flags:s.array(s.shape({flagName:s.string,flagValue:s.boolean}))}},feedback:{method:"POST",url:"/graphite/feedback",params:{user:s.string,message:s.string,debugContext:s.optional(s.string)}},generateBranchNameAndCommitMessage:{method:"POST",url:"/graphite/generate-branch-name-and-commit-message",params:{diff:s.string,template:s.optional(s.string),owner:s.optional(s.string),repo:s.optional(s.string)},response:{result:s.union(s.shape({branchName:s.string,commitMessage:s.string}),s.shape({error:s.string}))}},reviewDiff:{method:"POST",url:"/graphite/cli/review-diff",params:{diff:s.string,owner:s.string,repo:s.string},response:{result:s.array(s.shape({filePath:s.string,startLine:s.number,endLine:s.number,comment:s.string}))}},generateTitleAndDescription:{method:"POST",url:"/graphite/generate-title-and-description",params:{diff:s.string,template:s.optional(s.string),owner:s.string,repo:s.string},response:{result:s.union(s.shape({title:s.string,description:s.string}),s.shape({error:s.string}))}},traces:{method:"POST",url:"/graphite/traces",params:{jsonTraces:s.string,cliVersion:s.string}},retargetPullRequest:{method:"POST",url:"/graphite/cli/retarget-pr",params:{repoOwner:s.string,repoName:s.string,prNumber:s.number},response:{result:s.union(s.shape({branchName:s.string,branchSha:s.string}),s.shape({error:s.string}))}},cleanupRetargetPullRequests:{method:"POST",url:"/graphite/cli/cleanup-retarget-prs",params:{repoOwner:s.string,repoName:s.string,prs:s.array(s.shape({prNumber:s.number,previousPrBase:s.string}))},response:{result:s.union(s.literal("ok"),s.shape({error:s.string}))}},preSubmitPullRequests:{method:"POST",url:"/graphite/cli/submit/pre-submit-pull-requests",params:{repoOwner:s.string,repoName:s.string,branches:s.array(s.shape({headRefName:s.string,prNumber:s.optional(s.number)}))},response:{result:s.union(s.shape({retargetedPrs:s.array(s.number)}),s.shape({error:s.string}))}},submitPullRequests:{method:"POST",url:"/graphite/submit/pull-requests",params:{repoOwner:s.string,repoName:s.string,trunkBranchName:s.optional(s.string),targetTrunkBranchName:s.optional(s.string),mergeWhenReady:s.optional(s.boolean),rerequestReview:s.optional(s.boolean),comment:s.optional(s.string),gti:s.optional(s.boolean),useWebSubmit:s.optional(s.boolean),prs:s.array(s.unionMany([s.shape({action:s.literals(["create"]),head:s.string,headSha:s.optional(s.string),base:s.string,baseSha:s.optional(s.string),title:s.string,body:s.optional(s.string),draft:s.optional(s.boolean),reviewers:s.optional(s.array(s.string))}),s.shape({action:s.literals(["update"]),head:s.string,headSha:s.optional(s.string),base:s.string,baseSha:s.optional(s.string),title:s.optional(s.string),body:s.optional(s.string),prNumber:s.number,draft:s.optional(s.boolean),reviewers:s.optional(s.array(s.string)),rebaseOnlyChange:s.optional(s.boolean)})])),webSubmitAnalytics:s.optional(s.shape({eligible:s.boolean,usedWebSubmit:s.boolean,prompted:s.boolean,suppressedPrompt:s.boolean,submitViaCliSetting:s.optional(s.boolean)}))},response:{prs:s.array(s.unionMany([s.shape({head:s.string,prNumber:s.number,prURL:s.string,status:s.literals(["updated","created"]),repoOwner:s.string,repoName:s.string}),s.shape({head:s.string,error:s.string,status:s.literals(["error"])})]))}},pullRequestInfo__DEPRECATED:{method:"POST",url:"/graphite/pull-requests",params:c,response:{prs:s.array(t.pullRequestInfoShape)}},pullRequestInfo:{method:"POST",url:"/graphite/cli/pull-request-info",params:c,response:{result:s.taggedUnion("status",{ok:{status:s.literal("ok"),prs:s.array(t.pullRequestInfoShape)},error:{status:s.literal("error"),message:s.string}})}},mergeabilityStatus:{method:"POST",url:"/graphite/mergeability-status",params:{repoOwner:s.string,repoName:s.string,prNumbers:s.array(s.number),cliVersion:s.optional(s.string)},response:{mergeabilityStatuses:s.array(s.shape({prNumber:s.number,mergeabilityStatus:s.literals(a.PrMetastatuses)}))}},merge:{method:"POST",url:"/graphite/merge",params:{repoOwner:s.string,repoName:s.string,trunkBranchName:s.string,prNumbers:s.array(s.number)}},getRepoMessage:{method:"GET",url:"/graphite/cli-repo-message",queryParams:{org:s.string,repo:s.string},response:{message:s.nullable(s.shape({text:s.string,status:s.literals(["warning","info","error"])}))}},getMenuBarAppConfig:{method:"GET",url:"/graphite/cli/menu-bar-app-config",headers:{"User-Agent":s.string},response:{config:s.shape({pollingRateInSeconds:s.number})}},getSectionsSummary:{method:"GET",url:"/graphite/sections-summary",queryParams:{first:s.string},headers:{"User-Agent":s.string},response:{host:s.shape({kind:s.literals(["CLOUD","ENTERPRISE"])}),sections:s.array(s.shape({name:s.string,sectionId:s.string,includeInTotalCount:s.boolean,totalUnpaginatedPrs:s.number,prs:s.array(s.shape({number:s.number,title:s.string,state:s.literals(["OPEN","CLOSED","MERGED"]),createdAt:s.string,updatedAt:s.string,repo:s.shape({name:s.string,owner:s.string}),author:s.nullable(s.shape({name:s.nullable(s.string),login:s.string,avatarUrl:s.string})),reviewDecision:s.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED"])}))}))}},checkAuth:{method:"POST",url:"/graphite/check-auth",params:{repoOwner:s.optional(s.string),repoName:s.optional(s.string)},response:{githubLogin:s.optional(s.string),canSubmitPrs:s.optional(s.boolean)}},checkIsRepoSynced:{method:"GET",url:"/graphite/cli/is-repo-synced",queryParams:{repoOwner:s.string,repoName:s.string},response:{result:s.unionMany([s.shape({status:s.literals(["SYNCED","NOT_SYNCED_ADDABLE"])}),s.shape({status:s.literals(["NOT_SYNCED_UNADDABLE"]),message:s.string})])}},addSyncedRepo:{method:"POST",url:"/graphite/cli/add-synced-repo",params:{repoOwner:s.string,repoName:s.string},response:{err:s.optional(s.string)}},markNewUserChecklistStepCompleted:{method:"POST",url:"/graphite/cli/mark-new-user-checklist-step-completed",params:{step:s.literals(["submitFirstPr","submitFirstStack"])}},health:{method:"GET",url:"/health"}}},55990:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeAuthClient=void 0;const r=n(85855),o=n(20610);t.composeAuthClient=e=>({getAuthInfo:(0,r.bind)(o.getAuthInfo,{context:e})})},20610:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAuthInfo=void 0;const o=n(5397);t.getAuthInfo=e=>r(void 0,[e],void 0,(function*({repo:e,context:t}){if(!t.userConfig.getAuthToken())return{status:"no_token"};try{const n=yield t.graphiteApi.checkAuth({repo:e});if(!n.githubLogin)throw new Error("Unknown response: "+n._response.status);return{status:n.canSubmitPrs?"ok":"no_repo_access",githubLogin:n.githubLogin}}catch(e){if(e instanceof o.AuthError)return{status:"invalid_token"};throw e}}))},58114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeAuthClient=void 0;var r=n(55990);Object.defineProperty(t,"composeAuthClient",{enumerable:!0,get:function(){return r.composeAuthClient}})},68480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeBranchClient=void 0;const r=n(85855),o=n(95743),i=n(75981),a=n(32434),s=n(94543),c=n(78502),u=n(70869),l=n(17214),d=n(80911),f=n(34447),h=n(37314),p=n(68422),m=n(64385),g=n(24726),v=n(52386),b=n(87233),y=n(18642),_=n(55318),E=n(41595),C=n(65378),R=n(86539),w=n(79657),P=n(75010),O=n(67193),N=n(2621),S=n(59361),A=n(14566),M=n(40639),T=n(6334);t.composeBranchClient=e=>({assertBranchExists:(0,r.bind)(a.assertBranchExists,{context:e}),assertBranchExistsAndGetMeta:(0,r.bind)(a.assertBranchExistsAndGetMeta,{context:e}),assertBranchIsValidAndNotTrunkAndGetMeta:(0,r.bind)(a.assertBranchIsValidAndNotTrunkAndGetMeta,{context:e}),assertBranchIsValidOrTrunkAndGetMeta:(0,r.bind)(a.assertBranchIsValidOrTrunkAndGetMeta,{context:e}),checkoutBranch:(0,r.bind)(s.checkoutBranch,{context:e}),cleanBranch:(0,r.bind)(c.cleanBranch,{context:e}),deleteAllBranchData:(0,r.bind)(u.deleteAllBranchData,{context:e}),deleteBranch:(0,r.bind)(l.deleteBranch,{context:e}),getAllCommits:(0,r.bind)(d.getAllCommits,{context:e}),getBranchesToCleanFromPrInfos:(0,r.bind)(f.getBranchesToCleanFromPrInfos,{context:e}),getCurrentBranchOrThrow:()=>(0,a.getCurrentBranchOrThrow)({context:e}),getCurrentBranchPrecondition:()=>(0,a.getCurrentBranchPrecondition)({context:e}),getLastSubmittedVersionNumber:(0,r.bind)(v.getLastSubmittedVersionNumber,{context:e}),getLastSubmittedVersionBaseName:(0,r.bind)(g.getLastSubmittedVersionBaseName,{context:e}),getParentPrecondition:(0,r.bind)(y.getParentPrecondition,{context:e}),getVersionsForBranch:(0,r.bind)(E.getVersionsForBranch,{context:e}),handleSuccessfulRebase:(0,r.bind)(C.handleSuccessfulRebase,{context:e}),isBranchDirectlyOnTrunk:(0,r.bind)(R.isBranchDirectlyOnTrunk,{context:e}),isBranchEmpty:(0,r.bind)(w.isBranchEmpty,{context:e}),isBranchFixed:(0,r.bind)(P.isBranchFixed,{context:e}),isBranchTracked:(0,r.bind)(a.isBranchTracked,{context:e}),updateBranchMeta:(0,r.bind)(A.updateBranchMeta,{context:e}),updateBranchToSha:(0,r.bind)(M.updateBranchToSha,{context:e}),getChildren:(0,r.bind)(h.getChildren,{context:e}),getParent:(0,r.bind)(b.getParent,{context:e}),getRecursiveParentsExcludingTrunk:(0,r.bind)(b.getRecursiveParentsExcludingTrunk,{context:e}),getRelativeStack:(0,r.bind)(_.getRelativeStack,{context:e}),removeChild:(0,r.bind)(O.removeChild,{context:e}),setParent:(0,r.bind)(N.setParent,{context:e}),validateNewParent:(0,r.bind)(T.validateNewParent,{context:e}),branchMatchesRemote:(0,r.bind)(o.branchMatchesRemote,{context:e}),getCurrentRemoteVersion:(0,r.bind)(p.getCurrentRemoteVersion,{context:e}),localMatchesLastSubmittedUpToRebase:(0,r.bind)(i.localMatchesLastSubmittedUpToRebase,{context:e}),matchesLastSubmittedUpToRebase:(0,r.bind)(i.matchesLastSubmittedUpToRebase,{context:e}),syncBranchWithRemoteVersion:(0,r.bind)(S.syncBranchWithRemoteVersion,{context:e}),getCurrentTrunkNameOrNull:()=>(0,m.getCurrentTrunkNameOrNull)({context:e}),getCurrentTrunkNameOrThrow:()=>(0,m.getCurrentTrunkNameOrThrow)({context:e}),getTrunkForBranchOrNull:(0,r.bind)(m.getTrunkForBranchOrNull,{context:e}),getTrunkForBranchOrThrow:(0,r.bind)(m.getTrunkForBranchOrThrow,{context:e})})},95743:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.branchMatchesRemote=void 0;const o=n(32434);t.branchMatchesRemote=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){var n;const{git:r}=t,i=(0,o.assertBranchIsValidOrTrunkAndGetMeta)({branchName:e,context:t}),a=null!==(n=r.getRemoteSha(e))&&void 0!==n?n:yield r.readFetchHead({branchName:e}).catch((()=>{}));return i.branchRevision===a}))}},75981:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.matchesLastSubmittedUpToRebase=t.localMatchesLastSubmittedUpToRebase=void 0;const o=n(6150),i=n(32434);function a(e){return r(this,arguments,void 0,(function*({branchName:e,commitRange:t,remoteRepo:n,context:r}){const a=(0,i.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:r}).lastSubmittedVersion;return!!a&&function({commitRange1:e,commitRange2:t,remoteRepo:n,context:r}){const{git:i}=r;return!!(0,o.areCommitRangesEqual)(e,t)||i.commitRangesAreEquivalent({commitRange1:e,commitRange2:t,remote:n})}({commitRange1:{base:a.baseSha,head:a.headSha},commitRange2:t,remoteRepo:n,context:r})}))}t.localMatchesLastSubmittedUpToRebase=function(e){return r(this,arguments,void 0,(function*({branchName:e,remoteRepo:t,context:n}){const r=(0,i.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:n});return a({branchName:e,commitRange:{base:r.parentBranchRevision,head:r.branchRevision},remoteRepo:t,context:n})}))},t.matchesLastSubmittedUpToRebase=a},32434:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCurrentBranchPrecondition=t.isBranchTracked=t.getCurrentBranchOrThrow=t.assertBranchIsValidAndNotTrunkAndGetMeta=t.assertBranchIsValidOrTrunkAndGetMeta=t.assertBranchExistsAndGetMeta=t.assertBranchExists=void 0;const r=n(306),o=n(5397);t.assertBranchExists=({branchName:e,context:t})=>{if(!t.cache.branchExists(e))throw new o.NoBranchError(e)},t.assertBranchExistsAndGetMeta=({branchName:e,context:n})=>{(0,t.assertBranchExists)({branchName:e,context:n});const r=n.cache.getBranchMetadata(e);if(!r)throw new o.NoBranchError(e);return r},t.assertBranchIsValidOrTrunkAndGetMeta=({branchName:e,context:n})=>{const o=(0,t.assertBranchExistsAndGetMeta)({branchName:e,context:n});return(0,r.assertCachedBranchMetadataIsValidOrTrunk)(e,o),o},t.assertBranchIsValidAndNotTrunkAndGetMeta=({branchName:e,context:n})=>{const o=(0,t.assertBranchExistsAndGetMeta)({branchName:e,context:n});return(0,r.assertCachedBranchMetadataIsValidAndNotTrunk)(e,o),o},t.getCurrentBranchOrThrow=({context:e})=>{const n=e.cache.getCurrentBranch();if(!n)throw new o.DetachedError;return(0,t.assertBranchExists)({branchName:n,context:e}),n},t.isBranchTracked=({branchName:e,context:n})=>"VALID"===(0,t.assertBranchExistsAndGetMeta)({branchName:e,context:n}).validationResult,t.getCurrentBranchPrecondition=({context:e})=>{const n=(0,t.getCurrentBranchOrThrow)({context:e});return(0,t.assertBranchIsValidOrTrunkAndGetMeta)({branchName:n,context:e}),n}},94543:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.checkoutBranch=void 0;const o=n(32434);t.checkoutBranch=e=>r(void 0,[e],void 0,(function*({branchName:e,context:t}){const{cache:n,git:r}=t;n.getCurrentBranch()!==e&&((0,o.assertBranchExists)({branchName:e,context:t}),yield r.switchBranch({branch:e}),n.setCurrentBranch(e))}))},78502:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanBranch=void 0;const o=n(34388),i=n(17214),a=n(37314),s=n(18642),c=n(55318),u=n(2621);t.cleanBranch=e=>r(void 0,[e],void 0,(function*({branchesToClean:e,trunks:t,remoteRepo:n,shouldDeleteBranch:r,warnOnCheckedOutBranch:l,context:d}){var f;const{worktree:h}=d,p=new Map,m=[];for(const n of t)for(const t of(0,c.getRelativeStack)({branchName:n,scope:o.STACK_SCOPE.UPSTACK_EXCLUSIVE,context:d})){const n=e.find((e=>e.branchName===t));if(void 0===n)continue;if(yield h.isBranchCheckedOutInAnotherWorktree({branchName:t})){l(n);continue}if(!(yield r(n)))continue;const o=null!==(f=p.get(t))&&void 0!==f?f:(0,s.getParentPrecondition)({branchName:t,context:d});(0,a.getChildren)({branchName:t,context:d}).forEach((e=>p.set(e,o))),p.delete(t),m.push(n)}const g=[];for(const[e,t]of p)yield(0,u.setParent)({branchName:e,parentBranchName:t,context:d}),g.push({action:"setParent",branchName:e,newParent:t});for(const{branchName:e,prNumber:t}of m){const r=yield(0,i.deleteBranch)({branchName:e,remoteRepo:n,context:d});g.push({action:"deleteBranch",branchName:e,previousSha:r,prNumber:t})}return g}))},70869:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteAllBranchData=void 0;const o=n(32434),i=n(67193);t.deleteAllBranchData=e=>r(void 0,[e],void 0,(function*({branchName:e,remoteRepo:t,context:n}){const{cache:r,git:a}=n,s=(0,o.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:n});(0,i.removeChild)({parentBranchName:s.parentBranchName,childBranchName:e,context:n}),r.deleteBranchMetadata(e),yield a.deleteBranch({branchName:e}),yield a.deleteRemoteTracking({remote:t,branchName:e}),yield n.branchMetadata.deleteBranchMetadataRef({branchName:e})}))},17214:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteBranch=void 0;const i=o(n(80701)),a=n(5397),s=n(32434),c=n(94543),u=n(70869),l=n(2621);t.deleteBranch=e=>r(void 0,[e],void 0,(function*({branchName:e,remoteRepo:t,context:n}){const{worktree:r}=n,o=(0,s.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:n});if(e===n.cache.getCurrentBranch())yield(0,c.checkoutBranch)({branchName:o.parentBranchName,context:n});else if(yield r.isBranchCheckedOutInAnotherWorktree({branchName:e}))throw new a.PreconditionsFailedError(`Cannot delete branch ${i.default.yellow(e)} while it is checked out in another worktree`);const d=o.branchRevision;return[...o.children].forEach((e=>(0,l.setParent)({branchName:e,parentBranchName:o.parentBranchName,context:n}))),yield(0,u.deleteAllBranchData)({branchName:e,remoteRepo:t,context:n}),d}))},80911:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getAllCommits=void 0;const r=n(32434);t.getAllCommits=({branchName:e,format:t,context:n})=>{const{git:o}=n,i=(0,r.assertBranchIsValidOrTrunkAndGetMeta)({branchName:e,context:n});return o.getFormattedCommitOrRange({base:"TRUNK"===i.validationResult?void 0:i.parentBranchRevision,head:i.branchRevision,format:t})}},34447:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchesToCleanFromPrInfos=void 0;const o=n(64385);t.getBranchesToCleanFromPrInfos=e=>r(void 0,[e],void 0,(function*({prInfos:e,trunk:t,context:n}){const i=yield Promise.all(e.map((e=>r(void 0,void 0,void 0,(function*(){var r,i;switch(e.state){case"OPEN":return null;case"CLOSED":return{prNumber:e.prNumber,branchName:e.headRefName,state:e.state};case"MERGED":{const a=e.mergeCommitSha;if(!a)return{prNumber:e.prNumber,branchName:e.headRefName,state:e.state};const s=yield n.git.doesObjectExist({ref:a}),c=null!==(i=null!==(r=null!=t?t:e.cliTrunk)&&void 0!==r?r:(0,o.getTrunkForBranchOrNull)({branchName:e.headRefName,context:n}))&&void 0!==i?i:(0,o.getCurrentTrunkNameOrThrow)({context:n}),u=s&&(yield n.git.isAncestor({left:a,right:c}));return{prNumber:e.prNumber,branchName:e.headRefName,state:u?e.state:"MERGED_BUT_NOT_IN_TRUNK",trunk:c}}}})))));return{branchesToClean:i.filter((e=>"CLOSED"===(null==e?void 0:e.state)||"MERGED"===(null==e?void 0:e.state))),branchesNotCleanable:i.filter((e=>"MERGED_BUT_NOT_IN_TRUNK"===(null==e?void 0:e.state)))}}))},37314:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRecursiveChildren=t.getChildren=void 0,t.getChildren=({branchName:e,context:{cache:t}})=>{var n,r;return null!==(r=null===(n=t.getBranchMetadata(e))||void 0===n?void 0:n.children.filter((e=>{var n;return"VALID"===(null===(n=t.getBranchMetadata(e))||void 0===n?void 0:n.validationResult)})))&&void 0!==r?r:[]},t.getRecursiveChildren=({branchName:e,context:n})=>(0,t.getChildren)({branchName:e,context:n}).flatMap((e=>[e,...(0,t.getRecursiveChildren)({branchName:e,context:n})]))},68422:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deduplicateVersionsForTest=t.getCurrentRemoteVersion=void 0;const i=o(n(86776)),a=n(99833),s=n(64385);function c({versions:e}){const t=e.reduce(((e,t)=>{const n=t.headSha;return t.isGraphiteGenerated&&(e[n]=t),e}),{}),n=new Set,r=i.default.reverse(e).reduce(((e,r)=>{const o=r.headSha;if(!n.has(o)){const i=t[o];if(!r.isGraphiteGenerated&&i)return n.add(o),e.push(i),e;n.add(o),e.push(r)}return e}),[]);return i.default.reverse(r)}t.getCurrentRemoteVersion=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){var n;const{git:o,prInfo:i,splog:u}=t,l=i.getPrInfo(e);if(!l)return{result:"NO_PR"};const d=c({versions:l.versions});u.debug(`deduplicatedVersions: ${(0,a.cuteString)(d)}`);const f=d.at(-1);if(!f)return{result:"NO_MATCH"};const h=yield o.readFetchHead({branchName:e}),p=function({prInfoForBranch:e,versions:t,context:n}){var r,o,i,a;const{prInfo:c}=n,u=c.findPrInfo((({prNumber:t})=>t===e.dependentPrNumber));return null!==(a=null!==(o=null!==(r=null==u?void 0:u.headRefName)&&void 0!==r?r:e.cliTrunk)&&void 0!==o?o:null===(i=t.at(-1))||void 0===i?void 0:i.baseName)&&void 0!==a?a:(0,s.getCurrentTrunkNameOrThrow)({context:n})}({prInfoForBranch:l,versions:d,context:t}),m=yield function(e){return r(this,arguments,void 0,(function*({versions:e,remoteSha:t,context:n}){for(const r of e.slice().reverse())if(yield n.branchMetadata.hasValidParentBranchRevision({branchRevision:t,parentBranchRevision:r.baseSha}))return r.baseSha}))}({versions:d,remoteSha:h,context:t});return m?{result:"FOUND",prNumber:l.prNumber,value:{versionNumber:l.versions.length,headSha:h,baseSha:m,baseName:p,isGraphiteGenerated:null!==(n=f.isGraphiteGenerated)&&void 0!==n&&n}}:{result:"NO_MATCH"}}))},t.deduplicateVersionsForTest=c},64385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getTrunkForBranchOrNull=t.getTrunkForBranchOrThrow=t.getCurrentTrunkNameOrNull=t.getCurrentTrunkNameOrThrow=void 0;const r=n(5397),o=n(32434);t.getCurrentTrunkNameOrThrow=({context:e})=>{const n=(0,t.getCurrentTrunkNameOrNull)({context:e});if(!n)throw new r.UntrackedBranchError((0,o.getCurrentBranchOrThrow)({context:e}));return n},t.getCurrentTrunkNameOrNull=({context:e})=>{const{cache:n}=e,r=n.getCurrentBranch();if(!r||!n.branchExists(r))return null;const i=(0,o.getCurrentBranchOrThrow)({context:e});return(0,t.getTrunkForBranchOrNull)({branchName:i,context:e})},t.getTrunkForBranchOrThrow=({branchName:e,context:n})=>{const o=(0,t.getTrunkForBranchOrNull)({branchName:e,context:n});if(!o)throw new r.UntrackedBranchError(e);return o},t.getTrunkForBranchOrNull=({branchName:e,context:n})=>{const r=n.cache.getBranchMetadata(e);if(!r||"BAD_PARENT_NAME"===(null==r?void 0:r.validationResult))return null;if("TRUNK"===r.validationResult)return e;const o=r.parentBranchName;return(0,t.getTrunkForBranchOrNull)({branchName:o,context:n})}},24726:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getLastSubmittedVersionBaseName=void 0;const r=n(32434);t.getLastSubmittedVersionBaseName=({branchName:e,context:t})=>{var n,o,i;const{prInfo:a}=t,s=(0,r.assertBranchIsValidOrTrunkAndGetMeta)({branchName:e,context:t});if(!s.lastSubmittedVersion)return;const c=s.lastSubmittedVersion;return c.baseName?c.baseName:null===(i=(null!==(o=null===(n=a.getPrInfo(e))||void 0===n?void 0:n.versions)&&void 0!==o?o:[]).slice().reverse().find((e=>e.headSha===c.headSha&&e.baseSha===c.baseSha)))||void 0===i?void 0:i.baseName}},52386:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getLastSubmittedVersionNumber=void 0;const r=n(32434),o=n(41595);t.getLastSubmittedVersionNumber=({branchName:e,context:t})=>{const{lastSubmittedVersion:n}=(0,r.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:t}),i=(0,o.getVersionsForBranch)({branchName:e,context:t});if(i&&n)for(let e=i.length-1;e>=0;e--)if(i[e].headSha===n.headSha&&(!i[e].authorGithubHandle||i[e].baseSha===n.baseSha))return e+1}},87233:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRecursiveParentsExcludingTrunk=t.getParent=void 0,t.getParent=({branchName:e,context:{cache:t}})=>{const n=t.getBranchMetadata(e);return"BAD_PARENT_NAME"===(null==n?void 0:n.validationResult)||"TRUNK"===(null==n?void 0:n.validationResult)||null==n?void 0:n.parentBranchName},t.getRecursiveParentsExcludingTrunk=({branchName:e,context:n})=>{const r=(0,t.getParent)({branchName:e,context:n});return r&&!n.cache.isBranchTrunk({branchName:r})?[...(0,t.getRecursiveParentsExcludingTrunk)({branchName:r,context:n}),r]:[]}},18642:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getParentPrecondition=void 0;const r=n(32434);t.getParentPrecondition=({branchName:e,context:t})=>(0,r.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:t}).parentBranchName},55318:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRelativeStack=void 0;const r=n(32434),o=n(37314),i=n(87233);t.getRelativeStack=({branchName:e,scope:t,context:n})=>((0,r.assertBranchIsValidOrTrunkAndGetMeta)({branchName:e,context:n}),[...t.recursiveParents?(0,i.getRecursiveParentsExcludingTrunk)({branchName:e,context:n}):[],...t.currentBranch?[e]:[],...t.recursiveChildren?(0,o.getRecursiveChildren)({branchName:e,context:n}):[]])},41595:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getVersionsForBranch=void 0,t.getVersionsForBranch=({branchName:e,context:t})=>{var o,i,a;const{cache:s,prInfo:c}=t,u=null!==(i=null===(o=c.getPrInfo(e))||void 0===o?void 0:o.versions)&&void 0!==i?i:[],l=null===(a=s.getBranchMetadata(e))||void 0===a?void 0:a.lastSubmittedVersion;if(!l)return u;for(const e of u)if(n(e,l)&&r(l,e.baseName))return u;return[...u,Object.assign(Object.assign({},l),{createdAt:void 0,authorGithubHandle:void 0})]};const n=(e,t)=>e.headSha===t.headSha&&e.baseSha===t.baseSha,r=(e,t)=>!e.baseName||e.baseName===t},65378:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.handleSuccessfulRebase=void 0;const o=n(32434),i=n(14566);function a(e){return r(this,arguments,void 0,(function*({childBranchName:e,parentBranchName:t,context:n}){const{cache:r,git:o}=n,i=yield o.readFetchHead({branchName:e});return{headSha:i,baseSha:r.isBranchTrunk({branchName:t})?yield o.getMergeBase({left:i,right:t}):yield o.readFetchHead({branchName:t})}}))}t.handleSuccessfulRebase=function(e){return r(this,arguments,void 0,(function*({branchName:e,parentBranchRevision:t,updateLastSubmittedVersion:n,context:r}){const{cache:s,git:c}=r,u=(0,o.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:r});yield(0,i.updateBranchMeta)({branchName:e,metadata:Object.assign(Object.assign({},u),{branchRevision:yield c.getShaOrThrow({ref:e}),parentBranchRevision:t,lastSubmittedVersion:n?Object.assign(Object.assign({},yield a({childBranchName:e,parentBranchName:u.parentBranchName,context:r})),{baseName:u.parentBranchName}):u.lastSubmittedVersion}),context:r});const l=s.getCurrentBranch();l&&s.branchExists(l)&&(yield c.switchBranch({branch:l}))}))}},27770:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeBranchClient=void 0;var r=n(68480);Object.defineProperty(t,"composeBranchClient",{enumerable:!0,get:function(){return r.composeBranchClient}})},86539:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchDirectlyOnTrunk=void 0;const r=n(64385),o=n(18642);t.isBranchDirectlyOnTrunk=function({branchName:e,context:t}){return(0,o.getParentPrecondition)({branchName:e,context:t})===(0,r.getTrunkForBranchOrThrow)({branchName:e,context:t})}},79657:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchEmpty=void 0;const r=n(32434);t.isBranchEmpty=({branchName:e,context:t})=>{const{git:n}=t;(0,r.assertBranchExists)({branchName:e,context:t});const o=(0,r.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:t});return n.isDiffEmpty({left:e,right:o.parentBranchRevision})}},75010:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchFixed=void 0,t.isBranchFixed=({branchName:e,context:t})=>{const n=t.cache.getBranchMetadata(e);if("TRUNK"===(null==n?void 0:n.validationResult))return!0;if("VALID"!==(null==n?void 0:n.validationResult))return!1;const r=t.cache.getBranchMetadata(n.parentBranchName);return n.parentBranchRevision===(null==r?void 0:r.branchRevision)}},67193:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeChild=void 0;const r=n(32434);t.removeChild=({parentBranchName:e,childBranchName:t,context:n})=>{const o=(0,r.assertBranchExistsAndGetMeta)({branchName:e,context:n}).children,i=o.indexOf(t);i>-1&&o.splice(i,1)}},60697:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.revalidateChildren=void 0;const o=n(32434);t.revalidateChildren=e=>r(void 0,[e],void 0,(function*({children:e,context:n}){const{cache:r}=n;for(const i of e){const e=(0,o.assertBranchExistsAndGetMeta)({branchName:i,context:n});if("INVALID_PARENT"!==e.validationResult)return;const a=(0,o.assertBranchExistsAndGetMeta)({branchName:e.parentBranchName,context:n}),s=yield n.branchMetadata.validateOrFixBranchWithValidParent(Object.assign(Object.assign({branchName:i},e),{parentBranchCurrentRevision:a.branchRevision}));r.updateBranchMetadata({branchName:i,metadata:Object.assign(Object.assign({},e),s)}),yield(0,t.revalidateChildren)({children:e.children,context:n})}}))},2621:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.setParent=void 0;const o=n(32434),i=n(14566),a=n(6334);t.setParent=e=>r(void 0,[e],void 0,(function*({branchName:e,parentBranchName:t,context:n}){(0,a.validateNewParent)({branchName:e,parentBranchName:t,context:n});const r=(0,o.assertBranchIsValidAndNotTrunkAndGetMeta)({branchName:e,context:n});r.parentBranchName!==t&&((0,o.assertBranchIsValidOrTrunkAndGetMeta)({branchName:t,context:n}),yield(0,i.updateBranchMeta)({branchName:e,metadata:Object.assign(Object.assign({},r),{parentBranchName:t}),context:n}))}))},59361:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.syncBranchWithRemoteVersion=void 0;const i=n(85855),a=o(n(80701)),s=n(99833),c=n(5397),u=n(32434),l=n(14566),d=n(40639),f=n(6334);t.syncBranchWithRemoteVersion=e=>r(void 0,[e],void 0,(function*({branchName:e,prNumber:t,remoteVersion:n,reconciledVersion:r,remoteRepo:o,source:i,onSuccess:a,context:c}){var p,m;const{cache:g,git:v}=c;c.splog.debug(`Syncing ${e} (#${t}) with remote version from ${i}...`),c.splog.debug(`Remote version: ${(0,s.cuteString)(n)}`),c.splog.debug(`Reconciled version: ${(0,s.cuteString)(r)}`);const{branchRevision:b,parentBranchName:y,parentBranchRevision:_}=r,E=null===(p=g.getBranchMetadata(e))||void 0===p?void 0:p.branchRevision;(0,u.assertBranchIsValidOrTrunkAndGetMeta)({branchName:y,context:c}),(0,f.validateNewParent)({branchName:e,parentBranchName:y,context:c});const C=yield(0,d.updateBranchToSha)({branchName:e,sha:b,context:c});"SUCCESS"!==C&&h({branchName:e,result:C}),yield v.setRemoteTracking({remote:o,branchName:e,sha:n.headSha}),yield(0,l.updateBranchMeta)({branchName:e,metadata:Object.assign(Object.assign({},null!==(m=g.getBranchMetadata(e))&&void 0!==m?m:{children:[]}),{validationResult:"VALID",branchRevision:b,parentBranchName:y,parentBranchRevision:_,lastSubmittedVersion:n}),context:c}),null==a||a({branchName:e,prNumber:t,versionNumber:n.versionNumber,previousSha:E})}));const h=({branchName:e,result:t})=>{switch(t){case"STAGED_CHANGES":throw new c.PreconditionsFailedError(`Cannot sync ${a.default.yellow(e)} with staged changes.`);case"CONFLICTING_UNSTAGED_CHANGES":throw new c.PreconditionsFailedError(`Cannot sync ${a.default.yellow(e)} due to conflicting unstaged changes.`);case"CONFLICTING_UNTRACKED_CHANGES":throw new c.PreconditionsFailedError(`Cannot sync ${a.default.yellow(e)} due to conflicting untracked changes.`);default:(0,i.assertUnreachable)(t)}}},14566:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.updateBranchMeta=void 0;const o=n(306),i=n(99833),a=n(32434),s=n(67193),c=n(60697);t.updateBranchMeta=e=>r(void 0,[e],void 0,(function*({branchName:e,metadata:t,context:n}){var r;const{cache:u,git:l,splog:d}=n,f=null!==(r=u.getBranchMetadata(e))&&void 0!==r?r:{validationResult:"BAD_PARENT_NAME",branchRevision:yield l.getShaOrThrow({ref:e}),children:[]};(0,o.assertCachedBranchMetadataIsNotTrunk)(f),u.updateBranchMetadata({branchName:e,metadata:t});const h="BAD_PARENT_NAME"===f.validationResult?void 0:f.parentBranchName,p=t.parentBranchName,m=(0,a.assertBranchExistsAndGetMeta)({branchName:p,context:n});h!==p&&h&&u.branchExists(h)&&(0,s.removeChild)({parentBranchName:h,childBranchName:e,context:n}),m.children.includes(e)||m.children.push(e),yield n.branchMetadata.writeBranchMetadataRef({branchName:e,branchMetadata:{parentBranchName:t.parentBranchName,parentBranchRevision:t.parentBranchRevision,lastSubmittedVersion:t.lastSubmittedVersion}}),d.debug(`Updated cached meta for branch ${e}:\n${(0,i.cuteString)({oldCachedMeta:f,metadata:t})}`),"VALID"!==f.validationResult&&(yield(0,c.revalidateChildren)({children:t.children,context:n}))}))},40639:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.updateBranchToSha=void 0,t.updateBranchToSha=e=>n(void 0,[e],void 0,(function*({branchName:e,sha:t,context:n}){const{cache:r,git:o,worktree:i}=n,a=yield i.getWorktreeWithBranchCheckedOut({branchName:e});if(a){if(yield o.refreshIndex({cwd:a.path}),yield o.detectStagedChanges({cwd:a.path}))return"STAGED_CHANGES";try{yield o.keepReset({sha:t,cwd:a.path})}catch(e){if(e instanceof Error&&e.message.includes("Cannot merge"))return"CONFLICTING_UNSTAGED_CHANGES";if(e instanceof Error&&e.message.includes("Untracked working tree file"))return"CONFLICTING_UNTRACKED_CHANGES";throw e}}else yield o.updateRef({ref:`refs/heads/${e}`,sha:t});const s=r.getBranchMetadata(e);return s&&(s.branchRevision=t),"SUCCESS"}))},6334:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.validateNewParent=void 0;const o=r(n(80701)),i=n(5397),a=n(37314);t.validateNewParent=({branchName:e,parentBranchName:t,context:n})=>{if(e===t)throw new i.PreconditionsFailedError(`Cannot set parent of ${o.default.yellow(e)} to itself!`);if(n.cache.branchExists(e)&&(0,a.getRecursiveChildren)({branchName:e,context:n}).includes(t))throw new i.InvalidParentRecursiveDependencyError({parentBranchName:t,branchName:e})}},90050:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchMetadataRefList=t.deleteBranchMetadataRef=t.readBranchMetadataRef=t.writeBranchMetadataRef=t.createBranchMetadataRefObject=t.lastSubmittedVersionSchema=void 0;const i=o(n(66469)),a=n(99833),s="refs/branch-metadata/";t.lastSubmittedVersionSchema=i.default.object({headSha:i.default.string(),baseSha:i.default.string(),baseName:i.default.string().optional()});const c=i.default.object({parentBranchName:i.default.string().optional(),parentBranchRevision:i.default.string().optional(),lastSubmittedVersion:t.lastSubmittedVersionSchema.optional()});function u(e){return r(this,arguments,void 0,(function*({branchName:e,branchMetadata:t,context:n}){return{ref:l(e),sha:yield n.git.createNewObject({content:(0,a.cuteString)(t)})}}))}function l(e){return`${s}${e}`}t.createBranchMetadataRefObject=u,t.writeBranchMetadataRef=function(e){return r(this,arguments,void 0,(function*({branchName:e,branchMetadata:t,context:n}){const r=yield u({branchName:e,branchMetadata:t,context:n});yield n.git.updateRef(r)}))},t.readBranchMetadataRef=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){try{const n=JSON.parse(yield t.git.readRef({ref:l(e)})),r=c.safeParse(n);return r.success?r.data:{}}catch(e){return{}}}))},t.deleteBranchMetadataRef=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){yield t.git.deleteRef({ref:l(e)})}))},t.getBranchMetadataRefList=function({context:e}){return e.git.getShaForEachRefWithPrefix({prefix:s})}},99754:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeBranchMetadataClient=void 0;const r=n(85855),o=n(90050),i=n(51705),a=n(20104),s=n(2330);t.composeBranchMetadataClient=e=>({hasValidParentBranchRevision:(0,r.bind)(i.hasValidParentBranchRevision,{context:e}),parseBranchesAndMeta:(0,r.bind)(a.parseBranchesAndMeta,{context:e}),validateOrFixBranchWithValidParent:(0,r.bind)(s.validateOrFixBranchWithValidParent,{context:e}),createBranchMetadataRefObject:(0,r.bind)(o.createBranchMetadataRefObject,{context:e}),deleteBranchMetadataRef:(0,r.bind)(o.deleteBranchMetadataRef,{context:e}),getBranchMetadataRefList:(0,r.bind)(o.getBranchMetadataRefList,{context:e}),readBranchMetadataRef:(0,r.bind)(o.readBranchMetadataRef,{context:e}),writeBranchMetadataRef:(0,r.bind)(o.writeBranchMetadataRef,{context:e})})},80469:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.assertCachedBranchMetadataIsValidAndNotTrunk=t.assertCachedBranchMetadataIsNotTrunk=t.assertCachedBranchMetadataIsValidOrTrunk=t.cachedBranchMetadataSchema=void 0;const o=r(n(66469)),i=n(5397),a=n(90050);function s(e,t){if("BAD_PARENT_REVISION"===t.validationResult)throw new i.DivergedBranchError(e);if("VALID"!==t.validationResult&&"TRUNK"!==t.validationResult)throw new i.UntrackedBranchError(e)}function c(e){if("TRUNK"===e.validationResult)throw new i.BadTrunkOperationError}t.cachedBranchMetadataSchema=o.default.intersection(o.default.object({children:o.default.array(o.default.string()),branchRevision:o.default.string(),lastSubmittedVersion:a.lastSubmittedVersionSchema.optional()}),o.default.discriminatedUnion("validationResult",[o.default.object({validationResult:o.default.literal("VALID"),parentBranchName:o.default.string(),parentBranchRevision:o.default.string()}),o.default.object({validationResult:o.default.literal("INVALID_PARENT"),parentBranchName:o.default.string(),parentBranchRevision:o.default.string().optional()}),o.default.object({validationResult:o.default.literal("BAD_PARENT_REVISION"),parentBranchName:o.default.string(),parentBranchRevision:o.default.string().optional()}),o.default.object({validationResult:o.default.literal("BAD_PARENT_NAME")}),o.default.object({validationResult:o.default.literal("TRUNK")})])),t.assertCachedBranchMetadataIsValidOrTrunk=s,t.assertCachedBranchMetadataIsNotTrunk=c,t.assertCachedBranchMetadataIsValidAndNotTrunk=function(e,t){s(e,t),c(t)}},51705:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.hasValidParentBranchRevision=void 0,t.hasValidParentBranchRevision=e=>n(void 0,[e],void 0,(function*({branchRevision:e,parentBranchRevision:t,context:n}){try{return yield n.git.isAncestor({left:t,right:e})}catch(e){if(e instanceof Error&&e.message.includes("Not a valid"))return!1;throw e}}))},306:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cachedBranchMetadataSchema=t.assertCachedBranchMetadataIsValidOrTrunk=t.assertCachedBranchMetadataIsValidAndNotTrunk=t.assertCachedBranchMetadataIsNotTrunk=t.composeBranchMetadataClient=void 0;var r=n(99754);Object.defineProperty(t,"composeBranchMetadataClient",{enumerable:!0,get:function(){return r.composeBranchMetadataClient}});var o=n(80469);Object.defineProperty(t,"assertCachedBranchMetadataIsNotTrunk",{enumerable:!0,get:function(){return o.assertCachedBranchMetadataIsNotTrunk}}),Object.defineProperty(t,"assertCachedBranchMetadataIsValidAndNotTrunk",{enumerable:!0,get:function(){return o.assertCachedBranchMetadataIsValidAndNotTrunk}}),Object.defineProperty(t,"assertCachedBranchMetadataIsValidOrTrunk",{enumerable:!0,get:function(){return o.assertCachedBranchMetadataIsValidOrTrunk}}),Object.defineProperty(t,"cachedBranchMetadataSchema",{enumerable:!0,get:function(){return o.cachedBranchMetadataSchema}})},20104:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseBranchesAndMeta=void 0;const i=o(n(86776)),a=n(90050),s=n(2330);t.parseBranchesAndMeta=e=>r(void 0,[e],void 0,(function*({trunkName:e,trunks:t,metadataRefList:n,gitBranchNamesAndRevisions:o,context:c}){var u;const l=yield function(e){return r(this,arguments,void 0,(function*({metadataRefList:e,gitBranchNamesAndRevisions:t,context:n}){n.splog.debug("Building cache from disk...");const[o,s]=i.default.partition(Object.keys(e),(e=>Boolean(t[e])));for(const e of s)n.splog.debug(`Deleting metadata for missing branch: ${e}`),yield(0,a.deleteBranchMetadataRef)({branchName:e,context:n});const c=new Set(o);return Object.fromEntries(yield Promise.all(Object.keys(t).map((e=>r(this,void 0,void 0,(function*(){return[e,Object.assign({branchRevision:t[e]},c.has(e)?yield(0,a.readBranchMetadataRef)({branchName:e,context:n}):{})]}))))))}))}({metadataRefList:n,gitBranchNamesAndRevisions:o,context:c}),d=new Map,f=new Set([...e?[e]:[],...(null!=t?t:[]).map((e=>e.name))]);c.splog.debug(`Validating ${Object.keys(l).length} branches for trunks ${Array.from(f).join()}...`);const h=new Map;function p({childrenToMarkInvalid:e,parentBranchName:t}){e.forEach((e=>{var n;const r=l[e],o=null!==(n=h.get(e))&&void 0!==n?n:[];h.delete(e),c.splog.debug(`invalid parent: ${e}\n\tchildren: ${o.join()}`),d.set(e,Object.assign(Object.assign({},r),{children:o,parentBranchName:t,validationResult:"INVALID_PARENT"})),o.length&&p({childrenToMarkInvalid:o,parentBranchName:e})}))}function m(e){return r(this,arguments,void 0,(function*({parentBranchName:e,parentBranchCurrentRevision:t,childrenToValidate:n}){yield Promise.all(n.map((n=>r(this,void 0,void 0,(function*(){var r;const o=l[n],i=yield(0,s.validateOrFixBranchWithValidParent)(Object.assign(Object.assign({},o),{branchName:n,parentBranchName:e,parentBranchCurrentRevision:t,context:c})),a=null!==(r=h.get(n))&&void 0!==r?r:[];h.delete(n),d.set(n,Object.assign(Object.assign({children:a,parentBranchName:e},o),i)),a.length&&("BAD_PARENT_REVISION"!==i.validationResult?yield m({parentBranchName:n,parentBranchCurrentRevision:o.branchRevision,childrenToValidate:a}):p({parentBranchName:n,childrenToMarkInvalid:a}))})))))}))}Object.keys(l).filter((e=>!f.has(e))).forEach((e=>{var t;const n=l[e].parentBranchName;if(!n||n===e||!(n in l))return c.splog.debug(n?`bad parent name: ${e}\n\t${n}`:`no parent: ${e}`),void d.set(e,{validationResult:"BAD_PARENT_NAME",branchRevision:l[e].branchRevision,children:null!==(t=h.get(e))&&void 0!==t?t:[]});c.splog.debug(`valid parent name: ${e}\n\t${n}`);const r=h.get(n);r?r.push(e):h.set(n,[e])}));for(const e of f)if(e in l){c.splog.debug(`trunk: ${e}`);const t=null!==(u=h.get(e))&&void 0!==u?u:[];h.delete(e);const{branchRevision:n}=l[e];d.set(e,{validationResult:"TRUNK",branchRevision:n,children:t}),yield m({parentBranchName:e,parentBranchCurrentRevision:n,childrenToValidate:t})}return h.forEach(((e,t)=>{const n=d.get(t);n&&(n.children=e),p({parentBranchName:t,childrenToMarkInvalid:e})})),c.splog.debug("Finished validating branches..."),Object.fromEntries(d.entries())}))},2330:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.validateOrFixBranchWithValidParent=void 0;const o=n(90050),i=n(51705);t.validateOrFixBranchWithValidParent=e=>r(void 0,[e],void 0,(function*({branchName:e,branchRevision:t,parentBranchName:n,parentBranchRevision:r,parentBranchCurrentRevision:a,lastSubmittedVersion:s,context:c}){if(r&&(yield(0,i.hasValidParentBranchRevision)({parentBranchRevision:r,branchRevision:t,context:c}))){if(r!==a&&(yield c.git.isAncestor({left:r,right:a}))){const r=yield c.git.getMergeBase({left:a,right:t});return yield(0,o.writeBranchMetadataRef)({branchName:e,branchMetadata:{parentBranchName:n,parentBranchRevision:r,lastSubmittedVersion:s},context:c}),c.splog.debug(`validated and updated parent rev: ${e}\n\t${r}`),{validationResult:"VALID",parentBranchRevision:r}}return c.splog.debug(`validated: ${e}`),{validationResult:"VALID",parentBranchRevision:r}}return(yield c.git.isAncestor({left:a,right:e}))?(yield(0,o.writeBranchMetadataRef)({branchName:e,branchMetadata:{parentBranchName:n,parentBranchRevision:a,lastSubmittedVersion:s},context:c}),c.splog.debug(`validated and fixed parent rev: ${e}\n\t${a}`),{validationResult:"VALID",parentBranchRevision:a}):(c.splog.debug(`bad parent rev: ${e}\n\t${null!=r?r:"missing"}`),{validationResult:"BAD_PARENT_REVISION"})}))},28368:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.computeHash=void 0;const r=n(76982);t.computeHash=function(e){return(0,r.createHash)("sha1").update(JSON.stringify(e)).digest("hex").toString()}},99833:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cuteString=void 0,t.cuteString=e=>JSON.stringify(e,null,2)},5397:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidParentRecursiveDependencyError=t.TooMuchDebugContextError=t.GitPassthroughBlockedError=t.NoPotentialParentsError=t.OutsideGitMutationDetectedError=t.NoGraphiteUndoError=t.NoGraphiteContinue=t.AbortFailedError=t.NoGraphiteAbortError=t.BlockedDuringRebaseError=t.KilledError=t.BadTrunkOperationError=t.UntrackedBranchError=t.DivergedBranchError=t.NoBranchError=t.DetachedError=t.ConcurrentExecutionError=t.RebaseConflictError=t.NonInteractiveError=t.PreconditionsFailedError=t.ExitFailedError=t.FailedPingError=t.ConnectionError=t.AuthError=void 0;const o=r(n(80701));class i extends Error{constructor(e){super(`Your Graphite auth token is invalid/expired.\n\nPlease obtain a new auth token by visiting ${e}/activate`),this.name="AuthError"}}t.AuthError=i;class a extends Error{constructor(){super("Could not connect to the Graphite server. Please try again."),this.name="Connection"}}t.ConnectionError=a;class s extends Error{constructor({pingCheck:e}){super(`Failed to ping Graphite server or ping ${e.ipAddress}. Please check your internet connection and try again.`),this.name="FailedPing"}}t.FailedPingError=s;class c extends Error{constructor(e){super(e),this.name="ExitFailed"}}t.ExitFailedError=c;class u extends Error{constructor(e){super(e),this.name="PreconditionsFailed"}}t.PreconditionsFailedError=u;class l extends Error{constructor(){super("Cannot perform interactive operation in non-interactive mode."),this.name="NonInteractive"}}t.NonInteractiveError=l;class d extends Error{constructor(){super("Hit a conflict during rebase."),this.name="RebaseConflict"}}t.RebaseConflictError=d;class f extends Error{constructor(){super("Cannot run more than one Graphite process at once."),this.name="ConcurrentExecutionError"}}t.ConcurrentExecutionError=f;class h extends Error{constructor(e){const t="Cannot perform this operation without a branch checked out.";super(e?[t,e].join("\n"):t),this.name="DetachedError"}}t.DetachedError=h;class p extends Error{constructor(e){super(`Could not find branch ${o.default.yellow(e)}.`),this.name="NoBranchError"}}t.NoBranchError=p;class m extends Error{constructor(e){super(`Cannot perform this operation on diverged branch ${o.default.yellow(e)}.`)}}t.DivergedBranchError=m;class g extends Error{constructor(e){super([`Cannot perform this operation on untracked branch ${o.default.yellow(e)}.`,`You can track it by specifying its parent with ${o.default.cyan("gt track")}.`].join("\n")),this.name="UntrackedBranchError"}}t.UntrackedBranchError=g;class v extends Error{constructor(e){super(["Cannot perform this operation on the trunk branch.",e].filter((e=>e)).join("\n\n")),this.name="BadTrunkOperationError"}}t.BadTrunkOperationError=v;class b extends Error{constructor(){super("Killed Graphite early."),this.name="Killed"}}t.KilledError=b;class y extends Error{constructor(){super(["This operation is blocked during a rebase.",`You can continue with ${o.default.cyan("gt continue")} after resolving conflicts or abort the rebase with ${o.default.cyan("gt abort")}.`].join("\n")),this.name="BlockedDuringRebase"}}t.BlockedDuringRebaseError=y;class _ extends Error{constructor(){super("No Graphite operation to abort."),this.name="NoGraphiteAbortError"}}t.NoGraphiteAbortError=_;class E extends Error{constructor(e){super(`Failed to abort command "${e}".`),this.name="AbortFailedError"}}t.AbortFailedError=E;class C extends Error{constructor(e){const t="No Graphite operation to continue.";super(e?[t,`Did you mean ${o.default.cyan(e)}?`].join("\n"):t),this.name="NoGraphiteContinue"}}t.NoGraphiteContinue=C;class R extends Error{constructor(){super("No Graphite operation to undo."),this.name="NoGraphiteUndoError"}}t.NoGraphiteUndoError=R;class w extends Error{constructor(e){const t="Cannot run this command since we detected a git command was run outside of Graphite.";super(e?[t,e].join("\n"):t),this.name="OutsideGitMutationDetectedError"}}t.OutsideGitMutationDetectedError=w,t.NoPotentialParentsError=class extends c{constructor({branchName:e,trunkNames:t}){super("No possible parents for this branch. "+(t.length>1?`Try running \`git rebase <${t.join("|")}> ${e}\` with the trunk you want to track this branch against.`:`Try running \`git rebase ${t[0]} ${e}\`.`))}};class P extends Error{constructor({recommendedGraphiteCommand:e}){super(`This command is not supported by Graphite. You can run ${o.default.cyan(e)} instead.`),this.name="GitPassthroughBlockedError"}}t.GitPassthroughBlockedError=P;class O extends Error{constructor(){super("The amount of log data encountered is more than is supported by the feedback comment"),this.name="TooMuchDebugContextError"}}t.TooMuchDebugContextError=O,t.InvalidParentRecursiveDependencyError=class extends u{constructor({parentBranchName:e,branchName:t}){super(`Cannot set ${o.default.yellow(e)} as the parent of ${o.default.yellow(t)} because it's a child of it!`)}}},35295:function(e,t,n){var r,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGit=void 0;const i=n(85855),a=n(20705),s=n(95414),c=n(42598),u=n(42928),l=n(31247),d=n(78832),f=n(23047),h=n(92874),p=n(16631),m=n(82198),g=n(75132),v=n(1712),b=n(84577),y=n(34734),_=n(12054),E=n(89956),C=n(92780),R=n(55926),w=n(8328),P=n(34875),O=n(68937),N=n(90822),S=n(10629),A=n(76429),M=n(32209),T=n(38840),k=n(63352),x=n(76425),I=n(91833),B=n(49165),D=n(64829),j=n(89394),F=n(79165),G=n(74827),U=n(50412),L=n(13017),H=n(50796),$=n(52704),V=n(51431),q=n(5918),W=n(4485),K=n(60308),z=n(58139),J=n(90173),Q=+(null!==(r=process.env.GT_MAX_GIT_CONCURRENCY)&&void 0!==r?r:0)||1e3;t.composeGit=function(e){return o(this,arguments,void 0,(function*({cwd:e,splog:t,quiet:n}){const r=(0,z.composeExecutionPool)({maxConcurrency:Q,onEnqueued:({queueSize:e})=>{t.debug(`Git execution pool full, ${e} commands in queue`)},onQueueDrained:()=>{t.debug("Git execution pool fully drained")}}),o=(0,J.composeGitRunner)({cwd:e,splog:t,executionPool:r}),[Y,X]=yield Promise.all([(0,j.getRepoPaths)({runner:o}),(0,R.getGitVersion)({runner:o})]),Z=(0,p.composeGitConfig)(o),ee={runner:o,gitConfig:Z,splog:t};return Y?Object.assign(Object.assign(Object.assign({gitVersion:X,repo:!0,config:Z},Y),(0,E.composeGetRemoteSha)(o)),{addAll:(0,i.bindWithEmptyObject)((0,i.bind)(s.addAll,{runner:o})),addUpdates:(0,i.bindWithEmptyObject)((0,i.bind)(s.addUpdates,{runner:o})),addPatch:(0,i.bindWithEmptyObject)((0,i.bind)(s.addPatch,{runner:o})),createStashCommit:(0,i.bind)($.createStashCommit,{runner:o}),findUntrackedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(q.findUntrackedFiles,{runner:o})),trackFiles:(0,i.bind)(q.trackFiles,{runner:o}),trackAllNewFiles:(0,i.bindWithEmptyObject)((0,i.bind)(q.trackAllNewFiles,{runner:o})),getCommitAuthor:(0,i.bind)(f.getCommitAuthor,{runner:o}),getCommitDate:(0,i.bind)(f.getCommitDate,{runner:o}),getFilesChanged:(0,i.bind)(b.getFilesChanged,{runner:o}),getStatus:(0,i.bindWithEmptyObject)((0,i.bind)(V.getStatus,{runner:o})),getCurrentBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(c.getCurrentBranchName,{runner:o})),getPreviousBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(c.getPreviousBranchName,{runner:o})),moveBranch:(0,i.bind)(c.moveBranch,{runner:o}),deleteBranch:(0,i.bind)(c.deleteBranch,{runner:o}),switchBranch:(0,i.bind)(c.switchBranch,{runner:o}),getDiff:(0,i.bind)(m.getDiff,{runner:o}),getDiffOfStagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(m.getDiffOfStagedChanges,{runner:o})),forceCheckoutNewBranch:(0,i.bind)(c.forceCheckoutNewBranch,{runner:o}),forceCreateBranch:(0,i.bind)(c.forceCreateBranch,{runner:o}),getNumberOfCommitsInRange:(0,i.bind)(h.getNumberOfCommitsInRange,{runner:o}),getFormattedCommitOrRange:(0,i.bind)(h.getFormattedCommitOrRange,{runner:o}),commit:(0,i.bind)(d.commit,{quiet:n,runner:o}),restore:(0,i.bind)(G.restore,{runner:o}),revert:(0,i.bind)(d.revert,{quiet:n,runner:o}),detectStagedChanges:(0,i.bind)(V.detectStagedChanges,{runner:o}),getUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(m.getUnstagedChanges,{runner:o})),showDiff:(0,i.bind)(m.showDiff,{runner:o}),isDiffEmpty:(0,i.bind)(m.isDiffEmpty,{runner:o}),fetchBranches:(0,i.bind)(g.fetchBranches,{runner:o}),readFetchHead:(0,i.bind)(g.readFetchHead,{runner:o}),findRemoteHeadBranch:(0,i.bind)(y.findRemoteHeadBranch,{runner:o}),getShaOrThrow:(0,i.bind)(E.getShaOrThrow,{runner:o}),getSha:(0,i.bind)(E.getSha,{runner:o}),detectUntrackedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(V.detectUntrackedChanges,{runner:o})),trackedUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(V.trackedUnstagedChanges,{runner:o})),isMerged:(0,i.bind)(w.isMerged,{runner:o}),logLong:(0,i.bindWithEmptyObject)((0,i.bind)(P.logLong,{runner:o})),getMergeBase:(0,i.bind)(O.getMergeBase,{runner:o}),isAncestor:(0,i.bind)(O.isAncestor,{runner:o}),getUnmergedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(V.getUnmergedFiles,{runner:o})),getRebaseHead:(0,i.bindWithEmptyObject)((0,i.bind)(N.getRebaseHead,{gitDir:Y.gitDir})),getRemoteUrl:(0,i.bind)(D.getRemoteUrl,{runner:o}),showCommits:(0,i.bind)(L.showCommits,{runner:o}),getFileContents:(0,i.bind)(v.getFileContents,{runner:o}),fetchRemoteTrackingBranch:(0,i.bind)(M.fetchRemoteTrackingBranch,{runner:o}),fastForwardBranchToRemoteTracking:(0,i.bind)(M.fastForwardBranchToRemoteTracking,{runner:o}),pushBranches:(0,i.bind)(T.pushBranches,{runner:o,gitConfig:Z,gitCommonDir:Y.gitCommonDir,repoRoot:Y.repoRoot}),getHookExecutablePath:(0,i.bind)(_.getHookExecutablePath,{gitConfig:Z,gitCommonDir:Y.gitCommonDir,repoRoot:Y.repoRoot}),getCleanlyReconciledSquashedHead:(0,i.bind)(B.getCleanlyReconciledSquashedHead,{runner:o,gitConfig:Z}),rebaseInProgress:(0,i.bindWithEmptyObject)((0,i.bind)(I.rebaseInProgress,{gitDir:Y.gitDir})),cleanRebase:(0,i.bind)(l.cleanRebase,{context:ee}),rebase:(0,i.bind)(x.rebase,{gitDir:Y.gitDir,runner:o}),rebaseContinue:(0,i.bind)(x.rebaseContinue,{gitDir:Y.gitDir,runner:o}),rebaseAbort:(0,i.bindWithEmptyObject)((0,i.bind)(x.rebaseAbort,{runner:o})),rebaseInteractive:(0,i.bind)(x.rebaseInteractive,{gitDir:Y.gitDir,runner:o}),softReset:(0,i.bind)(F.softReset,{runner:o}),mixedReset:(0,i.bind)(F.mixedReset,{runner:o}),keepReset:(0,i.bind)(F.keepReset,{runner:o}),trackedReset:(0,i.bind)(F.trackedReset,{runner:o}),setRemoteTracking:(0,i.bind)(U.setRemoteTracking,{runner:o}),deleteRemoteTracking:(0,i.bind)(U.deleteRemoteTracking,{runner:o}),getBranchNamesAndRevisions:(0,i.bindWithEmptyObject)((0,i.bind)(H.getBranchNamesAndRevisions,{runner:o})),clean:(0,i.bindWithEmptyObject)((0,i.bind)(u.clean,{runner:o})),createNewObject:(0,i.bind)(A.createNewObject,{runner:o}),updateRef:(0,i.bind)(A.updateRef,{runner:o}),updateRefs:(0,i.bind)(W.updateRefs,{runner:o}),readRef:(0,i.bind)(A.readRef,{runner:o}),doesObjectExist:(0,i.bind)(A.doesObjectExist,{runner:o}),deleteRef:(0,i.bind)(A.deleteRef,{runner:o}),getShaForEachRefWithPrefix:(0,i.bind)(A.getShaForEachRefWithPrefix,{runner:o}),commitRangesAreEquivalent:(0,i.bind)(k.commitRangesAreEquivalent,{runner:o}),getBranchesInCommitRange:(0,i.bind)(h.getBranchesInCommitRange,{runner:o}),absorbPatchesIntoCommitStack:(0,i.bind)(a.absorbPatchesIntoCommitStack,{repoRoot:Y.repoRoot,gitCommonDir:Y.gitCommonDir,runner:o,gitConfig:Z}),refreshIndex:(0,i.bind)(V.refreshIndex,{runner:o}),packAllRefs:(0,i.bindWithEmptyObject)((0,i.bind)(S.packAllRefs,{runner:o})),listWorktrees:(0,i.bindWithEmptyObject)((0,i.bind)(K.listWorktrees,{runner:o})),runGitCommandPassthrough:(0,i.bind)(C.runGitCommandPassthrough,{runner:o})}):{gitVersion:X,repo:!1,config:Z}}))}},20705:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.absorbPatchesIntoCommitStack=void 0;const i=o(n(57372)),a=o(n(16928)),s=n(92874),c=n(55627),u=n(16631),l=n(89956),d=n(97690);function f(e){return r(this,arguments,void 0,(function*({sha:e,patch:t,runner:n,repoRoot:r,gitCommonDir:o}){const s=a.default.join(o,`.gt-${process.pid}-${Date.now()}.index`);yield(0,d.readTreeIntoIndexFile)({treeish:e,indexFile:s,runner:n,repoRoot:r}),yield(0,d.applyPatchToIndexFile)({patch:t,indexFile:s,runner:n,repoRoot:r});const c=yield(0,d.writeTreeFromIndexFile)({indexFile:s,runner:n,repoRoot:r});return i.default.rmSync(s),c}))}t.absorbPatchesIntoCommitStack=function(e){return r(this,arguments,void 0,(function*({shas:e,patches:t,runner:n,restackCommitterDateIsAuthorDate:r,gitConfig:o,gitCommonDir:i,repoRoot:a}){const d=yield(0,u.isGpgSigningEnabled)({gitConfig:o}),h=[];let p=yield(0,l.getSha)({runner:n,ref:`${e[0]}~`}),m=!1;for(let o=0;o<t.length;o++){const u=e[o],l=t[o];if(!m&&null===l){h.push(u),p=u;continue}m=!0;const g=(0,s.getRebaseMetadataForCommit)({runner:n,sha:u}),v=null===l?`${u}^{tree}`:yield f({gitCommonDir:i,repoRoot:a,sha:u,patch:l,runner:n}),{message:b,authorDate:y,authorEmail:_,authorName:E}=yield g,C=yield(0,c.commitTree)({tree:v,parent:p,message:b,gpgSign:d,env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:E,GIT_AUTHOR_EMAIL:_,GIT_AUTHOR_DATE:y}),r&&{GIT_COMMITTER_DATE:y}),cwd:a,resource:"absorbPatchesIntoCommitStackCommitTree",runner:n});h.push(C),p=C}return h}))}},95414:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.addPatch=t.addUpdates=t.addAll=void 0,t.addAll=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--all"],onError:"throw",resource:"addAll"})}))},t.addUpdates=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--update"],onError:"throw",resource:"addUpdates"})}))},t.addPatch=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--patch"],spawnOptions:{stdio:"inherit"},onError:"throw",resource:"addPatch"})}))}},42598:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.forceCreateBranch=t.forceCheckoutNewBranch=t.switchBranch=t.deleteBranch=t.moveBranch=t.getPreviousBranchName=t.getCurrentBranchName=void 0,t.getCurrentBranchName=function(e){return n(this,arguments,void 0,(function*({runner:e}){const t=yield e.runGitCommand({args:["branch","--show-current"],onError:"ignore",resource:"getCurrentBranchName"});return t.length>0?t:void 0}))},t.getPreviousBranchName=function(e){return n(this,arguments,void 0,(function*({runner:e}){const t=yield e.runGitCommand({args:["rev-parse","--symbolic-full-name","--abbrev-ref=loose","@{-1}"],onError:"ignore",resource:"getPreviousBranchName"});return t.length>0?t:void 0}))},t.moveBranch=function(e){return n(this,arguments,void 0,(function*({runner:e,newName:t}){yield e.runGitCommand({args:["branch","-m",t],spawnOptions:{stdio:"pipe"},onError:"throw",resource:"moveBranch"})}))},t.deleteBranch=function(e){return n(this,arguments,void 0,(function*({runner:e,branchName:t}){yield e.runGitCommand({args:["branch","-D",t],spawnOptions:{stdio:"pipe"},onError:"throw",resource:"deleteBranch"})}))},t.switchBranch=function(e){return n(this,arguments,void 0,(function*({branch:e,newBranch:t,detach:n,force:r,runner:o}){yield o.runGitCommand({args:["switch","-q",...n?["-d"]:[],...r?["-f"]:[],...t?["-c"]:[],e],onError:"throw",resource:"switchBranch",options:{echoStderr:!0}})}))},t.forceCheckoutNewBranch=function(e){return n(this,arguments,void 0,(function*({branchName:e,sha:t,runner:n}){yield n.runGitCommand({args:["switch","-q","-C",e,t],onError:"throw",resource:"forceCheckoutNewBranch",options:{echoStderr:!0}})}))},t.forceCreateBranch=function(e){return n(this,arguments,void 0,(function*({branchName:e,sha:t,runner:n}){yield n.runGitCommand({args:["branch","-f",e,t],spawnOptions:{stdio:"pipe"},onError:"throw",resource:"forceCreateBranch"})}))}},42928:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.clean=void 0,t.clean=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["clean","--force"],spawnOptions:{stdio:"ignore"},onError:"throw",resource:"clean"})}))}},31247:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanRebase=void 0;const o=n(92874),i=n(55627),a=n(16631),s=n(68937),c=n(39036),u=n(76429);t.cleanRebase=function(e){return r(this,arguments,void 0,(function*({onto:e,from:t,head:n,restackCommitterDateIsAuthorDate:l,context:d}){var f,h;const{gitConfig:p,runner:m}=d,g=yield(0,a.isGpgSigningEnabled)({gitConfig:p}),v=yield(0,o.getFormattedCommitOrRange)({base:t,head:n,format:"SHA",runner:m});return d.splog.debug(`Rebasing ${v.length} commits from ${t} to ${n}`),null!==(h=null===(f=yield v.reverse().map((e=>({sha:e,metadataPromise:(0,o.getRebaseMetadataForCommit)({runner:m,sha:e})}))).reduce(((t,n)=>r(this,[t,n],void 0,(function*(t,{sha:n,metadataPromise:o}){const[a,{message:d,authorDate:f,authorEmail:h,authorName:p}]=yield Promise.all([t,o]);if(!a)return null;const v=a.tree,b=yield function(e){return r(this,arguments,void 0,(function*({sha:e,runner:t}){return(yield t.runGitCommand({args:["rev-list","--parents","-1",`${e}`],onError:"ignore",resource:"getShaParentsForDebugging"})).split(" ").length}))}({sha:n,runner:m});if(b>2)return{tree:v,commitPromise:Promise.resolve(a.commitPromise)};if(yield(0,s.isAncestor)({left:n,right:e,runner:m}))return{tree:v,commitPromise:Promise.resolve(a.commitPromise)};const y=yield function(e){return r(this,arguments,void 0,(function*({sha:e,parentTree:t,runner:n}){const r=`${e}~`,o=yield(0,u.doesObjectExist)({ref:r,runner:n}),a=yield(0,i.commitTree)({tree:t,parent:o?r:void 0,message:"_",resource:"cleanRebaseOntoCommitTree",runner:n});return(0,c.mergeTree)({rev1:a,rev2:e,allowUnrelatedHistories:!0,resource:"cleanRebaseMergeTree",runner:n})}))}({sha:n,parentTree:v,runner:m});return y?y===v?a:{tree:y,commitPromise:(0,i.commitTree)({tree:y,parent:yield a.commitPromise,message:d,gpgSign:g,env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:p,GIT_AUTHOR_EMAIL:h,GIT_AUTHOR_DATE:f}),l&&{GIT_COMMITTER_DATE:f}),resource:"cleanRebaseCommitTree",runner:m})}:null}))),Promise.resolve({commitPromise:Promise.resolve(e),tree:`${e}^{tree}`})))||void 0===f?void 0:f.commitPromise)&&void 0!==h?h:null}))}},78832:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.revert=t.commit=void 0,t.commit=function(e){return n(this,arguments,void 0,(function*({amend:e,message:t,noEdit:n,edit:r,patch:o,quiet:i,verboseCount:a,noVerify:s,runner:c}){yield c.runGitCommand({args:["commit",...e?["--amend"]:[],...t?["-m",t]:[],...n?["--no-edit"]:[],...r?["-e"]:[],...o?["-p"]:[],...s?["-n"]:[],...i?["-q"]:[],...a?Array(a).fill("-v"):[]],spawnOptions:{stdio:"inherit"},onError:"throw",resource:"commit"})}))},t.revert=function(e){return n(this,arguments,void 0,(function*({runner:e,sha:t,edit:n,quiet:r}){yield e.runGitCommand({args:["revert",t,...r?["-q"]:[],...n?[]:["--no-edit"]],spawnOptions:{stdio:"inherit"},onError:"throw",resource:"revert"})}))}},23047:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitParents=t.getCommitDate=t.getCommitAuthor=void 0;const o=n(34875);t.getCommitAuthor=function({ref:e,runner:t}){return(0,o.runGitLog)({runner:t,args:["--format=%an","-n","1",e,"--"],onError:"throw",resource:"commitInfoAuthor"})},t.getCommitDate=function(e){return r(this,arguments,void 0,(function*({ref:e,runner:t}){const n=yield(0,o.runGitLog)({runner:t,args:["--format=%cd","-n","1",e,"--"],onError:"throw",resource:"commitInfoDate"});return new Date(n)}))},t.getCommitParents=function(e){return r(this,arguments,void 0,(function*({ref:e,runner:t}){const n=yield t.runGitCommand({args:["rev-parse",`${e}^@`],onError:"ignore",resource:"commitInfoAuthor"});return n?n.split("\n"):[]}))}},92874:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseMetadataForCommit=t.getBranchesInCommitRange=t.getFormattedCommitOrRange=t.getNumberOfCommitsInRange=void 0;const i=o(n(86776)),a=n(90173),s=n(34875);t.getNumberOfCommitsInRange=function(e){return r(this,arguments,void 0,(function*({runner:e,base:t,head:n}){return Number(yield e.runGitCommand({args:["rev-list","--count",`${t}..${n}`,"--"],onError:"throw",resource:"getNumberOfCommitsInRange"}))}))};const c={READABLE:"%h - %s",SUBJECT:"%s",MESSAGE:"%B%n",REBASE_METADATA:"%aN%n%aE%n%aI%n%B",AUTHOR_METADATA:"%aN%n%aE%n%aI",COMMITTER_DATE_RELATIVE:"%cr",SHA:"%H",AUTHOR_NAME:"%aN",COMMITTER_DATE:"%cI"};function u(e){return r(this,arguments,void 0,(function*({runner:e,base:t,head:n,format:r}){if(!t)return[yield e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${c[r]}`,n,"--"],onError:"throw",resource:"getCommitRangeFormatted"})];const o=yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=format:%H",`${t}..${n}`,"--"],onError:"throw",resource:"getCommitRangeHashes"}),a=[];for(const t of i.default.chunk(o,125)){const n=yield Promise.all(t.map((t=>"SHA"===r?t:(0,s.runGitLog)({runner:e,args:["-1",`--pretty=format:${c[r]}`,t,"--"],onError:"throw",resource:"getCommitRangeFormatted"}))));a.push(...n)}return a}))}t.getFormattedCommitOrRange=u,t.getBranchesInCommitRange=function(e){return r(this,arguments,void 0,(function*({runner:e,base:t,head:n}){const r=yield(0,s.runGitLog)({runner:e,args:["--pretty=%D",`${t}..${n}`,"--"],onError:"throw",resource:"getBranchesInCommitRange"});return(0,a.splitLines)(r).flatMap((e=>e.split(", "))).map((e=>e.replace("HEAD -> ",""))).filter(Boolean)}))},t.getRebaseMetadataForCommit=function(e){return r(this,arguments,void 0,(function*({runner:e,sha:t}){return u({runner:e,base:void 0,head:t,format:"REBASE_METADATA"}).then((([e])=>e.split("\n"))).then((([e,t,n,...r])=>({authorName:e,authorEmail:t,authorDate:n,message:r.join("\n")})))}))}},55627:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.commitTree=void 0,t.commitTree=function(e){return n(this,arguments,void 0,(function*({tree:e,parent:t,message:n,gpgSign:r,env:o,cwd:i,onError:a,resource:s,runner:c}){return c.runGitCommand({args:["commit-tree",e,...t?["-p",t]:[],"-m",n,...r?["-S"]:[]],spawnOptions:{env:o},options:{cwd:i},onError:null!=a?a:"throw",resource:s})}))}},16631:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isGpgSigningEnabled=t.composeGitConfig=void 0,t.composeGitConfig=e=>{const t=new Map;return r=>n(void 0,void 0,void 0,(function*(){const o=t.get(r);if(void 0!==o)return o;const i=yield function(e){return n(this,arguments,void 0,(function*({runner:e,key:t}){return(yield e.runGitCommand({args:["config","--get",t],onError:"ignore",resource:"inferRepoGitHubInfo"}))||null}))}({runner:e,key:r});return t.set(r,i),i}))},t.isGpgSigningEnabled=function(e){return n(this,arguments,void 0,(function*({gitConfig:e}){const t=yield e("commit.gpgSign");return Boolean(t&&"false"!==t&&"0"!==t)}))}},82198:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getDiffOfStagedChanges=t.getDiff=t.isDiffEmpty=t.showDiff=t.getUnstagedChanges=void 0,t.getUnstagedChanges=function(e){return n(this,arguments,void 0,(function*({runner:e}){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff","--stat"],onError:"throw",resource:"getUnstagedChanges"})}))},t.showDiff=function({runner:e,left:t,right:n,stat:r,shortStat:o,summary:i}){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff",t,n,...r?["--stat"]:[],...o?["--shortstat"]:[],...i?["--summary"]:[],"--"],onError:"throw",resource:"showDiff"})},t.isDiffEmpty=function(e){return n(this,arguments,void 0,(function*({runner:e,left:t,right:n}){return 0===(yield e.runGitCommand({args:["--no-pager","diff","--no-ext-diff","--shortstat",t,n,"--"],onError:"throw",resource:"isDiffEmpty"})).length}))};const r=["--no-pager","-c","diff.renames=true","diff","--no-ext-diff","--no-prefix","--unified"];t.getDiff=function({runner:e,left:t,right:n}){return e.runGitCommand({args:[...r,t,...n?[n]:[],"--"],onError:"throw",resource:"getDiff",options:{noTrim:!0}})},t.getDiffOfStagedChanges=function({runner:e}){return e.runGitCommand({args:[...r,"--cached","--"],onError:"throw",resource:"getDiffOfStagedChanges",options:{noTrim:!0}})}},75132:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readFetchHead=t.fetchBranches=void 0;const o=n(22036),i=n(89956),a=e=>`refs/gt-fetch-head/${e}`;t.fetchBranches=function(e){return r(this,arguments,void 0,(function*({remote:e,branchNames:t,onProgressUpdate:n,runner:r}){if(0===t.length)return;const{updateProgressOnStdError:i}=(0,o.composeGitProgressTracker)({progressOutput:["Counting objects","Compressing objects","Receiving objects","Resolving deltas"],onProgressUpdate:n});yield r.runGitCommand({args:["fetch","--no-write-fetch-head","--progress","--no-tags","-f",e,...t.map((e=>`refs/heads/${e}:${a(e)}`))],spawnOptions:{stdio:"pipe"},onError:"throw",onStdError:i,resource:"fetchBranch"})}))},t.readFetchHead=function(e){return r(this,arguments,void 0,(function*({runner:e,branchName:t}){return(0,i.getShaOrThrow)({runner:e,ref:a(t)})}))}},1712:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFileContents=void 0,t.getFileContents=function(e){return n(this,arguments,void 0,(function*({runner:e,ref:t,file:n}){return e.runGitCommand({args:["show",`${t}:${n}`],onError:"throw",resource:"fileContents"})}))}},84577:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){switch(e){case"A":return"added";case"C":return"copied";case"D":return"deleted";case"M":default:return"modified";case"R":return"renamed"}}Object.defineProperty(t,"__esModule",{value:!0}),t.getFilesChanged=void 0,t.getFilesChanged=function(e){return n(this,arguments,void 0,(function*({runner:e,from:t,to:n}){const o=[],i=(yield e.runGitCommand({args:["diff","-z","--name-status",t,n],onError:"ignore",resource:"getFilesChanged"})).split("\0");for(let e=0;e<i.length-1;e){const t=r(i[e][0]);if("copied"===t||"renamed"===t){const n=i[e+1],r=i[e+2];o.push({path:r,status:t,from:n}),e+=3}else{const n=i[e+1];o.push({path:n,status:t,from:void 0}),e+=2}}return o}))}},34734:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.findRemoteHeadBranch=void 0,t.findRemoteHeadBranch=function(e){return n(this,arguments,void 0,(function*({runner:e,remote:t}){const n=yield e.runGitCommand({args:["rev-parse","--abbrev-ref",`refs/remotes/${t}/HEAD`],onError:"ignore",resource:"findRemoteHeadBranch"});if(!n)return null;const r=`${t}/`;return n.startsWith(r)?n.slice(r.length):null}))}},12054:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getHookExecutablePath=void 0;const i=o(n(57372)),a=o(n(16928));t.getHookExecutablePath=function(e){return r(this,arguments,void 0,(function*({hook:e,gitConfig:t,repoRoot:n,gitCommonDir:r}){const o=yield t("core.hooksPath"),s=o?a.default.join(n,o):a.default.join(r,"hooks"),c=a.default.join(s,e);return i.default.pathExistsSync(c)?c:null}))}},89956:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGetRemoteSha=t.getSha=t.getShaOrThrow=void 0,t.getShaOrThrow=function(e){return n(this,arguments,void 0,(function*({ref:e,runner:t}){return t.runGitCommand({args:["rev-parse",e],onError:"throw",resource:"getShaOrThrow"})}))},t.getSha=function(e){return n(this,arguments,void 0,(function*({ref:e,runner:t}){return t.runGitCommand({args:["rev-parse",e],onError:"ignore",resource:"getSha"})}))},t.composeGetRemoteSha=function(e){let t;return{populateRemoteShas:r=>n(this,void 0,void 0,(function*(){t=yield function(e){return n(this,arguments,void 0,(function*({remote:e,runner:t}){const n={};return(yield t.runGitCommandAndSplitLines({args:["ls-remote","--heads",e],onError:"ignore",resource:"fetchRemoteShas"})).map((e=>e.split(/\s+/))).filter((e=>2===e.length&&e.every((e=>e.length>0))&&e[1].startsWith("refs/heads/"))).forEach((([e,t])=>n[t.slice(11)]=e)),n}))}({remote:r,runner:e})})),getRemoteSha:e=>null==t?void 0:t[e]}}},92780:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runGitCommandPassthrough=void 0,t.runGitCommandPassthrough=function({command:e,args:t,runner:n}){return n.runGitCommand({args:[e,...t],onError:"throw",spawnOptions:{stdio:"inherit"},resource:`runGitCommandPassthrough_${e}`})}},55926:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getGitVersion=void 0,t.getGitVersion=function(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield e.runGitCommand({args:["--version"],onError:"throw",resource:"getGitVersion"})).split(" ")[2]}))}},97690:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.writeTreeFromIndexFile=t.applyPatchToIndexFile=t.readTreeIntoIndexFile=void 0,t.readTreeIntoIndexFile=function(e){return n(this,arguments,void 0,(function*({treeish:e,indexFile:t,runner:n,repoRoot:r}){yield n.runGitCommand({args:["read-tree","--index-output",t,e],onError:"throw",resource:"readTreeIntoIndexFile",options:{cwd:r}})}))},t.applyPatchToIndexFile=function(e){return n(this,arguments,void 0,(function*({patch:e,runner:t,indexFile:n,repoRoot:r}){yield t.runGitCommand({args:["apply","--verbose","--cached","-p0","--unidiff-zero","-"],input:e,spawnOptions:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:n})},onError:"throw",resource:"applyPatchToIndexFile",options:{cwd:r}})}))},t.writeTreeFromIndexFile=function(e){return n(this,arguments,void 0,(function*({indexFile:e,runner:t,repoRoot:n}){return t.runGitCommand({args:["write-tree"],spawnOptions:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:e})},onError:"throw",resource:"writeTreeFromIndexFile",options:{cwd:n}})}))}},8328:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isMerged=void 0;const o=n(92874),i=n(55627),a=n(89956),s=n(68937);t.isMerged=function(e){return r(this,arguments,void 0,(function*({branchName:e,trunkName:t,runner:n}){const c=(0,s.getMergeBase)({runner:n,left:e,right:t}),u=(yield(0,o.getFormattedCommitOrRange)({base:t,head:e,format:"SHA",runner:n})).reverse();return(yield u.reduce(((e,o)=>r(this,void 0,void 0,(function*(){const r=yield e,a=yield(0,i.commitTree)({tree:`${o}^{tree}`,parent:r,message:"_",onError:"ignore",resource:"mergeBaseCommitTree",runner:n});return(yield n.runGitCommand({args:["cherry",t,a,r],onError:"ignore",resource:"isMerged"})).startsWith("-")?o:r}))),Promise.resolve(c)))===(yield(0,a.getSha)({runner:n,ref:e}))}))}},34875:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.runGitLog=t.logLong=void 0,t.logLong=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["log","--graph","--abbrev-commit","--decorate","--format=format:%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)","--branches"],spawnOptions:{stdio:"inherit"},onError:"throw",resource:"logLong"})}))},t.runGitLog=function(e){return n(this,arguments,void 0,(function*({runner:e,args:t,onError:n,resource:r}){return e.runGitCommand({args:["-c","log.showSignature=false","--no-pager","log",...t],onError:n,resource:r})}))}},68937:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isAncestor=t.getMergeBase=void 0;const o=n(90173);t.getMergeBase=function({runner:e,left:t,right:n}){return e.runGitCommand({args:["merge-base",t,n],onError:"throw",resource:"getMergeBase"})},t.isAncestor=function(e){return r(this,arguments,void 0,(function*({runner:e,left:t,right:n}){try{return yield e.runGitCommand({args:["merge-base","--is-ancestor",t,n],onError:"throw",resource:"getMergeBase"}),!0}catch(e){if(e instanceof o.CommandFailedError&&1===e.exitCode)return!1;throw e}}))}},90822:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseHead=void 0;const i=o(n(57372)),a=o(n(16928));t.getRebaseHead=function(e){return r(this,arguments,void 0,(function*({gitDir:e}){const t=a.default.join(`${e}`,"rebase-merge","head-name");if(yield i.default.pathExists(t))return(yield i.default.readFile(t,{encoding:"utf-8"})).trim().slice(11)}))}},39036:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.mergeTree=void 0;const o=n(90173);t.mergeTree=function(e){return r(this,arguments,void 0,(function*({rev1:e,rev2:t,allowUnrelatedHistories:n,resource:r,runner:i}){return i.runGitCommand({args:["merge-tree",...n?["--allow-unrelated-histories"]:[],e,t],onError:"throw",resource:r}).catch((e=>{if(e instanceof o.CommandFailedError&&1===e.exitCode)return null;throw e}))}))}},10629:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.packAllRefs=void 0,t.packAllRefs=function(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["pack-refs","--all"],onError:"throw",resource:"packAllRefs"})}))}},76429:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,arguments,void 0,(function*({ref:e,runner:t}){return t.runGitCommand({args:["cat-file","-p",e],onError:"throw",resource:"readRef"})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.getShaForEachRefWithPrefix=t.deleteRef=t.readRef=t.doesObjectExist=t.updateRef=t.createNewObject=void 0,t.createNewObject=function({content:e,runner:t}){return t.runGitCommand({args:["hash-object","-w","--stdin"],input:e,onError:"throw",resource:"createNewObject"})},t.updateRef=function(e){return n(this,arguments,void 0,(function*({ref:e,sha:t,runner:n}){yield n.runGitCommand({args:["update-ref",e,t],spawnOptions:{stdio:"pipe"},onError:"throw",resource:"updateRef"})}))},t.doesObjectExist=function(e){return n(this,arguments,void 0,(function*({ref:e,runner:t}){try{return yield r({ref:e,runner:t}),!0}catch(e){return!1}}))},t.readRef=r,t.deleteRef=function(e){return n(this,arguments,void 0,(function*({ref:e,runner:t}){yield t.runGitCommand({args:["update-ref","-d",e],onError:"throw",resource:"deleteRef"})}))},t.getShaForEachRefWithPrefix=function(e){return n(this,arguments,void 0,(function*({runner:e,prefix:t}){const n={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname):%(objectname)",t],onError:"throw",resource:"getShaForEachRefWithPrefix"})).map((e=>e.split(":"))).filter((e=>2===e.length)).forEach((([e,r])=>n[e.substring(t.length)]=r)),n}))}},32209:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fastForwardBranchToRemoteTracking=t.fetchRemoteTrackingBranch=void 0;const o=n(90173);t.fetchRemoteTrackingBranch=function(e){return r(this,arguments,void 0,(function*({runner:e,remote:t,branchName:n}){yield e.runGitCommand({args:["fetch",t,n],onError:"throw",resource:"fetchRemoteTrackingBranch"})}))},t.fastForwardBranchToRemoteTracking=function(e){return r(this,arguments,void 0,(function*({runner:e,remote:t,branchName:n}){try{return yield e.runGitCommand({args:["merge","--ff-only",`${t}/${n}`],onError:"throw",resource:"fastForwardBranchToRemoteTracking"}),"OK"}catch(e){if(e instanceof o.CommandFailedError&&e.message.includes("fatal: Not possible to fast-forward, aborting."))return"CONFLICT";throw e}}))}},38840:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pushBranches=void 0;const o=n(35317),i=n(22036),a=n(12054),s=n(64829);t.pushBranches=function(e){return r(this,arguments,void 0,(function*({remote:e,branches:t,noVerify:n,forcePush:c,atomic:u,runner:l,gitConfig:d,gitCommonDir:f,repoRoot:h,onProgressUpdate:p}){const{updateProgressOnStdError:m}=(0,i.composeGitProgressTracker)({progressOutput:["Counting objects","Compressing objects","Writing objects","Resolving deltas"],onProgressUpdate:p}),g="win32"===process.platform;n||g||(yield function(e){return r(this,arguments,void 0,(function*({branches:e,gitConfig:t,remote:n,repoRoot:r,gitCommonDir:i,runner:c}){const u=yield(0,a.getHookExecutablePath)({hook:"pre-push",gitConfig:t,repoRoot:r,gitCommonDir:i});if(!u)return;const l=yield(0,s.getRemoteUrl)({runner:c,remote:n}),d=e.map((e=>{const t=`refs/heads/${e.name}`;return`${t} ${e.localSha} ${t} ${e.remoteSha||"0000000000000000000000000000000000000000"}\n`})).join("");try{(0,o.execSync)(`"${u}" ${n} ${l}`,{stdio:["pipe","inherit","inherit"],input:d,encoding:"utf-8",cwd:r})}catch(t){throw new Error(`pre-push git hook failed while pushing branches ${e.map((e=>e.name)).join(", ")}: ${t instanceof Error?t.message:JSON.stringify(t)}`)}}))}({runner:l,remote:e,gitConfig:d,gitCommonDir:f,repoRoot:h,branches:t}));const v=c?"--force":"--force-with-lease";yield l.runGitCommand({args:["push","-u",e,v,"--progress",...t.map((e=>e.name)),...n?["--no-verify"]:g?[]:["--no-verify"],...u?["--atomic"]:[]],onError:"throw",resource:"pushBranch",onStdError:m})}))}},63352:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.commitRangesAreEquivalent=void 0;const o=n(13234);function i(e){for(const t of e){const e=t.trim().split(/\s+/);if(e.length<3)return!1;if("="!==e[2])return!1}return!0}t.commitRangesAreEquivalent=function(e){return r(this,arguments,void 0,(function*({commitRange1:e,commitRange2:t,remote:n,runner:a}){if((0,o.isCommitRangeEmpty)(e)||(0,o.isCommitRangeEmpty)(t))return(0,o.isCommitRangeEmpty)(e)&&(0,o.isCommitRangeEmpty)(t);const s=(yield Promise.all([e.base,e.head,t.base,t.head].map((e=>r(this,void 0,void 0,(function*(){try{return yield a.runGitCommand({args:["show","--no-patch",e,"--"],onError:"throw",resource:"rangeDiffShow"}),{sha:e,toFetch:!1}}catch(t){return{sha:e,toFetch:!0}}})))))).filter((({toFetch:e})=>e)).map((({sha:e})=>e));s.length>0&&(yield a.runGitCommand({args:["fetch","--no-write-fetch-head",n,...s],onError:"throw",resource:"rangeDiffFetch"}));const c=(0,o.formatCommitRange)(e),u=(0,o.formatCommitRange)(t);let l=!0,d="";return yield a.runGitCommandAndSplitLines({args:["range-diff",c,u],onError:"throw",resource:"rangeDiff",onStdOut:e=>{d+=e;const t=d.split("\n");d=t.pop()||"",i(t)||(l=!1)}}),d&&!i(d.split("\n"))&&(l=!1),l}))}},76425:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInteractive=t.rebaseAbort=t.rebaseContinue=t.rebase=void 0;const o=n(90173),i=n(91833);function a(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["rebase","--abort"],spawnOptions:{stdio:"pipe"},onError:"throw",resource:"rebaseAbort"})}))}function s(e){return r(this,arguments,void 0,(function*({args:e,options:t,resource:n,runner:r,gitDir:c}){try{yield r.runGitCommand({args:["rebase",...e],spawnOptions:Object.assign({stdio:"pipe"},t),onError:"throw",resource:n})}catch(u){if(u instanceof o.CommandFailedError&&u.message.includes("It seems that there is already a rebase-merge directory")){try{yield a({runner:r})}catch(e){throw u}return s({runner:r,args:e,options:t,resource:n,gitDir:c})}if(yield(0,i.rebaseInProgress)({gitDir:c}))return"REBASE_CONFLICT";throw u}return"REBASE_DONE"}))}t.rebase=function(e){return r(this,arguments,void 0,(function*({onto:e,from:t,branchName:n,restackCommitterDateIsAuthorDate:r,runner:o,gitDir:i}){return s({runner:o,args:[...r?["--committer-date-is-author-date"]:[],"--onto",e,t,n],resource:"rebase",gitDir:i})}))},t.rebaseContinue=function(e){return r(this,arguments,void 0,(function*({runner:e,gitDir:t,options:{runWithStdio:n}={runWithStdio:!1}}){return s({runner:e,args:["--continue"],options:{env:Object.assign(Object.assign({},process.env),{GIT_EDITOR:"true"}),stdio:n?"inherit":"pipe"},resource:"rebaseContinue",gitDir:t})}))},t.rebaseAbort=a,t.rebaseInteractive=function(e){return r(this,arguments,void 0,(function*({runner:e,parentBranchRevision:t,branchName:n,gitDir:r}){return s({runner:e,args:["-i",t,n],resource:"rebaseInteractive",options:{stdio:"inherit"},gitDir:r})}))}},91833:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInProgress=void 0;const i=o(n(57372)),a=o(n(16928));t.rebaseInProgress=function(e){return r(this,arguments,void 0,(function*({gitDir:e}){return i.default.pathExists(a.default.join(e,"rebase-merge"))}))}},49165:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCleanlyReconciledSquashedHead=void 0;const o=n(92874),i=n(55627),a=n(16631),s=n(39036);function c(e){return r(this,arguments,void 0,(function*({onto:e,from:t,head:n,runner:r}){const o=yield(0,i.commitTree)({tree:`${e}^{tree}`,parent:t,message:"_",resource:"getRebasedTreeOntoCommitTree",runner:r});return(0,s.mergeTree)({rev1:o,rev2:n,resource:"getRebasedTreeMergeTree",runner:r})}))}t.getCleanlyReconciledSquashedHead=function(e){return r(this,arguments,void 0,(function*({oldBase:e,oldHead:t,newBase:n,newHead:r,updatedBase:u,updatedHead:l,restackCommitterDateIsAuthorDate:d,runner:f,gitConfig:h}){const p=yield(0,a.isGpgSigningEnabled)({gitConfig:h}),m=yield c({runner:f,onto:n,from:e,head:t});if(null===m)return null;const g=yield c({runner:f,onto:n,from:u,head:l});if(null===g)return null;const v=yield(0,i.commitTree)({tree:m,parent:n,message:"_",resource:"getCleanlyReconciledSquashedHeadOldTreeCommit",runner:f}),b=yield(0,i.commitTree)({tree:g,parent:v,message:"_",resource:"getCleanlyReconciledSquashedHeadUpdatedTreeCommit",runner:f}),y=yield(0,i.commitTree)({tree:`${r}^{tree}`,parent:v,message:"_",resource:"getCleanlyReconciledSquashedHeadNewHeadCommit",runner:f}),_=yield(0,s.mergeTree)({rev1:y,rev2:b,resource:"getCleanlyReconciledSquashedHeadMergeTree",runner:f});if(null===_)return null;const E=(yield(0,o.getFormattedCommitOrRange)({format:"SHA",runner:f,head:r,base:n})).at(-1);if(!E)return null;const{authorName:C,authorEmail:R,authorDate:w,message:P}=yield(0,o.getRebaseMetadataForCommit)({runner:f,sha:E});return(0,i.commitTree)({tree:_,parent:n,message:P,gpgSign:p,env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:C,GIT_AUTHOR_EMAIL:R,GIT_AUTHOR_DATE:w}),d&&{GIT_COMMITTER_DATE:w}),resource:"getCleanlyReconciledSquashedHeadCommitTree",runner:f})}))}},64829:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRemoteUrl=void 0,t.getRemoteUrl=function(e){return n(this,arguments,void 0,(function*({runner:e,remote:t}){return e.runGitCommand({args:["remote","get-url",t,"--push"],onError:"throw",resource:"getRemoteUrl"})}))}},89394:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRepoPaths=void 0,t.getRepoPaths=function(e){return n(this,arguments,void 0,(function*({runner:e}){try{const[t,n,r]=yield e.runGitCommandAndSplitLines({args:["rev-parse","--path-format=absolute","--show-toplevel","--git-common-dir","--git-dir"],onError:"throw",resource:"getRepoPaths"});return{repoRoot:t,gitCommonDir:n,gitDir:r}}catch(e){return}}))}},79165:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.trackedReset=t.keepReset=t.mixedReset=t.softReset=void 0,t.softReset=function(e){return n(this,arguments,void 0,(function*({sha:e,runner:t}){yield t.runGitCommand({args:["reset","-q","--soft",e,"--"],onError:"throw",resource:"softReset"})}))},t.mixedReset=function(e){return n(this,arguments,void 0,(function*({sha:e,cwd:t,runner:n}){yield n.runGitCommand({args:["reset","-q","--mixed",...e?[e,"--"]:[]],onError:"throw",resource:"mixedReset",options:{cwd:t}})}))},t.keepReset=function(e){return n(this,arguments,void 0,(function*({sha:e,runner:t,cwd:n}){yield t.runGitCommand({args:["reset","-q","--keep",e,"--"],onError:"throw",resource:"keepReset",options:{cwd:n}})}))},t.trackedReset=function(e){return n(this,arguments,void 0,(function*({sha:e,runner:t}){yield t.runGitCommand({args:["reset","-Nq",e,"--"],onError:"throw",resource:"trackedReset"})}))}},74827:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.restore=void 0,t.restore=function(e){return n(this,arguments,void 0,(function*({pathSpec:e,source:t,staged:n,runner:r}){return r.runGitCommand({args:["restore",...t?[`--source=${t}`]:[],...n?["--staged"]:[],"-q","--",...e],onError:"throw",resource:"restore"})}))}},50412:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteRemoteTracking=t.setRemoteTracking=void 0,t.setRemoteTracking=function(e){return n(this,arguments,void 0,(function*({remote:e,branchName:t,sha:n,runner:r}){yield r.runGitCommand({args:["update-ref",`refs/remotes/${e}/${t}`,n],onError:"throw",resource:"setRemoteTracking"}),yield r.runGitCommand({args:["branch","-u",`${e}/${t}`,t],onError:"ignore",resource:"setRemoteTrackingUpstream"})}))},t.deleteRemoteTracking=function(e){return n(this,arguments,void 0,(function*({remote:e,branchName:t,runner:n}){yield n.runGitCommand({args:["update-ref","-d",`refs/remotes/${e}/${t}`],onError:"throw",resource:"deleteRemoteTracking"})}))}},13017:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.showCommits=void 0,t.showCommits=function(e){return n(this,arguments,void 0,(function*({base:e,head:t,patch:n,runner:r}){return r.runGitCommand({args:["-c","color.ui=always","--no-pager","log",..."patch"===n?["-p"]:"stat"===n?["--stat"]:[],`${e}..${t}`,"--"],onError:"throw",resource:"showCommits"})}))}},50796:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchNamesAndRevisions=void 0,t.getBranchNamesAndRevisions=function(e){return n(this,arguments,void 0,(function*({runner:e}){const t={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname:short):%(objectname)","--sort=-committerdate","refs/heads/"],onError:"throw",resource:"getBranchNamesAndRevisions"})).map((e=>e.split(":"))).filter((e=>2===e.length&&e.every((e=>e.length>0)))).forEach((([e,n])=>t[e]=n)),t}))}},52704:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createStashCommit=void 0;const o=n(23047);t.createStashCommit=function(e){return r(this,arguments,void 0,(function*({runner:e,cwd:t}){const n=yield e.runGitCommand({args:["stash","create"],onError:"ignore",resource:"stashCreate",options:{cwd:t}});if(!n)return null;const r=yield(0,o.getCommitParents)({ref:n,runner:e});return 2!==r.length?null:{headRef:r[0],indexRef:r[1],workingTreeRef:n}}))}},51431:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,arguments,void 0,(function*({runner:e,cwd:t}){const n=yield e.runGitCommand({args:["--no-optional-locks","status","-z"],onError:"throw",resource:"getRawStatus",options:{noTrim:!0,cwd:t}}),r=n.split("\0"),o=[];for(let e=0;e<r.length-1;e++){const t=r[e],a=t[0],s=t[1];if(!i(a)||!i(s))throw new Error("Invalid status output:\n"+n);const c=t.slice(3),u=["R","C"].includes(a)||["R","C"].includes(s)?r[++e]:void 0;o.push({path:c,from:u,indexStatus:a,workingTreeStatus:s})}return o}))}Object.defineProperty(t,"__esModule",{value:!0}),t.getStatus=t.getUnmergedFiles=t.detectUntrackedChanges=t.trackedUnstagedChanges=t.detectStagedChanges=t.refreshIndex=void 0,t.refreshIndex=function(e){return n(this,arguments,void 0,(function*({runner:e,cwd:t}){yield e.runGitCommand({args:["status"],onError:"ignore",resource:"refreshIndex",options:{cwd:t}})}))},t.detectStagedChanges=function(e){return n(this,arguments,void 0,(function*({runner:e,cwd:t}){return(yield r({runner:e,cwd:t})).some((({indexStatus:e,workingTreeStatus:t})=>["M","T","C","R"].includes(e)||["A","D"].includes(e)&&e!==t))}))},t.trackedUnstagedChanges=function(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"U"===e||["U","M","T","A","D","C","R"].includes(t)))}))},t.detectUntrackedChanges=function(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"?"===e||"?"===t))}))},t.getUnmergedFiles=function(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield r({runner:e})).filter((({indexStatus:e,workingTreeStatus:t})=>"U"===e||"U"===t||"A"===e&&"A"===t||"D"===e&&"D"===t)).map((({path:e})=>e))}))},t.getStatus=function(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield r({runner:e})).map((({indexStatus:e,workingTreeStatus:t,path:n,from:r})=>Object.assign(Object.assign({},function(e,t){if("A"===e&&"A"===t||"D"===e&&"D"===t||"U"===e||"U"===t)return{status:"unresolved",staged:"none"};if("?"===t)return{status:"added",staged:"none"};if(" "===e){if("M"===t||"T"===t)return{status:"modified",staged:"none"};if("D"===t)return{status:"deleted",staged:"none"};if("C"===t)return{status:"copied",staged:"none"};if("R"===t)return{status:"renamed",staged:"none"};if("A"===t)return{status:"added",staged:"none"}}return"M"===e||"T"===e?{status:"modified",staged:" "===t?"full":"partial"}:"A"===e?{status:"added",staged:" "===t?"full":"partial"}:"D"===e?{status:"deleted",staged:" "===t?"full":"partial"}:"C"===e?{status:"copied",staged:" "===t?"full":"partial"}:"R"===e?{status:"renamed",staged:" "===t?"full":"partial"}:{status:"modified",staged:"none"}}(e,t)),{path:n,from:r})))}))};const o=["M","T","A","D","C","R","U"," ","?","!"];function i(e){return o.includes(e)}},5918:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,arguments,void 0,(function*({runner:e}){return(yield e.runGitCommandAndSplitLines({args:["-c","color.ui=false","status","-s"],onError:"throw",resource:"findUntrackedFiles"})).filter((e=>e.startsWith("??"))).map((e=>e.substring(3)))}))}function o(e){return n(this,arguments,void 0,(function*({runner:e,filePaths:t}){yield e.runGitCommandAndSplitLines({args:["add","--intent-to-add",...t],onError:"throw",resource:"trackFiles"})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.trackAllNewFiles=t.trackFiles=t.findUntrackedFiles=void 0,t.findUntrackedFiles=r,t.trackFiles=o,t.trackAllNewFiles=function(e){return n(this,arguments,void 0,(function*({runner:e}){const t=yield r({runner:e});yield o({runner:e,filePaths:t})}))}},4485:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){return["start",...e.map((e=>`update ${e.ref} ${e.sha}`)),"commit"].join("\n")+"\n"}Object.defineProperty(t,"__esModule",{value:!0}),t.calculateRefUpdateTransactionForTest=t.updateRefs=void 0,t.updateRefs=function(e){return n(this,arguments,void 0,(function*({refs:e,runner:t}){yield t.runGitCommand({args:["update-ref","--stdin"],onError:"throw",resource:"updateRefs",input:r(e)})}))},t.calculateRefUpdateTransactionForTest=r},60308:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.listWorktrees=void 0,t.listWorktrees=function(e){return n(this,arguments,void 0,(function*({runner:e}){var t,n;const i=[],a=(yield e.runGitCommand({args:["worktree","list","--porcelain","-z"],onError:"throw",resource:"updateRefs"})).split("\0\0");for(const e of a){const a=e.split("\0"),s=r({pathToken:a[0]}),c=null===(t=a[1])||void 0===t?void 0:t.split(" ")[1];if(!s||!c)continue;const u=a[2]?o(a[2]):null;i.push({path:s,ref:c,branch:null!==(n=null==u?void 0:u.branchName)&&void 0!==n?n:null})}return i}))};const r=({pathToken:e})=>{if(!e)return;const t=e.indexOf(" ");return-1!==t?e.slice(t+1):void 0},o=e=>{const t=e.split(" ");return 0===t.length?null:"detached"===t[0]?{state:"detached"}:t[1]?{state:"valid",branchName:t[1].replace("refs/heads/","")}:null}},11566:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.commuteHunkBefore=t.getNetChangeInHunk=t.translateNewLinesInHunk=t.translateHunk=t.getBoundsOfHunk=void 0;const r=n(85855);function o(e){const{oldStart:t,newStart:n}=e,r=e.lines.filter((({type:e})=>"remove"===e)),o=e.lines.filter((({type:e})=>"add"===e));return{oldStart:t,oldEnd:r.length?t+r.length-1:void 0,newStart:n,newEnd:o.length?n+o.length-1:void 0}}function i(e,t){return Object.assign(Object.assign({},e),{oldStart:e.oldStart+t,newStart:e.newStart+t})}function a(e){return e.lines.reduce(((e,t)=>{switch(t.type){case"remove":return e-1;case"add":return e+1;default:(0,r.assertUnreachable)(t)}}),0)}t.getBoundsOfHunk=o,t.translateHunk=i,t.translateNewLinesInHunk=function(e,t){return Object.assign(Object.assign({},e),{newStart:e.newStart+t})},t.getNetChangeInHunk=a,t.commuteHunkBefore=function({originalBeforeHunk:e,originalAfterHunk:t}){const{newStart:n,newEnd:r}=o(e),{oldStart:s,oldEnd:c}=o(t);return(null!=c?c:s)<n||void 0===r&&void 0!==c&&c===n?t:(null!=r?r:n)<s||void 0!==r&&void 0===c&&r===s?i(t,-1*a(e)):void 0}},73769:(e,t)=>{function n({hunk:e}){const t=e.lines.filter((e=>"remove"===e.type)),n=e.lines.filter((e=>"add"===e.type));return[`@@ -${e.oldStart},${t.length} +${e.newStart},${n.length} @@`,...t.map((e=>`-${e.text}`)),...e.oldNoNewlineAtEndOfFile?["\"]:[],...n.map((e=>`+${e.text}`)),...e.newNoNewlineAtEndOfFile?["\"]:[]].join("\n")}Object.defineProperty(t,"__esModule",{value:!0}),t.computePatchFromHunk=t.computePatchFromHunks=void 0,t.computePatchFromHunks=function({path:e,hunks:t}){return 0===t.length?null:[`diff --git ${e} ${e}`,`--- ${e}`,`+++ ${e}`,...t.sort(((e,t)=>e.oldStart-t.oldStart)).map((e=>n({hunk:e})))].join("\n")},t.computePatchFromHunk=n},90260:(e,t)=>{function n(e){const[t,...n]=e.split("\n@@");if(!t)throw new Error("empty diff file");const o=t.split("\n"),i=o[0];if(!i)throw new Error("empty diff file prefix");let[a,s]=i.split(" ");if(!a||!s)throw new Error("invalid diff file prefix line "+i);for(const e of o.slice(1))if(e.startsWith("new file"))a="/dev/null";else if(e.startsWith("deleted file"))s="/dev/null";else if(!(e.startsWith("---")||e.startsWith("+++")||e.startsWith("new mode")||e.startsWith("old mode")||e.startsWith("index")||e.startsWith("rename")||e.startsWith("similarity")||e.startsWith("dissimilarity")||e.startsWith("Binary")||""===e))throw new Error("invalid diff file prefix line "+e);return{oldFilename:a,newFilename:s,hunks:n.map((e=>{try{return r(e)}catch(t){throw new Error(`Error parsing hunk for file ${a} ${s}:\n${"object"==typeof t&&t&&"message"in t&&t.message}\n${e}`)}}))}}function r(e){const[t,...n]=e.split("\n");if(!t)throw new Error("empty hunk");const[r]=t.split("@@");if(!r)throw new Error("invalid hunk header "+t);const[o,i]=r.trim().split(" ");if(!o||!i)throw new Error("invalid hunk header "+t);const[a,s]=o.slice(1).split(","),[c,u]=i.slice(1).split(",");if(!a||!c)throw new Error("invalid hunk header "+t);let l,d=+a,f=+c,h=!1,p=!1;const m=[];for(const e of n){if(0===e.length)continue;const t=e[0],n=e.slice(1);switch(t){case"-":d++,m.push({type:"remove",text:n});break;case"+":f++,m.push({type:"add",text:n});break;case" ":d++,f++,m.push({type:"context",text:n});break;case"\\":if(!l||" No newline at end of file"!==n)throw new Error("invalid hunk line "+e);switch(l){case"-":h=!0;break;case"+":p=!0;break;case" ":h=!0,p=!0;break;default:throw new Error("invalid hunk line "+e)}break;default:throw new Error("invalid hunk line "+e)}l=t}const g=+a+(s?+s:1);if(d!==g)throw new Error("invalid hunk old line count "+d+" should be "+g);const v=+c+(u?+u:1);if(f!==v)throw new Error("invalid hunk new line count "+f+" should be "+v);return{oldNoNewlineAtEndOfFile:h,newNoNewlineAtEndOfFile:p,oldStart:+a,newStart:+c,lines:m}}Object.defineProperty(t,"__esModule",{value:!0}),t.parseDiffHunkForTest=t.parseHunksFromDiff=void 0,t.parseHunksFromDiff=function(e){return e?("\n"+e.trimStart()).split("\ndiff --git ").filter(Boolean).map(n):[]},t.parseDiffHunkForTest=r},37461:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduceHunksToZeroContext=void 0;const r=n(85855);t.reduceHunksToZeroContext=function(e){return e.map((e=>({oldFilename:e.oldFilename,newFilename:e.newFilename,hunks:e.hunks.flatMap((e=>{const t=[];let n=e.oldStart,o=e.newStart,i=n,a=o,s=[];for(const c of e.lines)if("context"!==c.type)switch(c.type){case"remove":s.push({type:"remove",text:c.text}),n++;break;case"add":s.push({type:"add",text:c.text}),o++;break;default:(0,r.assertUnreachable)(c)}else s.length>0&&t.push({oldStart:i,newStart:a,lines:s,oldNoNewlineAtEndOfFile:!1,newNoNewlineAtEndOfFile:!1}),i=++n,a=++o,s=[];return s.length>0&&t.push({oldStart:i,newStart:a,lines:s,oldNoNewlineAtEndOfFile:e.oldNoNewlineAtEndOfFile,newNoNewlineAtEndOfFile:e.newNoNewlineAtEndOfFile}),t.map((e=>{if(0===e.lines.length)throw new Error("empty hunk");return e.oldStart>0&&!e.lines.some((e=>"remove"===e.type))?Object.assign(Object.assign({},e),{oldStart:e.oldStart-1}):e.newStart>0&&!e.lines.some((e=>"add"===e.type))?Object.assign(Object.assign({},e),{newStart:e.newStart-1}):e}))}))})))}},29114:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeExecutionPool=void 0;const o=n(76925);t.composeExecutionPool=function({maxConcurrency:e,onEnqueued:t,onQueueDrained:n}){const i=[],a=new Set,s=t=>r(this,void 0,void 0,(function*(){const r=(0,o.v4)();a.add(r);try{return yield t()}finally{a.delete(r),(()=>{var t;if(0!==i.length){for(;i.length>0&&a.size<e;)null===(t=i.shift())||void 0===t||t();0===i.length&&(null==n||n())}})()}}));return{execute:n=>a.size<e?s(n):new Promise(((e,r)=>{i.push((()=>s(n).then(e).catch(r))),null==t||t({queueSize:i.length})}))}}},58139:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMockExecutionPool=t.composeExecutionPool=void 0;var r=n(29114);Object.defineProperty(t,"composeExecutionPool",{enumerable:!0,get:function(){return r.composeExecutionPool}});var o=n(20197);Object.defineProperty(t,"createMockExecutionPool",{enumerable:!0,get:function(){return o.createMockExecutionPool}})},20197:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMockExecutionPool=void 0,t.createMockExecutionPool=()=>({execute:e=>e()})},84602:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.splitLines=t.composeGitRunner=void 0;const o=n(85855),i=n(35317),a=n(89359),s=n(56142);function c(e){return e.split("\n").filter((e=>e.length>0))}t.composeGitRunner=e=>{const t=t=>r(void 0,void 0,void 0,(function*(){var n,r;const o=null!==(r=null===(n=t.options)||void 0===n?void 0:n.cwd)&&void 0!==r?r:e.cwd,i=Object.assign(Object.assign(Object.assign({},t),o?{args:["-C",o,...t.args]}:{}),{context:e});return t.resource&&a.tracer.currentSpanId?a.tracer.span({name:"spawnedCommand",resource:t.resource,meta:{runCommandArgs:JSON.stringify(t,null,2)}},(()=>f(i))):f(i)}));return{runGitCommand:t,runGitCommandAndSplitLines:e=>r(void 0,void 0,void 0,(function*(){return c(yield t(e))}))}},t.splitLines=c;const u=3,l=["EAGAIN","EBADF"],d=50;function f(e){return r(this,void 0,void 0,(function*(){return(0,o.retryWithSleep)({fn:()=>e.context.executionPool.execute((()=>h(e))),onRetry:({retryCount:t,err:n})=>{const{splog:r}=e.context,o=n instanceof Error?n.message:"unknown error";if(r.debug(`Spawning git ${e.args.join(" ")} failed: ${o}`),!l.some((e=>o.includes(e))))throw n;r.debug(`Retrying git command after spawn error (attempt ${t+1}/${u})...`)},options:{maxRetries:u,sleepDuration:{milliseconds:d}}})}))}const h=e=>r(void 0,[e],void 0,(function*({args:e,spawnOptions:t,options:n,onError:r,input:o,resource:a,numIndexLockRetries:c,numSpawnRetries:u,onStdError:l,onStdOut:f,context:p}){const{splog:m}=p;return c&&m.debug(`index.lock retry: ${c}`),new Promise(((g,v)=>{var b,y;const _=(0,i.spawn)("git",e,Object.assign(Object.assign({},t),{windowsHide:!0}));m.debug(`${u?`[Retry ${u}] `:""}Spawning ${a} (${_.pid}): git ${e.join(" ")}`),o&&(null===(b=_.stdin)||void 0===b||b.write(o),null===(y=_.stdin)||void 0===y||y.end());let E="";_.stdout&&(_.stdout.setEncoding("utf8"),_.stdout.on("data",(function(e){const t=e.toString();(null==n?void 0:n.echoStdout)&&m.stdout(t),f?f(t):E+=t})));let C="";_.stderr&&(_.stderr.setEncoding("utf8"),_.stderr.on("data",(function(e){const t=e.toString();(null==n?void 0:n.echoStderr)&&m.stderr(t),C+=t,null==l||l(t)}))),_.addListener("close",((o,i)=>{return m.debug(`Finished ${a} (${_.pid}): git ${e.join(" ")}\n${JSON.stringify({code:o,signal:i,stdout:E,stderr:C},null,2)}`),i?v(new s.CommandKilledError({command:"git",args:e,signal:i,stdout:E,stderr:C})):0===o?g((null==n?void 0:n.noTrim)?E:E.trim()):(null!=c?c:0)<5&&C.includes("index.lock")?g((u=d,new Promise((e=>setTimeout(e,u)))).then((()=>h({args:e,spawnOptions:t,onError:r,resource:a,numIndexLockRetries:(null!=c?c:0)+1,context:p})))):"ignore"===r?g(""):v(new s.CommandFailedError({command:"git",args:e,status:o||1,stdout:E,stderr:C}));var u}))}))}))},56142:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandKilledError=t.CommandFailedError=void 0;class n extends Error{constructor(e){super([e.errno&&e.code?`Command failed with error ${e.code} (${e.errno}), exit code ${e.status}:`:`Command failed with error exit code ${e.status}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.exitCode=e.status,this.name="CommandFailed"}}t.CommandFailedError=n;class r extends Error{constructor(e){super([`Command killed with signal ${e.signal}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.name="CommandKilled"}}t.CommandKilledError=r},90173:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandKilledError=t.CommandFailedError=t.splitLines=t.composeGitRunner=void 0;var r=n(84602);Object.defineProperty(t,"composeGitRunner",{enumerable:!0,get:function(){return r.composeGitRunner}}),Object.defineProperty(t,"splitLines",{enumerable:!0,get:function(){return r.splitLines}});var o=n(56142);Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return o.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return o.CommandKilledError}})},13234:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.areCommitRangesEqual=t.isCommitRangeEmpty=t.formatCommitRange=void 0,t.formatCommitRange=e=>`${e.base}..${e.head}`,t.isCommitRangeEmpty=e=>e.base===e.head,t.areCommitRangesEqual=(e,t)=>e.base===t.base&&e.head===t.head},6150:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TmpGitRepo=t.TestGitRepo=t.mockGitWithRepo=t.mockGit=t.CommandKilledError=t.CommandFailedError=t.formatCommitRange=t.areCommitRangesEqual=t.reduceHunksToZeroContext=t.parseHunksFromDiff=t.parseDiffHunkForTest=t.computePatchFromHunks=t.computePatchFromHunk=t.translateNewLinesInHunk=t.translateHunk=t.getNetChangeInHunk=t.getBoundsOfHunk=t.commuteHunkBefore=t.composeGitConfig=t.composeGit=void 0;var r=n(35295);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return r.composeGit}});var o=n(16631);Object.defineProperty(t,"composeGitConfig",{enumerable:!0,get:function(){return o.composeGitConfig}});var i=n(11566);Object.defineProperty(t,"commuteHunkBefore",{enumerable:!0,get:function(){return i.commuteHunkBefore}}),Object.defineProperty(t,"getBoundsOfHunk",{enumerable:!0,get:function(){return i.getBoundsOfHunk}}),Object.defineProperty(t,"getNetChangeInHunk",{enumerable:!0,get:function(){return i.getNetChangeInHunk}}),Object.defineProperty(t,"translateHunk",{enumerable:!0,get:function(){return i.translateHunk}}),Object.defineProperty(t,"translateNewLinesInHunk",{enumerable:!0,get:function(){return i.translateNewLinesInHunk}});var a=n(73769);Object.defineProperty(t,"computePatchFromHunk",{enumerable:!0,get:function(){return a.computePatchFromHunk}}),Object.defineProperty(t,"computePatchFromHunks",{enumerable:!0,get:function(){return a.computePatchFromHunks}});var s=n(90260);Object.defineProperty(t,"parseDiffHunkForTest",{enumerable:!0,get:function(){return s.parseDiffHunkForTest}}),Object.defineProperty(t,"parseHunksFromDiff",{enumerable:!0,get:function(){return s.parseHunksFromDiff}});var c=n(37461);Object.defineProperty(t,"reduceHunksToZeroContext",{enumerable:!0,get:function(){return c.reduceHunksToZeroContext}});var u=n(13234);Object.defineProperty(t,"areCommitRangesEqual",{enumerable:!0,get:function(){return u.areCommitRangesEqual}});var l=n(13234);Object.defineProperty(t,"formatCommitRange",{enumerable:!0,get:function(){return l.formatCommitRange}});var d=n(90173);Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return d.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return d.CommandKilledError}});var f=n(39802);Object.defineProperty(t,"mockGit",{enumerable:!0,get:function(){return f.mockGit}}),Object.defineProperty(t,"mockGitWithRepo",{enumerable:!0,get:function(){return f.mockGitWithRepo}});var h=n(29819);Object.defineProperty(t,"TestGitRepo",{enumerable:!0,get:function(){return h.TestGitRepo}});var p=n(56628);Object.defineProperty(t,"TmpGitRepo",{enumerable:!0,get:function(){return p.TmpGitRepo}})},39802:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockGitWithRepo=t.mockGit=void 0;const r=n(22650);t.mockGit=function(e){return(0,r.fromPartial)(Object.assign({},e))},t.mockGitWithRepo=function(e){return(0,r.fromPartial)(Object.assign(Object.assign({},e),{repo:!0}))}},29819:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TestGitRepo=void 0;const i=n(35317),a=o(n(57372)),s=o(n(16928)),c=n(63959),u=n(58139),l=n(90173),d="test.txt";class f{static fromExisting({dir:e}){return new f(e)}static fromClone({dir:e,repoUrl:t}){return(0,i.spawnSync)("git",["clone",t,e]),new f(e)}static initRepo({dir:e}){return(0,i.spawnSync)("git",["init",e,"-b","main"]),new f(e)}constructor(e){this.mockSplog=(0,c.createMockSplog)(),this.dir=e,this.runner=(0,l.composeGitRunner)({cwd:e,splog:this.mockSplog,executionPool:(0,u.createMockExecutionPool)()}),(0,i.spawnSync)("git",["config","user.email","test@graphite.dev"],{cwd:e}),(0,i.spawnSync)("git",["config","user.name","graphite_test"],{cwd:e})}runGitCommand(e,t){return r(this,void 0,void 0,(function*(){return this.runner.runGitCommand({args:e,onError:"throw",resource:"test",spawnOptions:{env:null==t?void 0:t.env},options:{cwd:null==t?void 0:t.cwd}})}))}createChange(e){return r(this,arguments,void 0,(function*({textValue:e,prefix:t,unstaged:n,cwd:r}){const o=s.default.join(r||`${this.dir}`,`${t?t+"_":""}${d}`);a.default.writeFileSync(o,e),n||(yield this.runGitCommand(["add",o]))}))}readFileContents(e){const t=s.default.join(`${this.dir}`,`${e?e+"_":""}${d}`);return a.default.readFileSync(t,"utf8")}createChangeAndCommit(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange({textValue:e,prefix:t}),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","-m",e])}))}createChangeAndAmend(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange({textValue:e,prefix:t}),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","--amend","--no-edit"])}))}deleteBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["branch","-D",e])}))}hasStagedChanges(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["diff","--cached"])).length>0}))}createPrecommitHook(e){a.default.mkdirpSync(`${this.dir}/.git/hooks`),a.default.writeFileSync(`${this.dir}/.git/hooks/pre-commit`,e),(0,i.spawnSync)("chmod",["+x",`${this.dir}/.git/hooks/pre-commit`])}createAndCheckoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","-b",e])}))}checkoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout",e])}))}rebaseInProgress(){return a.default.existsSync(s.default.join(this.dir,".git","rebase-merge"))}resolveMergeConflicts(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","--theirs","."])}))}markMergeConflictsAsResolved(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["add","."])}))}currentBranchName(){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["branch","--show-current"])}))}getBranchSha(e){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["rev-parse",`refs/heads/${e}`])}))}listCurrentBranchCommitMessages(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["log","--oneline","--format=%B"])).split("\n\n").filter((e=>e.length>0))}))}}t.TestGitRepo=f},56628:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TmpGitRepo=void 0;const o=r(n(57372)),i=n(16928),a=r(n(27836)),s=n(99833),c=n(2117),u=n(29819);class l{static initRepo(e){const t=a.default.dirSync(),n=u.TestGitRepo.initRepo({dir:t.name});return new l(n,t,null!=e?e:{})}static cloneRepo(e,t){const n=a.default.dirSync(),r=u.TestGitRepo.fromClone({dir:n.name,repoUrl:e});return new l(r,n,null!=t?t:{})}constructor(e,t,n){this.repo=e,this.tmpDir=t,d({dir:this.tmpDir.name}),f({dir:this.tmpDir.name,options:n})}get dir(){return this.tmpDir.name}cleanup(){o.default.emptyDirSync(this.tmpDir.name),this.tmpDir.removeCallback()}}t.TmpGitRepo=l;const d=({dir:e})=>{process.env.XDG_CONFIG_HOME=(0,i.join)(e,".git",".config"),process.env.XDG_DATA_HOME=(0,i.join)(e,".git",".local","share")},f=({dir:e,options:t})=>{var n,r;o.default.writeFileSync(`${e}/.git/.graphite_repo_config`,null!==(n=t.gtRepoConfigOverride)&&void 0!==n?n:(0,s.cuteString)({trunk:"main",owner:"test_owner",repo:"test_repo"})),o.default.outputFileSync((0,i.join)((0,c.getGtConfigDir)(),"user_config"),null!==(r=t.gtUserConfigOverride)&&void 0!==r?r:(0,s.cuteString)({tips:!1}))}},22036:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitProgressTracker=void 0;const r=n(85855),o={"Counting objects":/Counting objects:[ \t]*(\d+)%/g,"Compressing objects":/Compressing objects:[ \t]*(\d+)%/g,"Receiving objects":/Receiving objects:[ \t]*(\d+)%/g,"Writing objects":/Writing objects:[ \t]*(\d+)%/g,"Resolving deltas":/Resolving deltas:[ \t]*(\d+)%/g};t.composeGitProgressTracker=({progressOutput:e,onProgressUpdate:t})=>{let n={completionPercentage:0,currentStep:"Starting"};return{updateProgressOnStdError:i=>{const a=1/e.length;for(let c=e.length-1;c>=0;c--){const u=(s=o[e[c]],[...i.matchAll(s)].reduce(((e,t)=>{const n=t[1]?(0,r.parseIntOrNull)(t[1]):null;return null===n?e:Math.max(null!=e?e:0,n)}),null));if(null!==u){const r=Math.round(100*(u/100*a+c*a));r!==n.completionPercentage&&(null==t||t({completionPercentage:r,currentStep:e[c]})),n={completionPercentage:r,currentStep:e[c]};break}}var s;return n}}}},56141:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getGitFileAndRebaseStatus=void 0,t.getGitFileAndRebaseStatus=e=>n(void 0,[e],void 0,(function*({context:e}){const[t,n]=yield Promise.all([(yield e.git.getStatus()).map((e=>({status:r(e.status,e.staged),path:e.path,copy:e.from}))),e.git.rebaseInProgress()]);return{files:t,conflicts:n}}));const r=(e,t)=>"unresolved"===e?"UNRESOLVED":`${{full:"TRACKED",partial:"PARTIALLY_TRACKED",none:"UNTRACKED"}[t]}_${{added:"ADD",modified:"MODIFY",deleted:"REMOVE",copied:"COPY",renamed:"RENAME"}[e]}`},21856:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitOrchestrator=void 0;const r=n(85855),o=n(56141);t.composeGitOrchestrator=e=>({getGitFileAndRebaseStatus:(0,r.bind)(o.getGitFileAndRebaseStatus,{context:e})})},98853:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitOrchestrator=void 0;var r=n(21856);Object.defineProperty(t,"composeGitOrchestrator",{enumerable:!0,get:function(){return r.composeGitOrchestrator}})},40800:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.addSyncedRepo=void 0;const o=n(72920),i=n(36073);t.addSyncedRepo=function(e){return r(this,arguments,void 0,(function*({repo:e,context:t}){const n=yield t.request({route:o.API_ROUTES.addSyncedRepo,params:{repoName:e.name,repoOwner:e.owner}});if(200!==n._response.status&&(0,i.handleUnexpectedResponseStatus)({rawResponse:n._response,serverUrl:t.userConfig.getAppServerUrl()}),n.err)throw new Error(n.err)}))}},69812:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.checkAuth=void 0;const o=n(72920),i=n(36073);t.checkAuth=function(e){return r(this,arguments,void 0,(function*({repo:e,context:t}){const n=yield t.request({route:o.API_ROUTES.checkAuth,params:e?{repoName:e.name,repoOwner:e.owner}:{}});return 200!==n._response.status&&(0,i.handleUnexpectedResponseStatus)({rawResponse:n._response,serverUrl:t.userConfig.getAppServerUrl()}),n}))}},26938:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.checkIsRepoSynced=void 0;const o=n(72920),i=n(36073);t.checkIsRepoSynced=function(e){return r(this,arguments,void 0,(function*({repo:e,context:t}){const n=yield t.request({route:o.API_ROUTES.checkIsRepoSynced,params:{},queryParams:{repoName:e.name,repoOwner:e.owner}});return 200!==n._response.status&&(0,i.handleUnexpectedResponseStatus)({rawResponse:n._response,serverUrl:t.userConfig.getAppServerUrl()}),n.result}))}},56490:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanupRetargetPrs=void 0;const o=n(72920);t.cleanupRetargetPrs=e=>r(void 0,[e],void 0,(function*({repo:e,prs:t,context:n}){const r=yield n.request({route:o.API_ROUTES.cleanupRetargetPullRequests,params:{repoOwner:e.owner,repoName:e.name,prs:t}});if(200!==r._response.status)throw new Error(`Error response trying to cleanup retargeted PRs: ${r._response.status}`);if("ok"!==r.result)throw new Error(r.result.error)}))},28210:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchFeatureFlags=void 0;const o=n(72920);t.fetchFeatureFlags=function(e){return r(this,arguments,void 0,(function*({currentVersion:e,context:t}){const n=yield t.request({route:o.API_ROUTES.featureFlags,params:{},queryParams:{currentVersion:e}});if(200===n._response.status)return n.flags}))}},29536:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchMenuBarAppConfig=void 0;const o=n(72920);t.fetchMenuBarAppConfig=function(e){return r(this,arguments,void 0,(function*({app:e,context:t}){const n=yield t.request({route:o.API_ROUTES.getMenuBarAppConfig,params:{},headers:{"User-Agent":`${e.name}/${e.version}`}});if(200===n._response.status)return n.config}))}},55622:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchRepoMessage=void 0;const o=n(72920);t.fetchRepoMessage=function(e){return r(this,arguments,void 0,(function*({repo:e,context:t}){const n=yield t.request({route:o.API_ROUTES.getRepoMessage,params:{},queryParams:{org:e.owner,repo:e.name}});return 200===n._response.status&&n.message||void 0}))}},6561:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchUpgradePromptMessage=void 0;const o=n(72920);t.fetchUpgradePromptMessage=e=>r(void 0,[e],void 0,(function*({currentVersion:e,installationMethod:t,context:n}){const r=yield n.request({route:o.API_ROUTES.upgradePrompt,params:{},queryParams:{currentVersion:e,installationMethod:t}});if(200===r._response.status)return r.prompt?r.prompt.message:null}))},63577:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.generateBranchNameAndCommitMessage=void 0;const o=n(72920),i=n(36073);t.generateBranchNameAndCommitMessage=e=>r(void 0,[e],void 0,(function*({repo:e,diff:t,template:n,context:r}){const a=yield r.request({route:o.API_ROUTES.generateBranchNameAndCommitMessage,params:{owner:e.owner,repo:e.name,diff:t,template:n}});if(200!==a._response.status&&(0,i.handleUnexpectedResponseStatus)({rawResponse:a._response,serverUrl:r.userConfig.getAppServerUrl()}),"error"in a.result)throw new Error(a.result.error);return a.result}))},51814:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.generateTitleAndDescription=void 0;const o=n(72920),i=n(36073);t.generateTitleAndDescription=e=>r(void 0,[e],void 0,(function*({repo:e,diff:t,template:n,context:r}){const a=yield r.request({route:o.API_ROUTES.generateTitleAndDescription,params:{owner:e.owner,repo:e.name,diff:t,template:n}});if(200!==a._response.status&&(0,i.handleUnexpectedResponseStatus)({rawResponse:a._response,serverUrl:r.userConfig.getAppServerUrl()}),"error"in a.result)throw new Error(a.result.error);return a.result}))},47189:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getMergeabilityStatus=void 0;const o=n(72920),i=n(5397);t.getMergeabilityStatus=e=>r(void 0,[e],void 0,(function*({repo:e,prNumbers:t,cliVersion:n,ignoreFailures:r,context:a}){const s=yield a.request({route:o.API_ROUTES.mergeabilityStatus,params:{repoName:e.name,repoOwner:e.owner,prNumbers:t,cliVersion:n}});if(200!==s._response.status){if(r)return[];throw new i.ExitFailedError("Cannot determine if stack is ready to merge")}return s.mergeabilityStatuses}))},57903:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getPrInfo=void 0;const o=n(72920),i=n(5397),a=n(36073);t.getPrInfo=e=>r(void 0,[e],void 0,(function*({repo:e,prNumbers:t,branchNames:n,trunkBranchNames:r,callsite:s,context:c}){const u=yield c.request({route:o.API_ROUTES.pullRequestInfo,params:{repoOwner:e.owner,repoName:e.name,prNumbers:t,prHeadRefNames:n,trunkBranchNames:r,consistent:!0,callsite:s}});if(200!==u._response.status)return(0,a.handleUnexpectedResponseStatus)({rawResponse:u._response,serverUrl:c.userConfig.getAppServerUrl()});if("ok"!==u.result.status)throw new i.ExitFailedError(u.result.message);return u.result.prs}))},24232:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGraphiteApiClient=t.createGraphiteApiClient=void 0;const o=n(85855),i=n(36073),a=n(50815),s=n(40800),c=n(69812),u=n(26938),l=n(56490),d=n(28210),f=n(29536),h=n(55622),p=n(6561),m=n(63577),g=n(51814),v=n(47189),b=n(57903),y=n(83262),_=n(30901),E=n(28048),C=n(8039),R=n(29433);t.createGraphiteApiClient=e=>r(void 0,[e],void 0,(function*({splog:e}){const n=yield(0,a.composeUserConfigFactory)().load(),r=(0,i.composeRequest)({userConfig:n,splog:e});return(0,t.composeGraphiteApiClient)({request:r,userConfig:n})})),t.composeGraphiteApiClient=e=>({addSyncedRepo:(0,o.bind)(s.addSyncedRepo,{context:e}),checkAuth:(0,o.bind)(c.checkAuth,{context:e}),checkIsRepoSynced:(0,o.bind)(u.checkIsRepoSynced,{context:e}),cleanupRetargetPrs:(0,o.bind)(l.cleanupRetargetPrs,{context:e}),fetchFeatureFlags:(0,o.bind)(d.fetchFeatureFlags,{context:e}),fetchMenuBarAppConfig:(0,o.bind)(f.fetchMenuBarAppConfig,{context:e}),fetchRepoMessage:(0,o.bind)(h.fetchRepoMessage,{context:e}),fetchUpgradePromptMessage:(0,o.bind)(p.fetchUpgradePromptMessage,{context:e}),generateBranchNameAndCommitMessage:(0,o.bind)(m.generateBranchNameAndCommitMessage,{context:e}),generateTitleAndDescription:(0,o.bind)(g.generateTitleAndDescription,{context:e}),getMergeabilityStatus:(0,o.bind)(v.getMergeabilityStatus,{context:e}),getPrInfo:(0,o.bind)(b.getPrInfo,{context:e}),logActions:(0,o.bind)(y.logActions,{context:e}),preSubmitPrs:(0,o.bind)(_.preSubmitPrs,{context:e}),retargetPr:(0,o.bind)(E.retargetPr,{context:e}),sendFeedback:(0,o.bind)(C.sendFeedback,{context:e}),submitPullRequests:(0,o.bind)(R.submitPullRequests,{context:e})})},2603:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createGraphiteApiClient=t.composeGraphiteApiClient=void 0;var r=n(24232);Object.defineProperty(t,"composeGraphiteApiClient",{enumerable:!0,get:function(){return r.composeGraphiteApiClient}}),Object.defineProperty(t,"createGraphiteApiClient",{enumerable:!0,get:function(){return r.createGraphiteApiClient}})},83262:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.logActions=void 0;const o=n(72920);t.logActions=e=>r(void 0,[e],void 0,(function*({actions:e,context:t}){if(0===e.length)throw new Error("Must pass in at least 1 action.");yield t.request({route:o.API_ROUTES.logActions,params:{actions:e.map((e=>({name:e.name,details:e.details,timestamp:i(e.timestamp)})))}})}));const i=e=>e?"string"==typeof e?e:e.toISOString():(new Date).toISOString()},30901:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.preSubmitPrs=void 0;const o=n(72920);t.preSubmitPrs=e=>r(void 0,[e],void 0,(function*({repo:e,branches:t,context:n}){const r=yield n.request({route:o.API_ROUTES.preSubmitPullRequests,params:{repoOwner:e.owner,repoName:e.name,branches:t}});if(200!==r._response.status){if(r.result&&"error"in r.result)throw new Error(r.result.error);throw new Error(`Error response trying to pre-submit PRs: ${r._response.status}`)}return r.result}))},28048:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.retargetPr=void 0;const o=n(72920);t.retargetPr=e=>r(void 0,[e],void 0,(function*({repo:e,prNumber:t,context:n}){const r=yield n.request({route:o.API_ROUTES.retargetPullRequest,params:{repoOwner:e.owner,repoName:e.name,prNumber:t}});if(200!==r._response.status)throw new Error(`Error response trying to retarget PR: ${r._response.status}`);if("error"in r.result)throw new Error(r.result.error);return r.result}))},8039:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.sendFeedback=void 0;const o=n(72920);t.sendFeedback=e=>r(void 0,[e],void 0,(function*({user:e,message:t,debugContext:n,context:r}){const i=yield r.request({route:o.API_ROUTES.feedback,params:{user:e,message:t,debugContext:n}});if(200!==i._response.status)throw new Error(`Failed to report feedback, network response ${i._response.status}`);return i.result}))},29433:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.submitPullRequests=void 0;const o=n(72920),i=n(36073);t.submitPullRequests=function(e){return r(this,arguments,void 0,(function*({repo:e,prSubmissionInfos:t,comment:n,trunkBranchName:r,targetTrunkBranchName:a,options:s,webSubmitAnalytics:c,context:u}){const l=yield u.request({route:o.API_ROUTES.submitPullRequests,params:{repoOwner:e.owner,repoName:e.name,prs:t,comment:n,trunkBranchName:r,targetTrunkBranchName:a,gti:s.gti,mergeWhenReady:s.mergeWhenReady,rerequestReview:s.rerequestReview,useWebSubmit:s.useWebSubmit,webSubmitAnalytics:c}});200===l._response.status&&l._response.body||(0,i.handleUnexpectedResponseStatus)({rawResponse:l._response,serverUrl:u.userConfig.getAppServerUrl()});const d={};return t.forEach((e=>{d[e.head]=e})),l.prs.map((e=>({request:d[e.head],response:e})))}))}},7004:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGtActionsClient=void 0;const r=n(85855),o=n(6623);t.composeGtActionsClient=e=>({sendFeedback:(0,r.bind)(o.sendFeedback,{context:e})})},77827:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGtActionsClient=void 0;var r=n(7004);Object.defineProperty(t,"composeGtActionsClient",{enumerable:!0,get:function(){return r.composeGtActionsClient}})},6623:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,o,(t=e[n](t)).done,t.value)}))}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.gatherExtraDebugInfoForTests=t.getOrderedFilesToIncludeForTests=t.sendFeedback=void 0;const a=i(n(57372)),s=n(16928),c=n(5397),u=n(2117);t.sendFeedback=e=>r(void 0,[e],void 0,(function*({message:e,includeDebugContext:t,context:n}){const r=yield n.git.config("user.email"),o=null!=r?r:"NotFound";if(t){try{const e=yield p({context:n});g({extraDebugInfo:e,context:n})}catch(e){n.splog.debug(`Error gathering extra debug info: ${e}`)}yield l({message:e,user:o,context:n})}else yield n.graphiteApi.sendFeedback({user:o,message:e})}));const l=e=>r(void 0,[e],void 0,(function*({message:e,user:t,context:n}){var r,i,l,f;const h=n.userConfig.getDebugExpiryMs(),p=Date.now(),m=(0,s.join)((0,u.getGtDataDir)(),"debug"),g=d({directoryContents:a.default.readdirSync(m),debugExpiryMs:h,now:p});let v="",b=0;for(const u of g){const d=(0,s.join)(m,u),h=a.default.createReadStream(d,{highWaterMark:65536});h.setEncoding("utf-8"),v+=u;try{for(var y,_=!0,E=(i=void 0,o(h));!(r=(y=yield E.next()).done);_=!0)if(f=y.value,_=!1,v+=f,v.length>26214400&&(yield n.graphiteApi.sendFeedback({user:t,message:`${e}-${b}`,debugContext:v}),v="",b++,b>=10))throw new c.TooMuchDebugContextError}catch(e){i={error:e}}finally{try{_||r||!(l=E.return)||(yield l.call(E))}finally{if(i)throw i.error}}}v.length>0&&(yield n.graphiteApi.sendFeedback({user:t,message:b>0?`${e}-${b}`:e,debugContext:v}))})),d=({directoryContents:e,debugExpiryMs:t,now:n})=>{const r=h({debugExpiryMs:t,now:n});return e.filter((e=>e.endsWith(".log"))).filter(r).sort(((e,t)=>f(e)-f(t)))};t.getOrderedFilesToIncludeForTests=d;const f=e=>parseInt(e.split(".")[0]),h=({debugExpiryMs:e,now:t})=>n=>f(n)+e>t,p=e=>r(void 0,[e],void 0,(function*({context:e}){var t;const{git:n}=e,r=null!==(t=yield n.config("core.hooksPath"))&&void 0!==t?t:".git/hooks";return{hooksDirectory:r,hooks:yield m({hooksDirectory:r})}}));t.gatherExtraDebugInfoForTests=p;const m=e=>r(void 0,[e],void 0,(function*({hooksDirectory:e}){return a.default.existsSync(e)?(yield a.default.readdir(e)).filter((e=>!e.endsWith(".sample"))):[]})),g=({extraDebugInfo:e,context:t})=>{const{splog:n}=t;n.debug(`Hooks directory: ${e.hooksDirectory}`),n.debug(`Hooks: ${e.hooks.join(", ")}`)}},85340:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeCacheClient=void 0;const o=n(85855),i=n(5397),a=n(87872);t.composeCacheClient=function(e){return r(this,arguments,void 0,(function*({version:e,git:t,splog:n,branchMetadata:s,continueConfig:c,repoConfig:u}){const l=c.getCurrentBranchOverride();let d=u.getTrunk(),f=u.getTrunks();const h=yield(0,a.composeCacheLoader)({version:e,branchMetadata:s,git:t,splog:n}),p=yield h.loadCachedBranches({trunkName:d,trunks:f});let m=null!=p?p:{},g=null!=l?l:yield t.getCurrentBranchName();function v(e){return m[e]}return{branchExists:function(e){return e in m},deleteBranchMetadata:function(e){delete m[e]},getAllBranchNames:function(){return Object.keys(m)},getAllBranches:function(){return m},getBranchMetadata:v,getCurrentBranch:function(){return g},setCurrentBranch:function(e){g=e},updateBranchMetadata:function({branchName:e,metadata:t}){m[e]=t},getTrunkNamesOrThrow:function(){if(!f||!(0,o.isNonEmptyArray)(f))throw new i.PreconditionsFailedError("No trunks found.");return f.map((e=>e.name))},getTrunksOrNull:function(){return null!=f?f:null},isBranchTrunk:function({branchName:e}){var t;return"TRUNK"===(null===(t=v(e))||void 0===t?void 0:t.validationResult)},setTrunks:function(e){f=e},clearPersistedCache:function(){return r(this,void 0,void 0,(function*(){yield h.clearPersistedCache()}))},persistCache:function(){return r(this,void 0,void 0,(function*(){yield h.persistCache({trunkName:d,trunks:f,cachedBranches:m})}))},rebuildCache:function(e){return r(this,void 0,void 0,(function*(){var t,n,r;d=null!==(t=null==e?void 0:e.newTrunkName)&&void 0!==t?t:d,f=null!==(n=null==e?void 0:e.newTrunks)&&void 0!==n?n:f,m=null!==(r=yield h.loadCachedBranches({trunkName:d,trunks:f}))&&void 0!==r?r:{}}))},getCacheSeed:(0,o.bind)(a.getCacheSeed,{context:{branchMetadata:s,git:t,splog:n,version:e}}),getTrunkOrNull__DEPRECATED:()=>null!=d?d:null,getTrunkOrThrow__DEPRECATED:()=>{if(!d)throw new i.PreconditionsFailedError("No trunk found.");return d},setTrunk__DEPRECATED:e=>{d=e}}}))}},87872:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCacheSeed=t.composeCacheLoader=void 0;const o=n(28368),i=n(50815);function a(e){return r(this,arguments,void 0,(function*({trunkName:e,trunks:t,context:n}){const{branchMetadata:r,git:o,version:i}=n,[a,s,c]=yield Promise.all([o.getRebaseHead(),o.getBranchNamesAndRevisions(),r.getBranchMetadataRefList({})]);return{version:i,trunkName:e,trunks:t,rebaseHead:a,gitBranchNamesAndRevisions:s,metadataRefList:c}}))}t.composeCacheLoader=function(e){return r(this,void 0,void 0,(function*(){const{splog:t,branchMetadata:n}=e,s=yield(0,i.composeCachePersistenceFactory)({git:e.git,debug:t.debug}).load();let c=!1;return{loadCachedBranches:i=>r(this,[i],void 0,(function*({trunkName:r,trunks:i}){t.debug("Reading cache seed data...");const u=yield a({trunkName:r,trunks:i,context:e});t.debug("Loading cache...");const l=s.getCachedBranches();return c=Boolean(l&&(0,o.computeHash)(u)===s.getSha()),c?l:n.parseBranchesAndMeta(Object.assign({},u))})),persistCache:n=>r(this,[n],void 0,(function*({trunkName:n,trunks:r,cachedBranches:i}){try{if(c&&(0,o.computeHash)(s.getBranches())===(0,o.computeHash)(Object.entries(i)))return void t.debug("In-memory cache was not mutated; skipping persistence")}catch(e){t.debug("Failed to hash cache data; persisting cache"),e instanceof Error&&e.stack&&t.debug(e.stack)}t.debug("Persisting cache...");const u=(0,o.computeHash)(yield a({trunkName:n,trunks:r,context:e}));yield s.persist({sha:u,cachedBranches:i})})),clearPersistedCache:()=>r(this,void 0,void 0,(function*(){t.debug("Clearing persisted cache..."),yield s.delete()}))}}))},t.getCacheSeed=a},59909:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockGtCacheClient=void 0;const r=n(22650);t.mockGtCacheClient=function({overrides:e,branchMetadataMap:t}){return(0,r.fromPartial)(Object.assign({getBranchMetadata:e=>null==t?void 0:t[e],branchExists:e=>Boolean(null==t?void 0:t[e]),isBranchTrunk:({branchName:e})=>{var n;return"TRUNK"===(null===(n=null==t?void 0:t[e])||void 0===n?void 0:n.validationResult)}},e))}},91648:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockGtCacheClient=t.composeCacheClient=void 0;var r=n(85340);Object.defineProperty(t,"composeCacheClient",{enumerable:!0,get:function(){return r.composeCacheClient}});var o=n(59909);Object.defineProperty(t,"mockGtCacheClient",{enumerable:!0,get:function(){return o.mockGtCacheClient}})},70074:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGtEngineForRepo=t.createGtEngineForRepo=t.composeGtEngine=t.createGtEngine=void 0;const o=n(58114),i=n(27770),a=n(306),s=n(6150),c=n(98853),u=n(2603),l=n(77827),d=n(91648),f=n(46321),h=n(6211),p=n(50815),m=n(4644),g=n(35843);t.createGtEngine=e=>r(void 0,[e],void 0,(function*({splog:e}){const[n,r,o]=yield Promise.all([(0,p.composeUserConfigFactory)().load(),(0,u.createGraphiteApiClient)({splog:e}),(0,s.composeGit)({splog:e})]);return(0,t.composeGtEngine)({userConfig:n,graphiteApi:r,git:o,splog:e})})),t.composeGtEngine=({userConfig:e,graphiteApi:t,git:n,splog:r})=>({authClient:(0,o.composeAuthClient)({userConfig:e,graphiteApi:t}),graphiteApi:t,gtActions:(0,l.composeGtActionsClient)({userConfig:e,git:n,graphiteApi:t,splog:r}),userConfig:e}),t.createGtEngineForRepo=e=>r(void 0,[e],void 0,(function*({version:e,repoDir:n,splog:r}){const o=yield(0,s.composeGit)({cwd:n,splog:r});if(!o.repo)throw new Error("Git repository not found");const[i,a,c]=yield Promise.all([(0,p.composeLocalPrInfoConfigFactory)({git:o}).load(),(0,p.composeRepoConfigFactory)(o).load(),(0,p.composeUserConfigFactory)().load()]);return(0,t.composeGtEngineForRepo)({version:e,git:o,repoConfig:a,splog:r,userConfig:c,localPrInfoCache:i})})),t.composeGtEngineForRepo=e=>r(void 0,[e],void 0,(function*({version:e,git:n,repoConfig:r,userConfig:o,splog:s,localPrInfoCache:u}){const l=yield(0,p.loadAndMaybeClearContinueConfig)({git:n}),v=yield(0,p.composePrInfoConfigFactory)({git:n}).load(),b=yield(0,t.createGtEngine)({splog:s}),y=(0,a.composeBranchMetadataClient)({git:n,splog:s}),_=(0,c.composeGitOrchestrator)({git:n}),E=yield(0,d.composeCacheClient)({version:e,branchMetadata:y,git:n,splog:s,continueConfig:l,repoConfig:r}),C=(0,g.composeWorktreeClient)({cache:E,git:n}),R=(0,i.composeBranchClient)({branchMetadata:y,cache:E,git:n,prInfo:v,splog:s,worktree:C}),w=(0,m.composeTrunkClient)({branchClient:R,gtCache:E}),P=(0,f.composePrOrchestrator)({branchClient:R,gtCache:E,graphiteApi:b.graphiteApi,prInfoConfig:v}),O=(0,h.composeRestackClient)({branchClient:R,git:n,userConfig:o});return Object.assign(Object.assign({},b),{git:n,gtCache:E,repoConfig:r,branchClient:R,branchMetadata:y,gitOrchestrator:_,localPrInfoCache:u,prInfo:v,prOrchestrator:P,restack:O,trunk:w,userConfig:o,worktree:C,withRepo:!0})}))},34388:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createGtEngine=t.composeGtEngineForRepo=t.composeGtEngine=t.createGraphiteApiClient=t.composeGraphiteApiClient=t.composeGitOrchestrator=t.translateNewLinesInHunk=t.translateHunk=t.reduceHunksToZeroContext=t.parseHunksFromDiff=t.getNetChangeInHunk=t.getBoundsOfHunk=t.computePatchFromHunks=t.computePatchFromHunk=t.composeGit=t.commuteHunkBefore=t.CommandKilledError=t.CommandFailedError=t.areCommitRangesEqual=t.UntrackedBranchError=t.TooMuchDebugContextError=t.RebaseConflictError=t.PreconditionsFailedError=t.OutsideGitMutationDetectedError=t.NoPotentialParentsError=t.NonInteractiveError=t.NoGraphiteContinue=t.NoGraphiteAbortError=t.NoBranchError=t.KilledError=t.InvalidParentRecursiveDependencyError=t.GitPassthroughBlockedError=t.FailedPingError=t.ExitFailedError=t.DivergedBranchError=t.DetachedError=t.ConnectionError=t.ConcurrentExecutionError=t.BlockedDuringRebaseError=t.BadTrunkOperationError=t.AuthError=t.cuteString=t.computeHash=t.composeBranchMetadataClient=t.cachedBranchMetadataSchema=t.assertCachedBranchMetadataIsValidOrTrunk=t.assertCachedBranchMetadataIsValidAndNotTrunk=t.assertCachedBranchMetadataIsNotTrunk=t.composeBranchClient=t.composeAuthClient=void 0,t.testDataFactory=t.TmpGitRepo=t.TestGitRepo=t.getGtDataDir=t.getGtConfigDir=t.composeWorktreeClient=t.STACK_SCOPE=t.tracer=t.composeOutputChannelSplog=t.composeFileSplog=t.composeCliSplog=t.spiffyRetype__DEPRECATED=t.spiffy=t.loadAndMaybeClearContinueConfig=t.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS=t.composeUserConfigFactory=t.composeRepoConfigFactory=t.composePrInfoConfigFactory=t.composeNuxConfigFactory=t.composeMessageConfigFactory=t.composeMenuBarAppConfigFactory=t.composeLocalPrInfoConfigFactory=t.composeFeatureFlagConfigFactory=t.composeCachePersistenceFactory=t.sendAnalyticsEvent=t.composeRequest=t.checkAndDisplayGraphiteStatus=t.composePrOrchestrator=t.composeCacheClient=t.composeGtActionsClient=t.createGtEngineForRepo=void 0;var r=n(58114);Object.defineProperty(t,"composeAuthClient",{enumerable:!0,get:function(){return r.composeAuthClient}});var o=n(27770);Object.defineProperty(t,"composeBranchClient",{enumerable:!0,get:function(){return o.composeBranchClient}});var i=n(306);Object.defineProperty(t,"assertCachedBranchMetadataIsNotTrunk",{enumerable:!0,get:function(){return i.assertCachedBranchMetadataIsNotTrunk}}),Object.defineProperty(t,"assertCachedBranchMetadataIsValidAndNotTrunk",{enumerable:!0,get:function(){return i.assertCachedBranchMetadataIsValidAndNotTrunk}}),Object.defineProperty(t,"assertCachedBranchMetadataIsValidOrTrunk",{enumerable:!0,get:function(){return i.assertCachedBranchMetadataIsValidOrTrunk}}),Object.defineProperty(t,"cachedBranchMetadataSchema",{enumerable:!0,get:function(){return i.cachedBranchMetadataSchema}}),Object.defineProperty(t,"composeBranchMetadataClient",{enumerable:!0,get:function(){return i.composeBranchMetadataClient}});var a=n(28368);Object.defineProperty(t,"computeHash",{enumerable:!0,get:function(){return a.computeHash}});var s=n(99833);Object.defineProperty(t,"cuteString",{enumerable:!0,get:function(){return s.cuteString}});var c=n(5397);Object.defineProperty(t,"AuthError",{enumerable:!0,get:function(){return c.AuthError}}),Object.defineProperty(t,"BadTrunkOperationError",{enumerable:!0,get:function(){return c.BadTrunkOperationError}}),Object.defineProperty(t,"BlockedDuringRebaseError",{enumerable:!0,get:function(){return c.BlockedDuringRebaseError}}),Object.defineProperty(t,"ConcurrentExecutionError",{enumerable:!0,get:function(){return c.ConcurrentExecutionError}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return c.ConnectionError}}),Object.defineProperty(t,"DetachedError",{enumerable:!0,get:function(){return c.DetachedError}}),Object.defineProperty(t,"DivergedBranchError",{enumerable:!0,get:function(){return c.DivergedBranchError}}),Object.defineProperty(t,"ExitFailedError",{enumerable:!0,get:function(){return c.ExitFailedError}}),Object.defineProperty(t,"FailedPingError",{enumerable:!0,get:function(){return c.FailedPingError}}),Object.defineProperty(t,"GitPassthroughBlockedError",{enumerable:!0,get:function(){return c.GitPassthroughBlockedError}}),Object.defineProperty(t,"InvalidParentRecursiveDependencyError",{enumerable:!0,get:function(){return c.InvalidParentRecursiveDependencyError}}),Object.defineProperty(t,"KilledError",{enumerable:!0,get:function(){return c.KilledError}}),Object.defineProperty(t,"NoBranchError",{enumerable:!0,get:function(){return c.NoBranchError}}),Object.defineProperty(t,"NoGraphiteAbortError",{enumerable:!0,get:function(){return c.NoGraphiteAbortError}}),Object.defineProperty(t,"NoGraphiteContinue",{enumerable:!0,get:function(){return c.NoGraphiteContinue}}),Object.defineProperty(t,"NonInteractiveError",{enumerable:!0,get:function(){return c.NonInteractiveError}}),Object.defineProperty(t,"NoPotentialParentsError",{enumerable:!0,get:function(){return c.NoPotentialParentsError}}),Object.defineProperty(t,"OutsideGitMutationDetectedError",{enumerable:!0,get:function(){return c.OutsideGitMutationDetectedError}}),Object.defineProperty(t,"PreconditionsFailedError",{enumerable:!0,get:function(){return c.PreconditionsFailedError}}),Object.defineProperty(t,"RebaseConflictError",{enumerable:!0,get:function(){return c.RebaseConflictError}}),Object.defineProperty(t,"TooMuchDebugContextError",{enumerable:!0,get:function(){return c.TooMuchDebugContextError}}),Object.defineProperty(t,"UntrackedBranchError",{enumerable:!0,get:function(){return c.UntrackedBranchError}});var u=n(6150);Object.defineProperty(t,"areCommitRangesEqual",{enumerable:!0,get:function(){return u.areCommitRangesEqual}}),Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return u.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return u.CommandKilledError}}),Object.defineProperty(t,"commuteHunkBefore",{enumerable:!0,get:function(){return u.commuteHunkBefore}}),Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return u.composeGit}}),Object.defineProperty(t,"computePatchFromHunk",{enumerable:!0,get:function(){return u.computePatchFromHunk}}),Object.defineProperty(t,"computePatchFromHunks",{enumerable:!0,get:function(){return u.computePatchFromHunks}}),Object.defineProperty(t,"getBoundsOfHunk",{enumerable:!0,get:function(){return u.getBoundsOfHunk}}),Object.defineProperty(t,"getNetChangeInHunk",{enumerable:!0,get:function(){return u.getNetChangeInHunk}}),Object.defineProperty(t,"parseHunksFromDiff",{enumerable:!0,get:function(){return u.parseHunksFromDiff}}),Object.defineProperty(t,"reduceHunksToZeroContext",{enumerable:!0,get:function(){return u.reduceHunksToZeroContext}}),Object.defineProperty(t,"translateHunk",{enumerable:!0,get:function(){return u.translateHunk}}),Object.defineProperty(t,"translateNewLinesInHunk",{enumerable:!0,get:function(){return u.translateNewLinesInHunk}});var l=n(98853);Object.defineProperty(t,"composeGitOrchestrator",{enumerable:!0,get:function(){return l.composeGitOrchestrator}});var d=n(2603);Object.defineProperty(t,"composeGraphiteApiClient",{enumerable:!0,get:function(){return d.composeGraphiteApiClient}}),Object.defineProperty(t,"createGraphiteApiClient",{enumerable:!0,get:function(){return d.createGraphiteApiClient}});var f=n(70074);Object.defineProperty(t,"composeGtEngine",{enumerable:!0,get:function(){return f.composeGtEngine}}),Object.defineProperty(t,"composeGtEngineForRepo",{enumerable:!0,get:function(){return f.composeGtEngineForRepo}}),Object.defineProperty(t,"createGtEngine",{enumerable:!0,get:function(){return f.createGtEngine}}),Object.defineProperty(t,"createGtEngineForRepo",{enumerable:!0,get:function(){return f.createGtEngineForRepo}});var h=n(77827);Object.defineProperty(t,"composeGtActionsClient",{enumerable:!0,get:function(){return h.composeGtActionsClient}});var p=n(91648);Object.defineProperty(t,"composeCacheClient",{enumerable:!0,get:function(){return p.composeCacheClient}});var m=n(46321);Object.defineProperty(t,"composePrOrchestrator",{enumerable:!0,get:function(){return m.composePrOrchestrator}});var g=n(36073);Object.defineProperty(t,"checkAndDisplayGraphiteStatus",{enumerable:!0,get:function(){return g.checkAndDisplayGraphiteStatus}}),Object.defineProperty(t,"composeRequest",{enumerable:!0,get:function(){return g.composeRequest}}),Object.defineProperty(t,"sendAnalyticsEvent",{enumerable:!0,get:function(){return g.sendAnalyticsEvent}});var v=n(50815);Object.defineProperty(t,"composeCachePersistenceFactory",{enumerable:!0,get:function(){return v.composeCachePersistenceFactory}}),Object.defineProperty(t,"composeFeatureFlagConfigFactory",{enumerable:!0,get:function(){return v.composeFeatureFlagConfigFactory}}),Object.defineProperty(t,"composeLocalPrInfoConfigFactory",{enumerable:!0,get:function(){return v.composeLocalPrInfoConfigFactory}}),Object.defineProperty(t,"composeMenuBarAppConfigFactory",{enumerable:!0,get:function(){return v.composeMenuBarAppConfigFactory}}),Object.defineProperty(t,"composeMessageConfigFactory",{enumerable:!0,get:function(){return v.composeMessageConfigFactory}}),Object.defineProperty(t,"composeNuxConfigFactory",{enumerable:!0,get:function(){return v.composeNuxConfigFactory}}),Object.defineProperty(t,"composePrInfoConfigFactory",{enumerable:!0,get:function(){return v.composePrInfoConfigFactory}}),Object.defineProperty(t,"composeRepoConfigFactory",{enumerable:!0,get:function(){return v.composeRepoConfigFactory}}),Object.defineProperty(t,"composeUserConfigFactory",{enumerable:!0,get:function(){return v.composeUserConfigFactory}}),Object.defineProperty(t,"DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS",{enumerable:!0,get:function(){return v.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS}}),Object.defineProperty(t,"loadAndMaybeClearContinueConfig",{enumerable:!0,get:function(){return v.loadAndMaybeClearContinueConfig}});var b=n(50815);Object.defineProperty(t,"spiffy",{enumerable:!0,get:function(){return b.spiffy}}),Object.defineProperty(t,"spiffyRetype__DEPRECATED",{enumerable:!0,get:function(){return b.spiffyRetype__DEPRECATED}});var y=n(63959);Object.defineProperty(t,"composeCliSplog",{enumerable:!0,get:function(){return y.composeCliSplog}}),Object.defineProperty(t,"composeFileSplog",{enumerable:!0,get:function(){return y.composeFileSplog}}),Object.defineProperty(t,"composeOutputChannelSplog",{enumerable:!0,get:function(){return y.composeOutputChannelSplog}});var _=n(89359);Object.defineProperty(t,"tracer",{enumerable:!0,get:function(){return _.tracer}});var E=n(16305);Object.defineProperty(t,"STACK_SCOPE",{enumerable:!0,get:function(){return E.STACK_SCOPE}});var C=n(35843);Object.defineProperty(t,"composeWorktreeClient",{enumerable:!0,get:function(){return C.composeWorktreeClient}});var R=n(2117);Object.defineProperty(t,"getGtConfigDir",{enumerable:!0,get:function(){return R.getGtConfigDir}}),Object.defineProperty(t,"getGtDataDir",{enumerable:!0,get:function(){return R.getGtDataDir}});var w=n(6150);Object.defineProperty(t,"TestGitRepo",{enumerable:!0,get:function(){return w.TestGitRepo}}),Object.defineProperty(t,"TmpGitRepo",{enumerable:!0,get:function(){return w.TmpGitRepo}});var P=n(65500);Object.defineProperty(t,"testDataFactory",{enumerable:!0,get:function(){return P.testDataFactory}})},64368:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.generatePrTitleFromCommits=void 0,t.generatePrTitleFromCommits=e=>n(void 0,[e],void 0,(function*({branchName:e,context:t}){var n;return null!==(n=(yield t.branchClient.getAllCommits({branchName:e,format:"SUBJECT"})).reverse()[0])&&void 0!==n?n:e}))},91353:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getPrInfoForKnownPrs=void 0,t.getPrInfoForKnownPrs=e=>n(void 0,[e],void 0,(function*({repo:e,context:t}){return(yield t.graphiteApi.getPrInfo({repo:e,prNumbers:t.prInfoConfig.mapAllPrInfos((({prNumber:e})=>e)),callsite:"internalOnlyPrs"})).map((e=>({title:e.title,branchName:e.headRefName,isDraft:e.isDraft,number:e.prNumber.toString(),state:e.state})))}))},46321:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composePrOrchestrator=void 0;var r=n(92894);Object.defineProperty(t,"composePrOrchestrator",{enumerable:!0,get:function(){return r.composePrOrchestrator}})},92894:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composePrOrchestrator=void 0;const r=n(85855),o=n(64368),i=n(91353),a=n(72460);t.composePrOrchestrator=e=>({getPrInfoForKnownPrs:(0,r.bind)(i.getPrInfoForKnownPrs,{context:e}),generatePrTitleFromCommits:(0,r.bind)(o.generatePrTitleFromCommits,{context:e}),topologicallySortPrNumbersToSync:a.topologicallySortPrNumbersToSync})},72460:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.topologicallySortPrNumbersToSync=void 0;const r=n(5397);t.topologicallySortPrNumbersToSync=e=>{const t=[],n=e=>Boolean(t.find((({prNumber:t})=>t===e.prNumber)));for(const o of e){if(n(o))continue;let i=o.prNumber;const a=[];for(;void 0!==i;){const t=e.find((e=>e.prNumber===i));if(void 0===t)throw new r.PreconditionsFailedError(`Received incomplete PR info: ${i}`);a.push(t),i=t.dependentPrNumber}t.push(...a.reverse().filter((e=>!n(e))))}return t}},78773:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.sendAnalyticsEvent=void 0;const o=n(72920),i=n(50815),a=n(69564);t.sendAnalyticsEvent=function({event:e,timestampISOString:t,splog:n,details:s}){(()=>r(this,void 0,void 0,(function*(){const r=yield(0,i.composeUserConfigFactory)().load(),c=(0,a.composeRequest)({userConfig:r,splog:n});yield c({route:o.API_ROUTES.logActions,params:{actions:[{details:s,name:e,timestamp:t}]},maxRetries:1})})))().catch((e=>{n.error(`sendAnalyticsEvent threw an error: ${e}`)}))}},90980:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.checkAndDisplayGraphiteStatus=t.logInstatusStatusForTesting=void 0;const c=n(85855),u=n(72920),l=i(n(74374)),d=n(56617),f=s(n(80701)),h=n(50815),p=n(69564),m=l.shape({id:l.string,name:l.string,started:l.string,status:l.literals(["INVESTIGATING","IDENTIFIED","MONITORING","RESOLVED"]),impact:l.literals(["OPERATIONAL","PARTIALOUTAGE","MINOROUTAGE","MAJOROUTAGE"]),url:l.string,updatedAt:l.string}),g=l.shape({id:l.string,name:l.string,start:l.string,status:l.literals(["NOTSTARTEDYET","INPROGRESS","COMPLETED"]),duration:l.string,url:l.string,updatedAt:l.string}),v={method:"GET",url:"/summary.json",response:{page:l.shape({name:l.string,url:l.string,status:l.literals(["UP","HASISSUES","UNDERMAINTENANCE"])}),activeIncidents:l.optional(l.array(m)),activeMaintenances:l.optional(l.array(g))}},b={OPERATIONAL:f.default.green,PARTIALOUTAGE:f.default.yellow,MINOROUTAGE:f.default.yellow,MAJOROUTAGE:f.default.red},y={INVESTIGATING:f.default.red,IDENTIFIED:f.default.yellow,MONITORING:f.default.blue,RESOLVED:f.default.green},_={NOTSTARTEDYET:f.default.blue,INPROGRESS:f.default.yellow,COMPLETED:f.default.green},E={OPERATIONAL:"✅",PARTIALOUTAGE:"⚠️",MINOROUTAGE:"⚠️",MAJOROUTAGE:"🔴"};function C(e,t){const{page:n,activeIncidents:r,activeMaintenances:o}=e;if("UP"===n.status)return;const i="HASISSUES"===n.status?f.default.redBright:f.default.blue;t.info(i(`Graphite Status: ${function(e){switch(e){case"UP":return"Up";case"HASISSUES":return"Has Issues";case"UNDERMAINTENANCE":return"Under Maintenance";default:(0,c.assertUnreachable)(e)}}(n.status)} - ${n.url}`)),r&&r.length>0&&(t.info("\n"+f.default.bold.redBright("Active Incidents:")),r.forEach((e=>{const n=y[e.status],r=b[e.impact],o=E[e.impact];t.info(""),t.info(n.bold(`${o} ${e.name}`)),t.info(f.default.gray(`Started: ${new Date(e.started).toLocaleString()}`)),t.info(r(`Impact: ${function(e){switch(e){case"OPERATIONAL":return"Operational";case"PARTIALOUTAGE":return"Partial Outage";case"MINOROUTAGE":return"Minor Outage";case"MAJOROUTAGE":return"Major Outage";default:(0,c.assertUnreachable)(e)}}(e.impact)}`)),t.info(n(`Status: ${function(e){switch(e){case"INVESTIGATING":return"Investigating";case"IDENTIFIED":return"Identified";case"MONITORING":return"Monitoring";case"RESOLVED":return"Resolved";default:(0,c.assertUnreachable)(e)}}(e.status)}`)),t.info(f.default.blueBright(`Details: ${e.url}`))}))),o&&o.length>0&&(t.info("\n"+f.default.bold.blue("Active Maintenance:")),o.forEach((e=>{const n=_[e.status];t.info(""),t.info(n.bold(`🔧 ${e.name}`)),t.info(f.default.gray(`Start: ${new Date(e.start).toLocaleString()}`)),t.info(n(`Status: ${function(e){switch(e){case"NOTSTARTEDYET":return"Not Started Yet";case"INPROGRESS":return"In Progress";case"COMPLETED":return"Completed";default:(0,c.assertUnreachable)(e)}}(e.status)}`)),t.info(f.default.blue(`Details: ${e.url}`))}))),t.info("")}t.logInstatusStatusForTesting=C,t.checkAndDisplayGraphiteStatus=function(e){return a(this,void 0,void 0,(function*(){try{const t=yield d.request.requestWithArgs({route:v,apiServer:"https://status.graphite.dev",params:{}});if(C(t,e),"UP"===t.page.status){const t=yield(0,h.composeUserConfigFactory)().load(),n=(0,p.composeRequest)({userConfig:t,splog:e});try{if(200!==(yield n({route:u.API_ROUTES.health,params:{},maxRetries:1}))._response.status)throw new Error("Health check failed");e.info(f.default.redBright("Your request failed but Graphite's servers are up and running. This is likely a temporary issue."))}catch(t){e.info(f.default.redBright(`${E.PARTIALOUTAGE} Cannot reach Graphite's servers to complete your request`))}}}catch(t){e.error(f.default.red("Failed to fetch Graphite status information")),t instanceof Error&&e.error(f.default.red(t.message))}}))}},36073:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.handleUnexpectedResponseStatus=t.composeRequest=t.checkAndDisplayGraphiteStatus=t.sendAnalyticsEvent=void 0;var r=n(78773);Object.defineProperty(t,"sendAnalyticsEvent",{enumerable:!0,get:function(){return r.sendAnalyticsEvent}});var o=n(90980);Object.defineProperty(t,"checkAndDisplayGraphiteStatus",{enumerable:!0,get:function(){return o.checkAndDisplayGraphiteStatus}});var i=n(69564);Object.defineProperty(t,"composeRequest",{enumerable:!0,get:function(){return i.composeRequest}}),Object.defineProperty(t,"handleUnexpectedResponseStatus",{enumerable:!0,get:function(){return i.handleUnexpectedResponseStatus}})},69564:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.handleUnexpectedResponseStatus=t.composeRequest=t.PUBLIC_DNS_IP_ADDRESS=void 0;const o=n(85855),i=n(56617),a=n(35317),s=n(99833),c=n(5397);function u(e){const{headers:t}=e;return{"x-graphite-request-id":t.get("x-graphite-request-id")}}t.PUBLIC_DNS_IP_ADDRESS="8.8.8.8",t.composeRequest=function({userConfig:e,splog:n}){return d=>r(this,[d],void 0,(function*({route:d,params:f,queryParams:h,urlParams:p,headers:m,maxRetries:g,timeoutMs:v}){const b=e.getAuthToken(),y=e.getApiServerUrl();n.debug("Requesting: "+(0,s.cuteString)({apiServer:y,route:d,params:f,queryParams:h,urlParams:p,headers:m}));try{return yield(0,o.retryWithSleep)({fn:()=>r(this,void 0,void 0,(function*(){const e=yield i.request.requestWithArgs({apiServer:y,route:d,params:f,queryParams:h,urlParams:p,headers:Object.assign({authorization:b?`token ${b}`:void 0},m),timeoutMs:null!=v?v:6e4}),t=u(e._response);return n.debug("Debug headers: "+(0,s.cuteString)(t)),n.debug("Result: "+(0,s.cuteString)({result:e})),e})),onRetry:({retryCount:e,err:t})=>{const{errorMessage:r,errorCause:o}=l(t);if(!(r.includes("fetch failed")&&o.includes("Connect Timeout Error")||r.includes("Request timed out")))throw t;n.debug(`Request timed out, retrying #${e}: ${(0,s.cuteString)({errorMessage:r,errorCause:o})}`)},options:{maxRetries:null!=g?g:3,sleepDuration:{milliseconds:100}}})}catch(e){const{errorMessage:r,errorCause:o}=l(e);n.debug("Request failed: "+(0,s.cuteString)({errorMessage:r,errorCause:o}));const i=function(e){const t=(0,a.spawnSync)("ping",["-c","2","-W","1",e]).stderr.toString();return t?{result:"failure",err:t}:{result:"success"}}(t.PUBLIC_DNS_IP_ADDRESS);if(n.debug(`Pinging ${t.PUBLIC_DNS_IP_ADDRESS} result was a ${"success"===i.result?"success":`failure: ${i.err}`}`),r.includes("fetch failed")){if("failure"===i.result)throw new c.FailedPingError({pingCheck:{ipAddress:t.PUBLIC_DNS_IP_ADDRESS}});throw new c.ConnectionError}throw e}}))},t.handleUnexpectedResponseStatus=function({rawResponse:e,serverUrl:t}){if(401===e.status)throw new c.AuthError(t);const n=u(e),r=Object.entries(n).map((([e,t])=>` ${e}: ${t||"<empty>"}`)).join("\n");throw new c.ExitFailedError(`Unexpected server response (${e.status}).\n\nHeaders:\n${r}\n\nResponse: ${(0,s.cuteString)(e)}`)};const l=e=>e instanceof Error?{errorMessage:e.message,errorCause:"cause"in e&&e.cause&&e.cause instanceof Error?e.cause.message:"Unknown cause"}:{errorMessage:"Unknown error",errorCause:"Unknown cause"}},15901:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRestackDataForBranches=void 0;const o=n(99067);t.getRestackDataForBranches=function(e){return r(this,arguments,void 0,(function*({branchNames:e,context:t}){return Promise.all(e.map((e=>function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){const{branchClient:n}=t,r=n.isBranchFixed({branchName:e});return{branchName:e,isBasedOnTrunk:n.isBranchDirectlyOnTrunk({branchName:e}),isFixed:r,wouldConflict:!r&&(yield(0,o.restackBranchWouldHaveConflict)({branchName:e,context:t}))}}))}({branchName:e,context:t}))))}))}},6211:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeRestackClient=void 0;var r=n(96099);Object.defineProperty(t,"composeRestackClient",{enumerable:!0,get:function(){return r.composeRestackClient}})},79603:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.restackBranch=void 0;const o=n(306);t.restackBranch=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){const{branchClient:n,git:r,userConfig:i}=t,a=n.assertBranchIsValidOrTrunkAndGetMeta({branchName:e});if(n.isBranchFixed({branchName:e}))return{result:"REBASE_UNNEEDED"};(0,o.assertCachedBranchMetadataIsNotTrunk)(a);const s=n.assertBranchExistsAndGetMeta({branchName:a.parentBranchName}).branchRevision,c=i.isCommitterDateIsAuthorDateEnabled();return"REBASE_CONFLICT"===(yield r.rebase({branchName:e,onto:a.parentBranchName,from:a.parentBranchRevision,restackCommitterDateIsAuthorDate:c}))?{result:"REBASE_CONFLICT",rebasedBranchBase:s}:(yield n.handleSuccessfulRebase({branchName:e,parentBranchRevision:s,updateLastSubmittedVersion:!1}),{result:"REBASE_DONE"})}))}},67414:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.restackBranchWithNoConflicts=void 0;const o=n(306);t.restackBranchWithNoConflicts=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){const{branchClient:n,git:r,userConfig:i}=t,a=i.isCommitterDateIsAuthorDateEnabled(),s=n.assertBranchIsValidOrTrunkAndGetMeta({branchName:e});if(n.isBranchFixed({branchName:e}))return"REBASE_UNNEEDED";(0,o.assertCachedBranchMetadataIsNotTrunk)(s);const c=n.assertBranchExistsAndGetMeta({branchName:s.parentBranchName}).branchRevision,u=yield r.cleanRebase({head:e,onto:s.parentBranchName,from:s.parentBranchRevision,restackCommitterDateIsAuthorDate:a});if(!u)return"REBASE_CONFLICT";const l=yield n.updateBranchToSha({branchName:e,sha:u});if("SUCCESS"!==l)return l;if(c){const t=n.assertBranchIsValidAndNotTrunkAndGetMeta({branchName:e});yield n.updateBranchMeta({branchName:e,metadata:Object.assign(Object.assign({},t),{parentBranchRevision:c})})}return"REBASE_DONE"}))}},99067:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.restackBranchWouldHaveConflict=void 0;const o=n(306);t.restackBranchWouldHaveConflict=function(e){return r(this,arguments,void 0,(function*({branchName:e,context:t}){const{branchClient:n,git:r,userConfig:i}=t,a=n.assertBranchIsValidOrTrunkAndGetMeta({branchName:e});if(n.isBranchFixed({branchName:e}))return!1;(0,o.assertCachedBranchMetadataIsNotTrunk)(a),n.assertBranchExists({branchName:a.parentBranchName});const s=i.isCommitterDateIsAuthorDateEnabled();return!(yield r.cleanRebase({head:e,onto:a.parentBranchName,from:a.parentBranchRevision,restackCommitterDateIsAuthorDate:s}))}))}},96099:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeRestackClient=void 0;const r=n(85855),o=n(15901),i=n(79603),a=n(67414),s=n(99067);t.composeRestackClient=function(e){return{getRestackDataForBranches:(0,r.bind)(o.getRestackDataForBranches,{context:e}),restackBranch:(0,r.bind)(i.restackBranch,{context:e}),restackBranchWithNoConflicts:(0,r.bind)(a.restackBranchWithNoConflicts,{context:e}),restackBranchWouldHaveConflict:(0,r.bind)(s.restackBranchWouldHaveConflict,{context:e})}}},9749:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeCachePersistenceFactory=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(306),c=n(98230);t.composeCachePersistenceFactory=({git:e,debug:t})=>{const n=a.default.object({sha:a.default.string().length(40),branches:a.default.array(a.default.tuple([a.default.string(),s.cachedBranchMetadataSchema]))});return(0,c.spiffy)({filepath:i.default.join(e.gitCommonDir,".graphite_cache_persist"),schema:n,initialize:()=>({}),debug:t,helperFunctions:(e,t)=>({getBranches:()=>e.branches,getCachedBranches:()=>e.branches?Object.fromEntries(e.branches.map((([e,t])=>[e,t]))):void 0,getSha:()=>e.sha,persist:e=>r(void 0,[e],void 0,(function*({sha:e,cachedBranches:n}){yield t((t=>{t.sha=e,t.branches=Object.entries(n)}))}))}),options:{removeIfEmpty:!0,removeIfInvalid:!0}})}},59680:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loadAndMaybeClearContinueConfig=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(98230),c=a.default.object({branchesToRestack:a.default.array(a.default.string()),currentBranchOverride:a.default.string().optional(),rebasedBranchBase:a.default.string().optional(),updateLastSubmittedVersion:a.default.boolean().optional(),eventId:a.default.string().optional()});t.loadAndMaybeClearContinueConfig=e=>r(void 0,[e],void 0,(function*({git:e}){const t=u(e),n=yield t.load();return(yield e.rebaseInProgress())?n:(yield n.delete(),t.load())}));const u=e=>(0,s.spiffy)({schema:c,filepath:i.default.join(e.gitDir,".gtcontinue"),initialize:()=>({}),helperFunctions:(e,t)=>({getEventId:()=>e.eventId,getRebasedBranchBase:()=>e.rebasedBranchBase,getBranchesToRestack:()=>e.branchesToRestack,getCurrentBranchOverride:()=>e.currentBranchOverride,getUpdateLastSubmittedVersion:()=>e.updateLastSubmittedVersion,setContinuation:e=>r(void 0,[e],void 0,(function*({currentBranch:e,branchesToRestack:n,rebasedBranchBase:r,updateLastSubmittedVersion:o,eventId:i}){yield t((t=>{t.currentBranchOverride=e,t.branchesToRestack=null!=n?n:[],t.rebasedBranchBase=r,t.updateLastSubmittedVersion=o,t.eventId=i}))})),clearContinuation:()=>r(void 0,void 0,void 0,(function*(){yield t((e=>{e.branchesToRestack=[],e.currentBranchOverride=void 0,e.rebasedBranchBase=void 0,e.updateLastSubmittedVersion=void 0,e.eventId=void 0}))}))}),options:{removeIfEmpty:!0,removeIfInvalid:!0}})},78677:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeFeatureFlagConfigFactory=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(2117),c=n(98230),u={COLLABORATION_UPDATE_FLAG_NAME:!0,MULTITRUNK_ENABLED_FLAG_NAME:!0},l=a.default.object({flags:a.default.array(a.default.object({flagName:a.default.string(),flagValue:a.default.boolean()}))});t.composeFeatureFlagConfigFactory=()=>(0,c.spiffy)({schema:l,filepath:i.default.join((0,s.getGtDataDir)(),"feature_flags"),initialize:()=>({flags:[]}),helperFunctions:(e,t)=>({isAiFeaturesEnabled:()=>d("enableAiFeatures",{featureFlagConfig:{data:e}}),updateFeatureFlags:e=>r(void 0,[e],void 0,(function*({flags:e}){return t((t=>{t.flags=e}))})),getFeatureFlags:()=>e.flags}),options:{removeIfEmpty:!0,removeIfInvalid:!0}});const d=(e,t)=>{var n;const r=t.featureFlagConfig.data.flags;for(const{flagName:t,flagValue:n}of r)if(t===e)return n;return null!==(n=u[e])&&void 0!==n&&n}},50815:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockPrInfoConfig=t.composeGestItForSpiffy=t.composeUserConfigFactory=t.composeMessageConfigFactory=t.spiffyRetype__DEPRECATED=t.spiffy=t.composeRepoConfigFactory=t.composePrInfoConfigFactory=t.composeNuxConfigFactory=t.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS=t.composeMenuBarAppConfigFactory=t.composeLocalPrInfoConfigFactory=t.composeFeatureFlagConfigFactory=t.loadAndMaybeClearContinueConfig=t.composeCachePersistenceFactory=void 0;var r=n(9749);Object.defineProperty(t,"composeCachePersistenceFactory",{enumerable:!0,get:function(){return r.composeCachePersistenceFactory}});var o=n(59680);Object.defineProperty(t,"loadAndMaybeClearContinueConfig",{enumerable:!0,get:function(){return o.loadAndMaybeClearContinueConfig}});var i=n(78677);Object.defineProperty(t,"composeFeatureFlagConfigFactory",{enumerable:!0,get:function(){return i.composeFeatureFlagConfigFactory}});var a=n(68492);Object.defineProperty(t,"composeLocalPrInfoConfigFactory",{enumerable:!0,get:function(){return a.composeLocalPrInfoConfigFactory}});var s=n(39763);Object.defineProperty(t,"composeMenuBarAppConfigFactory",{enumerable:!0,get:function(){return s.composeMenuBarAppConfigFactory}}),Object.defineProperty(t,"DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS",{enumerable:!0,get:function(){return s.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS}});var c=n(61232);Object.defineProperty(t,"composeNuxConfigFactory",{enumerable:!0,get:function(){return c.composeNuxConfigFactory}});var u=n(27072);Object.defineProperty(t,"composePrInfoConfigFactory",{enumerable:!0,get:function(){return u.composePrInfoConfigFactory}});var l=n(86228);Object.defineProperty(t,"composeRepoConfigFactory",{enumerable:!0,get:function(){return l.composeRepoConfigFactory}});var d=n(98230);Object.defineProperty(t,"spiffy",{enumerable:!0,get:function(){return d.spiffy}});var f=n(42296);Object.defineProperty(t,"spiffyRetype__DEPRECATED",{enumerable:!0,get:function(){return f.spiffyRetype__DEPRECATED}});var h=n(49651);Object.defineProperty(t,"composeMessageConfigFactory",{enumerable:!0,get:function(){return h.composeMessageConfigFactory}});var p=n(64957);Object.defineProperty(t,"composeUserConfigFactory",{enumerable:!0,get:function(){return p.composeUserConfigFactory}});var m=n(88196);Object.defineProperty(t,"composeGestItForSpiffy",{enumerable:!0,get:function(){return m.composeGestItForSpiffy}});var g=n(25484);Object.defineProperty(t,"mockPrInfoConfig",{enumerable:!0,get:function(){return g.mockPrInfoConfig}})},68492:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeLocalPrInfoConfigFactory=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(98230),c=a.default.object({localPrInfo:a.default.array(a.default.object({branchName:a.default.string(),localPrTitle:a.default.string().optional(),localPrDescription:a.default.string().optional()}))});t.composeLocalPrInfoConfigFactory=({git:e,debug:t})=>(0,s.spiffy)({schema:c,filepath:i.default.join(e.gitDir,".gtlocalprinfo"),initialize:()=>({localPrInfo:[]}),debug:t,helperFunctions:(e,t)=>{const n=t=>{if(!e.localPrInfo)return{localPrTitle:void 0,localPrDescription:void 0};for(const{branchName:n,localPrTitle:r,localPrDescription:o}of e.localPrInfo)if(t===n)return{localPrTitle:r,localPrDescription:o};return{localPrTitle:void 0,localPrDescription:void 0}},o=n=>r(void 0,void 0,void 0,(function*(){e.localPrInfo&&(yield t((e=>e.localPrInfo=e.localPrInfo.filter((e=>e.branchName!==n)))))}));return{add:i=>r(void 0,[i],void 0,(function*({branchName:r,localPrTitle:i,localPrDescription:a}){const s=n(r);yield o(r);const c=e.localPrInfo||[];c.push({branchName:r,localPrTitle:null!=i?i:s.localPrTitle,localPrDescription:null!=a?a:s.localPrDescription}),yield t((e=>e.localPrInfo=c))})),get:n,remove:o,syncWithLocalBranches:n=>r(void 0,void 0,void 0,(function*(){e.localPrInfo&&(yield t((e=>e.localPrInfo.filter((e=>n.includes(e.branchName))))))}))}},options:{removeIfEmpty:!0,removeIfInvalid:!0}})},39763:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeMenuBarAppConfigFactory=t.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(2117),c=n(98230),u=a.default.object({config:a.default.object({pollingRateInSeconds:a.default.number()})});t.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS=600,t.composeMenuBarAppConfigFactory=()=>(0,c.spiffy)({schema:u,filepath:i.default.join((0,s.getGtDataDir)(),"menu_bar_app_config"),initialize:()=>({config:{pollingRateInSeconds:t.DEFAULT_MENU_BAR_APP_POLLING_RATE_IN_SECONDS}}),helperFunctions:(e,t)=>({updateConfig:e=>r(void 0,[e],void 0,(function*({config:e}){return t((t=>{t.config=e}))})),getConfig:()=>e.config}),options:{removeIfEmpty:!0,removeIfInvalid:!0}})},61232:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeNuxConfigFactory=void 0;const i=o(n(16928)),a=o(n(66469)),s=n(2117),c=n(98230),u=a.default.object({webSubmitNuxCount:a.default.number().optional(),cliFlagNuxCount:a.default.number().optional(),syncNuxCount:a.default.number().optional(),syncForceNuxCount:a.default.number().optional(),undoNuxCount:a.default.number().optional()});t.composeNuxConfigFactory=()=>(0,c.spiffy)({schema:u,filepath:i.default.join((0,s.getGtDataDir)(),"nuxes"),initialize:()=>({}),helperFunctions:(e,t)=>{const n=()=>{var t;return null!==(t=e.cliFlagNuxCount)&&void 0!==t?t:0};return{getCliFlagNuxCount:n,getSyncNuxRemaining:()=>{var t;return 3-(null!==(t=e.syncNuxCount)&&void 0!==t?t:0)},getSyncForceNuxRemaining:()=>{var t;return 1-(null!==(t=e.syncForceNuxCount)&&void 0!==t?t:0)},hasRemainingUndoNux:()=>{var t;return 3-(null!==(t=e.undoNuxCount)&&void 0!==t?t:0)>0},incrementCliFlagNuxCount:()=>r(void 0,void 0,void 0,(function*(){yield t((e=>e.cliFlagNuxCount=n()+1))})),incrementSyncNuxCount:()=>r(void 0,void 0,void 0,(function*(){yield t((e=>{var t;return e.syncNuxCount=(null!==(t=e.syncNuxCount)&&void 0!==t?t:0)+1}))})),incrementSyncForceNuxCount:()=>r(void 0,void 0,void 0,(function*(){yield t((e=>{var t;return e.syncForceNuxCount=(null!==(t=e.syncForceNuxCount)&&void 0!==t?t:0)+1}))})),incrementUndoNuxCount:()=>r(void 0,void 0,void 0,(function*(){yield t((e=>{var t;return e.undoNuxCount=(null!==(t=e.undoNuxCount)&&void 0!==t?t:0)+1}))})),isCliFlagNuxCountMaxed:()=>n()>=5}},options:{removeIfEmpty:!0,removeIfInvalid:!0}})},27072:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composePrInfoConfigFactory=void 0;const c=n(72920),u=i(n(74374)),l=s(n(16928)),d=n(42296),f=u.shape({prInfos:u.array(c.pullRequestInfoShape),mergeabilityStatuses:c.API_ROUTES.mergeabilityStatus.response.mergeabilityStatuses});t.composePrInfoConfigFactory=({git:e,options:t,debug:n})=>{var r,o;const i=l.default.join(e.gitCommonDir,".graphite_pr_info");return(0,d.spiffyRetype__DEPRECATED)({schema:f,filepath:i,initialize:()=>({prInfos:[],mergeabilityStatuses:[]}),debug:n,helperFunctions:(e,t)=>{const r=t=>{var n;return null===(n=e.prInfos)||void 0===n?void 0:n.find(t)},o=e=>r((({headRefName:t})=>t===e)),i=t=>{var n,r;return null===(r=null===(n=e.mergeabilityStatuses)||void 0===n?void 0:n.find((e=>e.prNumber===t)))||void 0===r?void 0:r.mergeabilityStatus};return{clearPrInfos:e=>a(void 0,void 0,void 0,(function*(){yield t((t=>{e.forEach((e=>{var r;const o=t.prInfos.findIndex((t=>t.headRefName===e));if(-1===o)return;null==n||n(`Removing pr info for branch ${e} in clearPrInfos`);const i=null===(r=t.prInfos[o])||void 0===r?void 0:r.prNumber;t.prInfos.splice(o,1);const a=t.mergeabilityStatuses.findIndex((e=>e.prNumber===i));-1!==a&&t.mergeabilityStatuses.splice(a,1)}))}))})),countPrInfos:()=>e.prInfos.length,findPrInfo:r,getMergeabilityStatus:i,getMergeabilityStatusByBranchName:e=>{var t;const n=null===(t=o(e))||void 0===t?void 0:t.prNumber;return n?i(n):void 0},getPrInfo:o,getRemoteVersionNumber:({branchName:e})=>{var t;const n=null===(t=o(e))||void 0===t?void 0:t.versions;if(n)return n.length},mapAllPrInfos:t=>e.prInfos.map(t),saveMergeabilityStatuses:e=>a(void 0,void 0,void 0,(function*(){yield t((t=>{e.forEach((e=>{const n=t.mergeabilityStatuses.find((t=>e.prNumber===t.prNumber));n?Object.assign(n,e):t.mergeabilityStatuses.push(e)}))}))})),savePrInfos:e=>a(void 0,void 0,void 0,(function*(){yield t((t=>{const n=new Set(e.map((e=>e.headRefName)));t.prInfos=t.prInfos.filter((e=>!n.has(e.headRefName))).concat(e)}))})),syncWithLocalBranches:e=>a(void 0,void 0,void 0,(function*(){yield t((t=>{var r,o;const i=t.prInfos.filter((t=>e.includes(t.headRefName))).map((({prNumber:e})=>e)),a=new Set(i);for(const e of i){let i=null===(r=t.prInfos.find((t=>t.prNumber===e)))||void 0===r?void 0:r.dependentPrNumber;const s=new Set;for(;i;){if(s.has(i)){null==n||n(`Infinite loop detected from dependent PR ${i}... Breaking out.`);break}a.add(i),s.add(i),i=null===(o=t.prInfos.find((e=>e.prNumber===i)))||void 0===o?void 0:o.dependentPrNumber}}const s=t.prInfos.filter((e=>!a.has(e.prNumber)));s.length>0&&(null==n||n(`Removing ${s.length} pr infos in syncWithLocalBranches: ${JSON.stringify(s.map((e=>({number:e.prNumber,headRefName:e.headRefName}))))}`)),t.prInfos=t.prInfos.filter((e=>a.has(e.prNumber))),t.mergeabilityStatuses=t.mergeabilityStatuses.filter((e=>a.has(e.prNumber)))}))})),updateExistingPrInfo:e=>a(void 0,void 0,void 0,(function*(){yield t((t=>{e(t.prInfos)}))})),updatePrInfoAndMergeabilityStatus:e=>a(void 0,[e],void 0,(function*({prInfos:e,mergeabilityStatuses:n}){return t((t=>{const r=t.prInfos.filter((t=>!e.some((e=>e.prNumber===t.prNumber))));t.prInfos=r.concat(e);const o=t.mergeabilityStatuses.filter((e=>!n.some((t=>t.prNumber===e.prNumber))));t.mergeabilityStatuses=o.concat(n)}))}))}},options:{removeIfEmpty:null===(r=null==t?void 0:t.removeIfEmpty)||void 0===r||r,removeIfInvalid:null===(o=null==t?void 0:t.removeIfInvalid)||void 0===o||o}})}},86228:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getOwnerAndNameFromUrlForTests=t.composeRepoConfigFactory=void 0;const i=o(n(57372)),a=o(n(16928)),s=o(n(66469)),c=n(5397),u=n(98230),l=s.default.object({name:s.default.string(),targetTrunk:s.default.string().optional()}),d=s.default.object({host:s.default.string().optional(),owner:s.default.string().optional(),name:s.default.string().optional(),trunk:s.default.string().optional(),trunks:s.default.array(l).optional(),remote:s.default.string().optional(),lastFetchedPRInfoMs:s.default.number().optional(),lastSuccessfullyFetchedPRInfoMs:s.default.number().optional(),lastFetchedFeatureFlagsInMs:s.default.number().optional(),userSelectedTemplatePath:s.default.string().optional()});function f(e){const t=/(?:https:\/\/(.*)\/|(?:git\+ssh:\/\/|ssh:\/\/)?(?:git@)?([^:/]*)[:/])([^/]+)\/(.+?)(?:\.git|\/)?$/.exec(e);if(null==t)return null;const[,n,r,o,i]=t;return{owner:o,name:i,hostname:null!=n?n:r}}t.composeRepoConfigFactory=e=>(0,u.spiffy)({schema:d,filepath:a.default.join(e.gitCommonDir,".graphite_repo_config"),initialize:()=>({}),helperFunctions:(t,n)=>{const o=()=>{var e,n;return""===(null===(e=t.remote)||void 0===e?void 0:e.trim())?"origin":null!==(n=t.remote)&&void 0!==n?n:"origin"},s=()=>function(e){return r(this,arguments,void 0,(function*({git:e,remote:t}){const n=yield e.getRemoteUrl({remote:t}).catch((()=>{}));if(!n)return;const r=f(n);return null!==r?{repoOwner:r.owner,repoName:r.name,repoHost:r.hostname}:void 0}))}({git:e,remote:o()}),u=()=>r(void 0,void 0,void 0,(function*(){const e=t.host;if(e)return e;const n=yield s();if(null==n?void 0:n.repoHost)return n.repoHost;throw new c.ExitFailedError("Could not determine the host of this repo (e.g. 'github.com' in the repo 'https://github.com/withgraphite/graphite-cli'). Please use `gt config` to manually set the repo host.")})),l=()=>r(void 0,void 0,void 0,(function*(){const e=t.owner;if(e)return e;const n=yield s();if(null==n?void 0:n.repoOwner)return n.repoOwner;throw new c.ExitFailedError("Could not determine the owner of this repo (e.g. 'withgraphite' in the repo 'withgraphite/graphite-cli'). Please use `gt config` to manually set the repo owner.")})),d=()=>r(void 0,void 0,void 0,(function*(){if(t.name)return t.name;const e=yield s();if(null==e?void 0:e.repoName)return e.repoName;throw new c.ExitFailedError("Could not determine the name of this repo (e.g. 'graphite-cli' in the repo 'withgraphite/graphite-cli'). Please use `gt config` to manually set the repo name.")}));return{getUserSelectedTemplatePath:()=>r(void 0,void 0,void 0,(function*(){if(!t.userSelectedTemplatePath)return;const n=a.default.join(e.repoRoot,t.userSelectedTemplatePath);return(yield i.default.pathExists(n))?n:void 0})),setUserSelectedTemplatePath:t=>r(void 0,[t],void 0,(function*({fullPath:t}){if(!t.startsWith(e.repoRoot))throw new c.ExitFailedError("Template path lies outside repo");const r=a.default.relative(e.repoRoot,t);yield n((e=>e.userSelectedTemplatePath=r))})),getRemote:o,setRemote:e=>r(void 0,void 0,void 0,(function*(){return n((t=>{const n=e.trim();t.remote=n,""===n&&delete t.remote}))})),clearRemote:()=>r(void 0,void 0,void 0,(function*(){return n((e=>{delete e.remote}))})),addTrunk:e=>r(void 0,void 0,void 0,(function*(){yield n((t=>{var n;const r=null!==(n=t.trunks)&&void 0!==n?n:[];r.some((t=>t.name===e))||(t.trunks=r.concat({name:e}))}))})),getTrunk:()=>t.trunk,removeTrunk:e=>r(void 0,void 0,void 0,(function*(){yield n((t=>{var n;t.trunk===e&&(t.trunk=void 0),t.trunks=null===(n=t.trunks)||void 0===n?void 0:n.filter((t=>t.name!==e))}))})),setTrunk:e=>r(void 0,void 0,void 0,(function*(){yield n((t=>{t.trunk=e,t.trunks=[{name:e}]}))})),getTargetTrunk:e=>{var n,r;return null===(r=null===(n=t.trunks)||void 0===n?void 0:n.find((t=>t.name===e)))||void 0===r?void 0:r.targetTrunk},setTargetTrunk:e=>r(void 0,[e],void 0,(function*({cliTrunkName:e,targetTrunk:t}){yield n((n=>{var r;const o=(null!==(r=n.trunks)&&void 0!==r?r:[]).find((t=>t.name===e));if(!o)throw new c.ExitFailedError(`Could not find configured trunk ${e} to set target trunk for.`);Object.assign(o,{targetTrunk:t})}))})),countTrunks:()=>{var e,n;return null!==(n=null===(e=t.trunks)||void 0===e?void 0:e.length)&&void 0!==n?n:0},getTrunkNames:()=>{var e,n,r;return null!==(n=null===(e=t.trunks)||void 0===e?void 0:e.map((({name:e})=>e)))&&void 0!==n?n:[null!==(r=t.trunk)&&void 0!==r?r:"Missing trunk"]},getTargetTrunks:()=>{var e,n;return null!==(n=null===(e=t.trunks)||void 0===e?void 0:e.map((({targetTrunk:e})=>e)))&&void 0!==n?n:[]},getTrunks:()=>t.trunks,graphiteInitialized:()=>{var e;return Boolean(t.trunk||(null===(e=t.trunks)||void 0===e?void 0:e.length))},getInferredRepoInfo:s,getRepoHost:u,getRepoNameAndOwnerIfPresent:()=>r(void 0,void 0,void 0,(function*(){var e,n;if(t.owner&&t.name)return{owner:t.owner,name:t.name};const r=yield s(),o=null!==(e=t.owner)&&void 0!==e?e:null==r?void 0:r.repoOwner,i=null!==(n=t.name)&&void 0!==n?n:null==r?void 0:r.repoName;return o&&i?{owner:o,name:i}:void 0})),getRepoOwner:l,getRepoOwnerOrUndefined:()=>{var e;return null!==(e=t.owner)&&void 0!==e?e:void 0},getRepoName:d,getRepoNameOrUndefined:()=>{var e;return null!==(e=t.name)&&void 0!==e?e:void 0},getRepoInfo:()=>r(void 0,void 0,void 0,(function*(){const n=t.trunk;if(!n)throw new Error("Repo not initialized");return{remote:yield r(void 0,void 0,void 0,(function*(){try{const[e,t,n]=yield Promise.all([u(),l(),d()]);return{hostname:e,owner:t,name:n}}catch(e){return}})),dotDir:e.gitCommonDir,rootDir:e.repoRoot,trunkBranch:n}})),setRepo:e=>r(void 0,[e],void 0,(function*({owner:e,name:t}){return n((n=>{n.owner=null!=e?e:n.owner,n.name=null!=t?t:n.name}))})),clearRepoName:()=>r(void 0,void 0,void 0,(function*(){return n((e=>{delete e.name}))})),clearRepoOwner:()=>r(void 0,void 0,void 0,(function*(){return n((e=>{delete e.owner}))})),getLastFetchedFeatureFlagsInMs:()=>t.lastFetchedFeatureFlagsInMs,updateLastFetchedFeatureFlags:e=>r(void 0,[e],void 0,(function*({ms:e}){return n((t=>{t.lastFetchedFeatureFlagsInMs=e}))})),getLastFetchedPrInfoInMs:()=>t.lastFetchedPRInfoMs,updateLastFetchedPrInfo:e=>r(void 0,[e],void 0,(function*({ms:e}){return n((t=>{t.lastFetchedPRInfoMs=e}))}))}}}),t.getOwnerAndNameFromUrlForTests=f},98230:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spiffy=void 0;const i=o(n(57372)),a=n(99833),s=n(5397);t.spiffy=function(e){const t=()=>r(this,void 0,void 0,(function*(){var t;const n=yield function(e){return r(this,arguments,void 0,(function*({filePath:e,oldFilepath:t,schema:n,initialize:r,removeIfInvalid:o,debug:a}){null==a||a(`Reading JSON for ${e}`);const c=e&&(yield i.default.pathExists(e));t&&(yield i.default.pathExists(t))&&(null==a||a(`Migrating old JSON for ${e}`),c?i.default.removeSync(t):i.default.moveSync(t,e));try{if(!c)return r();const t=yield i.default.readJson(e),o=n.safeParse(t);if(!o.success)throw new Error("Malformed data");return null==a||a(`Successfully parsed JSON at ${e}`),o.data}catch(t){if(null==a||a(`Failed to parse JSON at ${e}`),o)return null==a||a(`Removing invalid JSON and re-initializing ${e}`),yield i.default.remove(e),r();throw new s.ExitFailedError(`Malformed JSON at ${e}`)}}))}({filePath:e.filepath,oldFilepath:e.oldFilepath,schema:e.schema,initialize:e.initialize,removeIfInvalid:(null===(t=e.options)||void 0===t?void 0:t.removeIfInvalid)||!1,debug:e.debug});return Object.assign({path:e.filepath,delete:()=>r(this,void 0,void 0,(function*(){(yield i.default.pathExists(e.filepath))&&(yield i.default.remove(e.filepath))}))},e.helperFunctions(n,(t=>r(this,void 0,void 0,(function*(){var r;t(n),(null===(r=e.options)||void 0===r?void 0:r.removeIfEmpty)&&(0,a.cuteString)(n)===(0,a.cuteString)({})?yield i.default.remove(e.filepath):yield i.default.outputFile(e.filepath,(0,a.cuteString)(n),{mode:384})})))))}));return{load:t,loadIfExists:()=>r(this,void 0,void 0,(function*(){if(yield i.default.pathExists(e.filepath))return t()}))}}},42296:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spiffyRetype__DEPRECATED=void 0;const i=o(n(57372)),a=n(99833),s=n(5397);t.spiffyRetype__DEPRECATED=function(e){const t=()=>r(this,void 0,void 0,(function*(){var t;const n=yield function(e){return r(this,arguments,void 0,(function*({filePath:e,oldFilepath:t,schema:n,initialize:r,removeIfInvalid:o,debug:a}){null==a||a(`Reading JSON for ${e}`);const c=e&&(yield i.default.pathExists(e));t&&(yield i.default.pathExists(t))&&(null==a||a(`Migrating old JSON for ${e}`),c?i.default.removeSync(t):i.default.moveSync(t,e));try{const t=c?yield i.default.readJson(e):r();if(!n(t,{logFailures:!1}))throw null==a||a(`Malformed data for ${e}: `+JSON.stringify(t)),new Error("Malformed data");return null==a||a(`Successfully parsed JSON at ${e}`),t}catch(t){if(null==a||a(`Failed to parse JSON at ${e}`),o)return null==a||a(`Removing invalid JSON and re-initializing ${e}`),yield i.default.remove(e),r();throw new s.ExitFailedError(`Malformed JSON at ${e}`)}}))}({filePath:e.filepath,oldFilepath:e.oldFilepath,schema:e.schema,initialize:e.initialize,removeIfInvalid:(null===(t=e.options)||void 0===t?void 0:t.removeIfInvalid)||!1,debug:e.debug});return Object.assign({path:e.filepath,delete:()=>r(this,void 0,void 0,(function*(){(yield i.default.pathExists(e.filepath))&&(yield i.default.remove(e.filepath))}))},e.helperFunctions(n,(t=>r(this,void 0,void 0,(function*(){var r;t(n),(null===(r=e.options)||void 0===r?void 0:r.removeIfEmpty)&&(0,a.cuteString)(n)===(0,a.cuteString)({})?yield i.default.remove(e.filepath):yield i.default.outputFile(e.filepath,(0,a.cuteString)(n),{mode:384})})))))}));return{load:t,loadIfExists:()=>r(this,void 0,void 0,(function*(){if(yield i.default.pathExists(e.filepath))return t()}))}}},88196:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGestItForSpiffy=void 0;const i=n(80725),a=o(n(57372)),s=o(n(27836));t.composeGestItForSpiffy=({createData:e})=>(t,n)=>{(0,i.describe)("",(()=>{let o,c;(0,i.before)((()=>r(void 0,void 0,void 0,(function*(){var t;o=s.default.dirSync(),c=null!==(t=yield null==e?void 0:e({tmpDir:o}))&&void 0!==t?t:{}})))),(0,i.it)(t,(()=>r(void 0,void 0,void 0,(function*(){if(!o)throw new Error("Failed to initialize tmpDir");if(void 0===c)throw new Error("Failed to initialize testData");yield n({tmpDir:o,testData:c})})))),(0,i.after)((()=>{o&&(a.default.emptyDirSync(o.name),o.removeCallback())}))}))}},25484:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockPrInfoConfig=void 0;const r=n(85855),o=n(22650);t.mockPrInfoConfig=function({overrides:e,prInfoMap:t}){return(0,o.fromPartial)(Object.assign({getPrInfo:e=>null==t?void 0:t[e],findPrInfo:e=>Object.values(null!=t?t:{}).filter(r.filterUndefined).find(e)},e))}},49651:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeMessageConfigFactory=void 0;const o=r(n(16928)),i=r(n(66469)),a=n(2117),s=n(98230),c=i.default.object({message:i.default.object({contents:i.default.string(),cliVersion:i.default.string()}).optional()});t.composeMessageConfigFactory=()=>(0,s.spiffy)({schema:c,filepath:o.default.join((0,a.getGtDataDir)(),"upgrade_message"),initialize:()=>({message:void 0}),helperFunctions:(e,t)=>({clearMessage:()=>t((e=>{e.message=void 0})),getMessage:()=>e.message,setMessage:e=>t((t=>{t.message=e}))}),options:{removeIfEmpty:!0,removeIfInvalid:!0}})},64957:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeUserConfigFactory=void 0;const i=n(85855),a=o(n(70857)),s=o(n(16928)),c=o(n(66469)),u=n(5397),l=n(2117),d=n(98230),f=c.default.object({branchPrefix:c.default.string().optional(),branchDate:c.default.boolean().optional(),branchReplacement:c.default.union([c.default.literal("_"),c.default.literal("-"),c.default.literal("")]).optional(),skipApplyingPrefixToNonGeneratedBranchNames:c.default.boolean().optional(),allowSlashesInGeneratedBranchNames:c.default.boolean().optional(),allowUpperCaseInGeneratedBranchNames:c.default.boolean().optional(),authToken:c.default.string().optional(),tips:c.default.boolean().optional(),yubikey:c.default.boolean().optional(),editor:c.default.string().optional(),pager:c.default.string().optional(),restackCommitterDateIsAuthorDate:c.default.boolean().optional(),submitIncludeCommitMessages:c.default.boolean().optional(),excludeTemplatesWithCommitMessages:c.default.boolean().optional(),submitViaCli:c.default.boolean().optional(),connectCliToLocalServer:c.default.boolean().optional(),gtiConfigs:c.default.array(c.default.object({key:c.default.string(),value:c.default.string()})).optional(),alternativeProfiles:c.default.array(c.default.object({name:c.default.string(),hostPrefix:c.default.string(),authToken:c.default.string().optional()})).optional(),systemTrayConfig:c.default.object({sections:c.default.array(c.default.object({sectionId:c.default.string(),display:c.default.boolean()}))}).optional(),debugExpiryMs:c.default.number().optional()});t.composeUserConfigFactory=()=>(0,d.spiffy)({schema:f,oldFilepath:s.default.join(a.default.homedir(),".graphite_user_config"),filepath:s.default.join((0,l.getGtConfigDir)(),"user_config"),initialize:()=>({}),helperFunctions:(e,t)=>{const n=()=>{var t,n,r;if(!process.env.GRAPHITE_PROFILE)return null!==(n=null===(t=e.alternativeProfiles)||void 0===t?void 0:t.find((e=>"default"===e.name)))&&void 0!==n?n:null;const o=null===(r=e.alternativeProfiles)||void 0===r?void 0:r.find((e=>e.name===process.env.GRAPHITE_PROFILE));if(!o)throw new Error(`Unknown profile ${process.env.GRAPHITE_PROFILE}`);return o},o=()=>{var e;const t=null===(e=n())||void 0===e?void 0:e.hostPrefix;return t?`https://app.${t}.graphite.dev`:"https://app.graphite.dev"},a=()=>`${o()}/activate`,s=()=>{var t,r;return null!==(r=null===(t=n())||void 0===t?void 0:t.authToken)&&void 0!==r?r:e.authToken};return{getApiServerUrl:()=>{var t;if(e.connectCliToLocalServer)return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0","https://localhost:8000/v1";const r=null===(t=n())||void 0===t?void 0:t.hostPrefix;return r?`https://api.${r}.graphite.dev/v1`:"https://api.graphite.dev/v1"},getAppServerUrl:o,getAuthToken:s,setAuthToken:e=>r(void 0,void 0,void 0,(function*(){var r;const o=null===(r=n())||void 0===r?void 0:r.name;yield t(o?t=>{var n;const r=null===(n=t.alternativeProfiles)||void 0===n?void 0:n.find((({name:e})=>e===o));if(!r)throw new Error(`Unknown profile ${o}`);r.authToken=e}:t=>t.authToken=e)})),getProfileName:()=>{var e;return null===(e=n())||void 0===e?void 0:e.name},authTokenPrecondition:()=>{const e=s();if(!e||0===e.length)throw new u.PreconditionsFailedError(`Please authenticate your Graphite CLI by visiting ${a()}`)},getDefaultPrDescriptionBehavior:()=>e.submitIncludeCommitMessages?e.excludeTemplatesWithCommitMessages?"messages":"both":"template",getSubmitViaCli:()=>{var t;return null!==(t=e.submitViaCli)&&void 0!==t&&t},getCLIAuthUrl:a,setSectionConfig:e=>r(void 0,[e],void 0,(function*({sectionId:e,display:n}){yield t((t=>{var r,o,i;t.systemTrayConfig&&(t.systemTrayConfig.sections=null===(r=t.systemTrayConfig)||void 0===r?void 0:r.sections.filter((t=>t.sectionId!==e))),t.systemTrayConfig={sections:[...null!==(i=null===(o=t.systemTrayConfig)||void 0===o?void 0:o.sections)&&void 0!==i?i:[],{sectionId:e,display:n}]}}))})),getSectionConfig:t=>{var n;const r=null===(n=e.systemTrayConfig)||void 0===n?void 0:n.sections.find((e=>t===e.sectionId));return null!=r?r:{sectionId:t,display:!0}},getGtiConfigValue:t=>{var n,r;return null===(r=null===(n=e.gtiConfigs)||void 0===n?void 0:n.find((e=>e.key===t)))||void 0===r?void 0:r.value},setGtiConfigValue:(e,n)=>r(void 0,void 0,void 0,(function*(){return t((t=>{t.gtiConfigs||(t.gtiConfigs=[]),t.gtiConfigs=[...t.gtiConfigs.filter((({key:t})=>t!==e)),{key:e,value:n}]}))})),getDebugExpiryMs:()=>{var t;return null!==(t=e.debugExpiryMs)&&void 0!==t?t:864e5},initialized:()=>!(0,i.isEmptyObject)(e),getBranchReplacement:()=>{var t;return null!==(t=e.branchReplacement)&&void 0!==t?t:"_"},setBranchReplacement:e=>r(void 0,[e],void 0,(function*({replacement:e}){return t((t=>{t.branchReplacement=e}))})),setBranchPrefix:e=>r(void 0,[e],void 0,(function*({prefix:e}){return t((t=>{t.branchPrefix=e}))})),getBranchPrefix:()=>e.branchPrefix,enableBranchDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.branchDate=!0}))})),disableBranchDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.branchDate=!1}))})),toggleBranchDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.branchDate=!e.branchDate}))})),isBranchDateEnabled:()=>{var t;return null===(t=e.branchDate)||void 0===t||t},toggleSkipPrefixToNonGeneratedBranchNames:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.skipApplyingPrefixToNonGeneratedBranchNames=!e.skipApplyingPrefixToNonGeneratedBranchNames}))})),isSkipPrefixToNonGeneratedBranchNamesEnabled:()=>{var t;return null!==(t=e.skipApplyingPrefixToNonGeneratedBranchNames)&&void 0!==t&&t},toggleAllowSlashesInGeneratedBranchNames:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.allowSlashesInGeneratedBranchNames=!e.allowSlashesInGeneratedBranchNames}))})),isAllowSlashesInGeneratedBranchNamesEnabled:()=>{var t;return null!==(t=e.allowSlashesInGeneratedBranchNames)&&void 0!==t&&t},toggleAllowUpperCaseInGeneratedBranchNames:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.allowUpperCaseInGeneratedBranchNames=!e.allowUpperCaseInGeneratedBranchNames}))})),isAllowUpperCaseInGeneratedBranchNamesEnabled:()=>{var t;return null!==(t=e.allowUpperCaseInGeneratedBranchNames)&&void 0!==t&&t},setGtEditor:e=>r(void 0,[e],void 0,(function*({editor:e}){return t((t=>{t.editor=e}))})),unsetGtEditor:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.editor=void 0}))})),getGtEditor:()=>e.editor,setGtPager:e=>r(void 0,[e],void 0,(function*({pager:e}){return t((t=>{t.pager=e}))})),disableGtPager:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.pager=""}))})),unsetGtPager:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.pager=void 0}))})),getGtPager:()=>e.pager,disableCommitterDateIsAuthorDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.restackCommitterDateIsAuthorDate=!1}))})),enableCommitterDateIsAuthorDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.restackCommitterDateIsAuthorDate=!0}))})),toggleCommitterDateIsAuthorDate:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.restackCommitterDateIsAuthorDate=!e.restackCommitterDateIsAuthorDate}))})),isCommitterDateIsAuthorDateEnabled:()=>{var t;return null!==(t=e.restackCommitterDateIsAuthorDate)&&void 0!==t&&t},disableIncludeCommitMessagesInSubmit:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.submitIncludeCommitMessages=!1}))})),enableIncludeCommitMessagesInSubmit:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.submitIncludeCommitMessages=!0}))})),isIncludeCommitMessagesEnabled:()=>{var t;return null!==(t=e.submitIncludeCommitMessages)&&void 0!==t&&t},isExcludeTemplatesWithCommitMessagesEnabled:()=>{var t;return null!==(t=e.excludeTemplatesWithCommitMessages)&&void 0!==t&&t},enableExcludeTemplatesWithCommitMessages:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.excludeTemplatesWithCommitMessages=!0}))})),disableExcludeTemplatesWithCommitMessages:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.excludeTemplatesWithCommitMessages=!1}))})),toggleSubmitViaCli:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.submitViaCli=!e.submitViaCli}))})),isSubmitViaCliEnabled:()=>{var t;return null!==(t=e.submitViaCli)&&void 0!==t&&t},areTipsEnabled:()=>{var t;return null===(t=e.tips)||void 0===t||t},enableTips:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.tips=!0}))})),disableTips:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.tips=!1}))})),toggleTips:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.tips=!e.tips}))})),disableYubikey:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.yubikey=!1}))})),enableYubikey:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.yubikey=!0}))})),isYubikeyEnabled:()=>{var t;return null!==(t=e.yubikey)&&void 0!==t&&t},toggleYubikey:()=>r(void 0,void 0,void 0,(function*(){return t((e=>{e.yubikey=!e.yubikey}))}))}}})},74053:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeCliSplog=void 0;const r=n(16928),o=n(2117),i=n(36868);t.composeCliSplog=({cliVersion:e,options:t})=>{const n=(0,r.join)((0,o.getGtDataDir)(),"debug"),a=(0,r.join)(n,`${Date.now()}.log`);return(0,i.buildSplog)({cliVersion:e,logFn:e=>console.log(e),errFn:e=>console.error(e),debugFile:{dir:n,filename:a},options:t})}},65825:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeFileSplog=void 0;const o=r(n(79896)),i=n(36868);t.composeFileSplog=({cliVersion:e,filename:t})=>{const n=e=>{o.default.promises.appendFile(t,`${e}\n`)};return(0,i.buildSplog)({cliVersion:e,logFn:n,errFn:n})}},63959:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMockSplog=t.composeOutputChannelSplog=t.composeFileSplog=t.composeCliSplog=void 0;var r=n(74053);Object.defineProperty(t,"composeCliSplog",{enumerable:!0,get:function(){return r.composeCliSplog}});var o=n(65825);Object.defineProperty(t,"composeFileSplog",{enumerable:!0,get:function(){return o.composeFileSplog}});var i=n(57010);Object.defineProperty(t,"composeOutputChannelSplog",{enumerable:!0,get:function(){return i.composeOutputChannelSplog}});var a=n(8333);Object.defineProperty(t,"createMockSplog",{enumerable:!0,get:function(){return a.createMockSplog}})},57010:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeOutputChannelSplog=void 0;const r=n(36868);t.composeOutputChannelSplog=({cliVersion:e,outputChannel:t})=>(0,r.buildSplog)({cliVersion:e,logFn:t.info,errFn:t.error})},36868:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildSplog=void 0;const o=n(68263),i=r(n(80701)),a=r(n(57372));t.buildSplog=({cliVersion:e,logFn:t,errFn:n,debugFile:r,options:u})=>{const l=r&&function({debugFile:e,options:t}){return!("SERVER_MODE_LAMBDA"===(0,o.getCurrentServerMode)()||!e||(null==t?void 0:t.skipDebugLogFile))}({debugFile:r,options:u})?e=>a.default.appendFileSync(r.filename,e+"\n"):void 0,d=e=>{null==l||l(i.default.reset(e)),t(e)},f=e=>{null==l||l(i.default.reset(e)),n(e)};return l&&r&&(a.default.outputFileSync(r.filename,process.argv.join("\n")+"\n"),l(`CLI version: ${e}`)),(null==u?void 0:u.outputDebugLogs)&&f(i.default.gray(`Debug logs for every command are written to ${null==r?void 0:r.dir}. The \`--debug\` flag enables also printing them to the terminal.`)),Object.assign(Object.assign({logToStdErr:e=>{(null==u?void 0:u.quiet)||f(e)}},s({logFn:d,errFn:f,writeToDebugFile:l,options:u})),c({log:d,err:f,options:u}))};const s=({logFn:e,errFn:t,writeToDebugFile:n,options:r})=>{const o=e=>{const o=`${(new Date).toISOString()}: ${e}`;null==n||n(o),(null==r?void 0:r.outputDebugLogs)&&t(i.default.gray(o))};return{error:(e,n)=>t(i.default.redBright(`ERROR: ${e} ${n?JSON.stringify(n):""}`)),warn:e=>t(i.default.yellow(`WARNING: ${e}`)),info:t=>{(null==r?void 0:r.quiet)||e(t)},debug:o,trace:e=>{o(e)}}},c=({log:e,err:t,options:n})=>({employee:t=>{(null==n?void 0:n.isEmployee)&&e(i.default.magenta(`\nEMPLOYEES ONLY: ${t}\n`))},newline:()=>{(null==n?void 0:n.quiet)||e("")},stderr:e=>{t(e)},stdout:t=>{e(t)},tip:e=>{(null==n?void 0:n.tips)&&!(null==n?void 0:n.quiet)&&t(i.default.gray(["",`${i.default.bold("tip")}: ${e}`,i.default.italic("Feeling like an expert? Disable tips in `gt config`"),""].join("\n")))},yubikeyReminder:()=>{(null==n?void 0:n.yubikey)&&t(i.default.bold("Please tap your YubiKey each time it flashes to continue"))}})},8333:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMockSplog=void 0;const r=n(36868);t.createMockSplog=()=>{let e="",t="";const n=(0,r.buildSplog)({cliVersion:"TEST",logFn:t=>{e+=t+"\n"},errFn:e=>{t+=e+"\n"}});return Object.assign(Object.assign({},n),{getStdout:()=>e,getStderr:()=>t})}},65500:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testDataFactory=void 0;var r=n(71715);Object.defineProperty(t,"testDataFactory",{enumerable:!0,get:function(){return r.testDataFactory}})},58:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CachedBranchMetadataBuilder=t.buildCachedBranchMetadata=void 0;const r=n(51343),o=n(85855);t.buildCachedBranchMetadata=()=>new i;class i{constructor(){this._children=[],this._branchRevision=r.faker.git.commitSha(),this._lastSubmittedVersion=void 0,this._validationResult="VALID",this._parentBranchName="main",this._parentBranchRevision=r.faker.git.commitSha()}add_child(e){return this._children.push(e),this}children(e){return this._children=e,this}branchRevision(e){return this._branchRevision=e,this}lastSubmittedVersion(e){return this._lastSubmittedVersion=e,this}validationResult(e){return this._validationResult=e,this}parentBranchName(e){return this._parentBranchName=e,this}parentBranchRevision(e){return this._parentBranchRevision=e,this}build(){const e={children:this._children,branchRevision:this._branchRevision,lastSubmittedVersion:this._lastSubmittedVersion};switch(this._validationResult){case"VALID":if(!this._parentBranchName||!this._parentBranchRevision)throw new Error("Parent branch name and revision are required for VALID validation result");return Object.assign(Object.assign({},e),{validationResult:"VALID",parentBranchName:this._parentBranchName,parentBranchRevision:this._parentBranchRevision});case"INVALID_PARENT":case"BAD_PARENT_REVISION":if(!this._parentBranchName)throw new Error(`Parent branch name is required for ${this._validationResult} validation result`);return Object.assign(Object.assign({},e),{validationResult:this._validationResult,parentBranchName:this._parentBranchName,parentBranchRevision:this._parentBranchRevision});case"BAD_PARENT_NAME":case"TRUNK":return Object.assign(Object.assign({},e),{validationResult:this._validationResult});default:(0,o.assertUnreachable)(this._validationResult)}}}t.CachedBranchMetadataBuilder=i},41148:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VersionBuilder=t.PrInfoBuilder=t.buildVersion=t.buildPrInfo=void 0;const r=n(51343);t.buildPrInfo=()=>new o,t.buildVersion=()=>new i;class o{constructor(){this._baseRefName=r.faker.git.branch(),this._body=r.faker.lorem.paragraph(),this._cliTrunk=void 0,this._dependentPrNumber=void 0,this._headRefName=r.faker.git.branch(),this._isDraft=!1,this._prNumber=1,this._reviewDecision=null,this._state="OPEN",this._title=r.faker.lorem.sentence(),this._url=r.faker.internet.url(),this._versions=[]}versions(e){return void 0!==e&&(this._versions=e),this}cliTrunk(e){return this._cliTrunk=e,this}dependentPrNumber(e){return this._dependentPrNumber=e,this}headRefName(e){return this._headRefName=e,this}prNumber(e){return this._prNumber=e,this}state(e){return this._state=e,this}build(){return{prNumber:this._prNumber,title:this._title,body:this._body,state:this._state,reviewDecision:this._reviewDecision,headRefName:this._headRefName,baseRefName:this._baseRefName,url:this._url,isDraft:this._isDraft,versions:this._versions,cliTrunk:this._cliTrunk,dependentPrNumber:this._dependentPrNumber}}}t.PrInfoBuilder=o;class i{constructor(){this._headSha=r.faker.git.commitSha(),this._baseSha=r.faker.git.commitSha(),this._baseName=r.faker.git.branch(),this._createdAt=r.faker.date.past().toISOString(),this._authorGithubHandle=r.faker.internet.userName(),this._isGraphiteGenerated=void 0}headSha(e){return this._headSha=e,this}baseSha(e){return this._baseSha=e,this}baseName(e){return this._baseName=e,this}createdAt(e){return this._createdAt=e,this}isGraphiteGenerated(e){return this._isGraphiteGenerated=e,this}build(){return{headSha:this._headSha,baseSha:this._baseSha,baseName:this._baseName,createdAt:this._createdAt,authorGithubHandle:this._authorGithubHandle,isGraphiteGenerated:this._isGraphiteGenerated}}}t.VersionBuilder=i},71715:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testDataFactory=void 0;const r=n(58),o=n(41148);t.testDataFactory={branchMetadata:{buildCachedBranchMetadata:r.buildCachedBranchMetadata},prInfo:{buildPrInfo:o.buildPrInfo,buildVersion:o.buildVersion}}},89359:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.tracer=void 0;const r=o();function o(){return Math.ceil(1e9*Math.random())}function i(e){return null!=e}const a=BigInt(Date.now())*BigInt(1e6)-process.hrtime.bigint();function s(){return process.hrtime.bigint()+a}class c{constructor(e){this.name=e.name,this.parentId=e.parentId,this.resource=e.resource,this.meta=e.meta,this.spanId=o(),this.start=s()}end(e,t){this.endedSpan=Object.assign({error:t?1:0,meta:Object.assign(Object.assign(Object.assign({},"string"==typeof e?{result:e}:Object.assign({},e)),t?Object.assign({"error.msg":t.message,"error.type":t.constructor.name},t.stack?{"error.stack":t.stack}:{}):{}),this.meta),metrics:{},name:this.name,resource:this.resource,service:"graphite-cli",span_id:this.spanId,start:Number(this.start),trace_id:r,type:"custom",duration:Number(s()-this.start)},this.parentId?{parent_id:this.parentId}:{parent_id:0})}}t.tracer=new class{constructor(){this.allSpans=[]}startSpan(e){const t=new c(Object.assign(Object.assign({},e),this.currentSpanId?{parentId:this.currentSpanId}:{}));return this.allSpans.push(t),t}span(e,t){return n(this,void 0,void 0,(function*(){const n=this.startSpan(e);let r;this.currentSpanId=n.spanId;try{r=yield t()}catch(e){throw n.end(r,e instanceof Error?e:new Error("unknown error")),e}return n.end(r),this.currentSpanId=n.parentId,r}))}flushJson(){let e=this.allSpans.map((e=>e.endedSpan)).filter(i);const t=e.find((e=>"command"===e.name));t&&(e=e.map((e=>Object.assign(Object.assign({},e),void 0!==e.parent_id?{parent_id:e.parent_id}:{parent_id:t.span_id}))));const n=[e];return this.allSpans=this.allSpans.filter((e=>!e.endedSpan)),JSON.stringify(n)}}},87855:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getTrunksFromPrInfo=void 0;const r=n(85855);t.getTrunksFromPrInfo=function({prInfos:e,context:t}){const{branchClient:n,gtCache:o}=t,i=e.map((e=>{var t;return null!==(t=e.cliTrunk)&&void 0!==t?t:n.getTrunkForBranchOrNull({branchName:e.headRefName})}));return[...new Set([...i.filter(r.filterNullUndefined),...i.some((e=>!e))?o.getTrunkNamesOrThrow():[]])]}},48926:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getTrunksToSync=void 0;const r=n(85855),o=n(87855);t.getTrunksToSync=function({prInfos:e,all:t,context:n}){const{gtCache:i}=n,a=(0,o.getTrunksFromPrInfo)({prInfos:e,context:n});return(0,r.dedup)([...a,...t||0===a.length?i.getTrunkNamesOrThrow():[]],(e=>e)).filter((e=>i.isBranchTrunk({branchName:e})))}},4644:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeTrunkClient=void 0;var r=n(49946);Object.defineProperty(t,"composeTrunkClient",{enumerable:!0,get:function(){return r.composeTrunkClient}})},49946:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeTrunkClient=void 0;const r=n(85855),o=n(87855),i=n(48926);t.composeTrunkClient=function(e){return{getTrunksFromPrInfo:(0,r.bind)(o.getTrunksFromPrInfo,{context:e}),getTrunksToSync:(0,r.bind)(i.getTrunksToSync,{context:e})}}},16305:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.STACK_SCOPE=void 0;var r=n(20131);Object.defineProperty(t,"STACK_SCOPE",{enumerable:!0,get:function(){return r.STACK_SCOPE}})},20131:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.STACK_SCOPE=void 0,t.STACK_SCOPE={BRANCH:{recursiveParents:!1,currentBranch:!0,recursiveChildren:!1},DOWNSTACK:{recursiveParents:!0,currentBranch:!0,recursiveChildren:!1},STACK:{recursiveParents:!0,currentBranch:!0,recursiveChildren:!0},UPSTACK:{recursiveParents:!1,currentBranch:!0,recursiveChildren:!0},UPSTACK_EXCLUSIVE:{recursiveParents:!1,currentBranch:!1,recursiveChildren:!0}}},34872:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getWorktreeWithBranchCheckedOut=void 0,t.getWorktreeWithBranchCheckedOut=e=>n(void 0,[e],void 0,(function*({branchName:e,context:t}){const{git:n}=t;return(yield n.listWorktrees()).find((t=>t.branch===e))}))},35843:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockWorktreeClient=t.composeWorktreeClient=void 0;var r=n(73774);Object.defineProperty(t,"composeWorktreeClient",{enumerable:!0,get:function(){return r.composeWorktreeClient}});var o=n(60611);Object.defineProperty(t,"mockWorktreeClient",{enumerable:!0,get:function(){return o.mockWorktreeClient}})},80637:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchCheckedOutInAnotherWorktree=void 0;const o=n(34872);t.isBranchCheckedOutInAnotherWorktree=e=>r(void 0,[e],void 0,(function*({branchName:e,context:t}){const{cache:n}=t;return e!==n.getCurrentBranch()&&!!(yield(0,o.getWorktreeWithBranchCheckedOut)({branchName:e,context:t}))}))},73774:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeWorktreeClient=void 0;const r=n(85855),o=n(34872),i=n(80637);t.composeWorktreeClient=e=>({getWorktreeWithBranchCheckedOut:(0,r.bind)(o.getWorktreeWithBranchCheckedOut,{context:e}),isBranchCheckedOutInAnotherWorktree:(0,r.bind)(i.isBranchCheckedOutInAnotherWorktree,{context:e})})},60611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockWorktreeClient=void 0;const r=n(22650);t.mockWorktreeClient=function(e){return(0,r.fromPartial)(Object.assign({},e))}},2117:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGtDataDir=t.getGtConfigDir=void 0;const r=n(70857),o=n(16928);t.getGtConfigDir=()=>{var e;return(0,o.join)(null!==(e=process.env.XDG_CONFIG_HOME)&&void 0!==e?e:(0,o.join)((0,r.homedir)(),".config"),"graphite")},t.getGtDataDir=()=>{var e;return(0,o.join)(null!==(e=process.env.XDG_DATA_HOME)&&void 0!==e?e:(0,o.join)((0,r.homedir)(),".local","share"),"graphite")}},32525:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.labelForComparison=t.ComparisonType=void 0,function(e){e.UncommittedChanges="UNCOMMITTED",e.HeadChanges="HEAD",e.StackChanges="STACK",e.Committed="InCommit",e.Commit="Commit",e.Range="Range"}(n||(t.ComparisonType=n={})),t.labelForComparison=function(e){switch(e.type){case n.UncommittedChanges:return"Uncommitted changes";case n.HeadChanges:return"Changes in current commit";case n.StackChanges:return"Changes in current branch";case n.Committed:return`Changes in ${e.hash}`;case n.Commit:return`In ${e.sha}`;case n.Range:return`From ${e.fromSha} to ${e.toSha}`}}},80649:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cached=t.LRU=void 0;const r=n(18413);class o{maxItems;maxHashCollision;cache=new Map;constructor(e,t=3){this.maxItems=e,this.maxHashCollision=t}get(e){let t;const n=i(e),o=this.cache.get(n);if(void 0!==o){const i=o.get(e);if(void 0!==i)t=i;else for(const[n,i]of o)if((0,r.is)(e,n)){t=i;break}this.cache.delete(n),this.cache.set(n,o)}return t}set(e,t){const n=i(e);let r=this.cache.get(n);if(void 0===r||r.size>=this.maxHashCollision?r=new Map([[e,t]]):r.set(e,t),this.cache.delete(n),void 0!==t&&(this.cache.set(n,r),this.cache.size>this.maxItems)){const e=this.cache.keys().next();e.done||this.cache.delete(e.value)}}delete(e){const t=i(e);this.cache.delete(t)}clear(){this.cache.clear()}}function i(e){const t=e?.hashCode;return void 0!==t?t.apply(e):e}function a(e,t){const n=t?.cache??new o(t?.cacheSize??10),i=t?.getExtraKeys,a=function(...t){const o=n.stats;if(!t.every(c))return null!=o&&(o.skip=(o.skip??0)+1),e.apply(this,t);const a=(0,r.List)(i?[...i.apply(this),...t]:t),s=n.get(a);if(void 0!==s)return null!=o&&(o.hit=(o.hit??0)+1),s;null!=o&&(o.miss=(o.miss??0)+1);const u=e.apply(this,t);return n.set(a,u),u};return a.cache=n,a}t.LRU=o,t.cached=function(e,t){return"function"==typeof e?a(e,t):function(e){const t=e?.getExtraKeys??function(){return(0,r.isValueObject)(this)?[this]:null!=this&&"object"==typeof this?Object.values(this).filter(c):[]};return function(n,r,o){const i=o.value;o.value=a(i,{...e,getExtraKeys:t})}}(e)};const s=new Set(["number","string","boolean","symbol","bigint","undefined","null"]);function c(e){if(null==e)return!0;const t=typeof e;return!!s.has(t)||!("object"!==t||!(0,r.isValueObject)(e))}},81351:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},65011:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(81351),t),o(n(83403),t),o(n(64082),t)},83403:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tracker=void 0;const r=n(45141);class o{sendData;context;constructor(e,t){this.sendData=e,this.context=t}error(e,t,n,r){const o=n instanceof Error?n.message||String(n):n;this.track(e,{...r??{},errorMessage:o,errorName:t})}operation(e,t,n,o){const i=Date.now(),a=n?.id??(0,r.randomId)();try{const s=o({parentId:a});if((0,r.isPromise)(s))return s.then((t=>{const r=Date.now()-i;return this.track(e,{...n??{},duration:r,id:a}),t})).catch((r=>{const o=Date.now()-i;return this.error(e,t,r,{...n??{},duration:o,id:a}),Promise.reject(r)}));const c=Date.now()-i;return this.track(e,{...n??{},duration:c,id:a}),s}catch(r){const o=Date.now()-i;throw this.error(e,t,r,{...n??{},duration:o,id:a}),r}}trackAsParent(e,t){const n=t?.id??(0,r.randomId)();return this.trackData({...t,eventName:e,id:n}),new o(((e,t)=>this.trackData({...e,...t})),{parentId:n})}track(e,t){this.trackData({...t,eventName:e})}trackData(e){const t=e?.id??(0,r.randomId)(),n={timestamp:e?.timestamp??Date.now(),id:t,...e??{}};this.sendData(n,this.context)}}t.Tracker=o},64082:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},28225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0,t.debounce=function(e,t,n=void 0,r=!1){let o,i=!0;function a(...s){let c;if(r){if(c=function(){i=!0,o=void 0},!i)return clearTimeout(o),void(o=setTimeout(c,t));i=!1,e.apply(n,s)}else a.reset(),c=function(){o=void 0,e.apply(n,s)};o=setTimeout(c,t)}return a.reset=function(){clearTimeout(o),o=void 0,i=!0},a.isPending=function(){return null!=o},a}},77052:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(65011),t),o(n(32525),t),o(n(28225),t),o(n(80649),t),o(n(17138),t),o(n(93809),t),o(n(67497),t),o(n(74866),t),o(n(65709),t),o(n(45141),t)},17138:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.parsePatch=t.DiffType=void 0,function(e){e.Modified="Modified",e.Added="Added",e.Removed="Removed",e.Renamed="Renamed",e.Copied="Copied"}(n||(t.DiffType=n={}));const r=/^diff --git (.*) (.*)$/,o=/^rename from (.*)$/,i=/^rename to (.*)$/,a=/^copy from (.*)$/,s=/^copy to (.*)$/,c=/^new file mode (\d{6})$/,u=/^deleted file mode (\d{6})$/,l=/^old mode (\d{6})$/,d=/^new mode (\d{6})$/,f=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,h=/^--- (.*)$/,p=/^\+\+\+ (.*)$/,m=/\r\n|[\n\v\f\r\x85]/g;function g(e,t){if(!1===e)throw new Error(t)}t.parsePatch=function(e){const t=e.split(m),v=e.match(m)||[],b=[];let y=0;function _(){const e={hunks:[]};for(b.push(e),function(e){for(;y<t.length;){const n=t[y],o=r.exec(n);if(o){e.oldFileName=o[1],e.newFileName=o[2],y++;break}y++}}(e);y<t.length;){const n=t[y];if(/^old mode/.test(n))E(e);else if(/^new mode/.test(n))C(e);else if(/^deleted file mode/.test(n))R(e);else if(/^new file mode/.test(n))w(e);else if(/^copy /.test(n))P(e);else if(/^rename /.test(n))O(e);else{if(/^--- /.test(n)){N(e);break}if(/^diff --git/.test(n))break;y++}}!function(e){for(;y<t.length;){const n=t[y];if(r.test(n))break;/^@@/.test(n)?e.hunks.push(S()):y++}}(e)}function E(e){const r=l.exec(t[y]);g(null!==r,`invalid format '${t[y]}'`),e.oldMode=r[1],e.type=n.Modified,y++}function C(e){const r=d.exec(t[y]);g(null!==r,`invalid format '${t[y]}'`),e.newMode=r[1],e.type=n.Modified,y++}function R(e){const r=u.exec(t[y]);g(null!==r,`invalid format '${t[y]}'`),e.newMode=r[1],e.type=n.Removed,y++}function w(e){const r=c.exec(t[y]);g(null!==r,`invalid format '${t[y]}'`),e.newMode=r[1],e.type=n.Added,y++}function P(e){g(a.test(t[y]),`invalid format '${t[y]}'`),g(s.test(t[y+1]),`invalid format '${t[y+1]}'`),e.type=n.Copied,y+=2}function O(e){g(o.test(t[y]),`invalid format '${t[y]}'`),g(i.test(t[y+1]),`invalid format '${t[y+1]}'`),e.type=n.Renamed,y+=2}function N(e){g(h.test(t[y]),`invalid format '${t[y]}'`),g(p.test(t[y+1]),`invalid format '${t[y+1]}'`),void 0===e.type&&(e.type=n.Modified),y+=2}function S(){const e=t[y++].split(f),n={oldStart:+e[1],oldLines:void 0===e[2]?1:+e[2],newStart:+e[3],newLines:void 0===e[4]?1:+e[4],lines:[],linedelimiters:[]};0===n.oldLines&&(n.oldStart+=1),0===n.newLines&&(n.newStart+=1);let r=0,o=0;for(;y<t.length&&!(0===t[y].indexOf("--- ")&&y+2<t.length&&0===t[y+1].indexOf("+++ ")&&0===t[y+2].indexOf("@@"));y++){const e=0===t[y].length&&y!==t.length-1?" ":t[y][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)break;n.lines.push(t[y]),n.linedelimiters.push(v[y]||"\n"),"+"===e?r++:"-"===e?o++:" "===e&&(r++,o++)}return r||1!==n.newLines||(n.newLines=0),o||1!==n.oldLines||(n.oldLines=0),n}for(;y<t.length;)_();return b}},93809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},67497:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeFromString=t.deserialize=t.serializeToString=t.serialize=void 0;const n={__rpcType:"undefined"};function r(e){if(void 0===e)return n;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null===e)return e;if(e instanceof Map)return{__rpcType:"Map",data:Array.from(e.entries()).map((([e,t])=>[r(e),r(t)]))};if(e instanceof Set)return{__rpcType:"Set",data:Array.from(e.values()).map(r)};if(e instanceof Error)return{__rpcType:"Error",data:{message:e.message,stack:e.stack}};if(e instanceof Date)return{__rpcType:"Date",data:e.valueOf()};if(Array.isArray(e))return e.map((e=>r(e)));if("object"==typeof e){const t={__rpcType:"object"};for(const[n,o]of Object.entries(e))t[n]=r(o);return t}throw new Error(`cannot serialize argument ${e}`)}function o(e){if("object"!=typeof e||null==e)return e;if(Array.isArray(e))return e.map((e=>o(e)));const t=e;switch(t.__rpcType){case"undefined":return;case"Map":return new Map(t.data.map((([e,t])=>[o(e),o(t)])));case"Set":return new Set(t.data.map(o));case"Error":{const e=new Error;return e.stack=t.data.stack,e.message=t.data.message,e}case"Date":return new Date(t.data);case"object":{const t=e,n={};for(const[e,r]of Object.entries(t))"__rpcType"!==e&&(n[e]=o(r));return n}default:throw new Error(`cannot deserialize unknown type ${t}`)}}t.serialize=r,t.serializeToString=function(e){return JSON.stringify(r(e))},t.deserialize=o,t.deserializeFromString=function(e){return o(JSON.parse(e))}},65709:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},95595:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SucceedableRevset=t.CommandRunner=void 0,function(e){e.Graphite="gt",e.CodeReviewProvider="codeReviewProvider"}(n||(t.CommandRunner=n={})),t.SucceedableRevset=function(e){return{type:"succeedable-revset",revset:e}}},32710:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},92157:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},88227:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorShortMessages=t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=t.ONE_MINUTE_MS=t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=void 0,t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=4100,t.ONE_MINUTE_MS=6e4,t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=void 0,function(e){e.NoCommitsFetched="No commits found"}(n||(t.ErrorShortMessages=n={}))},14239:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},74866:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(95595),t),o(n(32710),t),o(n(92157),t),o(n(88227),t),o(n(14239),t),o(n(38185),t)},38185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},45141:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=t.truncate=t.zip=t.generatorContains=t.mapObject=t.findParentWithClassName=t.basename=t.defer=t.randomId=t.unwrap=t.notEmpty=void 0,t.notEmpty=function(e){return null!=e},t.unwrap=function(e){if(null==e)throw new Error(`expected value not to be ${e}`);return e},t.randomId=function(){return Date.now().toString(36)+Math.random().toString(36)},t.defer=function(){const e={promise:void 0,resolve:void 0,reject:void 0};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e},t.basename=function(e,t="/"){const n=e.lastIndexOf(t);return-1===n?e:e.slice(n+1)},t.findParentWithClassName=function(e,t){let n=e;for(;n;){if(n.classList?.contains(t))return n;n=n.parentElement}},t.mapObject=function(e,t){return Object.fromEntries(Object.entries(e).map(t))},t.generatorContains=function(e,t){const n="function"==typeof t?t:e=>e===t;for(const t of e)if(n(t))return!0;return!1},t.zip=function*(e,t){const n=e[Symbol.iterator](),r=t[Symbol.iterator]();for(;;){const e=n.next(),t=r.next();if(e.done||t.done)break;yield[e.value,t.value]}},t.truncate=function(e,t=100){return e.length>t?e.substring(0,Math.max(0,t-1))+"…":e},t.isPromise=function(e){return"function"==typeof e?.then}},97499:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.doesPrHaveMissingCodeownerReviews=t.mapCodeownerToKey=t.getPrMissingCodeowners=t.authorIsOnlyCodeowner=t.isUserCodeownerForFile=t.hasCodeownerApprovedPr=t.fileHasCodeownersApproval=t.convertOwnerToLowerCase=t.doesFileSatisfyCodeownerRequirement=t.getFilesMissingCodeownersApproval=void 0;const r=n(85855),o=n(78584);function i({previousReviewers:e,authorLogin:t,files:n}){return n.filter((n=>!a({pr:{previousReviewers:e,authorLogin:t},file:n})))}function a({pr:e,file:t}){var n,r;return 0===(null!==(r=null===(n=t.codeowners)||void 0===n?void 0:n.owners)&&void 0!==r?r:[]).length||c({file:t,pr:e})||d({authorLogin:e.authorLogin,file:t})}function s(e){switch(e.kind){case"USER":return Object.assign(Object.assign({},e),{login:e.login.toLowerCase()});case"TEAM":return Object.assign(Object.assign({},e),{memberLogins:e.memberLogins.map((e=>e.toLowerCase()))});case"EMAIL":return Object.assign(Object.assign({},e),{email:e.email.toLowerCase()});default:(0,r.assertUnreachable)(e)}}function c({file:e,pr:t}){var n,r;const i=new Set(t.previousReviewers.filter(o.isApprover).map((e=>e.username))),a=null!==(r=null===(n=e.codeowners)||void 0===n?void 0:n.owners)&&void 0!==r?r:[];return[...i].some((e=>u({userLogin:e,owners:a})))}function u({userLogin:e,owners:t}){return t.some((t=>l({userLogin:e,owner:t})))}function l({userLogin:e,owner:t}){const n=s(t),o=e.toLowerCase();switch(n.kind){case"USER":return o===n.login;case"TEAM":return n.memberLogins.some((e=>o===e));case"EMAIL":return!1;default:(0,r.assertUnreachable)(n)}}function d({authorLogin:e,file:t}){var n,r;const o=null==e?void 0:e.toLowerCase(),i=(null!==(r=null===(n=t.codeowners)||void 0===n?void 0:n.owners)&&void 0!==r?r:[]).map(s);if(void 0===o||1!==i.length)return!1;const a=i[0];return"USER"===a.kind&&a.login===o||!("TEAM"!==a.kind||1!==a.memberLogins.length||!a.memberLogins.includes(o))}function f(e){switch(e.kind){case"USER":return e.login;case"TEAM":return`${e.org}/${e.team}`;case"EMAIL":return e.email;default:(0,r.assertUnreachable)(e)}}t.getFilesMissingCodeownersApproval=i,t.doesFileSatisfyCodeownerRequirement=a,t.convertOwnerToLowerCase=s,t.fileHasCodeownersApproval=c,t.hasCodeownerApprovedPr=function({owner:e,approverLogins:t}){return[...t].some((t=>l({userLogin:t,owner:e})))},t.isUserCodeownerForFile=u,t.authorIsOnlyCodeowner=d,t.getPrMissingCodeowners=function({previousReviewers:e,authorLogin:t,files:n}){const r=i({previousReviewers:e,authorLogin:t,files:n}).flatMap((e=>e.codeowners?e.codeowners.owners:[]));return[...new Map(r.map((e=>[f(e),e]))).values()]},t.mapCodeownerToKey=f,t.doesPrHaveMissingCodeownerReviews=function({previousReviewers:e,authorLogin:t,files:n}){return i({previousReviewers:e,authorLogin:t,files:n}).length>0}},34087:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchGraphiteBase=t.generateGraphiteBaseName=void 0;const n="graphite-base";t.generateGraphiteBaseName=e=>`${n}/${e}`,t.isBranchGraphiteBase=e=>Boolean(null==e?void 0:e.startsWith(`${n}/`))},78584:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isApprover=void 0,t.isApprover=function(e){return"APPROVED"===e.decision&&(e.hasWritePermission||null===e.hasWritePermission)}},66882:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MergeStateStatuses=t.PrMetastatuses=void 0,t.PrMetastatuses=["CLOSED","DRAFT","HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE","MERGED","QUEUED_TO_MERGE","READY_TO_MERGE","READY_TO_MERGE_AS_STACK","READY_TO_MERGE_AS_STACK_WITHOUT_CI","READY_TO_MERGE_WITHOUT_CI","REBASING","WAITING_TO_MERGE","NEEDS_RESTACK__BASE_INCORRECT","BRANCH_LOCKED","CHANGES_REQUESTED","GT_NEEDS_APPROVALS","FAILING_REQUIRED","HARD_WAITING_ON_DOWNSTACK","MERGE_CONFLICTS","NEEDS_REVIEWERS","NEEDS_APPROVALS","NEEDS_CODEOWNER_APPROVALS","NEEDS_RESTACK__BASE_BRANCH_MERGED","RUNNING","UNRESOLVED_COMMENTS","WAITING_ON_DOWNSTACK","GT_NEEDS_APPROVALS","GT_NEEDS_REQUIRED_APPROVER","FAILURE_HANDLING","STALE"],t.MergeStateStatuses=["GREEN__CLEAN__MERGEABLE_AND_PASSING_COMMIT_STATUS","GREEN__HAS_HOOKS__MERGEABLE_WITH_PASSING_COMMIT_STATUS_AND_PRERECEIVE_HOOKS_ENTERPRISE_ONLY","YELLOW__UNSTABLE__FAILING_OR_PENDING_NON_REQUIRED_STATUS_OK_TO_MERGE","RED__BEHIND__HEAD_REF_OUT_OF_DATE","RED__BLOCKED__FAILING_OR_MISSING_REQUIRED_STATUS_CHECK","RED__DIRTY__MERGE_CONFLICT","RED__DRAFT__MERGE_BLOCKED_DUE_TO_PULL_REQUEST_BEING_A_DRAFT","RED__UNKNOWN__MERGABILITY_NOT_YET_DETERMINED"]},18667:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.doesPrHaveMinimumRequiredApprovals=void 0;const r=n(78584);t.doesPrHaveMinimumRequiredApprovals=function({previousReviewers:e,numRequiredApproversBaseBranchRules:t,numRequiredApproversRestrictions:n}){return e.filter(r.isApprover).length>=Math.max(null!=t?t:1,...n.map((({numRequiredApprovers:e})=>e)))}},50992:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveClosedReviewRequests=t.doesPrHaveOpenChangesRequested=t.getPrMetastatus=void 0;const a=n(85855),s=i(n(45844)),c=n(97499),u=n(34087),l=n(78584);t.getPrMetastatus=function e({pr:t,downstackExclusivePrs:n,baseBranchRules:r,ignoreMergeStates:o}){var i,f;if("OPEN"!==t.state)return{prNumber:t.number,status:t.state};if(t.isDraft)return{prNumber:t.number,status:"DRAFT"};if(t.isQueuedToMerge&&!o)return{prNumber:t.number,status:"QUEUED_TO_MERGE"};if(t.isWaitingToMerge&&!o)return{prNumber:t.number,status:"WAITING_TO_MERGE"};if(t.isRebasing)return{prNumber:t.number,status:"REBASING"};const h=[],p=n[0];if(!o&&t.isInFailureHandling)return{prNumber:t.number,status:"BLOCKED",blockingReasons:[{reason:"FAILURE_HANDLING"}]};if((null==r?void 0:r.lockBranch)&&h.push({reason:"BRANCH_LOCKED"}),p&&"MERGED"===p.state&&(t.parentBranch===p.branch||(0,u.isBranchGraphiteBase)(t.parentBranch))&&h.push({reason:"NEEDS_RESTACK__BASE_BRANCH_MERGED"}),d({pr:t,parentPr:p}))return{prNumber:t.number,status:"NEEDS_RESTACK__BASE_INCORRECT"};t.hasMergeConflicts&&h.push({reason:"MERGE_CONFLICTS"}),"FAILING_REQUIRED"===t.ciRollup.status&&h.push({reason:"FAILING_REQUIRED"});const m=null!==(i=null==r?void 0:r.requiresApprovingReviews)&&void 0!==i?i:null;(null===m||m)&&t.previousReviewers.some((e=>(e.hasWritePermission||null===e.hasWritePermission)&&"CHANGES_REQUESTED"===e.decision))&&h.push({reason:"CHANGES_REQUESTED"}),(null==r?void 0:r.requiresCodeOwnerReviews)&&(0,c.doesPrHaveMissingCodeownerReviews)(t)&&h.push({reason:"NEEDS_CODEOWNER_APPROVALS"});const g=s.computeNeedsRequiredApproverBlockingReason(t);g&&h.push(g);const v=t.previousReviewers.filter(l.isApprover);(null!==(f=null==r?void 0:r.requiredApprovingReviewCount)&&void 0!==f?f:0)>v.length&&(t.hasReviewRequests||h.push({reason:"NEEDS_REVIEWERS"}),h.push({reason:"NEEDS_APPROVALS"}));const b=s.computeNeedsApprovalBlockingReason(t);b&&(h.some((e=>"NEEDS_APPROVALS"===e.reason))||"GT_NEEDS_APPROVALS"!==b.reason||t.hasReviewRequests||h.push({reason:"NEEDS_REVIEWERS"}),h.push(b)),"RUNNING"===t.ciRollup.status&&h.push({reason:"RUNNING"}),(null==r?void 0:r.requiresConversationResolution)&&t.unresolvedThreadCount>0&&h.push({reason:"UNRESOLVED_COMMENTS"}),!o&&t.isStale&&h.push({reason:"STALE"});const y=0===n.length?void 0:e({pr:n[0],downstackExclusivePrs:n.slice(1),baseBranchRules:r,ignoreMergeStates:o}),_=function({parentMetastatus:e,hasThirdPartyMergeQueueLabel:t,hasActiveEntryInGithubMergeQueue:n,ciRollupStatus:r}){switch(e){case"BLOCKED":case"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":return"WAITING_ON_DOWNSTACK";case"HARD_BLOCKED":case"CLOSED":case"DRAFT":case"WAITING_TO_MERGE":case"REBASING":return"HARD_WAITING_ON_DOWNSTACK";case void 0:case"MERGED":return t||n?"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_WITHOUT_CI":"READY_TO_MERGE";case"QUEUED_TO_MERGE":return"READY_TO_MERGE";case"NEEDS_RESTACK__BASE_INCORRECT":case"READY_TO_MERGE":case"READY_TO_MERGE_AS_STACK":return"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_AS_STACK_WITHOUT_CI":"READY_TO_MERGE_AS_STACK";case"READY_TO_MERGE_WITHOUT_CI":case"READY_TO_MERGE_AS_STACK_WITHOUT_CI":return"READY_TO_MERGE_AS_STACK_WITHOUT_CI";default:(0,a.assertUnreachable)(e)}}({parentMetastatus:null==y?void 0:y.status,hasThirdPartyMergeQueueLabel:t.hasThirdPartyMergeQueueLabel,hasActiveEntryInGithubMergeQueue:t.hasActiveEntryInGithubMergeQueue,ciRollupStatus:t.ciRollup.status});if("HARD_WAITING_ON_DOWNSTACK"===_||"WAITING_ON_DOWNSTACK"===_)h.push({reason:_});else if(0===h.length)return{prNumber:t.number,status:_};return Object.assign({prNumber:t.number,status:h.map((({reason:e})=>e)).includes("MERGE_CONFLICTS")||h.map((({reason:e})=>e)).includes("HARD_WAITING_ON_DOWNSTACK")?"HARD_BLOCKED":"BLOCKED",blockingReasons:[h[0],...h.slice(1)]},y?{parentMetastatus:y}:{})};const d=({pr:e,parentPr:t})=>!(0,u.isBranchGraphiteBase)(e.parentBranch)&&(!t||"MERGED"===t.state&&e.parentBranch!==t.branch)&&e.parentBranch!==e.stackTrunkBranch;t.doesPrHaveOpenChangesRequested=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>"CHANGES_REQUESTED"===e.decision)).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveClosedReviewRequests=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>["CHANGES_REQUESTED","COMMENTED"].includes(e.decision)&&!e.isBot)).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveOpenReviewRequests=function({requestedReviewers:e}){return e.length>0},t.getHumanReadablePrMetastatus={BRANCH_LOCKED:"Trunk branch locked",CHANGES_REQUESTED:"Changes requested",CLOSED:"Closed",DRAFT:"Draft",FAILING_REQUIRED:"Required checks failed",FAILURE_HANDLING:"Undergoing failure detection",GT_NEEDS_APPROVALS:"Needs more approvals",GT_NEEDS_REQUIRED_APPROVER:"Needs approvals from file owners",HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE:"Handed off to merge queue...",HARD_WAITING_ON_DOWNSTACK:"Waiting on downstack",MERGE_CONFLICTS:"Merge conflicts",MERGED:"Merged",NEEDS_REVIEWERS:"Needs more reviewers",NEEDS_APPROVALS:"Needs more approvals",NEEDS_CODEOWNER_APPROVALS:"Needs approvals from file owners",NEEDS_RESTACK__BASE_BRANCH_MERGED:"Needs restack",NEEDS_RESTACK__BASE_INCORRECT:"Needs restack",QUEUED_TO_MERGE:"Queued to merge...",READY_TO_MERGE:"Ready to merge",READY_TO_MERGE_AS_STACK:"Ready to merge as stack",READY_TO_MERGE_AS_STACK_WITHOUT_CI:"Ready to merge as stack",READY_TO_MERGE_WITHOUT_CI:"Ready to merge",REBASING:"Rebasing...",RUNNING:"Waiting on CI...",STALE:"Stale, needs rebase onto trunk",UNRESOLVED_COMMENTS:"Unresolved comments",WAITING_ON_DOWNSTACK:"Waiting on downstack",WAITING_TO_MERGE:"Waiting to merge..."}},96122:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GRAPHITE_CHECK_NAMES=t.GRAPHITE_AI_REVIEWER_CHECK_NAME=t.GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED=t.GRAPHITE_MERGE_RULE_CHECK_NAME=t.GRAPHITE_MERGE_RULE_DEPRECATED_CHECK_NAME=t.GRAPHITE_MERGEABILITY_CHECK_NAME=void 0,t.GRAPHITE_MERGEABILITY_CHECK_NAME="Graphite / mergeability_check",t.GRAPHITE_MERGE_RULE_DEPRECATED_CHECK_NAME="Graphite / merge_rules check",t.GRAPHITE_MERGE_RULE_CHECK_NAME="Graphite / protections check",t.GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED="Graphite / AI Reviewer",t.GRAPHITE_AI_REVIEWER_CHECK_NAME="Diamond / AI code review",t.GRAPHITE_CHECK_NAMES=[t.GRAPHITE_MERGEABILITY_CHECK_NAME,t.GRAPHITE_MERGE_RULE_CHECK_NAME,t.GRAPHITE_AI_REVIEWER_CHECK_NAME,t.GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED,t.GRAPHITE_MERGE_RULE_DEPRECATED_CHECK_NAME]},55086:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTestMergeRestriction=t.prAuthorIsRequiredApproverForFile=t.isUserRequiredApproverForFile=t.isRequiredApproversRestrictionSatisfied=t.isApprovedByRequiredApprover=t.hasFileBeenApprovedByRequiredApprovers=t.doesFileSatisfyRequiredApprovers=t.filterRequiredStatusChecksPayload=t.filterRequiredApproversWithTeamMembersPayload=t.filterNumRequiredApproversPayload=t.computeMergeRulesBlockingReasons=t.GRAPHITE_MERGEABILITY_CHECK_NAME=t.GRAPHITE_MERGE_RULE_CHECK_NAME=t.GRAPHITE_CHECK_NAMES=t.GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED=t.GRAPHITE_AI_REVIEWER_CHECK_NAME=t.getPrMetastatus=t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveOpenChangesRequested=t.doesPrHaveClosedReviewRequests=t.doesPrHaveMinimumRequiredApprovals=t.PrMetastatuses=t.MergeStateStatuses=t.isApprover=t.isBranchGraphiteBase=t.generateGraphiteBaseName=t.isUserCodeownerForFile=t.hasCodeownerApprovedPr=t.getPrMissingCodeowners=t.fileHasCodeownersApproval=t.doesPrHaveMissingCodeownerReviews=t.doesFileSatisfyCodeownerRequirement=t.authorIsOnlyCodeowner=void 0;var r=n(97499);Object.defineProperty(t,"authorIsOnlyCodeowner",{enumerable:!0,get:function(){return r.authorIsOnlyCodeowner}}),Object.defineProperty(t,"doesFileSatisfyCodeownerRequirement",{enumerable:!0,get:function(){return r.doesFileSatisfyCodeownerRequirement}}),Object.defineProperty(t,"doesPrHaveMissingCodeownerReviews",{enumerable:!0,get:function(){return r.doesPrHaveMissingCodeownerReviews}}),Object.defineProperty(t,"fileHasCodeownersApproval",{enumerable:!0,get:function(){return r.fileHasCodeownersApproval}}),Object.defineProperty(t,"getPrMissingCodeowners",{enumerable:!0,get:function(){return r.getPrMissingCodeowners}}),Object.defineProperty(t,"hasCodeownerApprovedPr",{enumerable:!0,get:function(){return r.hasCodeownerApprovedPr}}),Object.defineProperty(t,"isUserCodeownerForFile",{enumerable:!0,get:function(){return r.isUserCodeownerForFile}});var o=n(34087);Object.defineProperty(t,"generateGraphiteBaseName",{enumerable:!0,get:function(){return o.generateGraphiteBaseName}}),Object.defineProperty(t,"isBranchGraphiteBase",{enumerable:!0,get:function(){return o.isBranchGraphiteBase}});var i=n(78584);Object.defineProperty(t,"isApprover",{enumerable:!0,get:function(){return i.isApprover}});var a=n(66882);Object.defineProperty(t,"MergeStateStatuses",{enumerable:!0,get:function(){return a.MergeStateStatuses}}),Object.defineProperty(t,"PrMetastatuses",{enumerable:!0,get:function(){return a.PrMetastatuses}});var s=n(18667);Object.defineProperty(t,"doesPrHaveMinimumRequiredApprovals",{enumerable:!0,get:function(){return s.doesPrHaveMinimumRequiredApprovals}});var c=n(50992);Object.defineProperty(t,"doesPrHaveClosedReviewRequests",{enumerable:!0,get:function(){return c.doesPrHaveClosedReviewRequests}}),Object.defineProperty(t,"doesPrHaveOpenChangesRequested",{enumerable:!0,get:function(){return c.doesPrHaveOpenChangesRequested}}),Object.defineProperty(t,"doesPrHaveOpenReviewRequests",{enumerable:!0,get:function(){return c.doesPrHaveOpenReviewRequests}}),Object.defineProperty(t,"getHumanReadablePrMetastatus",{enumerable:!0,get:function(){return c.getHumanReadablePrMetastatus}}),Object.defineProperty(t,"getPrMetastatus",{enumerable:!0,get:function(){return c.getPrMetastatus}});var u=n(96122);Object.defineProperty(t,"GRAPHITE_AI_REVIEWER_CHECK_NAME",{enumerable:!0,get:function(){return u.GRAPHITE_AI_REVIEWER_CHECK_NAME}}),Object.defineProperty(t,"GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED",{enumerable:!0,get:function(){return u.GRAPHITE_AI_REVIEWER_CHECK_NAME_DEPRECATED}}),Object.defineProperty(t,"GRAPHITE_CHECK_NAMES",{enumerable:!0,get:function(){return u.GRAPHITE_CHECK_NAMES}}),Object.defineProperty(t,"GRAPHITE_MERGE_RULE_CHECK_NAME",{enumerable:!0,get:function(){return u.GRAPHITE_MERGE_RULE_CHECK_NAME}}),Object.defineProperty(t,"GRAPHITE_MERGEABILITY_CHECK_NAME",{enumerable:!0,get:function(){return u.GRAPHITE_MERGEABILITY_CHECK_NAME}});var l=n(45844);Object.defineProperty(t,"computeMergeRulesBlockingReasons",{enumerable:!0,get:function(){return l.computeMergeRulesBlockingReasons}});var d=n(96165);Object.defineProperty(t,"filterNumRequiredApproversPayload",{enumerable:!0,get:function(){return d.filterNumRequiredApproversPayload}}),Object.defineProperty(t,"filterRequiredApproversWithTeamMembersPayload",{enumerable:!0,get:function(){return d.filterRequiredApproversWithTeamMembersPayload}}),Object.defineProperty(t,"filterRequiredStatusChecksPayload",{enumerable:!0,get:function(){return d.filterRequiredStatusChecksPayload}});var f=n(29879);Object.defineProperty(t,"doesFileSatisfyRequiredApprovers",{enumerable:!0,get:function(){return f.doesFileSatisfyRequiredApprovers}}),Object.defineProperty(t,"hasFileBeenApprovedByRequiredApprovers",{enumerable:!0,get:function(){return f.hasFileBeenApprovedByRequiredApprovers}}),Object.defineProperty(t,"isApprovedByRequiredApprover",{enumerable:!0,get:function(){return f.isApprovedByRequiredApprover}}),Object.defineProperty(t,"isRequiredApproversRestrictionSatisfied",{enumerable:!0,get:function(){return f.isRequiredApproversRestrictionSatisfied}}),Object.defineProperty(t,"isUserRequiredApproverForFile",{enumerable:!0,get:function(){return f.isUserRequiredApproverForFile}}),Object.defineProperty(t,"prAuthorIsRequiredApproverForFile",{enumerable:!0,get:function(){return f.prAuthorIsRequiredApproverForFile}});var h=n(68540);Object.defineProperty(t,"createTestMergeRestriction",{enumerable:!0,get:function(){return h.createTestMergeRestriction}})},45844:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.computeNeedsRequiredApproverBlockingReason=t.computePendingRequiredBlockingReason=t.computeFailingRequiredBlockingReason=t.computeNeedsApprovalBlockingReason=t.computeMergeRulesBlockingReasons=void 0;const r=n(85855),o=n(78584),i=n(29879);function a(e){const{previousReviewers:t,mergeRestrictions:n}=e,r=t.filter(o.isApprover);return n.filter((e=>"NUM_REQUIRED_APPROVERS"===e.payload.kind)).filter((e=>e.payload.numRequiredApprovers>r.length)).length>0?{reason:"GT_NEEDS_APPROVALS"}:null}function s(e){var t;return(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"FAILED"===e.status.status)).length>0?{reason:"GT_FAILING_REQUIRED"}:null}function c(e){var t;const n=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"PENDING"===e.status.status));return n.length>0?{reason:"GT_PENDING_REQUIRED",blockingMergeRestrictions:n.map((({restriction:e})=>e))}:null}function u(e){const{files:t}=e;return t.filter((t=>!(0,i.doesFileSatisfyRequiredApprovers)({file:t,pr:e}))).length>0?{reason:"GT_NEEDS_REQUIRED_APPROVER"}:null}t.computeMergeRulesBlockingReasons=function(e){return[a(e),s(e),c(e),u(e)].filter(r.filterNull)},t.computeNeedsApprovalBlockingReason=a,t.computeFailingRequiredBlockingReason=s,t.computePendingRequiredBlockingReason=c,t.computeNeedsRequiredApproverBlockingReason=u},96165:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filterRequiredApproversWithTeamMembersPayload=t.filterRequiredStatusChecksPayload=t.filterNumRequiredApproversPayload=void 0,t.filterNumRequiredApproversPayload=function(e){return"NUM_REQUIRED_APPROVERS"===e.kind},t.filterRequiredStatusChecksPayload=function(e){return"REQUIRED_STATUS_CHECKS"===e.kind},t.filterRequiredApproversWithTeamMembersPayload=function(e){return"REQUIRED_APPROVERS"===e.kind}},29879:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isRequiredApproversRestrictionSatisfied=t.hasFileBeenApprovedByRequiredApprovers=t.doesFileSatisfyRequiredApprovers=t.isUserRequiredApproverForFile=t.prAuthorIsRequiredApproverForFile=t.isUserRequiredApprover=t.isApprovedByRequiredApprover=void 0;const r=n(85855),o=n(78584);function i({requiredApprover:e,approvers:t}){const n=t.map((({username:e})=>e));switch(e.kind){case"USER":return n.includes(e.login);case"TEAM":return e.memberLogins.some((e=>n.includes(e)));default:(0,r.assertUnreachable)(e)}}function a({userLogin:e,payload:t}){return t.requiredApprovers.flatMap((e=>"TEAM"===e.kind?e.memberLogins:[e.login])).includes(e)}function s({authorLogin:e,file:t}){return!(!e||!c({userLogin:e,file:t}))}function c({userLogin:e,file:t}){return t.requiredApproversMergeRestrictions.some((({payload:t})=>a({userLogin:e,payload:t})))}function u({file:e,pr:t}){const{requiredApproversMergeRestrictions:n}=e,{previousReviewers:r}=t;return n.some((({payload:e})=>l({previousReviewers:r,payload:e})))}function l({previousReviewers:e,payload:t}){const n=e.filter(o.isApprover),r=t.requiredApprovers;return 0===r.length||r.some((e=>i({requiredApprover:e,approvers:n})))}t.isApprovedByRequiredApprover=i,t.isUserRequiredApprover=a,t.prAuthorIsRequiredApproverForFile=s,t.isUserRequiredApproverForFile=c,t.doesFileSatisfyRequiredApprovers=function({file:e,pr:t}){const{requiredApproversMergeRestrictions:n}=e,{authorLogin:r}=t;return 0===n.length||s({authorLogin:r,file:e})||u({file:e,pr:t})},t.hasFileBeenApprovedByRequiredApprovers=u,t.isRequiredApproversRestrictionSatisfied=l},68540:(e,t)=>{function n({status:e="PASSING",ciMergeRestrictionsStatus:t=[]}){return{status:e,ciMergeRestrictionsStatus:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createTestPr=t.createTestCiRollup=t.createTestMergeRestriction=t.createTestFile=t.createTestReviewer=void 0,t.createTestReviewer=function({username:e="username",decision:t="APPROVED",hasWritePermission:n=null,isBot:r=!1}){return{username:e,decision:t,hasWritePermission:n,isBot:r}},t.createTestFile=function({filename:e="filename",codeowners:t=null,requiredApproversMergeRestrictions:n=[]}){return{filename:e,codeowners:t,requiredApproversMergeRestrictions:n}},t.createTestMergeRestriction=function({id:e="1",mergeRuleId:t="1",payload:n={kind:"NUM_REQUIRED_APPROVERS",numRequiredApprovers:1}}){return{id:e,mergeRuleId:t,payload:n}},t.createTestCiRollup=n,t.createTestPr=function({number:e=1,state:t="OPEN",isDraft:r=!1,authorLogin:o="authorLogin",hasReviewRequests:i=!0,previousReviewers:a=[],hasMergeConflicts:s=!1,isQueuedToMerge:c=!1,isInFailureHandling:u=!1,isWaitingToMerge:l=!1,isRebasing:d=!1,ciRollup:f=n({}),skipRequiredCi:h=!1,branch:p="branch",parentBranch:m="trunkBranch",unresolvedThreadCount:g=0,files:v=[],mergeRestrictions:b=[],stackTrunkBranch:y="trunkBranch",isStale:_=!1}){return{number:e,state:t,isDraft:r,authorLogin:o,hasReviewRequests:i,previousReviewers:a,hasMergeConflicts:s,isQueuedToMerge:c,isInFailureHandling:u,isWaitingToMerge:l,isRebasing:d,hasThirdPartyMergeQueueLabel:!1,hasActiveEntryInGithubMergeQueue:!1,ciRollup:f,skipRequiredCi:h,branch:p,parentBranch:m,unresolvedThreadCount:g,files:v,mergeRestrictions:b,stackTrunkBranch:y,isStale:_}}},74374:(e,t)=>{function n(e){return t=>JSON.stringify(e)===JSON.stringify(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.nullable=t.optional=t.literals=t.intersectMany=t.unionMany=t.intersection=t.union=t.tuple=t.array=t.taggedUnion=t._shapeWithExplicitOptionals=t.shape=t.nulltype=t.boolean=t.string=t.number=t.literal=t.undefinedtype=void 0,t.undefinedtype=e=>void 0===e,t.literal=function(e){return n(e)},t.number=e=>"number"==typeof e,t.string=e=>"string"==typeof e,t.boolean=e=>"boolean"==typeof e,t.nulltype=e=>null===e,t.shape=function(e){return(t,n)=>r(e,t,n)},t._shapeWithExplicitOptionals=function(e){return(t,n)=>r(e,t,n)};const r=(e,t,n)=>"object"==typeof t&&null!==t&&Object.keys(e).every((r=>{const o=e[r]&&e[r](t[r],n);return!o&&(null==n?void 0:n.logFailures)&&console.log(`Member of shape ${JSON.stringify(t[r])} for ${r} does not match expected type`),o}));function o(e,t){return(n,r)=>{const o=e(n,r)||t(n,r);return!o&&(null==r?void 0:r.logFailures)&&console.log(`Member of union "${JSON.stringify(n)}" does not match expected type`),o}}function i(e){return(t,n)=>{const r=e.some((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of union-many ${JSON.stringify(t)} does not expected type`),r}}t.taggedUnion=function(e,t){return(n,r)=>{if("object"!=typeof n||null===n||!(e in n))return(null==r?void 0:r.logFailures)&&console.log("Tagged union is not an object or missing tag"),!1;const o=t[n[e]];return!!o&&Object.keys(o).every((e=>{const t=o[e]&&o[e](n[e],r);return!t&&(null==r?void 0:r.logFailures)&&console.log(`Member of shape ${JSON.stringify(n[e])} for ${e} does not match expected type`),t}))}},t.array=function(e){return(t,n)=>Array.isArray(t)&&t.every((t=>{const r=e(t,n);return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of array "${JSON.stringify(t)}" does not match expected type`),r}))},t.tuple=function(e){return(t,n)=>Array.isArray(t)&&t.length===e.length&&t.every(((t,r)=>{const o=e[r](t,n);return!o&&(null==n?void 0:n.logFailures)&&console.log(`Member of tuple "${JSON.stringify(t)}" does not match expected type`),o}))},t.union=o,t.intersection=function(e,t){return(n,r)=>{const o=e(n,r)&&t(n,r);return!o&&(null==r?void 0:r.logFailures)&&console.log(`Member of intersection "${JSON.stringify(n)}" does not match expected type`),o}},t.unionMany=i,t.intersectMany=function(e){return(t,n)=>{const r=e.every((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of intersection-many ${JSON.stringify(t)} does not expected type`),r}},t.literals=function(e){return i(e.map((e=>n(e))))},t.optional=function(e){return o(e,t.undefinedtype)},t.nullable=function(e){return o(e,t.nulltype)}},98110:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.maybeCreateAbortController=void 0,t.maybeCreateAbortController=e=>{if(!e)return{controller:void 0,timeoutId:void 0};const t=new AbortController,n=setTimeout((()=>t.abort()),e);return{controller:t,timeoutId:n}}},56617:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.request=void 0,t.request=i(n(23228))},23228:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.requestWithArgs=void 0,n(20817);const s=i(n(10008)),c=n(98110);t.requestWithArgs=function({apiServer:e,route:t,params:n,queryParams:r,urlParams:o,headers:i,timeoutMs:u}){const l=function({apiServer:e,route:t,params:n,queryParams:r,urlParams:o,headers:i,opts:a}){let c=e+(o?s.compile(t.url)(o):t.url),u=null;if("GET"===t.method){if(r){const e=function(e,t){const n=[],r=Object.keys(e);t&&r.sort();for(const t of r){const r=e[t];void 0!==r&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}return n.join("&")}(r,null==a?void 0:a.sortQueryParams);""!==e&&(c+="?"+e)}}else u=t.rawBody?n:JSON.stringify(n);return{url:c,verb:t.method,headers:Object.assign(Object.assign({},i),{"Content-Type":"text/plain"}),body:u}}({apiServer:e,route:t,params:n,queryParams:r,urlParams:o,headers:i});return function(e){return a(this,arguments,void 0,(function*({url:e,verb:t,headers:n,body:r,timeoutMs:o}){const{controller:i,timeoutId:a}=(0,c.maybeCreateAbortController)(o);try{const o=yield fetch(e,Object.assign({method:t,mode:"cors",credentials:"include",headers:n,signal:null==i?void 0:i.signal},r?{body:r}:{}));return clearTimeout(a),o}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error(`Request timed out after ${o} ms`);throw e}}))}(Object.assign(Object.assign({},l),{timeoutMs:u})).then((e=>t.response&&200===e.status?e.json().then((t=>Object.assign(Object.assign({},t),{_response:e}))):{_response:e}))}},48528:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bindWithEmptyObject=t.bind=void 0,t.bind=function(e,t){return n=>e(Object.assign(Object.assign({},t),n))},t.bindWithEmptyObject=function(e){return()=>e({})}},79566:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateWithoutTime=t.dateWithoutTimeOrThrow=void 0;const r=n(90856);function o(e){return"string"==typeof e?function(e){return r.DateTime.fromISO(e).toISODate()}(e):e instanceof Date?function(e){return r.DateTime.fromJSDate(e).toISODate()}(e):function(e){return e.toISODate()}(e)}t.dateWithoutTimeOrThrow=function(e){if("string"==typeof e){const t=o(e);if(t)return t;throw new Error("Invalid date "+e)}if(e instanceof Date){const t=o(e);if(t)return t;throw new Error("Invalid date "+e)}const t=o(e);if(t)return t;throw new Error("Invalid date "+e)},t.dateWithoutTime=o},81923:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dedup=void 0,t.dedup=function(e,t,n){const r=e.reduce(((e,r)=>{const o=t(r);if(e.has(o)){if(n){const t=e.get(o);t&&n(t,r)>0&&e.set(o,r)}}else e.set(o,r);return e}),new Map);return Array.from(r.values())}},100:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setDifference=void 0,t.setDifference=function({a:e,b:t,itemIdentity:n}){const r=new Set;return t.forEach((e=>r.add(n(e)))),e.filter((e=>!r.has(n(e))))}},40662:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyObject=void 0,t.isEmptyObject=function(e){return 0===Object.keys(e).length}},81582:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndexOrFail=void 0,t.findIndexOrFail=({array:e,value:t,errorFn:n})=>{const r=e.indexOf(t);if(-1===r)throw n();return r}},24777:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertGlobToRegex=void 0;const n="@@ENTIRE_STRING_IS_GLOBSTAR@@",r="@@GLOBSTAR_AT_END@@",o="@@GLOBSTAR_FOLLOWED_BY_FORWARD_SLASH@@",i="@@STAR@@",a="@@DOT@@";t.convertGlobToRegex=function(e){return[e=>"**"===e?n:e,e=>e.replace(/\*\*$/,r),e=>e.replaceAll("**/",o),e=>e.replaceAll("*",i),e=>e.replaceAll(".",a),e=>e.replaceAll(n,".*"),e=>e.replaceAll(r,".*"),e=>e.replaceAll(o,"([^/]*/)*"),e=>e.replaceAll(i,"[^/]*"),e=>e.replaceAll(a,"\\."),e=>`^${e}`,e=>`${e}$`].reduce(((e,t)=>t(e)),e)}},26683:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithHeartbeat=void 0;const o=n(9188);t.runWithHeartbeat=function(e){return r(this,arguments,void 0,(function*({fn:e,heartbeat:t,heartbeatInterval:n,waitForHeartbeatOnExit:i}){let a=!1,s=!1,c=0;if(yield Promise.race([e(),(()=>r(this,void 0,void 0,(function*(){for(;!a;)yield t(),c++,yield(0,o.sleep)(n);s=!0})))()]),a=!0,i)for(;!s;)yield(0,o.sleep)({milliseconds:5});return{heartbeatCnt:c}}))}},85855:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.diffUntilNow=t.timeoutPromise=t.TimeoutError=t.plural=t.numberWithCommas=t.nth=t.humanizeDuration=t.humanizeDate=t.convertStringToNumberOrNull=t.commaSeparatedList=t.waitFor=t.sleep=t.semaphore=t.retryWithSleep=t.retryWithExponentialBackoff=t.percentDifference=t.parseIntOrNull=t.mapNonEmptyArray=t.isNonEmptyArrayOfNonEmptyArrays=t.isNonEmptyArray=t.flatNonEmptyArrayOfNonEmptyArrays=t.flatMapNonEmptyArray=t.median=t.createLookupTable=t.runWithHeartbeat=t.convertGlobToRegex=t.findIndexOrFail=t.isEmptyObject=t.setDifference=t.dedup=t.dateWithoutTimeOrThrow=t.dateWithoutTime=t.bindWithEmptyObject=t.bind=void 0,o(n(47798),t);var i=n(48528);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return i.bind}}),Object.defineProperty(t,"bindWithEmptyObject",{enumerable:!0,get:function(){return i.bindWithEmptyObject}});var a=n(79566);Object.defineProperty(t,"dateWithoutTime",{enumerable:!0,get:function(){return a.dateWithoutTime}}),Object.defineProperty(t,"dateWithoutTimeOrThrow",{enumerable:!0,get:function(){return a.dateWithoutTimeOrThrow}});var s=n(81923);Object.defineProperty(t,"dedup",{enumerable:!0,get:function(){return s.dedup}});var c=n(100);Object.defineProperty(t,"setDifference",{enumerable:!0,get:function(){return c.setDifference}});var u=n(40662);Object.defineProperty(t,"isEmptyObject",{enumerable:!0,get:function(){return u.isEmptyObject}});var l=n(81582);Object.defineProperty(t,"findIndexOrFail",{enumerable:!0,get:function(){return l.findIndexOrFail}});var d=n(24777);Object.defineProperty(t,"convertGlobToRegex",{enumerable:!0,get:function(){return d.convertGlobToRegex}});var f=n(26683);Object.defineProperty(t,"runWithHeartbeat",{enumerable:!0,get:function(){return f.runWithHeartbeat}});var h=n(72970);Object.defineProperty(t,"createLookupTable",{enumerable:!0,get:function(){return h.createLookupTable}});var p=n(98117);Object.defineProperty(t,"median",{enumerable:!0,get:function(){return p.median}});var m=n(54560);Object.defineProperty(t,"flatMapNonEmptyArray",{enumerable:!0,get:function(){return m.flatMapNonEmptyArray}}),Object.defineProperty(t,"flatNonEmptyArrayOfNonEmptyArrays",{enumerable:!0,get:function(){return m.flatNonEmptyArrayOfNonEmptyArrays}}),Object.defineProperty(t,"isNonEmptyArray",{enumerable:!0,get:function(){return m.isNonEmptyArray}}),Object.defineProperty(t,"isNonEmptyArrayOfNonEmptyArrays",{enumerable:!0,get:function(){return m.isNonEmptyArrayOfNonEmptyArrays}}),Object.defineProperty(t,"mapNonEmptyArray",{enumerable:!0,get:function(){return m.mapNonEmptyArray}});var g=n(66838);Object.defineProperty(t,"parseIntOrNull",{enumerable:!0,get:function(){return g.parseIntOrNull}});var v=n(18806);Object.defineProperty(t,"percentDifference",{enumerable:!0,get:function(){return v.percentDifference}});var b=n(68001);Object.defineProperty(t,"retryWithExponentialBackoff",{enumerable:!0,get:function(){return b.retryWithExponentialBackoff}}),Object.defineProperty(t,"retryWithSleep",{enumerable:!0,get:function(){return b.retryWithSleep}});var y=n(29721);Object.defineProperty(t,"semaphore",{enumerable:!0,get:function(){return y.semaphore}});var _=n(9188);Object.defineProperty(t,"sleep",{enumerable:!0,get:function(){return _.sleep}}),Object.defineProperty(t,"waitFor",{enumerable:!0,get:function(){return _.waitFor}});var E=n(15029);Object.defineProperty(t,"commaSeparatedList",{enumerable:!0,get:function(){return E.commaSeparatedList}}),Object.defineProperty(t,"convertStringToNumberOrNull",{enumerable:!0,get:function(){return E.convertStringToNumberOrNull}}),Object.defineProperty(t,"humanizeDate",{enumerable:!0,get:function(){return E.humanizeDate}}),Object.defineProperty(t,"humanizeDuration",{enumerable:!0,get:function(){return E.humanizeDuration}}),Object.defineProperty(t,"nth",{enumerable:!0,get:function(){return E.nth}}),Object.defineProperty(t,"numberWithCommas",{enumerable:!0,get:function(){return E.numberWithCommas}}),Object.defineProperty(t,"plural",{enumerable:!0,get:function(){return E.plural}});var C=n(35620);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return C.TimeoutError}}),Object.defineProperty(t,"timeoutPromise",{enumerable:!0,get:function(){return C.timeoutPromise}});var R=n(77190);Object.defineProperty(t,"diffUntilNow",{enumerable:!0,get:function(){return R.diffUntilNow}})},72970:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLookupTable=void 0,t.createLookupTable=function({items:e,getKey:t,serializeKey:n}){const r={};return e.forEach((e=>{r[n(t(e))]=e})),e=>r[n(e)]}},98117:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.median=void 0;const r=n(47798);t.median=function(e){const t=e.filter(r.filterNullUndefined).sort(((e,t)=>e-t));if(0===t.length)return;const n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}},54560:(e,t)=>{function n(e){return void 0!==e[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.flatNonEmptyArrayOfNonEmptyArrays=t.flatMapNonEmptyArray=t.mapNonEmptyArray=t.isNonEmptyArrayOfNonEmptyArrays=t.isNonEmptyArray=void 0,t.isNonEmptyArray=n,t.isNonEmptyArrayOfNonEmptyArrays=e=>e.every(n)&&n(e),t.mapNonEmptyArray=function(e,t){return e.map(t)},t.flatMapNonEmptyArray=function(e,t){return e.flatMap(t)},t.flatNonEmptyArrayOfNonEmptyArrays=function(e){return e.flat()}},66838:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseIntOrNull=void 0,t.parseIntOrNull=function(e){if(null==e)return null;const t=parseInt(e);return Number.isNaN(t)?null:t}},18806:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.percentDifference=void 0,t.percentDifference=function({value:e,comparison:t}){return 0===t?null:Math.round((e-t)/t*100)}},68001:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.retryWithSleep=t.retryWithExponentialBackoff=void 0;const i=o(n(86776)),a=n(9188);function s({attempt:e,options:t}){const{initialDelayMs:n,maxDelayMs:r,backoffMultiplier:o=2,jitterFactor:i=0}=t,a=Math.min(n*Math.pow(o,e),r);if(0===i)return{milliseconds:a};const s=a*i,c=(2*Math.random()-1)*s;return{milliseconds:Math.max(n,Math.min(r,a+c))}}function c(e,t){return!(null==t?void 0:t.length)||t.some((t=>"prototype"in t?e instanceof t:t(e)))}t.retryWithExponentialBackoff=e=>r(void 0,[e],void 0,(function*({fn:e,onRetry:t,options:n,sleepHandler:r=a.sleep}){const o=Math.max(1,n.maxTries);for(const a of i.default.range(o+1))try{return yield e()}catch(e){if(a+1>=o||!c(e,n.retryableErrors))throw e;const i=s({attempt:a,options:n});yield null==t?void 0:t({retryCount:a,err:e,nextDelay:i}),yield r(i)}throw new Error("Unreachable")})),t.retryWithSleep=e=>r(void 0,[e],void 0,(function*({fn:e,onRetry:t,options:n}){for(const r of i.default.range(n.maxRetries))try{return yield e()}catch(e){if(r+1>=n.maxRetries)throw e;null==t||t({retryCount:r,err:e}),yield(0,a.sleep)(n.sleepDuration)}throw new Error("Unreachable")}))},29721:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.semaphore=void 0,t.semaphore=function(e,t){let n;const r=new Promise((e=>{n=e})),o=[...t];let i=0;return function t(){const r=o.shift();void 0!==r?(i++,r().catch(console.error).finally((()=>{i--,t()})),i<e&&t()):0===i&&n(void 0)}(),r}},9188:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,void 0,void 0,(function*(){const t=o(e);yield new Promise((e=>{setTimeout(e,t)}))}))}Object.defineProperty(t,"__esModule",{value:!0}),t.waitFor=t.sleep=void 0,t.sleep=r,t.waitFor=e=>n(void 0,[e],void 0,(function*({condition:e,sleepDuration:t,timeout:n,label:i}){const a=o(t),s=o(null!=n?n:{minutes:1});for(const t=Date.now();Date.now()-t<s;){if(yield e())return;yield r({milliseconds:a})}throw new Error(`Timeout waiting for ${null!=i?i:"condition"}`)}));const o=e=>"minutes"in e?60*e.minutes*1e3:"seconds"in e?1e3*e.seconds:"days"in e?24*e.days*60*60*1e3:e.milliseconds},15029:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nth=t.numberWithCommas=t.commaSeparatedList=t.humanizeDuration=t.convertStringToNumberOrNull=t.humanizeDate=t.plural=void 0;const r=n(90856);t.plural=(e,t,n)=>{const r=(null==n?void 0:n.pluralSuffix)||"s",o=null==n?void 0:n.pluralWordOverride;return o?`${(null==n?void 0:n.prependAIfSingular)&&1===t?"a ":""}${1!==t?o:e}`:`${(null==n?void 0:n.prependAIfSingular)&&1===t?"a ":""}${e}${1!==t?r:""}`},t.humanizeDate=(e,t)=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:null==t?void 0:t.timeZone,timeZoneName:null==t?void 0:t.includeTimeZone}),t.convertStringToNumberOrNull=e=>{if(""===e)return null;const t=+e;return Number.isNaN(t)?null:t},t.humanizeDuration=(e,t)=>{const n=r.Duration.fromObject({seconds:e}).rescale(),o=[];return n.years>0&&o.push(`${n.years}y`),n.months>0&&o.push(`${n.months}mo`),n.days>0&&o.push(`${7*n.weeks+n.days}d`),n.hours>0&&o.push(`${n.hours}h`),n.minutes>0&&o.push(`${n.minutes}m`),t&&0===o.length&&o.push(`${n.seconds}s`),o.join(" ")},t.commaSeparatedList=e=>{var t;return 0===e.length?"":1===e.length?null!==(t=e[0])&&void 0!==t?t:"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`},t.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},t.nth=e=>0===e?"zeroth":e%10==1&&e%100!=11?1===e?"first":`${e}st`:e%10==2&&e%100!=12?2===e?"second":`${e}nd`:e%10==3&&e%100!=13?3===e?"third":`${e}rd`:`${e}th`},35620:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=void 0;class n extends Error{}t.TimeoutError=n,t.timeoutPromise=({promise:e,timeoutMs:t})=>Promise.race([e,new Promise((e=>setTimeout(e,t))).then((()=>{throw new n(`Timeout after ${t}ms`)}))])},77190:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.diffUntilNow=void 0;const r=n(90856);t.diffUntilNow=({startTime:e})=>r.DateTime.now().diff(e)},47798:(e,t)=>{function n(e){return null!==e}function r(e){return void 0!==e}Object.defineProperty(t,"__esModule",{value:!0}),t.filterNullUndefined=t.filterUndefined=t.filterNull=t.setEquals=t.isPropertyValue=t.assertUnreachable=void 0,t.assertUnreachable=function(e){throw new Error(`Didn't expect to get here, arg: ${JSON.stringify(e)}`)},t.isPropertyValue=function(e,t){return Object.values(e).includes(t)},t.setEquals=function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},t.filterNull=n,t.filterUndefined=r,t.filterNullUndefined=function(e){return n(e)&&r(e)}},60691:(e,t,n)=>{n.r(t),n.d(t,{extractTokenCwdAndPlatformFromUrlForTests:()=>Y,startServer:()=>Q,validateTokenForTests:()=>X});var r=n(34388),o=n(77052),i=n(79896),a=n.n(i),s=n(58611),c=n.n(s),u=n(16928),l=n.n(u),d=n(87016),f=n.n(d),h=n(79438);n(85855);var p=n(35317),m=n(70857),g=n.n(m);const v="win32"===process.platform?l().join((0,o.unwrap)(process.env.LOCALAPPDATA),"cache"):"darwin"===process.platform?l().join(g().homedir(),"Library/Caches"):process.env.XDG_CACHE_HOME||l().join(g().homedir(),".cache");l().join(v,"graphite-gti");var b=n(76982);function y(){try{return g().userInfo().username}catch(e){try{const{env:e}=process;return(0,o.unwrap)(e.LOGNAME||e.USER||e.LNAME||e.USERNAME)}catch(t){throw new Error(String(t)+String(e))}}}class _{splog;data;constructor(e,t){this.splog=e,this.data=t}setRepo(e){this.data.repo=e?.codeReviewProvider?.getSummaryName()}}const E=e=>{};var C=n(33499);const R=r.sendAnalyticsEvent;const w=async({userConfig:e})=>{const t=e.getGtiConfigValue("gti.install-uuid");if(t)return t;const n=(0,C.A)();return await e.setGtiConfigValue("gti.install-uuid",n),n};var P=n(71270),O=n.n(P),N=n(30862),S=n.n(N);function A(e,t,n,r){let o=[...t];"win32"!==process.platform&&(o=o.map((e=>e.replace(/\\\\/g,"\\"))));const i={...r,env:{LANG:"en_US.utf-8",EDITOR:void 0,GRAPHITE_INTERACTIVE:"true",GIT_OPTIONAL_LOCKS:"0"},cwd:n};return!e&&process.argv[1].startsWith("/snapshot/")?(e=process.argv[0],o=["/snapshot/monologue/apps/public/cli/dist/graphite.js",...o]):e||(e="gt"),{command:e,args:o,options:i}}function M({command:e,args:t,splog:n,cwd:r,options:o}){const{command:i,args:a,options:s}=A(e,t,r,o);return n&&n.info(`run command: ${i} ${a.join(" ")} ${JSON.stringify(s)}`),S()(i,a,s)}const T="1.0.14";var k=n(24434);class x extends k.EventEmitter{}class I{codeReviewSystem;runCommand;gtEngineForRepo;constructor(e,t,n){this.codeReviewSystem=e,this.runCommand=t,this.gtEngineForRepo=n}diffSummaries=new x;onChangeDiffSummaries(e){const t=t=>e({value:t}),n=t=>e({error:t});return this.diffSummaries.on("data",t),this.diffSummaries.on("error",n),{dispose:()=>{this.diffSummaries.off("data",t),this.diffSummaries.off("error",n)}}}async triggerDiffSummariesFetch(e){const t=await this.gtEngineForRepo.prOrchestrator.getPrInfoForKnownPrs({repo:this.getRepo()});this.diffSummaries.emit("data",t)}dispose(){this.diffSummaries.removeAllListeners()}getSummaryName(){return`github:${this.codeReviewSystem.hostname}/${this.codeReviewSystem.owner}/${this.codeReviewSystem.repo}`}runExternalCommand(e,t,n,r){throw new Error("GitHub code review provider does not support running external commands")}async typeahead(e,t){return Promise.resolve([])}getRepo(){return{owner:this.codeReviewSystem.owner,name:this.codeReviewSystem.repo}}}class B{splog;runCallback;constructor(e,t){this.splog=e,this.runCallback=t}queuedOperations=[];runningOperation=void 0;abortController=void 0;async runOrQueueOperation(e,t,n,r){if(null!=this.runningOperation)return this.queuedOperations.push({...e,tracker:n}),void t({id:e.id,kind:"queue",queue:this.queuedOperations.map((e=>e.id))});this.runningOperation=e;const o=(...n)=>{switch(n[0]){case"spawn":t({id:e.id,kind:"spawn",queue:this.queuedOperations.map((e=>e.id))});break;case"stdout":t({id:e.id,kind:"stdout",message:n[1]});break;case"stderr":t({id:e.id,kind:"stderr",message:n[1]});break;case"exit":t({id:e.id,kind:"exit",exitCode:n[1],timestamp:Date.now()})}};try{const i=new AbortController;if(this.abortController=i,await n.operation(e.trackEventName,"RunOperationError",{extras:{args:e.args,runner:e.runner}},(t=>this.runCallback(e,r,o,i.signal))),this.runningOperation=void 0,this.queuedOperations.length>0){const e=this.queuedOperations.shift();null!=e&&this.runOrQueueOperation(e,t,e.tracker,r)}}catch(n){const r=n.toString();this.splog.error(`error running operation: ${e.args[0]} ${r}`),t({id:e.id,kind:"error",error:r}),this.queuedOperations=[],this.runningOperation=void 0}}abortRunningOperation(e){this.runningOperation?.id===e&&this.abortController?.abort()}}class D{focusedPages=new Set;visiblePages=new Set;onChangeHandlers=new Set;setState(e,t){switch(t){case"focused":this.focusedPages.add(e),this.visiblePages.add(e);break;case"visible":this.focusedPages.delete(e),this.visiblePages.add(e);break;case"hidden":this.focusedPages.delete(e),this.visiblePages.delete(e)}for(const e of this.onChangeHandlers)e(t)}disposePage(e){this.focusedPages.delete(e),this.visiblePages.delete(e)}hasPageWithFocus(){return this.focusedPages.size>0}hasVisiblePage(){return this.visiblePages.size>0}onChange(e){return this.onChangeHandlers.add(e),()=>this.onChangeHandlers.delete(e)}}class j{maxSimultaneousRunning;log;queued=[];running=[];runs=new x;constructor(e,t){this.maxSimultaneousRunning=e,this.log=t}nextId=1;generateId(){return this.nextId++}async enqueueRun(e){const t=this.generateId();this.queued.push(t),this.tryDequeueNext(),this.running.includes(t)||(this.log?.(`${this.running.length} tasks are already running, enqueuing ID:${t}`),await new Promise((e=>{this.runs.on("run",(n=>{n===t&&(this.log?.(`now allowing ID:${t} to run`),e(void 0))}))})));try{return await e()}finally{this.notifyFinished(t)}}notifyFinished(e){this.running=this.running.filter((t=>t!==e)),this.tryDequeueNext()}tryDequeueNext(){if(this.running.length<this.maxSimultaneousRunning){const e=this.queued.shift();null!=e&&this.run(e)}}run(e){this.running.push(e),this.runs.emit("run",e)}}function F(e){let t,n;const r=()=>{const t=e();return n=t.then((()=>n=void 0),(()=>n=void 0)),t},o=()=>(t=void 0,r());return()=>null==n?r():(()=>{if(null==t){if(null==n)throw new Error("pendingCall must not be null!");t=n.then(o,o)}return t})()}function G(e){switch(e.type){case o.ComparisonType.UncommittedChanges:return["uncommitted"];case o.ComparisonType.HeadChanges:return["head"];case o.ComparisonType.StackChanges:return["stack"];case o.ComparisonType.Committed:return["stack","--ref",e.hash];case o.ComparisonType.Commit:case o.ComparisonType.Range:default:throw new Error("Unsupported comparison type: "+e.type)}}class U{info;platform;splog;gtEngineForRepo;IGNORE_COMMIT_MESSAGE_LINES_REGEX=/^((?:HG|SL):.*)/gm;mergeConflicts=void 0;uncommittedChanges=null;smartlogCommits=null;mergeConflictsEmitter=new x;uncommittedChangesEmitter=new x;smartlogCommitsChangesEmitter=new x;smartlogCommitsBeginFetchingEmitter=new x;uncommittedChangesBeginFetchingEmitter=new x;disposables=[()=>this.mergeConflictsEmitter.removeAllListeners(),()=>this.uncommittedChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsBeginFetchingEmitter.removeAllListeners(),()=>this.uncommittedChangesBeginFetchingEmitter.removeAllListeners()];onDidDispose(e){this.disposables.push(e)}operationQueue;watchForChangesDisposer;pageFocusTracker=new D;codeReviewProvider;currentVisibleCommitRangeIndex=0;visibleCommitRanges=[o.DEFAULT_DAYS_OF_COMMITS_TO_LOAD,60,void 0];constructor(e,t,n,r){this.info=e,this.platform=t,this.splog=n,this.gtEngineForRepo=r;const i=e.codeReviewSystem;"github"===i.type&&(this.codeReviewProvider=new I(i,this.runCommand.bind(this),r)),this.watchForChangesDisposer=t.watchForChanges(e,n,(e=>{"uncommitted changes"===e?(this.fetchUncommittedChanges(),this.checkForMergeConflicts()):"branches"===e?this.fetchSmartlogCommits():"merge conflicts"===e?this.checkForMergeConflicts():"everything"===e&&(this.fetchUncommittedChanges(),this.fetchSmartlogCommits(),this.checkForMergeConflicts())})),this.operationQueue=new B(this.splog,((e,t,n,r)=>{if(e.runner===o.CommandRunner.Graphite)return this.runOperation(e,n,t,r);if(e.runner===o.CommandRunner.CodeReviewProvider){const o=this.normalizeOperationArgs(t,e.args);return null==this.codeReviewProvider?.runExternalCommand?Promise.reject(Error("CodeReviewProvider does not support running external commands")):this.codeReviewProvider?.runExternalCommand(t,o,n,r)??Promise.resolve()}return Promise.resolve()}));const a=new Set,s=this.subscribeToSmartlogCommitsChanges((e=>{if(e.commits.value){const t=[],n=e.commits.value.filter((e=>e.pr)).map((e=>e.pr?.number));for(const e of n)a.has(e)||(t.push(e),a.add(e));t.length>0&&this.codeReviewProvider?.triggerDiffSummariesFetch(this.getAllDiffIds())}}));this.checkForMergeConflicts(),this.disposables.push((()=>s.dispose()))}getRepoId(){switch(this.info.codeReviewSystem.type){case"github":return{owner:this.info.codeReviewSystem.owner,name:this.info.codeReviewSystem.repo};case"none":return null}}nextVisibleCommitRangeInDays(){return this.currentVisibleCommitRangeIndex+1<this.visibleCommitRanges.length&&this.currentVisibleCommitRangeIndex++,this.visibleCommitRanges[this.currentVisibleCommitRangeIndex]}dispose(){this.disposables.forEach((e=>e())),this.codeReviewProvider?.dispose(),this.watchForChangesDisposer?.()}onChangeConflictState(e){return this.mergeConflictsEmitter.on("change",e),this.mergeConflicts&&e(this.mergeConflicts),{dispose:()=>this.mergeConflictsEmitter.off("change",e)}}checkForMergeConflicts=(0,o.debounce)(F((async()=>{this.splog.info("checking for merge conflicts");const e=Boolean(this.mergeConflicts);if(!e&&!await(t=l().join(this.info.dotdir,"rebase-merge"),a().promises.stat(t).then((()=>!0)).catch((e=>{if("ENOENT"===e.code)return!1;throw e}))))return void this.splog.info(`conflict state still the same (${e?"IN merge conflict":"NOT in conflict"})`);var t;this.mergeConflicts||(this.mergeConflicts={state:"loading"},this.mergeConflictsEmitter.emit("change",this.mergeConflicts));const n=Date.now();let r;try{r=await this.gtEngineForRepo.gitOrchestrator.getGitFileAndRebaseStatus({})}catch(e){return this.splog.error(`failed to check for merge conflicts: ${e}`),this.mergeConflicts=void 0,void this.mergeConflictsEmitter.emit("change",this.mergeConflicts)}const o=await(async({repoInfo:e})=>a().promises.readFile(l().join(e.dotdir,"rebase-merge","head-name")).then((e=>{const t=e.toString();return t.startsWith("refs/heads/")?t.slice(11).trimEnd():void 0}),(()=>{})))({repoInfo:this.info});if(this.mergeConflicts=(({previousConflicts:e,branchName:t,fileAndRebaseStatus:n,fetchStartTimestamp:r})=>{const o=n;if(!o?.conflicts||!t)return;const i=o.files.filter((e=>"UNRESOLVED"===e.status)),a={state:"loaded",branchName:t,files:[],fetchStartTimestamp:r,fetchCompletedTimestamp:Date.now()};if(null!=e?.files&&e.files.length>0){const t=new Set(i.map((e=>e.path)));a.files=e.files.map((e=>t.has(e.path)?{path:e.path,status:"UNRESOLVED"}:{path:e.path,status:"RESOLVED"}))}else a.files=i.map((e=>({path:e.path,status:"UNRESOLVED"})));return a})({previousConflicts:this.mergeConflicts,branchName:o,fileAndRebaseStatus:r,fetchStartTimestamp:n}),this.splog.info(`repo ${this.mergeConflicts?"IS":"IS NOT"} in merge conflicts ${JSON.stringify({mergeConflicts:this.mergeConflicts,files:this.mergeConflicts?.files})}`),this.mergeConflicts){const e=(({mergeConflicts:e})=>(e.files??[]).filter((e=>"UNRESOLVED"===e.status)).map((e=>e.path)).slice(0,20))({mergeConflicts:this.mergeConflicts});this.splog.info(`remaining files with conflicts: ${o} ${e.join(" ")}`)}this.mergeConflictsEmitter.emit("change",this.mergeConflicts)})),100);getMergeConflicts(){return this.mergeConflicts}async runOrQueueOperation(e,t,n,r){await this.operationQueue.runOrQueueOperation(e,t,n,r)}abortRunningOperation(e){this.operationQueue.abortRunningOperation(e)}normalizeOperationArgs(e,t){const n=(0,o.unwrap)(this.info.repoRoot);return t.map((t=>{if("object"==typeof t)switch(t.type){case"repo-relative-file":return l().normalize(l().relative(e,l().join(n,t.path)));case"succeedable-revset":return`max(successors(${t.revset}))`}return t}))}async runOperation(e,t,n,r){const o=this.normalizeOperationArgs(n,e.args),{stdin:i}=e,{command:a,args:s,options:c}=A(this.info.command,o,n,i?{input:i}:void 0);this.splog.info(`run operation: ${a} ${o.join(" ")}`);const u=S()(a,s,{...c,stdout:"pipe",stderr:"pipe"});t("spawn"),u.stdout?.on("data",(e=>{t("stdout",e.toString())})),u.stderr?.on("data",(e=>{t("stderr",e.toString())})),u.on("exit",(e=>{t("exit",e||0)})),r.addEventListener("abort",(()=>{this.splog.warn(`kill operation: ${a} ${o.join(" ")}`)})),function(e,t){t.addEventListener("abort",(()=>{"win32"===g().platform()?e.kill("SIGKILL",{forceKillAfterTimeout:!1}):(e.kill("SIGCONT"),e.kill("SIGTERM",{forceKillAfterTimeout:5e3}))}))}(u,r),await u}setPageFocus(e,t){this.pageFocusTracker.setState(e,t)}getUncommittedChanges(){return this.uncommittedChanges}subscribeToUncommittedChanges(e){return this.uncommittedChangesEmitter.on("change",e),{dispose:()=>{this.uncommittedChangesEmitter.off("change",e)}}}fetchUncommittedChanges=(0,o.debounce)(F((async()=>{const e=Date.now();try{this.uncommittedChangesBeginFetchingEmitter.emit("start");const t=(await this.gtEngineForRepo.gitOrchestrator.getGitFileAndRebaseStatus({})).files.map((e=>{return{...e,path:(t=e.path,t.startsWith(l().sep)?t.slice(1):t)};var t}));this.uncommittedChanges={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{value:t}},this.uncommittedChangesEmitter.emit("change",this.uncommittedChanges)}catch(n){if(this.splog.error("Error fetching files: ",n),null!=(t=n)&&"object"==typeof t&&"stderr"in t&&n.stderr.includes("checkout is currently in progress"))return void this.splog.info("Ignoring `hg status` error caused by in-progress checkout");this.uncommittedChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{error:n instanceof Error?n:new Error(n)}})}var t})),100);getSmartlogCommits(){return this.smartlogCommits}subscribeToSmartlogCommitsChanges(e){return this.smartlogCommitsChangesEmitter.on("change",e),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",e)}}}subscribeToSmartlogCommitsBeginFetching(e){const t=()=>e(!0);return this.smartlogCommitsBeginFetchingEmitter.on("start",t),{dispose:()=>{this.smartlogCommitsBeginFetchingEmitter.off("start",t)}}}subscribeToUncommittedChangesBeginFetching(e){const t=()=>e(!0);return this.uncommittedChangesBeginFetchingEmitter.on("start",t),{dispose:()=>{this.uncommittedChangesBeginFetchingEmitter.off("start",t)}}}fetchSmartlogCommits=(0,o.debounce)(F((async()=>{const e=Date.now();try{this.smartlogCommitsBeginFetchingEmitter.emit("start");const t=await this.runCommand(["internal-only","log"]),n=function(e,t){let n=[];try{n=JSON.parse(t)}catch(t){e.error("failed to parse branch info",t)}return n}(this.splog,t.stdout.trim());if(0===n.length)throw new Error(o.ErrorShortMessages.NoCommitsFetched);this.smartlogCommits={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{value:n}},this.smartlogCommitsChangesEmitter.emit("change",this.smartlogCommits)}catch(t){this.splog.error("Error fetching commits: ",t),this.smartlogCommitsChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{error:t instanceof Error?t:new Error(t)}})}})),100);subscribeToHeadCommit(e){let t=this.smartlogCommits?.commits.value?.find((e=>e.isHead));null!=t&&e(t);const n=n=>{const r=n?.commits.value?.find((e=>e.isHead));null!=r&&r.branch!==t?.branch&&(e(r),t=r)};return this.smartlogCommitsChangesEmitter.on("change",n),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",n)}}}catLimiter=new j(4,(e=>this.splog.info(`[cat] ${e}`)));relativeCat(e,t){const n=l().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((async()=>(await this.runCommand(["internal-only","relative-cat",...this.catArgs(t,n)],void 0,{stripFinalNewline:!1})).stdout))}cat(e,t){const n=l().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((async()=>(await this.runCommand(["internal-only","cat",t,n],void 0,{stripFinalNewline:!1})).stdout))}catArgs(e,t){switch(e.type){case o.ComparisonType.UncommittedChanges:return["uncommitted",t];case o.ComparisonType.HeadChanges:return["head",t];case o.ComparisonType.StackChanges:return["stack",t];case o.ComparisonType.Committed:return["stack",t,"--ref",e.hash]}}getAllDiffIds(){return this.getSmartlogCommits()?.commits.value?.map((e=>e.pr?.number)).filter(o.notEmpty)??[]}runCommand(e,t,n){return M({command:this.info.command,args:e,splog:this.splog,cwd:(0,o.unwrap)(t??this.info.repoRoot),options:n})}}var L=n(91943),H=n(31611),$=n.n(H);class V{promise;disposeFunc;constructor(e,t){this.promise=e,this.disposeFunc=t}unref(){this.disposed||(this.disposed=!0,this.disposeFunc())}internalReference;disposed=!1}class q{value;constructor(e){this.value=e}references=0;isDisposed=!1;ref(){this.references++}getNumberOfReferences(){return this.references}dispose(){this.references--,this.isDisposed||0!==this.references||(this.isDisposed=!0,this.value.dispose())}}const W=new class{reposByRoot=new Map;activeReposEmitter=new x;getOrCreate({version:e,cmd:t,platform:n,splog:o,cwd:i}){const a=this.lookup(i);if(a)return a.ref(),new V(Promise.resolve(a.value),(()=>a.dispose()));let s;return s=new V((async()=>{const a=await(0,r.composeUserConfigFactory)().load(),c=await(async({command:e,splog:t,cwd:n,userConfig:o})=>{const i=await async function({command:e,splog:t,cwd:n}){try{return(await M({command:e,args:["--version"],splog:t,cwd:n})).stdout}catch(e){throw t.error(`Failed to find gt version in ${n}`,e),e}}({command:e,splog:t,cwd:n}).catch((e=>e));if(i instanceof Error)return{type:"invalidCommand",command:e??"gt"};if(!i.startsWith("local")&&!i.startsWith("dev")&&O().lt(i,T))return{type:"invalidVersion",command:e??"gt",versionFound:i,versionRequired:T};const a=function({userConfig:e,splog:t}){try{return{appUrl:e.getAppServerUrl()}}catch(e){return t.error("Failed to find repository profile",e),{appUrl:"https://app.graphite.dev/"}}}({userConfig:o,splog:t}),s=await(0,r.composeGit)({cwd:n,splog:t});if(!s.repo)return{type:"cwdNotARepository",cwd:n};const c=await(0,r.composeRepoConfigFactory)(s).load(),u=await c.getRepoInfo();let l;if(void 0===u.remote)l={type:"none"};else{const{owner:e,name:t,hostname:n}=u.remote;l={type:"github",owner:e,repo:t,hostname:n}}const d={type:"success",command:e,dotdir:u.dotDir,repoRoot:u.rootDir,codeReviewSystem:l,profile:a,trunkBranch:u.trunkBranch};return t.info(`repo info: ${JSON.stringify(d)}`),d})({command:t,splog:o,cwd:i,userConfig:a});if(o.info(`repoInfo ${JSON.stringify(c)}`),"success"!==c.type)return c;if(s.disposed)return{type:"unknownError",error:new Error("Repository already disposed")};const u=this.lookup(c.repoRoot);if(u)return u.ref(),s.internalReference=u,u.value;const l=await(0,r.createGtEngineForRepo)({version:e,repoDir:i,splog:o}),d=new U(c,n,o,l),f=new q(d);return f.ref(),s.internalReference=f,this.reposByRoot.set(c.repoRoot,f),this.activeReposEmitter.emit("change"),d})(),(()=>{s.internalReference&&s.internalReference.dispose(),s.unref()})),s}cachedRepositoryForPath(e){const t=this.lookup(e);return t?.value}onChangeActiveRepos(e){const t=()=>{e([...this.reposByRoot.values()].map((e=>e.value)))};return this.activeReposEmitter.on("change",t),t(),()=>this.activeReposEmitter.off("change",t)}clearCache(){this.reposByRoot.forEach((e=>e.dispose())),this.reposByRoot=new Map,this.activeReposEmitter.removeAllListeners()}numberOfActiveServers(){let e=0;for(const t of this.reposByRoot.values())e+=t.getNumberOfReferences();return e}lookup(e){for(const n of this.reposByRoot.values())if((e===n.value.info.repoRoot||e.startsWith((t=n.value.info.repoRoot).endsWith(l().sep)?t:t+l().sep))&&!n.isDisposed)return n;var t}};class K{context;listenersByType=new Map;incomingListener;repoDisposables=[];subscriptions=new Map;activeRepoRef;queuedMessages=[];currentState={type:"loading"};pageId=(0,o.randomId)();platform;connection;tracker;splog;version;constructor(e){this.context=e,this.platform=e.platform,this.connection=e.connection,this.tracker=e.tracker,this.splog=e.splog,this.version=e.version;let t=null;this.incomingListener=this.connection.onDidReceiveMessage(((n,r)=>{if(r)return null==t?void e.connection.splog?.error("Error: got a binary message when not expecting one"):(this.handleIncomingMessageWithPayload(t,n),void(t=null));if(null!=t)return e.connection.splog?.error("Error: didnt get binary payload after a message that requires one"),void(t=null);const i=n.toString("utf-8"),a=(0,o.deserializeFromString)(i);if(function(e){return null!=e&&"object"==typeof e&&!0===e.hasBinaryPayload}(a))t=a;else if("loading"===this.currentState.type)this.queuedMessages.push(a);else try{this.handleIncomingMessage(a)}catch(t){e.connection.splog?.error(`error handling incoming message: ${a}`,t)}}))}setRepoError(e){this.disposeRepoDisposables(),this.currentState={type:"error",error:e},this.tracker.context.setRepo(void 0),this.processQueuedMessages()}setCurrentRepo(e,t){this.disposeRepoDisposables(),this.currentState={type:"repo",repo:e,cwd:t},this.tracker.context.setRepo(e),null!=e.codeReviewProvider&&this.repoDisposables.push(e.codeReviewProvider.onChangeDiffSummaries((e=>{this.postMessage({type:"fetchedDiffSummaries",summaries:e})}))),this.repoDisposables.push(e.subscribeToHeadCommit((t=>{const n=e.getSmartlogCommits(),r=function(e,t){let n;if(null!=e){const r=new Map(e.map((e=>[e.branch,e])));let o=t;for(;null!=o;){if(o.partOfTrunk){n=o;break}if(null==o.parents[0])break;o=r.get(o.parents[0])}}return n}(n?.commits.value,t);this.tracker.track("HeadCommitChanged",{extras:{hash:t.branch,public:r?.branch}})}))),this.processQueuedMessages()}postMessage(e){this.connection.postMessage((0,o.serializeToString)(e)).catch((()=>{console.warn("Failed to post message to client")}))}setActiveRepoForCwd(e){void 0!==this.activeRepoRef&&this.activeRepoRef.unref(),this.splog.info(`Setting active repo cwd to ${e}`),this.currentState={type:"loading"};const t=this.connection.command;this.activeRepoRef=W.getOrCreate({cmd:t,platform:this.platform,splog:this.splog,cwd:e,version:this.version}),this.activeRepoRef.promise.then((t=>{t instanceof U?this.setCurrentRepo(t,e):this.setRepoError(t)}))}dispose(){this.incomingListener.dispose(),this.disposeRepoDisposables(),void 0!==this.activeRepoRef&&this.activeRepoRef.unref()}disposeRepoDisposables(){this.repoDisposables.forEach((e=>e.dispose())),this.repoDisposables=[],this.subscriptions.forEach((e=>e.dispose())),this.subscriptions.clear()}processQueuedMessages(){for(const e of this.queuedMessages)try{this.handleIncomingMessage(e)}catch(t){this.connection.splog?.error(`error handling queued message: ${JSON.stringify(e)}`,t)}this.queuedMessages=[]}handleIncomingMessageWithPayload(e,t){switch(e.type){case"uploadFile":{const{id:n,filename:r}=e,i=null;if(null==i)return;this.tracker.operation("UploadImage","UploadImageError",{},(()=>i((0,o.unwrap)(this.connection.splog),{filename:r,data:t}))).then((e=>{this.connection.splog?.info(`successfully uploaded file ${r} ${e}`),this.postMessage({type:"uploadFileResult",id:n,result:{value:e}})})).catch((e=>{this.connection.splog?.info(`error uploading file ${r} ${e}`),this.postMessage({type:"uploadFileResult",id:n,result:{error:e}})}));break}}}handleIncomingMessage(e){this.handleIncomingGeneralMessage(e);const{currentState:t}=this;switch(t.type){case"repo":{const{repo:n,cwd:r}=t;this.handleIncomingMessageWithRepo(e,n,r);break}case"loading":case"error":e.type.startsWith("platform/")&&(this.platform.handleMessageFromClient(void 0,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})})),this.notifyListeners(e))}}handleIncomingGeneralMessage(e){switch(this.splog.info(`GeneralMessage ${JSON.stringify(e)}`),e.type){case"installCli":("brew"===e.method?S()("brew",["install","withgraphite/tap/graphite"]):S()("npm",["install","-g","@withgraphite/graphite-cli@stable"])).then((()=>{this.postMessage({type:"installCliResult",result:"success"})})).catch((e=>{const t=e instanceof Error?e.message:"Unknown error";this.postMessage({type:"installCliResult",result:"error",error:t})}));break;case"updateCli":$()("gt").then((async e=>{const t=await(0,L.realpath)(e),n="lib/node_modules/@withgraphite/graphite-cli/graphite.js";if(t.endsWith(n)){const e=t.replace(n,"bin/npm");return S()(e,["install","-g","@withgraphite/graphite-cli@stable"])}if(t.endsWith("/bin/gt")&&t.includes("Cellar"))return await S()("brew",["update"]),S()("brew",["upgrade","withgraphite/tap/graphite"]);throw new Error("Couldn't determine installation method")})).then((()=>{this.postMessage({type:"updateCliResult",result:"success"})})).catch((e=>{this.postMessage({type:"updateCliResult",result:"error",error:e instanceof Error?e.message:"Unknown error"})}));break;case"fetchAllBranches":"repo"===this.currentState.type&&(({splog:e,onSuccess:t,git:n})=>{n.getBranchNamesAndRevisions().then((e=>{const n=Object.values(e);t({branches:n})})).catch((t=>{e?.error(`error fetching all branches ${t.toString()}`)}))})({git:this.currentState.repo.gtEngineForRepo.git,splog:this.connection.splog,onSuccess:e=>{this.postMessage({type:"fetchedAllBranches",message:e})}});break;case"initializeRepository":this.splog.info("init"),M({command:this.connection.command||"gt",args:["init","--trunk",e.trunkBranch],cwd:this.connection.cwd}).then((e=>{this.splog.info(`initializeRepository ${e}`),e.exitCode&&this.postMessage({type:"failedToInitializeRepository"}),this.postMessage({type:"initializedRepository"})})).catch((()=>{this.postMessage({type:"failedToInitializeRepository"})}));break;case"track":this.tracker.trackData(e.data);break;case"changeCwd":this.setActiveRepoForCwd(e.cwd);break;case"requestRepoInfo":switch(this.currentState.type){case"repo":this.postMessage({type:"repoInfo",info:this.currentState.repo.info,cwd:this.currentState.cwd});break;case"error":this.postMessage({type:"repoInfo",info:this.currentState.error})}break;case"requestApplicationInfo":this.postMessage({type:"applicationInfo",platformName:this.platform.platformName,version:this.connection.version})}}handleIncomingMessageWithRepo(e,t,n){const{splog:r}=t;switch(e.type){case"subscribe":{const{subscriptionID:n,kind:r}=e;switch(r){case"uncommittedChanges":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"uncommittedChanges",subscriptionID:n,data:e})},r=t.getUncommittedChanges();null!=r&&e(r);const o=[];o.push(t.subscribeToUncommittedChanges(e)),t.fetchUncommittedChanges(),o.push(t.subscribeToUncommittedChangesBeginFetching((()=>this.postMessage({type:"beganFetchingUncommittedChangesEvent"})))),this.subscriptions.set(n,{dispose:()=>{o.forEach((e=>e.dispose()))}});break}case"smartlogCommits":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"smartlogCommits",subscriptionID:n,data:e})},r=t.getSmartlogCommits();null!=r&&e(r);const o=[];o.push(t.subscribeToSmartlogCommitsChanges(e)),t.fetchSmartlogCommits(),o.push(t.subscribeToSmartlogCommitsBeginFetching((()=>this.postMessage({type:"beganFetchingSmartlogCommitsEvent"})))),this.subscriptions.set(n,{dispose:()=>{o.forEach((e=>e.dispose()))}});break}case"mergeConflicts":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"mergeConflicts",subscriptionID:n,data:e})},r=t.getMergeConflicts();null!=r&&e(r),this.subscriptions.set(n,t.onChangeConflictState(e));break}}break}case"unsubscribe":{const t=this.subscriptions.get(e.subscriptionID);t?.dispose(),this.subscriptions.delete(e.subscriptionID);break}case"runOperation":{const{operation:r}=e;t.runOrQueueOperation(r,(e=>{this.postMessage({type:"operationProgress",...e}),"queue"===e.kind&&this.tracker.track("QueueOperation",{extras:{operation:r.trackEventName}})}),this.tracker,n);break}case"abortRunningOperation":{const{operationId:n}=e;t.abortRunningOperation(n);break}case"getConfig":{const t=this.context.gtEngine.userConfig.getGtiConfigValue(e.name);t&&(r.info(`got config ${e.name} ${t}`),this.postMessage({type:"gotConfig",name:e.name,value:t}));break}case"setConfig":r.info(`set config ${e.name} ${e.value}`),this.context.gtEngine.userConfig.setGtiConfigValue(e.name,e.value).catch((t=>r.error(`error settings config: ${e.name} ${e.value}`,t)));break;case"getPersistentViewState":this.postMessage({type:"gotPersistentViewState",name:e.name,value:this.connection.persistentClientSideViewState[e.name]});break;case"fetchRepoMessage":(({repository:e,onSuccess:t,gtEngine:n})=>{const{splog:r}=e,o=e.getRepoId();o?n.graphiteApi.fetchRepoMessage({repo:o}).then((e=>{e&&t(e.text)})).catch((e=>{r?.error(`error fetching repo message ${e.toString()}`)})):r?.error("No repo found")})({repository:t,onSuccess:e=>this.postMessage({type:"fetchedRepoMessage",message:e}),gtEngine:this.context.gtEngine});break;case"fetchUpgradePrompt":r.info("fetchUpgradePrompt"),t.runCommand(["internal-only","upgrade-prompt"]).then((e=>({value:e.stdout}))).catch((e=>(r?.error("error fetching upgrade prompt",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedUpgradePrompt",message:e.value||""})));break;case"fetchAuthStatus":(({repository:e,onSuccess:t,gtEngine:n})=>{const{splog:r}=e,o=e.getRepoId();o?n.authClient.getAuthInfo({repo:o}).then((e=>{e&&t(e)})).catch((e=>{r?.error(`error fetching auth status ${e.toString()}`)})):r?.error("No repo found")})({repository:t,onSuccess:e=>this.postMessage({type:"fetchedAuthStatus",message:e}),gtEngine:this.context.gtEngine});break;case"fetchPotentialParents":{const{branchToTrack:n}=e;t.runCommand(["internal-only","potential-parents",n]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(r?.error("error fetching potential parents",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedPotentialParents",message:e.value})}));break}case"setPersistentViewState":this.connection.persistentClientSideViewState[e.name]=e.value;break;case"deleteFile":{const{filePath:n}=e,o=function(e,t,n=l()){const r=n.resolve(t.info.repoRoot,e);return r.startsWith(t.info.repoRoot+n.sep)?r:null}(n,t);if(null==o)return void r.warn(`can't delete file outside of the repo: ${n}`);a().promises.rm(o).then((()=>{r.info(`deleted file from filesystem: ${o}`)})).catch((e=>{r.error(`unable to delete file: ${o}`,e)}));break}case"requestComparison":{const{comparison:n}=e;t.runCommand(["internal-only","diff",...G(n)]).then((e=>({value:e.stdout}))).catch((e=>(r?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"comparison",comparison:n,data:{diff:e}})));break}case"requestChangedFiles":{const{branch:n}=e;t.runCommand(["internal-only","changed-files",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(r?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFiles",branch:n,data:e})));break}case"requestComparisonContextLines":{const{id:{path:n,comparison:r},start:i,numLines:a}=e;if(r.type===o.ComparisonType.Commit||r.type===o.ComparisonType.Range)throw new Error("Not implemented");t.relativeCat(n,r).catch((()=>"")).then((e=>this.postMessage({type:"comparisonContextLines",lines:e.split("\n").slice(i-1,i-1+a),path:n})));break}case"requestChangedFilesInRange":{const{fromSha:n,toSha:o}=e;t.runCommand(["internal-only","changed-files",o,"--from",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(r?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInRange",fromSha:n,toSha:o,data:e})));break}case"requestCommitsInBranch":{const{branch:n}=e;t.runCommand(["internal-only","list-commits",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(r?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"commitsInBranch",branch:n,data:e})));break}case"requestChangedFilesInCommit":{const{commitSha:n}=e;t.runCommand(["internal-only","changed-files",n,"--from",`${n}~`]).then((e=>JSON.parse(e.stdout))).catch((e=>(r?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInCommit",commitSha:n,data:e})));break}case"refresh":r?.info("refresh requested"),t.fetchSmartlogCommits(),t.fetchUncommittedChanges(),t.codeReviewProvider?.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"pageVisibility":t.setPageFocus(this.pageId,e.state);break;case"fetchCommitMessageTemplate":t.runCommand(["internal-only","templates"]).then((e=>{const n=JSON.parse(e.stdout);this.postMessage({type:"fetchedCommitMessageTemplate",templates:Object.fromEntries(Object.entries(n).map((([e,n])=>[e,n.replace(t.IGNORE_COMMIT_MESSAGE_LINES_REGEX,"")])))})})).catch((e=>{r?.error("Could not fetch commit message template",e)}));break;case"typeahead":t.codeReviewProvider?.typeahead?.(e.kind,e.query)?.then((t=>this.postMessage({type:"typeaheadResult",id:e.id,result:t})));break;case"fetchDiffSummaries":t.codeReviewProvider?.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"loadMoreCommits":{const e=t.nextVisibleCommitRangeInDays();return this.postMessage({type:"commitsShownRange",rangeInDays:e}),this.postMessage({type:"beganLoadingMoreCommits"}),t.fetchSmartlogCommits(),void this.tracker.track("LoadMoreCommits",{extras:{daysToFetch:e??"Infinity"}})}default:this.platform.handleMessageFromClient(t,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})}))}this.notifyListeners(e)}notifyListeners(e){const t=this.listenersByType.get(e.type);t&&t.forEach((t=>t(e)))}}var z=n(53549);const J={platformName:"browser",watchForChanges:(e,t,n)=>{const{repoRoot:r,dotdir:o}=e,i=z.watch(o,{cwd:o});i.on("ready",(()=>{n("everything")})),i.on("all",((e,t)=>{t.startsWith("rebase-merge")&&n("merge conflicts"),(t.startsWith("index")||t.startsWith("HEAD"))&&n("uncommitted changes"),(t.startsWith("refs/heads")||t.startsWith("refs/branch-metadata")||t.startsWith("HEAD"))&&n("branches")}));const a=l().relative(r,o),s=z.watch(r,{cwd:r,ignored:`${a}/**`});return s.on("all",(()=>{n("uncommitted changes")})),()=>{s.close().catch((()=>t.error(`failed to close chokidar worktree watcher for ${r}`))),i.close().catch((()=>t.error(`failed to close chokidar dotdir watcher for ${o}`)))}},handleMessageFromClient:(e,t)=>{switch(t.type){case"platform/openFile":{const n=l().join((0,o.unwrap)(e?.info.repoRoot),t.path);let r;if(null==r)switch(process.platform){case"darwin":r="/usr/bin/open";break;case"win32":r="notepad.exe";break;case"linux":r="xdg-open"}if(r){e?.splog.info(`open file: ${n}`);const t=(0,p.spawn)(r,[n],{detached:!0,stdio:"ignore",windowsHide:!1,windowsVerbatimArguments:!0});t.on("error",(t=>{e?.splog.error(`failed to open ${n}`,t)})),t.unref()}break}}}};function Q({port:e,sensitiveToken:t,challengeToken:n,logFileLocation:i,logInfo:s,command:u,gtVersion:d,foreground:p,frontendDir:m}){return new Promise((v=>{try{const e=JSON.parse(a().readFileSync(l().join(m,"build/asset-manifest.json"),"utf-8"));for(const t of Object.values(e.files))t.startsWith("/")||v({type:"error",error:`expected entry to start with / but was: \`${t}\``}),te[t]=t.slice(1)}catch(e){}te["/favicon.ico"]="favicon.ico";const b=c().createServer((async(e,r)=>{if(e.url){const{pathname:i}=f().parse(e.url);if(null!=i&&te.hasOwnProperty(i)){const e=te[i];let t;try{t=await a().promises.readFile(l().join(m,"build",e))}catch(e){return r.writeHead(500,{"Content-Type":"text/plain"}),void r.end((o=e.toString(),o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"")))}const n=e.lastIndexOf("."),s=e.slice(n+1),c=ee[s]??"text/plain";return r.writeHead(200,{"Content-Type":c}),void r.end(t)}if("/challenge_authenticity"===i){const o=Z(e.url).get("token");if(X({providedToken:o,sensitiveToken:t}))return r.writeHead(401,{"Content-Type":"text/json"}),void r.end(JSON.stringify({error:"invalid token"}));r.writeHead(200,{"Content-Type":"text/json"});const i={challengeToken:n,pid:process.pid};return void r.end(JSON.stringify(i))}}var o;r.writeHead(404,{"Content-Type":"text/html"}),r.end("<html><body>Not Found!</body></html>")})),C=b.listen(e),P=new h.Ay.Server({noServer:!0,path:"/ws"});P.on("connection",(async(e,n)=>{const{providedToken:a,cwd:c}=Y({url:n.url}),l=X({providedToken:a,sensitiveToken:t});if(l)return s("closing ws:",l),void e.close(o.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,l);const f=i?(0,r.composeFileSplog)({cliVersion:d,filename:i}):(0,r.composeCliSplog)({cliVersion:d}),h=await(0,r.createGtEngine)({splog:f}),m=function(e){const{splog:t}=e,n=e?.platform??J,i=e?.version??"unknown";t.info(`establish client connection for ${e.cwd}`),t.debug(`platform '${n.platformName}', version '${i}', command '${e.command}'`),async function({userConfig:e,splog:t}){const n=await w({userConfig:e}),o=await async function(e){try{const t=await(0,r.composeGit)({splog:e});return await t.config("user.email")}catch(t){try{e.error(`Failed to get git email: ${t}`)}catch{}return}}(t);R({event:"gti-server-startup",timestampISOString:(new Date).toISOString(),splog:t,details:{installUuid:n,gitEmail:o}})}({userConfig:e.gtEngine.userConfig,splog:t}).catch((e=>{t.error("Failed to log startup",e)}));const a=function(e,t,n,r=E){return new o.Tracker(((e,t)=>{const{splog:n}=t;n.trace(`[track] ${e.eventName} ${e.errorName??""} ${e.errorMessage??""} ${null!=e.extras?JSON.stringify(e.extras):""}`);try{Promise.resolve(r({...e,...t.data})).catch((e=>{}))}catch{}}),new _(e,function(e,t){return{platform:e,version:t,repo:void 0,sessionId:(0,o.randomId)(),unixname:y(),osArch:g().arch(),osType:g().platform(),osRelease:g().release(),hostname:g().hostname()}}(t.platformName,n)))}(t,n,i,(t=>M({command:e.command||"gt",args:["internal-only","log-action",t.eventName||t.errorName||"UNKNOWN_CLI_EVENT",(t.timestamp?new Date(t.timestamp):new Date).toISOString(),JSON.stringify(t)],cwd:e.cwd})));a.track("ClientConnection",{extras:{cwd:e.cwd}});let s=new K({platform:n,connection:e,tracker:a,splog:t,gtEngine:e.gtEngine,version:i});return s.setActiveRepoForCwd(e.cwd),()=>{s?.dispose(),s=null}}({postMessage:t=>(e.send(t),Promise.resolve(!0)),onDidReceiveMessage(t){const n=e.on("message",t);return{dispose:()=>n.off("message",t)}},cwd:c??process.cwd(),gtEngine:h,logFileLocation:"stdout"===i?void 0:i,command:u,version:d,persistentClientSideViewState:{},splog:f,platform:void 0});e.on("close",(()=>{m(),p||setTimeout((()=>{0===W.numberOfActiveServers()&&process.exit(0)}),6e4)}))})),C.on("upgrade",((e,t,n)=>{P.handleUpgrade(e,t,n,(t=>{P.emit("connection",t,e)}))})),b.on("error",(function(t){if("listen"!==t.syscall)throw v({type:"error",error:t.toString()}),t;switch(t.code){case"EACCES":throw v({type:"error",error:`Port ${e} requires elevated privileges`}),t;case"EADDRINUSE":return void v({type:"addressInUse"});default:throw v({type:"error",error:t.toString()}),t}})),b.on("listening",(()=>v({type:"success",port:b.address().port,pid:process.pid})))}))}const Y=({url:e})=>{if(!e)return{providedToken:void 0,cwd:void 0,platform:void 0};const t=Z(e),n=t.get("cwd");return{providedToken:t.get("token"),cwd:n?decodeURIComponent(n):void 0,platform:t.get("platform")}},X=({providedToken:e,sensitiveToken:t})=>e?function(e,t){const n=Buffer.from(e),r=Buffer.from(t);return n.length===r.length&&(0,b.timingSafeEqual)(n,r)}(e,t)?void 0:"Invalid token":"No token provided in websocket request";function Z(e){const t=f().parse(e).search?.replace(/^\?/,"").split("&").map((e=>e.split("=")));return new Map(t)}const ee={css:"text/css",html:"text/html",js:"text/javascript",ttf:"font/ttf"},te={"/":"index.html"}}};
|
|
3
|
-
//# sourceMappingURL=691.js.map
|