performance.mark("js-parse-end:29534-f55053461a7194af.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["29534"],{79344(e,t,n){var i=n(62269),l=n(85498),s=n(74469),r=n(21403),o=n(21744),a=n(66743),c=n(21079);let d=!1;function u(e,t){return document.querySelector(`#${e}LC${t}`)}function f(){let e=(0,i.$c)(window.location.hash);!function({blobRange:e,anchorPrefix:t}){if(0!==document.querySelectorAll(".js-file-line").length&&(function(){for(let e of document.querySelectorAll(".js-file-line.highlighted"))e.classList.remove("highlighted");for(let e of document.querySelectorAll(".js-file-line .highlighted")){let t=e.closest(".js-file-line");e.replaceWith(...e.childNodes),t.normalize()}}(),e)){if(null===e.start.column||null===e.end.column)for(let n=e.start.line;n<=e.end.line;n+=1){let e=u(t,n);e&&e.classList.add("highlighted")}else if(e.start.line===e.end.line&&null!=e.start.column&&null!=e.end.column){let n=(0,i.Py)(e,e=>u(t,e));if(n){let e=document.createElement("span");e.classList.add("highlighted"),(0,c.t)(n,e)}}}}(e),function(){let e=document.querySelector(".js-file-line-actions");if(!e)return;let t=document.querySelectorAll(".js-file-line.highlighted"),n=t[0];if(n){var i;let l,s=[];for(let e of t)s.push(e.textContent);let r=document.getElementById("js-copy-lines");if(r&&"CLIPBOARD-COPY"===r.tagName){r.textContent=`Copy ${1===t.length?"line":"lines"}`,r.value=s.join("\n");let e=`Blob, copyLines, numLines:${t.length.toString()}`;r.setAttribute("data-ga-click",e)}i=t.length,(l=document.getElementById("js-view-git-blame"))&&l.setAttribute("data-ga-click",`Blob, viewGitBlame, numLines:${i.toString()}`);let o=function(e){let t=document.querySelector(".js-permalink-shortcut");if(t instanceof HTMLAnchorElement){let n=`${t.href}${window.location.hash}`,i=document.getElementById("js-copy-permalink");if(i&&"CLIPBOARD-COPY"===i.tagName){i.value=n;let t=`Blob, copyPermalink, numLines:${e.toString()}`;i.setAttribute("data-ga-click",t)}return n}}(t.length);o&&function(e,t){let n=document.getElementById("js-new-issue");if(n instanceof HTMLAnchorElement){if(!n.href)return;let i=new URL(n.href,window.location.origin),l=new URLSearchParams(i.search);l.set("permalink",e),i.search=l.toString(),n.href=i.toString(),n.setAttribute("data-ga-click",`Blob, newIssue, numLines:${t.toString()}`)}}(o,t.length),o&&function(e,t){let n=document.getElementById("js-new-discussion");if(!(n instanceof HTMLAnchorElement)||!n?.href)return;let i=new URL(n.href,window.location.origin),l=new URLSearchParams(i.search);l.set("permalink",e),i.search=l.toString(),n.href=i.toString(),n.setAttribute("data-ga-click",`Blob, newDiscussion, numLines:${t.toString()}`)}(o,t.length),e.style.top=`${n.offsetTop-2}px`,e.classList.remove("d-none")}else e.classList.add("d-none")}();let{blobRange:t,anchorPrefix:n}=e,l=t&&u(n,t.start.line);!d&&l&&(l.scrollIntoView(),l.closest(".blob-wrapper, .js-blob-wrapper").scrollLeft=0),d=!1}(0,s.A)(function(){if(document.querySelector(".js-file-line-container")){setTimeout(f,0);let e=window.location.hash;for(let t of document.querySelectorAll(".js-update-url-with-hash"))if(t instanceof HTMLAnchorElement)t.hash=e;else if(t instanceof HTMLFormElement){let n=new URL(t.action,window.location.origin);n.hash=e,t.action=n.toString()}}}),(0,o.on)("click",".js-line-number",function(e){let t,n=(0,i.$c)(e.currentTarget.id),{blobRange:l}=n,s=(0,i.eC)(window.location.hash);s&&e.shiftKey&&(n.blobRange={start:s.start,end:l.end}),t=window.scrollY,d=!0,(()=>{window.location.hash=(0,i.JB)(n)})(),window.scrollTo(0,t)}),(0,r.lB)(".js-check-hidden-unicode",function(e){let t=!1,n=performance.now();if(h.test(e.textContent||"")){let n=e.querySelectorAll(".diff-table .blob-code-inner, .js-file-line-container .js-file-line, .js-suggested-changes-blob .blob-code-inner"),i=document.querySelector(".js-line-alert-template"),s=document.querySelector(".js-revealed-character-template");for(let r of n)if(function e(t,n){if(t.nodeType===Node.TEXT_NODE)return function(e,t){let n=!1;if(e.nodeValue)for(let i=e.nodeValue.length-1;i>=0;i--){let s=e.nodeValue.charAt(i),r="\uDB40"===s&&e.nodeValue.length>i+1;if(r&&(s=e.nodeValue.substring(i,i+2)),m[s]){if(n=!0,!t)break;let o=new l.TemplateInstance(t,{revealedCharacter:m[s]}),a=new Range;a.setStart(e,i),a.setEnd(e,i+(r?2:1)),a.deleteContents(),a.insertNode(o)}}return n}(t,n);if(!t.childNodes||!t.childNodes.length)return!1;let i=!1;for(let l of t.childNodes)if((i||=e(l,n))&&!n)break;return i}(r,s)&&(t=!0,i)){let t=new l.TemplateInstance(i,{});"before"===e.getAttribute("data-line-alert")?r.before(t):r.after(t)}}let i={durationMs:(performance.now()-n).toString(),result:t.toString()};if((0,a.BI)("blob_js_check_hidden_unicode_character",i),t){let t=document.querySelector(".js-file-alert-template");if(t){let n=new URL(window.location.href,window.location.origin);"1"===n.searchParams.get("h")?n.searchParams.delete("h"):n.searchParams.set("h","1");let i=new l.TemplateInstance(t,{revealButtonHref:n.href});e.prepend(i)}}e.classList.remove("js-check-hidden-unicode")});let h=/[\u202A-\u202E]|[\u2066-\u2069]|\u{E0001}|\u{E007F}/u,m={"\u202A":"U+202A","\u202B":"U+202B","\u202C":"U+202C","\u202D":"U+202D","\u202E":"U+202E","\u2066":"U+2066","\u2067":"U+2067","\u2068":"U+2068","\u2069":"U+2069","\uDB40\uDC01":"U+E0001","\uDB40\uDC7F":"U+E007F"};class g{lineElement;numberElement;constructor(e,t){this.lineElement=e,this.numberElement=t}range(e,t){e=isNaN(e)?0:e,t=isNaN(t)?0:t;let n=null,i=0,l=0;for(let[s,r]of this.lineElement.childNodes.entries()){let o=(r.textContent||"").length;if(o>e&&!n&&(n=r,i=s),o>=t){l=s;break}e-=o,t-=o}let s=document.createRange();if(i===l){for(;n&&"#text"!==n.nodeName;)n=n.childNodes[0];if(!n)return null;s.setStart(n,e),s.setEnd(n,t)}else s.setStart(this.lineElement,i),s.setEnd(this.lineElement,l+1);return s}}class b{container;constructor(e){this.container=e}findLine(e){if(!e)return null;let t=this.container.querySelector(`.js-blob-rnum[data-line-number='${e}']`);if(!t)return null;let n=t.nextElementSibling;return n&&n.classList.contains("js-file-line")?new g(n,t):null}}let p=new WeakMap;function L(e){if(!e)return;let t=e.closest(".js-blob-code-container, .js-file-content"),n=e.querySelector(".js-codeowners-error-tooltip-template"),i=e.querySelector(".js-codeowners-error-line-alert-template");if(!t||!n||!i)return;let s=t.querySelector("deferred-diff-lines");if(s?.isAwaitingHighlight())return;let r=e.querySelectorAll(".js-codeowners-error"),o=new b(t);for(let e of r){if(p.get(e))continue;let t=e.getAttribute("data-line"),s=e.getAttribute("data-kind"),r=e.getAttribute("data-suggestion"),a=parseInt(e.getAttribute("data-start-offset")||"",10),c=parseInt(e.getAttribute("data-end-offset")||"",10),d=o.findLine(t),u=d?.range(a,c);if(!d||!u)continue;let f=s;r&&(f+=`: ${r}`);let h=document.createElement("SPAN");h.className="error-highlight",u.surroundContents(h);let m=new l.TemplateInstance(n,{message:f}).firstElementChild;u.surroundContents(m);let g=new l.TemplateInstance(i,{});d.numberElement.appendChild(g),p.set(e,!0)}}(0,r.lB)(".js-codeowners-errors",L),(0,o.on)("expander:expanded",".js-file",function(e){e.target&&e.target instanceof HTMLElement&&L(e.target.querySelector(".js-codeowners-errors"))}),(0,o.on)("deferred-highlight:applied","deferred-diff-lines",function(e){if(!e.target||!(e.target instanceof HTMLElement))return;let t=e.target.closest(".js-file");L(t?.querySelector(".js-codeowners-errors"))})},9624(e,t,n){n.d(t,{E:()=>i});function i(e){let t=e.match(/^#?(diff-[a-f0-9]+)(L|R)(\d+)(?:-(L|R)(\d+))?$/i);if(null!=t&&6===t.length)return t;let n=e.match(/^#?(discussion-diff-[0-9]+)(L|R)(\d+)(?:-(L|R)(\d+))?$/i);return null!=n&&6===n.length?n:null}},76291(e,t,n){n.d(t,{LU:()=>w,wr:()=>y,lI:()=>p});var i=n(94668);class l{diffId;side;lineNumber;element;constructor(e,t,n){this.diffId=e,this.side=t,this.lineNumber=n,this.element=(0,i.w$)(document,this.anchor())}sideForCommenting(){return this.element&&this.element.classList.contains("blob-num-context")?"right":({R:"right",L:"left"})[this.side]}isContext(){return!!this.element&&this.element.classList.contains("blob-num-context")}anchor(){return`${this.diffId}${this.anchorSuffix()}`}anchorSuffix(){return`${this.side}${this.lineNumber}`}is(e){return this.diffId===e.diffId&&this.side===e.side&&this.lineNumber===e.lineNumber}}class s{elements;isParsed;isSplit;diffId;diffTable;start;end;lineCount;_rows;_isAcrossHunks;_isContextOnly;_includesExpandedLine;_commentOutsideTheDiff;constructor(e,t,n,i,s){this.elements=new Set,this.isParsed=!1,this.isSplit=!1,this._rows=new Set,this._isAcrossHunks=!1,this._isContextOnly=!0,this._includesExpandedLine=!1,this._commentOutsideTheDiff=!1,this.diffId=e,this.diffTable=document.querySelector(`.js-diff-table[data-diff-anchor="${e}"]`),this.diffTable&&(this.isSplit=this.diffTable.classList.contains("js-file-diff-split")),this.start=new l(e,t,n),this.end=new l(e,i,s),this.lineCount=0,this.parse()}anchor(){let e=[];return e.push(this.start.anchor()),this.start.is(this.end)||e.push(this.end.anchorSuffix()),e.join("-")}parse(){if(!this.diffTable)return;let e=this.unify(this.diffTable.querySelectorAll(".js-linkable-line-number"));e=this.filterInRange(e),this.lineCount=e.length,this.elements=this.expandRelatedElements(e),this._commentOutsideTheDiff=this.diffTable.classList.contains("js-comment-outside-the-diff"),this.isParsed=!0}unify(e){if(!this.isSplit)return Array.from(e);let t=[],n=[],i=[];for(let l of e)l.classList.contains("blob-num-addition")?n.push(l):l.classList.contains("blob-num-deletion")?i.push(l):(t.push(...i,...n,l),n=[],i=[]);return t.push(...i,...n),t}filterInRange(e){if(!this.start.element||!this.end.element)return[];let t=e.indexOf(this.start.element),n=e.indexOf(this.end.element);if(t>n){[t,n]=[n,t];let[e,i]=[this.end,this.start];this.start=e,this.end=i}return e.slice(t,n+1)}isContextOnly(){return this.isParsed||this.parse(),this._isContextOnly}isAcrossHunks(){return this.isParsed||this.parse(),this._isAcrossHunks}includesExpandedLine(){return this.isParsed||this.parse(),this._includesExpandedLine}commentOutsideTheDiffEnabled(){return this.isParsed||this.parse(),this._commentOutsideTheDiff}rows(){return this.isParsed||this.parse(),this._rows}expandRelatedElements(e){let t=this.isSplit,n=e[0],i=e[e.length-1];if(n&&i){let e=n.closest("[data-hunk]"),t=i.closest("[data-hunk]");e&&t&&e.getAttribute("data-hunk")!==t.getAttribute("data-hunk")&&(this._isAcrossHunks=!0)}let l=(e,n)=>{!this._includesExpandedLine&&n.closest(".blob-expanded")&&(this._includesExpandedLine=!0);let i=n.parentElement;i instanceof HTMLElement&&this._rows.add(i);let l=n.classList.contains("blob-num-deletion")||n.classList.contains("blob-num-addition");if(l&&(this._isContextOnly=!1),!i)return e;if(t&&l)return 2>Array.from(i.children).indexOf(n)?e.add(i.children[0]).add(i.children[1]):e.add(i.children[2]).add(i.children[3]);for(let t of Array.from(i.children))e.add(t);return e};return e.reduce(l,new Set)}}var r=n(74469),o=n(9624),a=n(21403),c=n(21744),d=n(51388),u=n(69259),f=n(56341);let h=null,m=null,g=!1,b=null;function p(){return h}function L(e){return!!e.closest(".js-multi-line-comments-enabled")}function w(e,t){if(!L(e))return!1;let{start:{lineNumber:n},end:{lineNumber:i}}=t;return!(n===i&&t.isContextOnly()||!t.commentOutsideTheDiffEnabled()&&(t.isAcrossHunks()||t.includesExpandedLine()))&&!0}function E(e){return e.closest(".js-diff-table").classList.contains("is-selecting")}function y(){(0,f.K3)(),C(),u.o.dispatch()}function j(e,t){let n=e.id;if(t){let t=(0,o.E)(n);if(!t)return;let r=t[1],a=t[2],c=t[3];if(h&&h.diffId===r){var i,l;let t;if(a===h.start.side&&Number.parseInt(c){document.addEventListener("click",S,{once:!0})},0)}function C(){if(h){for(let e of h.elements)e.classList.remove("selected-line","selected-line-top","selected-line-bottom","selected-line-left","selected-line-right");h=null}let e=(0,o.E)(window.location.hash);if(!e)return;let t=e[1],n=e[2],i=e[3],l=e[4]||n,r=e[5]||i,a=Array.from((h=new s(t,n,+i,l,+r)).elements)[0];a&&(a.closest(".js-diff-table").classList.contains("file-diff-split")?function(){if(!h)return;for(let e of h.elements)e.classList.add("selected-line");let e=[],t=[],n=[],i=[];for(let l of h.rows()){let[s,r,o,a]=l.children;e.push(s),t.push(r),n.push(o),i.push(a)}function l(e){for(let[t,n]of e.entries()){if(n.classList.contains("empty-cell"))continue;let i=e[t-1];i&&i.classList.contains("selected-line")||n.classList.add("selected-line-top");let l=e[t+1];l&&l.classList.contains("selected-line")||n.classList.add("selected-line-bottom")}}for(let[s,r]of(l(e),l(t),l(n),l(i),t.entries()))i[s].classList.contains("selected-line")||r.classList.add("selected-line-right");for(let[e,i]of n.entries())t[e].classList.contains("selected-line")||i.classList.add("selected-line-left")}():function(){if(!h)return;for(let e of h.elements)e.classList.add("selected-line");let e=Array.from(h.rows());for(let t of e[0].children)t.classList.add("selected-line-top");for(let t of e[e.length-1].children)t.classList.add("selected-line-bottom")}())}(0,c.on)("mousedown",".js-add-line-comment",function(e){if(!(e instanceof MouseEvent)||0!==e.button)return;let t=e.target.parentElement;if(!t||!L(e.target))return;let n=v(t);if(!n)return;let i=e.target.closest(".js-diff-table");A(i),b=n,g=!0,e.target.addEventListener("mouseup",function(){x(i),b=null,g=!1},{once:!0}),h&&h.lineCount>1&&e.preventDefault()}),(0,c.on)("mousedown",".js-linkable-line-number",function(e){if(!(e instanceof MouseEvent)||0!==e.button)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(".js-diff-table");n.classList.add("is-selecting"),A(n),document.addEventListener("mouseup",function(){t.closest(".js-diff-table").classList.remove("is-selecting"),x(n)},{once:!0}),j(t,e instanceof MouseEvent&&e.shiftKey),e.preventDefault()}),(0,r.A)(C),(0,a.lB)(".blob-expanded",C),(0,a.lB)(".js-diff-progressive-loader",function(e){e.addEventListener("load",C)}),(0,a.lB)(".js-diff-entry-loader",function(e){e.addEventListener("load",C)})},81644(e,t,n){var i=n(21744);(0,i.on)("click",".js-rich-diff.collapsed .js-expandable",function(e){e.target instanceof Element&&(e.preventDefault(),e.target.closest(".js-rich-diff").classList.remove("collapsed"))}),(0,i.on)("click",".js-show-rich-diff",function(e){let t=e.currentTarget.closest(".js-warn-no-visible-changes");if(!t)return;t.classList.add("d-none");let n=t.parentElement.querySelector(".js-no-rich-changes");n&&n.classList.remove("d-none")})},51388(e,t,n){n.d(t,{$3:()=>s,HV:()=>r,Vb:()=>l});var i=n(51189);function l(e,t,n){let l={hydroEventPayload:e,hydroEventHmac:t,visitorPayload:"",visitorHmac:"",hydroClientContext:n},s=document.querySelector("meta[name=visitor-payload]");s instanceof HTMLMetaElement&&(l.visitorPayload=s.content);let r=document.querySelector("meta[name=visitor-hmac]")||"";r instanceof HTMLMetaElement&&(l.visitorHmac=r.content);let o="";try{o=JSON.parse(e).event_name}catch{}(0,i.iv)(l,!0,o?.startsWith("staff_bar.")?1:void 0)}function s(e){l(e.getAttribute("data-hydro-view")||"",e.getAttribute("data-hydro-view-hmac")||"",e.getAttribute("data-hydro-client-context")||"")}function r(e){l(e.getAttribute("data-hydro-click-payload")||"",e.getAttribute("data-hydro-click-hmac")||"",e.getAttribute("data-hydro-client-context")||"")}},21079(e,t,n){n.d(t,{t:()=>i});function i(e,t){t.appendChild(e.extractContents()),e.insertNode(t)}},62269(e,t,n){function i(e){let t=e.match(/#?(?:L)(\d+)((?:C)(\d+))?/g);if(t){if(1===t.length){let e=o(t[0]);if(!e)return;return Object.freeze({start:e,end:e})}if(2!==t.length)return;{let e=o(t[0]),n=o(t[1]);if(!e||!n)return;return d(Object.freeze({start:e,end:n}))}}}function l(e){let{start:t,end:n}=d(e);return null!=t.column&&null!=n.column?`L${t.line}C${t.column}-L${n.line}C${n.column}`:null!=t.column?`L${t.line}C${t.column}-L${n.line}`:null!=n.column?`L${t.line}-L${n.line}C${n.column}`:t.line===n.line?`L${t.line}`:`L${t.line}-L${n.line}`}function s(e){let t;return{blobRange:i(e),anchorPrefix:(t=e.length<5e3&&e.match(/(file-.+?-)L\d+?/i))&&t[1]?t[1]:""}}function r({anchorPrefix:e,blobRange:t}){return t?`#${e}${l(t)}`:"#"}function o(e){if(!e)return null;let t=e.match(/L(\d+)/),n=e.match(/C(\d+)/);return t&&t[1]?Object.freeze({line:parseInt(t[1]),column:n&&n[1]?parseInt(n[1]):null}):null}function a(e,t){let[n,i]=c(e.start,!0,t),[l,s]=c(e.end,!1,t);if(!n||!l)return;let r=i,o=s;if(-1===r&&(r=0),-1===o&&(o=l.childNodes.length),!n.ownerDocument)throw Error("DOMRange needs to be inside document");let a=n.ownerDocument.createRange();return a.setStart(n,r),a.setEnd(l,o),a}function c(e,t,n){let i=[null,0],l=n(e.line);if(!l)return i;if(null==e.column)return[l,-1];let s=e.column-1,r=function e(t){if(t.nodeType===Node.TEXT_NODE)return[t];if(!t.childNodes||!t.childNodes.length)return[];let n=[];for(let i of t.childNodes)n=n.concat(e(i));return n}(l);for(let e=0;es,JB:()=>r,Kn:()=>l,Py:()=>a,eC:()=>i})},69259(e,t,n){n.d(t,{o:()=>i});class i extends Event{static NAME="diff-line-selection";constructor(){super(i.NAME,{bubbles:!1,cancelable:!0})}static dispatch(){window.dispatchEvent(new i)}}},66743(e,t,n){let i;n.d(t,{BI:()=>j,lA:()=>E,sX:()=>y,Ti:()=>v});var l=n(70837),s=n(97088),r=n(35205),o=n(26316),a=n(51189);let c="font-weight: bold; font-size: 12px;",d=new Set(["actor_id","actor_login","actor_hash","referrer","request_id","visitor_id","region_edge","region_render","staff","service","react","app_name","page","title"]),u=new Set(["hpc","ttfb","fcp","lcp","fid","inp","cls","elementtiming","longTasks","longAnimationFrames"]),f=new Set(["react","reactApp","reactPartials","featureFlags","ssr","controller","action","routePattern","cpu","domNodes","previousDomNodes","navigationId"]);function h(e){try{return JSON.parse(e)}catch{return e}}let{getItem:m}=(0,r.A)("localStorage"),g="dimension_",b=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","scid"];function p(e){try{return(0,l.O)(e)}catch{return}}let L=p("octolytics");function w(e){let t=p("octolytics")?.baseContext??{};if(t)for(let[e,n]of(delete t.app_id,delete t.event_url,delete t.host,Object.entries(t)))e.startsWith(g)&&(t[e.replace(g,"")]=n,delete t[e]);let n=o.XC?.querySelector("meta[name=visitor-payload]");for(let[e,i]of(n&&Object.assign(t,JSON.parse(atob(n.content))),new URLSearchParams(window.location.search)))b.includes(e.toLowerCase())&&(t[e]=i);return t.staff=(0,a.Xl)().toString(),Object.assign(t,e)}function E(e){i?.sendPageView(w(e))}function y(){return o.XC?.head?.querySelector('meta[name="current-catalog-service"]')?.content}function j(e,t={},{batched:n=!1}={}){let l=y(),s=l?{service:l}:{};for(let[e,n]of Object.entries(t))null!=n&&(s[e]=`${n}`);if(i){let t=e||"unknown",l=w(s);n?i.sendBatchedEvent(t,w(s)):i.sendEvent(t,w(s)),"true"===m("stats-dev-logger")&&function(e,t={}){let n,i=[];for(let[e,n]of Object.entries(t))d.has(e)||i.push([e,h(n)]);let l=void 0!==t.value?` ${"number"==typeof(n=h(t.value))?String(Math.round(n)):String(n)}`:"";console.groupCollapsed(`%cevent%c ${e}${l}`,"background: #8957e5; color: #fff; padding: 2px 6px; border-radius: 3px; font-weight: bold; font-size: 11px;",c),"web-vital"===e?function(e){for(let[t,n]of e)u.has(t)?(console.log(`%c${t}`,c),console.table(n)):f.has(t)||console.log(`${t}:`,n)}(i):(console.table(Object.fromEntries(i.map(([e,t])=>[e,{value:t}]))),console.log(Object.fromEntries(i))),console.groupEnd()}(t,l)}}function v(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,JSON.stringify(t)]))}L&&(delete L.baseContext,L.idleTimeout=5e3,L.maxBatchSize=50,i=new s.s(L))}}]); //# sourceMappingURL=29534-f55053461a7194af-c63255136719f1f8.js.map