티스토리 수익 글 보기

티스토리 수익 글 보기

“use strict”;(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([[37294],{8891:(e,t,s)=>{s.d(t,{L:()=>BlackbirdPermissionCaches});var a=s(50467),r=s(21067),i=s(96379),o=s(51987);let BlackbirdPermissionCaches=class BlackbirdPermissionCaches{async setupWarmCachesLoop(){(0,r.M3)()&&(BlackbirdPermissionCaches.warmCachesLoopSetup?await BlackbirdPermissionCaches.warm:(BlackbirdPermissionCaches.warmCachesLoopSetup=!0,await this.warmCaches()))}async warmCaches(){let e=54e4;try{let t=await (0,i.lS)(“/search/warm_blackbird_caches”,{headers:{Accept:”application/json”,…(0,o.kt)()}}),s=await t.json();e=new Date(s.userCacheExpiresAt).getTime()-Date.now()-3e4,(isNaN(e)||e<=5)&&(e=3e4)}catch{}BlackbirdPermissionCaches.warmResolve(),setTimeout(()=>{this.warmCaches()},e)}};(0,a._)(BlackbirdPermissionCaches,”warmCachesLoopSetup”,!1),(0,a._)(BlackbirdPermissionCaches,”warmResolve”,void 0),(0,a._)(BlackbirdPermissionCaches,”warm”,new Promise(e=>{BlackbirdPermissionCaches.warmResolve=e}))},14095:(e,t,s)=>{s.d(t,{U1:()=>E,Z2:()=>_});var a=s(50467),r=s(53419),i=s(97665),o=s(97286),n=s(96379),l=s(59014),h=s(25641),u=s(51213),c=s(35247);function _(e,t,s){let a=(0,i.jE)(),_=(0,l.useCallback)(()=>a.invalidateQueries({queryKey:[“copilot-chat”,”entitlement”]}),[a]),{data:E}=(0,o.I)({queryKey:[“copilot-chat”,”entitlement”],queryFn:async()=>{let e=await (0,n.lS)(“/github-copilot/chat/entitlement”);if(!e.ok)throw Error(`Failed to retrieve Copilot chat entitlement (${e.status} on ${e.url})`);return await e.json()},enabled:e===u.mF.LicensedLimited||e===u.mF.LicensedFull&&c.W.premiumRequestQuotasEnabled,placeholderData:{licenseType:e,plan:t,quotas:s},staleTime:3e5}),T=E?.licenseType??e,d=E?.plan??t,S=E?.quotas??s,O=(0,l.useCallback)(t=>{(e===u.mF.LicensedLimited||e===u.mF.LicensedFull&&c.W.premiumRequestQuotasEnabled)&&(c.W.reduceChatQuotaChecks&&T===u.mF.LicensedLimited&&S?.remaining.chatPercentage!==void 0&&S.remaining.chatPercentage>h.fG||T===u.mF.LicensedFull&&S?.remaining.premiumInteractionsPercentage!==void 0&&S.remaining.premiumInteractionsPercentage>h.mF||(_(),(0,r.BI)(“dotcom_chat.activate”,{target:”ENTITLEMENTS_RELOAD”,origin:t})))},[e,_,T,S?.remaining.chatPercentage,S?.remaining.premiumInteractionsPercentage]);return[new CopilotChatEntitlement(T,d,E?.quotas,E?.trial),O]}let CopilotChatEntitlement=class CopilotChatEntitlement{isLicensed(){return this.licenseType&&this.licenseType!==u.mF.Unlicensed}canPurchaseAdditionalQuota(){return this.licenseType!==u.mF.LicensedLimited&&c.W.premiumRequestQuotasEnabled&&(this.plan===u.UH.IndividualPro||this.plan===u.UH.IndividualProPlus)}canUpgradePlan(){return this.licenseType===u.mF.LicensedLimited||c.W.premiumRequestQuotasEnabled&&this.plan===u.UH.IndividualPro}chatQuotaRemaining(){return c.W.premiumRequestQuotasEnabled&&this.quotas?.remaining.chatPercentage!==void 0?this.quotas?.remaining.chatPercentage??0:this.quotas?.remaining.chat??0}premiumInteractionsQuotaRemaining(){return this.quotas?.remaining.premiumInteractionsPercentage??0}eligibleForTrial(){return this.trial?.eligible??!1}constructor(e,t,s,r){(0,a._)(this,”licenseType”,void 0),(0,a._)(this,”plan”,void 0),(0,a._)(this,”quotas”,void 0),(0,a._)(this,”trial”,void 0),this.licenseType=e,this.plan=t,this.quotas=s,this.trial=r}};function E(e){return!!(e&&e!==u.UH.IndividualFree)}},14457:(e,t,s)=>{s.d(t,{d:()=>ApiCache});var a=s(50467);let ApiCache=class ApiCache{async get(…e){let t=e.join(this.separator),s=this.cache.get(t);if(s)return s;{let s=this.fetchFn(…e);return this.cache.set(t,s),(await s).ok||this.cache.delete(t),s}}constructor(e){(0,a._)(this,”separator”,”-!-“),(0,a._)(this,”cache”,new Map),(0,a._)(this,”fetchFn”,void 0),this.fetchFn=e}}},20139:(e,t,s)=>{s.d(t,{k:()=>CopilotChatService});var a=s(50467),r=s(8891),i=s(65411),o=s(25407),n=s(96379),l=s(14457),h=s(25641),u=s(35247),c=s(79064),_=s(57872),E=s(44902),T=s(46062);let d=new Set([“snippet”,”file”,”symbol”,”repository”]);let CopilotChatService=class CopilotChatService{async fetchMCPServers(){let e=await this.makeCAPIRequest(“/mcps”,”GET”);if(!e.ok)throw Error(`Failed to fetch MCP servers: ${e.status}`);return(await e.json()).servers}async fetchThreads(e={}){let t=new URLSearchParams;”string”==typeof e.name&&t.set(“name”,e.name);let s=`/threads?${t.toString()}`,a=await this.makeCAPIRequest(s,”GET”);if(!a.ok)return a;let r=(await a.json()).threads||[];return{status:a.status,ok:!0,payload:r}}async fetchSharedThreads(){let e=await this.makeCAPIRequest(“/threads?shared”,”GET”);if(!e.ok)return e;let t=(await e.json()).threads||[];return{status:e.status,ok:!0,payload:t}}async fetchLatestThread(e){let t=new URLSearchParams;”string”==typeof e&&t.set(“thread_id”,e);let s=await this.makeCAPIRequest(`/threads/latest?${t.toString()}`,”GET”);if(!s.ok)return s;let a=(await s.json()).thread;return{status:s.status,ok:!0,payload:a}}async createThread(e,t){let s={custom_copilot_id:e?.id,custom_copilot_owner:e?.owner,scope_id:t},a=await this.makeCAPIRequest(“/threads”,”POST”,s);if(!a.ok)return a;let r=(await a.json()).thread;return{status:a.status,ok:!0,payload:r}}async deleteThread(e){let t=await this.makeCAPIRequest(`/threads/${e}`,”DELETE”);return t.ok?{status:t.status,ok:!0,payload:null}:t}async deleteAllThreads(e){let t=await this.makeCAPIRequest(“/threads”,”DELETE”,e);return t.ok?{status:t.status,ok:!0,payload:null}:t}async renameThread(e,t){let s=await this.makeCAPIRequest(`/threads/${e}/name`,”PATCH”,{generate:!1,name:t});if(!s.ok)return s;let a=(await s.json()).name||””;return{status:s.status,ok:!0,payload:a}}async clearThread(e){let t=await this.makeCAPIRequest(`/threads/${e}/clear`,”PATCH”);return t.ok?{status:t.status,ok:!0,payload:null}:t}async shareThread(e,t){let s=await this.makeCAPIRequest(`/threads/${e}/share`,”PATCH”,{shared_message_id:t});if(!s.ok)return s;let a=(await s.json()).thread;return{status:s.status,ok:!0,payload:a}}async unshareThread(e){let t=await this.makeCAPIRequest(`/threads/${e}/unshare`,”PATCH”);if(!t.ok)return t;let s=(await t.json()).thread;return{status:t.status,ok:!0,payload:s}}async unshareAllThreads(){let e=await this.makeCAPIRequest(“/threads/unshare”,”POST”);return e.ok?{status:e.status,ok:!0,payload:null}:e}async continueSharedThread(e){let t=await this.makeCAPIRequest(`/shared/${e}/duplicate`,”POST”);return t.ok?{status:200,ok:!0,payload:await t.json()}:t}async generateThreadName(e){let t=await this.makeCAPIRequest(`/threads/${e}/name`,”PATCH”,{generate:!0,name:””});if(!t.ok)return t;let s=(await t.json()).name||””;return{status:t.status,ok:!0,payload:s}}async getSystemPrompt(e){let t=await this.makeCAPIRequest(`/system_prompt/${e}`,”GET”);if(!t.ok)return t;let s=await t.json();return{status:t.status,ok:!0,payload:s}}async listMessages(e){if(this.listMessagesCache?.thread.id===e)return{status:200,ok:!0,payload:this.listMessagesCache};let t=await this.makeCAPIRequest(`/threads/${e}/messages`,”GET”);return this.handleListMessages(t,!0)}async listSharedThreadMessages(e){let t=await this.makeCAPIRequest(`/shared/${e}/messages`,”GET”);return this.handleListMessages(t,!1)}async handleListMessages(e,t){if(!e.ok)if(!(404===e.status&&e.response?.headers.has(“Content-Type”))||”application/json”!==e.response.headers.get(“Content-Type”))return e;else{let t=await e.response.json();return{…e,payload:t}}let s=await e.json();return t&&(Array.isArray(s.messages)&&(s.messages=s.messages.map(e=>(e.references=(0,_.q)(e.references),e))),this.listMessagesCache=s),{status:e.status,ok:!0,payload:s}}async createMessage(e,t,s,a,r,i,o){this.listMessagesCache=void 0;let n=await this.makeCAPIRequest(`/threads/${e}/messages`,”POST”,{content:t,mediaContent:s,intent:a,references:r,currentURL:window.location.href,customInstructions:i,model:o,settings:c.Jt.settings??void 0});if(!n.ok)return n;let l=(await n.json()).message;return{status:n.status,ok:!0,payload:l}}async createMessageStreaming({threadID:e,messageID:t,content:s,mediaContent:a,intent:r,mode:i,references:o,context:n,confirmations:l,customInstructions:h,model:_,customCopilotID:E,parentMessageID:T,tools:d,clientToolResults:O,signal:m,skillOptions:I}){this.listMessagesCache=void 0,E&&(i=”custom-copilots”);let g=u.W.domPageContext&&”immersive”!==i&&”custom-copilots”!==i?function(){let e=(document.querySelector(“main”)||document.body).cloneNode(!0);for(let t of[“script”,”style”,”svg”,”iframe”,”textarea”,”.js-header-wrapper”,”.footer”,”.sr-only”,”.react-code-file-contents”])for(let s of e.querySelectorAll(t))s.remove();for(let t of e.querySelectorAll(“*”)){if(!t.textContent?.trim()){t.remove();continue}let e=window.getComputedStyle(t);(“none”===e.display||”hidden”===e.visibility)&&t.remove()}let t=e.querySelectorAll(“p, h1, h2, h3, h4, li, td, th, blockquote, pre, code:not(pre code)”),s=[];for(let e of t){let t=S(e);t&&s.push(t)}let a=s.join(` `);return(a.length<=16e3?a:`${a.substring(0,16e3)} Content was truncated. Use the API to get full content.`).replace(/\s{2,}/g," ").trim()}():void 0,p={responseMessageID:t,content:s,intent:r,references:o,context:n,currentURL:window.location.href,streaming:!0,confirmations:l,customInstructions:h,model:_,mode:i,settings:c.Jt.settings??void 0,customCopilotID:E?.id,customCopilotOwner:E?.owner,parentMessageID:T,tools:d,clientToolResults:O,mediaContent:a,skillOptions:I,pageContext:g,requestTrace:c.Jt.getTracingRequestedFlag()},C=this.processQueryParams(new URLSearchParams(window.location.search)),A=await this.makeCAPIRequest(`/threads/${e}/messages?${C.toString()}`,"POST",p,!0,void 0,m);return A.ok?{status:A.status,ok:!0,response:A}:A}processQueryParams(e){let t=["instruction_prompt"],s=new URLSearchParams;for(let[a,r]of e)t.includes(a)&&s.append(a,r);return s}async listModels(){let e=await this.makeCAPIRequest("/models","GET",void 0,!1,"");if(!e.ok)return e;let t=await e.json();return{status:e.status,ok:!0,payload:t.data}}async setModelPolicyState(e,t){let s=await this.makeCAPIRequest(`/models/${e}/policy`,"POST",{state:t},!1,"");if(!s.ok)return Promise.reject(Error(`Failed to update model policy state: ${s.status}`))}async getSimpleCompletion(e,t){let s=(0,T.wv)(),a=t??s.id,r=await this.makeCAPIRequest("/chat/completions","POST",{messages:[{role:"user",content:e}],selectedModel:a,stream:!1},!1,"");if(!r.ok)return r;let i=(await r.json()).choices[0]?.message?.content||"";return{status:r.status,ok:!0,payload:i}}async sendFeedback({feedback:e,feedbackChoice:t,messageId:s,threadId:a,textResponse:r}){let i=await this.makeDotcomRequest(`${this.urlPathPrefix}/feedback`,"POST",{feedback:e,feedback_choice:t,message_id:s,thread_id:a,text_response:r});return i.ok?{status:i.status,ok:!0,payload:null}:i}async listRepoFiles(e,t=!1){let s=(0,o.ClY)({repo:e,commitOid:e.commitOID,includeDirectories:t});return this.repoFilesCache.get(s)}async querySymbols(e,t){return await this.blackbirdCaches.setupWarmCachesLoop(),this.querySymbolsCache.get(e.ownerLogin,e.name,t)}async fetchImplicitContext(e,t,s){let a=await this.makeDotcomRequest(`${this.urlPathPrefix}/implicit-context/${t}/${s}/${encodeURIComponent(e)}`,"GET");return a.ok?{status:a.status,ok:a.ok,payload:await a.json()}:a}getCachedRepo(e){return this.repoDetailsCache.get(e)}async fetchRepo(e){let t;if(this.repoDetailsCache.has(e))t=this.repoDetailsCache.get(e);else{let s=await this.makeDotcomRequest(`${this.urlPathPrefix}/repositories/${e}`,"GET");if(!s.ok)return s;t=await s.json(),this.repoDetailsCache.set(e,t)}return{status:200,ok:!0,payload:t}}async fetchFileContents(e,t,s){let a=await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents/${e}/${t}/${s}`,"GET");return a.ok?{status:200,ok:!0,payload:await a.json()}:a}async fetchFileContentsNwo(e,t,s,a){let r;return(r=a?await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents_nwo/${e}/${t}/${a}/${s}`,"GET"):await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents_nwo/${e}/${t}/${s}`,"GET")).ok?{status:200,ok:!0,payload:await r.json()}:r}async listAgents(e){let t=await (0,n.lS)(e);if(!t.ok)return{status:t.status,ok:!1,error:h.nN[t.status]||h.DW};let s=await t.json();return{status:t.status,ok:t.ok,payload:s}}async listCustomCopilots(){let e=await (0,n.lS)(`${this.urlPathPrefix}/custom_copilots`);if(!e.ok)return{status:e.status,ok:!1,error:h.nN[e.status]||h.DW};let t=await e.json();return{status:e.status,ok:!0,payload:t}}async fetchCopilotSpace(e){let t,{owner:s,id:a}=e;t=s?`${this.urlPathPrefix}/custom_copilots/${s}/${a}`:`${this.urlPathPrefix}/custom_copilots/${a}`;let r=await (0,n.lS)(t);if(!r.ok)return{status:r.status,ok:!1,error:h.nN[r.status]||h.DW};let i=await r.json();return{status:r.status,ok:!0,payload:i}}async fetchCustomAgents(e,t){let s=await this.makeCAPIRequest(`/agents/swe/custom-agents/${e}/${t}`,"GET",void 0,void 0,"");if(!s.ok)return 404===s.status?{status:s.status,ok:!0,payload:[]}:{status:s.status,ok:!1,error:h.nN[s.status]||h.DW};let a=(await s.json()).agents;return{status:s.status,ok:!0,payload:a}}async hydrateReference(e){if(!d.has(e.type))return{status:204,ok:!0,payload:e};let t=await this.makeDotcomRequest(`${this.urlPathPrefix}/reference_details`,"POST",{reference:e});return t.ok?{status:t.status,ok:t.ok,payload:await t.json()}:t}async fetchLanguageForFileReference(e){let{repoOwner:t,repoName:s}=e,a=window.btoa(e.path),r=(0,o.RT3)({ownerLogin:t,name:s},a,!0),i=await this.makeDotcomRequest(r,"GET");return i.ok?{status:i.status,ok:i.ok,payload:await i.json()}:i}async fetchAutocompleteIssues(e,t){let s=await this.makeDotcomRequest(`/copilot/chat/autocomplete/issues?repo=${e}&q=${t}`,"GET");return s.ok?await s.json():[]}async fetchAutocompletePullRequests(e,t){let s=await this.makeDotcomRequest(`/copilot/chat/autocomplete/pulls?repo=${e}&q=${t}`,"GET");return s.ok?await s.json():[]}async fetchAutocompleteDiscussions(e,t){let s=await this.makeDotcomRequest(`/copilot/chat/autocomplete/discussions?repo=${e}&q=${t}`,"GET");return s.ok?await s.json():[]}async makeDotcomRequest(e,t,s){let a={};for(let e of(0,E.f)()){let t=e.split("="),s=t[0]?.replaceAll("_","-"),r="1";t.length>1&&(r=t[1]),a[`X-Experiment-${s}`]=r}let r=await this.copilotAuthTokenProvider.getAuthToken();a[“X-Copilot-Api-Token”]=r.value;try{let r=await (0,n.lS)(e,{method:t,body:s,headers:a});if(r.ok)return r;return{status:r.status,ok:!1,error:h.nN[r.status]||h.DW}}catch{return{status:500,ok:!1,error:h.DW}}}get directConnectConfiguration(){return{integrationID:”copilot-chat”}}async makeCAPIRequest(e,t,s,a=!1,r=”/github/chat”,i){let o=this.apiURL,n=await this.copilotAuthTokenProvider.getAuthToken();return await (0,h.p)({basePath:o+r,path:e,method:t,body:s,streamingResponse:a,authToken:n,integrationId:this.directConnectConfiguration.integrationID,realIp:this.realIp,signal:i,apiVersion:this.apiVersion})}async fetchTracesByThreadID(e,t){let s=`/thread/${e}`;t&&(s+=`?sharedID=${encodeURIComponent(t)}`);let a=await this.makeCAPIRequest(s,”GET”,void 0,!1,”/traces”);if(!a.ok)return a;let r=await this.processTracesResponse(a);return{status:a.status,ok:!0,payload:r}}async fetchCoffeTrace(e){let t=await this.makeCAPIRequest(`/evaluation/thread/${e}`,”GET”,void 0,!1,”/traces”);if(!t.ok)return t;let s=await this.processTracesResponse(t);return{status:t.status,ok:!0,payload:s}}async processTracesResponse(e){let t=await e.json(),s=[];for(let e of t)e.spans&&Array.isArray(e.spans)&&e.id&&s.push({id:e.id,spans:e.spans});return s}async deleteTrace(e,t){let s=await this.makeCAPIRequest(`/thread/${e}/trace/${t}`,”DELETE”,void 0,!1,”/traces”);return s.ok?{status:s.status,ok:!0,payload:null}:s}async deleteTracesForThread(e){let t=await this.makeCAPIRequest(`/thread/${e}`,”DELETE”,void 0,!1,”/traces”);return t.ok?{status:t.status,ok:!0,payload:null}:t}constructor(e,t,s,o){(0,a._)(this,”apiURL”,void 0),(0,a._)(this,”urlPathPrefix”,”/github-copilot/chat”),(0,a._)(this,”repoDetailsCache”,new Map),(0,a._)(this,”listMessagesCache”,void 0),(0,a._)(this,”copilotAuthTokenProvider”,void 0),(0,a._)(this,”blackbirdCaches”,new r.L),(0,a._)(this,”realIp”,void 0),(0,a._)(this,”apiVersion”,void 0),(0,a._)(this,”listRepoFilesImpl”,async e=>{let t=await this.makeDotcomRequest(e,”GET”);return t.ok?{status:200,ok:!0,payload:await t.json()}:t}),(0,a._)(this,”repoFilesCache”,new l.d(this.listRepoFilesImpl)),(0,a._)(this,”querySymbolsImpl”,async(e,t,s)=>{let a=await this.makeDotcomRequest(`/search/suggestions?query=repo:${e}/${t} ${s}`,”GET”);return a.ok?{status:200,ok:!0,payload:(await a.json()).suggestions.filter(e=>”SUGGESTION_KIND_SYMBOL”===e.kind)}:a}),(0,a._)(this,”querySymbolsCache”,new l.d(this.querySymbolsImpl)),this.apiURL=e,this.copilotAuthTokenProvider=new i.JR(t.map(e=>e.id)),this.realIp=s||””,this.apiVersion=o}};let S=e=>{let t=e.tagName.toLowerCase(),s=e.textContent;if(!s||!s.trim())return null;let a=s.trim();switch(t){case”h1″:return`# ${a}`;case”h2″:return`## ${a}`;case”h3″:return`### ${a}`;case”h4″:return`#### ${a}`;case”p”:default:return a;case”li”:return`\u{2022} ${a}`;case”code”:return`\`${a}\“;case”pre”:return`\`\`\` ${a} \`\`\“;case”blockquote”:return`> ${a}`}}},33535:(e,t,s)=>{s.d(t,{AI:()=>i,HN:()=>u,R:()=>n,Rs:()=>h,Sk:()=>_,XG:()=>o,tQ:()=>c});var a=s(59014),r=s(49835);function i(e){let[t]=(0,a.useState)(()=>new r.Lj(e));return t}function o(e){let t=(0,a.useRef)(null);null===t.current&&(t.current=new r.Lj(e));let s=(0,a.useCallback)(e=>{null!==t.current&&(t.current.value=e)},[]);return[t,s]}function n(…e){let[t]=(0,a.useState)(()=>new r.Es(…e));return t}let l=Symbol(“no value”);function h(e,t){let s=(0,a.useRef)(e.value),r=(0,a.useRef)(t);(0,a.useEffect)(()=>{r.current=t}),(0,a.useEffect)(()=>(s.current!==l&&s.current!==e.value&&(r.current(e.value),s.current=l),e.subscribe(e=>r.current(e))),[e])}function u(e){let[t,s]=(0,a.useState)(e.value);return h(e,e=>s(e)),t}function c(e){let[t,s]=(0,a.useState)(e.value),[r,i]=(0,a.useState)({});return h(e,e=>{s(e),i({})}),t}function _(e,t){let s=i(t(e.value));return h(e,e=>{s.value=t(e)}),s}},37294:(e,t,s)=>{s.d(t,{hh:()=>d,jR:()=>O,Kf:()=>S});var a=s(28278),r=s(21728),i=s(33535),o=s(88431),n=s(59014),l=s(60803),h=s(60460);let u=new Map,c=new Set;function _(e,t){switch(t.type){case”SET_TRACE_INFO”:{let{visible:s,spanNode:a,messageId:r,threadId:i,actualTraceId:o,traces:n}=t.traceInfo,l=e.traceInfo?.traces||u,h=e.traceInfo?.loadedThreadIds||c;if(n&&n.size>0){let e=new Map(l);for(let[t,s]of n)e.set(t,s);l=e}else if(a&&r&&i){let e=new Map(l),t=new Date(a.startTime).toISOString();e.set(r,{spanNode:a,threadId:i,actualTraceId:o||””,timestamp:t}),l=e}if(i&&!h.has(i)){let e=new Set(h);e.add(i),h=e}let _=void 0!==s?s:e.traceInfo?.visible||!1;return{…e,traceInfo:{visible:_,traces:l,loadedThreadIds:h}}}case”REMOVE_TRACE”:{let s=new Map(e.traceInfo?.traces||[]);for(let[e,a]of s)if(a.actualTraceId===t.traceID){s.delete(e);break}return{…e,traceInfo:{visible:e.traceInfo?.visible||!1,traces:s,loadedThreadIds:e.traceInfo?.loadedThreadIds||new Set}}}case”REMOVE_TRACES_FOR_THREAD”:{let s=new Map(e.traceInfo?.traces||[]);for(let[e,a]of s)a.threadId===t.threadID&&s.delete(e);return{…e,traceInfo:{visible:e.traceInfo?.visible||!1,traces:s,loadedThreadIds:e.traceInfo?.loadedThreadIds||new Set}}}}}let E=(0,n.createContext)(null),T=(0,n.createContext)(null);function d(e){let t,s,u,c,d,S,O=(0,r.c)(20),{apiURL:m,children:I,ssoOrgs:g,testReducerState:p}=e;O[0]!==p?(t=p||{},O[0]=p,O[1]=t):t=O[1];let C=t,[A,P]=(0,n.useReducer)(_,C),[L,R]=(0,i.XG)(A);return O[2]!==R||O[3]!==A||O[4]!==L.current.value?(s=()=>{A!==L.current.value&&R(A)},O[2]=R,O[3]=A,O[4]=L.current.value,O[5]=s):s=O[5],O[6]!==R||O[7]!==A||O[8]!==L?(u=[A,L,R],O[6]=R,O[7]=A,O[8]=L,O[9]=u):u=O[9],(0,o.N)(s,u),O[10]!==m||O[11]!==I||O[12]!==g?(c=(0,a.jsx)(h.Q,{apiURL:m,dispatch:P,ssoOrgs:g,children:I}),O[10]=m,O[11]=I,O[12]=g,O[13]=c):c=O[13],O[14]!==L||O[15]!==c?(d=(0,a.jsx)(T.Provider,{value:P,children:(0,a.jsx)(l.n,{value:L,children:c})}),O[14]=L,O[15]=c,O[16]=d):d=O[16],O[17]!==A||O[18]!==d?(S=(0,a.jsx)(E.Provider,{value:A,children:d}),O[17]=A,O[18]=d,O[19]=S):S=O[19],S}function S(){let e=(0,n.useContext)(E);if(!e)throw Error(“useTraceState must be used within a TraceContext”);return e}function O(){return(0,n.useContext)(T)}try{E.displayName||(E.displayName=”TraceStateContext”)}catch{}try{T.displayName||(T.displayName=”TraceDispatchContext”)}catch{}try{d.displayName||(d.displayName=”TraceProvider”)}catch{}},46062:(e,t,s)=>{s.d(t,{GF:()=>u,QA:()=>l,ZL:()=>T,eW:()=>_,fZ:()=>c,wv:()=>h});var a=s(79184),r=s(51213),i=s(35247);let o=”/images/modules/marketplace/models/families/openai.svg”,n=new Map([[“Azure OpenAI”,o],[“OpenAI”,o],[“Anthropic”,”/images/modules/marketplace/models/families/anthropic.svg”],[“Google”,”/images/modules/marketplace/models/families/gemini.svg”],[“xAI”,”/images/modules/marketplace/models/families/xai.svg”]]),l=”copilot-base”;function h(){return{capabilities:{family:”gpt-4.1″,limits:{max_prompt_tokens:128e3,vision:{supported_media_types:[“image/jpeg”,”image/png”,”image/webp”,”image/gif”]}},supports:{parallel_tool_calls:!0,tool_calls:!0},tokenizer:”o200k_base”,type:”chat”},id:”gpt-4.1″,name:”GPT-4.1″,displayName:”GPT-4.1″,model_picker_enabled:!0,preview:!1,vendor:”OpenAI”,logoURL:o,isThirdParty:!1,hasLimitedCapabilities:!1,version:”gpt-4.1-2025-04-14″}}function u(e){let{plan:t,premiumInteractionsQuotaExceeded:s,overagesEnabled:r}=(0,a.xR)();return c(e,t,s,r)}function c(e,t,s,a){var n,l;let u;return i.W.forceLegacyChatDefaultModel?{capabilities:{family:”gpt-4o”,limits:{max_prompt_tokens:2e4,vision:{supported_media_types:[“image/jpeg”,”image/png”,”image/webp”,”image/gif”]}},supports:{parallel_tool_calls:!0,tool_calls:!0},tokenizer:”o200k_base”,type:”chat”},id:”gpt-4o”,name:”GPT 4o”,version:”gpt-4o-2024-05-13″,displayName:”GPT 4o”,vendor:”Azure OpenAI”,logoURL:o,hasLimitedCapabilities:!1,preview:!1,isThirdParty:!1,model_picker_enabled:!0}:(n=!!s,l=!!a,(u=i.W.premiumRequestQuotasEnabled&&t!==r.UH.IndividualFree&&n&&!l?e?.find(e=>!0===e.is_chat_fallback):e?.find(e=>!0===e.is_chat_default))||h())}function _(e){return(e??[h()]).map(E).filter(e=>!!e).filter(e=>e.model_picker_enabled)}function E(e){var t,s,a;if(“chat”!==e.capabilities.type||!((t=e).model_picker_enabled&&(!t.policy||”enabled”===t.policy.state||t.policy.terms)))return null;let r=n.get(e.vendor);return”xAI”===e.vendor&&null!==document.querySelector(‘[data-color-mode=”dark”]’)&&(r=”/images/modules/marketplace/models/families/xai-dark.svg”),{…e,displayName:function(e){for(let t of d)if(e.name.endsWith(t))return e.name.replace(t,””).trim();return e.name}(e),hasLimitedCapabilities:(s=e,a=i.W.copilotChatO1Tools,”o1-ga”===s.capabilities.family?!a:”o3″===s.capabilities.family||!s.capabilities.supports.tool_calls),isThirdParty:”Azure OpenAI”!==e.vendor,logoURL:r}}function T(e){return null!=e.custom_model}let d=[“(Beta)”,”(Preview)”]},49835:(e,t,s)=>{s.d(t,{Es:()=>ObservableMap,Lj:()=>ObservableValue,yy:()=>ObservableSet});var a=s(35750),r=s(18150),i=s(85242),o=new WeakMap;let n=class ObservableBase{subscribe(e){return(0,a._)(this,o).add(e),()=>{(0,a._)(this,o).delete(e)}}notify(e){for(let t of(0,a._)(this,o))t(e)}constructor(){(0,r._)(this,o,{writable:!0,value:new Set})}};var l=new WeakMap;let ObservableValue=class ObservableValue extends n{get value(){return(0,a._)(this,l)}set value(e){var t,s;t=(0,a._)(this,l),(“object”==typeof(s=e)&&s&&”object”==typeof t&&t?function(e,t){for(let s of new Set(Object.keys(e).concat(Object.keys(t))))if(!Object.is(e[s],t[s]))return!0;return!1}(t,s):!Object.is(t,s))&&((0,i._)(this,l,e),this.notify(e))}setValue(e){this.value=e}constructor(e){super(),(0,r._)(this,l,{writable:!0,value:void 0}),(0,i._)(this,l,e)}};var h=new WeakMap,u=new WeakMap;let ObservableSet=class ObservableSet extends n{get value(){return(0,a._)(this,h)}has(e){if(!(0,a._)(this,u).has(e)){let t=new ObservableValue((0,a._)(this,h).has(e));(0,a._)(this,u).set(e,t)}return(0,a._)(this,u).get(e)}add(e){(0,a._)(this,h).has(e)||((0,a._)(this,h).add(e),(0,a._)(this,u).has(e)&&((0,a._)(this,u).get(e).value=!0),this.notify((0,a._)(this,h)))}delete(e){(0,a._)(this,h).has(e)&&((0,a._)(this,h).delete(e),(0,a._)(this,u).has(e)&&((0,a._)(this,u).get(e).value=!1),this.notify((0,a._)(this,h)))}clear(){if(0!==(0,a._)(this,h).size){for(let e of((0,a._)(this,h).clear(),(0,a._)(this,u).values()))e.value=!1;this.notify((0,a._)(this,h))}}constructor(…e){super(),(0,r._)(this,h,{writable:!0,value:void 0}),(0,r._)(this,u,{writable:!0,value:new Map}),(0,i._)(this,h,new Set(…e))}};var c=new WeakMap,_=new WeakMap,E=new WeakMap;let ObservableMap=class ObservableMap extends n{get value(){return(0,a._)(this,c)}has(e){if(!(0,a._)(this,_).has(e)){let t=new ObservableValue((0,a._)(this,c).has(e));(0,a._)(this,_).set(e,t)}return(0,a._)(this,_).get(e)}get(e){if(!(0,a._)(this,E).has(e)){let t=new ObservableValue((0,a._)(this,c).get(e));(0,a._)(this,E).set(e,t)}return(0,a._)(this,E).get(e)}set(e,t){(0,a._)(this,c).get(e)!==t&&((0,a._)(this,c).set(e,t),(0,a._)(this,_).has(e)&&((0,a._)(this,_).get(e).value=!0),(0,a._)(this,E).has(e)&&((0,a._)(this,E).get(e).value=t),this.notify((0,a._)(this,c)))}delete(e){(0,a._)(this,c).has(e)&&((0,a._)(this,c).delete(e),(0,a._)(this,_).has(e)&&((0,a._)(this,_).get(e).value=!1),(0,a._)(this,E).has(e)&&((0,a._)(this,E).get(e).value=void 0),this.notify((0,a._)(this,c)))}clear(){if(0!==(0,a._)(this,c).size){for(let e of((0,a._)(this,c).clear(),(0,a._)(this,_).values()))e.value=!1;for(let e of(0,a._)(this,E).values())e.value=void 0;this.notify((0,a._)(this,c))}}constructor(…e){super(),(0,r._)(this,c,{writable:!0,value:void 0}),(0,r._)(this,_,{writable:!0,value:new Map}),(0,r._)(this,E,{writable:!0,value:new Map}),(0,i._)(this,c,new Map(…e))}}},57872:(e,t,s)=>{s.d(t,{q:()=>a});function a(e){return Array.isArray(e)?e.filter(e=>!(“refOrigin”in e&&”custom_copilot”===e.refOrigin)&&!(“type”in e&&”custom-instructions”===e.type)):e}},60460:(e,t,s)=>{s.d(t,{Q:()=>E,y:()=>T});var a=s(28278),r=s(21728),i=s(59014),o=s(60803),n=s(50467),l=s(82518),h=s(20139),u=s(35247),c=s(63828);let TraceManager=class TraceManager{async fetchAndLoadTraces(e,t){if(!u.W.requestTracing||!(0,l.Xl)())return;let s=this.getTraceState();if(!s.traceInfo?.loadedThreadIds?.has(e))try{let a=await this.service.fetchTracesByThreadID(e,t);a.ok&&a.payload.length>0?this.addTracesToState(s,a,e):this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{threadId:e}})}catch{}}addTracesToState(e,t,s){let a=new Map(e.traceInfo?.traces||[]);for(let e of t.payload)for(let[,t]of(0,c.r)(e.spans).entries()){let r=new Date(t.startTime).toISOString(),i=`${s}:${r}`;a.set(i,{spanNode:t,threadId:s,actualTraceId:e.id,timestamp:r})}this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{traces:a,threadId:s}})}async fetchCoffeTrace(e){if(!u.W.requestTracing||!(0,l.Xl)())return{ok:!1,status:403,error:”Tracing not available”};let t=this.getTraceState(),s=await this.service.fetchCoffeTrace(e);if(s.ok&&s.payload.length>0)return this.addTracesToState(t,s,e),s;throw Error(`Failed to load COFFE trace: ${s.status}`)}async deleteTraceSpansForGivenThread(e){let t=await this.service.deleteTracesForThread(e);return t.ok&&this.dispatch({type:”REMOVE_TRACES_FOR_THREAD”,threadID:e}),t}async deleteTrace(e,t){let s=await this.service.deleteTrace(e,t);return s.ok&&this.dispatch({type:”REMOVE_TRACE”,traceID:t}),s}constructor(e,t,s,a){(0,n._)(this,”dispatch”,void 0),(0,n._)(this,”service”,void 0),(0,n._)(this,”getTraceState”,void 0),(0,n._)(this,”showTraceDisplay”,async(e,t)=>{e&&t&&await this.fetchAndLoadTraces(t),this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{visible:e,threadId:t??void 0}})}),this.dispatch=e,this.service=new h.k(s,a),this.getTraceState=t}};let _=(0,i.createContext)(null);function E(e){let t,s,i=(0,r.c)(8),{apiURL:n,children:l,dispatch:h,ssoOrgs:u}=e,c=(0,o.c)();i[0]!==n||i[1]!==h||i[2]!==c||i[3]!==u?(t=new TraceManager(h,c,n,u),i[0]=n,i[1]=h,i[2]=c,i[3]=u,i[4]=t):t=i[4];let E=t;return i[5]!==l||i[6]!==E?(s=(0,a.jsx)(_.Provider,{value:E,children:l}),i[5]=l,i[6]=E,i[7]=s):s=i[7],s}function T(){let e=(0,i.useContext)(_);if(null===e)throw Error(“useTraceManager must be used within a TraceManagerProvider”);return e}try{_.displayName||(_.displayName=”TraceManagerContext”)}catch{}try{E.displayName||(E.displayName=”TraceManagerProvider”)}catch{}},60803:(e,t,s)=>{s.d(t,{c:()=>o,n:()=>i});var a=s(59014);let r=(0,a.createContext)(null),i=r.Provider;function o(){let e=(0,a.useContext)(r);if(!e||!e.current)throw Error(“useGetTraceState can only be used inside a TraceProvider”);return(0,a.useCallback)(()=>e.current.value,[e])}try{r.displayName||(r.displayName=”ObservableTraceStateContext”)}catch{}},63828:(e,t,s)=>{s.d(t,{r:()=>a});function a(e){let t=new Map,s=[];return e.map(e=>{let a={name:e.name,spanId:e.spanId,attributes:e.attributes,startTime:e.startTime,endTime:e.endTime,children:[],sessionId:e.sessionId,userId:e.userId,input:e.input,output:e.output,metadata:e.metadata};t.set(a.spanId,a);let r=e.parentId&&t.get(e.parentId);return r?r.children.push(a):s.push(a),a}),s}},65411:(e,t,s)=>{s.d(t,{JR:()=>CopilotAuthTokenProvider,UZ:()=>n,yj:()=>CopilotAuthTokenUnlicensedError});var a=s(50467),r=s(65620),i=s(82075),o=s(96379);let n=”COPILOT_AUTH_TOKEN”;let CopilotAuthTokenProvider=class CopilotAuthTokenProvider{async getAuthToken(){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?r.Y.deserialize(JSON.parse(e)):null}removeLocalStorageAuthToken(){this.copilotLocalStorage.removeItem(this.storageKey)}async validateAuthToken(e){return e.needsRefreshing(this.ssoOrgIDs)?this.fetchAuthToken():e}fetchAuthToken(){return this.currentAuthTokenRequest||(this.currentAuthTokenRequest=this._fetchAuthToken()),this.currentAuthTokenRequest}async _fetchAuthToken(){try{let e=await (0,o.lS)(this.tokenEndpoint,{method:”POST”});if(e.ok){let t=await e.json(),s=r.Y.fromResult(t,this.ssoOrgIDs);return this.ssoOrgIDs=s.ssoOrgIDs,this.setLocalStorageAuthToken(s),s}if(404===e.status)throw new CopilotAuthTokenUnlicensedError(“Copilot auth token endpoint not found (404)”);throw Error(“Failed to mint new auth token”)}finally{this.currentAuthTokenRequest=null}}constructor(e,t=”/github-copilot/chat/token”,s=n){(0,a._)(this,”tokenEndpoint”,void 0),(0,a._)(this,”storageKey”,void 0),(0,a._)(this,”ssoOrgIDs”,void 0),(0,a._)(this,”currentAuthTokenRequest”,void 0),(0,a._)(this,”copilotLocalStorage”,void 0),this.ssoOrgIDs=e,this.currentAuthTokenRequest=null,this.copilotLocalStorage=(0,i.A)(“localStorage”,{throwQuotaErrorsOnSet:!1,ttl:864e5}),this.storageKey=s,this.tokenEndpoint=t}};let CopilotAuthTokenUnlicensedError=class CopilotAuthTokenUnlicensedError extends Error{constructor(e){super(e),this.name=”CopilotAuthTokenUnlicensedError”}}},65620:(e,t,s)=>{s.d(t,{Y:()=>AuthToken});var a=s(50467);let AuthToken=class AuthToken{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 AuthToken(e.token,e.expiration,e.ssoOrgIDs??t)}serialize(){return{value:this.value,expiration:this.expiration,ssoOrgIDs:this.ssoOrgIDs}}static deserialize(e){return new AuthToken(e.value,e.expiration,e.ssoOrgIDs)}constructor(e,t,s){(0,a._)(this,”value”,void 0),(0,a._)(this,”expiration”,void 0),(0,a._)(this,”ssoOrgIDs”,void 0),this.value=e,this.expiration=t,this.ssoOrgIDs=s}}},79064:(e,t,s)=>{s.d(t,{Jt:()=>_,iI:()=>E});var a=s(50467),r=s(31635),i=s(21728),o=s(45062),n=s(65411),l=s(82075),h=s(59014),u=s(25641),c=s(35247);let CopilotLocalStorage=class CopilotLocalStorage{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){this.mediumStorage.setItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(e),JSON.stringify(t)),e&&this.mediumStorage.setItem(this.COPILOT_SELECTED_MODEL_STORAGE_KEY(null),JSON.stringify(t))}checkAndClearModelSelection(){this.lastCheckedModelVersion=this.CURRENT_MODEL_STORAGE_VERSION,c.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){return this.localStorage.getItem(this.COPILOT_SAVED_USER_MESSAGE_KEY(e))}setSavedMessage(e,t){this.setSavedMessageFast(e,t)}setSavedMessageFast(e,t){let s=this.COPILOT_SAVED_USER_MESSAGE_KEY(e);null==t?this.localStorage.removeItem(s):this.localStorage.setItem(s,t)}clearSavedUserMessage(e){this.localStorage.removeItem(this.COPILOT_SAVED_USER_MESSAGE_KEY(e))}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?{message:t.message,references:t.references,model:t.model,mediaContent:t.mediaContent}:null}clearEntrypointMessage(e){this.localStorage.removeItem(this.COPILOT_ENTRYPOINT_MESSAGE_KEY(e))}setEntrypointMessage({message:e,references:t,model:s,mediaContent:a,threadID:r}){this.setEntrypointMessageImpl({message:e,references:t,model:s,mediaContent:a,key:this.COPILOT_ENTRYPOINT_MESSAGE_KEY(r)})}setEntrypointMessageImpl({message:e,references:t,model:s,mediaContent:a,key:r}){null==e?this.localStorage.removeItem(r):this.localStorage.setItem(r,JSON.stringify({message:e,references:t,model:s,mediaContent:a}))}getTaskEntrypointMessage(){return this.getEntrypointMessageImpl(this.COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY)}setTaskEntrypointMessage(e,t){this.setEntrypointMessageImpl({message:e,references:t,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),a=t.filter((e,s)=>s===t.findIndex(t=>(0,u.Vb)(e)===(0,u.Vb)(t)));this.localStorage.setItem(s,JSON.stringify(a))}clearCurrentReferences(e){let t=this.COPILOT_CURRENT_REFERENCES_KEY(e);this.localStorage.removeItem(t)}migrateNullThreadToNewThread(e){let t=this.getSavedMessage(null);this.setSavedMessageFast(null,null),t&&this.setSavedMessageFast(e,t);let s=this.getCurrentReferences(null);this.clearCurrentReferences(null),s&&this.setCurrentReferences(e,s);let a=this.settings;a&&this.localStorage.setItem(this.COPILOT_SETTINGS_STORAGE_KEY(e),JSON.stringify(a)),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(n.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)}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())}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(),a=s.findIndex(t=>t.messageID===e);-1!==a&&s.splice(a,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}constructor(){(0,a._)(this,”COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY”,”COPILOT_REPO_CUSTOM_INSTRUCTIONS_STATE_KEY”),(0,a._)(this,”COPILOT_SELECTED_THREAD_ID_STORAGE_KEY”,”COPILOT_SELECTED_THREAD_ID_STORAGE_KEY”),(0,a._)(this,”COPILOT_COLLAPSED_STATE_KEY”,”COPILOT_COLLAPSED_STATE_KEY”),(0,a._)(this,”COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY”,”COPILOT_IMMERSIVE_SIDEBAR_COLLAPSED_STATE_KEY”),(0,a._)(this,”COPILOT_PANEL_HEIGHT”,”COPILOT_PANEL_HEIGHT”),(0,a._)(this,”DEFAULT_PANEL_HEIGHT”,600),(0,a._)(this,”COPILOT_PANEL_WIDTH”,”COPILOT_PANEL_WIDTH”),(0,a._)(this,”COPILOT_ENTRYPOINT_MESSAGE_KEY”,e=>e?`COPILOT_ENTRYPOINT_MESSAGE_KEY_${e}`:”COPILOT_ENTRYPOINT_MESSAGE_KEY”),(0,a._)(this,”COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY”,”COPILOT_TASK_ENTRYPOINT_MESSAGE_KEY”),(0,a._)(this,”COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY”,”COPILOT_LOOP_ENTRYPOINT_MESSAGE_KEY”),(0,a._)(this,”COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY”,”COPILOT_SPARK_ENTRYPOINT_MESSAGE_KEY”),(0,a._)(this,”COPILOT_MESSAGE_REQUEST_ID_KEY”,”COPILOT_MESSAGE_REQUEST_ID_KEY”),(0,a._)(this,”COPILOT_METER_BANNER_FLAG”,”COPILOT_METER_BANNER_FLAG”),(0,a._)(this,”COPILOT_QUOTA_EXCEEDED_BANNER_FLAG”,”COPILOT_QUOTA_EXCEEDED_BANNER_FLAG”),(0,a._)(this,”COPILOT_ANIMATION_FLAG”,”COPILOT_ANIMATION_FLAG”),(0,a._)(this,”COPILOT_WRAP_CODE_LINES_KEY”,”COPILOT_WRAP_CODE_LINES_KEY”),(0,a._)(this,”COPILOT_TRACING_REQUESTED_FLAG”,”COPILOT_TRACING_REQUESTED_FLAG”),(0,a._)(this,”COPILOT_DIFF_REFERENCES_KEY”,”COPILOT_DIFF_REFERENCES_KEY”),(0,a._)(this,”COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT”,”COPILOT_SPACES_MCP_BANNER_DISMISSAL_COUNT”),(0,a._)(this,”COPILOT_SPACES_SELECTED_TAB”,”COPILOT_SPACES_SELECTED_TAB”),(0,a._)(this,”COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE”,”COPILOT_SPACES_SELECTION_MENU_LAST_SELECTED_SPACE”),(0,a._)(this,”COPILOT_LAST_USED_REPOSITORY_KEY”,”COPILOT_LAST_USED_REPOSITORY_KEY”),(0,a._)(this,”COPILOT_ACTIVE_MODE_KEY”,”COPILOT_ACTIVE_MODE_KEY”),(0,a._)(this,”COPILOT_SELECTED_MODEL_VERSION_KEY”,”COPILOT_SELECTED_MODEL_VERSION”),(0,a._)(this,”COPILOT_LANDED_ON_AGENTS_VIEW_KEY”,”COPILOT_LANDED_ON_AGENTS_VIEW_KEY”),(0,a._)(this,”lastCheckedModelVersion”,null),(0,a._)(this,”MAX_MESSAGE_REQUEST_ID_STORAGE_COUNT”,100),(0,a._)(this,”DEFAULT_PANEL_WIDTH”,480),(0,a._)(this,”CURRENT_MODEL_STORAGE_VERSION”,”4″),(0,a._)(this,”COPILOT_SELECTED_MODEL_STORAGE_KEY”,e=>`COPILOT_SELECTED_MODEL_${e}`),(0,a._)(this,”COPILOT_SETTINGS_STORAGE_KEY”,e=>`COPILOT_SETTINGS_${e}`),(0,a._)(this,”COPILOT_SAVED_USER_MESSAGE_KEY”,e=>`COPILOT_SAVED_USER_MESSAGE_${e}`),(0,a._)(this,”COPILOT_SAVED_USER_MESSAGE_ON_ERROR_KEY”,e=>`COPILOT_SAVED_USER_MESSAGE_ON_ERROR_${e}`),(0,a._)(this,”COPILOT_CURRENT_REFERENCES_KEY”,e=>`COPILOT_CURRENT_REFERENCES_${e}`),(0,a._)(this,”COPILOT_SELECTED_TOPIC_STORAGE_KEY”,e=>`COPILOT_SELECTED_TOPIC_${e}`),(0,a._)(this,”localStorage”,(0,l.A)(“localStorage”,{throwQuotaErrorsOnSet:!1,ttl:864e5})),(0,a._)(this,”mediumStorage”,(0,l.A)(“localStorage”,{throwQuotaErrorsOnSet:!1,ttl:24192e5})),(0,a._)(this,”longStorage”,(0,l.A)(“localStorage”,{throwQuotaErrorsOnSet:!1})),(0,a._)(this,”tempStorage”,(0,l.A)(“localStorage”,{throwQuotaErrorsOnSet:!1,ttl:18e5})),(0,a._)(this,”sessionStorage”,(0,l.A)(“sessionStorage”,{throwQuotaErrorsOnSet:!1,ttl:864e5}))}};(0,r.Cg)([(0,o.s)(100)],CopilotLocalStorage.prototype,”setSavedMessage”,null);let _=new CopilotLocalStorage;function E(e,t){let s,a,r,o=(0,i.c)(7);o[0]!==e?(s=()=>_[e](),o[0]=e,o[1]=s):s=o[1];let[n,l]=(0,h.useState)(s);o[2]!==t?(a=e=>{_[t](e),l(e)},o[2]=t,o[3]=a):a=o[3];let u=a;return o[4]!==n||o[5]!==u?(r=[n,u],o[4]=n,o[5]=u,o[6]=r):r=o[6],r}},79184:(e,t,s)=>{s.d(t,{$d:()=>c,xR:()=>_});var a=s(28278),r=s(21728),i=s(69599),o=s(59014),n=s(14095),l=s(51213),h=s(35247);let u=(0,o.createContext)(void 0);function c(e){let t,s,o,c,_,E,T,d,S,O=(0,r.c)(30),{children:m,initialLicenseType:I,initialPlan:g,initialQuotas:p}=e,[C,A]=(0,n.Z2)(I,g,p),P=C.licenseType,L=C.plan??null;O[0]!==C?(t=C.chatQuotaRemaining()??1/0,O[0]=C,O[1]=t):t=O[1];let R=t;O[2]!==C?(s=C.premiumInteractionsQuotaRemaining()??1/0,O[2]=C,O[3]=s):s=O[3];let f=s;O[4]!==C.quotas?(o=C.quotas?.resetDate?new Date(C.quotas.resetDate).toLocaleDateString(“en-US”,{year:”numeric”,month:”long”,day:”numeric”}):””,O[4]=C.quotas,O[5]=o):o=O[5];let y=o;O[6]===Symbol.for(“react.memo_cache_sentinel”)?(c=(0,i.G7)(“copilot_simulate_quota_exceeded”),O[6]=c):c=O[6];let k=c,v=k||P===l.mF.LicensedLimited;O[7]!==C?(_=C.canPurchaseAdditionalQuota(),O[7]=C,O[8]=_):_=O[8];let N=_;O[9]!==C?(E=C.canUpgradePlan(),O[9]=C,O[10]=E):E=O[10];let w=E,D=k||v&&R<=0,M=h.W.premiumRequestQuotasEnabled&&f<=0,b=C.quotas?.overagesEnabled??!1;O[11]!==C?(T=C.eligibleForTrial(),O[11]=C,O[12]=T):T=O[12];let G=T;O[13]!==N||O[14]!==w||O[15]!==D||O[16]!==R||O[17]!==G||O[18]!==v||O[19]!==P||O[20]!==b||O[21]!==L||O[22]!==f||O[23]!==M||O[24]!==A||O[25]!==y?(d={licenseType:P,chatQuotaRemaining:R,premiumChatQuotaRemaining:f,resetDate:y,isLicensedLimited:v,chatQuotaExceeded:D,premiumInteractionsQuotaExceeded:M,reloadQuota:A,plan:L,canPurchaseAdditionalQuota:N,canUpgradePlan:w,overagesEnabled:b,eligibleForTrial:G},O[13]=N,O[14]=w,O[15]=D,O[16]=R,O[17]=G,O[18]=v,O[19]=P,O[20]=b,O[21]=L,O[22]=f,O[23]=M,O[24]=A,O[25]=y,O[26]=d):d=O[26];let F=d;return O[27]!==m||O[28]!==F?(S=(0,a.jsx)(u.Provider,{value:F,children:m}),O[27]=m,O[28]=F,O[29]=S):S=O[29],S}let _=()=>{let e=(0,o.useContext)(u);if(!e)throw Error(“useEntitlement must be used within EntitlementProvider”);return e};try{u.displayName||(u.displayName=”EntitlementContext”)}catch{}try{c.displayName||(c.displayName=”EntitlementProvider”)}catch{}}}]); //# sourceMappingURL=37294-fd7a9b866829.js.map