PageSourceSearch

https://cdn.overleaf.com/js/4138-eda7d9011b632d2d75c2.js

js overleaf.com collected 2026-09-24 08:32:28 UTC 15,276 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_overleaf_web=self.webpackChunk_overleaf_web||[]).push([[4138],{74138(e,t,i){i.d(t,{PL:()=>g,bu:()=>A,i5:()=>q,pJ:()=>H});var o=i(19472),s=i(13591),n=i(75779);class l{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class r{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let n=i.facet(C).markerFilter;n&&(e=n(e,i));let l=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),c=new s.vB,d=[],f=0,m=i.doc.iter(),u=0,h=i.doc.length;for(let e=0;;){let t,i,s=e==l.length?null:l[e];if(!s&&!d.length)break;if(d.length)t=f,i=d.reduce((e,t)=>Math.min(e,t.to),s&&s.from>t?s.from:1e8);else{if(t=s.from,t>h)break;i=s.to,d.push(s),e++}for(;e<l.length;){let o=l[e];if(o.from!=t||!(o.to>o.from||o.to==t)){i=Math.min(o.from,i);break}d.push(o),e++,i=Math.min(o.to,i)}i=Math.min(i,h);let n=!1;if(d.some(e=>e.from==t&&(e.to==i||i==h))&&(n=t==i,!n&&i-t<10)){let e=t-(u+m.value.length);e>0&&(m.next(e),u=t);for(let e=t;;){if(e>=i){n=!0;break}if(!m.lineBreak&&u+m.value.length>e)break;e=u+m.value.length,u+=m.value.length,m.next()}}let r=O(d);if(n)c.add(t,t,o.NZ.widget({widget:new L(r),diagnostics:d.slice()}));else{let e=d.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");c.add(t,i,o.NZ.mark({class:"cm-lintRange cm-lintRange-"+r+e,diagnostics:d.slice(),inclusiveEnd:d.some(e=>e.to>i)}))}if(f=i,f==h)break;for(let e=0;e<d.length;e++)d[e].to<=f&&d.splice(e--,1)}let g=c.finish();return new r(g,t,a(g))}}function a(e,t=null,i=0){let o=null;return e.between(i,1e9,(e,i,{spec:s})=>{if(!(t&&s.diagnostics.indexOf(t)<0))if(o){if(s.diagnostics.indexOf(o.diagnostic)<0)return!1;o=new l(o.from,i,o.diagnostic)}else o=new l(e,i,t||s.diagnostics[0])}),o}function c(e,t){let i=t.pos,o=t.end||i,s=e.state.facet(C).hideOn(e,i,o);if(null!=s)return s;let n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(f))&&!e.changes.touchesRange(n.from,Math.max(n.to,o)))}function d(e,t){return e.field(h,!1)?t:t.concat(s.Pe.appendConfig.of(j))}const f=s.Pe.define(),m=s.Pe.define(),u=s.Pe.define(),h=s.sU.define({create:()=>new r(o.NZ.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let i=e.diagnostics.map(t.changes),o=null,s=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);o=a(i,e.selected.diagnostic,s)||a(i,null,s)}!i.size&&s&&t.state.facet(C).autoPanel&&(s=null),e=new r(i,s,o)}for(let i of t.effects)if(i.is(f)){let o=t.state.facet(C).autoPanel?i.value.length?S.open:null:e.panel;e=r.init(i.value,o,t.state)}else i.is(m)?e=new r(e.diagnostics,i.value?S.open:null,e.selected):i.is(u)&&(e=new r(e.diagnostics,e.panel,i.value));return e},provide:e=>[o.S7.from(e,e=>e.panel),o.Lz.decorations.from(e,e=>e.diagnostics)]});function g(e){let t=e.field(h,!1);return t?t.diagnostics.size:0}const p=o.NZ.mark({class:"cm-lintRange cm-lintRange-active"});function v(e,t,i){let o,{diagnostics:s}=e.state.field(h),n=-1,l=-1;s.between(t-(i<0?1:0),t+(i>0?1:0),(e,s,{spec:r})=>{if(t>=e&&t<=s&&(e==s||(t>e||i>0)&&(t<s||i<0)))return o=r.diagnostics,n=e,l=s,!1});let r=e.state.facet(C).tooltipFilter;return o&&r&&(o=r(o,e.state)),o?{pos:n,end:l,above:e.state.doc.lineAt(n).to<l,create:()=>({dom:w(e,o)})}:null}function w(e,t){return(0,n.A)("ul",{class:"cm-tooltip-lint"},t.map(t=>T(e,t,!1)))}const b=e=>{let t=e.state.field(h,!1);return!(!t||!t.panel)&&(e.dispatch({effects:m.of(!1)}),!0)},k=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(h,!1);t&&t.panel||e.dispatch({effects:d(e.state,[m.of(!0)])});let i=(0,o.ld)(e,S.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(h,!1);if(!t)return!1;let i=e.state.selection.main,o=t.diagnostics.iter(i.to+1);return!(!o.value&&(o=t.diagnostics.iter(0),!o.value||o.from==i.from&&o.to==i.to))&&(e.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0}),!0)}}],x=o.Z9.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(C);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(C);t.length&&function(e,t,i){let o=[],s=-1;for(let n of e)n.then(i=>{o.push(i),clearTimeout(s),o.length==e.length?t(o):s=setTimeout(()=>t(o),200)},i)}(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:d(e,[f.of(t)])}}(this.view.state,t.reduce((e,t)=>
1e.concat(t))))},e=>{(0,o.c_)(this.view.state,e)})}}update(e){let t=e.state.facet(C);(e.docChanged||t!=e.startState.facet(C)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});const C=s.sj.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...(0,s.QR)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:y,tooltipFilter:y,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,o,s)=>e(i,o,s)||t(i,o,s):e:t,autoPanel:(e,t)=>e||t})})});function y(e,t){return e?t?(i,o)=>t(e(i,o),o):e:t}function A(e,t={}){return[C.of({source:e,config:t}),x,j]}function R(e){let t=[];if(e)e:for(let{name:i}of e){for(let e=0;e<i.length;e++){let o=i[e];if(/[a-zA-Z]/.test(o)&&!t.some(e=>e.toLowerCase()==o.toLowerCase())){t.push(o);continue e}}t.push("")}return t}function T(e,t,i){var o;let s=i?R(t.actions):[];return(0,n.A)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,n.A)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(o=t.actions)||void 0===o?void 0:o.map((i,o)=>{let l=!1,r=o=>{if(o.preventDefault(),l)return;l=!0;let s=a(e.state.field(h).diagnostics,t);s&&i.apply(e,s.from,s.to)},{name:c}=i,d=s[o]?c.indexOf(s[o]):-1,f=d<0?c:[c.slice(0,d),(0,n.A)("u",c.slice(d,d+1)),c.slice(d+1)],m=i.markClass?" "+i.markClass:"";return(0,n.A)("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:r,onmousedown:r,"aria-label":` Action: ${c}${d<0?"":` (access key "${s[o]})"`}.`},f)}),t.source&&(0,n.A)("div",{class:"cm-diagnosticSource"},t.source))}class L extends o.xO{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,n.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class P{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=T(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class S{constructor(e){this.view=e,this.items=[];this.list=(0,n.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)b(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],o=R(i.actions);for(let s=0;s<o.length;s++)if(o[s].toUpperCase().charCodeAt(0)==t.keyCode){let t=a(this.view.state.field(h).diagnostics,i);t&&i.actions[s].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=(0,n.A)("div",{class:"cm-panel-lint"},this.list,(0,n.A)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>b(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(h).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(h),i=0,o=!1,s=null,n=new Set;for(e.between(0,this.view.state.doc.length,(e,l,{spec:r})=>{for(let e of r.diagnostics){if(n.has(e))continue;n.add(e);let l,r=-1;for(let t=i;t<this.items.length;t++)if(this.items[t].diagnostic==e){r=t;break}r<0?(l=new P(this.view,e),this.items.splice(i,0,l),o=!0):(l=this.items[r],r>i&&(this.items.splice(i,r-i),o=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),s=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();0==this.items.length&&(this.items.push(new P(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let i=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/i:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=a(this.view.state.field(h).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:u.of(t)})}static open(e){return new S(e)}}function M(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function I(e){return M(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const B=o.Lz.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:I("#d11")},".cm-lintRange-warning":{backgroundImage:I("orange")},".cm-lintRange-info":{backgroundImage:I("#999")},".cm-lintRange-hint":{backgroundImage:I("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function D(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function O(e){let t="hint",i=1;for(let o of e){let e=D(o.severity);e>i&&(i=e,t=o.severity)}return t}class F extends o.wJ{constructor(e){super(),this.diagnostics=e,this.severity=O(e)}toDOM(e){let t=document.createElement("div");
1t.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,o=e.state.facet(E).tooltipFilter;return o&&(i=o(i,e.state)),i.length&&(t.onmouseover=()=>function(e,t,i){function o(){let o=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(o.from)&&e.dispatch({effects:_.of({pos:o.from,above:!1,clip:!1,create:()=>({dom:w(e,i),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,function(e,t){let i=o=>{let s=t.getBoundingClientRect();if(!(o.clientX>s.left-10&&o.clientX<s.right+10&&o.clientY>s.top-10&&o.clientY<s.bottom+10)){for(let e=o.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),e.state.field(U)&&e.dispatch({effects:_.of(null)})}};window.addEventListener("mousemove",i)}(e,t)}let{hoverTime:s}=e.state.facet(E),n=setTimeout(o,s);t.onmouseout=()=>{clearTimeout(n),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(n),n=setTimeout(o,s)}}(e,t,i)),t}}function z(e,t){let i=Object.create(null);for(let o of t){let t=e.lineAt(o.from);(i[t.from]||(i[t.from]=[])).push(o)}let o=[];for(let e in i)o.push(new F(i[e]).range(+e));return s.om.of(o,!0)}const N=(0,o.cU)({class:"cm-gutter-lint",markers:e=>e.state.field(Z),widgetMarker:(e,t,i)=>{let o=[];return e.state.field(Z).between(i.from,i.to,(e,t,s)=>{e>i.from&&e<i.to&&o.push(...s.diagnostics)}),o.length?new F(o):null}}),Z=s.sU.define({create:()=>s.om.empty,update(e,t){e=e.map(t.changes);let i=t.state.facet(E).markerFilter;for(let o of t.effects)if(o.is(f)){let s=o.value;i&&(s=i(s||[],t.state)),e=z(t.state.doc,s.slice(0))}return e}}),_=s.Pe.define(),U=s.sU.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=c(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(_)?t.value:e,e)),provide:e=>o.DK.from(e)}),$=o.Lz.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:M('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:M('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:M('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),j=[h,o.Lz.decorations.compute([h],e=>{let{selected:t,panel:i}=e.field(h);return t&&i&&t.from!=t.to?o.NZ.set([p.range(t.from,t.to)]):o.NZ.none}),(0,o.Ux)(v,{hideOn:c}),B],E=s.sj.define({combine:e=>(0,s.QR)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});function H(e={}){return[E.of(e),Z,N,$,U]}function q(e,t){let i=e.field(h,!1);if(i&&i.diagnostics.size){let e=[],o=[],n=-1;for(let l=s.om.iter([i.diagnostics]);;l.next()){for(let i=0;i<e.length;i++)(!l.value||l.value.spec.diagnostics.indexOf(e[i])<0)&&(t(e[i],o[i],n),e.splice(i,1),o.splice(i--,1));if(!l.value)break;for(let t of l.value.spec.diagnostics)e.indexOf(t)<0&&(e.push(t),o.push(l.from));n=l.to}}}i.d(t,["$w",0,k])}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.