performance.mark("js-parse-end:5743-35e0b3379140a97e.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["5743"],{36216(e,t,n){n.d(t,{B:()=>U});var i=n(74848),o=n(16522),s=n(32363),r=n(14500),a=n(7624),l=n(26108),c=n(41431),u=n(21373),d=n(34256),m=n(96540),p=n(38621),h=n(69513),f=n(4216),g=n(20331),_=n(46993),y=n(97286),b=n(78597),v=n(23666);async function w(e){try{let[t,n]=e.split("/");if(!t||!n)return null;let i=(0,v.Jkq)({owner:t,repo:n}),o=await (0,b.lS)(i);if(o.ok){let e=await o.json();if(!e)return null;return e?.defaultBranch||null}return null}catch{return null}}var x=n(40771);let A="CopilotAssignmentForm-module__formControl__wFWqH",j="CopilotAssignmentForm-module__toolbarButton__LzjYH";var C=n(70056),S=n(47916),N=n(73537),k=n(59046),$=n(49685),I=n(20909),F=n(9773),B=n(53709),P=n(13292),T=n(66996);function L(e){var t,n;let v,L,E,R,M,q,W,O,H,Q,G,D,K,U,Y,J,V,z,X,Z,ee,et,en,ei,eo,es,er,ea,el,ec,eu,ed,em,ep,eh,ef,eg=(0,o.c)(99),{ref:e_,initialRepo:ey,onSubmit:eb,onCancel:ev,isSubmitting:ew,isQuotaExhausted:ex,textareaRef:eA,textareaAriaDescribedBy:ej,promptPlaceholder:eC,promptLabelHidden:eS,promptRequired:eN,insideDialog:ek,initialAgent:e$}=e,eI=void 0!==ew&&ew,eF=void 0!==eS&&eS,eB=void 0!==eN&&eN,eP=void 0!==ek&&ek,{plan:eT}=(0,f.xR)(),{data:eL}=(t=T.Y.issues,(em=(0,o.c)(3))[0]===Symbol.for("react.memo_cache_sentinel")?(eu=(0,N.G7)("copilot_mission_control_decoupled_mode")&&(0,N.G7)("issue_cca_visualization_decoupled_mode"),em[0]=eu):eu=em[0],ep=eu,em[1]!==t?(ed={queryKey:["notice-dismissal",t],queryFn:async()=>{let e=await (0,b.lS)(`/settings/notice-dismissals/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`Failed to check notice dismissal: ${e.status}`);return await e.json()},staleTime:1/0,enabled:ep},em[1]=t,em[2]=ed):ed=em[2],(0,y.I)(ed)),[eE,eR]=(0,m.useState)(""),[eM,eq]=(0,m.useState)(void 0),[eW,eO]=(0,m.useState)(void 0),[eH,eQ]=(0,P.N)(),[eG,eD]=(0,B.s)(e$),{data:eK}=(0,F.B)(eG.topLevelAgentId?Number(eG.topLevelAgentId):null),eU=`copilot-assignment-ref-selector-${(0,m.useId)()}`,eY=(0,m.useRef)(null),eJ=eA||eY,eV=`${ey.owner.login}/${ey.name}`,ez=(n=ey.owner.login,(ef=(0,o.c)(3))[0]!==n||ef[1]!==eV?(eh=e=>(0,x.P)(e,n,eV),ef[0]=n,ef[1]=eV,ef[2]=eh):eh=ef[2],eh),{selectedRepo:eX,selectedBranch:eZ,setSelectedBranch:e0,isLoadingBranch:e1,initialRepoApiMetadata:e2,handleRepoSelect:e3,handleReposLoaded:e7}=function(e){let t,n,i,s,r,a,l,c,u,d,p,h,f,g,_,b,v=(0,o.c)(32);v[0]!==e.owner.login?(t={login:e.owner.login},v[0]=e.owner.login,v[1]=t):t=v[1],v[2]!==e.defaultBranch||v[3]!==e.name||v[4]!==t?(n={name:e.name,defaultBranch:e.defaultBranch,owner:t},v[2]=e.defaultBranch,v[3]=e.name,v[4]=t,v[5]=n):n=v[5];let x=n,[A,j]=(0,m.useState)(null),[C,S]=(0,m.useState)(""),[N,k]=(0,m.useState)(!1),[$,I]=(0,m.useState)(null);v[6]!==$||v[7]!==x.name||v[8]!==x.owner.login?(i=e=>{if($)return;let t=`${x.owner.login}/${x.name}`,n=e.find(e=>e.nameWithOwner===t);if(!n)return;let i={private:n.private,isEmpty:n.isEmpty,graphQLId:n.graphQLId};I(i),j(e=>e?.nameWithOwner===t?{...e,...i}:e)},v[6]=$,v[7]=x.name,v[8]=x.owner.login,v[9]=i):i=v[9];let F=i,B=`${x.owner.login}/${x.name}`,P=!x.defaultBranch,{data:T,isLoading:L}=(_=(0,o.c)(7),b=void 0===P||P,_[0]!==B?(h=["repository-default-branch",B],f=()=>w(B??""),_[0]=B,_[1]=h,_[2]=f):(h=_[1],f=_[2]),_[3]!==b||_[4]!==h||_[5]!==f?(g={queryKey:h,queryFn:f,enabled:b,staleTime:3e5,gcTime:6e5,retry:1},_[3]=b,_[4]=h,_[5]=f,_[6]=g):g=_[6],(0,y.I)(g));v[10]!==A||v[11]!==x.defaultBranch||v[12]!==x.name||v[13]!==x.owner.login?(s=()=>{if(A)return;let e=`${x.owner.login}/${x.name}`;j({owner:x.owner.login,name:e,nameOnly:x.name,nameWithOwner:e,enabled:!0,defaultBranch:x.defaultBranch||"",private:!1,graphQLId:"",isEmpty:!1}),x.defaultBranch&&S(x.defaultBranch)},v[10]=A,v[11]=x.defaultBranch,v[12]=x.name,v[13]=x.owner.login,v[14]=s):s=v[14],v[15]!==A||v[16]!==x?(r=[x,A],v[15]=A,v[16]=x,v[17]=r):r=v[17],(0,m.useEffect)(s,r),v[18]!==L?(a=()=>{k(L)},l=[L],v[18]=L,v[19]=a,v[20]=l):(a=v[19],l=v[20]),(0,m.useEffect)(a,l),v[21]!==T||v[22]!==x.defaultBranch?(c=()=>{T&&!x.defaultBranch&&(S(T),j(e=>e?{...e,defaultBranch:T}:e))},u=[T,x.defaultBranch],v[21]=T,v[22]=x.defaultBranch,v[23]=c,v[24]=u):(c=v[23],u=v[24]),(0,m.useEffect)(c,u),v[25]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{e&&(k(!1),j(e),S(e.defaultBranch))},v[25]=d):d=v[25];let E=d;return v[26]!==F||v[27]!==$||v[28]!==N||v[29]!==C||v[30]!==A?(p={selectedRepo:A,selectedBranch:C,isLoadingBranch:N,initialRepoApiMetadata:$,setSelectedBranch:S,handleRepoSelect:E,handleReposLoaded:F},v[26]=F,v[27]=$,v[28]=N,v[29]=C,v[30]=A,v[31]=p):p=v[31],p}(ey);eg[0]===Symbol.for("react.memo_cache_sentinel")?(v=(0,N.G7)("copilot_swe_agent_use_subagents"),eg[0]=v):v=eg[0];let e4=v;eg[1]===Symbol.for("react.memo_cache_sentinel")?(L=(0,N.G7)("issue_cca_modal_open"),eg[1]=L):L=eg[1];let e6=L;e:{if(!eX){E=null;break e}let e=!eX.private,t=ey.owner.login!==eX.owner;if(eX.isEmpty){E="The selected repo has no commits or branches so there's no valid base branch to create a PR against.";break e}if(t){E=e6?"You're assigning the agent to perform work in a different organization. The issue description will be visible to users outside this repository.":"You're assigning Copilot coding agent to perform work in a different organization. The issue description will be visible to users outside this repository.";break e}if(e2?.private&&e){E=e6?"You're assigning the agent to perform work in a public repository. The issue description will be visible to users outside this repository.":"You're assigning Copilot coding agent to perform work in a public repository. The issue description will be visible to users outside this repository.";break e}E=null}let e5=E;eg[2]!==e3||eg[3]!==eI?(R=e=>{e&&!eI&&(e3(e),eO(void 0))},eg[2]=e3,eg[3]=eI,eg[4]=R):R=eg[4];let e9=R;eg[5]!==eE||eg[6]!==eI||eg[7]!==eb||eg[8]!==eB||eg[9]!==eG||eg[10]!==eZ||eg[11]!==eH||eg[12]!==eX?(M=async()=>{if(!eI){if(eq(void 0),eO(void 0),eB&&!eE.trim())return void eq("Please provide a prompt.");if(eE.length>1e4)return void eq(`Instructions must be ${1e4.toLocaleString()} characters or fewer. Current length: ${eE.length.toLocaleString()} characters.`);if(!eX||!eZ)return void eO("Please select a repository and branch.");if(eX.isEmpty)return void eO("Please select a valid base branch.");await eb(eE,eX,eZ,eG,eH)}},eg[5]=eE,eg[6]=eI,eg[7]=eb,eg[8]=eB,eg[9]=eG,eg[10]=eZ,eg[11]=eH,eg[12]=eX,eg[13]=M):M=eg[13];let e8=M;eg[14]!==e8?(q=()=>({submit:e8}),W=[e8],eg[14]=e8,eg[15]=q,eg[16]=W):(q=eg[15],W=eg[16]),(0,m.useImperativeHandle)(e_,q,W);let te=void 0!==ex&&ex||eX?.isEmpty||eI||!eX||!eZ,tt=eI||e1||!eX?.defaultBranch||eX?.isEmpty;eg[17]!==eF?(O=eF?(0,i.jsx)("label",{htmlFor:"copilot-assignment-prompt",className:"sr-only",children:_.nX}):(0,i.jsx)("label",{htmlFor:"copilot-assignment-prompt",className:"CopilotAssignmentForm-module__promptLabel__MmIEw",children:_.nX}),eg[17]=eF,eg[18]=O):O=eg[18];let tn=eC??(e6?_.Pq:_.qB);eg[19]===Symbol.for("react.memo_cache_sentinel")?(H=e=>eR(e.target.value),eg[19]=H):H=eg[19],eg[20]!==ej||eg[21]!==eM?(Q=eM?[ej,"copilot-assignment-prompt-error"].filter(Boolean).join(" "):ej,eg[20]=ej,eg[21]=eM,eg[22]=Q):Q=eg[22],eg[23]!==eE||eg[24]!==eJ||eg[25]!==eI||eg[26]!==tn||eg[27]!==Q?(G=(0,i.jsx)("textarea",{id:"copilot-assignment-prompt",ref:eJ,className:"CopilotAssignmentForm-module__textarea__waaFd",placeholder:tn,value:eE,onChange:H,rows:2,"aria-describedby":Q,maxLength:1e4,disabled:eI}),eg[23]=eE,eg[24]=eJ,eg[25]=eI,eg[26]=tn,eg[27]=Q,eg[28]=G):G=eg[28],eg[29]!==eM?(D=eM&&(0,i.jsx)("span",{id:"copilot-assignment-prompt-error",className:"CopilotAssignmentForm-module__validationError__DJjaM",children:eM}),eg[29]=eM,eg[30]=D):D=eg[30],eg[31]!==G||eg[32]!==D?(K=(0,i.jsxs)("div",{className:"CopilotAssignmentForm-module__textareaContainer__ihkyt",children:[G,D]}),eg[31]=G,eg[32]=D,eg[33]=K):K=eg[33],eg[34]===Symbol.for("react.memo_cache_sentinel")?(U=(0,i.jsx)(a.A.Label,{visuallyHidden:!0,children:_.De}),eg[34]=U):U=eg[34];let ti=eX||void 0,to=eX?.nameWithOwner||"Select repository",ts=`Repository: ${eX?.nameWithOwner||"Select repository"}`;return eg[35]!==eI||eg[36]!==ts?(Y={variant:"invisible",className:j,"aria-label":ts,disabled:eI},eg[35]=eI,eg[36]=ts,eg[37]=Y):Y=eg[37],eg[38]!==ez||eg[39]!==e9||eg[40]!==e7||eg[41]!==ti||eg[42]!==to||eg[43]!==Y?(J=(0,i.jsxs)(a.A,{className:A,children:[U,(0,i.jsx)(r.P,{repositoryLoader:ez,selectionVariant:"single",selectAllOption:!1,onSelect:e9,onLoad:e7,currentSelection:ti,buttonText:to,width:"large",truncateMaxWidth:250,additionalButtonProps:Y})]}),eg[38]=ez,eg[39]=e9,eg[40]=e7,eg[41]=ti,eg[42]=to,eg[43]=Y,eg[44]=J):J=eg[44],eg[45]===Symbol.for("react.memo_cache_sentinel")?(V=(0,i.jsx)(a.A.Label,{visuallyHidden:!0,children:_.T6}),eg[45]=V):V=eg[45],eg[46]!==eU||eg[47]!==e1||eg[48]!==eI||eg[49]!==tt||eg[50]!==eZ||eg[51]!==eX||eg[52]!==e0?(z=(0,i.jsxs)(a.A,{className:A,children:[V,eX||eZ?(0,i.jsx)(s.PI,{useFocusZone:!0,cacheKey:eU,canCreate:!1,currentCommitish:eZ||eX?.defaultBranch||"",defaultBranch:eX?.defaultBranch??eZ,owner:eX?.owner||"",repo:eX?.nameOnly||"",types:["branch"],selectedRefType:"branch",closeOnSelect:!0,hideShowAll:!0,disabled:tt,actionListHeadingText:_.in,actionListDescription:e6?_.sk:_.vA,onSelectItem:e=>{eI||e0(e)},renderAnchor:e=>(0,i.jsx)(h.L,{...e,variant:"invisible",className:j,icon:p.GitBranchIcon,selectedIcon:p.GitBranchCheckIcon,selected:eZ!==eX?.defaultBranch,"aria-label":eX?.isEmpty?"Branch: None available":`Branch: ${e1?"Loading branch...":eZ||"Select branch"}`,"aria-labelledby":void 0}),anchoredOverlayProps:{variant:{regular:"anchored",narrow:"fullscreen"},height:"small"}}):(0,i.jsx)(l.K,{variant:"invisible",className:j,icon:p.GitBranchIcon,"aria-label":"Loading branches\u2026",disabled:!0})]}),eg[46]=eU,eg[47]=e1,eg[48]=eI,eg[49]=tt,eg[50]=eZ,eg[51]=eX,eg[52]=e0,eg[53]=z):z=eg[53],eg[54]!==eI||eg[55]!==eP||eg[56]!==eG||eg[57]!==eZ||eg[58]!==eX||eg[59]!==eD?(X=(e4||e6)&&eX&&(0,i.jsxs)(a.A,{className:A,children:[(0,i.jsx)(a.A.Label,{visuallyHidden:!0,children:_.SF}),(0,i.jsx)(S.b,{repo:eX,branch:eZ||eX.defaultBranch,selectedAgent:eG,onSelectAgent:e=>eD(e),iconOnly:!0,disabled:eI,insideDialog:eP,buttonProps:{variant:"invisible",className:j}})]}),eg[54]=eI,eg[55]=eP,eg[56]=eG,eg[57]=eZ,eg[58]=eX,eg[59]=eD,eg[60]=X):X=eg[60],eg[61]!==eK?.slug||eg[62]!==eT||eg[63]!==eG||eg[64]!==eH||eg[65]!==eQ?(Z=$.W.codingAgentModelSelection&&($.W.codingAgentModelSelectionAllSkus||eT===g.UH.IndividualPro||eT===g.UH.IndividualProPlus||eT===g.UH.IndividualStudent)&&(0,I.CF)(eG,eK?.slug)&&(0,i.jsx)("div",{className:"CopilotAssignmentForm-module__modelPickerContainer__V8acK",children:(0,i.jsxs)(a.A,{children:[(0,i.jsx)(a.A.Label,{visuallyHidden:!0,children:"Model"}),(0,i.jsx)(k.Y,{onUpdateModel:eQ,selectedModelId:eH})]})}),eg[61]=eK?.slug,eg[62]=eT,eg[63]=eG,eg[64]=eH,eg[65]=eQ,eg[66]=Z):Z=eg[66],eg[67]!==J||eg[68]!==z||eg[69]!==X||eg[70]!==Z?(ee=(0,i.jsx)("div",{className:"CopilotAssignmentForm-module__toolbar__K5ux7",children:(0,i.jsxs)("div",{className:"CopilotAssignmentForm-module__selectorsRow__PS3Pc",children:[J,z,X,Z]})}),eg[67]=J,eg[68]=z,eg[69]=X,eg[70]=Z,eg[71]=ee):ee=eg[71],eg[72]!==K||eg[73]!==ee?(et=(0,i.jsxs)("div",{className:"CopilotAssignmentForm-module__inputContainer__dwVvp",children:[K,ee]}),eg[72]=K,eg[73]=ee,eg[74]=et):et=eg[74],eg[75]!==eL?.dismissed?(en=!(eL?.dismissed??!0)&&(0,N.G7)("copilot_mission_control_decoupled_mode")&&(0,N.G7)("issue_cca_visualization_decoupled_mode"),eg[75]=eL?.dismissed,eg[76]=en):en=eg[76],eg[77]!==en?(ei=(0,i.jsx)(T.h,{className:"CopilotAssignmentForm-module__decoupledBanner__qYT5R",dismissalKey:T.Y.issues,enabled:en}),eg[77]=en,eg[78]=ei):ei=eg[78],eg[79]!==e5?(eo=e5&&(0,i.jsx)(c.l,{variant:"warning",title:"Warning",hideTitle:!0,className:"CopilotAssignmentForm-module__warningBanner__akq0E",children:e5}),eg[79]=e5,eg[80]=eo):eo=eg[80],eg[81]!==eW?(es=eW&&(0,i.jsx)(d.v,{variant:"critical",className:"CopilotAssignmentForm-module__branchValidation__Wc_Pt",children:eW}),eg[81]=eW,eg[82]=es):es=eg[82],eg[83]!==eI||eg[84]!==ev?(er=ev&&(0,i.jsx)(u.Q,{variant:"invisible",onClick:ev,disabled:eI,children:"Cancel"}),eg[83]=eI,eg[84]=ev,eg[85]=er):er=eg[85],eg[86]!==eI||eg[87]!==te?(ea=(0,i.jsx)(C.cQ,{commandId:"github:submit-form",showKeybindingHint:!0,variant:"primary",inactive:te,loading:eI,className:"CopilotAssignmentForm-module__assignButton__n3IQM",children:"Assign"}),eg[86]=eI,eg[87]=te,eg[88]=ea):ea=eg[88],eg[89]!==er||eg[90]!==ea?(el=(0,i.jsx)("div",{className:"CopilotAssignmentForm-module__buttonsContainer__OpmG7",children:(0,i.jsxs)("div",{className:"CopilotAssignmentForm-module__buttonsRow__B3ojR",children:[er,ea]})}),eg[89]=er,eg[90]=ea,eg[91]=el):el=eg[91],eg[92]!==O||eg[93]!==et||eg[94]!==ei||eg[95]!==eo||eg[96]!==es||eg[97]!==el?(ec=(0,i.jsxs)("div",{className:"CopilotAssignmentForm-module__formContainer__sti8x",children:[O,et,ei,eo,es,el]}),eg[92]=O,eg[93]=et,eg[94]=ei,eg[95]=eo,eg[96]=es,eg[97]=el,eg[98]=ec):ec=eg[98],ec}L.displayName="CopilotAssignmentForm";var E=n(61398),R=n(4925),M=n(83223),q=n(79533),W=n(91834),O=n(51189),H=n(98573),Q=n(57976),G=n(50964);async function D(){let e=await (0,b.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()}var K=n(93797);function U({isOpen:e,onClose:t,repository:n,issueNumbers:s,onAssignmentComplete:r,returnFocusRef:a,onSubmit:l,title:u,description:d,initialAgent:p}){let[h,_]=(0,m.useState)(!1),[b,v]=(0,m.useState)(null),w=(0,m.useRef)(null),x=(0,m.useRef)(null),A=function(){let e,t,n,i=(0,o.c)(4),s=(0,G.X)(),r=s?.licenseType;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=["copilot-chat","entitlement"],i[0]=e):e=i[0];let a=void 0===r;i[1]===Symbol.for("react.memo_cache_sentinel")?(t={licenseType:g.mF.Unlicensed},i[1]=t):t=i[1],i[2]!==a?(n={queryKey:e,queryFn:D,enabled:a,placeholderData:t,staleTime:3e5},i[2]=a,i[3]=n):n=i[3];let{data:l}=(0,y.I)(n);return r??l?.licenseType??g.mF.Unlicensed}(),[j,S]=(0,m.useState)(()=>s?.length??0),k=(0,m.useRef)(e);(0,m.useEffect)(()=>{e&&!k.current&&S(s?.length??0),k.current=e},[e,s]);let $=()=>{v(null),_(!1),t()},I=n.owner.login,F=n.name,B=j>1,P=(0,m.useCallback)(async(e,n,i,o,a)=>{if(!n)return;if(l&&n.graphQLId){_(!0);try{await l(n.graphQLId,i,e,o,a,n.nameWithOwner,n.id)}finally{_(!1)}return}if(!s||0===s.length)return;let c=[...s];_(!0),v(null);try{let s=await (0,q.J)(I,F,c,{instructions:e,targetRepo:n.nameWithOwner,targetBranch:i,customAgent:o?.subAgentSlug||void 0,agentId:o?.topLevelAgentId||void 0,model:a});if(s.ok)await r?.(s.data?.copilot),t();else{let e=B?(0,W.Ah)(c,s.jobs):"Assignment failed",t=(0,W.v0)(s,e);v(t)}}catch(e){v((0,W.VJ)(e,"Assignment"))}finally{_(!1)}},[s,I,F,r,t,B,l]),T=(0,m.useMemo)(()=>n?{name:n.name,defaultBranch:void 0,owner:{login:n.owner.login}}:null,[n]),L=(0,m.useCallback)(async()=>{!h&&x.current&&await x.current.submit()},[h]);if(!e)return null;let K=(0,N.G7)("issue_cca_modal_open"),J=B?`Assign ${j} issues to ${K?"agent":"Copilot"}`:K?"Assign agent to issue":"Assign Copilot to issue",V=u??J,z=(0,O.Xl)()?"https://gh.io/copilot-issues-cross-repo-assign-staff-feedback":"https://gh.io/copilot-issues-cross-repo-assign-feedback";return(0,i.jsxs)(E.l,{onClose:$,width:"xlarge",initialFocusRef:w,returnFocusRef:a,renderHeader:({dialogLabelId:e})=>(0,i.jsxs)(E.l.Header,{id:e,className:"CopilotAssignmentModal-module__header__MjeFB",children:[(0,i.jsx)(E.l.Title,{children:V}),(0,i.jsxs)("div",{className:"CopilotAssignmentModal-module__rightSection__Zf0ZN",children:[(0,i.jsx)(R.A,{variant:"success",className:"CopilotAssignmentModal-module__previewBadge__qDE0g",children:"Preview"}),(0,i.jsx)(M.A,{href:z,target:"_blank",rel:"noopener noreferrer",className:"CopilotAssignmentModal-module__feedbackLink__yhmlN",children:"Feedback"}),(0,i.jsx)(E.l.CloseButton,{onClose:$})]})]}),children:[b&&(0,i.jsx)("div",{className:"CopilotAssignmentModal-module__errorContainer___WUJV",children:(0,i.jsx)(c.l,{variant:"critical",title:"Assignment Failed",hideTitle:!0,description:(0,i.jsx)("div",{"data-testid":"copilot-markdown",children:(0,i.jsx)(Q.To,{markdown:b,className:"CopilotAssignmentModal-module__errorMarkdown__x8NPl"})}),secondaryAction:(0,i.jsx)(c.l.SecondaryAction,{onClick:()=>v(null),children:"Dismiss"})})}),T&&(0,i.jsx)(C.tL,{commands:{"github:submit-form":L},children:(0,i.jsx)(H.Fn,{children:(0,i.jsx)(f.$d,{initialLicenseType:A,children:(0,i.jsx)(Y,{formRef:x,initialRepo:T,onSubmit:P,onCancel:$,isSubmitting:h,textareaRef:w,description:d??(K?"The agent will use the issue description, comments, and any additional prompt you provide to get started. Select a custom agent for specialized tasks.":"Copilot will use the issue description, comments, and any additional prompt you provide to get started. Select a custom agent for specialized tasks."),initialAgent:p})})})})]})}function Y(e){let t,n,s,r,a=(0,o.c)(15),{formRef:l,initialRepo:c,onSubmit:u,onCancel:d,isSubmitting:p,textareaRef:h,description:f,initialAgent:g}=e,[_,y]=(0,m.useState)(!1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)(K.A,{onQuotaExhaustedChange:y,entrypointLocation:"ASSIGNMENT_MODAL"}),a[0]=t):t=a[0],a[1]!==f?(n=(0,i.jsx)("p",{className:"CopilotAssignmentModal-module__description__l78UH",children:f}),a[1]=f,a[2]=n):n=a[2],a[3]!==l||a[4]!==g||a[5]!==c||a[6]!==_||a[7]!==p||a[8]!==d||a[9]!==u||a[10]!==h?(s=(0,i.jsx)(L,{ref:l,initialRepo:c,onSubmit:u,onCancel:d,isSubmitting:p,isQuotaExhausted:_,textareaRef:h,textareaAriaDescribedBy:"copilot-assignment-description",insideDialog:!0,initialAgent:g}),a[3]=l,a[4]=g,a[5]=c,a[6]=_,a[7]=p,a[8]=d,a[9]=u,a[10]=h,a[11]=s):s=a[11],a[12]!==n||a[13]!==s?(r=(0,i.jsxs)(i.Fragment,{children:[t,n,s]}),a[12]=n,a[13]=s,a[14]=r):r=a[14],r}U.displayName="CopilotAssignmentModal",Y.displayName="CopilotAssignmentModalContent"},17164(e,t,n){n.d(t,{$s:()=>h,CV:()=>m,EW:()=>y,Hm:()=>u,JK:()=>r,Jh:()=>p,K9:()=>k,MZ:()=>C,PG:()=>a,Pb:()=>s,Qx:()=>o,SS:()=>x,VY:()=>$,X:()=>g,Yj:()=>A,cv:()=>F,jL:()=>f,kY:()=>c,mk:()=>I,mv:()=>i,p4:()=>b,q8:()=>l,v5:()=>N,wG:()=>S,ws:()=>w,xN:()=>_,x_:()=>v});let i=new Set(["ask_user","exit_plan_mode","permission_request"]);function o(e){return"object"==typeof e&&null!==e&&"choices"in e&&Array.isArray(e.choices)}function s(e){return Array.isArray(e)&&e.every(e=>r(e))}function r(e){return a(e)&&"source"in e}function a(e){return"object"==typeof e&&null!==e&&"role"in e&&"user"===e.role}function l(e){return"object"==typeof e&&null!==e&&"role"in e&&"tool"===e.role}function c(e){return"object"==typeof e&&null!=e&&"role"in e&&("user"===e.role||"assistant"===e.role)&&"threadID"in e}function u(e){return"object"==typeof e&&null!==e&&"type"in e&&"tool.user_requested"===e.type&&"toolCallId"in e&&"string"==typeof e.toolCallId&&"toolName"in e&&"string"==typeof e.toolName&&"arguments"in e&&"object"==typeof e.arguments&&"timestamp"in e&&"string"==typeof e.timestamp&&!0}function d(e){if("object"!=typeof e||null===e||!("type"in e)||"tool.execution_start"!==e.type||!("id"in e)||"string"!=typeof e.id||!("timestamp"in e)||"string"!=typeof e.timestamp||!("data"in e)||"object"!=typeof e.data||null===e.data)return!1;let t=e.data;return"string"==typeof t.toolCallId&&"string"==typeof t.toolName}function m(e){return"object"==typeof e&&null!==e&&"type"in e&&"tool.outputs"===e.type&&"toolCallId"in e&&"string"==typeof e.toolCallId&&"output"in e&&"string"==typeof e.output&&"timestamp"in e&&"string"==typeof e.timestamp&&!0}function p(e){return"object"==typeof e&&null!==e&&"string"==typeof e.question&&(void 0===e.choices||!!Array.isArray(e.choices))&&(void 0===e.allowFreeform||"boolean"==typeof e.allowFreeform)}function h(e){return"object"==typeof e&&null!==e&&"string"==typeof e.summary&&(void 0===e.actions||!!Array.isArray(e.actions))&&(void 0===e.recommendedAction||"string"==typeof e.recommendedAction)}function f(e){return"object"==typeof e&&null!==e&&"string"==typeof e.kind&&(void 0===e.toolName||"string"==typeof e.toolName)&&(void 0===e.command||"string"==typeof e.command)&&(void 0===e.filePath||"string"==typeof e.filePath)&&(void 0===e.diff||"string"==typeof e.diff)&&(void 0===e.description||"string"==typeof e.description)&&!0}function g(e){return"object"==typeof e&&null!==e&&(o(e)||a(e)||l(e)||u(e)||d(e)||"object"==typeof e)}function _(e){return!!d(e)&&i.has(e.data.toolName)}function y(e){let t=[];for(let n of e.choices)if(n.delta.tool_calls)for(let e of n.delta.tool_calls){let n;if(e.function?.name&&i.has(e.function.name)){try{n=e.function.arguments?JSON.parse(e.function.arguments):{}}catch{n={}}t.push({toolCallId:e.id,toolName:e.function.name,arguments:n})}}return t}function b(e){return!!o(e)&&y(e).length>0}function v(e){return y(e)[0]??null}function w(e,t){return{type:"tool.user_requested",toolCallId:e.toolCallId,toolName:e.toolName,arguments:e.arguments,timestamp:t||new Date().toISOString()}}function x(e){return!!e&&[946600,71,106,776,386,56].includes(e.agent_id)}let A={InProgress:"in_progress",Completed:"completed",Failed:"failed",Idle:"idle",WaitingForUser:"waiting_for_user",TimedOut:"timed_out",Cancelled:"cancelled",Queued:"queued"},j=new Set(Object.values(A));function C(e){return j.has(e)}function S(e,t){switch(e){case A.InProgress:return"In progress";case A.Completed:return t?.hasPull?"Ready for review":"Completed";case A.Failed:return"Failed";case A.Idle:return"Idle";case A.WaitingForUser:return"Waiting for user";case A.TimedOut:return"Timed out";case A.Cancelled:return"Cancelled";case A.Queued:return"Queued";default:return"Unknown"}}function N(e){return["queued","in_progress"].includes(e.state)}function k(e){return e.state===A.Completed}function $(e){return!!e.isPending&&e.state===A.Queued}function I(e){return e.state===A.Cancelled}function F(e){return e.state===A.Failed}},79533(e,t,n){n.d(t,{J:()=>s});var i=n(78597),o=n(46993);async function s(e,t,n,s){try{let r=await (0,i.lS)(`/${e}/${t}${o.Ct}`,{method:"POST",body:{issue_ids:n,repo_name_with_owner:s.targetRepo,base_ref:s.targetBranch,custom_instructions:s.instructions,custom_agent:s.customAgent,agent_id:s.agentId,model:s.model,skip_pull_request:s.skipPullRequest}});if(r.ok){let e=await r.json();return{ok:!0,status:r.status,data:e}}{let e;try{let t=await r.json();return e=t.error||`Request failed with status ${r.status}`,{ok:!1,status:r.status,errorMessage:e,jobs:t.jobs||[]}}catch{return e=`Request failed with status ${r.status}`,{ok:!1,status:r.status,errorMessage:e}}}}catch(e){return{ok:!1,status:0,errorMessage:e instanceof Error?e.message:"An unexpected error occurred"}}}},91834(e,t,n){function i(e,t){switch(t){case 403:return`${e}: Please check that you have permission to assign issues in the target repository.`;case 404:return`${e}: The repository or branch may not exist or may not be accessible.`;case 422:return`${e}: Request could not be processed. Please try again or contact support if the issue persists.`;case 429:return`${e}: Rate limit exceeded. Please wait a few moments and try again.`;case 0:return`${e}. Please check your network connection and try again.`;default:if(t>=500)return`${e}: There was a server error. Please try again in a few moments.`;return`${e}. Please try again or contact support if the issue persists.`}}function o(e,t){return e.errorMessage?`${t}: ${e.errorMessage}`:i(t,e.status)}function s(e,t){if(!e||0===e.length)return"Assignment failed";let n=new Set((t||[]).map(e=>e.issue_number)),i=[];for(let t of e)"number"!=typeof t||isNaN(t)||n.has(t)||i.push(t);if(i.sort((e,t)=>e-t),0===i.length||i.length===e.length)return"Assignment failed";if(1===i.length)return`Assignment failed for #${i[0]}`;if(2===i.length)return`Assignment failed for #${i[0]} and #${i[1]}`;let[o,s,...r]=i,a=r.length;return`Assignment failed for #${o}, #${s} and ${a} other${1===a?"":"s"}`}function r(e,t){return e instanceof Error?`${t} failed: ${e.message}`:i(`${t} failed`,500)}n.d(t,{Ah:()=>s,VJ:()=>r,v0:()=>o})},71016(e,t,n){n.d(t,{b:()=>r});var i=n(74848),o=n(16522),s=n(34164);let r=e=>{let t,n,r,a,l=(0,o.c)(10),{children:c,className:u,innerClassName:d}=e;return l[0]!==u?(t=(0,s.$)("WithShimmerEffect-module__fadeIn__Zbywa",u),l[0]=u,l[1]=t):t=l[1],l[2]!==d?(n=(0,s.$)("WithShimmerEffect-module__shimmerText__SbrE8",d),l[2]=d,l[3]=n):n=l[3],l[4]!==c||l[5]!==n?(r=(0,i.jsx)("div",{className:n,children:c}),l[4]=c,l[5]=n,l[6]=r):r=l[6],l[7]!==t||l[8]!==r?(a=(0,i.jsx)("div",{className:t,children:r}),l[7]=t,l[8]=r,l[9]=a):a=l[9],a};r.displayName="WithShimmerEffect"},7749(e,t,n){function i(e){let t=[...e.querySelectorAll("meta[name=html-safe-nonce]")].map(e=>e.content);if(t.length<1)throw Error("could not find html-safe-nonce on document");return t}n.d(t,{A:()=>s,K:()=>i});class o extends Error{response;constructor(e,t){super(`${e} for HTTP ${t.status}`),this.response=t,this.name="ResponseError"}}function s(e,t,n=!1){let i=t.headers.get("content-type")||"";if(!n&&!i.startsWith("text/html"))throw new o(`expected response with text/html, but was ${i}`,t);if(n&&!(i.startsWith("text/html")||i.startsWith("application/json")))throw new o(`expected response with text/html or application/json, but was ${i}`,t);let r=t.headers.get("x-html-safe");if(r){if(!e.includes(r))throw new o("response X-HTML-Safe nonce did not match",t)}else throw new o("missing X-HTML-Safe nonce",t)}}}]); //# sourceMappingURL=5743-35e0b3379140a97e-fb128f2fda6618e9.js.map