@codingame/monaco-vscode-markdown-language-features-default-extension 33.0.7 → 34.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- var et=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var We=et((en,Fe)=>{var Re="Expected a function",Be=NaN,vt="[object Symbol]",yt=/^\s+|\s+$/g,bt=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,St=/^0o[0-7]+$/i,Tt=parseInt,Et=typeof global=="object"&&global&&global.Object===Object&&global,Lt=typeof self=="object"&&self&&self.Object===Object&&self,Ct=Et||Lt||Function("return this")(),xt=Object.prototype,At=xt.toString,Mt=Math.max,Nt=Math.min,be=function(){return Ct.Date.now()};function Dt(e,t,n){var i,r,o,s,a,l,d=0,c=!1,m=!1,b=!0;if(typeof e!="function")throw new TypeError(Re);t=Ie(t)||0,se(n)&&(c=!!n.leading,m="maxWait"in n,o=m?Mt(Ie(n.maxWait)||0,t):o,b="trailing"in n?!!n.trailing:b);function L(h){var A=i,I=r;return i=r=void 0,d=h,s=e.apply(I,A),s}function S(h){return d=h,a=setTimeout(M,t),c?L(h):s}function K(h){var A=h-l,I=h-d,R=t-A;return m?Nt(R,o-I):R}function q(h){var A=h-l,I=h-d;return l===void 0||A>=t||A<0||m&&I>=o}function M(){var h=be();if(q(h))return B(h);a=setTimeout(M,K(h))}function B(h){return a=void 0,b&&i?L(h):(i=r=void 0,s)}function U(){a!==void 0&&clearTimeout(a),d=0,i=l=r=a=void 0}function J(){return a===void 0?s:B(be())}function P(){var h=be(),A=q(h);if(i=arguments,r=this,l=h,A){if(a===void 0)return S(l);if(m)return a=setTimeout(M,t),L(l)}return a===void 0&&(a=setTimeout(M,t)),s}return P.cancel=U,P.flush=J,P}function Pt(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(Re);return se(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Dt(e,t,{leading:i,maxWait:t,trailing:r})}function se(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function kt(e){return!!e&&typeof e=="object"}function Ht(e){return typeof e=="symbol"||kt(e)&&At.call(e)==vt}function Ie(e){if(typeof e=="number")return e;if(Ht(e))return Be;if(se(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=se(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(yt,"");var n=wt.test(e);return n||St.test(e)?Tt(e.slice(2),n?2:8):bt.test(e)?Be:+e}Fe.exports=Pt});var Le="code-line",$=class{constructor(t,n,i,r){this.element=t;this.line=n;this.codeElement=i;this.endLine=r;this.#e=Array.from(nt(t,"DETAILS"))}#e;get isVisible(){if(this.#e.some(i=>!i.open))return!1;let t=window.getComputedStyle(this.element);if(t.display==="none"||t.visibility==="hidden")return!1;let n=this.element.getBoundingClientRect();return!(n.height===0||n.width===0)}},ue=(()=>{let e,t=-1;return n=>{if(!e||n!==t){t=n,e=[new $(document.body,-1)];for(let i of document.getElementsByClassName(Le)){if(!(i instanceof HTMLElement))continue;let r=+i.getAttribute("data-line");if(!isNaN(r))if(i.tagName==="CODE"&&i.parentElement&&i.parentElement.tagName==="PRE"){let s=((i.textContent||"").match(/\n/g)||[]).length+1,a=r+s-1;e.push(new $(i.parentElement,r,i,a))}else i.tagName==="PRE"||i.tagName==="UL"||i.tagName==="OL"||e.push(new $(i,r))}}return e}})();function W(e,t){let n=Math.floor(e),i=ue(t),r=i[0]||null;for(let o of i){if(o.line===n)return{previous:o,next:void 0};if(o.line>n)return{previous:r,next:o};r=o}return{previous:r}}function tt(e,t){let n=ue(t).filter(l=>l.isVisible),i=e-window.scrollY,r=-1,o=n.length-1;for(;r+1<o;){let l=Math.floor((r+o)/2),d=F(n[l]);d.top+d.height>=i?o=l:r=l}let s=n[o],a=F(s);return o>=1&&a.top>i?{previous:n[r],next:s}:o>1&&o<n.length&&a.top+a.height>i?{previous:s,next:n[o+1]}:{previous:s}}function F(e){let{element:t,codeElement:n}=e,i=t.getBoundingClientRect();if(n)return i;let r=t.querySelector(`.${Le}`);if(r){let o=r.getBoundingClientRect(),s=Math.max(1,o.top-i.top);return{top:i.top,height:s}}return i}function Ce(e){let{element:t,codeElement:n}=e,i=F(e);if(n){let r=window.getComputedStyle(t),o=parseFloat(r.paddingTop)||0,s=parseFloat(r.paddingBottom)||0;return{top:i.top+o,height:i.height-o-s,paddingTop:o,paddingBottom:s}}return{top:i.top,height:i.height,paddingTop:0,paddingBottom:0}}function z(e,t,n){if(!n.settings?.scrollPreviewWithEditor)return;if(e<=0){window.scroll(window.scrollX,0);return}let{previous:i,next:r}=W(e,t);if(!i)return;let o=0,s=F(i),a=s.top;if(i.endLine&&i.endLine>i.line)if(e<i.endLine){let l=Ce(i),d=(e-i.line)/(i.endLine-i.line);o=window.scrollY+l.top+l.height*d}else if(r&&r.line!==i.line){let l=(e-i.endLine)/(r.line-i.endLine),d=window.scrollY+a+s.height,m=window.scrollY+r.element.getBoundingClientRect().top-d;o=d+l*m}else o=window.scrollY+a+s.height;else if(r&&r.line!==i.line){let l=(e-i.line)/(r.line-i.line),d=window.scrollY+a+s.height,m=window.scrollY+r.element.getBoundingClientRect().top-d;o=d+l*m}else{let l=e-Math.floor(e);o=window.scrollY+a+s.height*l}window.scroll(window.scrollX,Math.max(1,o))}function me(e,t){let{previous:n,next:i}=tt(e,t);if(n){if(n.line<0)return 0;let r=F(n),o=e-window.scrollY-r.top;if(n.endLine&&n.endLine>n.line){let s=Ce(n),a=e-window.scrollY-s.top;if(a>=0&&a<=s.height){let l=a/s.height;return n.line+l*(n.endLine-n.line)}else if(i&&a>s.height){let l=a-s.height,d=F(i),c=s.top+s.height,m=d.top-c,b=l/m;return n.endLine+b*(i.line-n.endLine)}else a<0}if(i){let s=o/(F(i).top-r.top);return n.line+s*(i.line-n.line)}else{let s=o/r.height;return n.line+s}}return null}function xe(e,t){return ue(t).find(n=>n.element.id===e)}function*nt(e,t){for(let n=e.parentElement;n;n=n.parentElement)n.tagName===t&&(yield n)}var te=class{#e;onDidChangeTextEditorSelection(t,n){let{previous:i}=W(t,n);this.#i(i&&(i.codeElement||i.element))}#i(t){this.#n(this.#e),this.#t(t),this.#e=t}#n(t){t&&t.classList.toggle("code-active-line",!1)}#t(t){t&&t.classList.toggle("code-active-line",!0)}};function Ae(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var Me=(e,t)=>({postMessage(n,i){e.postMessage({type:n,source:t.settings.source,...i})}});function ge(e){let t=document.getElementById("vscode-markdown-preview-data");if(t){let n=t.getAttribute(e);if(n)return n}throw new Error(`Could not load data for ${e}`)}function pe(e){return JSON.parse(ge(e))}var ne=class{#e=pe("data-settings");get settings(){return this.#e}updateSettings(t){this.#e=t}};var Ne=11;function it(e,t){var n=t.attributes,i,r,o,s,a;if(!(t.nodeType===Ne||e.nodeType===Ne)){for(var l=n.length-1;l>=0;l--)i=n[l],r=i.name,o=i.namespaceURI,s=i.value,o?(r=i.localName||r,a=e.getAttributeNS(o,r),a!==s&&(i.prefix==="xmlns"&&(r=i.name),e.setAttributeNS(o,r,s))):(a=e.getAttribute(r),a!==s&&e.setAttribute(r,s));for(var d=e.attributes,c=d.length-1;c>=0;c--)i=d[c],r=i.name,o=i.namespaceURI,o?(r=i.localName||r,t.hasAttributeNS(o,r)||e.removeAttributeNS(o,r)):t.hasAttribute(r)||e.removeAttribute(r)}}var ie,rt="http://www.w3.org/1999/xhtml",E=typeof document>"u"?void 0:document,ot=!!E&&"content"in E.createElement("template"),st=!!E&&E.createRange&&"createContextualFragment"in E.createRange();function at(e){var t=E.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function lt(e){ie||(ie=E.createRange(),ie.selectNode(E.body));var t=ie.createContextualFragment(e);return t.childNodes[0]}function dt(e){var t=E.createElement("body");return t.innerHTML=e,t.childNodes[0]}function ct(e){return e=e.trim(),ot?at(e):st?lt(e):dt(e)}function re(e,t){var n=e.nodeName,i=t.nodeName,r,o;return n===i?!0:(r=n.charCodeAt(0),o=i.charCodeAt(0),r<=90&&o>=97?n===i.toUpperCase():o<=90&&r>=97?i===n.toUpperCase():!1)}function ft(e,t){return!t||t===rt?E.createElement(e):E.createElementNS(t,e)}function ut(e,t){for(var n=e.firstChild;n;){var i=n.nextSibling;t.appendChild(n),n=i}return t}function he(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var De={OPTION:function(e,t){var n=e.parentNode;if(n){var i=n.nodeName.toUpperCase();i==="OPTGROUP"&&(n=n.parentNode,i=n&&n.nodeName.toUpperCase()),i==="SELECT"&&!n.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}he(e,t,"selected")},INPUT:function(e,t){he(e,t,"checked"),he(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var i=e.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==e.placeholder)return;i.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n=-1,i=0,r=e.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild,r||(r=o.nextSibling,o=null);else{if(s==="OPTION"){if(r.hasAttribute("selected")){n=i;break}i++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}e.selectedIndex=n}}},G=1,Pe=11,ke=3,He=8;function O(){}function mt(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function gt(e){return function(n,i,r){if(r||(r={}),typeof i=="string")if(n.nodeName==="#document"||n.nodeName==="HTML"||n.nodeName==="BODY"){var o=i;i=E.createElement("html"),i.innerHTML=o}else i=ct(i);else i.nodeType===Pe&&(i=i.firstElementChild);var s=r.getNodeKey||mt,a=r.onBeforeNodeAdded||O,l=r.onNodeAdded||O,d=r.onBeforeElUpdated||O,c=r.onElUpdated||O,m=r.onBeforeNodeDiscarded||O,b=r.onNodeDiscarded||O,L=r.onBeforeElChildrenUpdated||O,S=r.skipFromChildren||O,K=r.addChild||function(f,u){return f.appendChild(u)},q=r.childrenOnly===!0,M=Object.create(null),B=[];function U(f){B.push(f)}function J(f,u){if(f.nodeType===G)for(var v=f.firstChild;v;){var g=void 0;u&&(g=s(v))?U(g):(b(v),v.firstChild&&J(v,u)),v=v.nextSibling}}function P(f,u,v){m(f)!==!1&&(u&&u.removeChild(f),b(f),J(f,v))}function h(f){if(f.nodeType===G||f.nodeType===Pe)for(var u=f.firstChild;u;){var v=s(u);v&&(M[v]=u),h(u),u=u.nextSibling}}h(n);function A(f){l(f);for(var u=f.firstChild;u;){var v=u.nextSibling,g=s(u);if(g){var p=M[g];p&&re(u,p)?(u.parentNode.replaceChild(p,u),R(p,u)):A(u)}else A(u);u=v}}function I(f,u,v){for(;u;){var g=u.nextSibling;(v=s(u))?U(v):P(u,f,!0),u=g}}function R(f,u,v){var g=s(u);if(g&&delete M[g],!v){var p=d(f,u);if(p===!1||(p instanceof HTMLElement&&(f=p,h(f)),e(f,u),c(f),L(f,u)===!1))return}f.nodeName!=="TEXTAREA"?Qe(f,u):De.TEXTAREA(f,u)}function Qe(f,u){var v=S(f,u),g=u.firstChild,p=f.firstChild,j,D,V,Z,k;e:for(;g;){for(Z=g.nextSibling,j=s(g);!v&&p;){if(V=p.nextSibling,g.isSameNode&&g.isSameNode(p)){g=Z,p=V;continue e}D=s(p);var ee=p.nodeType,H=void 0;if(ee===g.nodeType&&(ee===G?(j?j!==D&&((k=M[j])?V===k?H=!1:(f.insertBefore(k,p),D?U(D):P(p,f,!0),p=k,D=s(p)):H=!1):D&&(H=!1),H=H!==!1&&re(p,g),H&&R(p,g)):(ee===ke||ee==He)&&(H=!0,p.nodeValue!==g.nodeValue&&(p.nodeValue=g.nodeValue))),H){g=Z,p=V;continue e}D?U(D):P(p,f,!0),p=V}if(j&&(k=M[j])&&re(k,g))v||K(f,k),R(k,g);else{var fe=a(g);fe!==!1&&(fe&&(g=fe),g.actualize&&(g=g.actualize(f.ownerDocument||E)),K(f,g),A(g))}g=Z,p=V}I(f,p,D);var Ee=De[f.nodeName];Ee&&Ee(f,u)}var T=n,Q=T.nodeType,Te=i.nodeType;if(!q){if(Q===G)Te===G?re(n,i)||(b(n),T=ut(n,ft(i.nodeName,i.namespaceURI))):T=i;else if(Q===ke||Q===He){if(Te===Q)return T.nodeValue!==i.nodeValue&&(T.nodeValue=i.nodeValue),T;T=i}}if(T===i)b(n);else{if(i.isSameNode&&i.isSameNode(T))return;if(R(T,i,q),B)for(var de=0,Ze=B.length;de<Ze;de++){var ce=M[B[de]];ce&&P(ce,ce.parentNode,!1)}}return!q&&T!==n&&n.parentNode&&(T.actualize&&(T=T.actualize(n.ownerDocument||E)),n.parentNode.replaceChild(T,n)),T}}var pt=gt(it),Oe=pt;var ve=Object.freeze({http:"http",https:"https",file:"file",untitled:"untitled",mailto:"mailto",vscode:"vscode","vscode-insiders":"vscode-insiders",notebookCell:"vscode-notebook-cell"});function ye(e,t){return t.toLowerCase().startsWith(e+":")}var oe=class{#e=Math.random().toString(36).slice(2,10);#i;#n;#t;#r=0;constructor(t,n){this.#i=n,this.#n=t,this.#t=new BroadcastChannel(t.channelName),this.#t.onmessage=i=>{let{line:r,sender:o}=i.data;if(o===this.#e||typeof r!="number"||isNaN(r))return;let s=ht(r,this.#n.lineMappings);this.#r=Date.now()+100,this.#i(s)}}update(t){this.#n=t}broadcastScroll(t){!this.#t||Date.now()<this.#r||this.#t.postMessage({line:t,sender:this.#e})}};function ht(e,t){if(!t?.length)return e;let n=Math.floor(e),i=e-n,r=t[n]??e;if(i<=0)return Math.max(0,r);let o=t[n+1];return typeof o!="number"?Math.max(0,r+i):Math.max(0,r+(o-r)*i)}var Ve=We(),C=0,w,Ye=new te,y=new ne,x=0,Y=y.settings.source,we=y.settings.lineChanges,_=acquireVsCodeApi(),Ot=e=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},100),le(()=>z(e,x,y))},_e=y.settings.diffScrollSync?new oe(y.settings.diffScrollSync,Ot):void 0,ae=_.getState()??{},N={...ae,...pe("data-state")},Bt=typeof y.settings.line=="number"&&!isNaN(y.settings.line);typeof ae.scrollProgress<"u"&&(ae?.resource!==N.resource||Bt&&ae.line!==y.settings.line)&&(N.scrollProgress=void 0);_.setState(N);var X=Me(_,y);window.cspAlerter.setPoster(X);window.styleLoadingMonitor.setPoster(X);function le(e){let t=document.getElementsByTagName("img");if(t.length>0){let n=Array.from(t,i=>i.complete?Promise.resolve():new Promise(r=>{i.addEventListener("load",()=>r()),i.addEventListener("error",()=>r())}));Promise.all(n).then(()=>setTimeout(e,0))}else setTimeout(e,0)}Ae(()=>{let n=[...new DOMParser().parseFromString(ge("data-initial-md-content"),"text/html").body.children];document.body.append(...n);for(let r of n)r instanceof HTMLElement&&Se(r);let i=N.scrollProgress;if($e(),Ge(we),typeof i=="number"&&!y.settings.fragment){le(()=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200);let r=Math.max(1,i*document.body.clientHeight);window.scrollTo(0,r)});return}y.settings.scrollPreviewWithEditor&&le(()=>{if(y.settings.fragment){let r;try{r=encodeURIComponent(y.settings.fragment)}catch{r=y.settings.fragment}N.fragment=void 0,_.setState(N);let o=xe(r,x);o&&(C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),z(o.line,x,y))}else isNaN(y.settings.line)||(C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),z(y.settings.line,x,y))}),typeof y.settings.selectedLine=="number"&&Ye.onDidChangeTextEditorSelection(y.settings.selectedLine,x)});var It=(()=>{let e=Ve(t=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},50),le(()=>z(t,x,y))},50);return t=>{isNaN(t)||(N.line=t,e(t))}})();window.addEventListener("resize",()=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),Ke()},!0);function $e(){let e=document.getElementsByTagName("img"),t=0;for(let n of e){n.id="image-"+t,t+=1;let i=n.getAttribute("data-src"),o=i&&!(ye(ve.http,i)||ye(ve.https,i))?"localImage":"image";n.setAttribute("data-vscode-context",JSON.stringify({webviewSection:o,id:n.id,preventDefaultContextMenuItems:!0,resource:Y,imageSource:i}))}}async function ze(e,t=5){if(!document.hasFocus()&&t>0){setTimeout(()=>{ze(e,t-1)},20);return}try{await navigator.clipboard.write([new ClipboardItem({"image/png":new Promise(n=>{let i=document.createElement("canvas");i!==null&&(i.width=e.naturalWidth,i.height=e.naturalHeight,i.getContext("2d")?.drawImage(e,0,0)),i.toBlob(r=>{r&&n(r),i.remove()},"image/png")})})])}catch(n){console.error(n);let i=window.getSelection();if(!i){await navigator.clipboard.writeText(e.getAttribute("data-src")??e.src);return}i.removeAllRanges();let r=document.createRange();r.selectNode(e),i.addRange(r),document.execCommand("copy"),i.removeAllRanges()}}window.addEventListener("message",async e=>{let t=e.data;switch(t.type){case"copyImage":{let n=document.getElementById(t.id);n instanceof HTMLImageElement&&ze(n);return}case"onDidChangeTextEditorSelection":t.source===Y&&Ye.onDidChangeTextEditorSelection(t.line,x);return;case"updateView":t.source===Y&&It(t.line);return;case"updateContent":{we=t.lineChanges,t.diffScrollSync&&_e?.update(t.diffScrollSync);let n=document.querySelector(".markdown-body"),r=new DOMParser().parseFromString(t.content,"text/html");for(let o of Array.from(r.querySelectorAll("meta")))o.hasAttribute("http-equiv")&&o.remove();if(t.source!==Y){Y=t.source;let o=r.querySelector(".markdown-body");n.replaceWith(o),Se(o)}else{let o=r.querySelector(".markdown-body"),s=o.querySelectorAll("link");for(let a of s)a.remove();o.prepend(...s),Oe(n,o,{childrenOnly:!0,onBeforeElUpdated:(a,l)=>{if(Je(a,l)){let d=a.querySelectorAll("[data-line]"),c=l.querySelectorAll("[data-line]");d.length!==c.length&&console.log("unexpected line number change");for(let m=0;m<d.length;++m){let b=d[m],L=c[m];L&&b.setAttribute("data-line",L.getAttribute("data-line"))}return!1}return a.tagName==="DETAILS"&&l.tagName==="DETAILS"&&a.hasAttribute("open")&&l.setAttribute("open",""),!0},addChild:(a,l)=>{a.appendChild(l),l instanceof HTMLElement&&Se(l)}})}++x,window.dispatchEvent(new CustomEvent("vscode.markdown.updateContent")),$e(),Ge(we);break}}},!1);function Ge(e){for(let t of document.querySelectorAll(".code-line-diff-added, .code-line-diff-deleted, .code-line-diff-modified"))t.classList.remove("code-line-diff","code-line-diff-added","code-line-diff-deleted","code-line-diff-modified");for(let t of document.querySelectorAll(".diff-change-indicator"))t.remove();for(let t of document.querySelectorAll(".diff-modification-gutter"))t.remove();qe(e?.added,"code-line-diff-added"),qe(e?.deleted,"code-line-diff-deleted"),Rt(e),jt(e)}function qe(e,t){if(e)for(let n of e){let{previous:i,next:r}=W(n,x),o=i.line>=0?i:r,s=o?.codeElement||o?.element;s&&s.classList.add("code-line-diff",t)}}function Rt(e){if(e?.changeIndicators?.length)for(let t of e.changeIndicators){let{previous:n,next:i}=W(t.modifiedLine,x);if(t.type==="deletion"){let r=n.line===t.modifiedLine?n.codeElement||n.element:i?.codeElement||i?.element||n.codeElement||n.element;if(!r)continue;let o=Ft(t);r.parentElement?.insertBefore(o,r)}else{let r=new Set,o=!0;for(let s=0;s<t.modifiedLineCount;s++){let a=t.modifiedLine+s,{previous:l,next:d}=W(a,x),c=l.line>=0?l:d,m=c?.codeElement||c?.element;m&&!r.has(m)&&(r.add(m),m.classList.add("code-line-diff-modified"),Wt(m,o?t:void 0),o=!1)}}}}function Ft(e){let t=document.createElement("div");t.className=`diff-change-indicator diff-change-indicator-${e.type}`,t.setAttribute("data-original-line-count",String(e.originalLineCount));let n=document.createElement("span");n.className="diff-change-indicator-arrow";let i=Xe(e.originalContent,e.modifiedContent);return n.appendChild(i),t.appendChild(n),t}function Wt(e,t){let n=document.createElement("div");if(n.className="diff-modification-gutter",t){let i=Xe(t.originalContent,t.modifiedContent);n.appendChild(i)}e.style.position="relative",e.appendChild(n)}function Xe(e,t){let n=document.createElement("div");n.className="diff-change-indicator-tooltip";let i=e?e.split(`
2
- `):[],r=t?t.split(`
3
- `):[],o=qt(i,r);for(let s of o)if(s.type==="equal"){let a=document.createElement("div");a.className="diff-tooltip-unchanged";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="delete"){let a=document.createElement("div");a.className="diff-tooltip-deleted";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="insert"){let a=document.createElement("div");a.className="diff-tooltip-added";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="modify"){let a=document.createElement("div");a.className="diff-tooltip-deleted";let l=document.createElement("pre");je(l,s.oldTokens,s.newTokens,"delete"),a.appendChild(l),n.appendChild(a);let d=document.createElement("div");d.className="diff-tooltip-added";let c=document.createElement("pre");je(c,s.oldTokens,s.newTokens,"insert"),d.appendChild(c),n.appendChild(d)}return n}function qt(e,t){let n=e.length,i=t.length,r=Array.from({length:n+1},()=>new Array(i+1).fill(0));for(let c=1;c<=n;c++)for(let m=1;m<=i;m++)e[c-1]===t[m-1]?r[c][m]=r[c-1][m-1]+1:r[c][m]=Math.max(r[c-1][m],r[c][m-1]);let o=[],s=n,a=i;for(;s>0||a>0;)s>0&&a>0&&e[s-1]===t[a-1]?(o.push({type:"equal",line:e[s-1]}),s--,a--):a>0&&(s===0||r[s][a-1]>=r[s-1][a])?(o.push({type:"insert",line:t[a-1]}),a--):(o.push({type:"delete",line:e[s-1]}),s--);o.reverse();let l=[],d=0;for(;d<o.length;){let c=o[d];if(c.type==="equal")l.push({type:"equal",text:c.line}),d++;else{let m=[],b=[];for(;d<o.length&&o[d].type!=="equal";)o[d].type==="delete"?m.push(o[d].line):b.push(o[d].line),d++;let L=Math.min(m.length,b.length);for(let S=0;S<L;S++)l.push({type:"modify",text:"",oldTokens:Ue(m[S]),newTokens:Ue(b[S])});for(let S=L;S<m.length;S++)l.push({type:"delete",text:m[S]});for(let S=L;S<b.length;S++)l.push({type:"insert",text:b[S]})}}return l}function Ue(e){return e.match(/\S+|\s+/g)||[""]}function Ut(e,t){let n=e.length,i=t.length,r=Array.from({length:n+1},()=>new Array(i+1).fill(0));for(let d=1;d<=n;d++)for(let c=1;c<=i;c++)e[d-1]===t[c-1]?r[d][c]=r[d-1][c-1]+1:r[d][c]=Math.max(r[d-1][c],r[d][c-1]);let o=new Set,s=new Set,a=n,l=i;for(;a>0&&l>0;)e[a-1]===t[l-1]?(o.add(a-1),s.add(l-1),a--,l--):r[a][l-1]>=r[a-1][l]?l--:a--;return[o,s]}function je(e,t,n,i){let[r,o]=Ut(t,n),s=i==="delete"?t:n,a=i==="delete"?r:o,l=i==="delete"?"diff-inline-deleted":"diff-inline-added";for(let d=0;d<s.length;d++)if(a.has(d))e.appendChild(document.createTextNode(s[d]));else{let c=document.createElement("span");c.className=l,c.textContent=s[d],e.appendChild(c)}}function jt(e){let t="diff-inner-added",n="diff-inner-deleted";if(CSS.highlights?.delete(t),CSS.highlights?.delete(n),!e?.innerChanges?.length||!CSS.highlights)return;let i=e.added?t:n,r=[],o=document.querySelector(".markdown-body");if(!o)return;let s=0;for(;;){let a=o.querySelector(`[data-diff-start="${s}"]`),l=o.querySelector(`[data-diff-end="${s}"]`);if(!a||!l)break;let d=new Range;d.setStartAfter(a),d.setEndBefore(l),r.push(d),s++}r.length>0&&CSS.highlights.set(i,new Highlight(...r))}document.addEventListener("dblclick",e=>{if(!y.settings.doubleClickToSwitchToEditor||Y.endsWith(".copilotmd"))return;for(let i=e.target;i;i=i.parentNode)if(i.tagName==="A")return;let t=e.pageY,n=me(t,x);typeof n=="number"&&!isNaN(n)&&X.postMessage("didClick",{line:Math.floor(n)})});var Vt=["http:","https:","mailto:","vscode:","vscode-insiders:"];document.addEventListener("click",e=>{if(!e)return;let t=e.target;for(;t;){if(t.tagName&&t.tagName==="A"&&t.href){if(t.getAttribute("href")?.startsWith("#"))return;let n=t.getAttribute("data-href");if(!n&&(n=t.getAttribute("href"),n&&Vt.some(i=>n.startsWith(i))))return;if(n&&!/^[a-z\-]+:/i.test(n)){X.postMessage("openLink",{href:n}),e.preventDefault(),e.stopPropagation();return}return}t=t.parentElement}},!0);window.addEventListener("scroll",Ve(()=>{if(Ke(),C>0)return;let e=me(window.scrollY,x);typeof e=="number"&&!isNaN(e)&&(N.line=e,_.setState(N),X.postMessage("revealLine",{line:e}),_e?.broadcastScroll(e))},50));function Ke(){N.scrollProgress=window.scrollY/document.body.clientHeight,_.setState(N)}function Je(e,t){let n=["open"];if(e.isEqualNode(t))return!0;if(e.tagName!==t.tagName||e.textContent!==t.textContent)return!1;let i=[...e.attributes].filter(a=>!n.includes(a.name)),r=[...t.attributes].filter(a=>!n.includes(a.name));if(i.length!==r.length)return!1;for(let a=0;a<i.length;++a){let l=i[a],d=r[a];if(l.name!==d.name||l.value!==d.value&&l.name!=="data-line")return!1}let o=Array.from(e.children),s=Array.from(t.children);return o.length===s.length&&o.every((a,l)=>Je(a,s[l]))}function Se(e){let t=["type","src","nonce","noModule","async"],n=e.tagName==="SCRIPT"?[e]:Array.from(e.getElementsByTagName("script"));for(let i of n){if(!(i instanceof HTMLElement))continue;let r=document.createElement("script"),o=i.innerText;r.text=o;for(let s of t){let a=i.getAttribute?.(s);a&&r.setAttribute(s,a)}i.insertAdjacentElement("afterend",r),i.remove()}}
1
+ var tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ue=tt((dn,We)=>{var Fe="Expected a function",Oe=NaN,wt="[object Symbol]",yt=/^\s+|\s+$/g,Ct=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,St=/^0o[0-7]+$/i,Et=parseInt,Lt=typeof global=="object"&&global&&global.Object===Object&&global,Mt=typeof self=="object"&&self&&self.Object===Object&&self,At=Lt||Mt||Function("return this")(),xt=Object.prototype,Nt=xt.toString,Pt=Math.max,kt=Math.min,we=function(){return At.Date.now()};function It(e,t,r){var n,i,o,a,s,l,u=0,b=!1,v=!1,E=!0;if(typeof e!="function")throw new TypeError(Fe);t=Re(t)||0,ae(r)&&(b=!!r.leading,v="maxWait"in r,o=v?Pt(Re(r.maxWait)||0,t):o,E="trailing"in r?!!r.trailing:E);function x(g){var L=n,H=i;return n=i=void 0,u=g,a=e.apply(H,L),a}function de(g){return u=g,s=setTimeout(M,t),b?x(g):a}function $(g){var L=g-l,H=g-u,O=t-L;return v?kt(O,o-H):O}function F(g){var L=g-l,H=g-u;return l===void 0||L>=t||L<0||v&&H>=o}function M(){var g=we();if(F(g))return B(g);s=setTimeout(M,$(g))}function B(g){return s=void 0,E&&n?x(g):(n=i=void 0,a)}function W(){s!==void 0&&clearTimeout(s),u=0,n=l=i=s=void 0}function K(){return s===void 0?a:B(we())}function P(){var g=we(),L=F(g);if(n=arguments,i=this,l=g,L){if(s===void 0)return de(l);if(v)return s=setTimeout(M,t),x(l)}return s===void 0&&(s=setTimeout(M,t)),a}return P.cancel=W,P.flush=K,P}function Dt(e,t,r){var n=!0,i=!0;if(typeof e!="function")throw new TypeError(Fe);return ae(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),It(e,t,{leading:n,maxWait:t,trailing:i})}function ae(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Bt(e){return!!e&&typeof e=="object"}function Ht(e){return typeof e=="symbol"||Bt(e)&&Nt.call(e)==wt}function Re(e){if(typeof e=="number")return e;if(Ht(e))return Oe;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(yt,"");var r=Tt.test(e);return r||St.test(e)?Et(e.slice(2),r?2:8):Ct.test(e)?Oe:+e}We.exports=Dt});var Ee="code-line",_=class{constructor(t,r,n,i){this.element=t;this.line=r;this.codeElement=n;this.endLine=i;this.#e=Array.from(it(t,"DETAILS"))}#e;get isVisible(){if(this.#e.some(n=>!n.open))return!1;let t=window.getComputedStyle(this.element);if(t.display==="none"||t.visibility==="hidden")return!1;let r=this.element.getBoundingClientRect();return!(r.height===0||r.width===0)}},ee=(()=>{let e,t=-1;return r=>{if(!e||r!==t){t=r,e=[new _(document.body,-1)];for(let n of document.getElementsByClassName(Ee)){if(!(n instanceof HTMLElement))continue;let i=+n.getAttribute("data-line");if(!isNaN(i))if(n.tagName==="CODE"&&n.parentElement&&n.parentElement.tagName==="PRE"){let a=((n.textContent||"").match(/\n/g)||[]).length+1,s=i+a-1;e.push(new _(n.parentElement,i,n,s))}else n.tagName==="PRE"||n.tagName==="UL"||n.tagName==="OL"||e.push(new _(n,i))}}return e}})();function q(e,t){let r=Math.floor(e),n=ee(t),i=n[0]||null;for(let o of n){if(o.line===r)return{previous:o,next:void 0};if(o.line>r)return{previous:i,next:o};i=o}return{previous:i}}function Le(e,t,r){let n=Math.floor(e),i=Math.max(n+1,Math.ceil(t)),o=ee(r).filter(s=>s.line>=0),a=[];for(let s=0;s<o.length;s++){let l=o[s],u=o[s+1],b=l.line,v=l.endLine!==void 0?l.endLine+1:u&&u.line>l.line?u.line:l.line+1;nt(n,i,b,v)&&a.push(l)}return a}function nt(e,t,r,n){return e<n&&r<t}function rt(e,t){let r=ee(t).filter(l=>l.isVisible),n=e-window.scrollY,i=-1,o=r.length-1;for(;i+1<o;){let l=Math.floor((i+o)/2),u=R(r[l]);u.top+u.height>=n?o=l:i=l}let a=r[o],s=R(a);return o>=1&&s.top>n?{previous:r[i],next:a}:o>1&&o<r.length&&s.top+s.height>n?{previous:a,next:r[o+1]}:{previous:a}}function R(e){let{element:t,codeElement:r}=e,n=t.getBoundingClientRect();if(r)return n;let i=t.querySelector(`.${Ee}`);if(i){let o=i.getBoundingClientRect(),a=Math.max(1,o.top-n.top);return{top:n.top,height:a}}return n}function Me(e){let{element:t,codeElement:r}=e,n=R(e);if(r){let i=window.getComputedStyle(t),o=parseFloat(i.paddingTop)||0,a=parseFloat(i.paddingBottom)||0;return{top:n.top+o,height:n.height-o-a,paddingTop:o,paddingBottom:a}}return{top:n.top,height:n.height,paddingTop:0,paddingBottom:0}}function z(e,t,r){if(!r.settings?.scrollPreviewWithEditor)return;if(e<=0){window.scroll(window.scrollX,0);return}let{previous:n,next:i}=q(e,t);if(!n)return;let o=0,a=R(n),s=a.top;if(n.endLine&&n.endLine>n.line)if(e<n.endLine){let l=Me(n),u=(e-n.line)/(n.endLine-n.line);o=window.scrollY+l.top+l.height*u}else if(i&&i.line!==n.line){let l=(e-n.endLine)/(i.line-n.endLine),u=window.scrollY+s+a.height,v=window.scrollY+i.element.getBoundingClientRect().top-u;o=u+l*v}else o=window.scrollY+s+a.height;else if(i&&i.line!==n.line){let l=(e-n.line)/(i.line-n.line),u=window.scrollY+s+a.height,v=window.scrollY+i.element.getBoundingClientRect().top-u;o=u+l*v}else{let l=e-Math.floor(e);o=window.scrollY+s+a.height*l}window.scroll(window.scrollX,Math.max(1,o))}function me(e,t){let{previous:r,next:n}=rt(e,t);if(r){if(r.line<0)return 0;let i=R(r),o=e-window.scrollY-i.top;if(r.endLine&&r.endLine>r.line){let a=Me(r),s=e-window.scrollY-a.top;if(s>=0&&s<=a.height){let l=s/a.height;return r.line+l*(r.endLine-r.line)}else if(n&&s>a.height){let l=s-a.height,u=R(n),b=a.top+a.height,v=u.top-b,E=l/v;return r.endLine+E*(n.line-r.endLine)}else s<0}if(n){let a=o/(R(n).top-i.top);return r.line+a*(n.line-r.line)}else{let a=o/i.height;return r.line+a}}return null}function Ae(e,t){return ee(t).find(r=>r.element.id===e)}function*it(e,t){for(let r=e.parentElement;r;r=r.parentElement)r.tagName===t&&(yield r)}var te=class{#e;onDidChangeTextEditorSelection(t,r){let{previous:n}=q(t,r);this.#r(n&&(n.codeElement||n.element))}#r(t){this.#n(this.#e),this.#t(t),this.#e=t}#n(t){t&&t.classList.toggle("code-active-line",!1)}#t(t){t&&t.classList.toggle("code-active-line",!0)}};function xe(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var Ne=(e,t)=>({postMessage(r,n){e.postMessage({type:r,source:t.settings.source,...n})}});function ge(e){let t=document.getElementById("vscode-markdown-preview-data");if(t){let r=t.getAttribute(e);if(r)return r}throw new Error(`Could not load data for ${e}`)}function pe(e){return JSON.parse(ge(e))}var ne=class{#e=pe("data-settings");get settings(){return this.#e}updateSettings(t){this.#e=t}};var Pe=11;function ot(e,t){var r=t.attributes,n,i,o,a,s;if(!(t.nodeType===Pe||e.nodeType===Pe)){for(var l=r.length-1;l>=0;l--)n=r[l],i=n.name,o=n.namespaceURI,a=n.value,o?(i=n.localName||i,s=e.getAttributeNS(o,i),s!==a&&(n.prefix==="xmlns"&&(i=n.name),e.setAttributeNS(o,i,a))):(s=e.getAttribute(i),s!==a&&e.setAttribute(i,a));for(var u=e.attributes,b=u.length-1;b>=0;b--)n=u[b],i=n.name,o=n.namespaceURI,o?(i=n.localName||i,t.hasAttributeNS(o,i)||e.removeAttributeNS(o,i)):t.hasAttribute(i)||e.removeAttribute(i)}}var re,at="http://www.w3.org/1999/xhtml",C=typeof document>"u"?void 0:document,st=!!C&&"content"in C.createElement("template"),lt=!!C&&C.createRange&&"createContextualFragment"in C.createRange();function dt(e){var t=C.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function ct(e){re||(re=C.createRange(),re.selectNode(C.body));var t=re.createContextualFragment(e);return t.childNodes[0]}function ut(e){var t=C.createElement("body");return t.innerHTML=e,t.childNodes[0]}function ft(e){return e=e.trim(),st?dt(e):lt?ct(e):ut(e)}function ie(e,t){var r=e.nodeName,n=t.nodeName,i,o;return r===n?!0:(i=r.charCodeAt(0),o=n.charCodeAt(0),i<=90&&o>=97?r===n.toUpperCase():o<=90&&i>=97?n===r.toUpperCase():!1)}function mt(e,t){return!t||t===at?C.createElement(e):C.createElementNS(t,e)}function gt(e,t){for(var r=e.firstChild;r;){var n=r.nextSibling;t.appendChild(r),r=n}return t}function he(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var ke={OPTION:function(e,t){var r=e.parentNode;if(r){var n=r.nodeName.toUpperCase();n==="OPTGROUP"&&(r=r.parentNode,n=r&&r.nodeName.toUpperCase()),n==="SELECT"&&!r.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}he(e,t,"selected")},INPUT:function(e,t){he(e,t,"checked"),he(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var n=e.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==e.placeholder)return;n.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r=-1,n=0,i=e.firstChild,o,a;i;)if(a=i.nodeName&&i.nodeName.toUpperCase(),a==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(a==="OPTION"){if(i.hasAttribute("selected")){r=n;break}n++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}e.selectedIndex=r}}},G=1,Ie=11,De=3,Be=8;function D(){}function pt(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function ht(e){return function(r,n,i){if(i||(i={}),typeof n=="string")if(r.nodeName==="#document"||r.nodeName==="HTML"||r.nodeName==="BODY"){var o=n;n=C.createElement("html"),n.innerHTML=o}else n=ft(n);else n.nodeType===Ie&&(n=n.firstElementChild);var a=i.getNodeKey||pt,s=i.onBeforeNodeAdded||D,l=i.onNodeAdded||D,u=i.onBeforeElUpdated||D,b=i.onElUpdated||D,v=i.onBeforeNodeDiscarded||D,E=i.onNodeDiscarded||D,x=i.onBeforeElChildrenUpdated||D,de=i.skipFromChildren||D,$=i.addChild||function(d,c){return d.appendChild(c)},F=i.childrenOnly===!0,M=Object.create(null),B=[];function W(d){B.push(d)}function K(d,c){if(d.nodeType===G)for(var p=d.firstChild;p;){var f=void 0;c&&(f=a(p))?W(f):(E(p),p.firstChild&&K(p,c)),p=p.nextSibling}}function P(d,c,p){v(d)!==!1&&(c&&c.removeChild(d),E(d),K(d,p))}function g(d){if(d.nodeType===G||d.nodeType===Ie)for(var c=d.firstChild;c;){var p=a(c);p&&(M[p]=c),g(c),c=c.nextSibling}}g(r);function L(d){l(d);for(var c=d.firstChild;c;){var p=c.nextSibling,f=a(c);if(f){var m=M[f];m&&ie(c,m)?(c.parentNode.replaceChild(m,c),O(m,c)):L(c)}else L(c);c=p}}function H(d,c,p){for(;c;){var f=c.nextSibling;(p=a(c))?W(p):P(c,d,!0),c=f}}function O(d,c,p){var f=a(c);if(f&&delete M[f],!p){var m=u(d,c);if(m===!1||(m instanceof HTMLElement&&(d=m,g(d)),e(d,c),b(d),x(d,c)===!1))return}d.nodeName!=="TEXTAREA"?Ze(d,c):ke.TEXTAREA(d,c)}function Ze(d,c){var p=de(d,c),f=c.firstChild,m=d.firstChild,U,N,V,Q,k;e:for(;f;){for(Q=f.nextSibling,U=a(f);!p&&m;){if(V=m.nextSibling,f.isSameNode&&f.isSameNode(m)){f=Q,m=V;continue e}N=a(m);var Z=m.nodeType,I=void 0;if(Z===f.nodeType&&(Z===G?(U?U!==N&&((k=M[U])?V===k?I=!1:(d.insertBefore(k,m),N?W(N):P(m,d,!0),m=k,N=a(m)):I=!1):N&&(I=!1),I=I!==!1&&ie(m,f),I&&O(m,f)):(Z===De||Z==Be)&&(I=!0,m.nodeValue!==f.nodeValue&&(m.nodeValue=f.nodeValue))),I){f=Q,m=V;continue e}N?W(N):P(m,d,!0),m=V}if(U&&(k=M[U])&&ie(k,f))p||$(d,k),O(k,f);else{var fe=s(f);fe!==!1&&(fe&&(f=fe),f.actualize&&(f=f.actualize(d.ownerDocument||C)),$(d,f),L(f))}f=Q,m=V}H(d,m,N);var Se=ke[d.nodeName];Se&&Se(d,c)}var y=r,J=y.nodeType,Te=n.nodeType;if(!F){if(J===G)Te===G?ie(r,n)||(E(r),y=gt(r,mt(n.nodeName,n.namespaceURI))):y=n;else if(J===De||J===Be){if(Te===J)return y.nodeValue!==n.nodeValue&&(y.nodeValue=n.nodeValue),y;y=n}}if(y===n)E(r);else{if(n.isSameNode&&n.isSameNode(y))return;if(O(y,n,F),B)for(var ce=0,et=B.length;ce<et;ce++){var ue=M[B[ce]];ue&&P(ue,ue.parentNode,!1)}}return!F&&y!==r&&r.parentNode&&(y.actualize&&(y=y.actualize(r.ownerDocument||C)),r.parentNode.replaceChild(y,r)),y}}var vt=ht(ot),He=vt;var ve=Object.freeze({http:"http",https:"https",file:"file",untitled:"untitled",mailto:"mailto",vscode:"vscode","vscode-insiders":"vscode-insiders",notebookCell:"vscode-notebook-cell"});function be(e,t){return t.toLowerCase().startsWith(e+":")}var oe=class{#e=Math.random().toString(36).slice(2,10);#r;#n;#t;#i=0;constructor(t,r){this.#r=r,this.#n=t,this.#t=new BroadcastChannel(t.channelName),this.#t.onmessage=n=>{let{line:i,sender:o}=n.data;if(o===this.#e||typeof i!="number"||isNaN(i))return;let a=bt(i,this.#n.lineMappings);this.#i=Date.now()+100,this.#r(a)}}update(t){this.#n=t}broadcastScroll(t){!this.#t||Date.now()<this.#i||this.#t.postMessage({line:t,sender:this.#e})}};function bt(e,t){if(!t?.length)return e;let r=Math.floor(e),n=e-r,i=t[r]??e;if(n<=0)return Math.max(0,i);let o=t[r+1];return typeof o!="number"?Math.max(0,i+n):Math.max(0,i+(o-i)*n)}var Ye=Ue(),T=0,w,_e=new te,h=new ne,S=0,j=h.settings.source,ye=h.settings.lineChanges,Y=acquireVsCodeApi(),Ot=e=>{T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},100),le(()=>z(e,S,h))},ze=h.settings.diffScrollSync?new oe(h.settings.diffScrollSync,Ot):void 0,se=Y.getState()??{},A={...se,...pe("data-state")},Rt=typeof h.settings.line=="number"&&!isNaN(h.settings.line);typeof se.scrollProgress<"u"&&(se?.resource!==A.resource||Rt&&se.line!==h.settings.line)&&(A.scrollProgress=void 0);Y.setState(A);var X=Ne(Y,h);window.cspAlerter.setPoster(X);window.styleLoadingMonitor.setPoster(X);function le(e){let t=document.getElementsByTagName("img");if(t.length>0){let r=Array.from(t,n=>n.complete?Promise.resolve():new Promise(i=>{n.addEventListener("load",()=>i()),n.addEventListener("error",()=>i())}));Promise.all(r).then(()=>setTimeout(e,0))}else setTimeout(e,0)}xe(()=>{let r=[...new DOMParser().parseFromString(ge("data-initial-md-content"),"text/html").body.children];document.body.append(...r);for(let i of r)i instanceof HTMLElement&&Ce(i);let n=A.scrollProgress;if(Ge(),$e(ye),typeof n=="number"&&!h.settings.fragment){le(()=>{T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},200);let i=Math.max(1,n*document.body.clientHeight);window.scrollTo(0,i)});return}h.settings.scrollPreviewWithEditor&&le(()=>{if(h.settings.fragment){let i;try{i=encodeURIComponent(h.settings.fragment)}catch{i=h.settings.fragment}A.fragment=void 0,Y.setState(A);let o=Ae(i,S);o&&(T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},200),z(o.line,S,h))}else isNaN(h.settings.line)||(T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},200),z(h.settings.line,S,h))}),typeof h.settings.selectedLine=="number"&&_e.onDidChangeTextEditorSelection(h.settings.selectedLine,S)});var Ft=(()=>{let e=Ye(t=>{T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},50),le(()=>z(t,S,h))},50);return t=>{isNaN(t)||(A.line=t,e(t))}})();window.addEventListener("resize",()=>{T=1,w&&clearTimeout(w),w=window.setTimeout(()=>{T=0},200),Je()},!0);function Ge(){let e=document.getElementsByTagName("img"),t=0;for(let r of e){r.id="image-"+t,t+=1;let n=r.getAttribute("data-src"),o=n&&!(be(ve.http,n)||be(ve.https,n))?"localImage":"image";r.setAttribute("data-vscode-context",JSON.stringify({webviewSection:o,id:r.id,preventDefaultContextMenuItems:!0,resource:j,imageSource:n}))}}async function Xe(e,t=5){if(!document.hasFocus()&&t>0){setTimeout(()=>{Xe(e,t-1)},20);return}try{await navigator.clipboard.write([new ClipboardItem({"image/png":new Promise(r=>{let n=document.createElement("canvas");n!==null&&(n.width=e.naturalWidth,n.height=e.naturalHeight,n.getContext("2d")?.drawImage(e,0,0)),n.toBlob(i=>{i&&r(i),n.remove()},"image/png")})})])}catch(r){console.error(r);let n=window.getSelection();if(!n){await navigator.clipboard.writeText(e.getAttribute("data-src")??e.src);return}n.removeAllRanges();let i=document.createRange();i.selectNode(e),n.addRange(i),document.execCommand("copy"),n.removeAllRanges()}}window.addEventListener("message",async e=>{let t=e.data;switch(t.type){case"copyImage":{let r=document.getElementById(t.id);r instanceof HTMLImageElement&&Xe(r);return}case"onDidChangeTextEditorSelection":t.source===j&&_e.onDidChangeTextEditorSelection(t.line,S);return;case"updateView":t.source===j&&Ft(t.line);return;case"updateContent":{ye=t.lineChanges,t.diffScrollSync&&ze?.update(t.diffScrollSync);let r=document.querySelector(".markdown-body"),i=new DOMParser().parseFromString(t.content,"text/html");for(let o of Array.from(i.querySelectorAll("meta")))o.hasAttribute("http-equiv")&&o.remove();if(t.source!==j){j=t.source;let o=i.querySelector(".markdown-body");r.replaceWith(o),Ce(o)}else{let o=i.querySelector(".markdown-body"),a=o.querySelectorAll("link");for(let s of a)s.remove();o.prepend(...a),He(r,o,{childrenOnly:!0,onBeforeElUpdated:(s,l)=>{if(Qe(s,l)){let u=s.querySelectorAll("[data-line]"),b=l.querySelectorAll("[data-line]");u.length!==b.length&&console.log("unexpected line number change");for(let v=0;v<u.length;++v){let E=u[v],x=b[v];x&&E.setAttribute("data-line",x.getAttribute("data-line"))}return!1}return s.tagName==="DETAILS"&&l.tagName==="DETAILS"&&s.hasAttribute("open")&&l.setAttribute("open",""),!0},addChild:(s,l)=>{s.appendChild(l),l instanceof HTMLElement&&Ce(l)}})}++S,window.dispatchEvent(new CustomEvent("vscode.markdown.updateContent")),Ge(),$e(ye);break}}},!1);function $e(e){for(let t of document.querySelectorAll(".code-line-diff-added, .code-line-diff-deleted, .code-line-diff-modified"))t.classList.remove("code-line-diff","code-line-diff-added","code-line-diff-deleted","code-line-diff-modified");for(let t of document.querySelectorAll(".diff-change-indicator"))t.remove();for(let t of document.querySelectorAll(".diff-modification-gutter"))t.remove();Ve(e?.added,"code-line-diff-added"),Ve(e?.deleted,"code-line-diff-deleted"),Wt(e),$t(e)}function Ve(e,t){if(e)for(let r of e){let{previous:n,next:i}=q(r,S),o=n.line>=0?n:i,a=o?.codeElement||o?.element;a&&a.classList.add("code-line-diff",t)}}function Wt(e){if(e?.changeIndicators?.length)for(let t of Ut(e.changeIndicators)){if(t.indicator.type==="deletion"){let n=jt(t.indicator);t.elements[0].parentElement?.insertBefore(n,t.elements[0]);continue}let r=!0;for(let n of t.elements)n.classList.add("code-line-diff-modified"),Yt(n,r?t.indicator:void 0),r=!1}}function Ut(e){let t=[];for(let r of e){let n=r.type==="deletion"?Vt(r.modifiedLine):qt(r.modifiedLine,r.modifiedLineCount);n.length&&t.push({indicator:r,elements:n})}return t}function Vt(e){let{previous:t,next:r}=q(e,S),n=t.line===e?t.codeElement||t.element:r?.codeElement||r?.element||t.codeElement||t.element;return n?[n]:[]}function qt(e,t){let r=[],n=new Set,i=Le(e,e+t,S);for(let o of i){let a=o.codeElement||o.element;a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function jt(e){let t=document.createElement("div");t.className=`diff-change-indicator diff-change-indicator-${e.type}`,t.setAttribute("data-original-line-count",String(e.originalLineCount));let r=document.createElement("span");r.className="diff-change-indicator-arrow";let n=Ke(e);return r.appendChild(n),t.appendChild(r),t}function Yt(e,t){let r=document.createElement("div");if(r.className="diff-modification-gutter",t){let n=Ke(t);r.appendChild(n)}e.style.position="relative",e.appendChild(r)}function Ke(e){let t=document.createElement("div");return t.className="diff-change-indicator-tooltip",e.originalContent&&qe(t,"diff-tooltip-deleted",e.originalContent,e.originalInnerChanges,"diff-tooltip-inner-deleted"),e.modifiedContent&&qe(t,"diff-tooltip-added",e.modifiedContent,e.modifiedInnerChanges,"diff-tooltip-inner-added"),t}function qe(e,t,r,n,i){let o=document.createElement("div");o.className=t;let a=document.createElement("pre");_t(a,r,n,i),o.appendChild(a),e.appendChild(o)}function _t(e,t,r,n){if(!r?.length){e.textContent=t;return}let i=Gt(r),o=t.split(`
2
+ `);for(let a=0;a<o.length;++a)zt(e,o[a],i.get(a),n),a+1<o.length&&e.appendChild(document.createTextNode(`
3
+ `))}function zt(e,t,r,n){let i=Xt(r,t.length),o=0;for(let a of i){o<a.startColumn&&e.appendChild(document.createTextNode(t.slice(o,a.startColumn)));let s=document.createElement("span");s.className=n,s.textContent=t.slice(a.startColumn,a.endColumn),e.appendChild(s),o=a.endColumn}o<t.length&&e.appendChild(document.createTextNode(t.slice(o)))}function Gt(e){let t=new Map;for(let r of e){let n=t.get(r.line);n?n.push(r):t.set(r.line,[r])}return t}function Xt(e,t){if(!e?.length)return[];let r=e.map(i=>({startColumn:je(i.startColumn,t),endColumn:je(i.endColumn,t)})).filter(i=>i.startColumn<i.endColumn).sort((i,o)=>i.startColumn-o.startColumn||i.endColumn-o.endColumn),n=[];for(let i of r){let o=n[n.length-1];o&&i.startColumn<=o.endColumn?o.endColumn=Math.max(o.endColumn,i.endColumn):n.push(i)}return n}function je(e,t){return Math.min(Math.max(e,0),t)}function $t(e){let t="diff-inner-added",r="diff-inner-deleted";if(CSS.highlights?.delete(t),CSS.highlights?.delete(r),!e?.innerChanges?.length||!CSS.highlights)return;let n=e.added?t:r,i=[],o=document.querySelector(".markdown-body");if(o){for(let{startMarker:a,endMarker:s}of Kt(o)){let l=new Range;l.setStartAfter(a),l.setEndBefore(s),i.push(l)}i.length>0&&CSS.highlights.set(n,new Highlight(...i))}}function Kt(e){let t=new Map;for(let n of e.querySelectorAll("[data-diff-end]")){let i=n.getAttribute("data-diff-end");i!==null&&t.set(i,n)}let r=[];for(let n of e.querySelectorAll("[data-diff-start]")){let i=n.getAttribute("data-diff-start"),o=i===null?void 0:t.get(i);o&&!(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)&&r.push({startMarker:n,endMarker:o})}return r}document.addEventListener("dblclick",e=>{if(!h.settings.doubleClickToSwitchToEditor||j.endsWith(".copilotmd"))return;for(let n=e.target;n;n=n.parentNode)if(n.tagName==="A")return;let t=e.pageY,r=me(t,S);typeof r=="number"&&!isNaN(r)&&X.postMessage("didClick",{line:Math.floor(r)})});var Jt=["http:","https:","mailto:","vscode:","vscode-insiders:"];document.addEventListener("click",e=>{if(!e)return;let t=e.target;for(;t;){if(t.tagName&&t.tagName==="A"&&t.href){if(t.getAttribute("href")?.startsWith("#"))return;let r=t.getAttribute("data-href");if(!r&&(r=t.getAttribute("href"),r&&Jt.some(n=>r.startsWith(n))))return;if(r&&!/^[a-z\-]+:/i.test(r)){X.postMessage("openLink",{href:r}),e.preventDefault(),e.stopPropagation();return}return}t=t.parentElement}},!0);window.addEventListener("scroll",Ye(()=>{if(Je(),T>0)return;let e=me(window.scrollY,S);typeof e=="number"&&!isNaN(e)&&(A.line=e,Y.setState(A),X.postMessage("revealLine",{line:e}),ze?.broadcastScroll(e))},50));function Je(){A.scrollProgress=window.scrollY/document.body.clientHeight,Y.setState(A)}function Qe(e,t){let r=["open"];if(e.isEqualNode(t))return!0;if(e.tagName!==t.tagName||e.textContent!==t.textContent)return!1;let n=[...e.attributes].filter(s=>!r.includes(s.name)),i=[...t.attributes].filter(s=>!r.includes(s.name));if(n.length!==i.length)return!1;for(let s=0;s<n.length;++s){let l=n[s],u=i[s];if(l.name!==u.name||l.value!==u.value&&l.name!=="data-line")return!1}let o=Array.from(e.children),a=Array.from(t.children);return o.length===a.length&&o.every((s,l)=>Qe(s,a[l]))}function Ce(e){let t=["type","src","nonce","noModule","async"],r=e.tagName==="SCRIPT"?[e]:Array.from(e.getElementsByTagName("script"));for(let n of r){if(!(n instanceof HTMLElement))continue;let i=document.createElement("script"),o=n.innerText;i.text=o;for(let a of t){let s=n.getAttribute?.(a);s&&i.setAttribute(a,s)}n.insertAdjacentElement("afterend",i),n.remove()}}