@withgraphite/graphite-cli 1.5.1 → 1.5.3

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/607.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ "use strict";exports.id=607,exports.ids=[607],exports.modules={42161:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.sendAnalyticsEvent=void 0;const o=r(79379),i=r(90103),s=r(17891);t.sendAnalyticsEvent=function({event:e,timestampISOString:t,logger:r,details:a}){(()=>n(this,void 0,void 0,(function*(){const r=yield(0,s.composeUserConfigFactory)().load(),n=(0,i.composeRequest)({userConfig:r});yield n({route:o.API_ROUTES.logActions,params:{actions:[{details:a,name:e,timestamp:t}]}})})))().catch((e=>{r.error(`sendAnaltyicsEvent threw an error: ${e}`)}))}},4740:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cuteString=void 0,t.cuteString=e=>JSON.stringify(e,null,2)},98126:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PreconditionsFailedError=t.ExitFailedError=void 0;class r extends Error{constructor(e){super(e),this.name="ExitFailed"}}t.ExitFailedError=r;class n extends Error{constructor(e){super(e),this.name="PreconditionsFailed"}}t.PreconditionsFailedError=n},79115:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(42161),t),o(r(4740),t),o(r(98126),t),o(r(90103),t),o(r(75357),t),o(r(37529),t),o(r(17891),t),o(r(52081),t)},90103:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeRequest=void 0;const o=r(53977);t.composeRequest=function({userConfig:e}){const t=e.getAuthToken(),r=e.getApiServerUrl();return e=>n(this,[e],void 0,(function*({route:e,params:n,queryParams:i,urlParams:s,headers:a}){return yield o.request.requestWithArgs({apiServer:r,route:e,params:n,queryParams:i,urlParams:s,headers:Object.assign({authorization:t?`token ${t}`:void 0},a)})}))}},75357:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=r(4740),a=r(98126);t.spiffy=function(e){const t=()=>n(this,void 0,void 0,(function*(){var t;const r=yield function(e){return n(this,arguments,void 0,(function*({filePath:e,oldFilepath:t,schema:r,initialize:n,removeIfInvalid:o,debug:s}){null==s||s(`Reading JSON for ${e}`);const u=e&&(yield i.default.pathExists(e));t&&(yield i.default.pathExists(t))&&(null==s||s(`Migrating old JSON for ${e}`),u?i.default.removeSync(t):i.default.moveSync(t,e));try{if(!u)return n();const t=yield i.default.readJson(e),o=r.safeParse(t);if(!o.success)throw new Error("Malformed data");return null==s||s(`Successfully parsed JSON at ${e}`),o.data}catch(t){if(null==s||s(`Failed to parse JSON at ${e}`),o)return null==s||s(`Removing invalid JSON and re-initializing ${e}`),yield i.default.remove(e),n();throw new a.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}),o=t=>n(this,void 0,void 0,(function*(){var n;t(r),(null===(n=e.options)||void 0===n?void 0:n.removeIfEmpty)&&(0,s.cuteString)(r)===(0,s.cuteString)({})?yield i.default.remove(e.filepath):yield i.default.outputFile(e.filepath,(0,s.cuteString)(r),{mode:384})}));return Object.assign({data:r,update:o,path:e.filepath,delete:()=>n(this,void 0,void 0,(function*(){(yield i.default.pathExists(e.filepath))&&(yield i.default.remove(e.filepath))}))},e.helperFunctions(r,o))}));return{load:t,loadIfExists:()=>n(this,void 0,void 0,(function*(){if(yield i.default.pathExists(e.filepath))return t()}))}}},37529:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=r(4740),a=r(98126);t.spiffyRetype__DEPRECATED=function(e){const t=()=>n(this,void 0,void 0,(function*(){var t;const r=yield function(e){return n(this,arguments,void 0,(function*({filePath:e,oldFilepath:t,schema:r,initialize:n,removeIfInvalid:o,debug:s}){null==s||s(`Reading JSON for ${e}`);const u=e&&(yield i.default.pathExists(e));t&&(yield i.default.pathExists(t))&&(null==s||s(`Migrating old JSON for ${e}`),u?i.default.removeSync(t):i.default.moveSync(t,e));try{const t=u?yield i.default.readJson(e):n();if(!r(t,{logFailures:!1}))throw null==s||s(`Malformed data for ${e}: `+JSON.stringify(t)),new Error("Malformed data");return null==s||s(`Successfully parsed JSON at ${e}`),t}catch(t){if(null==s||s(`Failed to parse JSON at ${e}`),o)return null==s||s(`Removing invalid JSON and re-initializing ${e}`),yield i.default.remove(e),n();throw new a.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}),o=t=>n(this,void 0,void 0,(function*(){var n;t(r),(null===(n=e.options)||void 0===n?void 0:n.removeIfEmpty)&&(0,s.cuteString)(r)===(0,s.cuteString)({})?yield i.default.remove(e.filepath):yield i.default.outputFile(e.filepath,(0,s.cuteString)(r),{mode:384})}));return Object.assign({data:r,update:o,path:e.filepath,delete:()=>n(this,void 0,void 0,(function*(){(yield i.default.pathExists(e.filepath))&&(yield i.default.remove(e.filepath))}))},e.helperFunctions(r,o))}));return{load:t,loadIfExists:()=>n(this,void 0,void 0,(function*(){if(yield i.default.pathExists(e.filepath))return t()}))}}},17891:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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=r(34490),s=o(r(22037)),a=o(r(71017)),u=o(r(83087)),c=r(98126),l=r(75357),d=r(52081),f=u.default.object({branchPrefix:u.default.string().optional(),branchDate:u.default.boolean().optional(),branchReplacement:u.default.union([u.default.literal("_"),u.default.literal("-"),u.default.literal("")]).optional(),skipApplyingPrefixToNonGeneratedBranchNames:u.default.boolean().optional(),allowSlashesInGeneratedBranchNames:u.default.boolean().optional(),allowUpperCaseInGeneratedBranchNames:u.default.boolean().optional(),authToken:u.default.string().optional(),tips:u.default.boolean().optional(),yubikey:u.default.boolean().optional(),editor:u.default.string().optional(),pager:u.default.string().optional(),restackCommitterDateIsAuthorDate:u.default.boolean().optional(),submitIncludeCommitMessages:u.default.boolean().optional(),excludeTemplatesWithCommitMessages:u.default.boolean().optional(),submitViaCli:u.default.boolean().optional(),connectCliToLocalServer:u.default.boolean().optional(),gtiConfigs:u.default.array(u.default.object({key:u.default.string(),value:u.default.string()})).optional(),alternativeProfiles:u.default.array(u.default.object({name:u.default.string(),hostPrefix:u.default.string(),authToken:u.default.string().optional()})).optional(),systemTrayConfig:u.default.object({sections:u.default.array(u.default.object({sectionId:u.default.string(),display:u.default.boolean()}))}).optional(),debugExpiryMs:u.default.number().optional()});t.composeUserConfigFactory=()=>(0,l.spiffy)({schema:f,oldFilepath:a.default.join(s.default.homedir(),".graphite_user_config"),filepath:a.default.join((0,d.getGtConfigDir)(),"user_config"),initialize:()=>({}),helperFunctions:(e,t)=>{const r=()=>{var t,r,n;if(!process.env.GRAPHITE_PROFILE)return null!==(r=null===(t=e.alternativeProfiles)||void 0===t?void 0:t.find((e=>"default"===e.name)))&&void 0!==r?r:null;const o=null===(n=e.alternativeProfiles)||void 0===n?void 0:n.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=r())||void 0===e?void 0:e.hostPrefix;return t?`https://app.${t}.graphite.dev`:"https://app.graphite.dev"},s=()=>`${o()}/activate`,a=()=>{var t,n;return null!==(n=null===(t=r())||void 0===t?void 0:t.authToken)&&void 0!==n?n:e.authToken};return{getBranchReplacement:()=>{var t;return null!==(t=e.branchReplacement)&&void 0!==t?t:"_"},getEditor:t=>n(void 0,void 0,void 0,(function*(){var r,n,o,i,s,a;return null!==(a=null!==(s=null!==(i=null!==(o=null!==(n=null!==(r=process.env.GT_EDITOR)&&void 0!==r?r:e.editor)&&void 0!==n?n:yield t())&&void 0!==o?o:process.env.GIT_EDITOR)&&void 0!==i?i:process.env.VISUAL)&&void 0!==s?s:process.env.EDITOR)&&void 0!==a?a:"vi"})),getPager:t=>n(void 0,void 0,void 0,(function*(){var r,n,o,i,s;const a=null!==(s=null!==(i=null!==(o=null!==(n=null!==(r=process.env.GT_PAGER)&&void 0!==r?r:e.pager)&&void 0!==n?n:yield t())&&void 0!==o?o:process.env.GIT_PAGER)&&void 0!==i?i:process.env.PAGER)&&void 0!==s?s:"less";return""===a?void 0:a})),getApiServerUrl:()=>{var t;if(e.connectCliToLocalServer)return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0","https://localhost:8000/v1";const n=null===(t=r())||void 0===t?void 0:t.hostPrefix;return n?`https://api.${n}.graphite.dev/v1`:"https://api.graphite.dev/v1"},getAppServerUrl:o,getAuthToken:a,setAuthToken:e=>n(void 0,void 0,void 0,(function*(){var n;const o=null===(n=r())||void 0===n?void 0:n.name;yield t(o?t=>{var r;const n=null===(r=t.alternativeProfiles)||void 0===r?void 0:r.find((({name:e})=>e===o));if(!n)throw new Error(`Unknown profile ${o}`);n.authToken=e}:t=>t.authToken=e)})),getProfileName:()=>{var e;return null===(e=r())||void 0===e?void 0:e.name},authTokenPrecondition:()=>{const e=a();if(!e||0===e.length)throw new c.PreconditionsFailedError(`Please authenticate your Graphite CLI by visiting ${s()}`)},getDefaultPrDescriptionBehavior:()=>e.submitIncludeCommitMessages?e.excludeTemplatesWithCommitMessages?"messages":"both":"template",getSubmitViaCli:()=>{var t;return null!==(t=e.submitViaCli)&&void 0!==t&&t},getCLIAuthUrl:s,setSectionConfig:e=>n(void 0,[e],void 0,(function*({sectionId:e,display:r}){yield t((t=>{var n,o,i;t.systemTrayConfig&&(t.systemTrayConfig.sections=null===(n=t.systemTrayConfig)||void 0===n?void 0:n.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:r}]}}))})),getSectionConfig:t=>{var r;const n=null===(r=e.systemTrayConfig)||void 0===r?void 0:r.sections.find((e=>t===e.sectionId));return null!=n?n:{sectionId:t,display:!0}},getGtiConfigValue:t=>{var r,n;return null===(n=null===(r=e.gtiConfigs)||void 0===r?void 0:r.find((e=>e.key===t)))||void 0===n?void 0:n.value},setGtiConfigValue:(e,r)=>n(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:r}]}))})),getDebugExpiryMs:()=>{var t;return null!==(t=e.debugExpiryMs)&&void 0!==t?t:864e5},initialized:()=>!(0,i.isEmptyObject)(e)}}})},52081:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGtDataDir=t.getGtConfigDir=void 0;const n=r(22037),o=r(71017);t.getGtConfigDir=()=>{var e;return(0,o.join)(null!==(e=process.env.XDG_CONFIG_HOME)&&void 0!==e?e:(0,o.join)((0,n.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,n.homedir)(),".local","share"),"graphite")}},79379:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),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 r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.API_ROUTES=t.pullRequestInfoShape=void 0;const s=r(27716),a=i(r(8296)),u={repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number),prHeadRefNames:a.optional(a.array(a.string)),trunkBranchNames:a.optional(a.array(a.string)),consistent:a.optional(a.boolean),callsite:a.optional(a.string)};t.pullRequestInfoShape=a.shape({prNumber:a.number,title:a.string,body:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED",null,void 0]),headRefName:a.string,baseRefName:a.string,isBaseRefGraphiteBase:a.optional(a.boolean),url:a.string,isDraft:a.boolean,versions:a.array(a.shape({headSha:a.string,baseSha:a.string,baseName:a.string,createdAt:a.string,authorGithubHandle:a.optional(a.string)})),dependentPrNumber:a.optional(a.number),mergeCommitSha:a.optional(a.string),cliTrunk:a.optional(a.string)}),t.API_ROUTES={logActions:{method:"POST",url:"/graphite/cli/log-actions",params:{actions:a.array(a.shape({name:a.string,details:a.optional(a.shape({})),timestamp:a.string}))}},logCommand:{method:"POST",url:"/graphite/log-command",params:{commandName:a.string,durationMiliSeconds:a.number,user:a.string,version:a.optional(a.string),err:a.optional(a.shape({name:a.string,message:a.string,stackTrace:a.string,debugContext:a.optional(a.string)}))}},downstackDependencies:{method:"GET",url:"/graphite/downstack-dependencies",queryParams:{org:a.string,repo:a.string,trunkName:a.string,branchName:a.string},response:{downstackBranchNames:a.array(a.string)}},upgradePrompt:{method:"GET",url:"/graphite/upgrade",queryParams:{currentVersion:a.string,installationMethod:a.optional(a.string)},response:{prompt:a.optional(a.shape({message:a.string,blocking:a.boolean}))}},featureFlags:{method:"GET",url:"/graphite/feature-flags",queryParams:{currentVersion:a.string},response:{flags:a.array(a.shape({flagName:a.string,flagValue:a.boolean}))}},feedback:{method:"POST",url:"/graphite/feedback",params:{user:a.string,message:a.string,debugContext:a.optional(a.string)}},generateBranchNameAndCommitMessage:{method:"POST",url:"/graphite/generate-branch-name-and-commit-message",params:{diff:a.string,template:a.optional(a.string),owner:a.optional(a.string),repo:a.optional(a.string)},response:{result:a.union(a.shape({branchName:a.string,commitMessage:a.string}),a.shape({error:a.string}))}},reviewDiff:{method:"POST",url:"/graphite/cli/review-diff",params:{diff:a.string,owner:a.string,repo:a.string},response:{result:a.array(a.shape({filePath:a.string,startLine:a.number,endLine:a.number,comment:a.string}))}},generateTitleAndDescription:{method:"POST",url:"/graphite/generate-title-and-description",params:{diff:a.string,template:a.optional(a.string),owner:a.string,repo:a.string},response:{result:a.union(a.shape({title:a.string,description:a.string}),a.shape({error:a.string}))}},traces:{method:"POST",url:"/graphite/traces",params:{jsonTraces:a.string,cliVersion:a.string}},retargetPullRequest:{method:"POST",url:"/graphite/cli/retarget-pr",params:{repoOwner:a.string,repoName:a.string,prNumber:a.number},response:{result:a.union(a.shape({branchName:a.string,branchSha:a.string}),a.shape({error:a.string}))}},cleanupRetargetPullRequests:{method:"POST",url:"/graphite/cli/cleanup-retarget-prs",params:{repoOwner:a.string,repoName:a.string,prs:a.array(a.shape({prNumber:a.number,previousPrBase:a.string}))},response:{result:a.union(a.literal("ok"),a.shape({error:a.string}))}},preSubmitPullRequests:{method:"POST",url:"/graphite/cli/submit/pre-submit-pull-requests",params:{repoOwner:a.string,repoName:a.string,branches:a.array(a.shape({headRefName:a.string,prNumber:a.optional(a.number)}))},response:{result:a.union(a.shape({retargetedPrs:a.array(a.number)}),a.shape({error:a.string}))}},submitPullRequests:{method:"POST",url:"/graphite/submit/pull-requests",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.optional(a.string),targetTrunkBranchName:a.optional(a.string),mergeWhenReady:a.optional(a.boolean),rerequestReview:a.optional(a.boolean),comment:a.optional(a.string),gti:a.optional(a.boolean),useWebSubmit:a.optional(a.boolean),prs:a.array(a.unionMany([a.shape({action:a.literals(["create"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.string,body:a.optional(a.string),draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string))}),a.shape({action:a.literals(["update"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.optional(a.string),body:a.optional(a.string),prNumber:a.number,draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string)),rebaseOnlyChange:a.optional(a.boolean)})])),webSubmitAnalytics:a.optional(a.shape({eligible:a.boolean,usedWebSubmit:a.boolean,prompted:a.boolean,suppressedPrompt:a.boolean,submitViaCliSetting:a.optional(a.boolean)}))},response:{prs:a.array(a.unionMany([a.shape({head:a.string,prNumber:a.number,prURL:a.string,status:a.literals(["updated","created"]),repoOwner:a.string,repoName:a.string}),a.shape({head:a.string,error:a.string,status:a.literals(["error"])})]))}},pullRequestInfo__DEPRECATED:{method:"POST",url:"/graphite/pull-requests",params:u,response:{prs:a.array(t.pullRequestInfoShape)}},pullRequestInfo:{method:"POST",url:"/graphite/cli/pull-request-info",params:u,response:{result:a.taggedUnion("status",{ok:{status:a.literal("ok"),prs:a.array(t.pullRequestInfoShape)},error:{status:a.literal("error"),message:a.string}})}},mergeabilityStatus:{method:"POST",url:"/graphite/mergeability-status",params:{repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number)},response:{mergeabilityStatuses:a.array(a.shape({prNumber:a.number,mergeabilityStatus:a.literals(s.PrMetastatuses)}))}},merge:{method:"POST",url:"/graphite/merge",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.string,prNumbers:a.array(a.number)}},getRepoMessage:{method:"GET",url:"/graphite/cli-repo-message",queryParams:{org:a.string,repo:a.string},response:{message:a.nullable(a.shape({text:a.string,status:a.literals(["warning","info","error"])}))}},getSectionsSummary:{method:"GET",url:"/graphite/sections-summary",queryParams:{first:a.string},headers:{"User-Agent":a.string},response:{host:a.shape({kind:a.literals(["CLOUD","ENTERPRISE"])}),sections:a.array(a.shape({name:a.string,sectionId:a.string,includeInTotalCount:a.boolean,totalUnpaginatedPrs:a.number,prs:a.array(a.shape({number:a.number,title:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),createdAt:a.string,updatedAt:a.string,repo:a.shape({name:a.string,owner:a.string}),author:a.nullable(a.shape({name:a.nullable(a.string),login:a.string,avatarUrl:a.string})),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED"])}))}))}},checkAuth:{method:"POST",url:"/graphite/check-auth",params:{repoOwner:a.optional(a.string),repoName:a.optional(a.string)},response:{githubLogin:a.optional(a.string),canSubmitPrs:a.optional(a.boolean)}},checkIsRepoSynced:{method:"GET",url:"/graphite/cli/is-repo-synced",queryParams:{repoOwner:a.string,repoName:a.string},response:{result:a.unionMany([a.shape({status:a.literals(["SYNCED","NOT_SYNCED_ADDABLE"])}),a.shape({status:a.literals(["NOT_SYNCED_UNADDABLE"]),message:a.string})])}},addSyncedRepo:{method:"POST",url:"/graphite/cli/add-synced-repo",params:{repoOwner:a.string,repoName:a.string},response:{err:a.optional(a.string)}},markNewUserChecklistStepCompleted:{method:"POST",url:"/graphite/cli/mark-new-user-checklist-step-completed",params:{step:a.literals(["submitFirstPr","submitFirstStack"])}}}},9164:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGit=void 0;const o=r(34490),i=r(1284),s=r(49690),a=r(42548),u=r(22917),c=r(51674),l=r(66809),d=r(45960),f=r(67397),h=r(31176),m=r(50279),p=r(26055),g=r(16681),v=r(68012),y=r(55044),b=r(83002),E=r(71852),w=r(64645),_=r(15506),C=r(13729),R=r(61093),O=r(14397),P=r(87803),S=r(27373),A=r(21435),T=r(42178),M=r(73777),N=r(2250),D=r(42517),I=r(71735),k=r(5755),j=r(60770),G=r(22925),F=r(58468),x=r(52282),H=r(11154),B=r(19963),U=r(19109),L=r(75122),q=r(37378),$=r(64568),W=r(70081),V=r(59373),K=r(53911),Q=r(93333);t.composeGit=function(e){return n(this,arguments,void 0,(function*({cwd:e,debug:t,quiet:r}){const n=(0,Q.composeGitRunner)({cwd:e,debug:t}),[z,J]=yield Promise.all([(0,F.getRepoPaths)({runner:n}),(0,C.getGitVersion)({runner:n})]),Y=(0,m.composeGitConfig)(n);return z?Object.assign(Object.assign(Object.assign({gitVersion:J,repo:!0,config:Y},z),(0,w.composeGetRemoteSha)(n)),{addAll:(0,o.bindWithEmptyObject)((0,o.bind)(s.addAll,{runner:n})),addUpdates:(0,o.bindWithEmptyObject)((0,o.bind)(s.addUpdates,{runner:n})),addPatch:(0,o.bindWithEmptyObject)((0,o.bind)(s.addPatch,{runner:n})),createStashCommit:(0,o.bind)(q.createStashCommit,{runner:n}),findUntrackedFiles:(0,o.bindWithEmptyObject)((0,o.bind)(W.findUntrackedFiles,{runner:n})),trackFiles:(0,o.bind)(W.trackFiles,{runner:n}),trackAllNewFiles:(0,o.bindWithEmptyObject)((0,o.bind)(W.trackAllNewFiles,{runner:n})),getCommitAuthor:(0,o.bind)(d.getCommitAuthor,{runner:n}),getCommitDate:(0,o.bind)(d.getCommitDate,{runner:n}),getFilesChanged:(0,o.bind)(y.getFilesChanged,{runner:n}),getStatus:(0,o.bindWithEmptyObject)((0,o.bind)($.getStatus,{runner:n})),getCurrentBranchName:(0,o.bindWithEmptyObject)((0,o.bind)(a.getCurrentBranchName,{runner:n})),getPreviousBranchName:(0,o.bindWithEmptyObject)((0,o.bind)(a.getPreviousBranchName,{runner:n})),moveBranch:(0,o.bind)(a.moveBranch,{runner:n}),deleteBranch:(0,o.bind)(a.deleteBranch,{runner:n}),switchBranch:(0,o.bind)(a.switchBranch,{runner:n}),getDiff:(0,o.bind)(p.getDiff,{runner:n}),getDiffOfStagedChanges:(0,o.bindWithEmptyObject)((0,o.bind)(p.getDiffOfStagedChanges,{runner:n})),forceCheckoutNewBranch:(0,o.bind)(a.forceCheckoutNewBranch,{runner:n}),forceCreateBranch:(0,o.bind)(a.forceCreateBranch,{runner:n}),getNumberOfCommitsInRange:(0,o.bind)(f.getNumberOfCommitsInRange,{runner:n}),getFormattedCommitOrRange:(0,o.bind)(f.getFormattedCommitOrRange,{runner:n}),getCommitTree:(0,o.bind)(h.getCommitTree,{runner:n}),commit:(0,o.bind)(l.commit,{quiet:r,runner:n}),restore:(0,o.bind)(H.restore,{runner:n}),revert:(0,o.bind)(l.revert,{quiet:r,runner:n}),detectStagedChanges:(0,o.bind)($.detectStagedChanges,{runner:n}),getUnstagedChanges:(0,o.bindWithEmptyObject)((0,o.bind)(p.getUnstagedChanges,{runner:n})),showDiff:(0,o.bind)(p.showDiff,{runner:n}),isDiffEmpty:(0,o.bind)(p.isDiffEmpty,{runner:n}),fetchBranches:(0,o.bind)(g.fetchBranches,{runner:n}),readFetchHead:(0,o.bind)(g.readFetchHead,{runner:n}),findRemoteHeadBranch:(0,o.bind)(b.findRemoteHeadBranch,{runner:n}),getShaOrThrow:(0,o.bind)(w.getShaOrThrow,{runner:n}),getSha:(0,o.bind)(w.getSha,{runner:n}),detectUntrackedChanges:(0,o.bindWithEmptyObject)((0,o.bind)($.detectUntrackedChanges,{runner:n})),trackedUnstagedChanges:(0,o.bindWithEmptyObject)((0,o.bind)($.trackedUnstagedChanges,{runner:n})),isMerged:(0,o.bind)(R.isMerged,{runner:n}),logLong:(0,o.bindWithEmptyObject)((0,o.bind)(O.logLong,{runner:n})),getMergeBase:(0,o.bind)(P.getMergeBase,{runner:n}),isAncestor:(0,o.bind)(P.isAncestor,{runner:n}),getUnmergedFiles:(0,o.bindWithEmptyObject)((0,o.bind)($.getUnmergedFiles,{runner:n})),getRebaseHead:(0,o.bindWithEmptyObject)((0,o.bind)(S.getRebaseHead,{gitDir:z.gitDir})),getRemoteUrl:(0,o.bind)(G.getRemoteUrl,{runner:n}),showCommits:(0,o.bind)(U.showCommits,{runner:n}),getFileContents:(0,o.bind)(v.getFileContents,{runner:n}),fetchRemoteTrackingBranch:(0,o.bind)(M.fetchRemoteTrackingBranch,{runner:n}),fastForwardBranchToRemoteTracking:(0,o.bind)(M.fastForwardBranchToRemoteTracking,{runner:n}),pushBranches:(0,o.bind)(N.pushBranches,{runner:n,gitConfig:Y,gitCommonDir:z.gitCommonDir,repoRoot:z.repoRoot}),getHookExecutablePath:(0,o.bind)(E.getHookExecutablePath,{gitConfig:Y,gitCommonDir:z.gitCommonDir,repoRoot:z.repoRoot}),getCleanlyReconciledSquashedHead:(0,o.bind)(j.getCleanlyReconciledSquashedHead,{runner:n,gitConfig:Y}),rebaseInProgress:(0,o.bindWithEmptyObject)((0,o.bind)(k.rebaseInProgress,{gitDir:z.gitDir})),cleanRebase:(0,o.bind)(c.cleanRebase,{runner:n,gitConfig:Y}),rebase:(0,o.bind)(I.rebase,{gitDir:z.gitDir,runner:n}),rebaseContinue:(0,o.bind)(I.rebaseContinue,{gitDir:z.gitDir,runner:n}),rebaseAbort:(0,o.bindWithEmptyObject)((0,o.bind)(I.rebaseAbort,{runner:n})),rebaseInteractive:(0,o.bind)(I.rebaseInteractive,{gitDir:z.gitDir,runner:n}),softReset:(0,o.bind)(x.softReset,{runner:n}),mixedReset:(0,o.bind)(x.mixedReset,{runner:n}),keepReset:(0,o.bind)(x.keepReset,{runner:n}),trackedReset:(0,o.bind)(x.trackedReset,{runner:n}),setRemoteTracking:(0,o.bind)(B.setRemoteTracking,{runner:n}),deleteRemoteTracking:(0,o.bind)(B.deleteRemoteTracking,{runner:n}),getBranchNamesAndRevisions:(0,o.bindWithEmptyObject)((0,o.bind)(L.getBranchNamesAndRevisions,{runner:n})),clean:(0,o.bindWithEmptyObject)((0,o.bind)(u.clean,{runner:n})),createNewObject:(0,o.bind)(T.createNewObject,{runner:n}),updateRef:(0,o.bind)(T.updateRef,{runner:n}),updateRefs:(0,o.bind)(V.updateRefs,{runner:n}),readRef:(0,o.bind)(T.readRef,{runner:n}),doesObjectExist:(0,o.bind)(T.doesObjectExist,{runner:n}),deleteRef:(0,o.bind)(T.deleteRef,{runner:n}),getShaForEachRefWithPrefix:(0,o.bind)(T.getShaForEachRefWithPrefix,{runner:n}),commitRangesAreEquivalent:(0,o.bind)(D.commitRangesAreEquivalent,{runner:n}),getBranchesInCommitRange:(0,o.bind)(f.getBranchesInCommitRange,{runner:n}),absorbPatchesIntoCommitStack:(0,o.bind)(i.absorbPatchesIntoCommitStack,{repoRoot:z.repoRoot,gitCommonDir:z.gitCommonDir,runner:n,gitConfig:Y}),refreshIndex:(0,o.bind)($.refreshIndex,{runner:n}),packAllRefs:(0,o.bindWithEmptyObject)((0,o.bind)(A.packAllRefs,{runner:n})),listWorktrees:(0,o.bindWithEmptyObject)((0,o.bind)(K.listWorktrees,{runner:n})),runGitCommandPassthrough:(0,o.bind)(_.runGitCommandPassthrough,{runner:n})}):{gitVersion:J,repo:!1,config:Y}}))}},1284:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=o(r(71017)),a=r(67397),u=r(64645),c=r(70341);function l(e){return n(this,arguments,void 0,(function*({sha:e,patch:t,runner:r,repoRoot:n,gitCommonDir:o}){const a=s.default.join(o,`.gt-${process.pid}-${Date.now()}.index`);yield(0,c.readTreeIntoIndexFile)({treeish:e,indexFile:a,runner:r,repoRoot:n}),yield(0,c.applyPatchToIndexFile)({patch:t,indexFile:a,runner:r,repoRoot:n});const u=yield(0,c.writeTreeFromIndexFile)({indexFile:a,runner:r,repoRoot:n});return i.default.rmSync(a),u}))}t.absorbPatchesIntoCommitStack=function(e){return n(this,arguments,void 0,(function*({shas:e,patches:t,runner:r,restackCommitterDateIsAuthorDate:n,gitConfig:o,gitCommonDir:i,repoRoot:s}){const c=yield o("commit.gpgSign"),d=c&&"false"!==c&&"0"!==c,f=[];let h=yield(0,u.getSha)({runner:r,ref:`${e[0]}~`}),m=!1;for(let o=0;o<t.length;o++){const u=e[o],c=t[o];if(!m&&null===c){f.push(u),h=u;continue}m=!0;const p=(0,a.getRebaseMetadataForCommit)({runner:r,sha:u}),g=null===c?`${u}^{tree}`:yield l({gitCommonDir:i,repoRoot:s,sha:u,patch:c,runner:r}),{message:v,authorDate:y,authorEmail:b,authorName:E}=yield p,w=yield r.runGitCommand({args:["commit-tree",g,"-p",h,"-m",v,...d?["-S"]:[]],onError:"throw",resource:"absorbPatchesIntoCommitStackCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:E,GIT_AUTHOR_EMAIL:b,GIT_AUTHOR_DATE:y}),n&&{GIT_COMMITTER_DATE:y})},cwd:s});f.push(w),h=w}return f}))}},49690:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.addPatch=t.addUpdates=t.addAll=void 0,t.addAll=function(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--all"],onError:"throw",resource:"addAll"})}))},t.addUpdates=function(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--update"],onError:"throw",resource:"addUpdates"})}))},t.addPatch=function(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["add","--patch"],options:{stdio:"inherit"},onError:"throw",resource:"addPatch"})}))}},42548:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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 r(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 r(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 r(this,arguments,void 0,(function*({runner:e,newName:t}){yield e.runGitCommand({args:["branch","-m",t],options:{stdio:"pipe"},onError:"throw",resource:"moveBranch"})}))},t.deleteBranch=function(e){return r(this,arguments,void 0,(function*({runner:e,branchName:t}){yield e.runGitCommand({args:["branch","-D",t],options:{stdio:"pipe"},onError:"throw",resource:"deleteBranch"})}))},t.switchBranch=function(e){return r(this,arguments,void 0,(function*({branch:e,newBranch:t,detach:r,force:n,runner:o}){yield o.runGitCommand({args:["switch","-q",...r?["-d"]:[],...n?["-f"]:[],...t?["-c"]:[],e],options:{stdio:"inherit"},onError:"throw",resource:"switchBranch"})}))},t.forceCheckoutNewBranch=function(e){return r(this,arguments,void 0,(function*({branchName:e,sha:t,runner:r}){yield r.runGitCommand({args:["switch","-q","-C",e,t],options:{stdio:"inherit"},onError:"throw",resource:"forceCheckoutNewBranch"})}))},t.forceCreateBranch=function(e){return r(this,arguments,void 0,(function*({branchName:e,sha:t,runner:r}){yield r.runGitCommand({args:["branch","-f",e,t],options:{stdio:"pipe"},onError:"throw",resource:"forceCreateBranch"})}))}},22917:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.clean=void 0,t.clean=function(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["clean","--force"],options:{stdio:"ignore"},onError:"throw",resource:"clean"})}))}},51674:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanRebase=void 0;const o=r(93333),i=r(67397),s=r(87803),a=r(42178);t.cleanRebase=function(e){return n(this,arguments,void 0,(function*({onto:e,from:t,head:r,restackCommitterDateIsAuthorDate:u,runner:c,gitConfig:l}){var d,f;const h=yield l("commit.gpgSign"),m=h&&"false"!==h&&"0"!==h;return null!==(f=null===(d=yield(yield(0,i.getFormattedCommitOrRange)({base:t,head:r,format:"SHA",runner:c})).reverse().map((e=>({sha:e,metadataPromise:(0,i.getRebaseMetadataForCommit)({runner:c,sha:e})}))).reduce(((t,r)=>n(this,[t,r],void 0,(function*(t,{sha:r,metadataPromise:n}){const[i,{message:l,authorDate:d,authorEmail:f,authorName:h}]=yield Promise.all([t,n]);if(!i)return null;const p=i.tree;if((yield c.runGitCommand({args:["rev-list","--parents","-1",`${r}`],onError:"ignore",resource:"getShaParentsForDebugging"})).split(" ").length>2)return{tree:p,commitPromise:Promise.resolve(i.commitPromise)};if(yield(0,s.isAncestor)({left:r,right:e,runner:c}))return{tree:p,commitPromise:Promise.resolve(i.commitPromise)};const g=`${r}~`,v=yield(0,a.doesObjectExist)({ref:g,runner:c}),y=yield c.runGitCommand({args:["commit-tree",p,...v?["-p",g]:[],"-m","_"],onError:"throw",resource:"cleanRebaseOntoCommitTree"}),b=yield c.runGitCommand({args:["merge-tree","--allow-unrelated-histories",y,r],onError:"throw",resource:"cleanRebaseMergeTree"}).catch((e=>{if(e instanceof o.CommandFailedError&&1===e.exitCode)return null;throw e}));return b?b===p?i:{tree:b,commitPromise:c.runGitCommand({args:["commit-tree",b,"-p",yield i.commitPromise,"-m",l,...m?["-S"]:[]],options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:h,GIT_AUTHOR_EMAIL:f,GIT_AUTHOR_DATE:d}),u&&{GIT_COMMITTER_DATE:d})},onError:"throw",resource:"cleanRebaseCommitTree"})}:null}))),Promise.resolve({commitPromise:Promise.resolve(e),tree:`${e}^{tree}`})))||void 0===d?void 0:d.commitPromise)&&void 0!==f?f:null}))}},66809:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.revert=t.commit=void 0,t.commit=function(e){return r(this,arguments,void 0,(function*({amend:e,message:t,noEdit:r,edit:n,patch:o,quiet:i,verboseCount:s,noVerify:a,runner:u}){yield u.runGitCommand({args:["commit",...e?["--amend"]:[],...t?["-m",t]:[],...r?["--no-edit"]:[],...n?["-e"]:[],...o?["-p"]:[],...a?["-n"]:[],...i?["-q"]:[],...s?Array(s).fill("-v"):[]],options:{stdio:"inherit"},onError:"throw",resource:"commit"})}))},t.revert=function(e){return r(this,arguments,void 0,(function*({runner:e,sha:t,edit:r,quiet:n}){yield e.runGitCommand({args:["revert",t,...n?["-q"]:[],...r?[]:["--no-edit"]],options:{stdio:"inherit"},onError:"throw",resource:"revert"})}))}},45960:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitParents=t.getCommitDate=t.getCommitAuthor=void 0,t.getCommitAuthor=function({ref:e,runner:t}){return t.runGitCommand({args:["log","--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 r=yield t.runGitCommand({args:["log","--format=%cd","-n","1",e,"--"],onError:"throw",resource:"commitInfoBody"});return new Date(r)}))},t.getCommitParents=function(e){return r(this,arguments,void 0,(function*({ref:e,runner:t}){const r=yield t.runGitCommand({args:["rev-parse",`${e}^@`],onError:"ignore",resource:"commitInfoAuthor"});return r?r.split("\n"):[]}))}},67397:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(62637));t.getNumberOfCommitsInRange=function(e){return n(this,arguments,void 0,(function*({runner:e,base:t,head:r}){return Number(yield e.runGitCommand({args:["rev-list","--count",`${t}..${r}`,"--"],onError:"throw",resource:"getNumberOfCommitsInRange"}))}))};const s={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 a(e){return n(this,arguments,void 0,(function*({runner:e,base:t,head:r,format:n}){if(!t)return[yield e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[n]}`,r,"--"],onError:"throw",resource:"getCommitRangeFormatted"})];const o=yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=format:%H",`${t}..${r}`,"--"],onError:"throw",resource:"getCommitRangeHashes"}),a=[];for(const t of i.default.chunk(o,125)){const r=yield Promise.all(t.map((t=>"SHA"===n?t:e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[n]}`,t,"--"],onError:"throw",resource:"getCommitRangeFormatted"}))));a.push(...r)}return a}))}t.getFormattedCommitOrRange=a,t.getBranchesInCommitRange=function(e){return n(this,arguments,void 0,(function*({runner:e,base:t,head:r}){return(yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=%D",`${t}..${r}`,"--"],onError:"throw",resource:"getBranchesInCommitRange"})).flatMap((e=>e.split(", "))).map((e=>e.replace("HEAD -> ",""))).filter(Boolean)}))},t.getRebaseMetadataForCommit=function(e){return n(this,arguments,void 0,(function*({runner:e,sha:t}){return a({runner:e,base:void 0,head:t,format:"REBASE_METADATA"}).then((([e])=>e.split("\n"))).then((([e,t,r,...n])=>({authorName:e,authorEmail:t,authorDate:r,message:n.join("\n")})))}))}},31176:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitTree=void 0;const o=r(64645);t.getCommitTree=function(e){return n(this,arguments,void 0,(function*({runner:e,branchNames:t}){const r=yield(0,o.getSha)({runner:e,ref:`${yield e.runGitCommand({args:["merge-base","--octopus",...t],onError:"ignore",resource:"parentOfMergeBase"})}~`}),n={};return(yield e.runGitCommandAndSplitLines({args:["rev-list","--parents",...r?[`^${r}`,...t]:["--all"],"--"],onError:"throw",resource:"getCommitTree"})).map((e=>e.split(" "))).forEach((e=>n[e[0]]=e.slice(1))),n}))}},50279:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitConfig=void 0,t.composeGitConfig=e=>{const t=new Map;return n=>r(void 0,void 0,void 0,(function*(){const o=t.get(n);if(void 0!==o)return o;const i=yield function(e){return r(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:n});return t.set(n,i),i}))}},26055:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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 r(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:r,stat:n,shortStat:o,summary:i}){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff",t,r,...n?["--stat"]:[],...o?["--shortstat"]:[],...i?["--summary"]:[],"--"],onError:"throw",resource:"showDiff"})},t.isDiffEmpty=function(e){return r(this,arguments,void 0,(function*({runner:e,left:t,right:r}){return 0===(yield e.runGitCommand({args:["--no-pager","diff","--no-ext-diff","--shortstat",t,r,"--"],onError:"throw",resource:"isDiffEmpty"})).length}))};const n=["--no-pager","-c","diff.renames=true","diff","--no-ext-diff","--no-prefix","--unified"];t.getDiff=function({runner:e,left:t,right:r}){return e.runGitCommand({args:[...n,t,...r?[r]:[],"--"],noTrim:!0,onError:"throw",resource:"getDiff"})},t.getDiffOfStagedChanges=function({runner:e}){return e.runGitCommand({args:[...n,"--cached","--"],noTrim:!0,onError:"throw",resource:"getDiffOfStagedChanges"})}},16681:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readFetchHead=t.fetchBranches=void 0;const o=r(23378),i=r(64645),s=e=>`refs/gt-fetch-head/${e}`;t.fetchBranches=function(e){return n(this,arguments,void 0,(function*({remote:e,branchNames:t,onProgressUpdate:r,runner:n}){if(0===t.length)return;const{updateProgressOnStdError:i}=(0,o.composeGitProgressTracker)({progressOutput:["Counting objects","Compressing objects","Receiving objects","Resolving deltas"],onProgressUpdate:r});yield n.runGitCommand({args:["fetch","--no-write-fetch-head","--progress","-f",e,...t.map((e=>`refs/heads/${e}:${s(e)}`))],options:{stdio:"pipe"},onError:"throw",onStdError:i,resource:"fetchBranch"})}))},t.readFetchHead=function(e){return n(this,arguments,void 0,(function*({runner:e,branchName:t}){return(0,i.getShaOrThrow)({runner:e,ref:s(t)})}))}},68012:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFileContents=void 0,t.getFileContents=function(e){return r(this,arguments,void 0,(function*({runner:e,ref:t,file:r}){return e.runGitCommand({args:["show",`${t}:${r}`],onError:"throw",resource:"fileContents"})}))}},55044:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(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 r(this,arguments,void 0,(function*({runner:e,from:t,to:r}){const o=[],i=(yield e.runGitCommand({args:["diff","-z","--name-status",t,r],onError:"ignore",resource:"getFilesChanged"})).split("\0");for(let e=0;e<i.length-1;e){const t=n(i[e][0]);if("copied"===t||"renamed"===t){const r=i[e+1],n=i[e+2];o.push({path:n,status:t,from:r}),e+=3}else{const r=i[e+1];o.push({path:r,status:t,from:void 0}),e+=2}}return o}))}},83002:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.findRemoteHeadBranch=void 0,t.findRemoteHeadBranch=function(e){return r(this,arguments,void 0,(function*({runner:e,remote:t}){const r=yield e.runGitCommand({args:["rev-parse","--abbrev-ref",`refs/remotes/${t}/HEAD`],onError:"ignore",resource:"findRemoteHeadBranch"});if(!r)return null;const n=`${t}/`;return r.startsWith(n)?r.slice(n.length):null}))}},71852:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=o(r(71017));t.getHookExecutablePath=function(e){return n(this,arguments,void 0,(function*({hook:e,gitConfig:t,repoRoot:r,gitCommonDir:n}){const o=yield t("core.hooksPath"),a=o?s.default.join(r,o):s.default.join(n,"hooks"),u=s.default.join(a,e);return i.default.pathExistsSync(u)?u:null}))}},64645:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGetRemoteSha=t.getSha=t.getShaOrThrow=void 0,t.getShaOrThrow=function(e){return r(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 r(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:n=>r(this,void 0,void 0,(function*(){t=yield function(e){return r(this,arguments,void 0,(function*({remote:e,runner:t}){const r={};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])=>r[t.slice(11)]=e)),r}))}({remote:n,runner:e})})),getRemoteSha:e=>null==t?void 0:t[e]}}},15506:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runGitCommandPassthrough=void 0,t.runGitCommandPassthrough=function({command:e,args:t,runner:r}){return r.runGitCommand({args:[e,...t],onError:"throw",options:{stdio:"inherit"},resource:`runGitCommandPassthrough_${e}`})}},13729:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getGitVersion=void 0,t.getGitVersion=function(e){return r(this,arguments,void 0,(function*({runner:e}){return(yield e.runGitCommand({args:["--version"],onError:"throw",resource:"getGitVersion"})).split(" ")[2]}))}},70341:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.writeTreeFromIndexFile=t.applyPatchToIndexFile=t.readTreeIntoIndexFile=void 0,t.readTreeIntoIndexFile=function(e){return r(this,arguments,void 0,(function*({treeish:e,indexFile:t,runner:r,repoRoot:n}){yield r.runGitCommand({args:["read-tree","--index-output",t,e],cwd:n,onError:"throw",resource:"readTreeIntoIndexFile"})}))},t.applyPatchToIndexFile=function(e){return r(this,arguments,void 0,(function*({patch:e,runner:t,indexFile:r,repoRoot:n}){yield t.runGitCommand({args:["apply","--verbose","--cached","-p0","--unidiff-zero","-"],input:e,options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:r})},cwd:n,onError:"throw",resource:"applyPatchToIndexFile"})}))},t.writeTreeFromIndexFile=function(e){return r(this,arguments,void 0,(function*({indexFile:e,runner:t,repoRoot:r}){return t.runGitCommand({args:["write-tree"],options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:e})},cwd:r,onError:"throw",resource:"writeTreeFromIndexFile"})}))}},61093:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isMerged=void 0;const o=r(67397),i=r(64645),s=r(87803);t.isMerged=function(e){return n(this,arguments,void 0,(function*({branchName:e,trunkName:t,runner:r}){const a=(0,s.getMergeBase)({runner:r,left:e,right:t}),u=(yield(0,o.getFormattedCommitOrRange)({base:t,head:e,format:"SHA",runner:r})).reverse();return(yield u.reduce(((e,o)=>n(this,void 0,void 0,(function*(){const n=yield e,i=yield r.runGitCommand({args:["commit-tree",`${o}^{tree}`,"-p",n,"-m","_"],onError:"ignore",resource:"mergeBaseCommitTree"});return(yield r.runGitCommand({args:["cherry",t,i,n],onError:"ignore",resource:"isMerged"})).startsWith("-")?o:n}))),Promise.resolve(a)))===(yield(0,i.getSha)({runner:r,ref:e}))}))}},14397:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.logLong=void 0,t.logLong=function(e){return r(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"],options:{stdio:"inherit"},onError:"throw",resource:"logLong"})}))}},87803:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isAncestor=t.getMergeBase=void 0;const o=r(93333);t.getMergeBase=function({runner:e,left:t,right:r}){return e.runGitCommand({args:["merge-base",t,r],onError:"throw",resource:"getMergeBase"})},t.isAncestor=function(e){return n(this,arguments,void 0,(function*({runner:e,left:t,right:r}){try{return yield e.runGitCommand({args:["merge-base","--is-ancestor",t,r],onError:"throw",resource:"getMergeBase"}),!0}catch(e){if(e instanceof o.CommandFailedError&&1===e.exitCode)return!1;throw e}}))}},27373:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=o(r(71017));t.getRebaseHead=function(e){return n(this,arguments,void 0,(function*({gitDir:e}){const t=s.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)}))}},21435:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.packAllRefs=void 0,t.packAllRefs=function(e){return r(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["pack-refs","--all"],onError:"throw",resource:"packAllRefs"})}))}},42178:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(e){return r(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 r(this,arguments,void 0,(function*({ref:e,sha:t,runner:r}){yield r.runGitCommand({args:["update-ref",e,t],options:{stdio:"pipe"},onError:"throw",resource:"updateRef"})}))},t.doesObjectExist=function(e){return r(this,arguments,void 0,(function*({ref:e,runner:t}){try{return yield n({ref:e,runner:t}),!0}catch(e){return!1}}))},t.readRef=n,t.deleteRef=function(e){return r(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 r(this,arguments,void 0,(function*({runner:e,prefix:t}){const r={};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,n])=>r[e.substring(t.length)]=n)),r}))}},73777:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fastForwardBranchToRemoteTracking=t.fetchRemoteTrackingBranch=void 0;const o=r(93333);t.fetchRemoteTrackingBranch=function(e){return n(this,arguments,void 0,(function*({runner:e,remote:t,branchName:r}){yield e.runGitCommand({args:["fetch",t,r],onError:"throw",resource:"fetchRemoteTrackingBranch"})}))},t.fastForwardBranchToRemoteTracking=function(e){return n(this,arguments,void 0,(function*({runner:e,remote:t,branchName:r}){try{return yield e.runGitCommand({args:["merge","--ff-only",`${t}/${r}`],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}}))}},2250:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pushBranches=void 0;const o=r(32081),i=r(23378),s=r(71852),a=r(22925);t.pushBranches=function(e){return n(this,arguments,void 0,(function*({remote:e,branches:t,noVerify:r,forcePush:u,runner:c,gitConfig:l,gitCommonDir:d,repoRoot:f,onProgressUpdate:h}){const{updateProgressOnStdError:m}=(0,i.composeGitProgressTracker)({progressOutput:["Counting objects","Compressing objects","Writing objects","Resolving deltas"],onProgressUpdate:h}),p="win32"===process.platform;r||p||(yield function(e){return n(this,arguments,void 0,(function*({branches:e,gitConfig:t,remote:r,repoRoot:n,gitCommonDir:i,runner:u}){const c=yield(0,s.getHookExecutablePath)({hook:"pre-push",gitConfig:t,repoRoot:n,gitCommonDir:i});if(!c)return;const l=yield(0,a.getRemoteUrl)({runner:u,remote:r}),d=e.map((e=>{const t=`refs/heads/${e.name}`;return`${t} ${e.localSha} ${t} ${e.remoteSha||"0000000000000000000000000000000000000000"}\n`})).join("");try{(0,o.execSync)(`"${c}" ${r} ${l}`,{stdio:["pipe","inherit","inherit"],input:d,encoding:"utf-8",cwd:n})}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:c,remote:e,gitConfig:l,gitCommonDir:d,repoRoot:f,branches:t}));const g=u?"--force":"--force-with-lease";yield c.runGitCommand({args:["push","-u",e,g,"--progress",...t.map((e=>e.name)),...r?["--no-verify"]:p?[]:["--no-verify"]],onError:"throw",resource:"pushBranch",onStdError:m})}))}},42517:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.commitRangesAreEquivalent=void 0,t.commitRangesAreEquivalent=function(e){return r(this,arguments,void 0,(function*({runner:e,base1:t,head1:n,base2:o,head2:i,remote:s}){if(t===n||o===i)return t===n&&o===i;const a=(yield Promise.all([t,n,o,i].map((t=>r(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["show","--no-patch",t,"--"],onError:"throw",resource:"rangeDiffShow"}),{sha:t,toFetch:!1}}catch(e){return{sha:t,toFetch:!0}}})))))).filter((({toFetch:e})=>e)).map((({sha:e})=>e));a.length>0&&(yield e.runGitCommand({args:["fetch","--no-write-fetch-head",s,...a],onError:"throw",resource:"rangeDiffFetch"}));const u=`${t}..${n}`,c=`${o}..${i}`,l=yield e.runGitCommandAndSplitLines({args:["range-diff",u,c],onError:"throw",resource:"rangeDiff"});for(const e of l){const t=e.trim().split(/\s+/);if(t.length<3)return!1;if("="!==t[2])return!1}return!0}))}},71735:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInteractive=t.rebaseAbort=t.rebaseContinue=t.rebase=void 0;const o=r(93333),i=r(5755);function s(e){return n(this,arguments,void 0,(function*({runner:e}){yield e.runGitCommand({args:["rebase","--abort"],options:{stdio:"pipe"},onError:"throw",resource:"rebaseAbort"})}))}function a(e){return n(this,arguments,void 0,(function*({args:e,options:t,resource:r,runner:n,gitDir:u}){try{yield n.runGitCommand({args:["rebase",...e],options:Object.assign({stdio:"pipe"},t),onError:"throw",resource:r})}catch(c){if(c instanceof o.CommandFailedError&&c.message.includes("It seems that there is already a rebase-merge directory")){try{yield s({runner:n})}catch(e){throw c}return a({runner:n,args:e,options:t,resource:r,gitDir:u})}if(yield(0,i.rebaseInProgress)({gitDir:u}))return"REBASE_CONFLICT";throw c}return"REBASE_DONE"}))}t.rebase=function(e){return n(this,arguments,void 0,(function*({onto:e,from:t,branchName:r,restackCommitterDateIsAuthorDate:n,runner:o,gitDir:i}){return a({runner:o,args:[...n?["--committer-date-is-author-date"]:[],"--onto",e,t,r],resource:"rebase",gitDir:i})}))},t.rebaseContinue=function(e){return n(this,arguments,void 0,(function*({runner:e,gitDir:t,options:{runWithStdio:r}={runWithStdio:!1}}){return a({runner:e,args:["--continue"],options:{env:Object.assign(Object.assign({},process.env),{GIT_EDITOR:"true"}),stdio:r?"inherit":"pipe"},resource:"rebaseContinue",gitDir:t})}))},t.rebaseAbort=s,t.rebaseInteractive=function(e){return n(this,arguments,void 0,(function*({runner:e,parentBranchRevision:t,branchName:r,gitDir:n}){return a({runner:e,args:["-i",t,r],resource:"rebaseInteractive",options:{stdio:"inherit"},gitDir:n})}))}},5755:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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(r(32856)),s=o(r(71017));t.rebaseInProgress=function(e){return n(this,arguments,void 0,(function*({gitDir:e}){return i.default.pathExists(s.default.join(e,"rebase-merge"))}))}},60770:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCleanlyReconciledSquashedHead=void 0;const o=r(93333),i=r(67397);function s(e){return n(this,arguments,void 0,(function*({onto:e,from:t,head:r,runner:n}){const i=yield n.runGitCommand({args:["commit-tree",`${e}^{tree}`,"-p",t,"-m","_"],onError:"throw",resource:"getRebasedTreeOntoCommitTree"});return n.runGitCommand({args:["merge-tree",i,r],onError:"throw",resource:"getRebasedTreeMergeTree"}).catch((e=>{if(e instanceof o.CommandFailedError&&1===e.exitCode)return null;throw e}))}))}t.getCleanlyReconciledSquashedHead=function(e){return n(this,arguments,void 0,(function*({oldBase:e,oldHead:t,newBase:r,newHead:n,updatedBase:a,updatedHead:u,restackCommitterDateIsAuthorDate:c,runner:l,gitConfig:d}){const f=yield d("commit.gpgSign"),h=f&&"false"!==f&&"0"!==f,m=yield s({runner:l,onto:r,from:e,head:t});if(null===m)return null;const p=yield s({runner:l,onto:r,from:a,head:u});if(null===p)return null;const g=yield l.runGitCommand({args:["commit-tree",m,"-p",r,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadOldTreeCommit"}),v=yield l.runGitCommand({args:["commit-tree",p,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadUpdatedTreeCommit"}),y=yield l.runGitCommand({args:["commit-tree",`${n}^{tree}`,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadNewHeadCommit"}),b=yield l.runGitCommand({args:["merge-tree",y,v],onError:"throw",resource:"getCleanlyReconciledSquashedHeadMergeTree"}).catch((e=>{if(e instanceof o.CommandFailedError&&1===e.exitCode)return null;throw e}));if(null===b)return null;const E=(yield(0,i.getFormattedCommitOrRange)({format:"SHA",runner:l,head:n,base:r})).at(-1);if(!E)return null;const{authorName:w,authorEmail:_,authorDate:C,message:R}=yield(0,i.getRebaseMetadataForCommit)({runner:l,sha:E});return l.runGitCommand({args:["commit-tree",b,"-p",r,"-m",R,...h?["-S"]:[]],onError:"throw",resource:"getCleanlyReconciledSquashedHeadCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:w,GIT_AUTHOR_EMAIL:_,GIT_AUTHOR_DATE:C}),c&&{GIT_COMMITTER_DATE:C})}})}))}},22925:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRemoteUrl=void 0,t.getRemoteUrl=function(e){return r(this,arguments,void 0,(function*({runner:e,remote:t}){return e.runGitCommand({args:["remote","get-url",t,"--push"],onError:"throw",resource:"getRemoteUrl"})}))}},58468:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRepoPaths=void 0,t.getRepoPaths=function(e){return r(this,arguments,void 0,(function*({runner:e}){try{const[t,r,n]=yield e.runGitCommandAndSplitLines({args:["rev-parse","--path-format=absolute","--show-toplevel","--git-common-dir","--git-dir"],onError:"throw",resource:"getRepoPaths"});return{repoRoot:t,gitCommonDir:r,gitDir:n}}catch(e){return}}))}},52282:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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 r(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 r(this,arguments,void 0,(function*({sha:e,cwd:t,runner:r}){yield r.runGitCommand({args:["reset","-q","--mixed",...e?[e,"--"]:[]],onError:"throw",resource:"mixedReset",cwd:t})}))},t.keepReset=function(e){return r(this,arguments,void 0,(function*({sha:e,runner:t,cwd:r}){yield t.runGitCommand({args:["reset","-q","--keep",e,"--"],onError:"throw",resource:"keepReset",cwd:r})}))},t.trackedReset=function(e){return r(this,arguments,void 0,(function*({sha:e,runner:t}){yield t.runGitCommand({args:["reset","-Nq",e,"--"],onError:"throw",resource:"trackedReset"})}))}},11154:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.restore=void 0,t.restore=function(e){return r(this,arguments,void 0,(function*({pathSpec:e,source:t,staged:r,runner:n}){return n.runGitCommand({args:["restore",...t?[`--source=${t}`]:[],...r?["--staged"]:[],"-q","--",...e],onError:"throw",resource:"restore"})}))}},19963:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteRemoteTracking=t.setRemoteTracking=void 0,t.setRemoteTracking=function(e){return r(this,arguments,void 0,(function*({remote:e,branchName:t,sha:r,runner:n}){yield n.runGitCommand({args:["update-ref",`refs/remotes/${e}/${t}`,r],onError:"throw",resource:"setRemoteTracking"}),yield n.runGitCommand({args:["branch","-u",`${e}/${t}`,t],onError:"ignore",resource:"setRemoteTrackingUpstream"})}))},t.deleteRemoteTracking=function(e){return r(this,arguments,void 0,(function*({remote:e,branchName:t,runner:r}){yield r.runGitCommand({args:["update-ref","-d",`refs/remotes/${e}/${t}`],onError:"throw",resource:"deleteRemoteTracking"})}))}},19109:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.showCommits=void 0,t.showCommits=function(e){return r(this,arguments,void 0,(function*({base:e,head:t,patch:r,runner:n}){return n.runGitCommand({args:["-c","color.ui=always","--no-pager","log",..."patch"===r?["-p"]:"stat"===r?["--stat"]:[],`${e}..${t}`,"--"],onError:"throw",resource:"showCommits"})}))}},75122:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchNamesAndRevisions=void 0,t.getBranchNamesAndRevisions=function(e){return r(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,r])=>t[e]=r)),t}))}},37378:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createStashCommit=void 0;const o=r(45960);t.createStashCommit=function(e){return n(this,arguments,void 0,(function*({runner:e,cwd:t}){const r=yield e.runGitCommand({args:["stash","create"],onError:"ignore",resource:"stashCreate",cwd:t});if(!r)return null;const n=yield(0,o.getCommitParents)({ref:r,runner:e});return 2!==n.length?null:{headRef:n[0],indexRef:n[1],workingTreeRef:r}}))}},64568:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(e){return r(this,arguments,void 0,(function*({runner:e,cwd:t}){const r=yield e.runGitCommand({args:["--no-optional-locks","status","-z"],onError:"throw",resource:"getRawStatus",noTrim:!0,cwd:t}),n=r.split("\0"),o=[];for(let e=0;e<n.length-1;e++){const t=n[e],s=t[0],a=t[1];if(!i(s)||!i(a))throw new Error("Invalid status output:\n"+r);const u=t.slice(3),c=["R","C"].includes(s)||["R","C"].includes(a)?n[++e]:void 0;o.push({path:u,from:c,indexStatus:s,workingTreeStatus:a})}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 r(this,arguments,void 0,(function*({runner:e,cwd:t}){yield e.runGitCommand({args:["status"],onError:"ignore",resource:"refreshIndex",cwd:t})}))},t.detectStagedChanges=function(e){return r(this,arguments,void 0,(function*({runner:e,cwd:t}){return(yield n({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 r(this,arguments,void 0,(function*({runner:e}){return(yield n({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"U"===e||["U","M","T","A","D","C","R"].includes(t)))}))},t.detectUntrackedChanges=function(e){return r(this,arguments,void 0,(function*({runner:e}){return(yield n({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"?"===e||"?"===t))}))},t.getUnmergedFiles=function(e){return r(this,arguments,void 0,(function*({runner:e}){return(yield n({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 r(this,arguments,void 0,(function*({runner:e}){return(yield n({runner:e})).map((({indexStatus:e,workingTreeStatus:t,path:r,from:n})=>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:r,from:n})))}))};const o=["M","T","A","D","C","R","U"," ","?","!"];function i(e){return o.includes(e)}},70081:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(e){return r(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 r(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=n,t.trackFiles=o,t.trackAllNewFiles=function(e){return r(this,arguments,void 0,(function*({runner:e}){const t=yield n({runner:e});yield o({runner:e,filePaths:t})}))}},59373:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(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 r(this,arguments,void 0,(function*({refs:e,runner:t}){yield t.runGitCommand({args:["update-ref","--stdin"],onError:"throw",resource:"updateRefs",input:n(e)})}))},t.calculateRefUpdateTransactionForTest=n},53911:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.listWorktrees=void 0,t.listWorktrees=function(e){return r(this,arguments,void 0,(function*({runner:e}){var t,r,o;const i=[],s=(yield e.runGitCommand({args:["worktree","list","--porcelain","-z"],onError:"throw",resource:"updateRefs"})).split("\0\0");for(const e of s){const s=e.split("\0"),a=null===(t=s[0])||void 0===t?void 0:t.split(" ")[1],u=null===(r=s[1])||void 0===r?void 0:r.split(" ")[1];if(!a||!u)continue;const c=s[2]?n(s[2]):null;i.push({path:a,ref:u,branch:null!==(o=null==c?void 0:c.branchName)&&void 0!==o?o:null})}return i}))};const n=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}},70435:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.commuteHunkBefore=t.getNetChangeInHunk=t.translateNewLinesInHunk=t.translateHunk=t.getBoundsOfHunk=void 0;const n=r(34490);function o(e){const{oldStart:t,newStart:r}=e,n=e.lines.filter((({type:e})=>"remove"===e)),o=e.lines.filter((({type:e})=>"add"===e));return{oldStart:t,oldEnd:n.length?t+n.length-1:void 0,newStart:r,newEnd:o.length?r+o.length-1:void 0}}function i(e,t){return Object.assign(Object.assign({},e),{oldStart:e.oldStart+t,newStart:e.newStart+t})}function s(e){return e.lines.reduce(((e,t)=>{switch(t.type){case"remove":return e-1;case"add":return e+1;default:(0,n.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=s,t.commuteHunkBefore=function({originalBeforeHunk:e,originalAfterHunk:t}){const{newStart:r,newEnd:n}=o(e),{oldStart:a,oldEnd:u}=o(t);return(null!=u?u:a)<r||void 0===n&&void 0!==u&&u===r?t:(null!=n?n:r)<a||void 0!==n&&void 0===u&&n===a?i(t,-1*s(e)):void 0}},39314:(e,t)=>{function r({hunk:e}){const t=e.lines.filter((e=>"remove"===e.type)),r=e.lines.filter((e=>"add"===e.type));return[`@@ -${e.oldStart},${t.length} +${e.newStart},${r.length} @@`,...t.map((e=>`-${e.text}`)),...e.oldNoNewlineAtEndOfFile?["\"]:[],...r.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=>r({hunk:e})))].join("\n")},t.computePatchFromHunk=r},4541:(e,t)=>{function r(e){const[t,...r]=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[s,a]=i.split(" ");if(!s||!a)throw new Error("invalid diff file prefix line "+i);for(const e of o.slice(1))if(e.startsWith("new file"))s="/dev/null";else if(e.startsWith("deleted file"))a="/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:s,newFilename:a,hunks:r.map((e=>{try{return n(e)}catch(t){throw new Error(`Error parsing hunk for file ${s} ${a}:\n${"object"==typeof t&&t&&"message"in t&&t.message}\n${e}`)}}))}}function n(e){const[t,...r]=e.split("\n");if(!t)throw new Error("empty hunk");const[n]=t.split("@@");if(!n)throw new Error("invalid hunk header "+t);const[o,i]=n.trim().split(" ");if(!o||!i)throw new Error("invalid hunk header "+t);const[s,a]=o.slice(1).split(","),[u,c]=i.slice(1).split(",");if(!s||!u)throw new Error("invalid hunk header "+t);let l,d=+s,f=+u,h=!1,m=!1;const p=[];for(const e of r){if(0===e.length)continue;const t=e[0],r=e.slice(1);switch(t){case"-":d++,p.push({type:"remove",text:r});break;case"+":f++,p.push({type:"add",text:r});break;case" ":d++,f++,p.push({type:"context",text:r});break;case"\\":if(!l||" No newline at end of file"!==r)throw new Error("invalid hunk line "+e);switch(l){case"-":h=!0;break;case"+":m=!0;break;case" ":h=!0,m=!0;break;default:throw new Error("invalid hunk line "+e)}break;default:throw new Error("invalid hunk line "+e)}l=t}const g=+s+(a?+a:1);if(d!==g)throw new Error("invalid hunk old line count "+d+" should be "+g);const v=+u+(c?+c:1);if(f!==v)throw new Error("invalid hunk new line count "+f+" should be "+v);return{oldNoNewlineAtEndOfFile:h,newNoNewlineAtEndOfFile:m,oldStart:+s,newStart:+u,lines:p}}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(r):[]},t.parseDiffHunkForTest=n},21542:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduceHunksToZeroContext=void 0;const n=r(34490);t.reduceHunksToZeroContext=function(e){return e.map((e=>({oldFilename:e.oldFilename,newFilename:e.newFilename,hunks:e.hunks.flatMap((e=>{const t=[];let r=e.oldStart,o=e.newStart,i=r,s=o,a=[];for(const u of e.lines)if("context"!==u.type)switch(u.type){case"remove":a.push({type:"remove",text:u.text}),r++;break;case"add":a.push({type:"add",text:u.text}),o++;break;default:(0,n.assertUnreachable)(u)}else a.length>0&&t.push({oldStart:i,newStart:s,lines:a,oldNoNewlineAtEndOfFile:!1,newNoNewlineAtEndOfFile:!1}),i=++r,s=++o,a=[];return a.length>0&&t.push({oldStart:i,newStart:s,lines:a,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}))}))})))}},9682:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=void 0;const i=r(32081),s=o(r(32856)),a=o(r(71017)),u=r(93333),c="test.txt";t.GitRepo=class{constructor(e,t){this.dir=e,this.runner=(0,u.composeGitRunner)({cwd:e,debug:process.env.DEBUG?e=>console.log(e):()=>{}}),this.userConfigPath=a.default.join(e,".git/.graphite_user_config"),(null==t?void 0:t.existingRepo)||(0,i.spawnSync)("git",(null==t?void 0:t.repoUrl)?["clone",t.repoUrl,e]:["init",e,"-b","main"]),(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 n(this,void 0,void 0,(function*(){return this.runner.runGitCommand({args:e,onError:"throw",resource:"test",options:{env:null==t?void 0:t.env},cwd:null==t?void 0:t.cwd})}))}createChange(e){return n(this,arguments,void 0,(function*({textValue:e,prefix:t,unstaged:r,cwd:n}){const o=a.default.join(n||`${this.dir}`,`${t?t+"_":""}${c}`);s.default.writeFileSync(o,e),r||(yield this.runGitCommand(["add",o]))}))}readFileContents(e){const t=a.default.join(`${this.dir}`,`${e?e+"_":""}${c}`);return s.default.readFileSync(t,"utf8")}createChangeAndCommit(e,t){return n(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 n(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 n(this,void 0,void 0,(function*(){yield this.runGitCommand(["branch","-D",e])}))}hasStagedChanges(){return n(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["diff","--cached"])).length>0}))}createPrecommitHook(e){s.default.mkdirpSync(`${this.dir}/.git/hooks`),s.default.writeFileSync(`${this.dir}/.git/hooks/pre-commit`,e),(0,i.spawnSync)("chmod",["+x",`${this.dir}/.git/hooks/pre-commit`])}createAndCheckoutBranch(e){return n(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","-b",e])}))}checkoutBranch(e){return n(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout",e])}))}rebaseInProgress(){return s.default.existsSync(a.default.join(this.dir,".git","rebase-merge"))}resolveMergeConflicts(){return n(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","--theirs","."])}))}markMergeConflictsAsResolved(){return n(this,void 0,void 0,(function*(){yield this.runGitCommand(["add","."])}))}currentBranchName(){return n(this,void 0,void 0,(function*(){return this.runGitCommand(["branch","--show-current"])}))}getBranchSha(e){return n(this,void 0,void 0,(function*(){return this.runGitCommand(["rev-parse",`refs/heads/${e}`])}))}listCurrentBranchCommitMessages(){return n(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["log","--oneline","--format=%B"])).split("\n").filter((e=>e.length>0))}))}}},53649:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=t.CommandKilledError=t.CommandFailedError=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 n=r(9164);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return n.composeGit}});var o=r(50279);Object.defineProperty(t,"composeGitConfig",{enumerable:!0,get:function(){return o.composeGitConfig}});var i=r(70435);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 s=r(39314);Object.defineProperty(t,"computePatchFromHunk",{enumerable:!0,get:function(){return s.computePatchFromHunk}}),Object.defineProperty(t,"computePatchFromHunks",{enumerable:!0,get:function(){return s.computePatchFromHunks}});var a=r(4541);Object.defineProperty(t,"parseDiffHunkForTest",{enumerable:!0,get:function(){return a.parseDiffHunkForTest}}),Object.defineProperty(t,"parseHunksFromDiff",{enumerable:!0,get:function(){return a.parseHunksFromDiff}});var u=r(21542);Object.defineProperty(t,"reduceHunksToZeroContext",{enumerable:!0,get:function(){return u.reduceHunksToZeroContext}});var c=r(93333);Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return c.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return c.CommandKilledError}});var l=r(9682);Object.defineProperty(t,"GitRepo",{enumerable:!0,get:function(){return l.GitRepo}})},93333:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CommandKilledError=t.CommandFailedError=t.composeGitRunner=void 0;const o=r(32081),i=r(97503);t.composeGitRunner=({cwd:e,debug:t})=>{const r=r=>n(void 0,void 0,void 0,(function*(){var n;const o=null!==(n=r.cwd)&&void 0!==n?n:e,s=Object.assign(Object.assign(Object.assign({},r),o?{args:["-C",o,...r.args]}:{}),{debug:t});return r.resource&&i.tracer.currentSpanId?i.tracer.span({name:"spawnedCommand",resource:r.resource,meta:{runCommandArgs:JSON.stringify(r,null,2)}},(()=>d(s))):d(s)}));return{runGitCommand:r,runGitCommandAndSplitLines:e=>n(void 0,void 0,void 0,(function*(){return(yield r(e)).split("\n").filter((e=>e.length>0))}))}};const s=5,a=3,u=["EAGAIN","EBADF"],c=50;function l(e){return new Promise((t=>setTimeout(t,e)))}function d(e){return n(this,void 0,void 0,(function*(){var t;try{return yield f(e)}catch(r){const{debug:n}=e,o=r instanceof Error?r.message:"unknown error";null==n||n(`Spawning git ${e.args.join(" ")} failed: ${o}`);const i=null!==(t=e.numSpawnRetries)&&void 0!==t?t:0;if(i<a&&u.some((e=>o.includes(e))))return null==n||n(`Retrying git command after spawn error (attempt ${i+1}/${a})...`),yield l(c),d(Object.assign(Object.assign({},e),{numSpawnRetries:i+1}));throw r}}))}function f({args:e,options:t,debug:r,noTrim:n,onError:i,input:a,resource:u,numIndexLockRetries:d,numSpawnRetries:p,onStdError:g}){return d&&(null==r||r(`index.lock retry: ${d}`)),new Promise(((v,y)=>{var b,E;const w=(0,o.spawn)("git",e,Object.assign(Object.assign({},t),{windowsHide:!0}));null==r||r(`${p?`[Retry ${p}] `:""}Spawning ${u} (${w.pid}): git ${e.join(" ")}`),a&&(null===(b=w.stdin)||void 0===b||b.write(a),null===(E=w.stdin)||void 0===E||E.end());let _="";w.stdout&&(w.stdout.setEncoding("utf8"),w.stdout.on("data",(function(e){_+=e.toString()})));let C="";w.stderr&&(w.stderr.setEncoding("utf8"),w.stderr.on("data",(function(e){const t=e.toString();C+=t,null==g||g(t)}))),w.addListener("close",((o,a)=>(null==r||r(`Finished ${u} (${w.pid}): git ${e.join(" ")}\n${JSON.stringify({code:o,signal:a,stdout:_,stderr:C},null,2)}`),a?y(new m({command:"git",args:e,signal:a,stdout:_,stderr:C})):0===o?v(n?_:_.trim()):(null!=d?d:0)<s&&C.includes("index.lock")?v(l(c).then((()=>f({args:e,options:t,debug:r,onError:i,resource:u,numIndexLockRetries:(null!=d?d:0)+1})))):"ignore"===i?v(""):y(new h({command:"git",args:e,status:o||1,stdout:_,stderr:C})))))}))}class h 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=h;class m 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=m},23378:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitProgressTracker=void 0;const n=r(34490),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 r={completionPercentage:0,currentStep:"Starting"};return{updateProgressOnStdError:i=>{const s=1/e.length;for(let u=e.length-1;u>=0;u--){const c=(a=o[e[u]],[...i.matchAll(a)].reduce(((e,t)=>{const r=t[1]?(0,n.parseIntOrNull)(t[1]):null;return null===r?e:Math.max(null!=e?e:0,r)}),null));if(null!==c){const n=Math.round(100*(c/100*s+u*s));n!==r.completionPercentage&&(null==t||t({completionPercentage:n,currentStep:e[u]})),r={completionPercentage:n,currentStep:e[u]};break}}var a;return r}}}},95808:(e,t,r)=>{t.composeGit=void 0;var n=r(53649);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return n.composeGit}});r(97503),r(53649)},97503:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.tracer=void 0;const n=o();function o(){return Math.ceil(1e9*Math.random())}function i(e){return null!=e}const s=BigInt(Date.now())*BigInt(1e6)-process.hrtime.bigint();function a(){return process.hrtime.bigint()+s}class u{constructor(e){this.name=e.name,this.parentId=e.parentId,this.resource=e.resource,this.meta=e.meta,this.spanId=o(),this.start=a()}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:n,type:"custom",duration:Number(a()-this.start)},this.parentId?{parent_id:this.parentId}:{parent_id:0})}}t.tracer=new class{constructor(){this.allSpans=[]}startSpan(e){const t=new u(Object.assign(Object.assign({},e),this.currentSpanId?{parentId:this.currentSpanId}:{}));return this.allSpans.push(t),t}span(e,t){return r(this,void 0,void 0,(function*(){const r=this.startSpan(e);let n;this.currentSpanId=r.spanId;try{n=yield t()}catch(e){throw r.end(n,e instanceof Error?e:new Error("unknown error")),e}return r.end(n),this.currentSpanId=r.parentId,n}))}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 r=[e];return this.allSpans=this.allSpans.filter((e=>!e.endedSpan)),JSON.stringify(r)}}},33800:(e,t)=>{var r;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"}(r||(t.ComparisonType=r={})),t.labelForComparison=function(e){switch(e.type){case r.UncommittedChanges:return"Uncommitted changes";case r.HeadChanges:return"Changes in current commit";case r.StackChanges:return"Changes in current branch";case r.Committed:return`Changes in ${e.hash}`;case r.Commit:return`In ${e.sha}`;case r.Range:return`From ${e.fromSha} to ${e.toSha}`}}},2982:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cached=t.LRU=void 0;const n=r(30826);class o{constructor(e,t=3){this.maxItems=e,this.maxHashCollision=t,this.cache=new Map}get(e){let t;const r=i(e),o=this.cache.get(r);if(void 0!==o){const i=o.get(e);if(void 0!==i)t=i;else for(const[r,i]of o)if((0,n.is)(e,r)){t=i;break}this.cache.delete(r),this.cache.set(r,o)}return t}set(e,t){const r=i(e);let n=this.cache.get(r);if(void 0===n||n.size>=this.maxHashCollision?n=new Map([[e,t]]):n.set(e,t),this.cache.delete(r),void 0!==t&&(this.cache.set(r,n),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=null==e?void 0:e.hashCode;return void 0!==t?t.apply(e):e}function s(e,t){var r,i;const s=null!==(r=null==t?void 0:t.cache)&&void 0!==r?r:new o(null!==(i=null==t?void 0:t.cacheSize)&&void 0!==i?i:10),a=null==t?void 0:t.getExtraKeys,c=function(...t){var r,o,i;const c=s.stats;if(!t.every(u))return null!=c&&(c.skip=(null!==(r=c.skip)&&void 0!==r?r:0)+1),e.apply(this,t);const l=(0,n.List)(a?[...a.apply(this),...t]:t),d=s.get(l);if(void 0!==d)return null!=c&&(c.hit=(null!==(o=c.hit)&&void 0!==o?o:0)+1),d;null!=c&&(c.miss=(null!==(i=c.miss)&&void 0!==i?i:0)+1);const f=e.apply(this,t);return s.set(l,f),f};return c.cache=s,c}t.LRU=o,t.cached=function(e,t){return"function"==typeof e?s(e,t):function(e){var t;const r=null!==(t=null==e?void 0:e.getExtraKeys)&&void 0!==t?t:function(){return(0,n.isValueObject)(this)?[this]:null!=this&&"object"==typeof this?Object.values(this).filter(u):[]};return function(t,n,o){const i=o.value;o.value=s(i,Object.assign(Object.assign({},e),{getExtraKeys:r}))}}(e)};const a=new Set(["number","string","boolean","symbol","bigint","undefined","null"]);function u(e){if(null==e)return!0;const t=typeof e;return!!a.has(t)||!("object"!==t||!(0,n.isValueObject)(e))}},61110:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5693:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(61110),t),o(r(52568),t),o(r(11268),t),o(r(66877),t)},52568:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},11268:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tracker=void 0;const n=r(48427);class o{constructor(e,t){this.sendData=e,this.context=t}error(e,t,r,n){const o=r instanceof Error?r.message||String(r):r;this.track(e,Object.assign(Object.assign({},null!=n?n:{}),{errorMessage:o,errorName:t}))}operation(e,t,r,o){var i;const s=Date.now(),a=null!==(i=null==r?void 0:r.id)&&void 0!==i?i:(0,n.randomId)();try{const i=o({parentId:a});if((0,n.isPromise)(i))return i.then((t=>{const n=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=r?r:{}),{duration:n,id:a})),t})).catch((n=>{const o=Date.now()-s;return this.error(e,t,n,Object.assign(Object.assign({},null!=r?r:{}),{duration:o,id:a})),Promise.reject(n)}));const u=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=r?r:{}),{duration:u,id:a})),i}catch(n){const o=Date.now()-s;throw this.error(e,t,n,Object.assign(Object.assign({},null!=r?r:{}),{duration:o,id:a})),n}}trackAsParent(e,t){var r;const i=null!==(r=null==t?void 0:t.id)&&void 0!==r?r:(0,n.randomId)();return this.trackData(Object.assign(Object.assign({},t),{eventName:e,id:i})),new o(((e,t)=>this.trackData(Object.assign(Object.assign({},e),t))),{parentId:i})}track(e,t){this.trackData(Object.assign(Object.assign({},t),{eventName:e}))}trackData(e){var t,r;const o=null!==(t=null==e?void 0:e.id)&&void 0!==t?t:(0,n.randomId)(),i=null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),s=Object.assign({timestamp:i,id:o},null!=e?e:{});this.sendData(s,this.context)}}t.Tracker=o},66877:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66960:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0,t.debounce=function(e,t,r=void 0,n=!1){let o,i=!0;function s(...a){let u;if(n){if(u=function(){i=!0,o=void 0},!i)return clearTimeout(o),void(o=setTimeout(u,t));i=!1,e.apply(r,a)}else s.reset(),u=function(){o=void 0,e.apply(r,a)};o=setTimeout(u,t)}return s.reset=function(){clearTimeout(o),o=void 0,i=!0},s.isPending=function(){return null!=o},s}},98696:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5693),t),o(r(33800),t),o(r(66960),t),o(r(2982),t),o(r(75905),t),o(r(85249),t),o(r(40256),t),o(r(86099),t),o(r(66224),t),o(r(48427),t)},75905:(e,t)=>{var r;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"}(r||(t.DiffType=r={}));const n=/^diff --git (.*) (.*)$/,o=/^rename from (.*)$/,i=/^rename to (.*)$/,s=/^copy from (.*)$/,a=/^copy to (.*)$/,u=/^new file mode (\d{6})$/,c=/^deleted file mode (\d{6})$/,l=/^old mode (\d{6})$/,d=/^new mode (\d{6})$/,f=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,h=/^--- (.*)$/,m=/^\+\+\+ (.*)$/,p=/\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(p),v=e.match(p)||[],y=[];let b=0;function E(){const e={hunks:[]};for(y.push(e),function(e){for(;b<t.length;){const r=t[b],o=n.exec(r);if(o){e.oldFileName=o[1],e.newFileName=o[2],b++;break}b++}}(e);b<t.length;){const r=t[b];if(/^old mode/.test(r))w(e);else if(/^new mode/.test(r))_(e);else if(/^deleted file mode/.test(r))C(e);else if(/^new file mode/.test(r))R(e);else if(/^copy /.test(r))O(e);else if(/^rename /.test(r))P(e);else{if(/^--- /.test(r)){S(e);break}if(/^diff --git/.test(r))break;b++}}!function(e){for(;b<t.length;){const r=t[b];if(n.test(r))break;/^@@/.test(r)?e.hunks.push(A()):b++}}(e)}function w(e){const n=l.exec(t[b]);g(null!==n,`invalid format '${t[b]}'`),e.oldMode=n[1],e.type=r.Modified,b++}function _(e){const n=d.exec(t[b]);g(null!==n,`invalid format '${t[b]}'`),e.newMode=n[1],e.type=r.Modified,b++}function C(e){const n=c.exec(t[b]);g(null!==n,`invalid format '${t[b]}'`),e.newMode=n[1],e.type=r.Removed,b++}function R(e){const n=u.exec(t[b]);g(null!==n,`invalid format '${t[b]}'`),e.newMode=n[1],e.type=r.Added,b++}function O(e){g(s.test(t[b]),`invalid format '${t[b]}'`),g(a.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=r.Copied,b+=2}function P(e){g(o.test(t[b]),`invalid format '${t[b]}'`),g(i.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=r.Renamed,b+=2}function S(e){g(h.test(t[b]),`invalid format '${t[b]}'`),g(m.test(t[b+1]),`invalid format '${t[b+1]}'`),void 0===e.type&&(e.type=r.Modified),b+=2}function A(){const e=t[b++].split(f),r={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===r.oldLines&&(r.oldStart+=1),0===r.newLines&&(r.newStart+=1);let n=0,o=0;for(;b<t.length&&!(0===t[b].indexOf("--- ")&&b+2<t.length&&0===t[b+1].indexOf("+++ ")&&0===t[b+2].indexOf("@@"));b++){const e=0===t[b].length&&b!==t.length-1?" ":t[b][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)break;r.lines.push(t[b]),r.linedelimiters.push(v[b]||"\n"),"+"===e?n++:"-"===e?o++:" "===e&&(n++,o++)}return n||1!==r.newLines||(r.newLines=0),o||1!==r.oldLines||(r.oldLines=0),r}for(;b<t.length;)E();return y}},85249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeFromString=t.deserialize=t.serializeToString=t.serialize=void 0;const r={__rpcType:"undefined"};function n(e){if(void 0===e)return r;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])=>[n(e),n(t)]))};if(e instanceof Set)return{__rpcType:"Set",data:Array.from(e.values()).map(n)};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=>n(e)));if("object"==typeof e){const t={__rpcType:"object"};for(const[r,o]of Object.entries(e))t[r]=n(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,r={};for(const[e,n]of Object.entries(t))"__rpcType"!==e&&(r[e]=o(n));return r}default:throw new Error(`cannot deserialize unknown type ${t}`)}}t.serialize=n,t.serializeToString=function(e){return JSON.stringify(n(e))},t.deserialize=o,t.deserializeFromString=function(e){return o(JSON.parse(e))}},40256:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66224:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},50209:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.SucceedableRevset=t.CommandRunner=void 0,function(e){e.Graphite="gt",e.CodeReviewProvider="codeReviewProvider"}(r||(t.CommandRunner=r={})),t.SucceedableRevset=function(e){return{type:"succeedable-revset",revset:e}}},74259:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},45852:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1018:(e,t)=>{var r;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"}(r||(t.ErrorShortMessages=r={}))},29641:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},86099:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(50209),t),o(r(74259),t),o(r(45852),t),o(r(1018),t),o(r(29641),t),o(r(85119),t)},85119:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},48427:(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,r)=>{e.resolve=t,e.reject=r})),e},t.basename=function(e,t="/"){const r=e.lastIndexOf(t);return-1===r?e:e.slice(r+1)},t.findParentWithClassName=function(e,t){var r;let n=e;for(;n;){if(null===(r=n.classList)||void 0===r?void 0:r.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 r="function"==typeof t?t:e=>e===t;for(const t of e)if(r(t))return!0;return!1},t.zip=function*(e,t){const r=e[Symbol.iterator](),n=t[Symbol.iterator]();for(;;){const e=r.next(),t=n.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(null==e?void 0:e.then)}},44269:(e,t,r)=>{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 n=r(34490),o=r(66703);function i({previousReviewers:e,authorLogin:t,files:r}){return r.filter((r=>!s({pr:{previousReviewers:e,authorLogin:t},file:r})))}function s({pr:e,file:t}){var r,n;return 0===(null!==(n=null===(r=t.codeowners)||void 0===r?void 0:r.owners)&&void 0!==n?n:[]).length||u({file:t,pr:e})||d({authorLogin:e.authorLogin,file:t})}function a(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,n.assertUnreachable)(e)}}function u({file:e,pr:t}){var r,n;const i=new Set(t.previousReviewers.filter(o.isApprover).map((e=>e.username))),s=null!==(n=null===(r=e.codeowners)||void 0===r?void 0:r.owners)&&void 0!==n?n:[];return[...i].some((e=>c({userLogin:e,owners:s})))}function c({userLogin:e,owners:t}){return t.some((t=>l({userLogin:e,owner:t})))}function l({userLogin:e,owner:t}){const r=a(t),o=e.toLowerCase();switch(r.kind){case"USER":return o===r.login;case"TEAM":return r.memberLogins.some((e=>o===e));case"EMAIL":return!1;default:(0,n.assertUnreachable)(r)}}function d({authorLogin:e,file:t}){var r,n;const o=null==e?void 0:e.toLowerCase(),i=(null!==(n=null===(r=t.codeowners)||void 0===r?void 0:r.owners)&&void 0!==n?n:[]).map(a);if(void 0===o||1!==i.length)return!1;const s=i[0];return"USER"===s.kind&&s.login===o||!("TEAM"!==s.kind||1!==s.memberLogins.length||!s.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,n.assertUnreachable)(e)}}t.getFilesMissingCodeownersApproval=i,t.doesFileSatisfyCodeownerRequirement=s,t.convertOwnerToLowerCase=a,t.fileHasCodeownersApproval=u,t.hasCodeownerApprovedPr=function({owner:e,approverLogins:t}){return[...t].some((t=>l({userLogin:t,owner:e})))},t.isUserCodeownerForFile=c,t.authorIsOnlyCodeowner=d,t.getPrMissingCodeowners=function({previousReviewers:e,authorLogin:t,files:r}){const n=i({previousReviewers:e,authorLogin:t,files:r}).flatMap((e=>e.codeowners?e.codeowners.owners:[]));return[...new Map(n.map((e=>[f(e),e]))).values()]},t.mapCodeownerToKey=f,t.doesPrHaveMissingCodeownerReviews=function({previousReviewers:e,authorLogin:t,files:r}){return i({previousReviewers:e,authorLogin:t,files:r}).length>0}},86685:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBranchGraphiteBase=t.generateGraphiteBaseName=void 0;const r="graphite-base";t.generateGraphiteBaseName=e=>`${r}/${e}`,t.isBranchGraphiteBase=e=>Boolean(null==e?void 0:e.startsWith(`${r}/`))},66703:(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)}},95957:(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","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"],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"]},27962:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.doesPrHaveMinimumRequiredApprovals=void 0;const n=r(66703);t.doesPrHaveMinimumRequiredApprovals=function({previousReviewers:e,numRequiredApproversBaseBranchRules:t,numRequiredApproversRestrictions:r}){return e.filter(n.isApprover).length>=Math.max(null!=t?t:1,...r.map((({numRequiredApprovers:e})=>e)))}},63261:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),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 r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveClosedReviewRequests=t.doesPrHaveOpenChangesRequested=t.getPrMetastatus=void 0;const s=r(34490),a=i(r(57569)),u=r(44269),c=r(86685),l=r(66703);t.getPrMetastatus=function e({pr:t,downstackExclusivePrs:r,baseBranchRules:n,ignoreMergeStates:o}){var i,d;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 f=[],h=r[0];if(!o&&t.isInFailureHandling)return{prNumber:t.number,status:"BLOCKED",blockingReasons:[{reason:"FAILURE_HANDLING"}]};(null==n?void 0:n.lockBranch)&&f.push({reason:"BRANCH_LOCKED"}),h&&"MERGED"===h.state&&(t.parentBranch===h.branch||(0,c.isBranchGraphiteBase)(t.parentBranch))&&f.push({reason:"NEEDS_RESTACK__BASE_BRANCH_MERGED"}),t.hasMergeConflicts&&f.push({reason:"MERGE_CONFLICTS"}),"FAILING_REQUIRED"===t.ciRollup.status&&f.push({reason:"FAILING_REQUIRED"});const m=null!==(i=null==n?void 0:n.requiresApprovingReviews)&&void 0!==i?i:null;(null===m||m)&&t.previousReviewers.some((e=>(e.hasWritePermission||null===e.hasWritePermission)&&"CHANGES_REQUESTED"===e.decision))&&f.push({reason:"CHANGES_REQUESTED"}),(null==n?void 0:n.requiresCodeOwnerReviews)&&(0,u.doesPrHaveMissingCodeownerReviews)(t)&&f.push({reason:"NEEDS_CODEOWNER_APPROVALS"});const p=a.computeNeedsRequiredApproverBlockingReason(t);p&&f.push(p);const g=t.previousReviewers.filter(l.isApprover);(null!==(d=null==n?void 0:n.requiredApprovingReviewCount)&&void 0!==d?d:0)>g.length&&(t.hasReviewRequests||f.push({reason:"NEEDS_REVIEWERS"}),f.push({reason:"NEEDS_APPROVALS"}));const v=a.computeNeedsApprovalBlockingReason(t);v&&(f.some((e=>"NEEDS_APPROVALS"===e.reason))||"GT_NEEDS_APPROVALS"!==v.reason||t.hasReviewRequests||f.push({reason:"NEEDS_REVIEWERS"}),f.push(v)),"RUNNING"===t.ciRollup.status&&f.push({reason:"RUNNING"}),(null==n?void 0:n.requiresConversationResolution)&&t.unresolvedThreadCount>0&&f.push({reason:"UNRESOLVED_COMMENTS"});const y=0===r.length?void 0:e({pr:r[0],downstackExclusivePrs:r.slice(1),baseBranchRules:n,ignoreMergeStates:o}),b=function({parentMetastatus:e,hasThirdPartyMergeQueueLabel:t,hasActiveEntryInGithubMergeQueue:r,ciRollupStatus:n}){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||r?"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":"PASSING_WITH_SKIPPED"===n?"READY_TO_MERGE_WITHOUT_CI":"READY_TO_MERGE";case"QUEUED_TO_MERGE":return"READY_TO_MERGE";case"READY_TO_MERGE":case"READY_TO_MERGE_AS_STACK":return"PASSING_WITH_SKIPPED"===n?"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,s.assertUnreachable)(e)}}({parentMetastatus:null==y?void 0:y.status,hasThirdPartyMergeQueueLabel:t.hasThirdPartyMergeQueueLabel,hasActiveEntryInGithubMergeQueue:t.hasActiveEntryInGithubMergeQueue,ciRollupStatus:t.ciRollup.status});if("HARD_WAITING_ON_DOWNSTACK"===b||"WAITING_ON_DOWNSTACK"===b)f.push({reason:b});else if(0===f.length)return{prNumber:t.number,status:b};return Object.assign({prNumber:t.number,status:f.map((({reason:e})=>e)).includes("MERGE_CONFLICTS")||f.map((({reason:e})=>e)).includes("HARD_WAITING_ON_DOWNSTACK")?"HARD_BLOCKED":"BLOCKED",blockingReasons:[f[0],...f.slice(1)]},y?{parentMetastatus:y}:{})},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",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...",UNRESOLVED_COMMENTS:"Unresolved comments",WAITING_ON_DOWNSTACK:"Waiting on downstack",WAITING_TO_MERGE:"Waiting to merge..."}},82528:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GRAPHITE_CHECK_NAMES=t.GRAPHITE_AI_REVIEWER_CHECK_NAME=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="Graphite / ai_reviewer check",t.GRAPHITE_CHECK_NAMES=[t.GRAPHITE_MERGEABILITY_CHECK_NAME,t.GRAPHITE_MERGE_RULE_CHECK_NAME,t.GRAPHITE_AI_REVIEWER_CHECK_NAME,t.GRAPHITE_MERGE_RULE_DEPRECATED_CHECK_NAME]},27716:(e,t,r)=>{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=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 n=r(44269);Object.defineProperty(t,"authorIsOnlyCodeowner",{enumerable:!0,get:function(){return n.authorIsOnlyCodeowner}}),Object.defineProperty(t,"doesFileSatisfyCodeownerRequirement",{enumerable:!0,get:function(){return n.doesFileSatisfyCodeownerRequirement}}),Object.defineProperty(t,"doesPrHaveMissingCodeownerReviews",{enumerable:!0,get:function(){return n.doesPrHaveMissingCodeownerReviews}}),Object.defineProperty(t,"fileHasCodeownersApproval",{enumerable:!0,get:function(){return n.fileHasCodeownersApproval}}),Object.defineProperty(t,"getPrMissingCodeowners",{enumerable:!0,get:function(){return n.getPrMissingCodeowners}}),Object.defineProperty(t,"hasCodeownerApprovedPr",{enumerable:!0,get:function(){return n.hasCodeownerApprovedPr}}),Object.defineProperty(t,"isUserCodeownerForFile",{enumerable:!0,get:function(){return n.isUserCodeownerForFile}});var o=r(86685);Object.defineProperty(t,"generateGraphiteBaseName",{enumerable:!0,get:function(){return o.generateGraphiteBaseName}}),Object.defineProperty(t,"isBranchGraphiteBase",{enumerable:!0,get:function(){return o.isBranchGraphiteBase}});var i=r(66703);Object.defineProperty(t,"isApprover",{enumerable:!0,get:function(){return i.isApprover}});var s=r(95957);Object.defineProperty(t,"MergeStateStatuses",{enumerable:!0,get:function(){return s.MergeStateStatuses}}),Object.defineProperty(t,"PrMetastatuses",{enumerable:!0,get:function(){return s.PrMetastatuses}});var a=r(27962);Object.defineProperty(t,"doesPrHaveMinimumRequiredApprovals",{enumerable:!0,get:function(){return a.doesPrHaveMinimumRequiredApprovals}});var u=r(63261);Object.defineProperty(t,"doesPrHaveClosedReviewRequests",{enumerable:!0,get:function(){return u.doesPrHaveClosedReviewRequests}}),Object.defineProperty(t,"doesPrHaveOpenChangesRequested",{enumerable:!0,get:function(){return u.doesPrHaveOpenChangesRequested}}),Object.defineProperty(t,"doesPrHaveOpenReviewRequests",{enumerable:!0,get:function(){return u.doesPrHaveOpenReviewRequests}}),Object.defineProperty(t,"getHumanReadablePrMetastatus",{enumerable:!0,get:function(){return u.getHumanReadablePrMetastatus}}),Object.defineProperty(t,"getPrMetastatus",{enumerable:!0,get:function(){return u.getPrMetastatus}});var c=r(82528);Object.defineProperty(t,"GRAPHITE_AI_REVIEWER_CHECK_NAME",{enumerable:!0,get:function(){return c.GRAPHITE_AI_REVIEWER_CHECK_NAME}}),Object.defineProperty(t,"GRAPHITE_CHECK_NAMES",{enumerable:!0,get:function(){return c.GRAPHITE_CHECK_NAMES}}),Object.defineProperty(t,"GRAPHITE_MERGE_RULE_CHECK_NAME",{enumerable:!0,get:function(){return c.GRAPHITE_MERGE_RULE_CHECK_NAME}}),Object.defineProperty(t,"GRAPHITE_MERGEABILITY_CHECK_NAME",{enumerable:!0,get:function(){return c.GRAPHITE_MERGEABILITY_CHECK_NAME}});var l=r(57569);Object.defineProperty(t,"computeMergeRulesBlockingReasons",{enumerable:!0,get:function(){return l.computeMergeRulesBlockingReasons}});var d=r(43712);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=r(73306);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=r(23413);Object.defineProperty(t,"createTestMergeRestriction",{enumerable:!0,get:function(){return h.createTestMergeRestriction}})},57569:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.computeNeedsRequiredApproverBlockingReason=t.computePendingRequiredBlockingReason=t.computeFailingRequiredBlockingReason=t.computeNeedsApprovalBlockingReason=t.computeMergeRulesBlockingReasons=void 0;const n=r(34490),o=r(66703),i=r(73306);function s(e){const{previousReviewers:t,mergeRestrictions:r}=e,n=t.filter(o.isApprover);return r.filter((e=>"NUM_REQUIRED_APPROVERS"===e.payload.kind)).filter((e=>e.payload.numRequiredApprovers>n.length)).length>0?{reason:"GT_NEEDS_APPROVALS"}:null}function a(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 u(e){var t;const r=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"PENDING"===e.status.status));return r.length>0?{reason:"GT_PENDING_REQUIRED",blockingMergeRestrictions:r.map((({restriction:e})=>e))}:null}function c(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[s(e),a(e),u(e),c(e)].filter(n.filterNull)},t.computeNeedsApprovalBlockingReason=s,t.computeFailingRequiredBlockingReason=a,t.computePendingRequiredBlockingReason=u,t.computeNeedsRequiredApproverBlockingReason=c},43712:(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}},73306:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isRequiredApproversRestrictionSatisfied=t.hasFileBeenApprovedByRequiredApprovers=t.doesFileSatisfyRequiredApprovers=t.isUserRequiredApproverForFile=t.prAuthorIsRequiredApproverForFile=t.isUserRequiredApprover=t.isApprovedByRequiredApprover=void 0;const n=r(34490),o=r(66703);function i({requiredApprover:e,approvers:t}){const r=t.map((({username:e})=>e));switch(e.kind){case"USER":return r.includes(e.login);case"TEAM":return e.memberLogins.some((e=>r.includes(e)));default:(0,n.assertUnreachable)(e)}}function s({userLogin:e,payload:t}){return t.requiredApprovers.flatMap((e=>"TEAM"===e.kind?e.memberLogins:[e.login])).includes(e)}function a({authorLogin:e,file:t}){return!(!e||!u({userLogin:e,file:t}))}function u({userLogin:e,file:t}){return t.requiredApproversMergeRestrictions.some((({payload:t})=>s({userLogin:e,payload:t})))}function c({file:e,pr:t}){const{requiredApproversMergeRestrictions:r}=e,{previousReviewers:n}=t;return r.some((({payload:e})=>l({previousReviewers:n,payload:e})))}function l({previousReviewers:e,payload:t}){const r=e.filter(o.isApprover),n=t.requiredApprovers;return 0===n.length||n.some((e=>i({requiredApprover:e,approvers:r})))}t.isApprovedByRequiredApprover=i,t.isUserRequiredApprover=s,t.prAuthorIsRequiredApproverForFile=a,t.isUserRequiredApproverForFile=u,t.doesFileSatisfyRequiredApprovers=function({file:e,pr:t}){const{requiredApproversMergeRestrictions:r}=e,{authorLogin:n}=t;return 0===r.length||a({authorLogin:n,file:e})||c({file:e,pr:t})},t.hasFileBeenApprovedByRequiredApprovers=c,t.isRequiredApproversRestrictionSatisfied=l},23413:(e,t)=>{function r({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:r=null,isBot:n=!1}){return{username:e,decision:t,hasWritePermission:r,isBot:n}},t.createTestFile=function({filename:e="filename",codeowners:t=null,requiredApproversMergeRestrictions:r=[]}){return{filename:e,codeowners:t,requiredApproversMergeRestrictions:r}},t.createTestMergeRestriction=function({id:e="1",mergeRuleId:t="1",payload:r={kind:"NUM_REQUIRED_APPROVERS",numRequiredApprovers:1}}){return{id:e,mergeRuleId:t,payload:r}},t.createTestCiRollup=r,t.createTestPr=function({number:e=1,state:t="OPEN",isDraft:n=!1,authorLogin:o="authorLogin",hasReviewRequests:i=!0,previousReviewers:s=[],hasMergeConflicts:a=!1,isQueuedToMerge:u=!1,isInFailureHandling:c=!1,isWaitingToMerge:l=!1,isRebasing:d=!1,ciRollup:f=r({}),skipRequiredCi:h=!1,branch:m="branch",parentBranch:p=null,unresolvedThreadCount:g=0,files:v=[],mergeRestrictions:y=[],lastPushedAt:b=new Date,lastBaseRefChangedAt:E=new Date}){return{number:e,state:t,isDraft:n,authorLogin:o,hasReviewRequests:i,previousReviewers:s,hasMergeConflicts:a,isQueuedToMerge:u,isInFailureHandling:c,isWaitingToMerge:l,isRebasing:d,hasThirdPartyMergeQueueLabel:!1,hasActiveEntryInGithubMergeQueue:!1,ciRollup:f,skipRequiredCi:h,branch:m,parentBranch:p,unresolvedThreadCount:g,files:v,mergeRestrictions:y,lastPushedAt:b,lastBaseRefChangedAt:E}}},8296:(e,t)=>{function r(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 r(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,r)=>n(e,t,r)},t._shapeWithExplicitOptionals=function(e){return(t,r)=>n(e,t,r)};const n=(e,t,r)=>"object"==typeof t&&null!==t&&Object.keys(e).every((n=>{const o=e[n]&&e[n](t[n],r);return!o&&(null==r?void 0:r.logFailures)&&console.log(`Member of shape ${JSON.stringify(t[n])} for ${n} does not match expected type`),o}));function o(e,t){return(r,n)=>{const o=e(r,n)||t(r,n);return!o&&(null==n?void 0:n.logFailures)&&console.log(`Member of union "${JSON.stringify(r)}" does not match expected type`),o}}function i(e){return(t,r)=>{const n=e.some((e=>e(t,r)));return!n&&(null==r?void 0:r.logFailures)&&console.log(`Member of union-many ${JSON.stringify(t)} does not expected type`),n}}t.taggedUnion=function(e,t){return(r,n)=>{if("object"!=typeof r||null===r||!(e in r))return(null==n?void 0:n.logFailures)&&console.log("Tagged union is not an object or missing tag"),!1;const o=t[r[e]];return!!o&&Object.keys(o).every((e=>{const t=o[e]&&o[e](r[e],n);return!t&&(null==n?void 0:n.logFailures)&&console.log(`Member of shape ${JSON.stringify(r[e])} for ${e} does not match expected type`),t}))}},t.array=function(e){return(t,r)=>Array.isArray(t)&&t.every((t=>{const n=e(t,r);return!n&&(null==r?void 0:r.logFailures)&&console.log(`Member of array "${JSON.stringify(t)}" does not match expected type`),n}))},t.tuple=function(e){return(t,r)=>Array.isArray(t)&&t.length===e.length&&t.every(((t,n)=>{const o=e[n](t,r);return!o&&(null==r?void 0:r.logFailures)&&console.log(`Member of tuple "${JSON.stringify(t)}" does not match expected type`),o}))},t.union=o,t.intersection=function(e,t){return(r,n)=>{const o=e(r,n)&&t(r,n);return!o&&(null==n?void 0:n.logFailures)&&console.log(`Member of intersection "${JSON.stringify(r)}" does not match expected type`),o}},t.unionMany=i,t.intersectMany=function(e){return(t,r)=>{const n=e.every((e=>e(t,r)));return!n&&(null==r?void 0:r.logFailures)&&console.log(`Member of intersection-many ${JSON.stringify(t)} does not expected type`),n}},t.literals=function(e){return i(e.map((e=>r(e))))},t.optional=function(e){return o(e,t.undefinedtype)},t.nullable=function(e){return o(e,t.nulltype)}},53977:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),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 r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.request=void 0,t.request=i(r(74911))},74911:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),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 r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.requestWithArgs=t.formatReqDetails=void 0,r(87686);const s=i(r(16627));function a({apiServer:e,route:t,params:r,queryParams:n,urlParams:o,headers:i,opts:a}){let u=e+(o?s.compile(t.url)(o):t.url),c=null;if("GET"===t.method){if(n){const e=function(e,t){const r=[],n=Object.keys(e);t&&n.sort();for(const t of n){const n=e[t];void 0!==n&&r.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}return r.join("&")}(n,null==a?void 0:a.sortQueryParams);""!==e&&(u+="?"+e)}}else c=t.rawBody?r:JSON.stringify(r);return{url:u,verb:t.method,headers:Object.assign(Object.assign({},i),{"Content-Type":"text/plain"}),body:c}}t.formatReqDetails=a,t.requestWithArgs=function({apiServer:e,route:t,params:r,queryParams:n,urlParams:o,headers:i}){return function({url:e,verb:t,headers:r,body:n}){return fetch(e,Object.assign({method:t,mode:"cors",credentials:"include",headers:r},n?{body:n}:{}))}(a({apiServer:e,route:t,params:r,queryParams:n,urlParams:o,headers:i})).then((e=>t.response&&200===e.status?e.json().then((t=>Object.assign(Object.assign({},t),{_response:e}))):{_response:e}))}},93034:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bindWithEmptyObject=t.bind=void 0,t.bind=function(e,t){return r=>e(Object.assign(Object.assign({},t),r))},t.bindWithEmptyObject=function(e){return()=>e({})}},26511:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateWithoutTime=t.dateWithoutTimeOrThrow=void 0;const n=r(19577);function o(e){return"string"==typeof e?function(e){return n.DateTime.fromISO(e).toISODate()}(e):e instanceof Date?function(e){return n.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},42392:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dedup=void 0,t.dedup=function(e,t){const r=new Set,n=[];return e.forEach((e=>{const o=t(e);r.has(o)||(n.push(e),r.add(o))})),n}},64761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setDifference=void 0,t.setDifference=function({a:e,b:t,itemIdentity:r}){const n=new Set;return t.forEach((e=>n.add(r(e)))),e.filter((e=>!n.has(r(e))))}},7846:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyObject=void 0,t.isEmptyObject=function(e){return 0===Object.keys(e).length}},73594:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndexOrFail=void 0,t.findIndexOrFail=({array:e,value:t,errorFn:r})=>{const n=e.indexOf(t);if(-1===n)throw r();return n}},10199:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertGlobToRegex=void 0;const r="@@ENTIRE_STRING_IS_GLOBSTAR@@",n="@@GLOBSTAR_AT_END@@",o="@@GLOBSTAR_FOLLOWED_BY_FORWARD_SLASH@@",i="@@STAR@@",s="@@DOT@@";t.convertGlobToRegex=function(e){return[e=>"**"===e?r:e,e=>e.replace(/\*\*$/,n),e=>e.replaceAll("**/",o),e=>e.replaceAll("*",i),e=>e.replaceAll(".",s),e=>e.replaceAll(r,".*"),e=>e.replaceAll(n,".*"),e=>e.replaceAll(o,"([^/]*/)*"),e=>e.replaceAll(i,"[^/]*"),e=>e.replaceAll(s,"\\."),e=>`^${e}`,e=>`${e}$`].reduce(((e,t)=>t(e)),e)}},10458:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithHeartbeat=void 0;const o=r(24938);t.runWithHeartbeat=function(e){return n(this,arguments,void 0,(function*({fn:e,heartbeat:t,heartbeatInterval:r,waitForHeartbeatOnExit:i}){let s=!1,a=!1,u=0;if(yield Promise.race([e(),(()=>n(this,void 0,void 0,(function*(){for(;!s;)yield t(),u++,yield(0,o.sleep)(r);a=!0})))()]),s=!0,i)for(;!a;)yield(0,o.sleep)({milliseconds:5});return{heartbeatCnt:u}}))}},34490:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};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.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(r(23760),t);var i=r(93034);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return i.bind}}),Object.defineProperty(t,"bindWithEmptyObject",{enumerable:!0,get:function(){return i.bindWithEmptyObject}});var s=r(26511);Object.defineProperty(t,"dateWithoutTime",{enumerable:!0,get:function(){return s.dateWithoutTime}}),Object.defineProperty(t,"dateWithoutTimeOrThrow",{enumerable:!0,get:function(){return s.dateWithoutTimeOrThrow}});var a=r(42392);Object.defineProperty(t,"dedup",{enumerable:!0,get:function(){return a.dedup}});var u=r(64761);Object.defineProperty(t,"setDifference",{enumerable:!0,get:function(){return u.setDifference}});var c=r(7846);Object.defineProperty(t,"isEmptyObject",{enumerable:!0,get:function(){return c.isEmptyObject}});var l=r(73594);Object.defineProperty(t,"findIndexOrFail",{enumerable:!0,get:function(){return l.findIndexOrFail}});var d=r(10199);Object.defineProperty(t,"convertGlobToRegex",{enumerable:!0,get:function(){return d.convertGlobToRegex}});var f=r(10458);Object.defineProperty(t,"runWithHeartbeat",{enumerable:!0,get:function(){return f.runWithHeartbeat}});var h=r(3475);Object.defineProperty(t,"createLookupTable",{enumerable:!0,get:function(){return h.createLookupTable}});var m=r(86894);Object.defineProperty(t,"median",{enumerable:!0,get:function(){return m.median}});var p=r(59340);Object.defineProperty(t,"flatMapNonEmptyArray",{enumerable:!0,get:function(){return p.flatMapNonEmptyArray}}),Object.defineProperty(t,"flatNonEmptyArrayOfNonEmptyArrays",{enumerable:!0,get:function(){return p.flatNonEmptyArrayOfNonEmptyArrays}}),Object.defineProperty(t,"isNonEmptyArray",{enumerable:!0,get:function(){return p.isNonEmptyArray}}),Object.defineProperty(t,"isNonEmptyArrayOfNonEmptyArrays",{enumerable:!0,get:function(){return p.isNonEmptyArrayOfNonEmptyArrays}}),Object.defineProperty(t,"mapNonEmptyArray",{enumerable:!0,get:function(){return p.mapNonEmptyArray}});var g=r(22154);Object.defineProperty(t,"parseIntOrNull",{enumerable:!0,get:function(){return g.parseIntOrNull}});var v=r(72554);Object.defineProperty(t,"percentDifference",{enumerable:!0,get:function(){return v.percentDifference}});var y=r(66066);Object.defineProperty(t,"retryWithSleep",{enumerable:!0,get:function(){return y.retryWithSleep}});var b=r(66496);Object.defineProperty(t,"semaphore",{enumerable:!0,get:function(){return b.semaphore}});var E=r(24938);Object.defineProperty(t,"sleep",{enumerable:!0,get:function(){return E.sleep}}),Object.defineProperty(t,"waitFor",{enumerable:!0,get:function(){return E.waitFor}});var w=r(50401);Object.defineProperty(t,"commaSeparatedList",{enumerable:!0,get:function(){return w.commaSeparatedList}}),Object.defineProperty(t,"convertStringToNumberOrNull",{enumerable:!0,get:function(){return w.convertStringToNumberOrNull}}),Object.defineProperty(t,"humanizeDate",{enumerable:!0,get:function(){return w.humanizeDate}}),Object.defineProperty(t,"humanizeDuration",{enumerable:!0,get:function(){return w.humanizeDuration}}),Object.defineProperty(t,"nth",{enumerable:!0,get:function(){return w.nth}}),Object.defineProperty(t,"numberWithCommas",{enumerable:!0,get:function(){return w.numberWithCommas}}),Object.defineProperty(t,"plural",{enumerable:!0,get:function(){return w.plural}});var _=r(69976);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return _.TimeoutError}}),Object.defineProperty(t,"timeoutPromise",{enumerable:!0,get:function(){return _.timeoutPromise}});var C=r(19986);Object.defineProperty(t,"diffUntilNow",{enumerable:!0,get:function(){return C.diffUntilNow}})},3475:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLookupTable=void 0,t.createLookupTable=function({items:e,getKey:t,serializeKey:r}){const n={};return e.forEach((e=>{n[r(t(e))]=e})),e=>n[r(e)]}},86894:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.median=void 0;const n=r(23760);t.median=function(e){const t=e.filter(n.filterNullUndefined).sort(((e,t)=>e-t));if(0===t.length)return;const r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}},59340:(e,t)=>{function r(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=r,t.isNonEmptyArrayOfNonEmptyArrays=e=>e.every(r)&&r(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()}},22154:(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}},72554:(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)}},66066:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.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=void 0;const i=o(r(62637)),s=r(24938);t.retryWithSleep=e=>n(void 0,[e],void 0,(function*({fn:e,onRetry:t,options:r}){for(const n of i.default.range(r.maxRetries))try{return yield e()}catch(e){if(n+1>=r.maxRetries)throw e;null==t||t({retryCount:n,err:e}),yield(0,s.sleep)(r.sleepDuration)}throw new Error("Unreachable")}))},66496:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.semaphore=void 0,t.semaphore=function(e,t){let r;const n=new Promise((e=>{r=e})),o=[...t];let i=0;return function t(){const n=o.shift();void 0!==n?(i++,n().catch(console.error).finally((()=>{i--,t()})),i<e&&t()):0===i&&r(void 0)}(),n}},24938:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function n(e){return r(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=n,t.waitFor=e=>r(void 0,[e],void 0,(function*({condition:e,sleepDuration:t,timeout:r,label:i}){const s=o(t),a=o(null!=r?r:{minutes:1});for(const t=Date.now();Date.now()-t<a;){if(yield e())return;yield n({milliseconds:s})}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},50401:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nth=t.numberWithCommas=t.commaSeparatedList=t.humanizeDuration=t.convertStringToNumberOrNull=t.humanizeDate=t.plural=void 0;const n=r(19577);t.plural=(e,t,r)=>{const n=(null==r?void 0:r.pluralSuffix)||"s";return`${(null==r?void 0:r.prependAIfSingular)&&1===t?"a ":""}${e}${1!==t?n:""}`},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 r=n.Duration.fromObject({seconds:e}).rescale(),o=[];return r.years>0&&o.push(`${r.years}y`),r.months>0&&o.push(`${r.months}mo`),r.days>0&&o.push(`${7*r.weeks+r.days}d`),r.hours>0&&o.push(`${r.hours}h`),r.minutes>0&&o.push(`${r.minutes}m`),t&&0===o.length&&o.push(`${r.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`},69976:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=void 0;class r extends Error{}t.TimeoutError=r,t.timeoutPromise=({promise:e,timeoutMs:t})=>Promise.race([e,new Promise((e=>setTimeout(e,t))).then((()=>{throw new r(`Timeout after ${t}ms`)}))])},19986:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.diffUntilNow=void 0;const n=r(19577);t.diffUntilNow=({startTime:e})=>n.DateTime.now().diff(e)},23760:(e,t)=>{function r(e){return null!==e}function n(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 r of e)if(!t.has(r))return!1;return!0},t.filterNull=r,t.filterUndefined=n,t.filterNullUndefined=function(e){return r(e)&&n(e)}},66607:(e,t,r)=>{r.r(t),r.d(t,{extractTokenCwdAndPlatformFromUrlForTests:()=>ne,startServer:()=>re,validateTokenForTests:()=>oe});var n=r(79115),o=r(98696),i=r(57147),s=r.n(i),a=r(13685),u=r.n(a),c=r(71017),l=r.n(c),d=r(57310),f=r.n(d),h=r(95352),m=r.n(h);r(34490);var p=r(32081),g=r(22037),v=r.n(g);const y="win32"===process.platform?l().join((0,o.unwrap)(process.env.LOCALAPPDATA),"cache"):"darwin"===process.platform?l().join(v().homedir(),"Library/Caches"):process.env.XDG_CACHE_HOME||l().join(v().homedir(),".cache");l().join(y,"graphite-gti");var b=r(6113);function E(){try{return v().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 w{logger;data;constructor(e,t){this.logger=e,this.data=t}setRepo(e){this.data.repo=e?.codeReviewProvider?.getSummaryName()}}const _=e=>{};var C=r(95808),R=r(43597);const O=n.sendAnalyticsEvent;const P=async({userConfig:e})=>{const t=e.getGtiConfigValue("gti.install-uuid");if(t)return t;const r=(0,R.Z)();return await e.setGtiConfigValue("gti.install-uuid",r),r};var S=r(73837),A=r.n(S);const T=console;var M=r(59778),N=r.n(M),D=r(34987),I=r.n(D);function k(e,t,r,n){let o=[...t];"win32"!==process.platform&&(o=o.map((e=>e.replace(/\\\\/g,"\\"))));const i={...n,env:{LANG:"en_US.utf-8",EDITOR:void 0,GRAPHITE_INTERACTIVE:"true",GIT_OPTIONAL_LOCKS:"0"},cwd:r};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 j({command:e,args:t,logger:r,cwd:n,options:o}){const{command:i,args:s,options:a}=k(e,t,n,o);return r&&r.log("run command: ",i,...s,a),I()(i,s,a)}const G="1.0.14";var F=r(82361);class x extends F.EventEmitter{}class H{codeReviewSystem;runCommand;constructor(e,t){this.codeReviewSystem=e,this.runCommand=t}diffSummaries=new x;onChangeDiffSummaries(e){const t=t=>e({value:t}),r=t=>e({error:t});return this.diffSummaries.on("data",t),this.diffSummaries.on("error",r),{dispose:()=>{this.diffSummaries.off("data",t),this.diffSummaries.off("error",r)}}}async triggerDiffSummariesFetch(e){const t=await this.runCommand(["internal-only","prs"]),r=JSON.parse(t.stdout);this.diffSummaries.emit("data",r)}dispose(){this.diffSummaries.removeAllListeners()}getSummaryName(){return`github:${this.codeReviewSystem.hostname}/${this.codeReviewSystem.owner}/${this.codeReviewSystem.repo}`}runExternalCommand(e,t,r,n){throw new Error("GitHub code review provider does not support running external commands")}async typeahead(e,t){return Promise.resolve([])}}class B{logger;runCallback;constructor(e,t){this.logger=e,this.runCallback=t}queuedOperations=[];runningOperation=void 0;abortController=void 0;async runOrQueueOperation(e,t,r,n){if(null!=this.runningOperation)return this.queuedOperations.push({...e,tracker:r}),void t({id:e.id,kind:"queue",queue:this.queuedOperations.map((e=>e.id))});this.runningOperation=e;const o=(...r)=>{switch(r[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:r[1]});break;case"stderr":t({id:e.id,kind:"stderr",message:r[1]});break;case"exit":t({id:e.id,kind:"exit",exitCode:r[1],timestamp:Date.now()})}};try{const i=new AbortController;if(this.abortController=i,await r.operation(e.trackEventName,"RunOperationError",{extras:{args:e.args,runner:e.runner}},(t=>this.runCallback(e,n,o,i.signal))),this.runningOperation=void 0,this.queuedOperations.length>0){const e=this.queuedOperations.shift();null!=e&&this.runOrQueueOperation(e,t,e.tracker,n)}}catch(r){const n=r.toString();this.logger.log("error running operation: ",e.args[0],n),t({id:e.id,kind:"error",error:n}),this.queuedOperations=[],this.runningOperation=void 0}}abortRunningOperation(e){this.runningOperation?.id===e&&this.abortController?.abort()}}class U{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 L{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",(r=>{r===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 q(e){let t,r;const n=()=>{const t=e();return r=t.then((()=>r=void 0),(()=>r=void 0)),t},o=()=>(t=void 0,n());return()=>null==r?n():(()=>{if(null==t){if(null==r)throw new Error("pendingCall must not be null!");t=r.then(o,o)}return t})()}function $(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 W{info;platform;logger;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 U;codeReviewProvider;currentVisibleCommitRangeIndex=0;visibleCommitRanges=[o.DEFAULT_DAYS_OF_COMMITS_TO_LOAD,60,void 0];constructor(e,t,r){this.info=e,this.platform=t,this.logger=r;const n=e.codeReviewSystem;"github"===n.type&&(this.codeReviewProvider=new H(n,this.runCommand.bind(this))),this.watchForChangesDisposer=t.watchForChanges(e,r,(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.logger,((e,t,r,n)=>{if(e.runner===o.CommandRunner.Graphite)return this.runOperation(e,r,t,n);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,r,n)??Promise.resolve()}return Promise.resolve()}));const i=new Set,s=this.subscribeToSmartlogCommitsChanges((e=>{if(e.commits.value){const t=[],r=e.commits.value.filter((e=>e.pr)).map((e=>e.pr?.number));for(const e of r)i.has(e)||(t.push(e),i.add(e));t.length>0&&this.codeReviewProvider?.triggerDiffSummariesFetch(this.getAllDiffIds())}}));this.checkForMergeConflicts(),this.disposables.push((()=>s.dispose()))}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)(q((async()=>{this.logger.info("checking for merge conflicts");const e=null!=this.mergeConflicts;if(!e&&!await(t=l().join(this.info.dotdir,"rebase-merge"),s().promises.stat(t).then((()=>!0)).catch((e=>{if("ENOENT"===e.code)return!1;throw e}))))return void this.logger.info(`conflict state still the same (${e?"IN merge conflict":"NOT in conflict"})`);var t;null==this.mergeConflicts&&(this.mergeConflicts={state:"loading"},this.mergeConflictsEmitter.emit("change",this.mergeConflicts));const r=Date.now();let n;try{const e=await this.runCommand(["internal-only","status"]);n=JSON.parse(e.stdout)}catch(e){return this.logger.error(`failed to check for merge conflicts: ${e}`),this.mergeConflicts=void 0,void this.mergeConflictsEmitter.emit("change",this.mergeConflicts)}const o=await s().promises.readFile(l().join(this.info.dotdir,"rebase-merge","head-name")).then((e=>{const t=e.toString();return t.startsWith("refs/heads/")?t.slice(11).trimEnd():void 0}),(()=>{}));if(this.mergeConflicts=function(e,t,r,n){const o=r;if(!o?.conflicts||!t)return;const i=o.files.filter((e=>"UNRESOLVED"===e.status)),s={state:"loaded",branchName:t,files:[],fetchStartTimestamp:n,fetchCompletedTimestamp:Date.now()};if(null!=e?.files&&e.files.length>0){const t=new Set(i.map((e=>e.path)));s.files=e.files.map((e=>t.has(e.path)?{path:e.path,status:"UNRESOLVED"}:{path:e.path,status:"RESOLVED"}))}else s.files=i.map((e=>({path:e.path,status:"UNRESOLVED"})));return s}(this.mergeConflicts,o,n,r),this.logger.info(`repo ${this.mergeConflicts?"IS":"IS NOT"} in merge conflicts`,{mergeConflicts:this.mergeConflicts,files:this.mergeConflicts?.files}),this.mergeConflicts){const e=20,t=(this.mergeConflicts.files??[]).filter((e=>"UNRESOLVED"===e.status)).map((e=>e.path)).slice(0,e);this.logger.info("remaining files with conflicts: ",{branchName:o,remainingConflicts:t})}this.mergeConflictsEmitter.emit("change",this.mergeConflicts)})),100);getMergeConflicts(){return this.mergeConflicts}async runOrQueueOperation(e,t,r,n){await this.operationQueue.runOrQueueOperation(e,t,r,n)}abortRunningOperation(e){this.operationQueue.abortRunningOperation(e)}normalizeOperationArgs(e,t){const r=(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(r,t.path)));case"succeedable-revset":return`max(successors(${t.revset}))`}return t}))}async runOperation(e,t,r,n){const o=this.normalizeOperationArgs(r,e.args),{stdin:i}=e,{command:s,args:a,options:u}=k(this.info.command,o,r,i?{input:i}:void 0);this.logger.log("run operation: ",s,o.join(" "));const c=I()(s,a,{...u,stdout:"pipe",stderr:"pipe"});t("spawn"),c.stdout?.on("data",(e=>{t("stdout",e.toString())})),c.stderr?.on("data",(e=>{t("stderr",e.toString())})),c.on("exit",(e=>{t("exit",e||0)})),n.addEventListener("abort",(()=>{this.logger.log("kill operation: ",s,o.join(" "))})),function(e,t){t.addEventListener("abort",(()=>{"win32"===v().platform()?e.kill("SIGKILL",{forceKillAfterTimeout:!1}):(e.kill("SIGCONT"),e.kill("SIGTERM",{forceKillAfterTimeout:5e3}))}))}(c,n),await c}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)(q((async()=>{const e=Date.now();try{this.uncommittedChangesBeginFetchingEmitter.emit("start");const t=await this.runCommand(["internal-only","status"]),r=JSON.parse(t.stdout).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:r}},this.uncommittedChangesEmitter.emit("change",this.uncommittedChanges)}catch(r){if(this.logger.error("Error fetching files: ",r),null!=(t=r)&&"object"==typeof t&&"stderr"in t&&r.stderr.includes("checkout is currently in progress"))return void this.logger.info("Ignoring `hg status` error caused by in-progress checkout");this.uncommittedChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{error:r instanceof Error?r:new Error(r)}})}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)(q((async()=>{const e=Date.now();try{this.smartlogCommitsBeginFetchingEmitter.emit("start");const t=await this.runCommand(["internal-only","log"]),r=function(e,t){let r=[];try{r=JSON.parse(t)}catch(t){e.error("failed to parse branch info",t)}return r}(this.logger,t.stdout.trim());if(0===r.length)throw new Error(o.ErrorShortMessages.NoCommitsFetched);this.smartlogCommits={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{value:r}},this.smartlogCommitsChangesEmitter.emit("change",this.smartlogCommits)}catch(t){this.logger.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 r=r=>{const n=r?.commits.value?.find((e=>e.isHead));null!=n&&n.branch!==t?.branch&&(e(n),t=n)};return this.smartlogCommitsChangesEmitter.on("change",r),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",r)}}}catLimiter=new L(4,(e=>this.logger.info("[cat]",e)));relativeCat(e,t){const r=l().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((async()=>(await this.runCommand(["internal-only","relative-cat",...this.catArgs(t,r)],void 0,{stripFinalNewline:!1})).stdout))}cat(e,t){const r=l().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((async()=>(await this.runCommand(["internal-only","cat",t,r],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,r){return j({command:this.info.command,args:e,logger:this.logger,cwd:(0,o.unwrap)(t??this.info.repoRoot),options:r})}}var V=r(73292),K=r(9826),Q=r.n(K);class z{promise;disposeFunc;constructor(e,t){this.promise=e,this.disposeFunc=t}unref(){this.disposed||(this.disposed=!0,this.disposeFunc())}internalReference;disposed=!1}class J{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 Y=new class{reposByRoot=new Map;activeReposEmitter=new x;getOrCreate({cmd:e,platform:t,logger:r,cwd:o}){const i=this.lookup(o);if(i)return i.ref(),new z(Promise.resolve(i.value),(()=>i.dispose()));let s;return s=new z((async()=>{const i=await(0,n.composeUserConfigFactory)().load(),a=await(async({command:e,logger:t,cwd:r,userConfig:n})=>{const o=await async function({command:e,logger:t,cwd:r}){try{return(await j({command:e,args:["--version"],logger:t,cwd:r})).stdout}catch(e){throw t.error(`Failed to find gt version in ${r}`,e),e}}({command:e,logger:t,cwd:r}).catch((e=>e));if(o instanceof Error)return{type:"invalidCommand",command:e??"gt"};if(!o.startsWith("local")&&!o.startsWith("dev")&&N().lt(o,G))return{type:"invalidVersion",command:e??"gt",versionFound:o,versionRequired:G};const i=function({userConfig:e,logger:t}){try{return{appUrl:e.getAppServerUrl()}}catch(e){return t.error("Failed to find repository profile",e),{appUrl:"https://app.graphite.dev/"}}}({userConfig:n,logger:t}),s=await async function({command:e,logger:t,cwd:r}){try{return JSON.parse((await j({command:e,args:["internal-only","repo-info"],logger:t,cwd:r})).stdout)}catch(e){return void t.error(`Failed to find repository info in ${r}`,e)}}({command:e,logger:t,cwd:r});if(null==s)return{type:"cwdNotARepository",cwd:r};let a;if(void 0===s.remote)a={type:"none"};else{const{owner:e,name:t,hostname:r}=s.remote;a={type:"github",owner:e,repo:t,hostname:r}}const u={type:"success",command:e,dotdir:s.dotDir,repoRoot:s.rootDir,codeReviewSystem:a,profile:i,trunkBranch:s.trunkBranch};return t.info("repo info: ",u),u})({command:e,logger:r,cwd:o,userConfig:i});if(r.info("repoInfo",a),"success"!==a.type)return a;if(s.disposed)return{type:"unknownError",error:new Error("Repository already disposed")};const u=this.lookup(a.repoRoot);if(u)return u.ref(),s.internalReference=u,u.value;const c=new W(a,t,r),l=new J(c);return l.ref(),s.internalReference=l,this.reposByRoot.set(a.repoRoot,l),this.activeReposEmitter.emit("change"),c})(),(()=>{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 r of this.reposByRoot.values())if((e===r.value.info.repoRoot||e.startsWith((t=r.value.info.repoRoot).endsWith(l().sep)?t:t+l().sep))&&!r.isDisposed)return r;var t}};class X{context;listenersByType=new Map;incomingListener;repoDisposables=[];subscriptions=new Map;activeRepoRef;queuedMessages=[];currentState={type:"loading"};pageId=(0,o.randomId)();platform;connection;tracker;logger;constructor(e){this.context=e,this.platform=e.platform,this.connection=e.connection,this.tracker=e.tracker,this.logger=e.logger;let t=null;this.incomingListener=this.connection.onDidReceiveMessage(((r,n)=>{if(n)return null==t?void e.connection.logger?.error("Error: got a binary message when not expecting one"):(this.handleIncomingMessageWithPayload(t,r),void(t=null));if(null!=t)return e.connection.logger?.error("Error: didnt get binary payload after a message that requires one"),void(t=null);const i=r.toString("utf-8"),s=(0,o.deserializeFromString)(i);if(function(e){return null!=e&&"object"==typeof e&&!0===e.hasBinaryPayload}(s))t=s;else if("loading"===this.currentState.type)this.queuedMessages.push(s);else try{this.handleIncomingMessage(s)}catch(t){e.connection.logger?.error("error handling incoming message: ",s,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 r=e.getSmartlogCommits(),n=function(e,t){let r;if(null!=e){const n=new Map(e.map((e=>[e.branch,e])));let o=t;for(;null!=o;){if(o.partOfTrunk){r=o;break}if(null==o.parents[0])break;o=n.get(o.parents[0])}}return r}(r?.commits.value,t);this.tracker.track("HeadCommitChanged",{extras:{hash:t.branch,public:n?.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.logger.info(`Setting active repo cwd to ${e}`),this.currentState={type:"loading"};const t=this.connection.command;this.activeRepoRef=Y.getOrCreate({cmd:t,platform:this.platform,logger:this.logger,cwd:e}),this.activeRepoRef.promise.then((t=>{t instanceof W?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.logger?.error("error handling queued message: ",e,t)}this.queuedMessages=[]}handleIncomingMessageWithPayload(e,t){switch(e.type){case"uploadFile":{const{id:r,filename:n}=e,i=null;if(null==i)return;this.tracker.operation("UploadImage","UploadImageError",{},(()=>i((0,o.unwrap)(this.connection.logger),{filename:n,data:t}))).then((e=>{this.connection.logger?.info("sucessfully uploaded file",n,e),this.postMessage({type:"uploadFileResult",id:r,result:{value:e}})})).catch((e=>{this.connection.logger?.info("error uploading file",n,e),this.postMessage({type:"uploadFileResult",id:r,result:{error:e}})}));break}}}handleIncomingMessage(e){this.handleIncomingGeneralMessage(e);const{currentState:t}=this;switch(t.type){case"repo":{const{repo:r,cwd:n}=t;this.handleIncomingMessageWithRepo(e,r,n);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.logger.info("GeneralMessage",e),e.type){case"installCli":("brew"===e.method?I()("brew",["install","withgraphite/tap/graphite"]):I()("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":Q()("gt").then((async e=>{const t=await(0,V.realpath)(e),r="lib/node_modules/@withgraphite/graphite-cli/graphite.js";if(t.endsWith(r)){const e=t.replace(r,"bin/npm");return I()(e,["install","-g","@withgraphite/graphite-cli@stable"])}if(t.endsWith("/bin/gt")&&t.includes("Cellar"))return await I()("brew",["update"]),I()("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":j({command:this.connection.command||"gt",args:["internal-only","all-branches"],cwd:this.connection.cwd}).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(this.logger?.error("error fetching auth status",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedAllBranches",message:e.value})}));break;case"initializeRepository":this.logger.info("init"),j({command:this.connection.command||"gt",args:["init","--trunk",e.trunkBranch],cwd:this.connection.cwd}).then((e=>{this.logger.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,r){const{logger:n}=t;switch(e.type){case"subscribe":{const{subscriptionID:r,kind:n}=e;switch(n){case"uncommittedChanges":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"uncommittedChanges",subscriptionID:r,data:e})},n=t.getUncommittedChanges();null!=n&&e(n);const o=[];o.push(t.subscribeToUncommittedChanges(e)),t.fetchUncommittedChanges(),o.push(t.subscribeToUncommittedChangesBeginFetching((()=>this.postMessage({type:"beganFetchingUncommittedChangesEvent"})))),this.subscriptions.set(r,{dispose:()=>{o.forEach((e=>e.dispose()))}});break}case"smartlogCommits":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"smartlogCommits",subscriptionID:r,data:e})},n=t.getSmartlogCommits();null!=n&&e(n);const o=[];o.push(t.subscribeToSmartlogCommitsChanges(e)),t.fetchSmartlogCommits(),o.push(t.subscribeToSmartlogCommitsBeginFetching((()=>this.postMessage({type:"beganFetchingSmartlogCommitsEvent"})))),this.subscriptions.set(r,{dispose:()=>{o.forEach((e=>e.dispose()))}});break}case"mergeConflicts":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"mergeConflicts",subscriptionID:r,data:e})},n=t.getMergeConflicts();null!=n&&e(n),this.subscriptions.set(r,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:n}=e;t.runOrQueueOperation(n,(e=>{this.postMessage({type:"operationProgress",...e}),"queue"===e.kind&&this.tracker.track("QueueOperation",{extras:{operation:n.trackEventName}})}),this.tracker,r);break}case"abortRunningOperation":{const{operationId:r}=e;t.abortRunningOperation(r);break}case"getConfig":{const t=this.context.userConfig.getGtiConfigValue(e.name);t&&(n.info("got config",e.name,t),this.postMessage({type:"gotConfig",name:e.name,value:t}));break}case"setConfig":n.info("set config",e.name,e.value),this.context.userConfig.setGtiConfigValue(e.name,e.value).catch((t=>n.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":t.runCommand(["internal-only","repo-message"]).then((e=>({value:e.stdout}))).catch((e=>(n?.error("error fetching repo message",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedRepoMessage",message:e.value||""})));break;case"fetchUpgradePrompt":n.info("fetchUpgradePrompt"),t.runCommand(["internal-only","upgrade-prompt"]).then((e=>({value:e.stdout}))).catch((e=>(n?.error("error fetching upgrade prompt",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedUpgradePrompt",message:e.value||""})));break;case"fetchAuthStatus":t.runCommand(["internal-only","check-auth"]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(n?.error("error fetching auth status",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedAuthStatus",message:e.value})}));break;case"fetchPotentialParents":{const{branchToTrack:r}=e;t.runCommand(["internal-only","potential-parents",r]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(n?.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:r}=e,o=function(e,t,r=l()){const n=r.resolve(t.info.repoRoot,e);return n.startsWith(t.info.repoRoot+r.sep)?n:null}(r,t);if(null==o)return void n.warn("can't delete file outside of the repo",r);s().promises.rm(o).then((()=>{n.info("deleted file from filesystem",o)})).catch((e=>{n.error("unable to delete file",o,e)}));break}case"requestComparison":{const{comparison:r}=e;t.runCommand(["internal-only","diff",...$(r)]).then((e=>({value:e.stdout}))).catch((e=>(n?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"comparison",comparison:r,data:{diff:e}})));break}case"requestChangedFiles":{const{branch:r}=e;t.runCommand(["internal-only","changed-files",r]).then((e=>JSON.parse(e.stdout))).catch((e=>(n?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFiles",branch:r,data:e})));break}case"requestComparisonContextLines":{const{id:{path:r,comparison:n},start:i,numLines:s}=e;if(n.type===o.ComparisonType.Commit||n.type===o.ComparisonType.Range)throw new Error("Not implemented");t.relativeCat(r,n).catch((()=>"")).then((e=>this.postMessage({type:"comparisonContextLines",lines:e.split("\n").slice(i-1,i-1+s),path:r})));break}case"requestChangedFilesInRange":{const{fromSha:r,toSha:o}=e;t.runCommand(["internal-only","changed-files",o,"--from",r]).then((e=>JSON.parse(e.stdout))).catch((e=>(n?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInRange",fromSha:r,toSha:o,data:e})));break}case"requestCommitsInBranch":{const{branch:r}=e;t.runCommand(["internal-only","list-commits",r]).then((e=>JSON.parse(e.stdout))).catch((e=>(n?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"commitsInBranch",branch:r,data:e})));break}case"requestChangedFilesInCommit":{const{commitSha:r}=e;t.runCommand(["internal-only","changed-files",r,"--from",`${r}~`]).then((e=>JSON.parse(e.stdout))).catch((e=>(n?.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInCommit",commitSha:r,data:e})));break}case"refresh":n?.log("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 r=JSON.parse(e.stdout);this.postMessage({type:"fetchedCommitMessageTemplate",templates:Object.fromEntries(Object.entries(r).map((([e,r])=>[e,r.replace(t.IGNORE_COMMIT_MESSAGE_LINES_REGEX,"")])))})})).catch((e=>{n?.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=r(44828);const ee={platformName:"browser",watchForChanges:(e,t,r)=>{const{repoRoot:n,dotdir:o}=e,i=Z.watch(o,{cwd:o});i.on("ready",(()=>{r("everything")})),i.on("all",((e,t)=>{t.startsWith("rebase-merge")&&r("merge conflicts"),(t.startsWith("index")||t.startsWith("HEAD"))&&r("uncommitted changes"),(t.startsWith("refs/heads")||t.startsWith("refs/branch-metadata")||t.startsWith("HEAD"))&&r("branches")}));const s=l().relative(n,o),a=Z.watch(n,{cwd:n,ignored:`${s}/**`});return a.on("all",(()=>{r("uncommitted changes")})),()=>{a.close().catch((()=>t.error(`failed to close chokidar worktree watcher for ${n}`))),i.close().catch((()=>t.error(`failed to close chokidar dotdir watcher for ${o}`)))}},handleMessageFromClient:(e,t)=>{switch(t.type){case"platform/openFile":{const r=l().join((0,o.unwrap)(e?.info.repoRoot),t.path);let n;if(null==n)switch(process.platform){case"darwin":n="/usr/bin/open";break;case"win32":n="notepad.exe";break;case"linux":n="xdg-open"}if(n){e?.logger.log("open file",r);const t=(0,p.spawn)(n,[r],{detached:!0,stdio:"ignore",windowsHide:!1,windowsVerbatimArguments:!0});t.on("error",(t=>{e?.logger.log("failed to open",r,t)})),t.unref()}break}}}};function te(e){const t=e.logger??(e.logFileLocation?function(e){const t=(...t)=>{const r=A().format(...t)+"\n";s().promises.appendFile(e,r)};return{info:t,log:t,warn:t,error:t,getLogFileContents:()=>s().promises.readFile(e,"utf-8")}}(e.logFileLocation):T);e.logger=t;const r=e?.platform??ee,n=e?.version??"unknown";t.log(`establish client connection for ${e.cwd}`),t.log(`platform '${r.platformName}', version '${n}', command '${e.command}'`),async function({userConfig:e,logger:t}){const r=await P({userConfig:e}),n=await async function(e){try{const t=await(0,C.composeGit)({debug:t=>e.info(t)});return await t.config("user.email")}catch(t){try{e.error("Failed to get git email",t)}catch{}return}}(t);O({event:"gti-server-startup",timestampISOString:(new Date).toISOString(),logger:t,details:{installUuid:r,gitEmail:n}})}({userConfig:e.userConfig,logger:t}).catch((e=>{t.error("Failed to log startup",e)}));const i=function(e,t,r,n=_){return new o.Tracker(((e,t)=>{const{logger:r}=t;r.log("[track]",e.eventName,e.errorName??"",e.errorMessage??"",null!=e.extras?JSON.stringify(e.extras):"");try{Promise.resolve(n({...e,...t.data})).catch((e=>{}))}catch{}}),new w(e,function(e,t){return{platform:e,version:t,repo:void 0,sessionId:(0,o.randomId)(),unixname:E(),osArch:v().arch(),osType:v().platform(),osRelease:v().release(),hostname:v().hostname()}}(t.platformName,r)))}(t,r,n,(t=>j({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})));i.track("ClientConnection",{extras:{cwd:e.cwd}});let a=new X({platform:r,connection:e,tracker:i,logger:t,userConfig:e.userConfig});return a.setActiveRepoForCwd(e.cwd),()=>{a?.dispose(),a=null}}function re({port:e,sensitiveToken:t,challengeToken:r,logFileLocation:i,logInfo:a,command:c,gtVersion:d,foreground:h,frontendDir:p}){return new Promise((g=>{try{const e=JSON.parse(s().readFileSync(l().join(p,"build/asset-manifest.json"),"utf-8"));for(const t of Object.values(e.files))t.startsWith("/")||g({type:"error",error:`expected entry to start with / but was: \`${t}\``}),ae[t]=t.slice(1)}catch(e){}ae["/favicon.ico"]="favicon.ico";const v=u().createServer((async(e,n)=>{if(e.url){const{pathname:i}=f().parse(e.url);if(null!=i&&ae.hasOwnProperty(i)){const e=ae[i];let t;try{t=await s().promises.readFile(l().join(p,"build",e))}catch(e){return n.writeHead(500,{"Content-Type":"text/plain"}),void n.end((o=e.toString(),o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#27;")))}const r=e.lastIndexOf("."),a=e.slice(r+1),u=se[a]??"text/plain";return n.writeHead(200,{"Content-Type":u}),void n.end(t)}if("/challenge_authenticity"===i){const o=ie(e.url).get("token");if(oe({providedToken:o,sensitiveToken:t}))return n.writeHead(401,{"Content-Type":"text/json"}),void n.end(JSON.stringify({error:"invalid token"}));n.writeHead(200,{"Content-Type":"text/json"});const i={challengeToken:r,pid:process.pid};return void n.end(JSON.stringify(i))}}var o;n.writeHead(404,{"Content-Type":"text/html"}),n.end("<html><body>Not Found!</body></html>")})),y=v.listen(e),b=new(m().Server)({noServer:!0,path:"/ws"});b.on("connection",(async(e,r)=>{const{providedToken:s,cwd:u,platform:l}=ne({url:r.url}),f=oe({providedToken:s,sensitiveToken:t});if(f)return a("closing ws:",f),void e.close(o.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,f);const m=await(0,n.composeUserConfigFactory)().load(),p=te({postMessage:t=>(e.send(t),Promise.resolve(!0)),onDidReceiveMessage(t){const r=e.on("message",t);return{dispose:()=>r.off("message",t)}},cwd:u??process.cwd(),userConfig:m,logFileLocation:"stdout"===i?void 0:i,command:c,version:d,persistentClientSideViewState:{},platform:void 0});e.on("close",(()=>{p(),h||setTimeout((()=>{0===Y.numberOfActiveServers()&&process.exit(0)}),6e4)}))})),y.on("upgrade",((e,t,r)=>{b.handleUpgrade(e,t,r,(t=>{b.emit("connection",t,e)}))})),v.on("error",(function(t){if("listen"!==t.syscall)throw g({type:"error",error:t.toString()}),t;switch(t.code){case"EACCES":throw g({type:"error",error:`Port ${e} requires elevated privileges`}),t;case"EADDRINUSE":return void g({type:"addressInUse"});default:throw g({type:"error",error:t.toString()}),t}})),v.on("listening",(()=>g({type:"success",port:v.address().port,pid:process.pid})))}))}const ne=({url:e})=>{if(!e)return{providedToken:void 0,cwd:void 0,platform:void 0};const t=ie(e),r=t.get("cwd");return{providedToken:t.get("token"),cwd:r?decodeURIComponent(r):void 0,platform:t.get("platform")}},oe=({providedToken:e,sensitiveToken:t})=>e?function(e,t){const r=Buffer.from(e),n=Buffer.from(t);return r.length===n.length&&(0,b.timingSafeEqual)(r,n)}(e,t)?void 0:"Invalid token":"No token provided in websocket request";function ie(e){const t=f().parse(e).search?.replace(/^\?/,"").split("&").map((e=>e.split("=")));return new Map(t)}const se={css:"text/css",html:"text/html",js:"text/javascript",ttf:"font/ttf"},ae={"/":"index.html"}}};
3
+ //# sourceMappingURL=607.js.map
@@ -3,14 +3,14 @@
3
3
  "main.js": "/static/js/main.js",
4
4
  "main.css": "/static/css/main.b9bea8d6.css",
5
5
  "static/css/274.74a3708d.chunk.css": "/static/css/274.74a3708d.chunk.css",
6
- "static/js/274.d7df68a1.chunk.js": "/static/js/274.d7df68a1.chunk.js",
6
+ "static/js/274.4d844c91.chunk.js": "/static/js/274.4d844c91.chunk.js",
7
7
  "static/js/697.e9243bfd.chunk.js": "/static/js/697.e9243bfd.chunk.js",
8
8
  "static/media/codicon.ttf?": "/static/media/codicon.fa2cc0ab9f0bec2b3365.ttf",
9
9
  "index.html": "/index.html",
10
10
  "main.js.map": "/static/js/main.js.map",
11
11
  "main.b9bea8d6.css.map": "/static/css/main.b9bea8d6.css.map",
12
12
  "274.74a3708d.chunk.css.map": "/static/css/274.74a3708d.chunk.css.map",
13
- "274.d7df68a1.chunk.js.map": "/static/js/274.d7df68a1.chunk.js.map",
13
+ "274.4d844c91.chunk.js.map": "/static/js/274.4d844c91.chunk.js.map",
14
14
  "697.e9243bfd.chunk.js.map": "/static/js/697.e9243bfd.chunk.js.map"
15
15
  },
16
16
  "entrypoints": [
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkGraphiteInteractive=self.webpackChunkGraphiteInteractive||[]).push([[274],{3274:function(e,n,o){o.r(n),o.d(n,{ComparisonView:function(){return Fe},lineRange:function(){return Me}});var t=o(885),r=o(184),i=(o(5297),o(1072)),a=o(88),l=o(2248),s=o.n(l),c=o(4098),d=o(32),u=o(4510),p=o(2791);function h(e){var n=e.children;return(0,r.jsx)("div",{className:"empty-state",children:(0,r.jsx)("div",{children:n})})}var f=o(6815),m=o(51),v=o(8122),g=o(7338),x=o(1485),b=o(4447),y=o(168),j=o(6444),w=(o(2986),o(4728)),S=o(4942),C=o(5830),k=o.n(C),T=o(763);function O(e){return e.map((function(e){return e.includes(" ")?'"'.concat(e,'"'):e})).join(", ")}function N(e){return"string"==typeof e&&/(inset\s|)([0-9.]+(\w*)\s){1,4}(rgb[a]?\(.*\)|\w+)/.test(e)}function L(e,n){return Array.isArray(e)?e.filter(n):Object.entries(e).reduce((function(e,o){var r=(0,t.Z)(o,2),i=r[0],a=r[1];if((0,T.isObject)(a)){var l=L(a,n);(0,T.isEmpty)(l)||(e[i]=l)}else n(a)&&(e[i]=a);return e}),{})}function M(e){return e.scale,function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["scale"])}var E,F,R=k().typography.normal.lineHeight,P={animation:{easeOutCubic:"cubic-bezier(0.33, 1, 0.68, 1)"},borderWidths:[0,"1px"],breakpoints:["544px","768px","1012px","1280px"],fonts:{normal:O(["-apple-system","BlinkMacSystemFont","Segoe UI","Noto Sans","Helvetica","Arial","sans-serif","Apple Color Emoji","Segoe UI Emoji"]),mono:O(["SFMono-Regular","Consolas","Liberation Mono","Menlo","Courier","monospace"])},fontSizes:["12px","14px","16px","20px","24px","32px","40px","48px"],fontWeights:{light:300,normal:400,semibold:500,bold:600},lineHeights:R,radii:["0","3px","6px","100px"],sizes:{small:"544px",medium:"768px",large:"1012px",xlarge:"1280px"},space:["0","4px","8px","16px","24px","32px","40px","48px","64px","80px","96px","112px","128px"],colorSchemes:Object.entries(k().colors).reduce((function(e,n){var o=(0,t.Z)(n,2),r=o[0],i=function(e){return{colors:L(e,(function(e){return function(e){return!(N(e)||!e.startsWith("#")&&!e.startsWith("rgb")&&!e.startsWith("hsl"))}(e)})),shadows:L(e,(function(e){return N(e)}))}}(o[1]),a=i.colors,l=i.shadows;return Object.assign(Object.assign({},e),(0,S.Z)({},r,{colors:M(a),shadows:M(l)}))}),{})},B=(w.U2,w.qC),I=w.By,Z=B(w.Dh,w.$_,w.jf),H=I({whiteSpace:{property:"whiteSpace"}}),D=B(w.cp,H),_=(B(w.Cg,w.AF),w.bK,o(9948)),A=o.n(_),z=o(4164),W="light",J="dark",U=p.createContext({setColorMode:function(){return null},setDayScheme:function(){return null},setNightScheme:function(){return null}}),K=function(e){var n,o,i,a,l,s,c,d,u=e.children,h=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["children"]),f=q(),m=f.theme,v=f.colorMode,g=f.dayScheme,x=f.nightScheme,b=null!==(o=null!==(n=h.theme)&&void 0!==n?n:m)&&void 0!==o?o:P,y=function(){var e;try{var n=null===(e=document.getElementById("__PRIMER_DATA__"))||void 0===e?void 0:e.textContent;if(n)return JSON.parse(n)}catch(e){}return{}}(),w=y.resolvedServerColorMode,S=p.useRef(w),C=p.useState(null!==(a=null!==(i=h.colorMode)&&void 0!==i?i:v)&&void 0!==a?a:"day"),k=(0,t.Z)(C,2),T=k[0],O=k[1],N=p.useState(null!==(s=null!==(l=h.dayScheme)&&void 0!==l?l:g)&&void 0!==s?s:W),L=(0,t.Z)(N,2),M=L[0],E=L[1],F=p.useState(null!==(d=null!==(c=h.nightScheme)&&void 0!==c?c:x)&&void 0!==d?d:J),R=(0,t.Z)(F,2),B=R[0],I=R[1],Z=function(){var e=p.useState(G),n=(0,t.Z)(e,2),o=n[0],r=n[1];return p.useEffect((function(){var e,n=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)");function o(e){var n=e.matches;r(n?"night":"day")}if(n){if(void 0!==n.addEventListener)return n.addEventListener("change",o),function(){n.removeEventListener("change",o)};if(void 0!==n.addListener)return n.addListener(o),function(){n.removeListener(o)}}}),[]),o}(),H=S.current||V(T,Z),D=function(e,n,o){switch(e){case"day":case"light":return n;case"dark":case"night":return o}}(H,M,B),_=p.useMemo((function(){return function(e,n){if(!e.colorSchemes)return{resolvedTheme:e,resolvedColorScheme:void 0};if(!e.colorSchemes[n]){console.error("`".concat(n,"` scheme not defined in `theme.colorSchemes`"));var o=Object.keys(e.colorSchemes)[0];return{resolvedTheme:A()(e,e.colorSchemes[o]),resolvedColorScheme:o}}return{resolvedTheme:A()(e,e.colorSchemes[n]),resolvedColorScheme:n}}(b,D)}),[b,D]),K=_.resolvedTheme,X=_.resolvedColorScheme;return p.useEffect((function(){var e=V(T,Z);S.current&&(S.current!==e&&window.setTimeout((function(){z.flushSync((function(){O(e)})),O(T)})),S.current=null)}),[T,Z]),p.useEffect((function(){var e,n;O(null!==(n=null!==(e=h.colorMode)&&void 0!==e?e:v)&&void 0!==n?n:"day")}),[h.colorMode,v]),p.useEffect((function(){var e,n;E(null!==(n=null!==(e=h.dayScheme)&&void 0!==e?e:g)&&void 0!==n?n:W)}),[h.dayScheme,g]),p.useEffect((function(){var e,n;I(null!==(n=null!==(e=h.nightScheme)&&void 0!==e?e:x)&&void 0!==n?n:J)}),[h.nightScheme,x]),(0,r.jsx)(U.Provider,{value:{theme:K,colorScheme:D,colorMode:T,resolvedColorMode:H,resolvedColorScheme:X,dayScheme:M,nightScheme:B,setColorMode:O,setDayScheme:E,setNightScheme:I},children:(0,r.jsxs)(j.f6,{theme:K,children:[u,h.preventSSRMismatch?(0,r.jsx)("script",{type:"application/json",id:"__PRIMER_DATA__",dangerouslySetInnerHTML:{__html:JSON.stringify({resolvedServerColorMode:H})}}):null]})})};function q(){return p.useContext(U)}function G(){var e,n;return"undefined"!=typeof window&&(null===(n=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===n?void 0:n.matches)?"night":"day"}function V(e,n){return"auto"===e?n:e}var X=(0,j.vJ)(E||(E=(0,y.Z)(["\n * { box-sizing: border-box; }\n body { margin: 0; }\n table { border-collapse: collapse; }\n input { color-scheme: ",'; }\n\n [role="button"]:focus:not(:focus-visible):not(.focus-visible),\n [role="tabpanel"][tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),\n button:focus:not(:focus-visible):not(.focus-visible),\n summary:focus:not(:focus-visible):not(.focus-visible),\n a:focus:not(:focus-visible):not(.focus-visible) {\n outline: none;\n box-shadow: none;\n }\n\n [tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),\n details-dialog:focus:not(:focus-visible):not(.focus-visible) {\n outline: none;\n }\n'])),(function(e){return e.colorScheme})),Y=j.ZP.div(F||(F=(0,y.Z)(["\n ",";\n ",";\n"])),D,Z);function $(e){var n=e.children,o=e.color,t=void 0===o?"fg.default":o,i=e.fontFamily,a=void 0===i?"normal":i,l=e.lineHeight,s=void 0===l?"default":l,c=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["children","color","fontFamily","lineHeight"]),d=q(),u=d.colorScheme,p=d.dayScheme,h=d.nightScheme;return(0,r.jsxs)(Y,Object.assign({},c,{color:t,fontFamily:a,lineHeight:s,"data-portal-root":!0,"data-color-mode":(null==u?void 0:u.includes("dark"))?"dark":"light","data-light-theme":p,"data-dark-theme":h,children:[(0,r.jsx)(X,{colorScheme:(null==u?void 0:u.includes("dark"))?"dark":"light"}),n]}))}var Q,ee=o(1828),ne=o(2104),oe=o(8490),te=function(e){return(0,oe.ZP)(e.sx)},re=j.ZP.div(w.Dh,w.$_,w.cp,w.bK,w.GQ,w.eC,w.Oq,w.Cg,w.FK,w.AF,te),ie=o(2909),ae=j.ZP.span(Q||(Q=(0,y.Z)(["\n ",";\n ",";\n ",";\n"])),D,Z,te);function le(e){var n=e.ctx,o=e.path,t=e.diffType,i=e.open,a=e.onChangeOpen,l=void 0===t?"fg.muted":ce[t],s=o.split("/");return(0,r.jsxs)(re,{className:"split-diff-view-file-header",display:"flex",alignItems:"center",bg:"accent.subtle",color:l,paddingX:2,paddingY:1,lineHeight:2,backgroundColor:"canvas.subtle",borderTopRightRadius:2,borderTopLeftRadius:2,borderBottomColor:"border.default",borderBottomStyle:"solid",borderBottomWidth:"1px",children:[a&&(0,r.jsx)(re,{paddingRight:2,onClick:function(){return a(!i)},sx:{cursor:"pointer"},children:i?(0,r.jsx)(ie.g8U,{size:24}):(0,r.jsx)(ie.v4q,{size:24})}),void 0!==t&&(0,r.jsx)(m.J,{icon:de[t]}),(0,r.jsx)(ae,{fontFamily:"mono",fontSize:12,children:s.reduce((function(e,o,t){var i=s.slice(t).join("/"),a=null==n?void 0:n.copy;return(0,r.jsxs)("span",{className:a&&"file-header-copyable-path",children:[e,(0,r.jsxs)("span",{title:a&&"Copy ".concat(i),onClick:a&&function(){return a(i)},className:"file-header-path-element",children:[o,t<s.length-1?"/":""]})]},t)}),(0,r.jsx)("span",{}))})]})}var se,ce={Modified:"var(--scm-modified-foreground)",Added:"var(--scm-added-foreground)",Removed:"var(--scm-removed-foreground)",Renamed:"var(--scm-modified-foreground)",Copied:"var(--scm-added-foreground)"},de={Modified:"diff-modified",Added:"diff-added",Removed:"diff-removed",Renamed:"diff-renamed",Copied:"diff-renamed"},ue=o(2982),pe=o(2840),he={small:"16px",medium:"32px",large:"64px"},fe=(0,j.ZP)((function(e){var n=e.size,o=void 0===n?"medium":n,t=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["size"]),i=he[o];return(0,r.jsxs)("svg",Object.assign({height:i,width:i,viewBox:"0 0 16 16",fill:"none"},t,{children:[(0,r.jsx)("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),(0,r.jsx)("path",{d:"M15 8a7.002 7.002 0 00-7-7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]}))}))(se||(se=(0,y.Z)(["\n @keyframes rotate-keyframes {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n animation: rotate-keyframes 1s linear infinite;\n\n ","\n"])),te);function me(e){var n,o,t=e.beforeLineNumber,i=e.before,a=e.afterLineNumber,l=e.after,s=e.rowType,c=e.path,d=e.openFileToLine;switch(s){case"remove":n="patch-remove-line",o=void 0;break;case"modify":n="patch-remove-line",o="patch-add-line";break;case"add":n=void 0,o="patch-add-line";break;case"common":n=void 0,o=void 0;break;case"expanded":n="patch-expanded",o="patch-expanded"}var u="expanded"!==s;return(0,r.jsxs)("tr",{children:[(0,r.jsx)(ve,{className:n,content:i,lineNumber:t,path:c,side:"LEFT",canComment:u}),(0,r.jsx)(ve,{className:o,content:l,lineNumber:a,path:c,side:"RIGHT",canComment:u,openFileToLine:d})]})}function ve(e){var n=e.className,o=e.content,t=e.lineNumber,i=e.path,a=e.side,l=e.openFileToLine,s="RIGHT"===a?ge:{},c=null!=l&&null!=t,d=(null!=n?" ".concat(n,"-number"):"")+(c?" clickable":"");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(re,Object.assign({as:"td",className:"lineNumber".concat(d),"data-line-number":t,"data-path":i,"data-side":a,onClick:c?function(){return l(t)}:void 0},s,{children:t})),(0,r.jsx)("td",{className:n,children:o})]})}fe.displayName="Spinner";var ge={borderLeftWidth:"1px",borderLeftStyle:"solid",borderLeftColor:"border.default"},xe=p.memo((function(e){var n,o=e.ctx,i=e.path,a=e.patch,l=e.preamble,s=(0,p.useState)(!1),c=(0,t.Z)(s,2),d=c[0],u=c[1],h=(0,p.useState)((function(){return new Set})),f=(0,t.Z)(h,2),m=f[0],v=f[1],g=(0,p.useCallback)((function(e){var n=new Set(m);n.add(e),v(n)}),[m,v]),x=null!==(n=o.translate)&&void 0!==n?n:function(e){return e},b="/dev/null"===a.newFileName,y=a.hunks,j=y.length-1,w=(0,ue.Z)(null!=l?l:[]);return!b||d?y.forEach((function(e,n){if(0===n&&(1!==e.oldStart||1!==e.newStart)){var a="s0";if(m.has(a)){var l={id:o.id,start:1,numLines:e.oldStart-1};w.push((0,r.jsx)(we,{ctx:o,range:l,path:i,beforeLineStart:1,afterLineStart:1,t:x},a))}else{var s=Math.max(e.oldStart,e.newStart)-1;w.push((0,r.jsx)(je,{numLines:s,onExpand:function(){return g(a)},t:x},a))}}if(function(e,n,o,i){var a=e.oldStart,l=e.newStart,s=function(e){var n=[],o={common:[],removed:[],added:[]};return e.forEach((function(e){var t=e.charAt(0),r=e.slice(1);" "===t?(function(e){return 0!==e.removed.length||0!==e.added.length}(o)&&(n.push(o),o={common:[],removed:[],added:[]}),o.common.push(r)):"-"===t?o.removed.push(r):"+"===t&&o.added.push(r)})),n.push(o),n}(e.lines),c=a,d=l;s.forEach((function(e){var a=e.common,l=e.removed,s=e.added;be(a,n,"common",c,d,o,i),c+=a.length,d+=a.length;for(var u=Math.max(l.length,s.length),p=0;p<u;++p){var h=l[p],f=s[p];if(null!=h&&null!=f){var m=ye(h,f),v=(0,t.Z)(m,2),g=v[0],x=v[1];o.push((0,r.jsx)(me,{beforeLineNumber:c,before:g,afterLineNumber:d,after:x,rowType:"modify",path:n,openFileToLine:i},"".concat(c,"/").concat(d))),++c,++d}else null!=h?(o.push((0,r.jsx)(me,{beforeLineNumber:c,before:h,afterLineNumber:null,after:null,rowType:"remove",path:n,openFileToLine:i},"".concat(c,"/"))),++c):(o.push((0,r.jsx)(me,{beforeLineNumber:null,before:null,afterLineNumber:d,after:f,rowType:"add",path:n,openFileToLine:i},"/".concat(d))),++d)}}))}(e,i,w,o.openFileToLine),n!==j){var c=y[n+1],d="s".concat(e.oldStart);if(m.has(d)){var u=e.oldStart+e.oldLines,p=c.oldStart-u,h={id:o.id,start:u,numLines:p};w.push((0,r.jsx)(we,{ctx:o,range:h,path:i,beforeLineStart:e.oldStart+e.oldLines,afterLineStart:e.newStart+e.newLines,t:x},d))}else{var f=c.oldStart-e.oldLines-e.oldStart;w.push((0,r.jsx)(je,{numLines:f,onExpand:function(){return g(d)},t:x},d))}}})):w.push((0,r.jsx)(Se,{children:(0,r.jsxs)(re,{display:"inline-block",onClick:function(){return u(!0)},padding:1,sx:{cursor:"pointer",":hover":{bg:"accent.emphasis",color:"fg.onEmphasis"}},children:[(0,r.jsx)(ie.NoM,{size:16}),(0,r.jsx)(ae,{paddingX:4,children:"Show deleted file"}),(0,r.jsx)(ie.NoM,{size:16})]})},"show-deleted")),(0,r.jsxs)("table",{className:"SplitDiffView-hunk-table",children:[(0,r.jsxs)("colgroup",{children:[(0,r.jsx)("col",{width:50}),(0,r.jsx)("col",{width:"50%"}),(0,r.jsx)("col",{width:50}),(0,r.jsx)("col",{width:"50%"})]}),(0,r.jsx)("tbody",{children:w})]})}));function be(e,n,o,t,i,a,l){var s=t,c=i;e.forEach((function(e){a.push((0,r.jsx)(me,{beforeLineNumber:s,before:e,afterLineNumber:c,after:e,rowType:o,path:n,openFileToLine:l},"".concat(s,"/").concat(c))),++s,++c}))}function ye(e,n){if(e.length+n.length>300)return[e,n];var o=(0,pe.Kx)(e,n),t=[],i=[];return o.forEach((function(e,n){var o=e.added,a=e.removed,l=e.value;o?i.push((0,r.jsx)("span",{className:"patch-add-word",children:l},n)):a?t.push((0,r.jsx)("span",{className:"patch-remove-word",children:l},n)):(t.push(l),i.push(l))})),[t,i]}function je(e){var n=e.numLines,o=e.onExpand;if(0===n)return null;var t=1===n?"Expand 1 line":"Expand ".concat(n," lines");return(0,r.jsx)(Se,{children:(0,r.jsxs)(re,{display:"inline-block",onClick:o,padding:1,sx:{cursor:"pointer",":hover":{bg:"accent.emphasis",color:"fg.onEmphasis"}},children:[(0,r.jsx)(ie.NoM,{size:16}),(0,r.jsx)(ae,{paddingX:4,children:t}),(0,r.jsx)(ie.NoM,{size:16})]})})}var we=(0,d.Pi)((function(e){var n=e.ctx,o=e.path,t=e.range,i=e.beforeLineStart,a=e.afterLineStart,l=n.atoms.lineRange(t).get();switch(l.state){case"fulfilled":var s=[];return be(l.value,o,"expanded",i,a,s,n.openFileToLine),(0,r.jsx)(r.Fragment,{children:s});case"pending":return(0,r.jsx)(Se,{children:(0,r.jsx)(re,{padding:1,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",children:(0,r.jsxs)(re,{display:"flex",alignItems:"center",children:[(0,r.jsx)(fe,{size:"small"}),(0,r.jsx)(ae,{marginLeft:2,children:"Loading..."})]})})});case"rejected":return(0,r.jsx)(Se,{children:(0,r.jsx)(re,{padding:1,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",children:(0,r.jsx)(re,{display:"flex",alignItems:"center",children:(0,r.jsxs)(ae,{children:["Error:"," ",l.value.message]})})})})}}));function Se(e){var n=e.children;return(0,r.jsx)(re,{as:"tr",bg:"accent.subtle",color:"fg.muted",height:12,children:(0,r.jsx)(re,{as:"td",colSpan:4,className:"separator",children:n})})}function Ce(e){var n,o,t,i,l=e.ctx,s=e.path,c=e.patch,d=null!==(o=null!==(n=c.newFileName)&&void 0!==n?n:c.oldFileName)&&void 0!==o?o:"/dev/null",u=xe,p=[];return c.type===a.DiffType.Added&&p.push((0,r.jsx)(ke,{children:"This file was added"},"added")),c.type===a.DiffType.Removed&&p.push((0,r.jsx)(ke,{children:"This file was removed"},"deleted")),c.type===a.DiffType.Renamed&&p.push((0,r.jsxs)(ke,{children:["This file was renamed from"," ",null!==(t=c.oldFileName)&&void 0!==t?t:""]},"renamed")),c.type===a.DiffType.Copied&&p.push((0,r.jsxs)(ke,{children:["This file was copied from"," ",null!==(i=c.oldFileName)&&void 0!==i?i:""]},"copied")),(0,r.jsxs)(re,{className:"split-diff-view",borderWidth:"1px",borderStyle:"solid",borderColor:"border.default",borderRadius:2,children:[(0,r.jsx)(le,{ctx:l,path:d,diffType:c.type}),(0,r.jsx)(u,{ctx:l,path:s,patch:c,preamble:p})]})}function ke(e){var n=e.children;return(0,r.jsx)(re,{as:"tr",bg:"attention.subtle",color:"fg.muted",height:12,children:(0,r.jsx)(re,{as:"td",colSpan:4,className:"separator",children:(0,r.jsx)(re,{padding:1,children:n})})})}var Te=p.memo((0,d.Pi)((function(){var e=q().theme;return(0,r.jsx)("style",{children:"\n.patch-word-begin {\n border-top-left-radius: .2em;\n border-bottom-left-radius: .2em;\n}\n\n.patch-word-end {\n border-top-right-radius: .2em;\n border-bottom-right-radius: .2em;\n}\n\n.patch-add-line {\n background-color: ".concat(null==e?void 0:e.colors.diffBlob.addition.lineBg,";\n}\n\n.patch-add-line-number {\n color: ").concat(null==e?void 0:e.colors.diffBlob.addition.numText,";\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.addition.numBg,";\n}\n\n.patch-add-word {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.addition.wordBg,";\n}\n\n.patch-remove-line {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.lineBg,";\n}\n\n.patch-remove-line-number {\n color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.numText,";\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.numBg,";\n}\n\n.patch-remove-word {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.wordBg,";\n}\n\n.patch-expanded, .patch-expanded-number {\n background-color: ").concat(null==e?void 0:e.colors.canvas.subtle,";\n}\n\n.patch-expanded-number {\n color: ").concat(null==e?void 0:e.colors.fg.subtle,";\n}\n\n.SplitDiffView-hunk-table td {\n font-family: ").concat(null==e?void 0:e.fonts.mono,"\n}\n\n.lineNumber.clickable {\n cursor: pointer;\n}\n\n.lineNumber.clickable:hover {\n text-decoration: underline;\n}\n/**\n * pl = prettylights theme\n *\n * Mapping from CSS class name to Primer color deduced from a combination of:\n * https://cdn.jsdelivr.net/npm/github-syntax-theme-generator@0.5.0/build/css/github-light.css\n * https://primer.style/react/theme-reference\n *\n * Though it is a bit confusing because github-light.css defines some classes\n * multiple times, such as .pl-s.\n */\n\n.pl-ba {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.brackethighlighterAngle,";\n}\n\n.pl-bu {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.brackethighlighterUnmatched,";\n}\n\n.pl-c {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.comment,";\n}\n\n.pl-c1 {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.constant,";\n}\n\n.pl-c2 {\n background-color: ").concat(null==e?void 0:e.colors.prettylights.syntax.carriageReturnBg,";\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.carriageReturnText,';\n}\n\n.pl-c2::before {\n content: "^M";\n}\n\n.pl-corl {\n color: ').concat(null==e?void 0:e.colors.prettylights.syntax.constantOtherReferenceLink,";\n text-decoration: underline;\n}\n\n.pl-e, .pl-en {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.entity,";\n}\n\n.pl-ent {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.entityTag,";\n}\n\n.pl-ii {\n background-color: ").concat(null==e?void 0:e.colors.prettylights.syntax.invalidIllegalBg,";\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.invalidIllegalText,";\n}\n\n.pl-k {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.keyword,";\n}\n\n.pl-s, .pl-pds {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.string,";\n}\n\n.pl-sg {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.sublimelinterGutterMark,";\n}\n\n.pl-smi {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.storageModifierImport,";\n}\n\n.pl-sr {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.stringRegexp,";\n font-weight: bold;\n}\n\n.pl-v {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.variable,";\n}\n")})}))),Oe=o(5288);function Ne(e){return(0,a.parsePatch)(e).filter((function(e){return e.hunks.length>0||null!=e.newFileName||null!=e.oldFileName}))}var Le=(0,g.N)({genKey:function(e){switch(e.type){case a.ComparisonType.Range:throw new Error("Version comparison not supported");case a.ComparisonType.Committed:return"Committed ".concat(e.hash);case a.ComparisonType.Commit:throw new Error("Commit comparison not supported");case a.ComparisonType.HeadChanges:return"HEAD";case a.ComparisonType.StackChanges:return"STACK";case a.ComparisonType.UncommittedChanges:return"UNCOMMITTED"}},genValue:function(e){return(0,x.u)({default:{isLoading:!0,data:null},setter:function(n){n.isLoading&&ee.H.postMessage({type:"requestComparison",comparison:e})},effects:[function(n){var o=n.setSelf,t=ee.H.onMessageOfType("comparison",(function(n){var t,r;e.type===n.comparison.type&&o({isLoading:!1,data:(t=n.data.diff,r=Ne,null==t.error?{value:r(t.value)}:t)})}));return function(){return t.dispose()}}]})}}),Me=(0,g.N)({genKey:function(e){return s()(e)},genValue:function(e){return(0,c.Fl)((function(){ne.ql.get(),ee.H.postMessage(Object.assign({type:"requestComparisonContextLines"},e));var n=new Promise((function(e){var n=ee.H.onMessageOfType("comparisonContextLines",(function(o){e(o.lines),n.dispose()}))}));return(0,u.p4)(n)}))}});function Ee(e){var n=Le(e);return[n.get(),(0,p.useCallback)((function(){(0,c.z)((function(){var e=n.get();n.set(Object.assign(Object.assign({},e),{isLoading:!0}))}))}),[n])]}var Fe=(0,d.Pi)((function(e){var n=e.comparison,o=Ee(n),i=(0,t.Z)(o,2),a=i[0],l=i[1];(0,p.useEffect)(l,[n,l]);var s=v.X.get();return(0,r.jsx)("div",{"data-testid":"comparison-view",className:"comparison-view",children:(0,r.jsxs)(K,{colorMode:"light"===s?"day":"night",children:[(0,r.jsx)(Te,{}),(0,r.jsxs)($,{className:"comparison-view-base-styles",children:[(0,r.jsx)(Pe,{comparison:n}),(0,r.jsx)("div",{className:"comparison-view-details",children:null==a.data?(0,r.jsx)(m.J,{icon:"loading"}):null!=a.data.error?(0,r.jsx)(f.W,{error:a.data.error,title:"Unable to load comparison"}):0===a.data.value.length?(0,r.jsx)(h,{children:"No Changes"}):a.data.value.map((function(e,o){return(0,r.jsx)(Be,{diff:e,comparison:n},o)}))})]})]})})})),Re=[a.ComparisonType.UncommittedChanges,a.ComparisonType.HeadChanges,a.ComparisonType.StackChanges],Pe=(0,d.Pi)((function(e){var n=e.comparison,o=Ee(n),l=(0,t.Z)(o,2),s=l[0],d=l[1];return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"comparison-view-header",children:[(0,r.jsxs)("span",{className:"comparison-view-header-group",children:[(0,r.jsxs)(i.Yb,{"data-testid":"comparison-view-picker",value:n.type,onChange:function(e){var n=Oe._.get();Oe._.set(Object.assign(Object.assign({},n),{comparison:{type:e.currentTarget.value}}))},children:[Re.map((function(e){return(0,r.jsx)(i.nH,{value:e,children:(0,a.labelForComparison)({type:e})},e)})),Re.includes(n.type)?null:(0,r.jsx)(i.nH,{value:n.type,children:(0,a.labelForComparison)(n)},n.type)]}),(0,r.jsx)(i.vD,{title:"Reload this comparison. Comparisons do not refresh automatically.",appearance:"secondary",onClick:d,children:(0,r.jsx)(m.J,{icon:"refresh","data-testid":"comparison-refresh-button"})}),s.isLoading?(0,r.jsx)(m.J,{icon:"loading","data-testid":"comparison-loading"}):null]}),(0,r.jsx)(i.vD,{"data-testid":"close-comparison-view-button",appearance:"icon",onClick:function(){return(0,c.z)((function(){var e=Oe._.get();Oe._.set(Object.assign(Object.assign({},e),{visible:!1}))}))},children:(0,r.jsx)(m.J,{icon:"x"})})]})})}));function Be(e){var n,o,t=e.diff,i=e.comparison,a=null!==(o=null!==(n=t.newFileName)&&void 0!==n?n:t.oldFileName)&&void 0!==o?o:"",l={id:{path:a,comparison:i},atoms:{lineRange:Me},copy:b.J.clipboardCopy,openFileToLine:Ie(i)?function(e){return b.J.openFile(a,{line:e})}:void 0};return(0,r.jsx)("div",{className:"comparison-view-file",children:(0,r.jsx)(Ce,{ctx:l,patch:t,path:a})},a)}function Ie(e){switch(e.type){case a.ComparisonType.UncommittedChanges:case a.ComparisonType.HeadChanges:case a.ComparisonType.StackChanges:return!0;case a.ComparisonType.Committed:case a.ComparisonType.Commit:case a.ComparisonType.Range:return!1}}}}]);