TvBox/all/lib/react-code-view-c5d6b504ff99.js

11 lines
243 KiB
JavaScript
Raw Normal View History

2025-07-03 20:15:22 +08:00
"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["react-code-view"],{68048:(e,t,n)=>{n.d(t,{D:()=>r});function r(e){if("clipboard"in navigator)return navigator.clipboard.writeText(e);let t=document.body;if(!t)return Promise.reject(Error());let n=function(e){let t=document.createElement("pre");return t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.top="5px",t.textContent=e,t}(e);return t.appendChild(n),!function(e){if("clipboard"in navigator)return navigator.clipboard.writeText(e.textContent||"");let t=getSelection();if(null==t)return Promise.reject(Error());t.removeAllRanges();let n=document.createRange();n.selectNodeContents(e),t.addRange(n),document.execCommand("copy"),t.removeAllRanges(),Promise.resolve()}(n),t.removeChild(n),Promise.resolve()}},70635:(e,t,n)=>{var r=n(16058),i=n(65980),o=n(74848),l=n(26033),a=n(88795),s=n(93955),c=n(53614),d=n(25772),u=n(68415),h=n(21325),m=n(96540);function p({children:e}){let t=(0,d.B)(),[n]=m.useState(t?.repo),[r]=m.useState(t?.currentUser),i=(0,m.useMemo)(()=>({}),[]);return(0,m.useEffect)(()=>{let e=document.querySelector(".footer");e&&(e.querySelector(".mt-6")?.classList.replace("mt-6","mt-0"),e.querySelector(".border-top")?.classList.remove("border-top"))},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meta",{"data-hydrostats":"publish"}),(0,o.jsx)(u.LB,{initialValue:u.Gy.xxxlarge,children:(0,o.jsx)(l.y,{appName:"react-code-view",category:"",metadata:i,children:(0,o.jsx)(s.Q,{user:r,children:(0,o.jsx)(a.d,{repository:n,children:(0,o.jsx)(h.cp,{children:(0,o.jsx)(c.i,{children:e})})})})})})]})}try{p.displayName||(p.displayName="App")}catch{}var f=n(95782),x=n(21609),y=n(69098),g=n(51314),b=n(85579),v=n(141),j=n(61763),w=n(50104),N=n(30903),_=n(28408),k=n(21113),C=n(74474),A=n(18138),S=n(66871),B=n(42658),I=n(8447),L=n(14103),T=n(93653),R=n(75177),E=n(84217),O=n(70170),D=n(54763),F=n(98637),$=n(13617),M=n(30695),P=n(38621),z=n(87330),H=n(9591),W=n(52464),U=n(53110),V=n(36588),G=n(55864),q=n(30631);function Y({symbolKind:e,showFullSymbol:t}){return e?(0,o.jsxs)(R.A,{sx:{display:"flex",flexDirection:"row",position:"relative",...t?{}:{mr:2}},children:[(0,o.jsx)(R.A,{sx:{backgroundColor:e.plColor,opacity:.1,position:"absolute",borderRadius:5,alignItems:"stretch",display:"flex",width:"100%",height:"100%"}}),(0,o.jsx)(R.A,{sx:{color:e.plColor,borderRadius:5,fontWeight:600,...t?{fontSize:"small",px:2,py:"1px",mt:"2px"}:{fontSize:"smaller",px:1,py:"1px"}},children:t?e.fullName:e.shortName})]}):null}try{Y.displayName||(Y.displayName="SymbolIndicator")}catch{}let K=m.memo(function({treeSymbols:e,onTreeSymbolSelect:t}){let n=!e.some(e=>e.isParent||e.children.length>0);return(0,o.jsx)(R.A,{id:"filter-results",sx:{mb:-2,overflowY:"auto",maxHeight:"calc(100vh - 237px)",pl:3,pb:2,pt:1},children:(0,o.jsx)(G.G,{"aria-label":"Code Navigation",flat:n,children:e.map((e,n)=>(0,o.jsx)(X,{id:`${n}${e.symbol.name}`,symbol:e,depth:e.isParent?1:2,onSelect:t},`${n}${e.symbol.name}`))})})});function Q({symbol:e}){return(0,o.jsxs)(R.A,{sx:{display:"flex"},children:[(0,o.jsx)(Y,{symbolKind:e.symbol.kind})," ",(0,o.jsx)(q.A,{title:e.symbol.name,sx:{maxWidth:180,display:"block"},children:(0,o.jsx)("span",{children:e.symbol.name})})]})}function X({symbol:e,depth:t,onSelect:n,id:r}){let[i,l]=(0,m.useState)(t<=7);return(0,o.jsxs)(G.G.Item,{onSelect:()=>n(e.symbol),expanded:i,onExpandedChange:()=>l(!i),id:r,children:[(0,o.jsx)(Q,{symbol:e}),e.isParent&&e.children.length>0&&(0,o.jsx)(G.G.SubTree,{children:e.children.map((e,r)=>(0,o.jsx)(X,{symbol:e,depth:e.isParent?t+1:t,onSelect:n,id:`${r}${e.symbol.name}`},`${r}${e.symbol.name}`))})]})}try{K.displayName||(K.displayName="CodeNavSymbolTree")}catch{}try{Q.displayName||(Q.displayName="CodeNavTreeContent")}catch{}try{X.displayName||(X.displayName="CodeNavTreeItem")}catch{}var Z=n(52811),J=n(69676),ee=n(82678),et=n(15385),en=n(39461),er=n(34614);let ei=m.memo(function({symbol:e,filterText:t,onSelect:n,focused:r,index:i}){return(0,o.jsx)(et.l.Item,{role:"option",id:`jump-to-item-${i}`,"aria-selected":r,sx:{minWidth:0
`);return{lines:s,plainTextLinesAsString:c,nonTruncatedLinesData:o}}(c??[],u??null,n??null,(0,m.useContext)(eK),r),J=(0,tf.G)(Z.length)&&d&&0!==d.length,ee=(0,m.useRef)(Q);ee.current=Q,(0,m.useEffect)(()=>{(0,e_.X5)()},[D.currentOid,F]),(0,m.useEffect)(()=>{window.onbeforeprint=()=>y(!0),window.onafterprint=()=>y(!1)},[]),(0,m.useEffect)(()=>{eE(null,null,U)},[]),(0,m.useEffect)(()=>{"true"!==tT.getItem("heardHelpAnnouncement")&&((0,e_.kY)("While the code is focused, press Alt+F1 for a menu of operations.",2e3),tT.setItem("heardHelpAnnouncement","true"))},[]);var et=(0,m.useCallback)(e=>{if(e&&e?.node&&!f){if(!e.node.textContent||e.node.textContent.length<3)return;let n=e.node;!n||!n.hasAttribute||n.hasAttribute("clickadded")||(n.classList.add("pl-token"),n.setAttribute("clickadded","true"),n.addEventListener("click",function(n){let r=n.target.textContent?n.target.textContent:"";t&&e&&(t({selectedText:r,lineNumber:e.lineNumber,offset:e.offset}),Y&&K(!1))}))}},[Y,f,K,t]);let en=!!(0,ey.O)(),er=(0,eO.fY)();(0,m.useEffect)(()=>{let e;if(en||!i||er)return;let t=(0,O.s)(t=>{clearTimeout(e),e=setTimeout(()=>{!function(e,t){let n=function(e,t,n){let r,i;if(document.caretPositionFromPoint){let e=document.caretPositionFromPoint(t,n);e&&(r=e.offsetNode,i=e.offset)}else if(document.caretRangeFromPoint){let e=document.caretRangeFromPoint(t,n);e&&(r=e.startContainer,i=e.startOffset)}if(!r||"number"!=typeof i||r.nodeType!==Node.TEXT_NODE||!r.textContent)return null;let o=function(e,t,n){let r,i=null;for(;r=t.exec(e);){if(t.lastIndex===i){(0,eZ.N7)(Error("regexp did not advance in findNearestMatch()"));break}i=t.lastIndex;let e=r.index+r[0].length;if(r.index<=n&&n<=e)return[r[0],r.index,e]}return null}(r.textContent,e,i);if(!o)return null;let l=document.createRange();return l.setStart(r,o[1]),l.setEnd(r,o[2]),l}(/\w+[!?]?/g,e.clientX,e.clientY);if(!n)return;let r=n.commonAncestorContainer.parentElement;if(r)for(let e of r.classList){if(["pl-token","pl-c","pl-s","pl-k"].includes(e))return null;let r=n.toString();if(!r||r.match(/\n|\s|[();&.=",]/))return null;let{lineNumber:i,offset:o,node:l}=function(e){let t=e.startContainer,n=e.startOffset;for(;;){let e=t.previousSibling;for(;e;)n+=(e.textContent||"").length,e=e.previousSibling;let r=t.parentElement;if(!r)return{lineNumber:0,offset:0,node:null};if(r.classList.contains("react-file-line"))return{lineNumber:parseInt(r.getAttribute("data-line-number")||"1",10),offset:n,node:t};t=r}}(n);if(0===i&&0===o||!l)return null;return t({lineNumber:i,offset:o,node:l})}}(t,et)},15)},5);return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}},[et,en,i,er]);let ei=({line:t,column:n})=>{if(t<10)e.current?.scrollToTop();else if(e.current){if(-1===(0,e_.N9)(t,Q)){for(let e of r?.get(t)??[])e&&e.collapsed&&(e.collapsed=!1,(0,e_.ny)(e?.startLine));V()}setTimeout(()=>{let r=(0,e_.N9)(t,ee.current);e.current?.scrollToLine(r,n)},0),G&&!(0,e_.si)(t)&&(l(null,!0),(0,e_.CZ)(G,t,r,l))}};return(0,m.useEffect)(()=>{let e=(0,eN.$c)(E);if(!e.blobRange?.start?.line)return void w(void 0);w(e.blobRange)},[F,E,Q.length]),(0,m.useEffect)(()=>{let e=(0,eN.$c)(E);if(!e.blobRange?.start?.line)return;let t=window.setTimeout(()=>ei({line:e.blobRange.start.line}),0);return()=>{window.clearTimeout(t)}},[F,f]),(0,m.useEffect)(()=>{let e=M.current;if(!e||!g)return void z(void 0);z(e.scrollWidth>e.clientWidth?e.scrollWidth:void 0);let t=new ResizeObserver(e=>{for(let{target:t}of e)z(t.scrollWidth>t.clientWidth?t.scrollWidth:void 0)});return t.observe(e),()=>{t.disconnect()}},[g,F]),(0,ek.g)(ei),(0,o.jsx)(tA.gt,{searchResults:a,focusedSearchResult:s,children:(0,o.jsxs)(t_.iU,{highlightedLines:j,children:[Q.some(e=>e.hiddenUnicode)&&(0,o.jsx)(eJ.om,{}),(0,o.jsx)(R.A,{sx:{display:"flex",flex:1,py:2*!f,flexDirection:"column",justifyContent:"space-between",minWidth:0,position:"relative"},children:(0,o.jsx)(e1.AG,{children:(0,o.jsx)(e0.eT,{children:(0,o.jsxs)(R.A,{sx:{flex:1,position:"relative",minWidth:0,overflowX:f?"auto":void 0,overflowY:f?"hidden":void 0},ref:B,onBlur:e=>{e.currentTarget.contains
`);let d=function(e,t,n,r){let i={value:0},o={nodes:[],s:0,e:e.length,c:""},l=t?.filter(e=>e.e>e.s);if(!l||0===l.length)return o.nodes.push(a("",e,0,e.length,i,r,n)),o;let s=[o];for(let t=0;t<l.length;t++){let c=l[t],d=l[t+1],u=s[s.length-1]??o,h=u.nodes[u.nodes.length-1];if(0===u.nodes.length&&c.s>u.s){let t=a("",e,u.s,c.s,i,r,n);u.nodes.push(t)}else if(h&&c.s>h.e){let t=a("",e,h.e,c.s,i,r,n);u.nodes.push(t)}if(d&&d.s<c.e){let e={...c,nodes:[]};u.nodes.push(e),s.push(e)}else{let t=a(c.c,e,c.s,c.e,i,r,n);u.nodes.push(t)}if(d&&d.s>=u.e){let t=c.e;if(u.e>t){let o=a("",e,t,u.e,i,r,n);u.nodes.push(o),t=u.e}for(;s.length>1&&d.s>=u.e;)if(s.pop(),u=s[s.length-1]??o,s.length>1&&d.s>=u.e&&u.e>t){let o=a("",e,t,u.e,i,r,n);t=u.e,u.nodes.push(o)}}}for(;s.length>0;){let t=s.pop(),o=t.nodes[t.nodes.length-1];if(o&&o.e<t.e){let l=a("",e,o.e,t.e,i,r,n);t.nodes.push(l)}}return o}(e,(0,o.M)(t??[]),n,r),u=[];return function e(t,n,r,o){for(let a of(t.c&&o.push(`<span class="${s(t.c)}">`),t.nodes))"nodes"in a?e(a,n,r,o):o.push(function e(t,n,r){switch(n){case"data-attribute":{let o=s(t.text);if(r&&(0,i.Y)(o)){let r=(0,i.t6)(o).map(r=>{let o=(0,i._n)(r);return o?(0,i.rE)(o):e({...t,text:r,c:""},n,!1)});return t.c?`<span class="${s(t.c)}">${r.join("")}</span>`:r.join("")}return t.c?`<span class="${s(t.c)}" data-code-text="${o}"></span>`:`<span data-code-text="${o}"></span>`}case"separated-characters-chunked":case"separated-characters":{if(t.text&&!t.text.trim())return e({...t},"data-attribute",r);let o=[...t.text];"separated-characters-chunked"!==n||r||(o=t.text.match(/.{1,2}/g)??o);let l=[...o].map(e=>{let t=r?(0,i._n)(e):void 0;return t?(0,i.rE)(t):`<span data-code-text="${s(e)}"></span>`}).join("");return t.c?`<span class="${s(t.c)}">${l}</span>`:l}default:{let e=s(t.text),n=r?(0,l.Gx)(e)??e:e;return t.c?`<span class="${s(t.c)}">${n}</span>`:n}}}(a,n,r));t.c&&o.push("</span>")}(d,n,c,u),u.join("")}(n,t,c,u,h),[n,e,t,c,u,h])}},98386:(e,t,n)=>{n.d(t,{G:()=>r});let r=e=>({})},40245:(e,t,n)=>{n.d(t,{u:()=>l});var r=n(96235),i=n(60039),o=n(96540);function l(e,t,n,l){let[a,s]=(0,o.useState)({loading:!0}),c=t&&e&&n&&l?(0,r.IO9)({repo:{name:t,ownerLogin:e},commitish:n,action:"file-contributors",path:l}):null;return(0,o.useEffect)(()=>{if(!c)return;let e=!1;return(async()=>{s({loading:!0});let t=await (0,i.lS)(c);if(!e)try{t.ok?s({contributors:await t.json()}):s({error:!0})}catch{s({error:!0})}})(),function(){e=!0}},[c]),a}},37433:(e,t,n)=>{n.d(t,{H:()=>i});var r=n(25772);function i(e,t){let{csrf_tokens:n}=(0,r.B)();return n?.[e]?.[t]}},14103:(e,t,n)=>{n.d(t,{L:()=>i});var r=n(96540);function i(e){(0,r.useEffect)(()=>{if(!e)return;let t=document.querySelector(".footer");if(t)return t.hidden=!0,()=>{t.hidden=!1}},[e])}},70979:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(96540);function i(){return(0,r.useSyncExternalStore)(a,o,l)}function o(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function l(){return!1}function a(){return()=>{}}},60040:(e,t,n)=>{n.d(t,{vp:()=>o.v,hf:()=>s,CK:()=>c});var r=n(17515),i=n(96540),o=n(35822);let l=e=>e;function a(e,t){return({additionalScrollOffset:n=0,scrollToFn:o,horizontal:l,parentRef:a,shouldUseScrollRef:s=!0,...c})=>{(0,i.useDebugValue)(t);let d=(0,i.useRef)(window),u=(0,i.useCallback)(()=>{let e=a.current?.getBoundingClientRect(),t=e?.top??0,n=e?.left??0;return l?-1*n:-1*t},[l,a]),h=(0,i.useCallback)(e=>{let t=e+((a.current?.getBoundingClientRect().top??0)+window.scrollY)+n;d.current?.scroll({top:l?0:t,left:l?t:0})},[n,l,a]);return e({...c,horizontal:l,parentRef:a,scrollToFn:o||h,onScrollElement:s?d:void 0,scrollOffsetFn:u,useObserver:()=>(function(e){let[t,n]=(0,i.useState)({height:0,width:0}),o=e.current;return(0,r.N)(()=>{if(!o)return;let e=()=>{let e={height:o.innerHeight,width:o.innerWidth};n(t=>t.height!==e.height||t.width!==e.width?e:t)};return e(),o.addEventListener("resize",e),()=>{o.removeEventListener("resize",e)}},[o]),t})(d)})}}let s=a(o.z,"useVirtualWindow"),c=a(function(e){let t=i.useRef({}),n=i.useRef({}),r=(e,n)=>{t.current[e](n)},a=i.useRef(r);a.current=r;let s=i.useRef(new ResizeObs
`}</div>${l}`}).join(`
`):"<div></div>",[e,t,n])}(e,t??null),o=(0,d.Gb)();return(0,r.jsx)(i.$6,{...o?{inert:"inert"}:{},html:n})}try{m.displayName||(m.displayName="SyntaxHighlightedLine")}catch{}try{p.displayName||(p.displayName="SyntaxHighlightedLineWithRef")}catch{}try{f.displayName||(f.displayName="SyntaxHighlightedOverlay")}catch{}try{x.displayName||(x.displayName="SyntaxHighlightedOverlayUnmemoed")}catch{}},87453:(e,t,n)=>{n.d(t,{a:()=>o,t:()=>l});var r=n(74848),i=n(75177);let o="find-result-marks-container";function l(){return(0,r.jsx)(i.A,{sx:{position:"fixed",top:0,right:0,height:"100%",width:"15px",transition:"transform 0.3s","&:hover":{transform:"scaleX(1.5)"},zIndex:1},id:o})}try{l.displayName||(l.displayName="ScrollMarksContainer")}catch{}},62578:(e,t,n)=>{n.d(t,{eT:()=>x,z8:()=>y});var r=n(74848),i=n(141),o=n(7956),l=n(88795),a=n(98075),s=n(17515),c=n(75177),d=n(96540),u=n(40961),h=n(76087),m=n(905);let p="copilot-button-positioner",f="copilot-button-container";function x({children:e}){return(0,r.jsxs)(c.A,{id:p,sx:{position:"relative"},children:[e,(0,r.jsx)("div",{id:f})]})}let y=d.memo(d.forwardRef(g));function g({rowBeginNumber:e,rowEndNumber:t,id:n,recalcPosition:c},x){let[y,g]=(0,d.useState)(null);(0,d.useImperativeHandle)(x,()=>({setAnchor:g}));let[b,v]=(0,d.useState)(void 0);(0,s.N)(()=>{let e=()=>requestAnimationFrame(()=>v(function(e,t={x:0,y:0}){let n=document.getElementById(p);if(!e||!n)return{display:"none"};let{top:r,height:i}=e.getBoundingClientRect(),{top:o}=n.getBoundingClientRect(),l=(m.u9-i)/2;return{top:`${r-o-l+t.y+1}px`,right:"37px"}}(y)));return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[y,c]);let{copilotAccessAllowed:j,refInfo:w,path:N}=(0,i.eu)(),_=(0,l.t)(),{language:k,languageID:C}=(0,h.A)(),A=(0,d.useMemo)(()=>({type:"snippet",languageID:C,languageName:k,path:N,range:{start:e,end:t},ref:(0,a.D7)(w.name,w.refType),commitOID:w.currentOid,repoID:_.id,repoName:_.name,repoOwner:_.ownerLogin,url:window.location.href}),[C,k,N,e,t,w,_]),S=void 0===b?null:(0,r.jsx)("div",{style:{alignSelf:"center",position:"absolute",lineHeight:"16px",height:"24px",width:"24px",zIndex:2,...b},children:(0,r.jsx)(o.Ay,{copilotAccessAllowed:j,messageReference:A,id:n})}),B=document.getElementById(f);return B?(0,u.createPortal)(S,B):null}try{x.displayName||(x.displayName="CopilotButtonContainer")}catch{}try{y.displayName||(y.displayName="CopilotButton")}catch{}try{g.displayName||(g.displayName="CopilotButtonWithRef")}catch{}},42490:(e,t,n)=>{n.d(t,{AG:()=>C,Ay:()=>S,Dp:()=>k});var r=n(74848),i=n(54763),o=n(141),l=n(50104),a=n(21113),s=n(88795),c=n(96235),d=n(96679),u=n(17515),h=n(26807),m=n(38621),p=n(10569),f=n(87330),x=n(15385),y=n(52464),g=n(96540),b=n(40961),v=n(68048),j=n(90864),w=n(905),N=n(63205);let _="highlighted-line-menu-container",k="highlighted-line-menu-first-option";function C({children:e}){return(0,r.jsxs)("div",{id:w.uU,className:"position-relative",children:[e,(0,r.jsx)("div",{id:_})]})}let A=g.memo(g.forwardRef(B)),S=A;function B({codeLineClassName:e,offset:t,lineData:n,onLineStickOrUnstick:C,onMenuClose:A,onCollapseToggle:S,openOnLoad:B=!1,cursorRef:I,rowBeginId:L,rowBeginNumber:T,rowEndId:R,rowEndNumber:E},O){let[D,F]=(0,g.useState)(null);(0,g.useImperativeHandle)(O,()=>({setAnchor:F}));let $=g.useRef(null),{githubDevUrl:M}=(0,o.sq)(),{modelsAccessAllowed:P,refInfo:z,path:H}=(0,o.eu)(),W=(0,s.t)(),[U,V]=(0,g.useState)(B?"hidden":"visible"),[G,q]=(0,g.useState)(void 0);(0,u.N)(()=>{let e=()=>{V("hidden"),requestAnimationFrame(()=>{q((0,w.sZ)(D,t)),V("visible")})};return e(),d.cg?.addEventListener("resize",e),()=>{d.cg?.removeEventListener("resize",e)}},[D,t]),(0,u.N)(()=>{if(B){I&&F(I.current);let e=window.setTimeout(()=>{Z(!0)},50);return()=>{window.clearTimeout(e)}}},[]);let{newDiscussionPath:Y,newIssuePath:K}=(0,j.Y_)(),{refSelectorShortcut:Q}=(0,l.wk)(),[X,Z]=g.useState(!1),{createPermalink:J,getUrl:ee}=(0,a.Z)(),{setShouldBeOpen:et,expandOrCollapseSection:en,openUpRefSelector:er}=(0,w.S9)({lineData:n,onLineStickOrUnstick:C,onMenuClose:A,onCollapseToggle:S,setOpen:Z}
`:""}`;e&&(0,v.D)(e),et(!1)},onSelect:()=>{(0,N.kY)(`Copied lines ${T}-${E}.`);let e="";for(let t=T;t<=E;t++)e+=`${(0,w.zM)(d.XC?.getElementById(`LC${t}`)??null)}${t!==E?`
`:""}`;e&&(0,v.D)(e),et(!1)},className:k,children:"Copy lines"}),eo&&(0,r.jsx)(x.l.Item,{onClick:()=>{(0,N.kY)("Copied permalink."),(0,v.D)(eo),et(!1)},onSelect:()=>{(0,N.kY)("Copied permalink."),(0,v.D)(eo),et(!1)},children:"Copy permalink"}),(0,r.jsx)(x.l.LinkItem,{href:ee({action:"blame",hash:ea}),children:"View git blame"}),K&&eo&&(0,r.jsx)(x.l.LinkItem,{href:`${K}?permalink=${el}`,children:"Reference in new issue"}),Y&&eo&&(0,r.jsx)(x.l.LinkItem,{href:`${Y}?permalink=${el}`,children:"Reference in new discussion"}),M&&(0,r.jsx)(x.l.LinkItem,{href:M+d.cg?.location.pathname.substring(1),children:"View file in GitHub.dev"}),T===E&&n&&(0,r.jsxs)(x.l.Item,{onClick:en,onSelect:en,children:[n.ownedSection&&n.ownedSection.collapsed?"Expand":"Collapse"," current section"]}),(0,r.jsxs)(x.l.Item,{onClick:er,onSelect:er,children:["View file in different branch/tag",(0,r.jsx)(x.l.TrailingVisual,{children:(0,r.jsx)(i.E,{children:Q.text})})]}),P&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.W.Divider,{}),(0,r.jsxs)(x.l.LinkItem,{href:(0,c.Da2)({registry:"azure-openai",name:"gpt-4o",commit:z.currentOid,filePath:H,repoOwner:W.ownerLogin,repoName:W.name,beginLine:T,endLine:E}),target:"_blank",children:[(0,r.jsx)("p",{className:"mb-1",children:"Open as prompt in GitHub Models"}),(0,r.jsx)(y.A,{sx:{color:"fg.muted",fontSize:0},children:"This tool uses AI to process your code"})]})]})]})})]}),ec=d.XC?.getElementById(_);return ec?(0,b.createPortal)(es,ec):null}try{C.displayName||(C.displayName="HighlightedLineMenuContainer")}catch{}try{A.displayName||(A.displayName="HighlightedLineMenu")}catch{}try{B.displayName||(B.displayName="HighlightedLineMenuWithRef")}catch{}},56369:(e,t,n)=>{n.d(t,{U:()=>l,p:()=>a});var r=n(74848),i=n(21325),o=n(52464);function l({symbols:e,focusedSymbol:t,lineNumber:n,sx:l,isNotUsingWhitespace:s,className:c}){let d=0,u=e.length>0?e[0].bodyText:"",h=`overlay-${n}-${l?"blob":"panel"}-${u}`,m=(0,i.ud)().codeWrappingOption,p=e.length>0&&!s?e[0].leadingWhitespace??0:0;return(0,r.jsxs)(o.A,{className:c,sx:{mb:"-20px",color:"transparent",position:"absolute",overflowWrap:m.enabled?"anywhere":"unset",maxWidth:m.enabled?"100%":"unset",maxHeight:"6rem",overflow:"hidden",width:"100%",display:"inline-block",userSelect:"none",...l},children:[e.map(e=>{let n=(0,r.jsxs)("span",{children:[(0,r.jsx)(o.A,{sx:{userSelect:"none",visibility:"hidden"},children:u.substring(d,e.ident.start.column+p)}),(0,r.jsx)(o.A,{sx:{bg:e===t?"#ff9632":"var(--bgColor-attention-muted)",zIndex:e===t?10:void 0,color:e===t?"black":void 0,position:e===t?"relative":void 0,userSelect:"none",pointerEvents:"none"},children:(0,r.jsx)(o.A,{sx:{visibility:e!==t?"hidden":void 0},id:a(e.lineNumber,e.ident.start.column+p),children:u.substring(e.ident.start.column+p,e.ident.end.column+p)})})]},`symbol-${e.ident.start.line}-${e.ident.start.column+p}`);return d=e.ident.end.column+p,n}),(0,r.jsx)(o.A,{sx:{visibility:"hidden",userSelect:"none"},children:u.substring(d)})]},h)}function a(e,t){return`match-${e}-${t}`}try{l.displayName||(l.displayName="HighlightedOverlay")}catch{}},3147:(e,t,n)=>{n.d(t,{PL:()=>h,TX:()=>m,Zj:()=>u});var r=n(74848),i=n(96235),o=n(60183),l=n(60039),a=n(96540),s=n(95321);let c={stylingDirectives:null},d=a.createContext(c);function u({children:e,...t}){return(0,r.jsx)(d.Provider,{value:t,children:e})}function h(){return a.useContext(d)}function m(e,t,n,r,d){let[u,h]=(0,a.useState)(c),m=(0,o.u)("react_blob_overlay"),p=t&&!r?(0,i.rzN)({repo:e,commitish:t.name,path:n}):null;return(0,a.useEffect)(()=>{if(!p)return;if(d>s.OL||!m)return void h(c);let e=!1;return(async()=>{h(c);let t=await (0,l.lS)(p);if(!e)try{if(t.ok){let e=await t.json();e&&Array.isArray(e.stylingDirectives)&&h(e)}else h(c)}catch{h(c)}})(),function(){e=!0}},[p,d,m]),u}try{d.displayName||(d.displayName="DeferredASTContext")}catch{}try{u.displayName||(u.displayName="DeferredASTProvider")}catch{}},90864:(e,t,n)=>{n.d(t,{U6:()=>u,Y_:()=>d,mD:()=>c});var r=n(74848),i=n(96235),o=n(60039),l=n(96540);let a={showLicenseMeta:!1,license:null,codeownerInfo:{codeownerPath:null,ownedByCurrentUser:
new technologies means delivering better customers solutions. Try it in Codespaces or your file editor.`,ORG_MEMBER:`We noticed that you're personally paying for GitHub Copilot. Instead, ask your organization admin
to purchase the business version of GitHub Copilot.`,STANDARD:`Spend less time creating boilerplate and repetitive code patterns, and more time building great software.
Try it in Codespaces or your favorite file editor.`},j=({featureRequestInfo:e,inProgress:t,toggleFeatureRequest:n,requested:i})=>e?.showFeatureRequest?i?(0,r.jsx)(o.c9,{inProgress:t,toggleFeatureRequest:n}):(0,r.jsx)(o.iU,{inProgress:t,toggleFeatureRequest:n,featureName:e?.featureName}):null,w=({view:e,copilotInfo:t,className:n})=>{let{documentationUrl:w,notices:N,userAccess:_}=t??{},{business:k,orgHasCFBAccess:C,userHasCFIAccess:A,userHasOrgs:S,userIsOrgAdmin:B,userIsOrgMember:I,featureRequestInfo:L}=_??{},{codeViewPopover:T}=N??{},{sendClickAnalyticsEvent:R}=(0,a.S)(),E=(0,g.i)(),{isOrgOwned:O,ownerLogin:D}=(0,i.t)(),{inProgress:F,requested:$,dismissed:M,dismissedAt:P,toggleFeatureRequest:z}=(0,o.tV)(L),[H,W]=(0,y.useState)(!1),[U,V]=(0,y.useState)(!1),G=(0,y.useCallback)(()=>W(!0),[W]),q=(0,y.useCallback)(()=>W(!1),[W]),Y=(0,y.useCallback)(()=>_&&O&&I&&!B&&(!C||A)?"Your organization can pay for GitHub Copilot":"Code 55% faster with GitHub Copilot",[C,O,_,A,B,I]),K=()=>E&&D===E.login?"owner":B?"admin":I?"member":"personal",Q=()=>{E&&R({category:"copilot_popover_code_view",action:`click_to_open_popover_${e}`,label:`ref_cta:open_copilot_popover;owner:${D};relationship:${K()}`})},X=(t,n)=>{R({category:"copilot_popover_code_view",action:t,label:`ref_cta:${n};ref_loc:code_view_${e}`})},Z=()=>{let t=`${O?"org_":""}code_view_${e}${B?"_org_admin":""}`;R({category:"copilot_popover_code_view",action:"click_to_dismiss_copilot_popover_forever",label:`ref_cta:dont_show_again;ref_loc:${t}`})},J=()=>{let e=_?.userHasOrgs??!1;R({category:"copilot_popover_code_view",action:`click_to_go_to_copilot_for_${e?"business":"individuals"}_info`,label:"ref_cta:learn_more;ref_loc:code_view"})};return U||!t?null:(0,r.jsx)("div",{className:n,children:(0,r.jsx)(h.T,{onOpen:G,onClose:q,open:H,overlayProps:{role:"dialog",sx:{overflow:"inherit"}},focusZoneSettings:{disabled:!0},renderAnchor:e=>(0,r.jsx)(m.Q,{...e,...(0,l.G)("copilot-popover-button"),leadingVisual:c.CopilotIcon,onClick:()=>{W(!H),Q()},size:"small",sx:{color:"fg.default",display:["none","none","none","none","block"]},variant:"invisible",children:Y()}),children:(0,r.jsxs)(p.A,{...(0,l.G)("copilot-popover-content"),caret:"top",className:b.PointerBox,children:[(0,r.jsx)(f.A,{as:"h2",sx:{fontSize:1,fontWeight:"bold",pb:3},children:"Code 55% faster with GitHub Copilot"}),(0,r.jsxs)(x.A,{sx:{fontSize:1,fontWeight:"normal",pb:3},children:[(0,r.jsx)("span",{...(0,l.G)("copilot-popover-body-text"),children:(()=>{if(M)return"";if(_&&O){if(B)return v.ORG_ADMIN;else if(I&&A)return v.ORG_MEMBER}return v.STANDARD})()}),M?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{children:["Your request for Copilot Business was declined by an admin on ",P,"."]}),(0,r.jsxs)("p",{className:"mb-0",children:[(0,r.jsx)(d.A,{...(0,l.G)("contact-admin-link"),"aria-label":"Click this link to contact your admin.",target:"_blank",href:`/orgs/${D}/people?query=role:owner`,onClick:()=>J(),children:"Contact your admin"}),""," for more details around their decision."]})]}):(0,r.jsx)(d.A,{...(0,l.G)("copilot-popover-content-learn-more"),"aria-label":"Click this link to learn more about copilot. This action opens in a new tab.",target:"_blank",href:w,onClick:()=>J(),sx:{marginLeft:"8px"},children:"Learn more"})]}),(0,r.jsxs)(x.A,{sx:{alignItems:"center",display:"flex",flexDirection:"row"},children:[k||A||O&&(!O||I)?I&&!C&&B?(0,r.jsx)(u.z,{type:"button",href:`/github-copilot/business_signup/organization/payment?org=${D}`,onClick:()=>X("click_to_buy_copilot_for_business","get_github_copilot"),children:"Get GitHub Copilot"}):L&&!M?(0,r.jsx)(j,{requested:$,featureRequestInfo:L,inProgress:F,toggleFeatureRequest:z}):null:S?(0,r.jsx)(u.z,{type:"button",href:"/settings/copilot",onClick:()=>X("click_to_go_to_copilot_settings","get_github_copilot"),children:"Get GitHub Copilot"}):(0,r.jsx)(u.z,{type:"button",href:"/github-copilot/signup",onClick:()=>X("click_to_go_to_copilot_trial_signup","start_a_free_trial"),children:"Start a free trial"}),(0,r.jsx)(d.A,{...(0,l.G)("copilot-popover-dismiss-button"),onClick:()=>{T&&((0,s.DI)(T.dismis
//# sourceMappingURL=react-code-view-e19e3abc01e7.js.map