vue-carousel-3d
Version:
Beautiful, flexible and touch supported 3D Carousel for Vue.js
3 lines • 50 kB
JavaScript
System.register(["./vendor.js","./frameworks.js"],(function(){"use strict";var e,t,n,s,o,i,r,c,a,l,u,d,m,g,f,p,h,b,j,v,L,y,A,w,S,E,T,q,x,M,H,k,I,_,C,$;return{setters:[function(l){e=l.g,t=l.q,n=l.b,s=l.a,o=l.o,i=l.c,r=l.r,c=l.I,a=l.f},function(e){l=e.l,u=e.n,d=e.q,m=e.a,g=e.s,f=e.u,p=e.k,h=e.d,b=e.b,j=e.v,v=e.w,L=e.x,y=e.y,A=e.z,w=e.A,S=e.B,E=e.C,T=e.D,q=e.p,x=e.E,M=e.F,H=e.G,k=e.H,I=e.I,_=e.c,C=e.t,$=e.J}],execute:function(){function R(e,n){return t(document,".js-details-container.open.Details--on").filter(t=>t.getAttribute(e)===n)}function F(e,t,s,o,i){const r=n(document,".js-file-filter"),c=new URL(window.location.href,window.location.origin);if(!e&&!o){if(t)return;return c.search="",l(u(),"",c.toString())}const a=n(r,".js-file-filter-form",HTMLFormElement),d=new FormData(a),m=s.filter(e=>!d.getAll("file-filters[]").includes(e)),g=i.filter(e=>!d.getAll("owned-by[]").includes(e));for(const n of m)d.append("file-filters[]",n);for(const n of g)d.append("owned-by[]",n);const f=new URLSearchParams;for(const[n,l]of d.entries())"string"==typeof l&&f.append(n,l);f.has("file-filters[]")&&""!==f.toString()||f.set("file-filters[]",""),t&&f.set("w","1"),c.search=f.toString(),l(u(),"",c.toString())}function D(s){var o;o=s,n(document,".js-file-filter-text",HTMLElement).classList.toggle("text-blue",o),function(e){const t=document.querySelector(".js-reset-filters"),n=document.querySelector(".js-commits-filtered");null==t||n||(t.hidden=!e)}(s),function(){const t=U(),n=z();for(const i of t)if(n){const t="0"===e(i,"data-non-deleted-files-count");i.disabled=t}else i.disabled=!1;const s=document.querySelector(".js-deleted-files-container"),o=W();if(o&&s){const n=function(t){const n=t.find(t=>t.checked&&"0"!==e(t,"data-deleted-files-count"));return Boolean(n)}(t);s.classList.toggle("text-gray",!n),o.disabled=!n}}(),function(){const t=K(),s=n(document,".js-file-filter-select-all-container",HTMLElement),o=e(s,t?"data-select-all-markup":"data-all-selected-markup");s.textContent=o,s.classList.toggle("text-gray",!t),s.classList.toggle("text-blue",t)}(),function(){const t=document.querySelector(".js-deleted-files-container");if(t){const n=z()?"data-show-deleted-markup":"data-hide-deleted-markup",s=e(t,n);t.textContent=s}}(),function(){const e=t(document,".js-file-type-count");for(const t of e){const e=z()?"data-non-deleted-file-count-markup":"data-all-file-count-markup",n=t.getAttribute(e);n&&(t.textContent=n)}}(),F(s,Q(),P(),V(),J())}function B(e){!function(){const e=W(),n=P(),s=t(document,".js-file"),o=J(),i=N();for(const t of s){let s=!0;const r=t.getAttribute("data-file-type");if(r&&(s=n.includes(r)),i&&s){t.hasAttribute("data-file-user-viewed")&&(s=!i.checked)}if(o.length>0&&s){const e=(t.getAttribute("data-codeowners")||"").split(",");s=e.filter(e=>o.includes(e)).length>0}if(e&&e.checked&&s){"true"===t.getAttribute("data-file-deleted")&&(s=!1)}G(t,s)}}(),D(e)}function P(){return U().filter(e=>e.checked).map(e=>e.value)}function U(){return t(document,".js-diff-file-type-option",HTMLInputElement)}function W(){const e=document.querySelector(".js-deleted-files-toggle");if(e instanceof HTMLInputElement)return e}function N(){const e=document.querySelector(".js-viewed-files-toggle");if(e instanceof HTMLInputElement)return e}function O(){return K()||z()||V()}function V(){return J().length>0}function J(){return t(document,".js-diff-owner-option",HTMLInputElement).filter(e=>e.checked).map(e=>e.value)}function K(){return P().length!==U().length}function Q(){return new URLSearchParams(window.location.search).has("w")}function z(){const e=W();return!!e&&e.checked}function G(e,t){const n=i(e,".js-file.js-details-container");n.classList.toggle("open",t),n.classList.toggle("Details--on",t)}function Y(e){const t=U();for(const n of t)n.checked=e}function X({currentTarget:e}){const t=e,n=t.hasAttribute("open");i(t,".js-file-header").classList.toggle("has-open-dropdown",n)}s("change",".js-diff-file-type-option",(function(){B(O())})),s("change",".js-diff-owner-option",(function(){B(V())})),s("click",".js-file-filter-select-all",(function(){K()&&(Y(!0),B(O()))})),s("change",".js-deleted-files-toggle",(function(){B(O())})),s("change",".js-viewed-files-toggle",(function(){B(O())})),o(".js-file-filter",(function(){O()?D(!0):F(!1,Q(),P(),V(),J())})),s("click",".js-file-header .js-details-target",(function({currentTarget:n}){if(!document.querySelector(".js-file-filter"))return;const s=i(n,".js-details-container"),o=function(n){const s=e(n,"data-file-type"),o=R("data-file-type",s),i=t(document,".js-diff-file-type-option",HTMLInputElement).find(e=>e.value===s);if(!i)return!1;const r=i.checked!==o.length>0;return r&&(i.checked=o.length>0),r}(s),r=W();let c=!1;r&&(c=function(t,n){let s=!1;if("true"===e(t,"data-file-deleted")){const e=R("data-file-deleted","true");s=n.checked!==(0===e.length),s&&(n.checked=0===e.length)}return s}(s,r));const a=N();let l=!1;a&&(l=function(e,t){let n=!1;if("true"===e.getAttribute("data-file-user-viewed")){const e=R("data-file-user-viewed","true");n=t.checked!==(0===e.length),n&&(t.checked=0===e.length)}return n}(s,a)),(o||c||l)&&D(O())})),s("details:toggled-group",".js-file.js-details-container",(function(e){e.target===e.currentTarget&&function(e){if(!document.querySelector(".js-file-filter"))return;Y(e);const t=W();t&&(t.checked=!e),D(O())}(e.detail.open)})),s("details:toggled",".js-file.js-details-container",(function(e){if(e.target!==e.currentTarget)return;const t=e.currentTarget;t.getBoundingClientRect().top<0&&g(t)})),d(()=>{const e=window.location.hash.slice(1);if(!e)return;const t=document.getElementsByName(e)[0];if(!t)return;const n=t.nextElementSibling;n&&n.matches(".js-file.js-details-container")&&(n.classList.add("open"),n.classList.add("Details--on"))}),o(".js-file-header-dropdown",{subscribe:e=>m(e,"toggle",X)});const Z=new RegExp("```suggestion(?:.*)\n","i"),ee=new RegExp("```(\n|$)");function te(e,t){const n=e.slice(0,t).split("\n");return e.split("\n")[n.length-1]}function ne(e){const t=/^(\s+)/.exec(e);return t&&t[0]||""}function se(e,t,n=0){const s=t.substring(n,t.length),o=e.exec(s);return o?o.index+n:-1}function oe(e,t){const n=[];let s=0,o=-1;for(;(o=se(Z,e,s))>-1;){s=o+"```suggestion".length;const t=se(ee,e,s);if(-1===t)return!1;s=t+"```".length,n.push([o,t])}return n.some(e=>t>e[0]&&t<e[1])}const ie=".js-add-to-batch-enabled",re=".js-unchanged-suggestion",ce=".js-closed-pull",ae=".js-viewing-subset-changes",le=".js-validation-on-left-blob",ue=".js-validation-on-right-blob",de=".js-outdated-comment",me=".js-resolved-thread",ge=".js-pending-review";function fe(e){const t=e.getAttribute("data-lines");if(null!=t){const s=i(e,".js-suggested-changes-container");!function(e,t){const n=function(e){let t="```suggestion\n";return t+=`${e}\n`,t+="```",t}(e),s=t.selectionStart,o=t.value,i=se(/\n/,o,s),r=""===o.trim(),c=te(o,s),a=""===c.trim(),l="\n```".length;let u=o,d=0;if(r)u=n,d=u.length-l;else if(-1===i)a?(u=o+n,d=u.length-l):(u=[o,n].join("\n"),d=u.length-l);else if(a){const e=s-ne(c).length,t=o.substring(0,e),r=o.substring(i,o.length);u=[t,n,r].join(""),d=u.length-r.length-l}else if(oe(o,s)){const e=se(/```/,o,s)+3,t=o.substring(0,e),i=o.substring(e,o.length);u=[t,"\n",n,i].join(""),d=u.length-i.length-l}else{const e=o.substring(0,i),t=o.substring(i,o.length);u=[e,"\n",n,t].join(""),d=u.length-t.length-l}f(t,u),t.focus(),t.setSelectionRange(d,d)}(t,n(s,".js-comment-field",HTMLTextAreaElement))}}function pe(e,t){const s=document.querySelectorAll(".js-apply-suggestion-button"),o=n(e,".js-disabled-apply-suggestion-button");for(const n of s){const e=o.cloneNode(!0);be(e,t),i(n,"details").replaceWith(e)}}function he(e){const n=document.querySelector(".js-batched-suggested-changes-container");n&&n.classList.add("d-none");for(const s of t(document,".js-apply-single-suggestion",HTMLInputElement))s.classList.remove("d-none"),s.disabled=!0,s.setAttribute("aria-label",e);for(const s of t(document,".js-batched-suggested-changes-add",HTMLInputElement))s.classList.remove("d-none"),s.disabled=!0,s.setAttribute("aria-label",e);for(const t of document.querySelectorAll(".js-batched-suggested-changes-remove"))t.classList.add("d-none");for(const t of document.querySelectorAll(".js-focus-commit-suggestions-form-button"))t.classList.add("d-none");for(const t of document.querySelectorAll(".pending-batched-suggestion-label"))t.classList.add("d-none")}function be(e,t){e.setAttribute("aria-label",t),e.classList.remove("d-none")}function je(e,t){const s=n(document,".js-suggested-changes-inline-validation-template").cloneNode(!0);s.classList.remove("js-suggested-changes-inline-validation-template"),n(s,".js-suggested-changes-inline-error-message").textContent=e.trim(),t.parentNode.insertBefore(s,t.nextSibling)}function ve(e){if(!document.querySelector(".js-suggested-changes-subset-files"))return;const s=t(e,".js-suggested-change-toolbar-item",HTMLButtonElement),o=n(document,ae).textContent.trim();for(const t of s)t.disabled=!0,t.setAttribute("aria-label",o)}function Le(){const e=document.querySelector(".js-batched-suggested-changes-container");e&&setTimeout(()=>function(e){const t=i(e,".js-review-state-classes").querySelectorAll("[data-pending-batched-suggestion]").length;for(const n of document.querySelectorAll(".js-pending-batched-suggested-changes-count"))n.textContent=String(t);const s=n(document,".js-reenable-add-to-batch").textContent;for(const n of document.querySelectorAll("[data-batched-suggestion-reenable-sibling]"))n.removeAttribute("data-batched-suggestion-reenable-sibling"),n.removeAttribute("disabled"),n.setAttribute("aria-label",s);if(t>0){e.hidden=!1;const t=n(e,".js-batched-suggested-changes-toggle");t.classList.add("anim-pulse-in"),t.addEventListener("animationend",()=>t.classList.remove("anim-pulse-in"),{once:!0});for(const e of document.querySelectorAll(".js-apply-single-suggestion"))e.classList.add("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-add")){const t=i(e,".js-suggested-change-form-container");"true"===t.getAttribute("data-pending-batched-suggestion")||"true"===t.getAttribute("data-comment-pending")||"true"===t.getAttribute("data-outdated-comment")?e.classList.add("d-none"):e.classList.remove("d-none"),"true"===e.getAttribute("data-batched-suggestion-disabled-by-sibling")&&(e.removeAttribute("data-batched-suggestion-disabled-by-sibling"),e.setAttribute("disabled","disabled"),e.setAttribute("aria-label",n(document,".js-one-suggestion-per-line").textContent))}for(const e of document.querySelectorAll(".js-batched-suggested-changes-remove")){"true"===i(e,".js-suggested-change-form-container").getAttribute("data-pending-batched-suggestion")?e.classList.remove("d-none"):e.classList.add("d-none")}for(const e of document.querySelectorAll(".js-focus-commit-suggestions-form-button")){const t=i(e,".js-suggested-change-form-container"),s="true"===t.getAttribute("data-comment-pending"),o="true"===t.getAttribute("data-outdated-comment"),r="true"===t.getAttribute("data-resolved-comment"),c=i(e,".js-inline-comments-container"),a="left"===n(c,'input[name="side"]',HTMLInputElement).value;s||o||r||a?e.classList.add("d-none"):e.classList.remove("d-none")}for(const e of document.querySelectorAll(".pending-batched-suggestion-label")){"true"===i(e,".js-suggested-change-form-container").getAttribute("data-pending-batched-suggestion")?e.classList.remove("d-none"):e.classList.add("d-none")}}else{e.hidden=!0;for(const e of document.querySelectorAll(".js-apply-single-suggestion"))e.classList.remove("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-add"))e.classList.remove("d-none");for(const e of document.querySelectorAll(".js-batched-suggested-changes-remove"))e.classList.add("d-none");for(const e of document.querySelectorAll(".js-focus-commit-suggestions-form-button"))e.classList.add("d-none");for(const e of document.querySelectorAll(".pending-batched-suggestion-label"))e.classList.add("d-none")}}(e))}function ye(e,t){const s=n(e,"input[name=commit_title]",HTMLInputElement),o=n(e,"textarea[name=commit_message]",HTMLTextAreaElement);let i=s.value.trim();""===i&&(i=s.defaultValue);const r=o.value.trim();""!==r&&(i=`${i}\n\n${r}\n`),s.disabled=!0,o.disabled=!0;const c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("name","message"),c.value=i,e.appendChild(c);const a=document.createElement("input");a.setAttribute("type","hidden"),a.setAttribute("name","changes"),a.value=JSON.stringify(t),e.appendChild(a)}function Ae(e,t){const n=e.nextElementSibling;return n&&n.matches(t)?n:null}function we(e){const t=e.querySelector(".js-toggle-file-notes");t instanceof HTMLInputElement&&f(t,!0)}function Se(){for(const e of document.querySelectorAll(".file .js-inline-comments-container")){const t=e.querySelectorAll(".js-comments-holder > *").length>0,n=e.querySelector(".js-inline-comment-form-container"),s=!!n&&n.classList.contains("open");t||s||e.remove()}}function Ee(e){const t=n(document,e).firstElementChild.cloneNode(!0),s=t.querySelector("textarea");return s instanceof HTMLTextAreaElement&&(s.value=""),t}async function Te(e){const t=e.querySelector(".js-suggestion-button-placeholder");if(!t)return;const n=t.getAttribute("data-src-base");if(!n)return;const s=new URL(n,window.location.origin),o=t.closest(".js-inline-comment-form")||t.closest(".js-comment-update");if(!(o instanceof HTMLFormElement))return;const i=function(e,t){const n=new URLSearchParams(e.search.slice(1)),s=t.elements.namedItem("in_reply_to")||t.elements.namedItem("comment_id");if(s instanceof HTMLInputElement&&s.value)return n.append("comment_id",s.value),n;const o=t.elements.namedItem("path"),i=t.elements.namedItem("start_side"),r=t.elements.namedItem("start_line"),c=t.elements.namedItem("side"),a=t.elements.namedItem("line"),l=t.elements.namedItem("start_commit_oid"),u=t.elements.namedItem("end_commit_oid"),d=t.elements.namedItem("base_commit_oid");return o instanceof HTMLInputElement&&i instanceof HTMLInputElement&&r instanceof HTMLInputElement&&c instanceof HTMLInputElement&&a instanceof HTMLInputElement&&l instanceof HTMLInputElement&&u instanceof HTMLInputElement&&d instanceof HTMLInputElement?(n.append("path",o.value),n.append("start_side",i.value),n.append("start_line",r.value),n.append("end_side",c.value),n.append("end_line",a.value),n.append("start_commit_oid",l.value),n.append("end_commit_oid",u.value),n.append("base_commit_oid",d.value),n):null}(s,o);if(!i)return;s.search=i.toString();const r=await b(document,s.toString());t.innerHTML="",t.appendChild(r)}function qe(e,t,n,s){if(e.classList.remove("bg-green-light","bg-red-light"),!s)return"right"===n?(e.classList.add("color-green-6"),void(e.textContent=`+${t}`)):"left"===n?(e.classList.add("text-red"),void(e.textContent=`-${t}`)):void(e.textContent=String(t));e.textContent=t}s("click",".js-suggested-change-toolbar-item",(function(e){const t=e.currentTarget;t instanceof HTMLButtonElement&&!t.disabled&&fe(t)})),s("click",".js-refresh-after-suggestion",(function(){window.location.reload()})),o(".js-inline-comments-container",{add(e){ve(e)}}),o(".js-preview-body .js-apply-changes",{add(e){const t=e.closest(".js-suggested-changes-container");if(!t)return e.remove();const s=n(document,ue).textContent,o=n(document,le).textContent,r=i(e,".js-suggested-changes-blob");if(""!==t.getAttribute("data-thread-side")){if("left"===t.getAttribute("data-thread-side"))return je(o,r),e.remove()}else{const t=i(e,".js-inline-comment-form"),s=n(t,'input[name="side"]',HTMLInputElement);if(!t||!s)return e.remove();if(t&&"left"===s.value)return je(o,r),e.remove()}const c=e.previousElementSibling,a=c.querySelector(".js-blob-code-deletion"),l=c.querySelectorAll(".js-blob-code-addition");return a&&0!==l.length?a.textContent===Array.from(l).map(e=>e.textContent).join("\n")?(je(s,r),e.remove()):void e.remove():void 0}}),o(".js-comment-body .js-apply-changes",{add(e){const s=e.closest(".js-suggested-changes-container");if(!s)return e.remove();const o=s.querySelector(".js-suggested-changes-template");if(!(o instanceof HTMLTemplateElement))return e.remove();const i=o.content.cloneNode(!0),r=n(i,".js-disabled-apply-suggestion-button");let c;try{c=n(i,".js-batched-suggested-changes-add")}catch(b){if("QueryError"!==b.name)throw b}if(t(document,".js-suggested-changes-files-tab").length){const e=n(document,ie).textContent;c&&(c.removeAttribute("disabled"),c.setAttribute("aria-label",e))}const a=n(document,".js-pull-header-details"),l=a&&"true"===a.getAttribute("data-pull-is-open"),u=e.closest(".js-resolvable-timeline-thread-container"),d="true"===o.getAttribute("data-comment-pending"),m=s.classList.contains("js-selection-contains-deletions");if(u&&"true"===u.getAttribute("data-resolved")){const t=n(document,me).textContent,s=i.querySelector("details");return s&&s.remove(),be(r,t),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",t)),e.replaceWith(i)}if(!l){const t=n(document,ce).textContent;return be(r,t),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",t)),e.replaceWith(i)}if(d){const t=n(document,ge).textContent;return n(i,"details").remove(),be(r,t),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",t)),e.replaceWith(i)}if(m){const t=n(document,le).textContent;return n(i,"details").remove(),be(r,t),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",t)),e.replaceWith(i)}const g=document.querySelector(".js-suggested-changes-subset-files"),f="true"===o.getAttribute("data-outdated-comment");if(g||f){let t;return g?t=n(document,ae).textContent:f&&(t=n(document,de).textContent),n(i,"details").remove(),be(r,t),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",t)),e.replaceWith(i)}const p=n(i,".js-single-suggested-change-form"),h=e.closest(".js-suggested-changes-blob");if(h){const e=h.querySelector(".js-blob-code-deletion"),t=h.querySelectorAll(".js-blob-code-addition");if(!e)return;const s=e.textContent,o=Array.from(t).map(e=>e.textContent);if(o.length>0&&s===o.join("\n")){const e=n(document,re).textContent;n(i,"details").remove(),be(r,e),c&&(c.setAttribute("disabled","disabled"),c.setAttribute("aria-label",e))}else for(const n of o){const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","value[]"),e.value=n,p.appendChild(e)}}e.replaceWith(i)}}),o(".js-pull-header-details",{add(e){const t="true"===e.getAttribute("data-pull-is-open"),s=document.querySelector(".js-suggested-changes-template");if(t||!(s instanceof HTMLTemplateElement))return;const o=s.content,i=n(document,ce).textContent;pe(o,i),he(i)}}),o(".js-suggested-changes-subset-files",{add(){const e=document.querySelector(".js-suggested-changes-template");if(!(e instanceof HTMLTemplateElement))return;const t=e.content,s=n(document,ae).textContent;pe(t,s),he(s)}}),s("click",".js-apply-suggestion-button",(async function(e){const t=e.currentTarget.parentElement;if(t){const e=n(t,".js-suggestion-commit-title");setTimeout(()=>e.focus(),1)}})),s("click",".js-dismiss-suggested-change-onboarding-notice",(async function(t){const s=e(t.currentTarget,"data-url"),o=n(t.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),i=new FormData;i.append("notice","suggested_changes_onboarding_prompt"),await h(s,{method:"POST",mode:"same-origin",body:i,headers:{"Scoped-CSRF-Token":o.value}});const r=document.querySelectorAll(".js-suggested-change-onboarding-notice");for(const e of r)e.remove()})),p("keypress",".js-comment-field",(function(e){if("Enter"===e.key){(function(e){const t=e.selectionStart;if(!oe(e.value,t))return!1;const n=e.value,s=te(n,t);if(null===s)return!1;const o=`\n${ne(s)}`,i=n.substr(0,t)+o+n.substr(t);f(e,i);const r=t+o.length;return e.setSelectionRange(r,r),!0})(e.target)&&e.preventDefault()}})),p("keypress",".js-suggestion-commit-message",(function(e){const t=e.currentTarget;"Enter"===e.key&&t.setAttribute("rows","3")})),s("click",".js-batched-suggested-changes-add",(function(e){const t=e.target,n=i(t,".js-suggested-change-form-container");if("true"===n.getAttribute("data-comment-pending")||"true"===n.getAttribute("data-outdated-comment")||"true"===t.getAttribute("data-batched-suggestion-disabled-by-sibling"))return;n.setAttribute("data-pending-batched-suggestion","true");const s=i(t,".js-inline-comments-container");for(const o of s.querySelectorAll(".js-batched-suggested-changes-add"))o.setAttribute("data-batched-suggestion-disabled-by-sibling","true");t.removeAttribute("data-batched-suggestion-disabled-by-sibling"),Le()})),s("click",".js-batched-suggested-changes-remove",(function(e){i(e.currentTarget,".js-suggested-change-form-container").removeAttribute("data-pending-batched-suggestion");const t=i(e.currentTarget,".js-inline-comments-container");for(const n of t.querySelectorAll(".js-batched-suggested-changes-add"))n.setAttribute("data-batched-suggestion-reenable-sibling","true");Le()})),s("click",".js-focus-commit-suggestions-form-button",(function(e){e.preventDefault(),window.location.href="#clear-commit-suggestions",window.location.href="#commit-suggestions"})),s("click",".js-dismiss-batched-suggested-changes-onboarding-notice",(async function(t){const s=e(t.currentTarget,"data-url"),o=n(t.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),i=new FormData;i.append("notice","batched_suggested_changes_onboarding_prompt"),await h(s,{method:"POST",mode:"same-origin",body:i,headers:{"Scoped-CSRF-Token":o.value}});for(const e of document.querySelectorAll(".js-batched-suggested-change-onboarding-notice"))e.remove()})),s("click",".js-single-suggested-change-form .js-suggested-changes-submit",(function(e){const s=e.currentTarget,o=i(s,".js-single-suggested-change-form",HTMLFormElement),r=t(o,'input[name="value[]"]',HTMLInputElement).map(e=>e.value);ye(o,[{commentId:n(o,"input[name=comment_id]",HTMLInputElement).value,path:n(o,"input[name=path]",HTMLInputElement).value,suggestion:r}])})),r(".js-single-suggested-change-form",(async function(e,t){const s=i(e,".js-suggested-change-form-container"),o=i(e,"details"),r=n(s,".js-suggestion-applied"),c=i(e,".js-suggested-changes-contents"),a=n(c,".js-error-message-placeholder");try{await t.json(),r.classList.remove("d-none"),n(s,".js-batched-suggested-changes-add").classList.add("d-none"),o.remove(),window.location.reload()}catch(l){if("QueryError"!==l.name){const t=l.response.json&&l.response.json.error,r=n(a,".js-error-message");a.hidden=!1,r.textContent=t,s.prepend(a);const c=i(e,".js-suggested-change-form-container");n(c,".js-batched-suggested-changes-add").classList.add("d-none"),o.remove()}}})),s("click",".js-suggestion-batch-submit",(function(e){const s=i(e.currentTarget,".js-batched-suggested-changes-form",HTMLFormElement),o=[];for(const i of document.querySelectorAll("[data-pending-batched-suggestion]")){const e=n(i,".js-single-suggested-change-form",HTMLFormElement),s=t(e,'input[name="value[]"]',HTMLInputElement).map(e=>e.value);o.push({commentId:n(e,"input[name=comment_id]",HTMLInputElement).value,path:n(e,"input[name=path]",HTMLInputElement).value,suggestion:s})}ye(s,o)})),r(".js-batched-suggested-changes-form",(async function(e,t){try{await t.json(),i(e,".js-batched-suggested-changes-container",HTMLElement).hidden=!0,window.location.reload()}catch(s){const t=s.response.json&&s.response.json.error,o=i(e,".js-batched-suggested-changes-container"),r=n(o,".js-error-message-container");n(r,".js-error-message").textContent=t,r.hidden=!1}})),o(".js-files-tab-stale",{add(){const e=document.querySelector(".js-batched-suggested-changes-container");e&&setTimeout(()=>{e.hidden=!0})}}),s("click",".js-add-single-line-comment",(function(e){const t=e.currentTarget;we(i(t,".file"));const s=function(e){const t=i(e,"tr"),s=Ae(t,".js-inline-comments-container");if(s instanceof Element){const e=Array.from(s.querySelectorAll(".js-inline-comment-form")).pop();return e instanceof HTMLFormElement&&Me(e,n(t,"button.js-add-line-comment")),s}}(t)||function(e){const t=i(e,"tr"),n=Ee("#js-inline-comments-single-container-template"),s=n.querySelector(".js-inline-comment-form");s instanceof HTMLFormElement&&Me(s,e);return t.after(n),n}(t),o=Array.from(s.querySelectorAll(".js-line-comments")).pop();j(o)})),s("click",".js-add-split-line-comment",(function(e){const t=e.currentTarget;we(i(t,".file"));const n=i(t,"tr"),s="addition"===t.getAttribute("data-type")?"js-addition":"js-deletion",o=function(e,t,n){const s=e.querySelector(`.js-line-comments.${t}`);if(s){return Me(Array.from(s.querySelectorAll(".js-inline-comment-form")).pop(),n),s}const o=Ee("#js-inline-comments-split-form-container-template");o.classList.add(t);const i=o.querySelector(".js-inline-comment-form");i instanceof HTMLFormElement&&Me(i,n);const r=e.querySelectorAll(`.${t}`);r[r.length-1].after(o);for(const c of r)c.remove();return o}(function(e){let t=Ae(e,".js-inline-comments-container");return t||(t=Ee("#js-inline-comments-split-container-template"),e.after(t),t)}(n),s,t),r=Array.from(o.querySelectorAll(".js-line-comments")).pop();j(r)})),r(".js-inline-comment-form",(async function(e,t){let s;!function(e){const t=e.querySelector(".js-comment-form-error");t&&(t.hidden=!0,t.textContent=null)}(e);try{s=await t.json()}catch(a){if(a.response){let t;try{t=a.response.json}catch(l){}if(t)return void function(e,t){const s=n(e,".js-comment-form-error");let o;o=t.errors?Array.isArray(t.errors)?t.errors.join(", "):t.errors:"There was an error posting your comment.";s.textContent=o,s.style.display="block",s.hidden=!1,s.classList.remove("d-none")}(e,t)}throw a}const o=s.json,i=o.inline_comment,r=e.closest(".js-line-comments");i&&n(r,".js-comments-holder").append(v(document,i));const c=o.inline_comment_thread;c&&r.replaceWith(v(document,c)),L(e)})),document.addEventListener("session:resume",(function(e){const t=e.detail;!function(e){const[t,n]=e.match(/^new_inline_comment_(?:discussion|diff)_(?:[\w-]+)_(\d+)_(\d+)$/)||[];if(!t)return;const s=document.querySelector(`.js-inline-comment-form input[name='in_reply_to'][value='${n}']`);if(!s)return;const o=s.closest(".js-line-comments");o&&j(o)}(t.targetId),function(e){const[t,n]=e.match(/^new_inline_comment_diff_(?:[\w-]+)_(\d+)$/)||[];if(!t)return;const s=document.querySelector(`.js-add-line-comment[data-anchor='${t}'][data-position='${n}']`);s&&s.click()}(t.targetId)})),o(".js-comment",{remove:Se}),s("inlinecomment:focus",".js-inline-comment-form-container",(function(e){const t=e.target.querySelector(".js-suggested-changes-container");t&&Te(t)})),o(".js-suggested-changes-container.is-comment-editing",e=>{Te(e)}),document.addEventListener("inlinecomment:collapse",()=>{Se()});const xe={R:"right",L:"left"};function Me(e,t){const s=["type","path","position","line","side","original-line"];for(const n of s){const s=e.elements.namedItem(n);if(s instanceof HTMLInputElement){const e=t.getAttribute(`data-${n}`)||"";s.value=e}}!function(e,t){const s=w();if(!s)return;if(s.end.is(s.start))return;if(!y(t,s))return void A();const{start:{lineNumber:o},end:{lineNumber:r}}=s;let{start:{side:c},end:{side:a}}=s;const l=Number(t.getAttribute("data-line")),u=t.getAttribute("data-side");if(l!==r||!s.end.isContext()&&u!==xe[a])return void A();const d=xe[c],m=e.elements.namedItem("start_line"),g=e.elements.namedItem("start_side"),f=e.elements.namedItem("line"),p=e.elements.namedItem("side"),h=e.elements.namedItem("preview_start_side"),b=e.elements.namedItem("preview_side");if(m instanceof HTMLInputElement&&g instanceof HTMLInputElement&&f instanceof HTMLInputElement&&p instanceof HTMLInputElement&&h instanceof HTMLInputElement&&b instanceof HTMLInputElement){m.value=String(o),g.value=d,g.value=h.value=g.value,b.value=p.value;const t=m.value;c=g.value;const r=f.value;a=p.value;const l=i(e,".js-inline-comment-form-container");if(t&&r){const e=n(l,".js-multi-line-preview"),o=n(e,".js-multi-line-preview-start"),i=n(e,".js-multi-line-preview-end"),u=s.start.isContext(),d=s.end.isContext();qe(o,t,c,u),qe(i,r,a,d),e.hidden=!1,l.classList.add("is-multiline")}else n(l,".js-multi-line-preview").hidden=!0,l.classList.remove("is-multiline");ve(l)}}(e,t);const o=t.getAttribute("data-position")||"",r=t.getAttribute("data-anchor")||"",c=n(e,".js-comment-field"),a=c.id.replace(/^r\d+ /,"").replace("${anchor}",r).replace("${position}",o);for(const n of e.querySelectorAll(`[for="${c.id}"]`))n.setAttribute("for",a);c.id=a}function He(e){const t=ke();if(!t)return;Ie(e,t);const n=function(e,t){const n=function(e,t){const n=/^(diff-[0-9a-f]{32})(?:[L|R]\d+)?$/.exec(t);if(!n)return;const s=n[1],o=e.querySelector(`a[name='${s}']`);if(!o)return;const i=o.nextElementSibling;if(i&&!i.querySelector(".js-diff-load-container"))return;return i}(e,t);if(n)return n;return function(e,t){const n=/^(?:r|commitcomment-)(\d+)$/.exec(t);if(!n)return;const s=n[1],o=e.querySelector(`#diff-with-comment-${s}`);if(!o)return;return o.closest(".js-file")}(e,t)}(e,t);n&&(g(n),_e(n))}function ke(){return window.location.hash.slice(1)}function Ie(e,t){let n;n=t.match(/^diff-.+[LR]\d+-[LR]\d+/)?S(e.ownerDocument,t.substring(0,t.indexOf("-",5))):S(e.ownerDocument,t),n&&e.contains(n)&&(E(n),g(n))}function _e(e){const t=n(e,".js-diff-entry-loader",c),s=n(e,".js-diff-placeholder",Element),o=n(e,"button.js-diff-load",HTMLButtonElement),i=n(e,".js-button-text");s.setAttribute("fill","url('#animated-diff-gradient')"),i.textContent=o.getAttribute("data-disable-with")||"",o.disabled=!0;const r=new URL(t.getAttribute("data-fragment-url")||"",window.location.origin);return t.src=r.toString(),t.data}function Ce(e,t,n){const s=Array.from(e.querySelectorAll('[role="menuitem"]'));let o=s.indexOf(t),i=s.indexOf(n);if(-1===o)throw new Error("Couldn't find startIndex in container");if(-1===i)throw new Error("Couldn't find endItem in container");$e(e),s[i].classList.add("is-last-in-range"),o>i&&([o,i]=[i,o]);for(const r of s.slice(o,i+1))r.classList.add("is-range-selected")}function $e(e){for(const t of e.querySelectorAll('[role="menuitem"]'))t.classList.remove("is-range-selected","is-last-in-range")}o(".js-diff-progressive-container",(function(e){He(e);const t=e.querySelector(".js-diff-progressive-loader");t&&t.addEventListener("load",(function(){He(e)}))})),o(".js-diff-load-container",(function(e){const t=e.querySelector(".js-diff-entry-loader");t&&t.addEventListener("load",(function(){i(e,".js-file").classList.remove("hide-file-notes-toggle");const t=ke();t&&Ie(e,t)}))})),s("click",".js-diff-load",(function(e){if(e.target.classList.contains("js-ignore-this"))return;_e(i(e.currentTarget,".js-diff-load-container"))})),s("click",".js-rendered, .js-source",(function(t){const n=t.currentTarget;n.classList.contains("selected")?t.preventDefault():(function(t){const n=i(t,".js-file-header"),s=t.classList.contains("js-rendered"),o=t.classList.contains("js-source"),r=e(n,"data-short-path"),c=e(n,"data-anchor"),a=new URL(window.location.href,window.location.origin),u=new URLSearchParams(a.search.slice(1));a.hash=c,s?u.set("short_path",r):o&&u.delete("short_path");a.search=u.toString(),l(null,"",a.toString())}(n),function(e){for(const t of document.querySelectorAll(".js-rendered, .js-source"))t.classList.remove("selected"),t.removeAttribute("aria-current");e.classList.add("selected"),e.setAttribute("aria-current","true")}(n))})),r(".js-prose-diff-toggle-form",(async function(e,t){const s=i(e,".js-details-container"),o=n(s,".js-file-content"),r=await t.html();for(;o.lastChild;)o.removeChild(o.lastChild);o.append(r.html),s.classList.toggle("display-rich-diff"),s.classList.toggle("show-inline-notes")})),s("change",".js-diff-style-toggle input",(function(e){if(!(e.target instanceof Element))return;const n=i(e.target,".js-diff-settings");for(const s of t(n,".js-diff-style-toggle label"))s.classList.toggle("selected")})),s("click",".js-toc-retry",(function(t){if(!(t.target instanceof Element))return;const s=i(t.target,".select-menu"),o=n(s,"include-fragment"),r=e(o,"src");o.setAttribute("src",""),o.setAttribute("src",r)})),s("details-menu-select",".js-pull-base-branch-menu",(function(){const e=n(document,".js-change-base-template",HTMLTemplateElement).content.cloneNode(!0);e instanceof DocumentFragment&&T({content:e})}),{capture:!0}),o(".js-diffbar-range-menu .js-diffbar-range-list",{subscribe:function(t){const s=i(t,"details-menu"),o=t.classList.contains("js-diffbar-invert-range");let r=!1;function c(e){r=e.shiftKey,r&&e.preventDefault()}function a(s){if(!r)return;s.preventDefault();const c=s.detail.relatedTarget;if(c.classList.contains("is-range-selected")){s.stopPropagation();const i=t.querySelectorAll(".is-range-selected"),r=o?i.length-1:0,c=o?0:i.length-1,a=i[r],l=i[c],u=e(t,"data-range-url"),d=a.getAttribute("data-parent-commit"),m=e(l,"data-commit"),g=d&&m?`${d}..${m}`:m,f=u.replace("$range",g);q({url:f,container:n(document,"#js-repo-pjax-container")})}else s.stopImmediatePropagation(),async function(e,t){function n(n){Ce(e,t,i(n.target,'[role="menuitem"]'))}Ce(e,t,t),e.addEventListener("mouseover",n),await new Promise(e=>window.addEventListener("keyup",e,{once:!0})),e.removeEventListener("mouseover",n),$e(e)}(t,c)}return t.addEventListener("click",c,{capture:!0}),s.addEventListener("details-menu-select",a),{unsubscribe:()=>{t.removeEventListener("click",c,{capture:!0}),s.removeEventListener("details-menu-select",a)}}}}),s("toggle",".js-diffbar-range-menu",(function(e){const t=e.currentTarget;if(!t.hasAttribute("open"))return;const n=t.querySelector(".in-range");n&&n.focus()}),{capture:!0}),s("click",".js-compare-tab",(function(e){for(const n of document.querySelectorAll(".js-compare-tab.selected"))n.classList.remove("selected");e.currentTarget.classList.add("selected");for(const n of document.querySelectorAll("#commits_bucket, #files_bucket, #commit_comments_bucket"))n.classList.add("d-none");const t=e.currentTarget.hash;n(document,t).classList.remove("d-none"),e.preventDefault()})),d((function({target:e}){if(!(e instanceof HTMLElement))return;const t=e.closest("#commits_bucket, #files_bucket, #commit_comments_bucket");t&&t instanceof HTMLElement&&!x(t)&&n(document,`.js-compare-tab[href="#${t.id}"]`).click()})),s("click",".js-toggle-range-editor-cross-repo",(function(){n(document,".js-range-editor").classList.toggle("is-cross-repo")})),s("pjax:click",".js-range-editor",(function(e){const t=document.querySelector(".js-compare-pr");if(t&&t.classList.contains("open")){const t=e.detail.options,n=new URL(t.url,window.location.origin);n.search.match(/expand=1/)||(n.search+=`${n.search?"&":""}expand=1`,t.url=n.toString())}})),o(".js-compare-pr.open",{add(){document.body.classList.add("is-pr-composer-expanded")},remove(){document.body.classList.remove("is-pr-composer-expanded")}}),s("change",".js-collab-checkbox",(function({currentTarget:e}){const t=e.form;for(const n of t.querySelectorAll(".errored"))n.classList.remove("errored");const s=i(e,".js-collab-option"),o=n(s,".js-status-indicator");o.classList.remove("status-indicator-success","status-indicator-failed"),o.classList.add("status-indicator-loading")})),r(".js-collab-form",(async function(e,t){try{await t.text()}catch(s){for(const t of e.querySelectorAll(".status-indicator-loading")){t.classList.remove("status-indicator-loading"),t.classList.add("status-indicator-failed");const e=i(t,".js-collab-option");e.classList.add("errored");const s=n(e,".js-collab-checkbox",HTMLInputElement);s.checked=!s.checked}for(const t of e.querySelectorAll(".status-indicator-success"))t.classList.remove("status-indicator-success");return}for(const n of e.querySelectorAll(".errored"))n.classList.remove("errored");for(const n of e.querySelectorAll(".status-indicator-loading"))n.classList.remove("status-indicator-loading"),n.classList.add("status-indicator-success")})),o(".js-timeline-item > .js-commit-group",{constructor:HTMLElement,add(e){if(e.querySelector(".js-commit-group-header"))return;const t=e.closest(".js-timeline-item");if(!(t instanceof HTMLElement))return;let s=t.previousElementSibling;s instanceof HTMLElement&&(s.classList.contains("js-timeline-item")||(s=s.previousElementSibling,s instanceof HTMLElement))&&s.querySelector(".js-commit-group")&&function(e,t){const s=n(e,".js-commit-group-commits"),o=t.querySelectorAll(".js-commit-group-commits > .js-commit");for(const n of o)n.classList.toggle("py-3"),s.appendChild(n);const i=e.querySelector(".js-commit-group-count");i instanceof HTMLElement&&(i.textContent=`${s.querySelectorAll(".js-commit").length}`),t.remove()}(s,t)}}),s("details:toggled",".js-pull-merging",(function({currentTarget:e}){const n=t(e,".js-merge-pull-request"),s=n.some(x);for(const t of n)t.classList.toggle("is-dirty",s)})),s("click",".js-merge-box-try-again",(async function({currentTarget:e}){const t=n(i(e,".js-pull-merging"),".js-tryable-again",HTMLFormElement);a(t,"submit")})),document.addEventListener("session:resume",(function(e){const t=document.getElementById(e.detail.targetId);if(t){const e=t.closest(".js-merge-pull-request");if(e){const t=e.closest(".js-details-container");t&&t.classList.add("open")}}})),s("change",".js-merge-button-toggle",(function({currentTarget:e}){const n=i(e,".js-merge-pr"),s=!e.checked;for(const o of t(n,".js-merge-commit-button",HTMLButtonElement))o.disabled=s})),s("details-menu-selected",".js-merge-method-menu",(function(s){const o=s.detail.relatedTarget,r=i(o,".js-merge-pr"),c=n(r,".js-merge-pull-request",HTMLFormElement),a=n(r,".js-merge-method-menu-button"),l=a.getAttribute("data-merge-button-class");a.classList.toggle("btn-danger",o.hasAttribute("data-dangerous-action")),l&&a.classList.toggle(l,!o.hasAttribute("data-dangerous-action"));const u=n(r,".js-merge-title",HTMLInputElement),d=n(r,".js-merge-message",HTMLTextAreaElement);u.defaultValue===u.value&&(u.defaultValue=u.value=e(o,"data-input-title-value"));d.defaultValue===d.value&&(d.defaultValue=d.value=e(o,"data-input-message-value"));r.classList.toggle("is-merging","merge"===o.value),r.classList.toggle("is-squashing","squash"===o.value),r.classList.toggle("is-rebasing","rebase"===o.value),r.classList.toggle("is-merging-group","group"===o.value),r.classList.toggle("is-merging-solo","solo"===o.value);const m=c.classList.contains("js-admin-override-merge")&&"merge"===o.value||c.classList.contains("js-admin-override-squash")&&"squash"===o.value||c.classList.contains("js-admin-override-rebase")&&"rebase"===o.value,g=t(r,".js-admin-override");for(const e of g)e.hidden=!m;const f=m&&!n(r,".js-merge-button-toggle",HTMLInputElement).checked,p=t(r,".js-merge-pull-request .js-merge-commit-button",HTMLButtonElement);for(const e of p)e.type=o.value===e.value?"submit":"button",e.disabled=f;c.classList.toggle("text-red",m);const h=i(r,".js-pull-merging"),b=new URL(e(h,"data-url"),window.location.origin),j=new URLSearchParams(b.search);j.set("merge_type",o.value),b.search=j.toString(),h.setAttribute("data-url",b.toString())}),{capture:!0}),s("details:toggled",".js-merge-pr",(function(e){const t=e.currentTarget.querySelector(".js-merge-message");t&&a(t,"change")})),o(".branch-action-item.js-details-container.open",{add(e){for(const t of e.querySelectorAll(".js-merge-review-section"))t.setAttribute("open","")},remove(e){for(const t of e.querySelectorAll(".js-merge-review-section"))t.removeAttribute("open")}}),s("toggle",".js-details-container .js-merge-review-section",(function({currentTarget:e}){const t=i(e,".js-details-container"),n=t.querySelectorAll(".js-merge-review-section").length,s=t.querySelectorAll(".js-merge-review-section[open]").length,o=s===n;0===s?M(t,{force:!1}):o&&M(t,{force:!0})}),{capture:!0}),o("poll-include-fragment[data-to-be-polled]",{constructor:c,add(t){function n(){t.src=e(t,"data-to-be-polled"),t.removeAttribute("data-to-be-polled")}document.hidden?document.addEventListener("visibilitychange",n,{once:!0}):n()}});let Re=!1;function Fe(){const e=document.querySelectorAll(".pull-request-ref-restore");for(let t=0;t<e.length;t++)e[t].classList.toggle("last",t===e.length-1)}function De(){const e=null!=document.querySelector("#js-pull-restorable"),t=document.querySelector(".js-pull-discussion-timeline");t&&t.classList.toggle("is-pull-restorable",e)}function Be(){const e=document.querySelector(".js-reviews-container");e&&setTimeout(()=>function(e){const t=i(e,".js-review-state-classes"),s=t.querySelectorAll(".js-pending-review-comment").length,o=n(document,".js-review-changes");t.classList.toggle("is-review-pending",s>0);for(const n of document.querySelectorAll(".js-pending-review-comment-count"))n.textContent=String(s);for(const n of document.querySelectorAll(".js-pending-comment-count-type"))n instanceof HTMLElement&&(n.textContent=n.getAttribute(1===s?"data-singular-string":"data-plural-string"));if(s>0){o.textContent=o.getAttribute("data-pending-message")||"";const t=n(e,".js-reviews-toggle");t.classList.add("anim-pulse-in"),t.addEventListener("animationend",()=>t.classList.remove("anim-pulse-in"),{once:!0})}else o.textContent=o.getAttribute("data-message")||""}(e))}function Pe(e){return e.getAttribute("ratio").split("/")}function Ue(e){if(e){const[t,n]=Pe(e),s=parseInt(t)/parseInt(n),o=e.querySelector(".js-review-progress"),i=e.querySelector(".js-review-count");o instanceof HTMLElement&&i&&(o.style.width=`${100*s}%`,i.textContent=`${t} / ${n}`)}}document.addEventListener("keydown",(function(e){"Alt"===e.key&&(Re=!0)})),document.addEventListener("keyup",(function(e){"Alt"===e.key&&(Re=!1)})),s("click",".js-toggle-outdated-comments",(function(e){if(!((e instanceof MouseEvent&&e.altKey||Re)&&e.currentTarget instanceof HTMLElement))return;const t=e.currentTarget,n=i(t,"details");function s(){const e=n.hasAttribute("open");for(const n of document.querySelectorAll(".js-toggle-outdated-comments"))if(n!==t){i(n,"details").toggleAttribute("open",e)}}setTimeout(()=>{H(t,s)})})),o(".pull-request-ref-restore",{add:Fe,remove:Fe}),o("#js-pull-restorable",{add:De,remove:De}),r(".js-inline-comment-form",(async function(e,t){await t.text(),Be()})),r(".js-pending-review-comment .js-comment-delete",(async function(e,t){await t.text(),Be()})),r(".js-resolvable-timeline-thread-form",(async function(e,t){try{const n=await t.html();i(e,".js-resolvable-timeline-thread-container").replaceWith(n.html)}catch(n){k()}})),s("click",".js-resolvable-thread-toggler",(function(e){if(!(e.target instanceof HTMLElement))return;const t=i(e.target,".js-resolvable-timeline-thread-container");i(e.target,".js-resolvable-thread-toggler-container").classList.toggle("border-bottom"),n(t,".js-resolvable-thread-contents").classList.toggle("d-none");for(const n of t.querySelectorAll(".js-resolvable-thread-toggler"))n.classList.toggle("d-none")})),r(".js-toggle-user-reviewed-file-form",(async function(e,t){const s=i(e,".js-details-container"),o=!!s.querySelector(".js-reviewed-file"),r=s.classList.contains("open"),c=s.querySelector(".js-file-header"),a=!!c&&60===c.getBoundingClientRect().top;(!o&&r||o&&!r)&&(M(s),a&&g(s));const l=n(e,".js-reviewed-toggle");o?(l.classList.remove("bg-blue-2","border-blue-light"),l.classList.add("text-gray","border-gray-dark")):(l.classList.remove("text-gray","border-gray-dark"),l.classList.add("bg-blue-2","border-blue-light")),n(l,".js-reviewed-checkbox",HTMLInputElement).disabled=!0;const u=document.querySelector("progress-bar");u instanceof ProgressBarElement&&(o?u.decrement():u.increment());const d=await t.html(),m=e.closest(".js-replace-file-header-review");m&&(m.replaceWith(d.html),s.hasAttribute("data-file-user-viewed")?s.removeAttribute("data-file-user-viewed"):s.setAttribute("data-file-user-viewed","true"))}));class ProgressBarElement extends HTMLElement{static get observedAttributes(){return["ratio"]}attributeChangedCallback(e){"ratio"===e&&Ue(this)}connectedCallback(){Ue(this)}increment(){const[e,t]=Pe(this),n=Math.min(parseInt(e)+1,parseInt(t));this.setAttribute("ratio",`${n}/${t}`)}decrement(){const[e,t]=Pe(this),n=Math.min(parseInt(e)-1,parseInt(t));this.setAttribute("ratio",`${n}/${t}`)}}function We(e){E(e),g(e)}async function Ne(t,n){let s;if(n){const e="R"===n.slice(-1)?"data-right-range":"data-left-range",o=t.getAttribute(e)||"";s=n+parseInt(o.split("-")[0],10)}else s=t.hash.slice(1);const o=e(t,"data-url"),r=new URL(o,window.location.origin),c=new URLSearchParams(r.search.slice(1));c.append("anchor",s),r.search=c.toString(),""!==window.location.hash&&window.history.replaceState(null,"","#");const a=await b(document,r.toString()),l=i(t,".js-expandable-line"),u=function(e,t){const n=e.nextElementSibling;return n instanceof HTMLElement&&n.matches(t)?n:null}(l,".file-diff-line");u?H(u,()=>{l.replaceWith(a)}):l.replaceWith(a)}function Oe(e,n,s,o){const i=parseInt(s,10),r=parseInt(o||"",10);return t(e,".js-expand",HTMLAnchorElement).filter(e=>{const t="R"===n?"data-right-range":"data-left-range",s=(e.getAttribute(t)||"").split("-"),o=parseInt(s[0],10),c=parseInt(s[1],10);return o<=i&&i<=c||(i<=o&&c<=r||o<=r&&r<=c)})}function Ve(e){return Math.floor(e/2)}function Je(e,t){const n=e.parentElement;if(!n)return;const s=n.children;let o;if(4===s.length)for(let i=0,r=s.length;i<r;i++){s[i]===e&&(o=Ve(i))}for(let i=0,r=s.length;i<r;i++){const e=s[i];null!=o&&Ve(i)!==o||e.classList.toggle("is-hovered",t)}}function Ke(){const e=document.querySelector("meta[name=diff-view]"),t=e&&e instanceof HTMLMetaElement?e.content:"",n=document.querySelector(".js-file-diff-split"),s=!!("split"===t&&n||document.querySelector(".wants-full-width-container"));document.body.classList.toggle("full-width",s)}function Qe(e){const t=e.parentElement,n=t.querySelectorAll("td.js-line-comments").length,s=t.querySelectorAll("td.js-line-comments.is-collapsed").length;t.classList.toggle("is-collapsed",s>0&&n===s)}window.customElements.get("progress-bar")||(window.ProgressBarElement=ProgressBarElement,window.customElements.define("progress-bar",ProgressBarElement)),document.addEventListener("pjax:end",(function(){for(const e of document.querySelectorAll(".js-pull-refresh-on-pjax"))I(e)})),o(".js-multi-line-callout",(function(e){const t=document.querySelector(".js-linkable-line-number");if(!t)return;if(i(t,".js-diff-table").offsetHeight<343)return;const n=t.closest("tr");if(!n)return;const s=n.lastElementChild;s&&(e.remove(),s.prepend(e),e.removeAttribute("hidden"))})),s("submit",".js-multi-line-callout",(function(e){if(!(e.target instanceof Element))return;i(e.target,".js-multi-line-callout").hidden=!0})),s("click",".js-dismiss-multi-line-suggestion-onboarding-notice",(async function(t){const s=e(t.currentTarget,"data-url"),o=n(t.currentTarget.parentElement,".js-data-url-csrf",HTMLInputElement),i=new FormData;i.append("notice","multi_line_suggestions"),await h(s,{method:"POST",mode:"same-origin",body:i,headers:{"Scoped-CSRF-Token":o.value}});const r=document.querySelectorAll(".js-multi-line-suggestion-onboarding-notice");for(const e of r)e.remove()})),o(".js-updating-pull-request-commits-count",{add(e){const n=e.textContent,s=t(document,".js-updateable-pull-request-commits-count");for(const t of s)t.textContent=n}}),(async()=>{if(await _,window.performance&&window.performance.navigation&&window.performance.navigation.type===window.performance.navigation.TYPE_RELOAD){const e=document.getElementById("js-report-pull-request-refresh");e&&C(e)}})(),d((function(){const e=function(e){if(!e)return;const t=$(e);if(!t)return;const n=t[1],s=t[2],o=t[3],i=t[5];return{anchor:n,side:s,line:o,lastLine:i,hashFragment:n+s+o,partialHashFragment:n+s}}(window.location.hash);e&&(S(document,e.hashFragment)&&!e.lastLine||async function e(t,s){const{anchor:o,side:i,line:r,lastLine:a,hashFragment:l,partialHashFragment:u}=t,d=S(document,o);if(!d)return;const m=d.nextElementSibling;if(!m)return;const g=Oe(m,i,r,a);if(!g.length){const e=S(document,l);if(e)return void We(e);const t=m.querySelector(".js-diff-load-container");if(!t)return;try{await function(e){const t=n(e,".js-diff-entry-loader",c),s=n(e,".js-diff-placeholder",Element),o=n(e,"button.js-diff-load",HTMLButtonElement),i=n(e,".js-button-text");s.setAttribute("fill","url('#animated-diff-gradient')"),i.textContent=o.getAttribute("data-disable-with")||"",o.disabled=!0;const r=new URL(t.getAttribute("data-fragment-url")||"",window.location.origin);return t.src=r.toString(),t.data}(t);const e=S(document,l);e instanceof HTMLElement&&We(e)}catch(p){We(m)}return}await function(e,t){return Promise.all(e.map(e=>Ne(e,t)))}(g,u);const f=S(document,l);Oe(m,i,r,a).length?e(t,s):f?We(f):s<1&&e(t,s+1)}(e,0))})),s("click",".js-expand",(function(e){e.preventDefault(),Ne(e.currentTarget)})),o(".diff-table",(function(e){let t=null;function n(){t&&Je(t,!1),t=null}function s(e){t&&Je(t,!1),e.target instanceof HTMLElement&&(t=e.target.closest("td.blob-code"),t&&Je(t,!0))}return{add:function(){e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",n),e.addEventListener("mouseover",s)},remove:function(){e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",n),e.removeEventListener("mouseover",s)}}})),o("meta[name=diff-view]",{add:Ke,remove:Ke}),o(".js-file-diff-split",{add:Ke,remove:Ke}),o(".js-compare-tab.selected",{add:Ke,remove:Ke}),o(".wants-full-width-container",{add:Ke,remove:Ke}),s("change",".js-toggle-file-notes",(function(e){const t=e.currentTarget;i(t,".file").classList.toggle("show-inline-notes",t.checked)})),s("click",".js-toggle-all-file-notes",(function(e){const n=t(document,".js-toggle-file-notes",HTMLInputElement),s=n.some(e=>e.checked);for(const t of n)f(t,!s);e.preventDefault()})),o(".js-inline-comments-container",(function(e){let t;const n=e.closest(".file");if(n){return{add:t=function(){const e=null!=n.querySelector(".js-inline-comments-container");n.classList.toggle("has-inline-notes",e)},remove:t}}})),s("change",".js-toggle-file-check-annotations",(function(e){const t=e.currentTarget,n=i(t,".file").querySelectorAll(".js-inline-annotations");for(const s of n)s instanceof HTMLElement&&(s.hidden=!t.checked)})),o("td.js-line-comments.is-collapsed",{add:Qe,remove:Qe})}}}));
//# sourceMappingURL=diffs-bootstrap-570e10b2.js.map