performance.mark("js-parse-end:66231-e6e39ee93d5d7dba.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["66231"],{91226(e,t,s){s.d(t,{Y:()=>E});class E{value;expiration;ssoOrgIDs;constructor(e,t,s){this.value=e,this.expiration=t,this.ssoOrgIDs=s}get authorizationHeaderValue(){return`GitHub-Bearer ${this.value}`}needsRefreshing(e){return this.isExpired||this.ssoChanged(e)}get isExpired(){let e=new Date(this.expiration);return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()))e.includes(t))&&e.every(e=>this.ssoOrgIDs.includes(e)))}static fromResult(e,t){return new E(e.token,e.expiration,e.ssoOrgIDs??t)}serialize(){return{value:this.value,expiration:this.expiration,ssoOrgIDs:this.ssoOrgIDs}}static deserialize(e){return new E(e.value,e.expiration,e.ssoOrgIDs)}}},17917(e,t,s){s.d(t,{JR:()=>O,UZ:()=>S,yj:()=>i});var E=s(91226),_=s(35205),r=s(78597);let S="COPILOT_AUTH_TOKEN";class O{tokenEndpoint;storageKey;ssoOrgIDs;currentAuthTokenRequest;isUnlicensed;copilotLocalStorage;constructor(e,t="/github-copilot/chat/token",s=S){this.ssoOrgIDs=e,this.currentAuthTokenRequest=null,this.isUnlicensed=!1,this.copilotLocalStorage=(0,_.A)("localStorage",{throwQuotaErrorsOnSet:!1,ttl:864e5}),this.storageKey=s,this.tokenEndpoint=t}async getAuthToken(){if(this.isUnlicensed)throw new i("User is not licensed for Copilot");let e=this.getLocalStorageAuthToken();return e?this.validateAuthToken(e):this.fetchAuthToken()}setLocalStorageAuthToken(e){this.copilotLocalStorage.setItem(this.storageKey,JSON.stringify(e.serialize()))}getLocalStorageAuthToken(){let e=this.copilotLocalStorage.getItem(this.storageKey);return e?E.Y.deserialize(JSON.parse(e)):null}removeLocalStorageAuthToken(){this.copilotLocalStorage.removeItem(this.storageKey)}async validateAuthToken(e){return e.needsRefreshing(this.ssoOrgIDs)?this.fetchAuthToken():e}fetchAuthToken(e=!1){return e&&(this.currentAuthTokenRequest=null),this.currentAuthTokenRequest||(this.currentAuthTokenRequest=this._fetchAuthToken(e)),this.currentAuthTokenRequest}async _fetchAuthToken(e=!1){try{let t=e?`${this.tokenEndpoint}?force_refresh=true`:this.tokenEndpoint,s=await (0,r.lS)(t,{method:"POST"});if(s.ok){let e=await s.json(),t=E.Y.fromResult(e,this.ssoOrgIDs);return this.ssoOrgIDs=t.ssoOrgIDs,this.setLocalStorageAuthToken(t),this.isUnlicensed=!1,t}if(404===s.status)throw this.isUnlicensed=!0,new i("Copilot auth token endpoint not found (404)");throw Error("Failed to mint new auth token")}finally{this.currentAuthTokenRequest=null}}}class i extends Error{constructor(e){super(e),this.name="CopilotAuthTokenUnlicensedError"}}},10506(e,t,s){s.d(t,{Jt:()=>I,iI:()=>l});var E=s(31635),_=s(16522),r=s(45062),S=s(17917),O=s(35205),i=s(96540),o=s(11515),T=s(49685);class a{COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY="COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY";COPILOT_SELECTED_THREAD_ID_STORAGE_KEY="COPILOT_SELECTED_THREAD_ID_STORAGE_KEY";COPILOT_COLLAPSED_STATE_KEY="COPILOT_COLLAPSED_STATE_KEY";COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY="COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY";COPILOT_PANEL_HEIGHT="COPILOT_PANEL_HEIGHT";DEFAULT_PANEL_HEIGHT=600;COPILOT_PANEL_WIDTH="COPILOT_PANEL_WIDTH";COPILOT_ENTRYPOINT_MESSAGE_KEY=e=>e?`COPILOT_ENTRYPOINT_MESSAGE_KEY_${e}`:"COPILOT_ENTRYPOINT_MESSAGE_KEY";COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY="COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY";COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY="COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY";COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY="COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY";COPILOT_MESSAGE_REQUEST_ID_KEY="COPILOT_MESSAGE_REQUEST_ID_KEY";COPILOT_METER_BANNER_FLAG="COPILOT_METER_BANNER_FLAG";COPILOT_QUOTA_EXCEEDED_BANNER_FLAG="COPILOT_QUOTA_EXCEEDED_BANNER_FLAG";COPILOT_CODING_AGENT_QUOTA_BANNER_DISMISSED_PREFIX="COPILOT_CODING_AGENT_QUOTA_BANNER_DISMISSED_";COPILOT_ANIMATION_FLAG="COPILOT_ANIMATION_FLAG";COPILOT_WRAP_CODE_LINES_KEY="COPILOT_WRAP_CODE_LINES_KEY";COPILOT_TRACING_REQUESTED_FLAG="COPILOT_TRACING_REQUESTED_FLAG";COPILOT_DIFF_REFERENCES_KEY="COPILOT_DIFF_REFERENCES_KEY";COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT="COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT";COPILOT_SPACES_SOURCES_TIP_DISMISSAL_COUNT="COPILOT_SPACES_SOURCES_TIP_DISMISSAL_COUNT";COPILOT_SPACES_SELECTED_TAB="COPILOT_SPACES_SELECTED_TAB";COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE="COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE";COPILOT_LAST_USED_REPOSITORY_KEY="COPILOT_LAST_USED_REPOSITORY_KEY";COPILOT_ACTIVE_MODE_KEY="COPILOT_ACTIVE_MODE_KEY";COPILOT_SELECTED_MODEL_VERSION_KEY="COPILOT_SELECTED_MODEL_VERSION";COPILOT_LANDED_ON_AGENTS_VIEW_KEY="COPILOT_LANDED_ON_AGENTS_VIEW_KEY";lastCheckedModelVersion=null;MAX_MESSAGE_REQUEST_ID_STORAGE_COUNT=100;DEFAULT_PANEL_WIDTH=480;CURRENT_MODEL_STORAGE_VERSION="12";COPILOT_SELECTED_MODEL_STORAGE_KEY=e=>`COPILOT_SELECTED_MODEL_${e}`;COPILOT_SETTINGS_STORAGE_KEY=e=>`COPILOT_SETTINGS_${e}`;COPILOT_SAVED_USER_MESSAGE_KEY=(e,t)=>`COPILOT_SAVED_USER_MESSAGE_${t}_${e}`;COPILOT_SAVED_USER_MESSAGE_ON_ERROR_KEY=e=>`COPILOT_SAVED_USER_MESSAGE_ON_ERROR_${e}`;COPILOT_CURRENT_REFERENCES_KEY=e=>`COPILOT_CURRENT_REFERENCES_${e}`;COPILOT_SELECTED_TOPIC_STORAGE_KEY=e=>`COPILOT_SELECTED_TOPIC_${e}`;localStorage=(0,O.A)("localStorage",{throwQuotaErrorsOnSet:!1,ttl:864e5});mediumStorage=(0,O.A)("localStorage",{throwQuotaErrorsOnSet:!1,ttl:24192e5});longStorage=(0,O.A)("localStorage",{throwQuotaErrorsOnSet:!1});tempStorage=(0,O.A)("localStorage",{throwQuotaErrorsOnSet:!1,ttl:18e5});sessionStorage=(0,O.A)("sessionStorage",{throwQuotaErrorsOnSet:!1,ttl:864e5});get selectedThreadID(){return this.localStorage.getItem(this.COPILOT_SELECTED_THREAD_ID_STORAGE_KEY)}set selectedThreadID(e){let t=this.COPILOT_SELECTED_THREAD_ID_STORAGE_KEY;null==e?this.localStorage.removeItem(t):this.localStorage.setItem(t,e)}getModel(e){this.lastCheckedModelVersion!==this.CURRENT_MODEL_STORAGE_VERSION&&null===e&&this.checkAndClearModelSelection();let t=this.mediumStorage.getItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(e));return null===t?t:JSON.parse(t)}setModel(e,t,s=!0){this.mediumStorage.setItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(e),JSON.stringify(t)),e&&s&&this.mediumStorage.setItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(null),JSON.stringify(t))}checkAndClearModelSelection(){this.lastCheckedModelVersion=this.CURRENT_MODEL_STORAGE_VERSION,T.W.clearModelSelectionForDefaultChange&&this.longStorage.getItem(this.COPILOT_SELECTED_MODEL_VERSION_KEY)!==this.CURRENT_MODEL_STORAGE_VERSION&&(this.mediumStorage.removeItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(null)),this.longStorage.setItem(this.COPILOT_SELECTED_MODEL_VERSION_KEY,this.CURRENT_MODEL_STORAGE_VERSION))}get settings(){let e=this.localStorage.getItem(this.COPILOT_SETTINGS_STORAGE_KEY(this.selectedThreadID));return null===e?e:JSON.parse(e)}set settings(e){this.localStorage.setItem(this.COPILOT_SETTINGS_STORAGE_KEY(this.selectedThreadID),JSON.stringify(e))}getPanelHeight(){let e=this.localStorage.getItem(this.COPILOT_PANEL_HEIGHT);return e?parseInt(e):this.DEFAULT_PANEL_HEIGHT}setPanelHeight(e){let t=this.COPILOT_PANEL_HEIGHT;this.localStorage.setItem(t,e.toString())}getPanelWidth(){let e=this.localStorage.getItem(this.COPILOT_PANEL_WIDTH);return e?parseInt(e):this.DEFAULT_PANEL_WIDTH}setPanelWidth(e){let t=this.COPILOT_PANEL_WIDTH;this.localStorage.setItem(t,e.toString())}getRepoCustomInstructionsState(){return"false"!==this.localStorage.getItem(this.COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY)}setRepoCustomInstructionsState(e){let t=this.COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY;this.localStorage.setItem(t,e.toString())}getCollapsedState(){return"false"!==this.sessionStorage.getItem(this.COPILOT_COLLAPSED_STATE_KEY)}setCollapsedState(e){let t=this.COPILOT_COLLAPSED_STATE_KEY;this.sessionStorage.setItem(t,e.toString())}getSelectedTopic(e){return this.localStorage.getItem(this.COPILOT_SELECTED_TOPIC_STORAGE_KEY(e))}setSelectedTopic(e,t){if(null==t)return void this.localStorage.removeItem(this.COPILOT_SELECTED_TOPIC_STORAGE_KEY(e));let s=this.COPILOT_SELECTED_TOPIC_STORAGE_KEY(e);this.localStorage.setItem(s,t)}getSavedMessage(e,t){return this.localStorage.getItem(this.COPILOT_SAVED_USER_MESSAGE_KEY(e,t))}setSavedMessage(e,t,s){this.setSavedMessageFast(e,t,s)}setSavedMessageFast(e,t,s){let E=this.COPILOT_SAVED_USER_MESSAGE_KEY(e,t);null==s?this.localStorage.removeItem(E):this.localStorage.setItem(E,s)}clearSavedUserMessage(e,t){this.localStorage.removeItem(this.COPILOT_SAVED_USER_MESSAGE_KEY(e,t))}getSavedUserMessageOnError(e){return this.localStorage.getItem(this.COPILOT_SAVED_USER_MESSAGE_ON_ERROR_KEY(e))}setSavedUserMessageOnError(e,t){let s=this.COPILOT_SAVED_USER_MESSAGE_ON_ERROR_KEY(e);null==t?this.localStorage.removeItem(s):this.localStorage.setItem(s,t)}clearSavedUserMessageOnError(e){this.localStorage.removeItem(this.COPILOT_SAVED_USER_MESSAGE_ON_ERROR_KEY(e))}getEntrypointMessage(e){return this.getEntrypointMessageImpl(this.COPILOT_ENTRYPOINT_MESSAGE_KEY(e))}getEntrypointMessageImpl(e){let t,s=this.localStorage.getItem(e);if(null==s)return null;try{t=JSON.parse(s)}catch{return null}return t&&t.message?{message:t.message,references:t.references,model:t.model,mediaContent:t.mediaContent,branch:t.branch}:null}clearEntrypointMessage(e){this.localStorage.removeItem(this.COPILOT_ENTRYPOINT_MESSAGE_KEY(e))}setEntrypointMessage({message:e,references:t,model:s,mediaContent:E,threadID:_}){this.setEntrypointMessageImpl({message:e,references:t,model:s,mediaContent:E,key:this.COPILOT_ENTRYPOINT_MESSAGE_KEY(_)})}setEntrypointMessageImpl({message:e,references:t,model:s,mediaContent:E,branch:_,key:r}){null==e?this.localStorage.removeItem(r):this.localStorage.setItem(r,JSON.stringify({message:e,references:t,model:s,mediaContent:E,branch:_}))}getTaskEntrypointMessage(){return this.getEntrypointMessageImpl(this.COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY)}setTaskEntrypointMessage(e,t,s){this.setEntrypointMessageImpl({message:e,references:t,branch:s,key:this.COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY})}getLoopEntrypointMessage(){return this.getEntrypointMessageImpl(this.COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY)}setLoopEntrypointMessage(e,t){this.setEntrypointMessageImpl({message:e,references:t,key:this.COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY})}getSparkEntrypointMessage(){return this.getEntrypointMessageImpl(this.COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY)}setSparkEntrypointMessage(e){this.setEntrypointMessageImpl({message:e,key:this.COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY})}getLastUsedRepository(){let e=this.localStorage.getItem(this.COPILOT_LAST_USED_REPOSITORY_KEY);if(!e)return null;try{return JSON.parse(e)}catch{return null}}setLastUsedRepository(e){this.localStorage.setItem(this.COPILOT_LAST_USED_REPOSITORY_KEY,JSON.stringify(e))}getCurrentReferences(e){let t=this.COPILOT_CURRENT_REFERENCES_KEY(e),s=this.localStorage.getItem(t);return s?JSON.parse(s):null}setCurrentReferences(e,t){let s=this.COPILOT_CURRENT_REFERENCES_KEY(e),E=t.filter((e,s)=>s===t.findIndex(t=>(0,o.Vb)(e)===(0,o.Vb)(t)));this.localStorage.setItem(s,JSON.stringify(E))}clearCurrentReferences(e){let t=this.COPILOT_CURRENT_REFERENCES_KEY(e);this.localStorage.removeItem(t)}migrateNullThreadToNewThread(e,t){let s=this.getSavedMessage(null,t);this.setSavedMessageFast(null,t,null),s&&this.setSavedMessageFast(e,t,s);let E=this.getCurrentReferences(null);this.clearCurrentReferences(null),E&&this.setCurrentReferences(e,E);let _=this.settings;_&&this.localStorage.setItem(this.COPILOT_SETTINGS_STORAGE_KEY(e),JSON.stringify(_)),this.selectedThreadID=e,this.localStorage.removeItem(this.COPILOT_SETTINGS_STORAGE_KEY(null))}getImmersiveSidebarCollapsedState(){let e=this.localStorage.getItem(this.COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY);return null===e||"true"===e}setImmersiveSidebarCollapsedState(e){this.localStorage.setItem(this.COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY,String(e))}getCopilotDiffReferences(){let e=this.localStorage.getItem(this.COPILOT_DIFF_REFERENCES_KEY);return e?JSON.parse(e):null}setCopilotDiffReferences(e){let t=Array.isArray(e)?e:[e];this.localStorage.setItem(this.COPILOT_DIFF_REFERENCES_KEY,JSON.stringify(t))}removeCopilotDiffReferences(){this.localStorage.removeItem(this.COPILOT_DIFF_REFERENCES_KEY)}clearAuthToken(){this.localStorage.removeItem(S.UZ)}getMeterBannerFlag(){let e=this.localStorage.getItem(this.COPILOT_METER_BANNER_FLAG);return null===e?null:"true"===e}setMeterBannerFlag(e){this.localStorage.setItem(this.COPILOT_METER_BANNER_FLAG,String(e))}removeMeterBannerFlag(){this.localStorage.removeItem(this.COPILOT_METER_BANNER_FLAG)}getQuotaExceededBannerFlag(){let e=this.tempStorage.getItem(this.COPILOT_QUOTA_EXCEEDED_BANNER_FLAG);return null===e?null:"true"===e}setQuotaExceededBannerFlag(e){this.tempStorage.setItem(this.COPILOT_QUOTA_EXCEEDED_BANNER_FLAG,String(e))}removeQuotaExceededBannerFlag(){this.tempStorage.removeItem(this.COPILOT_QUOTA_EXCEEDED_BANNER_FLAG)}getCodingAgentQuotaBannerDismissed(e){if(!e)return!1;let t=`${this.COPILOT_CODING_AGENT_QUOTA_BANNER_DISMISSED_PREFIX}${e}`;return"true"===this.localStorage.getItem(t)}setCodingAgentQuotaBannerDismissed(e){if(!e)return;let t=`${this.COPILOT_CODING_AGENT_QUOTA_BANNER_DISMISSED_PREFIX}${e}`;this.localStorage.setItem(t,"true")}getSkuSuccessBannerFlag(e){return this.getBooleanFlag(this.skuSuccessBannerKey(e))}setSkuSuccessBannerFlag(e,t){this.tempStorage.setItem(this.skuSuccessBannerKey(e),String(t))}removeSkuSuccessBannerFlag(e){this.tempStorage.removeItem(this.skuSuccessBannerKey(e))}getAnimationFlag(){return this.getBooleanFlag(this.COPILOT_ANIMATION_FLAG)}setAnimationFlag(e){this.tempStorage.setItem(this.COPILOT_ANIMATION_FLAG,String(e))}removeAnimationFlag(){this.tempStorage.removeItem(this.COPILOT_ANIMATION_FLAG)}getTracingRequestedFlag(){return"true"===this.localStorage.getItem(this.COPILOT_TRACING_REQUESTED_FLAG)}setTracingRequestedFlag(e){this.localStorage.setItem(this.COPILOT_TRACING_REQUESTED_FLAG,String(e))}getWrapCodeLines(){return"true"===this.localStorage.getItem(this.COPILOT_WRAP_CODE_LINES_KEY)}setWrapCodeLines(e){this.localStorage.setItem(this.COPILOT_WRAP_CODE_LINES_KEY,String(e))}getBooleanFlag(e,t=this.tempStorage){let s=t.getItem(e);return null===s?null:"true"===s}getSpacesMcpBannerDismissalCount(){let e=this.localStorage.getItem(this.COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT);return e?parseInt(e,10):0}setSpacesMcpBannerDismissalCount(e){let t=this.COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT;this.localStorage.setItem(t,e.toString())}getSpacesSourcesTipDismissalCount(){let e=this.localStorage.getItem(this.COPILOT_SPACES_SOURCES_TIP_DISMISSAL_COUNT);return e?parseInt(e,10):0}setSpacesSourcesTipDismissalCount(e){let t=this.COPILOT_SPACES_SOURCES_TIP_DISMISSAL_COUNT;this.localStorage.setItem(t,e.toString())}getSpacesSelectedTab(){return this.localStorage.getItem(this.COPILOT_SPACES_SELECTED_TAB)||"personal"}setSpacesSelectedTab(e){let t=this.COPILOT_SPACES_SELECTED_TAB;this.localStorage.setItem(t,e)}getLastSelectedSpace(){let e=this.localStorage.getItem(this.COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE);if(e)try{return JSON.parse(e)}catch{return}}setLastSelectedSpace(e){let t=this.COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE;void 0===e?this.localStorage.removeItem(t):this.localStorage.setItem(t,JSON.stringify(e))}getActiveMode(){return this.longStorage.getItem(this.COPILOT_ACTIVE_MODE_KEY)}setActiveMode(e){this.longStorage.setItem(this.COPILOT_ACTIVE_MODE_KEY,e)}getLandedOnAgentsView(){return"true"===this.sessionStorage.getItem(this.COPILOT_LANDED_ON_AGENTS_VIEW_KEY)}setLandedOnAgentsView(e){this.sessionStorage.setItem(this.COPILOT_LANDED_ON_AGENTS_VIEW_KEY,String(e))}skuSuccessBannerKey(e){return`COPILOT_${e.toUpperCase()}_SUCCESS_BANNER_FLAG`}retrieveAndValidateRequestIDs(){let e=this.localStorage.getItem(this.COPILOT_MESSAGE_REQUEST_ID_KEY);try{let t=JSON.parse(e||"[]");if(!Array.isArray(t)||0===t.length)return[];return t.filter(e=>"string"==typeof e.messageID&&"string"==typeof e.requestID)}catch{return[]}}addRequestID(e,t){let s=this.retrieveAndValidateRequestIDs(),E=s.findIndex(t=>t.messageID===e);-1!==E&&s.splice(E,1),s.push({messageID:e,requestID:t}),s.length>this.MAX_MESSAGE_REQUEST_ID_STORAGE_COUNT&&s.shift(),this.localStorage.setItem(this.COPILOT_MESSAGE_REQUEST_ID_KEY,JSON.stringify(s))}getRequestID(e){let t=this.retrieveAndValidateRequestIDs().find(t=>t.messageID===e);return t?t.requestID:void 0}}(0,E.Cg)([(0,r.s)(100)],a.prototype,"setSavedMessage",null);let I=new a;function l(e,t){let s,E,r,S=(0,_.c)(7);S[0]!==e?(s=()=>I[e](),S[0]=e,S[1]=s):s=S[1];let[O,o]=(0,i.useState)(s);S[2]!==t?(E=e=>{I[t](e),o(e)},S[2]=t,S[3]=E):E=S[3];let T=E;return S[4]!==O||S[5]!==T?(r=[O,T],S[4]=O,S[5]=T,S[6]=r):r=S[6],r}}}]); //# sourceMappingURL=66231-e6e39ee93d5d7dba-6123cee581cba8e1.js.map