performance.mark("js-parse-end:17363-e3dd517653b6b9ee.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["17363"],{69184(e,t,r){r.d(t,{E:()=>a});var n=r(74848),o=r(16522),i=r(91615);function a(e){let t,r=(0,o.c)(3),{children:a}=e,s=(0,i.P)();return r[0]!==s||r[1]!==a?(t=s?(0,n.jsx)(n.Fragment,{children:a}):null,r[0]=s,r[1]=a,r[2]=t):t=r[2],t}a.displayName="AllShortcutsEnabled"},91615(e,t,r){r.d(t,{$:()=>s,P:()=>l});var n=r(74848),o=r(16522),i=r(96540);let a=i.createContext(!0);function s(e){let t,r=(0,o.c)(3),{allShortcutsEnabled:i,children:s}=e;return r[0]!==i||r[1]!==s?(t=(0,n.jsxs)(a,{value:i,children:[" ",s," "]}),r[0]=i,r[1]=s,r[2]=t):t=r[2],t}function l(){return i.use(a)}a.displayName="AllShortcutsEnabledContext",s.displayName="AllShortcutsEnabledProvider"},48337(e,t,r){r.d(t,{Ck:()=>l,JS:()=>s});var n=r(74848),o=r(16522),i=r(96540);let a=(0,i.createContext)({query:"",setQuery:()=>void 0});function s(){return(0,i.use)(a)}function l(e){let t,r,s=(0,o.c)(5),{children:l}=e,[c,u]=(0,i.useState)("");s[0]!==c?(t={query:c,setQuery:u},s[0]=c,s[1]=t):t=s[1];let d=t;return s[2]!==l||s[3]!==d?(r=(0,n.jsx)(a,{value:d,children:l}),s[2]=l,s[3]=d,s[4]=r):r=s[4],r}a.displayName="FileQueryContext",l.displayName="FileQueryProvider"},7231(e,t,r){r.d(t,{T:()=>d});var n=r(16522),o=r(54242),i=r(95424),a=r(23666),s=r(51581),l=r(78597),c=r(36594),u=r(73537);function d(){let e,t,r,d,h,m,p,w,f,g,_,y,b,x,v,k,j,S,$,E=(0,n.c)(17),{sendAnalyticsEvent:C}=(0,s.s)(),L=(g=(0,n.c)(6),_=(t=(0,n.c)(7),r=(0,o.t)(),d=(0,c.i)(),h=`${r.ownerLogin}/${r.name}`,m=d?.id,p=d?.login,t[0]!==r.id||t[1]!==r.isFork||t[2]!==r.public||t[3]!==h||t[4]!==m||t[5]!==p?(e={react_app:"code-view",repository_id:r.id,repository_nwo:h,repository_public:r.public,repository_is_fork:r.isFork,actor_id:m,actor_login:p},t[0]=r.id,t[1]=r.isFork,t[2]=r.public,t[3]=h,t[4]=m,t[5]=p,t[6]=e):e=t[6],e),y=(0,o.t)(),g[0]!==y.name||g[1]!==y.ownerLogin?(w=(0,i.yH)(a.tTz,{owner:y.ownerLogin,repo:y.name}),g[0]=y.name,g[1]=y.ownerLogin,g[2]=w):w=g[2],b=w,g[3]!==_||g[4]!==b?(f=(e,t,r)=>{let n={target:e,interaction:t,context:r,..._,...{url:window.location.href,user_agent:window.navigator.userAgent,browser_width:document.documentElement.clientWidth,browser_languages:window.navigator.languages.join(",")}};(0,l.lS)(b,{method:"POST",body:n})},g[3]=_,g[4]=b,g[5]=f):f=g[5],f);E[0]===Symbol.for("react.memo_cache_sentinel")?(x=(0,u.G7)("code_nav_ui_events"),E[0]=x):x=E[0];let O=x;E[1]!==C||E[2]!==L?(v=(e,t)=>{let r=void 0===t?{}:t;C("repository.click",e,r),O&&L(e,"click",r)},E[1]=C,E[2]=L,E[3]=v):v=E[3];let N=v;E[4]!==C||E[5]!==L?(k=(e,t)=>{let r=void 0===t?{}:t;C("repository.keydown",e,r),O&&L(e,"keydown",r)},E[4]=C,E[5]=L,E[6]=k):k=E[6];let D=k;E[7]!==C||E[8]!==L?(j=(e,t)=>{let r=void 0===t?{}:t;C(e,"",r),O&&L(e,"stats",r)},E[7]=C,E[8]=L,E[9]=j):j=E[9];let A=j;E[10]!==C?(S=(e,t)=>{C("marketplace.action.click",e,void 0===t?{}:t)},E[10]=C,E[11]=S):S=E[11];let P=S;return E[12]!==N||E[13]!==D||E[14]!==A||E[15]!==P?($={sendRepoClickEvent:N,sendRepoKeyDownEvent:D,sendStats:A,sendMarketplaceActionEvent:P},E[12]=N,E[13]=D,E[14]=A,E[15]=P,E[16]=$):$=E[16],$}},92100(e,t,r){r.d(t,{o:()=>h});var n=r(16522),o=r(5225),i=r(54242),a=r(23666),s=r(78597),l=r(96540);async function c(e){let t=await (0,s.lS)(e);return t.ok?await t.json():void 0}let u=new Map,d=(0,o.A)(c,{cache:u});function h(e,t,r){let o,s,c,u=(0,n.c)(8),h=(0,i.t)();u[0]===Symbol.for("react.memo_cache_sentinel")?(o={list:[],directories:[],loading:!0},u[0]=o):o=u[0];let[m,p]=(0,l.useState)(o);return u[1]!==e||u[2]!==r||u[3]!==t||u[4]!==h.name||u[5]!==h.ownerLogin?(s=()=>{let n=(0,a.ClY)({repo:{name:h.name,ownerLogin:h.ownerLogin},commitOid:e,includeDirectories:!r}),o=!1,i=async()=>{p({list:[],directories:[],loading:!0});let e=await d(n);if(o)return;let t=e?.paths||[],r=e?.directories||[];p({list:t.concat(r).sort(),directories:r,error:!e})};return t&&i(),function(){o=!0}},c=[h.name,h.ownerLogin,r,e,t],u[1]=e,u[2]=r,u[3]=t,u[4]=h.name,u[5]=h.ownerLogin,u[6]=s,u[7]=c):(s=u[6],c=u[7]),(0,l.useEffect)(s,c),m}},12191(e,t,r){r.d(t,{Z:()=>d});var n=r(16522),o=r(27678),i=r(31595),a=r(68541),s=r(54242),l=r(23666),c=r(19519);function u({params:e,hash:t},r){let n=e?`?${e}`:"",o="";return r||(o=void 0===t?window.location.hash:t?`#${t}`:""),n+o}function d(){let e,t,r,d,h,m=(0,n.c)(27),{name:p,ownerLogin:w}=(0,s.t)(),f=(0,i.l)(),g=(0,o.y)(),_=(0,a.z)(),{isServer:y}=(0,c.V)();m[0]!==w||m[1]!==_.name||m[2]!==p?(e=e=>(0,l.IO9)({repo:{name:p,ownerLogin:w},commitish:_.name,action:"directory"===e.contentType?"tree":"blob",path:e.path}),m[0]=w,m[1]=_.name,m[2]=p,m[3]=e):e=m[3];let b=e;m[4]!==g||m[5]!==f||m[6]!==y||m[7]!==w||m[8]!==_.name||m[9]!==p?(t=e=>{let t=void 0===e?{}:e,r=(0,l.IO9)({repo:{name:p,ownerLogin:w},commitish:t.commitish||_.name,action:t.action||g,path:t.path||f})+u(t,y);return t.absolute?new URL(r,window.location.origin).href:r},m[4]=g,m[5]=f,m[6]=y,m[7]=w,m[8]=_.name,m[9]=p,m[10]=t):t=m[10];let x=t;m[11]!==g||m[12]!==f||m[13]!==y||m[14]!==w||m[15]!==_.currentOid||m[16]!==p?(r=e=>{let t=void 0===e?{}:e,r=(0,l.IO9)({repo:{name:p,ownerLogin:w},commitish:_.currentOid,action:t.action||g,path:t.path||f})+u(t,y);return t.absolute?new URL(r,window.location.origin).href:r},m[11]=g,m[12]=f,m[13]=y,m[14]=w,m[15]=_.currentOid,m[16]=p,m[17]=r):r=m[17];let v=r;m[18]!==y||m[19]!==_.currentOid||m[20]!==_.name?(d=()=>!y&&_.name===_.currentOid&&window.location.pathname.includes(_.currentOid),m[18]=y,m[19]=_.currentOid,m[20]=_.name,m[21]=d):d=m[21];let k=d;return m[22]!==v||m[23]!==b||m[24]!==x||m[25]!==k?(h={getItemUrl:b,getUrl:x,createPermalink:v,isCurrentPagePermalink:k},m[22]=v,m[23]=b,m[24]=x,m[25]=k,m[26]=h):h=m[26],h}},6406(e,t,r){r.d(t,{z:()=>n});class n{worker;set onmessage(e){this.worker.onmessage=e}constructor(e,t){try{this.worker=new Worker(`${e}?module=true`,{type:"module"})}catch{console.warn("Web workers are not available. Please enable web workers to benefit from the improved performance."),this.worker=new o(t)}}postMessage(e){this.worker.postMessage(e)}terminate(){this.worker.terminate()}}class o{#e=!1;onmessage;#t;constructor(e){this.#t=e}async postMessage(e){if(this.#e)return;let t={data:this.#t({data:e})};this.onmessage?.(t)}terminate(){this.#e=!0}}},45620(e,t,r){r.d(t,{j:()=>a});var n=r(5225),o=r(91385);let i=(0,n.A)(o.fN);function a({data:e}){let{query:t,baseList:r,startTime:n}=e,s=t.replaceAll("\\","");return{query:t,list:r.filter(e=>{var t,r;return t=e,""===(r=s)||(0,o.qA)(r,t)&&i(r,t)>0}).sort((e,t)=>i(s,t)-i(s,e)),baseCount:r.length,startTime:n}}},7394(e,t,r){r.d(t,{m:()=>i});var n=r(74848),o=r(21373);function i({onSave:e,onCancel:t,saveButtonText:r,isLoading:a=!1,loadingAnnouncement:s="",disabled:l=!1}){return(0,n.jsxs)("div",{className:"SpaceDialogFooter-module__footerContainer__n3xDw",children:[(0,n.jsx)(o.Q,{variant:"default",onClick:t,children:"Cancel"}),(0,n.jsx)(o.Q,{variant:"primary",loading:a,loadingAnnouncement:s,onClick:e,disabled:l,children:r})]})}i.displayName="SpaceDialogFooter"},2733(e,t,r){r.d(t,{E:()=>h});var n=r(74848),o=r(206),i=r(33542),a=r(78597),s=r(4925),l=r(67323),c=r(7624),u=r(18990),d=r(96540);function h({onSelect:e,repoId:t}){let r,m,p,[w,f]=(0,d.useState)([]),[g,_]=(0,d.useState)(!1),[y,b]=(0,d.useState)(void 0),x=(0,d.useCallback)(t=>{b(t),e(t)},[e]),v=(0,d.useCallback)(()=>{f([]),_(!0)},[]);return(0,d.useEffect)(()=>{(async()=>{try{let e=t?`/github-copilot/chat/custom_copilots_owners?repo_id=${t}`:"/github-copilot/chat/custom_copilots_owners",r=await (0,a.lS)(e),n=await r.json(),o=n?.owners;if(!r.ok||!o)return void v();f(o),o[0]&&x(o[0])}catch{v()}})()},[v,x,t]),(0,n.jsx)("div",{className:"mt-2 mb-1",children:(0,n.jsxs)(c.A,{children:[(0,n.jsx)(c.A.Label,{required:!0,children:"Owner"}),(0,n.jsxs)(l.W,{children:[(r=y?.name||"Choose an owner",m=y?(0,n.jsx)(o.r,{src:y.avatarUrl},y.avatarUrl):void 0,(0,n.jsx)(l.W.Button,{"data-testid":"owner-dropdown-anchor",alignContent:"start","aria-describedby":"owner-caption",leadingVisual:m,children:r})),(0,n.jsx)(l.W.Overlay,{width:"large",maxHeight:"large",className:"SpacesOwnerDropdown-module__ownerDropdownOverlay__sMXwE",children:(0,n.jsx)(u.l,{children:(0,n.jsx)(u.l.Group,{className:"SpacesOwnerDropdown-module__ownerListGroup__o7Xi2",children:(0,n.jsxs)(u.l,{selectionVariant:"single",children:[w&&w.map(e=>{let{name:t,avatarUrl:r,displayName:i}=e;return(0,n.jsxs)(u.l.Item,{selected:t===y?.name,onSelect:()=>x(e),className:"SpacesOwnerDropdown-module__ownerListItem__qPgcZ",children:[(0,n.jsx)(u.l.LeadingVisual,{children:(0,n.jsx)(o.r,{src:r})}),t,(0,n.jsx)(u.l.Description,{children:i})]},t)}),!w.length&&!g&&(0,n.jsx)(u.l.Item,{disabled:!0,children:"Fetching owners\u2026"},"fetching-owners"),g&&(0,n.jsx)(u.l.Item,{disabled:!0,className:"SpacesOwnerDropdown-module__errorListItem__aPRTD",children:"An error occurred while loading owners. Please reopen the dialog to try again."},"error-fetching-owners")]})})})})]}),(0,n.jsx)(c.A.Caption,{id:"owner-caption",children:(p=e=>(0,n.jsxs)("span",{className:"sr-only",children:["Space owner. Required. Selected owner: @",e.displayName,"."]}),y?"User"===y.type?(0,n.jsxs)("div",{className:"mt-2 d-flex flex-row flex-shrink flex-items-center",children:[p(y),(0,n.jsx)(s.A,{className:"mr-1",children:"Private"}),(0,n.jsx)("span",{...(0,i.G)("owner-user-caption"),children:"Only you will be able to see this space."})]}):(0,n.jsxs)("div",{className:"mt-2 d-flex flex-row flex-shrink",children:[p(y),(0,n.jsx)(s.A,{className:"SpacesOwnerDropdown-module__orgLabel__vEt2Z",children:"Private"}),(0,n.jsx)("span",{...(0,i.G)("owner-org-caption"),children:"Only visible to you and organization admins. You can share it later."})]}):(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"sr-only",children:"Space owner. Required."})," Where we will store your space."]}))})]})})}h.displayName="SpacesOwnerDropdown"},35366(e,t,r){r.d(t,{WU:()=>l,Bj:()=>b,A2:()=>_,O6:()=>c,dp:()=>h,Lr:()=>f,ee:()=>g,vC:()=>y,X_:()=>d,Ku:()=>u,CT:()=>m,kT:()=>w,rP:()=>p});var n=r(11515),o=r(34019),i=r(78597);function a(e,t){if(!e||!t)return null;let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=RegExp(`<([^>]+)>;\\s*rel=["']?${r}["']?`,"i"),o=e.match(n);return o?.[1]??null}let s="/github-copilot/chat",l=30,c=["copilot-chat","custom-copilots"],u=["copilot-chat","custom-copilots","count"];function d(e){return["copilot-chat","custom-copilots",e]}function h(e){return e?["copilot-chat","custom-copilot",{id:e.id,owner:e.owner}]:["copilot-chat","custom-copilot",null]}async function m(e){let t=e?`${s}/custom_copilots?type=${e}`:`${s}/custom_copilots`,r=await (0,i.lS)(t);if(!r.ok)throw Error(`Failed to fetch spaces: ${n.nN[r.status]||n.DW}`);return await r.json()}async function p(e){let t,{type:r,perPage:o=l,cursor:c}=e;if(c){let e=new URL(c,window.location.origin);r&&!e.searchParams.has("type")&&e.searchParams.set("type",r),t=e.pathname+e.search}else{let e=new URLSearchParams;r&&e.set("type",r),e.set("per_page",String(Math.min(Math.max(o,1),100)));let n=e.toString();t=`${s}/custom_copilots${n?`?${n}`:""}`}let u=await (0,i.lS)(t);if(!u.ok)throw Error(`Failed to fetch spaces: ${n.nN[u.status]||n.DW}`);let d=await u.json(),h=u.headers.get("Link");return{spaces:d,pagination:{nextCursor:a(h,"next"),prevCursor:a(h,"prev")}}}async function w(e,t){let r=`${s}/custom_copilots/search?type=${e}&q=${encodeURIComponent(t)}`,o=await (0,i.lS)(r);if(!o.ok)throw Error(`Failed to search spaces: ${n.nN[o.status]||n.DW}`);return await o.json()}async function f(e){if(!e||!e.owner)return{status:500,ok:!1,error:"unexpected null custom copilot id or missing owner"};let{owner:t,id:r}=e,o=`${s}/custom_copilots/${t}/${r}`,a=await (0,i.lS)(o);if(!a.ok)return{status:a.status,ok:!1,error:n.nN[a.status]||n.DW};let l=await a.json();return{status:a.status,ok:!0,payload:l}}async function g(e){let t=await (0,i.lS)((0,o.fn)(e),{method:"DELETE"});return t.ok?{status:t.status,ok:!0,payload:null}:t}async function _(e){let t=await (0,i.lS)(`${(0,o.fn)(e)}/settings/visibility`);if(!t.ok)throw Error("Error fetching visibility settings");try{let e=await t.json();return{memberCount:e.member_count&&"number"==typeof e.member_count?e.member_count:null}}catch(e){throw Error(`Error parsing visibility settings: ${e}`)}}async function y(e){let t=await (0,i.lS)(`${(0,o.fn)(e)}/menu_actions`);if(!t.ok)throw Error("Error fetching menu actions");try{let e=await t.json();return{visibility:e.visibility??"private",shareable:e.shareable??!1,editable:e.editable??!1,adminable:e.adminable??!1,baseRole:e.baseRole??"none",public:e.public??!1}}catch(e){throw Error(`Error parsing menu actions: ${e}`)}}async function b(){let e=await (0,i.lS)(`${s}/custom_copilots/count`);if(!e.ok)throw Error(`Failed to fetch spaces count: ${n.nN[e.status]||n.DW}`);return e.json()}},20573(e,t,r){r.d(t,{M:()=>n});function n(e){switch(e.type){case"repository":return{repository_id:e.repositoryId};case"github_file":return{repository_id:e.repositoryId,file_path:e.filePath,sha:e.sha};case"free_text":return{text:e.text,name:e.name};case"github_issue":case"github_pull_request":return{repository_id:e.repositoryId,number:e.number};case"uploaded_text_file":return{name:e.name};case"media_content":return{media_type:e.mediaType,name:e.name,url:e.url,height:e.height,width:e.width};default:throw Error("Unsupported resource")}}},29829(e,t,r){function n(e,t,r=.1){let o=a(e,t,r);return o&&-1===t.indexOf("/")&&(o+=a(e.substring(e.lastIndexOf("/")+1),t,r)),o}function o(e,t,r){if(t){let n=e.innerHTML.trim().match(r||function(e){let t=e.toLowerCase().split(""),r="",n=!0;for(let e of t){let t=e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&");n?(r+=`(.*)(${t})`,n=!1):r+=`([^${t}]*?)(${t})`}return RegExp(`${r}(.*?)$`,"i")}(t));if(!n)return;let o=!1,i=[];for(let e=1;e"),o=!0):o&&(i.push(""),o=!1),i.push(t))}e.innerHTML=i.join("")}else{let t=e.innerHTML.trim(),r=t.replace(/<\/?mark>/g,"");t!==r&&(e.innerHTML=r)}}r.d(t,{He:()=>o,UD:()=>s,dt:()=>n});let i=new Set([" ","-","_"]);function a(e,t,r=.1){let n=e;if(n===t)return 1;let o=n.length,s=0,l=0,c=!0;for(let e of t){let t=n.indexOf(e.toLowerCase()),a=n.indexOf(e.toUpperCase()),u=Math.min(t,a),d=u>-1?u:Math.max(t,a);if(-1===d)return 0;s+=.1,n[d]===e&&(s+=.1),0===d&&(s+=.9-r,c&&(l=1)),i.has(n.charAt(d-1))&&(s+=.9-r),n=n.substring(d+1,o),c=!1}let u=t.length,d=s/u,h=(u/o*d+d)/2;return l&&h+r<1&&(h+=r),h}function s(e,t){return e.score>t.score?-1:e.scoret.text)}}}]); //# sourceMappingURL=17363-e3dd517653b6b9ee-4ca78414e7bef793.js.map