diff --git a/docs/_static/preview/assets/index-CSk4DLjl.js b/docs/_static/preview/assets/index-CSk4DLjl.js deleted file mode 100644 index e7b3f5f7..00000000 --- a/docs/_static/preview/assets/index-CSk4DLjl.js +++ /dev/null @@ -1,15 +0,0 @@ -var Li=Object.defineProperty;var Ri=(i,e,t)=>e in i?Li(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var k=(i,e,t)=>Ri(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function t(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=t(s);fetch(s.href,o)}})();const Si="modulepreload",Ii=function(i,e){return new URL(i,e).href},jt={},_t=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),r=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=Promise.all(t.map(c=>{if(c=Ii(c,n),c in jt)return;jt[c]=!0;const d=c.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!n)for(let f=o.length-1;f>=0;f--){const g=o[f];if(g.href===c&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Si,d||(m.as="script",m.crossOrigin=""),m.href=c,r&&m.setAttribute("nonce",r),document.head.appendChild(m),d)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}return s.then(()=>e()).catch(o=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o})};function R(){}function hi(i){return i()}function Yt(){return Object.create(null)}function ae(i){i.forEach(hi)}function kt(i){return typeof i=="function"}function oe(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Oi(i){return Object.keys(i).length===0}function mi(i,...e){if(i==null){for(const n of e)n(void 0);return R}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function _e(i,e,t){i.$$.on_destroy.push(mi(e,t))}function Di(i,e,t){return i.set(t),e}function u(i,e){i.appendChild(e)}function I(i,e,t){i.insertBefore(e,t||null)}function S(i){i.parentNode&&i.parentNode.removeChild(i)}function Hi(i,e){for(let t=0;ti.removeEventListener(e,t,n)}function Ct(i){return function(e){return e.preventDefault(),i.call(this,e)}}function Mt(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function a(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function yt(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Ni(i){return Array.from(i.childNodes)}function we(i,e){e=""+e,i.data!==e&&(i.data=e)}function le(i,e){i.value=e??""}function Q(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function Xt(i,e,t){for(let n=0;n{const s=i.$$.callbacks[e];if(s){const o=zi(e,t,{cancelable:n});return s.slice().forEach(l=>{l.call(i,o)}),!o.defaultPrevented}return!0}}const Ne=[],Ae=[];let Be=[];const Gt=[],Wi=Promise.resolve();let At=!1;function Ui(){At||(At=!0,Wi.then(pi))}function ut(i){Be.push(i)}const wt=new Set;let He=0;function pi(){if(He!==0)return;const i=Qe;do{try{for(;Hei.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Be=e}const ct=new Set;let Le;function $e(){Le={r:0,c:[],p:Le}}function qe(){Le.r||ae(Le.c),Le=Le.p}function H(i,e){i&&i.i&&(ct.delete(i),i.i(e))}function $(i,e,t,n){if(i&&i.o){if(ct.has(i))return;ct.add(i),Le.c.push(()=>{ct.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function dt(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Xi(i,e){$(i,1,1,()=>{e.delete(i.key)})}function Gi(i,e,t,n,s,o,l,r,c,d,p,v){let m=i.length,f=o.length,g=m;const w={};for(;g--;)w[i[g].key]=g;const b=[],y=new Map,A=new Map,C=[];for(g=f;g--;){const F=v(s,o,g),O=t(F);let _=l.get(O);_?C.push(()=>_.p(F,e)):(_=d(O,F),_.c()),y.set(O,b[g]=_),O in w&&A.set(O,Math.abs(g-w[O]))}const M=new Set,D=new Set;function E(F){H(F,1),F.m(r,p),l.set(F.key,F),p=F.first,f--}for(;m&&f;){const F=b[f-1],O=i[m-1],_=F.key,P=O.key;F===O?(p=F.first,m--,f--):y.has(P)?!l.has(_)||M.has(_)?E(F):D.has(P)?m--:A.get(_)>A.get(P)?(D.add(_),E(F)):(M.add(P),m--):(c(O,l),m--)}for(;m--;){const F=i[m];y.has(F.key)||c(F,l)}for(;f;)E(b[f-1]);return ae(C),b}function be(i){i&&i.c()}function me(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ut(()=>{const o=i.$$.on_mount.map(hi).filter(kt);i.$$.on_destroy?i.$$.on_destroy.push(...o):ae(o),i.$$.on_mount=[]}),s.forEach(ut)}function pe(i,e){const t=i.$$;t.fragment!==null&&(Yi(t.after_update),ae(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ki(i,e){i.$$.dirty[0]===-1&&(Ne.push(i),Ui(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<{const g=f.length?f[0]:m;return d.ctx&&s(d.ctx[v],d.ctx[v]=g)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](g),p&&Ki(i,v)),m}):[],d.update(),p=!0,ae(d.before_update),d.fragment=n?n(d.ctx):!1,e.target){if(e.hydrate){const v=Ni(e.target);d.fragment&&d.fragment.l(v),v.forEach(S)}else d.fragment&&d.fragment.c();e.intro&&H(i.$$.fragment),me(i,e.target,e.anchor),pi()}Ke(c)}class ue{constructor(){k(this,"$$");k(this,"$$set")}$destroy(){pe(this,1),this.$destroy=R}$on(e,t){if(!kt(t))return R;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!Oi(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zi="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zi);function Qi(i){let e,t;return{c(){e=x("svg"),t=x("path"),a(t,"fill-rule","evenodd"),a(t,"clip-rule","evenodd"),a(t,"d","M5.11634 0.889422C4.86506 -0.296474 3.17237 -0.296474 2.92109 0.889422C2.78291 1.54158 2.10994 1.93011 1.47607 1.72371C0.323418 1.34837 -0.522932 2.81429 0.378448 3.62484C0.87414 4.07059 0.87414 4.84767 0.378448 5.29341C-0.522931 6.10397 0.323418 7.56989 1.47607 7.19455C2.10994 6.98814 2.78291 7.37668 2.92109 8.02883C3.17237 9.21473 4.86506 9.21473 5.11634 8.02883C5.25452 7.37668 5.92749 6.98814 6.56136 7.19455C7.71401 7.56989 8.56036 6.10397 7.65898 5.29341C7.16329 4.84767 7.16329 4.07059 7.65898 3.62484C8.56036 2.81429 7.71401 1.34837 6.56136 1.72371C5.92749 1.93011 5.25452 1.54158 5.11634 0.889422ZM4.01883 6.33408C5.05436 6.33408 5.89383 5.49462 5.89383 4.45908C5.89383 3.42355 5.05436 2.58408 4.01883 2.58408C2.98329 2.58408 2.14383 3.42355 2.14383 4.45908C2.14383 5.49462 2.98329 6.33408 4.01883 6.33408Z"),a(t,"fill","currentColor"),a(e,"width","9"),a(e,"height","9"),a(e,"viewBox","0 0 9 9"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(n,s){I(n,e,s),u(e,t)},p:R,i:R,o:R,d(n){n&&S(e)}}}class Ji extends ue{constructor(e){super(),ce(this,e,null,Qi,oe,{})}}function en(i){let e,t,n,s,o,l,r,c,d,p,v,m,f,g,w,b,y;return{c(){e=x("svg"),t=x("g"),n=x("path"),s=x("path"),o=x("defs"),l=x("filter"),r=x("feFlood"),c=x("feBlend"),d=x("feGaussianBlur"),p=x("linearGradient"),v=x("stop"),m=x("stop"),f=x("stop"),g=x("linearGradient"),w=x("stop"),b=x("stop"),y=x("stop"),a(n,"fill-rule","evenodd"),a(n,"clip-rule","evenodd"),a(n,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(n,"fill","url(#paint0_linear_67_262)"),a(t,"opacity","0.5"),a(t,"filter","url(#filter0_f_67_262)"),a(s,"fill-rule","evenodd"),a(s,"clip-rule","evenodd"),a(s,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(s,"fill","url(#paint1_linear_67_262)"),a(r,"flood-opacity","0"),a(r,"result","BackgroundImageFix"),a(c,"mode","normal"),a(c,"in","SourceGraphic"),a(c,"in2","BackgroundImageFix"),a(c,"result","shape"),a(d,"stdDeviation","3.39785"),a(d,"result","effect1_foregroundBlur_67_262"),a(l,"id","filter0_f_67_262"),a(l,"x","3.2043"),a(l,"y","2.2043"),a(l,"width","36.0914"),a(l,"height","41.0914"),a(l,"filterUnits","userSpaceOnUse"),a(l,"color-interpolation-filters","sRGB"),a(v,"stop-color","#FFAA00"),a(m,"offset","0.514478"),a(m,"stop-color","#FFEB00"),a(f,"offset","1"),a(f,"stop-color","#98FF05"),a(p,"id","paint0_linear_67_262"),a(p,"x1","7.3769"),a(p,"y1","18.4566"),a(p,"x2","20.6583"),a(p,"y2","33.1038"),a(p,"gradientUnits","userSpaceOnUse"),a(w,"stop-color","#FFC834"),a(b,"offset","0.514478"),a(b,"stop-color","#FAF534"),a(y,"offset","1"),a(y,"stop-color","#B8FF38"),a(g,"id","paint1_linear_67_262"),a(g,"x1","7.3769"),a(g,"y1","18.4566"),a(g,"x2","20.6583"),a(g,"y2","33.1038"),a(g,"gradientUnits","userSpaceOnUse"),a(e,"width","44"),a(e,"height","44"),a(e,"viewBox","0 0 44 44"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(A,C){I(A,e,C),u(e,t),u(t,n),u(e,s),u(e,o),u(o,l),u(l,r),u(l,c),u(l,d),u(o,p),u(p,v),u(p,m),u(p,f),u(o,g),u(g,w),u(g,b),u(g,y)},p:R,i:R,o:R,d(A){A&&S(e)}}}class tn extends ue{constructor(e){super(),ce(this,e,null,en,oe,{})}}const Ve=[];function nn(i,e){return{subscribe:ft(i,e).subscribe}}function ft(i,e=R){let t;const n=new Set;function s(r){if(oe(i,r)&&(i=r,t)){const c=!Ve.length;for(const d of n)d[1](),Ve.push(d,i);if(c){for(let d=0;d{n.delete(d),n.size===0&&t&&(t(),t=null)}}return{set:s,update:o,subscribe:l}}function vi(i,e,t){const n=!Array.isArray(i),s=n?[i]:i;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return nn(t,(l,r)=>{let c=!1;const d=[];let p=0,v=R;const m=()=>{if(p)return;v();const g=e(n?d[0]:d,l,r);o?l(g):v=kt(g)?g:R},f=s.map((g,w)=>mi(g,b=>{d[w]=b,p&=~(1<{p|=1<console.error(`Error when writing value from persisted store "${i}" to ${m}`,E),w=(c=t==null?void 0:t.onParseError)!=null?c:(E,F)=>console.error(`Error when parsing ${E?'"'+E+'"':"value"} from persisted store "${i}"`,F),b=(d=t==null?void 0:t.beforeRead)!=null?d:E=>E,y=(p=t==null?void 0:t.beforeWrite)!=null?p:E=>E,A=typeof window<"u"&&typeof document<"u",C=A?sn(m):null;function M(E,F){const O=y(F);try{C==null||C.setItem(E,v.stringify(O))}catch(_){g(_)}}function D(){function E(P){try{return v.parse(P)}catch(N){w(P,N)}}const F=C==null?void 0:C.getItem(i);if(F==null)return e;const O=E(F);return O==null?e:b(O)}if(!bt[m][i]){const E=D(),F=ft(E,P=>{if(A&&m=="local"&&f){const N=j=>{if(j.key===i&&j.newValue){let z;try{z=v.parse(j.newValue)}catch(ee){w(j.newValue,ee);return}const Fe=b(z);P(Fe)}};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)}}),{subscribe:O,set:_}=F;bt[m][i]={set(P){_(P),M(i,P)},update(P){return F.update(N=>{const j=P(N);return M(i,j),j})},reset(){this.set(e)},subscribe:O}}return bt[m][i]}function Kt(){return{collapseMode:"non-application",collapseCustomHide:"",collapseCustomShow:"",removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:.001,timeFormat:"absolute"}}const Z=Pt("pyinstrument:viewOptionsCallStack",Kt(),{syncTabs:!0,beforeRead(i){return{...Kt(),...i}}}),Ze=Pt("pyinstrument:viewOptions",{viewMode:"call-stack"},{syncTabs:!1}),Ge=Pt("pyinstrument:viewOptionsTimeline",{removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:1e-4},{syncTabs:!0});class on extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function rn(i,e){const t=e*(i.length-1),n=Math.floor(t),s=Math.ceil(t),o=i[n],l=i[s],r=t-n;return an(r,{to:[o,l]})}function ln(i,e,t){return i===1/0?(console.warn("clamp: value is Infinity, returning `max`",i),t):i===-1/0?(console.warn("clamp: value is -Infinity, returning `min`",i),e):Number.isFinite(i)?it?t:i:(console.warn("clamp: value isn't finite, returning `min`",i),e)}function ze(i,e){const{from:t=[0,1],to:n=[0,1]}=e,s=e.clamp||!1;let o=(i-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return s&&(o=ln(o,Math.min(n[0],n[1]),Math.max(n[0],n[1]))),o}function an(i,e){return`rgb( - ${ze(i,{from:e.from,to:[e.to[0][0],e.to[1][0]],clamp:e.clamp})}, - ${ze(i,{from:e.from,to:[e.to[0][1],e.to[1][1]],clamp:e.clamp})}, - ${ze(i,{from:e.from,to:[e.to[0][2],e.to[1][2]],clamp:e.clamp})} - )`}function cn(i){if(i.substr(0,1)=="#"){var e=(i.length-1)/3,t=[17,1,.062272][e-1];return[Math.round(parseInt(i.substr(1,e),16)*t),Math.round(parseInt(i.substr(1+e,e),16)*t),Math.round(parseInt(i.substr(1+2*e,e),16)*t)]}else return i.split("(")[1].split(")")[0].split(",").map(n=>+n)}function un(i,e,t={}){const{ignore:n=[],capture:s=!0}=t,o=window;if(!o)return()=>{};let l=!0,r=!1;const c=f=>n.some(g=>typeof g=="string"?Array.from(document.querySelectorAll(g)).some(w=>w===f.target||f.composedPath().includes(w)):g&&(f.target===g||f.composedPath().includes(g))),d=f=>{if(!(!i||i===f.target||f.composedPath().includes(i))){if(f.detail===0&&(l=!c(f)),!l){l=!0;return}e(f)}},p=f=>{r||(r=!0,setTimeout(()=>{r=!1},0),d(f))},v=f=>{l=!c(f)&&!!(i&&!f.composedPath().includes(i))};return o.addEventListener("click",p,{passive:!0,capture:s}),o.addEventListener("pointerdown",v,{passive:!0}),()=>{o.removeEventListener("click",p,{capture:s}),o.removeEventListener("pointerdown",v)}}function dn(i){const e=document.createElement("div");return e.appendChild(document.createTextNode(i)),e.innerHTML}function Et(i){return dn(i).replace(/(\/|\\)/g,t=>`${t}`)}function fn(i,e){if(i.length==0)return null;let t=i[0],n=e(t);for(const s of i){const o=e(s);o>n&&(t=s,n=o)}return t}function ht(){return Math.random().toString(36).substring(2)}function hn(i){let e,t,n,s,o,l,r,c,d,p,v,m,f,g,w,b,y,A,C,M,D,E,F,O,_,P,N,j,z,Fe,ee,J,Y,Ee,W,We,Ue,re,U,je,te,de,fe,ve,he,ye,Ye,Te,K,Re,ke,Xe,q,V,X,It,tt,Ot,Dt,Se,Ce,Ht,Ie,it,Vt,Nt,ge,Bt,zt,Oe,nt,xt,De,st,ot,ie,$t,qt,rt,lt,ne,Wt,pt,vt,gt,Ut;return pt=yt(i[5][0]),vt=yt(i[5][1]),{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Collapse frames",s=T(),o=h("div"),l=h("div"),r=h("input"),c=T(),d=h("label"),p=L("Library code"),v=T(),m=h("div"),m.textContent="Code run from the Python stdlib, a virtualenv, or a conda env will be collapsed.",f=T(),g=h("div"),w=h("input"),b=T(),y=h("label"),A=L("Custom"),C=T(),M=h("div"),D=L(`Regex on the source file path. - `),E=h("div"),F=h("label"),F.textContent="Show",O=T(),_=h("input"),P=T(),N=h("label"),N.textContent="Hide",j=T(),z=h("input"),Fe=L(` - If neither match, the library code rule is used.`),ee=T(),J=h("div"),Y=h("input"),Ee=T(),W=h("label"),We=L("Disabled"),Ue=T(),re=h("div"),U=h("div"),U.textContent="Remove frames",je=T(),te=h("div"),de=h("div"),fe=h("input"),ve=T(),he=h("label"),ye=L("importlib machinery"),Ye=T(),Te=h("div"),K=h("input"),Re=T(),ke=h("label"),Xe=L("Frames declaring __traceback_hide__"),q=T(),V=h("div"),X=h("input"),It=T(),tt=h("label"),Ot=L("pyinstrument frames"),Dt=T(),Se=h("div"),Ce=h("input"),Ht=T(),Ie=h("span"),it=h("label"),Vt=L("Frames with durations less than"),Nt=T(),ge=h("input"),Bt=L(` - % of the total time`),zt=T(),Oe=h("div"),nt=h("div"),nt.textContent="Time format",xt=T(),De=h("div"),st=h("div"),ot=h("label"),ie=h("input"),$t=L(` - Absolute time in seconds`),qt=T(),rt=h("div"),lt=h("label"),ne=h("input"),Wt=L(` - Percentage of the total run time`),a(n,"class","name svelte-1pecl4m"),a(r,"id",i[1]+"collapseModeAll"),a(r,"type","radio"),r.__value="non-application",le(r,r.__value),a(r,"class","svelte-1pecl4m"),a(d,"for",i[1]+"collapseModeAll"),a(m,"class","description svelte-1pecl4m"),a(l,"class","option svelte-1pecl4m"),a(w,"id",i[1]+"collapseModeCustom"),a(w,"type","radio"),w.__value="custom",le(w,w.__value),a(w,"class","svelte-1pecl4m"),a(y,"for",i[1]+"collapseModeCustom"),a(F,"for","collapseCustomShow"),a(F,"class","svelte-1pecl4m"),a(_,"id","collapseCustomShow"),a(_,"type","text"),a(_,"placeholder","myproject"),a(_,"spellcheck","false"),a(_,"autocapitalize","off"),a(_,"autocomplete","off"),a(_,"autocorrect","off"),a(_,"class","svelte-1pecl4m"),a(N,"for","collapseCustomHide"),a(N,"class","svelte-1pecl4m"),a(z,"id","collapseCustomHide"),a(z,"type","text"),a(z,"placeholder",".*/lib/.*"),a(z,"spellcheck","false"),a(z,"autocapitalize","off"),a(z,"autocomplete","off"),a(z,"autocorrect","off"),a(z,"class","svelte-1pecl4m"),a(E,"class","mini-input-grid svelte-1pecl4m"),a(M,"class","description svelte-1pecl4m"),a(g,"class","option svelte-1pecl4m"),a(Y,"id",i[1]+"collapseModeDisabled"),a(Y,"type","radio"),Y.__value="disabled",le(Y,Y.__value),a(Y,"class","svelte-1pecl4m"),a(W,"for",i[1]+"collapseModeDisabled"),a(J,"class","option svelte-1pecl4m"),a(o,"class","body"),a(t,"class","option-group svelte-1pecl4m"),a(U,"class","name svelte-1pecl4m"),a(fe,"id",i[1]+"removeImportlib"),a(fe,"type","checkbox"),a(fe,"class","svelte-1pecl4m"),a(he,"for",i[1]+"removeImportlib"),a(de,"class","option svelte-1pecl4m"),a(K,"id",i[1]+"removeTracebackHide"),a(K,"type","checkbox"),a(K,"class","svelte-1pecl4m"),a(ke,"for",i[1]+"removeTracebackHide"),a(Te,"class","option svelte-1pecl4m"),a(X,"id",i[1]+"removePyinstrument"),a(X,"type","checkbox"),a(X,"class","svelte-1pecl4m"),a(tt,"for",i[1]+"removePyinstrument"),a(V,"class","option svelte-1pecl4m"),a(Ce,"id",i[1]+"removeIrrelevant"),a(Ce,"type","checkbox"),a(Ce,"class","svelte-1pecl4m"),a(it,"for",i[1]+"removeIrrelevant"),a(ge,"type","number"),ge.value=i[2](),a(ge,"min","0"),a(ge,"max","99"),a(ge,"step","0.01"),Q(ge,"width","4em"),a(ge,"class","svelte-1pecl4m"),a(Se,"class","option svelte-1pecl4m"),a(te,"class","body"),a(re,"class","option-group svelte-1pecl4m"),a(nt,"class","name svelte-1pecl4m"),a(ie,"type","radio"),ie.__value="absolute",le(ie,ie.__value),a(ie,"class","svelte-1pecl4m"),a(st,"class","option svelte-1pecl4m"),a(ne,"type","radio"),ne.__value="proportion",le(ne,ne.__value),a(ne,"class","svelte-1pecl4m"),a(rt,"class","option svelte-1pecl4m"),a(De,"class","body"),a(Oe,"class","option-group svelte-1pecl4m"),a(e,"class","view-options-call-stack svelte-1pecl4m"),pt.p(ie,ne),vt.p(r,w,Y)},m(G,se){I(G,e,se),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(l,r),r.checked=r.__value===i[0].collapseMode,u(l,c),u(l,d),u(d,p),u(l,v),u(l,m),u(o,f),u(o,g),u(g,w),w.checked=w.__value===i[0].collapseMode,u(g,b),u(g,y),u(y,A),u(g,C),u(g,M),u(M,D),u(M,E),u(E,F),u(E,O),u(E,_),le(_,i[0].collapseCustomShow),u(E,P),u(E,N),u(E,j),u(E,z),le(z,i[0].collapseCustomHide),u(M,Fe),u(o,ee),u(o,J),u(J,Y),Y.checked=Y.__value===i[0].collapseMode,u(J,Ee),u(J,W),u(W,We),u(e,Ue),u(e,re),u(re,U),u(re,je),u(re,te),u(te,de),u(de,fe),fe.checked=i[0].removeImportlib,u(de,ve),u(de,he),u(he,ye),u(te,Ye),u(te,Te),u(Te,K),K.checked=i[0].removeTracebackHide,u(Te,Re),u(Te,ke),u(ke,Xe),u(te,q),u(te,V),u(V,X),X.checked=i[0].removePyinstrument,u(V,It),u(V,tt),u(tt,Ot),u(te,Dt),u(te,Se),u(Se,Ce),Ce.checked=i[0].removeIrrelevant,u(Se,Ht),u(Se,Ie),u(Ie,it),u(it,Vt),u(Ie,Nt),u(Ie,ge),u(Ie,Bt),u(e,zt),u(e,Oe),u(Oe,nt),u(Oe,xt),u(Oe,De),u(De,st),u(st,ot),u(ot,ie),ie.checked=ie.__value===i[0].timeFormat,u(ot,$t),u(De,qt),u(De,rt),u(rt,lt),u(lt,ne),ne.checked=ne.__value===i[0].timeFormat,u(lt,Wt),gt||(Ut=[B(r,"change",i[4]),B(w,"change",i[6]),B(_,"input",i[7]),B(z,"input",i[8]),B(Y,"change",i[9]),B(fe,"change",i[10]),B(K,"change",i[11]),B(X,"change",i[12]),B(Ce,"change",i[13]),B(ge,"input",i[3]),B(ie,"change",i[14]),B(ne,"change",i[15])],gt=!0)},p(G,[se]){se&1&&(r.checked=r.__value===G[0].collapseMode),se&1&&(w.checked=w.__value===G[0].collapseMode),se&1&&_.value!==G[0].collapseCustomShow&&le(_,G[0].collapseCustomShow),se&1&&z.value!==G[0].collapseCustomHide&&le(z,G[0].collapseCustomHide),se&1&&(Y.checked=Y.__value===G[0].collapseMode),se&1&&(fe.checked=G[0].removeImportlib),se&1&&(K.checked=G[0].removeTracebackHide),se&1&&(X.checked=G[0].removePyinstrument),se&1&&(Ce.checked=G[0].removeIrrelevant),se&1&&(ie.checked=ie.__value===G[0].timeFormat),se&1&&(ne.checked=ne.__value===G[0].timeFormat)},i:R,o:R,d(G){G&&S(e),pt.r(),vt.r(),gt=!1,ae(Ut)}}}function mn(i,e,t){let n;_e(i,Z,C=>t(0,n=C));const s=ht();function o(){return(n.removeIrrelevantThreshold*100).toLocaleString(void 0,{maximumFractionDigits:4})}function l(C){Di(Z,n.removeIrrelevantThreshold=C.currentTarget.valueAsNumber/100,n)}const r=[[],[]];function c(){n.collapseMode=this.__value,Z.set(n)}function d(){n.collapseMode=this.__value,Z.set(n)}function p(){n.collapseCustomShow=this.value,Z.set(n)}function v(){n.collapseCustomHide=this.value,Z.set(n)}function m(){n.collapseMode=this.__value,Z.set(n)}function f(){n.removeImportlib=this.checked,Z.set(n)}function g(){n.removeTracebackHide=this.checked,Z.set(n)}function w(){n.removePyinstrument=this.checked,Z.set(n)}function b(){n.removeIrrelevant=this.checked,Z.set(n)}function y(){n.timeFormat=this.__value,Z.set(n)}function A(){n.timeFormat=this.__value,Z.set(n)}return[n,s,o,l,c,r,d,p,v,m,f,g,w,b,y,A]}class pn extends ue{constructor(e){super(),ce(this,e,mn,hn,oe,{})}}function vn(i){let e,t,n,s,o,l,r,c,d,p,v,m,f,g,w,b,y,A,C,M,D,E,F,O;return{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Remove frames",s=T(),o=h("div"),l=h("div"),r=h("input"),c=T(),d=h("label"),p=L("importlib machinery"),v=T(),m=h("div"),f=h("input"),g=T(),w=h("label"),b=L("Frames declaring __traceback_hide__"),y=T(),A=h("div"),C=h("input"),M=T(),D=h("label"),E=L("pyinstrument frames"),a(n,"class","name"),a(r,"id",i[1]+"removeImportlib"),a(r,"type","checkbox"),a(d,"for",i[1]+"removeImportlib"),a(l,"class","option"),a(f,"id",i[1]+"removeTracebackHide"),a(f,"type","checkbox"),a(w,"for",i[1]+"removeTracebackHide"),a(m,"class","option"),a(C,"id",i[1]+"removePyinstrument"),a(C,"type","checkbox"),a(D,"for",i[1]+"removePyinstrument"),a(A,"class","option"),a(o,"class","body"),a(t,"class","option-group"),a(e,"class","view-options-timeline svelte-vsz8zm")},m(_,P){I(_,e,P),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(l,r),r.checked=i[0].removeImportlib,u(l,c),u(l,d),u(d,p),u(o,v),u(o,m),u(m,f),f.checked=i[0].removeTracebackHide,u(m,g),u(m,w),u(w,b),u(o,y),u(o,A),u(A,C),C.checked=i[0].removePyinstrument,u(A,M),u(A,D),u(D,E),F||(O=[B(r,"change",i[2]),B(f,"change",i[3]),B(C,"change",i[4])],F=!0)},p(_,[P]){P&1&&(r.checked=_[0].removeImportlib),P&1&&(f.checked=_[0].removeTracebackHide),P&1&&(C.checked=_[0].removePyinstrument)},i:R,o:R,d(_){_&&S(e),F=!1,ae(O)}}}function gn(i,e,t){let n;_e(i,Ge,c=>t(0,n=c));const s=ht();function o(){n.removeImportlib=this.checked,Ge.set(n)}function l(){n.removeTracebackHide=this.checked,Ge.set(n)}function r(){n.removePyinstrument=this.checked,Ge.set(n)}return[n,s,o,l,r]}class _n extends ue{constructor(e){super(),ce(this,e,gn,vn,oe,{})}}function wn(i){let e,t;return e=new _n({}),{c(){be(e.$$.fragment)},m(n,s){me(e,n,s),t=!0},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){pe(e,n)}}}function bn(i){let e,t;return e=new pn({}),{c(){be(e.$$.fragment)},m(n,s){me(e,n,s),t=!0},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){pe(e,n)}}}function yn(i){let e,t,n,s,o,l,r,c,d;const p=[bn,wn],v=[];function m(f,g){return f[0].viewMode==="call-stack"?0:f[0].viewMode==="timeline"?1:-1}return~(r=m(i))&&(c=v[r]=p[r](i)),{c(){e=h("div"),t=h("div"),n=h("div"),s=L(i[3]),o=T(),l=h("div"),c&&c.c(),a(n,"class","title-row svelte-rpk7lo"),a(l,"class","body svelte-rpk7lo"),a(t,"class","box svelte-rpk7lo"),a(e,"class","view-options svelte-rpk7lo")},m(f,g){I(f,e,g),u(e,t),u(t,n),u(n,s),u(t,o),u(t,l),~r&&v[r].m(l,null),i[4](t),i[5](e),d=!0},p(f,[g]){(!d||g&8)&&we(s,f[3]);let w=r;r=m(f),r!==w&&(c&&($e(),$(v[w],1,1,()=>{v[w]=null}),qe()),~r?(c=v[r],c||(c=v[r]=p[r](f),c.c()),H(c,1),c.m(l,null)):c=null)},i(f){d||(H(c),d=!0)},o(f){$(c),d=!1},d(f){f&&S(e),~r&&v[r].d(),i[4](null),i[5](null)}}}function Tn(i,e,t){let n;_e(i,Ze,m=>t(0,n=m));const s=qi();function o(){s("close")}let l,r;Tt(()=>{if(r)return un(r,o,{ignore:[".js-view-options-button"]})});function c(){if(!l||!r)return;const m=l.getBoundingClientRect(),g=r.getBoundingClientRect().width;m.right-g-20<0?t(2,r.style.right=`${m.right-g-20}px`,r):t(2,r.style.right="0",r)}Tt(()=>(c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)));let d="View options";function p(m){Ae[m?"unshift":"push"](()=>{r=m,t(2,r)})}function v(m){Ae[m?"unshift":"push"](()=>{l=m,t(1,l)})}return i.$$.update=()=>{i.$$.dirty&1&&(n.viewMode==="call-stack"?t(3,d="Call stack view options"):n.viewMode==="timeline"&&t(3,d="Timeline view options"))},[n,l,r,d,p,v]}class An extends ue{constructor(e){super(),ce(this,e,Tn,yn,oe,{})}}function Zt(i){let e,t;return e=new An({}),e.$on("close",i[9]),{c(){be(e.$$.fragment)},m(n,s){me(e,n,s),t=!0},p:R,i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){pe(e,n)}}}function En(i){let e,t,n,s,o,l,r,c,d=Et(i[0].target_description)+"",p,v,m,f,g,w,b,y,A,C,M,D,E,F=i[0].sampleCount+"",O,_,P,N,j,z,Fe,ee,J,Y,Ee,W,We,Ue,re,U,je,te,de,fe,ve,he,ye,Ye,Te,K,Re,ke,Xe;o=new tn({}),ye=new Ji({});let q=i[1]&&Zt(i);return Re=yt(i[7][0]),{c(){e=h("div"),t=h("div"),n=h("div"),s=h("div"),be(o.$$.fragment),l=T(),r=h("div"),c=h("div"),p=T(),v=h("div"),m=h("div"),f=h("span"),f.textContent="Recorded:",g=T(),w=h("span"),w.textContent=`${i[3]}`,b=T(),y=h("br"),A=T(),C=h("div"),M=h("span"),M.textContent="Samples:",D=T(),E=h("span"),O=L(F),_=T(),P=h("div"),N=h("span"),N.textContent="CPU utilization:",j=T(),z=h("span"),z.textContent=`${(i[4]*100).toFixed(0)}%`,Fe=T(),ee=h("div"),J=h("div"),Y=L(`View: - `),Ee=h("label"),W=h("input"),We=L(` - Call stack`),Ue=T(),re=h("label"),U=h("input"),je=L(` - Timeline`),te=T(),de=h("div"),fe=T(),ve=h("div"),he=h("button"),be(ye.$$.fragment),Ye=L(` - View options`),Te=T(),q&&q.c(),a(s,"class","logo svelte-qdxst2"),a(c,"class","target-description svelte-qdxst2"),a(f,"class","metric-label svelte-qdxst2"),a(w,"class","metric-value svelte-qdxst2"),a(m,"class","metric date svelte-qdxst2"),a(y,"class","svelte-qdxst2"),a(M,"class","metric-label svelte-qdxst2"),a(E,"class","metric-value svelte-qdxst2"),a(C,"class","metric svelte-qdxst2"),a(N,"class","metric-label svelte-qdxst2"),a(z,"class","metric-value svelte-qdxst2"),a(P,"class","metric svelte-qdxst2"),a(v,"class","metrics svelte-qdxst2"),a(W,"type","radio"),W.__value="call-stack",le(W,W.__value),a(W,"class","svelte-qdxst2"),a(Ee,"class","svelte-qdxst2"),a(U,"type","radio"),U.__value="timeline",le(U,U.__value),a(U,"class","svelte-qdxst2"),a(re,"class","svelte-qdxst2"),a(J,"class","toggle"),a(de,"class","spacer"),Q(de,"flex","1"),a(he,"class","js-view-options-button svelte-qdxst2"),a(ve,"class","button-container svelte-qdxst2"),a(ee,"class","view-options svelte-qdxst2"),a(r,"class","layout svelte-qdxst2"),a(n,"class","row svelte-qdxst2"),a(t,"class","margins"),a(e,"class","header svelte-qdxst2"),Re.p(W,U)},m(V,X){I(V,e,X),u(e,t),u(t,n),u(n,s),me(o,s,null),u(n,l),u(n,r),u(r,c),c.innerHTML=d,u(r,p),u(r,v),u(v,m),u(m,f),u(m,g),u(m,w),u(v,b),u(v,y),u(v,A),u(v,C),u(C,M),u(C,D),u(C,E),u(E,O),u(v,_),u(v,P),u(P,N),u(P,j),u(P,z),u(r,Fe),u(r,ee),u(ee,J),u(J,Y),u(J,Ee),u(Ee,W),W.checked=W.__value===i[2].viewMode,u(Ee,We),u(J,Ue),u(J,re),u(re,U),U.checked=U.__value===i[2].viewMode,u(re,je),u(ee,te),u(ee,de),u(ee,fe),u(ee,ve),u(ve,he),me(ye,he,null),u(he,Ye),u(ve,Te),q&&q.m(ve,null),K=!0,ke||(Xe=[B(W,"change",i[6]),B(U,"change",i[8]),B(he,"click",Mt(Ct(i[5])))],ke=!0)},p(V,[X]){(!K||X&1)&&d!==(d=Et(V[0].target_description)+"")&&(c.innerHTML=d),(!K||X&1)&&F!==(F=V[0].sampleCount+"")&&we(O,F),X&4&&(W.checked=W.__value===V[2].viewMode),X&4&&(U.checked=U.__value===V[2].viewMode),V[1]?q?(q.p(V,X),X&2&&H(q,1)):(q=Zt(V),q.c(),H(q,1),q.m(ve,null)):q&&($e(),$(q,1,1,()=>{q=null}),qe())},i(V){K||(H(o.$$.fragment,V),H(ye.$$.fragment,V),H(q),K=!0)},o(V){$(o.$$.fragment,V),$(ye.$$.fragment,V),$(q),K=!1},d(V){V&&S(e),pe(o),pe(ye),q&&q.d(),Re.r(),ke=!1,ae(Xe)}}}function kn(i,e,t){let n;_e(i,Ze,f=>t(2,n=f));let{session:s}=e;const o=new Date(s.startTime*1e3).toLocaleString(void 0,{dateStyle:"long",timeStyle:"medium"}),l=s.cpuTime/s.duration;let r=!1;function c(f){t(1,r=!r)}const d=[[]];function p(){n.viewMode=this.__value,Ze.set(n)}function v(){n.viewMode=this.__value,Ze.set(n)}const m=()=>t(1,r=!1);return i.$$set=f=>{"session"in f&&t(0,s=f.session)},[s,r,n,o,l,c,p,d,v,m]}class Cn extends ue{constructor(e){super(),ce(this,e,kn,En,oe,{session:0})}}const Mn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAWmSURBVHgBtVc7i11VFF5rn3PvPKoLFlqmDGPhaGVpJQoWAZEEGxERFBsDgnY6KFpaWWrQysRGf4BgmSKQFCKWKQMKTqNzz2svv/XY55ybeycTCw+z736cs/f61rdee5hmz/Hx85c66m4QyTEzrdAo4cd6EuuJ2P4wtbmUgfZkCyRoWVcwyMI29ybW47sfhRfXf793+z4X4ZchPEl3F2esElYrbRVaEjQGEKGE3jcUofGwlIEBygoACAa0fmDrdV4AOAg6FV4+W49nUPdlEW4AElGNtqjZ+hqIdI2NAC7KuvAZloyJCR+IukGmF5A6iH/IbEBWLN2NevbBFQ6tCoAF3u7VggYQtQJyFlygOAADI74Jf669QDiWWh6xFRMUgLF6PAGYkcgGgGkBE/x8AiSVaykG0AUxlgm7BY0BUMAQL8R77LM96F98A98kBeu+kAdlgA0MntUGACmOFDQl5sm+Rai6lwpMLtiEgSVGE8wVFBkAB7XcU+rdJOoLSU0x8Aii3ta/0AWqMHjlM6LDPaYDHLSsnRn9pjMny2jBCDSu9H3tDqpCmw4C6lgHqAQmWB05uwwF8RCAQpU7jIbQYCElBsjAlabfqJdnD7lKwzVcIVVOgmKpF2g921pS8/QRvuETmwDEKZdwFHMocYHffYSfBc0opojVIomjx/dY64CkxVktMsgar16/IhbKygANruwWA+YDkURUcNHQaK5ps1XhBwaAzf6M9YzWq3Ac1EKACm80cB8KV6IdPsCR0aQAMBAaUkxXPyU6WDqlypKaSEOtmCCpDyAKFgu1gSecrhdar4n++VsiGUVWDHUpdJkYEPEkEyDc7paHTShXbkuNhqQfaF5wMt16lff69JYFFYT3A8AYgFxku5xtBtw9R7YsEiH85hcYLIsfuO0lfCCHvTtMWxszNRhDebp+LRsTGobFr0zBiO5tBnhWaZgiDwD5gi3Wiw+YcDAwoDfB+MaFq83RsP8M5zSYdFjsBwfh9YAjErbyQLHNVNUsH2Dl2odCh4dE+0vQXjtI9YG2z05zOKvSbdR3eKdtLTbugVKzoOQxC+7KA5NtJPiXEZaH5xDglMrOBMHTWxdWhA/QVqtgEdx3EtVwSkDOxE4GHESpCZzcHLe+4gg3HA7P69jpfvutTA0GTQNNkXAs5UYJVjC593keik/JBohzALjQsXbrJtRksRgntzm7nVX4GnZumtC4D23N4aIAZWdv9LyZv+3IA87AlHY1HQu9+q7Qwb7nAQ01FbQ+g5NBaNOKA2jdD0bg4+UjzCrbqu6IgrLB6aLRF6KWB0ZNUj15QvLCRVa8PNanqiq7pM7kbVXDEvdaipMmHIRfBa2//aYC9WI5vjH6ydLsB1ezpePiK9PhYcoLnjSK5kljNUWqvXppKdVxo4XFhIsJ93gXy/8clxIvt0X7i4XrU8+1D+wGgKPGW/UCzHfew9VsXywVZxbz8GYdKqS4rCTfZ/NZvD8WA/Yxu/aW661F7q+cIbsXVO6EcVf3b0t9SIXFx9N+kwEO3w8QVmhggq+/9xSroVdiv5TZlr0SanL6/KXOK5SaL9b/G4DRdDzONZbPuAjXS4bnfPWBPrJkjhzpYbdR8OeXz62nvBt3HD3z3F/2f0Fyx9O7XL2HAoj7YG33AK8Bag4TrJlOa0DrrVtrj7DsPBtKlgstsZGIcOW+B0wvlMP1EOqcCh1rTldb+/Xcw2woqbaLeh/Vbl7vH/Vgx08TABrehO53ccJKK1ZWP+gjpRqAKdaN8jxLs5r7Bx5TMBm18kjxOOZ0ub/3flUW/nzw4PSJp568CT0vYXq5aGJgslc4o7doPI6dcis2eUq950Ug1DqF9NvQ/uVf79y5v+E1IptedEInNj+iT2L9Nfv9jf7gI/pFdP4D5rfoaYw/Lv+pReVRq/JOEEXOee/PAf7/PP8C3bt510T4rIwAAAAASUVORK5CYII=",Qt=ft({}),Jt=ft({});function gi(i){return i>.6?"#FF4159":i>.3?"#F5A623":i>.2?"#D8CB2A":"#7ED321"}function ei(i,e,t){const n=i.slice();return n[21]=e[t],n}function ti(i){let e,t,n,s,o,l,r,c,d,p,v,m,f,g,w,b;return{c(){e=h("div"),t=h("div"),n=x("svg"),s=x("path"),o=T(),l=h("div"),r=L(i[5]),c=T(),d=h("div"),p=L(i[4]),v=T(),m=h("div"),m.textContent=`${i[11]}`,f=T(),g=h("div"),a(s,"d","M.937-.016L5.793 4.84.937 9.696z"),a(s,"fill",i[7]),a(s,"fill-rule","evenodd"),a(s,"fill-opacity",".582"),a(n,"width","6"),a(n,"height","10"),a(t,"class","frame-triangle svelte-7e9kco"),Me(t,"rotate",!i[8]),Q(t,"visibility",i[0].children.length>0?"visible":"hidden"),a(l,"class","time svelte-7e9kco"),Q(l,"color",i[7]),Q(l,"font-weight",i[10]<.2?500:600),a(d,"class","name svelte-7e9kco"),a(m,"class","code-position svelte-7e9kco"),a(e,"class","frame-description svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),Me(e,"application-code",i[0].isApplicationCode),Me(e,"children-visible",!i[8]),Q(e,"padding-left",`${i[2]*35}px`),a(g,"class","visual-guide svelte-7e9kco"),Q(g,"left",`${i[2]*35+21}px`),Q(g,"background-color",i[7])},m(y,A){I(y,e,A),u(e,t),u(t,n),u(n,s),u(e,o),u(e,l),u(l,r),u(e,c),u(e,d),u(d,p),u(e,v),u(e,m),I(y,f,A),I(y,g,A),w||(b=[B(e,"keydown",i[14]),B(e,"click",Mt(Ct(i[12])))],w=!0)},p(y,A){A&128&&a(s,"fill",y[7]),A&256&&Me(t,"rotate",!y[8]),A&1&&Q(t,"visibility",y[0].children.length>0?"visible":"hidden"),A&32&&we(r,y[5]),A&128&&Q(l,"color",y[7]),A&16&&we(p,y[4]),A&1&&Me(e,"application-code",y[0].isApplicationCode),A&256&&Me(e,"children-visible",!y[8]),A&4&&Q(e,"padding-left",`${y[2]*35}px`),A&4&&Q(g,"left",`${y[2]*35+21}px`),A&128&&Q(g,"background-color",y[7])},d(y){y&&(S(e),S(f),S(g)),w=!1,ae(b)}}}function ii(i){let e,t,n,s,o=i[0].group.frames.length+"",l,r,c,d,p,v;return{c(){e=h("div"),t=h("div"),n=h("div"),n.innerHTML='',s=T(),l=L(o),r=L(" frames hidden ("),c=L(i[6]),d=L(")"),a(n,"class","group-triangle svelte-7e9kco"),Me(n,"rotate",i[9]),a(t,"class","group-header-button svelte-7e9kco"),a(e,"class","group-header svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),Q(e,"padding-left",`${i[2]*35}px`)},m(m,f){I(m,e,f),u(e,t),u(t,n),u(t,s),u(t,l),u(t,r),u(t,c),u(t,d),p||(v=[B(e,"keydown",i[15]),B(e,"click",Mt(Ct(i[13])))],p=!0)},p(m,f){f&512&&Me(n,"rotate",m[9]),f&1&&o!==(o=m[0].group.frames.length+"")&&we(l,o),f&64&&we(c,m[6]),f&4&&Q(e,"padding-left",`${m[2]*35}px`)},d(m){m&&S(e),p=!1,ae(v)}}}function ni(i){let e,t=[],n=new Map,s,o=dt(i[0].children);const l=r=>r[21].uuid;for(let r=0;r0&&ni(i);return{c(){e=h("div"),o&&o.c(),t=T(),l&&l.c(),n=T(),r&&r.c(),a(e,"class","frame svelte-7e9kco")},m(c,d){I(c,e,d),o&&o.m(e,null),u(e,t),l&&l.m(e,null),u(e,n),r&&r.m(e,null),s=!0},p(c,[d]){c[3]?o?o.p(c,d):(o=ti(c),o.c(),o.m(e,t)):o&&(o.d(1),o=null),c[0].group&&c[0].group.rootFrame==c[0]&&!c[8]?l?l.p(c,d):(l=ii(c),l.c(),l.m(e,n)):l&&(l.d(1),l=null),!c[8]&&c[0].children.length>0?r?(r.p(c,d),d&257&&H(r,1)):(r=ni(c),r.c(),H(r,1),r.m(e,null)):r&&($e(),$(r,1,1,()=>{r=null}),qe())},i(c){s||(H(r),s=!0)},o(c){$(r),s=!1},d(c){c&&S(e),o&&o.d(),l&&l.d(),r&&r.d()}}}function _i(){const i='a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])',e=document.querySelector(".call-stack-view");if(!e)throw new Error("callStackElement not found");var t=Array.prototype.filter.call(e.querySelectorAll(i),function(n){return n.offsetWidth>0||n.offsetHeight>0||n===document.activeElement});return t}function oi(){const i=_i();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e+1];t&&t.focus()}}function ri(){const i=_i();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e-1];t&&t.focus()}}function Pn(i,e,t){var O;let n,s,o,l,r;_e(i,Jt,_=>t(16,o=_)),_e(i,Qt,_=>t(17,l=_)),_e(i,Z,_=>t(18,r=_));let{frame:c}=e,{rootFrame:d}=e,{indent:p=0}=e,v;const m=c.time/d.time;let f;const g=`${c.filePathShort}:${(O=c.lineNo)==null?void 0:O.toString().padEnd(4," ")}`;let w,b=null;if(c.group){const _=c.group.libraries;_.length<4?b=_.join(", "):b=`${_[0]}, ${_[1]}, ${_[2]}...`}let y;y=gi(m);function A(_){C(c,!s,_.altKey)}function C(_,P,N=!0){if(Jt.update(j=>({...j,[_.uuid]:P})),N)for(const j of _.children)C(j,P,!0),_.group&&_.group.rootFrame==_&&M(_.group.id,!P)}function M(_,P){Qt.update(N=>({...N,[_]:P}))}function D(){c.group&&M(c.group.id,!n)}function E(_){let P=!0;_.key==="Enter"||_.key===" "?A(_):_.key==="ArrowLeft"&&!s?C(c,!0,_.altKey):_.key==="ArrowRight"&&s?C(c,!1,_.altKey):_.key==="ArrowUp"?ri():_.key==="ArrowDown"?oi():P=!1,P&&(_.preventDefault(),_.stopPropagation())}function F(_){let P=!0;_.key==="Enter"||_.key===" "?D():_.key==="ArrowLeft"&&c.group?M(c.group.id,!1):_.key==="ArrowRight"&&c.group?M(c.group.id,!0):_.key==="ArrowUp"?ri():_.key==="ArrowDown"?oi():P=!1,P&&(_.preventDefault(),_.stopPropagation())}return i.$$set=_=>{"frame"in _&&t(0,c=_.frame),"rootFrame"in _&&t(1,d=_.rootFrame),"indent"in _&&t(2,p=_.indent)},i.$$.update=()=>{var _,P;if(i.$$.dirty&131073&&(c.group?l[c.group.id??""]||((_=c.group)==null?void 0:_.rootFrame)===c||c.children.filter(N=>!N.group).length>1?t(3,v=!0):t(3,v=!1):t(3,v=!0)),i.$$.dirty&1&&(c.className?t(4,f=`${c.className}.${c.function}`):t(4,f=c.function)),i.$$.dirty&262145)if(r.timeFormat==="absolute")t(5,w=c.time.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:3}));else if(r.timeFormat==="proportion")t(5,w=`${(m*100).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}%`);else throw new Error("unknown timeFormat");i.$$.dirty&131073&&t(9,n=l[((P=c.group)==null?void 0:P.id)??""]===!0),i.$$.dirty&65537&&t(8,s=o[c.uuid]===!0)},[c,d,p,v,f,w,b,y,s,n,m,g,A,D,E,F,o,l,r]}let wi=class extends ue{constructor(e){super(),ce(this,e,Pn,Fn,oe,{frame:0,rootFrame:1,indent:2})}};function bi(i,e,t){let n=i;for(const s of e)if(n=s(n,t),!n)return null;return n}const Ln="\0",Rn="[await]",et="[self]",Sn="[out-of-context]",In="[root]",On=[Rn,et,Sn,In],Dn="c",Hn="h";class Je{constructor(e,t){k(this,"uuid",ht());k(this,"identifier");k(this,"_identifierParts");k(this,"startTime");k(this,"time",0);k(this,"absorbedTime",0);k(this,"group",null);k(this,"attributes");k(this,"_children",[]);k(this,"parent",null);k(this,"context");var o;this.identifier=e.identifier,this._identifierParts=this.identifier.split(Ln),this.startTime=e.startTime??0,this.time=e.time??0,this.attributes=e.attributes??{},this.context=t;let n=this.startTime;const s=(o=e.children)==null?void 0:o.map(l=>(l.startTime===void 0&&(l={...l,startTime:n},n+=l.time??0),n=l.startTime+(l.time??0),new Je(l,t)));s&&this.addChildren(s)}cloneDeep(){return new Je(this,this.context)}get children(){return this._children}addChild(e,t={}){if(e.removeFromParent(),e.parent=this,t.after){const n=this._children.indexOf(t.after);if(n==-1)throw new Error("After frame not found");this._children.splice(n+1,0,e)}else this._children.push(e)}addChildren(e,t={}){e=e.slice(),t.after?(e.slice().reverse(),e.forEach(s=>this.addChild(s,t))):e.forEach(n=>this.addChild(n,t))}removeFromParent(){if(this.parent){const e=this.parent._children.indexOf(this);this.parent._children.splice(e,1),this.parent=null}}getAttributes(e){return Object.keys(this.attributes).filter(n=>n.startsWith(e)).map(n=>({data:n.slice(1),time:this.attributes[n]}))}getAttributeValue(e){const t=this.getAttributes(e);if(!t||t.length==0)return null;let n=0;for(let s=0;st[n].time&&(n=s);return t[n].data}get hasTracebackHide(){return this.getAttributeValue(Hn)=="1"}get function(){return this._identifierParts[0]}get filePath(){return this._identifierParts[1]??null}get lineNo(){const e=this._identifierParts[2];return e?parseInt(e):null}get isSynthetic(){return On.includes(this.identifier)}get filePathShort(){return this.isSynthetic&&this.parent?this.parent.filePathShort:this.filePath?this.context.shortenPath(this.filePath):null}get isApplicationCode(){if(this.isSynthetic)return!1;const e=this.filePath;return!e||this.context.sysPrefixes.some(n=>e.startsWith(n))?!1:e.startsWith("<")?e.startsWith(""||e==""?this.parent?this.parent.isApplicationCode:!0:!1:!0}get proportionOfParent(){return this.parent?this.time/this.parent.time:1}get className(){return this.getAttributeValue(Dn)??""}get library(){const e=this.filePathShort;return e?/^[\\/.]*[^\\/.]*/.exec(e)[0]??"":null}}class Vn{constructor(e){k(this,"id");k(this,"rootFrame");k(this,"_frames",[]);this.id=ht(),this.rootFrame=e}addFrame(e){e.group&&e.group.removeFrame(e),this._frames.push(e),e.group=this}removeFrame(e){if(e.group!==this)throw new Error("Frame not in group.");const t=this._frames.indexOf(e);if(t===-1)throw new Error("Frame not found in group.");this._frames.splice(t,1),e.group=null}get frames(){return this._frames}get exitFrames(){const e=[];for(const t of this.frames){let n=!1;for(const s of t.children)if(s.group!=this){n=!0;break}n&&e.push(t)}return e}get libraries(){const e=[];for(const t of this.frames){const n=t.library;n&&(e.includes(n)||e.push(n))}return e}}function mt(i,e){const{replaceWith:t}=e,n=i.parent;if(!n)throw new Error("Cannot delete the root frame");if(t=="children")n.addChildren(i.children,{after:i});else if(t=="self_time")n.addChild(new Je({identifier:et,time:i.time},n.context),{after:i});else if(t=="nothing")n.absorbedTime+=i.time;else throw new on(t);i.removeFromParent(),Lt(i,!0)}function Nn(i,e){if(i.parent!==e.parent)throw new Error("Both frames must have the same parent.");e.absorbedTime+=i.absorbedTime,e.time+=i.time,Object.entries(i.attributes).forEach(([t,n])=>{e.attributes[t]!==void 0?e.attributes[t]+=n:e.attributes[t]=n}),e.addChildren(i.children),i.removeFromParent(),Lt(i,!1)}function Lt(i,e){if(e&&i.children&&i.children.forEach(t=>{Lt(t,!0)}),i.group){const t=i.group;t.removeFrame(i),t.frames.length===1&&t.removeFrame(t.frames[0])}}function Rt(i,e){if(!i)return null;for(const t of i.children)Rt(t),t.filePath&&t.filePath.includes("yi(n)),i._children.sort((n,s)=>s.time-n.time),i}function Ti(i,e){if(!i)return null;const t=e.hideRegex,n=e.showRegex;function s(l){const r=l.filePath||"",c=n&&new RegExp(n).test(r),d=t&&new RegExp(t).test(r);return c?!1:d?!0:!l.isApplicationCode}function o(l,r){r.addFrame(l),l.children.forEach(c=>{s(c)&&o(c,r)})}return i.children.forEach(l=>{if(!l.group&&s(l)&&l.children.some(s)){const r=new Vn(l);o(l,r)}Ti(l,e)}),i}function Ai(i,e,t=!0){if(!i)return null;let n=null;for(const s of i.children)s.identifier===et?n?(n.time+=s.time,s.removeFromParent()):n=s:n=null;return t&&i.children.forEach(s=>Ai(s,e,!0)),i}function Ei(i,e){return i?(i.children.length===1&&i.children[0].identifier===et&&mt(i.children[0],{replaceWith:"nothing"}),i.children.forEach(t=>Ei(t)),i):null}function ki(i,e,t=null){if(!i)return null;t===null&&(t=i.time,t<=0&&(t=1e-44));const n=e.filterThreshold??.01;for(const s of i.children.slice())s.time/tki(s,e,t)),i}function Ci(i,e){if(!i)return null;const t=r=>fn(r,c=>c.time),n=r=>{var c;return((c=r.filePath)==null?void 0:c.includes("pyinstrument/__main__.py"))&&r.children.length>0},s=r=>{var c;return r.proportionOfParent>.8&&((c=r.filePath)==null?void 0:c.includes(""))&&r.children.length>0},o=r=>{var c;return r.proportionOfParent>.8&&(new RegExp(".*runpy.py").test(r.filePath??"")||((c=r.filePath)==null?void 0:c.includes("")))&&r.children.length>0};let l=i;if(!n(l)||(l=t(l.children),!s(l))||(l=t(l.children),!o(l)))return i;for(;o(l);)l=t(l.children);return l.removeFromParent(),l}function Mi(i,e){return i?(i.children.forEach(t=>Mi(t)),i.group&&i.group.frames.length<3&&i.group.removeFrame(i),i):null}function Bn(i){let e,t,n;return t=new wi({props:{frame:i[3],rootFrame:i[3]}}),{c(){e=h("div"),be(t.$$.fragment),a(e,"class","call-stack-margins svelte-1hebm9u")},m(s,o){I(s,e,o),me(t,e,null),n=!0},p(s,o){const l={};o&8&&(l.frame=s[3]),o&8&&(l.rootFrame=s[3]),t.$set(l)},i(s){n||(H(t.$$.fragment,s),n=!0)},o(s){$(t.$$.fragment,s),n=!1},d(s){s&&S(e),pe(t)}}}function zn(i){let e;return{c(){e=h("div"),e.innerHTML='
All frames were filtered out.
',a(e,"class","margins")},m(t,n){I(t,e,n)},p:R,i:R,o:R,d(t){t&&S(e)}}}function xn(i){let e,t,n,s,o,l,r;const c=[zn,Bn],d=[];function p(v,m){return v[3]?1:0}return n=p(i),s=d[n]=c[n](i),{c(){e=h("div"),t=h("div"),s.c(),o=T(),l=h("div"),a(t,"class","scroll-inner svelte-1hebm9u"),a(l,"class","scroll-size-fixer svelte-1hebm9u"),a(e,"class","call-stack-view svelte-1hebm9u")},m(v,m){I(v,e,m),u(e,t),d[n].m(t,null),i[7](t),u(e,o),u(e,l),i[8](l),i[9](e),r=!0},p(v,[m]){let f=n;n=p(v),n===f?d[n].p(v,m):($e(),$(d[f],1,1,()=>{d[f]=null}),qe(),s=d[n],s?s.p(v,m):(s=d[n]=c[n](v),s.c()),H(s,1),s.m(t,null))},i(v){r||(H(s),r=!0)},o(v){$(s),r=!1},d(v){v&&S(e),d[n].d(),i[7](null),i[8](null),i[9](null)}}}function $n(i,e,t){let n,{session:s}=e;const o=vi([Z],([f])=>{const g=[f.removeImportlib?Rt:null,f.removeTracebackHide?St:null,Ai,yi,Ei,f.removeIrrelevant?ki:null,f.removePyinstrument?Ci:null,f.collapseMode!=="disabled"?Ti:null,Mi].filter(b=>b!==null),w={filterThreshold:f.removeIrrelevantThreshold,hideRegex:f.collapseMode=="custom"?f.collapseCustomHide:void 0,showRegex:f.collapseMode=="custom"?f.collapseCustomShow:void 0};return{processors:g,options:w}});_e(i,o,f=>t(6,n=f));let l,r,c;Tt(()=>{let f=0;const g=l;if(!g)throw new Error("element not set");if(!r)throw new Error("scrollInnerElement not set");if(!c)throw new Error("scrollSizeFixerElement not set");const w=new ResizeObserver(()=>{const y=r.getBoundingClientRect().height;y>f&&(f=y,t(2,c.style.top=`${f-1}px`,c))});w.observe(r);let b;return g.addEventListener("scroll",b=()=>{let y=g.scrollTop+g.clientHeight;const A=r.getBoundingClientRect().height;y{w.disconnect(),g.removeEventListener("scroll",b)}});let d;function p(f){Ae[f?"unshift":"push"](()=>{r=f,t(1,r)})}function v(f){Ae[f?"unshift":"push"](()=>{c=f,t(2,c)})}function m(f){Ae[f?"unshift":"push"](()=>{l=f,t(0,l)})}return i.$$set=f=>{"session"in f&&t(5,s=f.session)},i.$$.update=()=>{i.$$.dirty&96&&t(3,d=bi(s.rootFrame.cloneDeep(),n.processors,n.options))},[l,r,c,d,o,s,n,p,v,m]}class qn extends ue{constructor(e){super(),ce(this,e,$n,xn,oe,{session:5})}}class Wn{constructor(e){k(this,"mediaQueryList",null);this.onDevicePixelRatioChanged=e,this._onChange=this._onChange.bind(this),this.createMediaQueryList()}createMediaQueryList(){this.removeMediaQueryList();let e=`(resolution: ${window.devicePixelRatio}dppx)`;this.mediaQueryList=matchMedia(e),this.mediaQueryList.addEventListener("change",this._onChange)}removeMediaQueryList(){var e;(e=this.mediaQueryList)==null||e.removeEventListener("change",this._onChange),this.mediaQueryList=null}_onChange(e){this.onDevicePixelRatioChanged(),this.createMediaQueryList()}destroy(){this.removeMediaQueryList()}}class Un{constructor(e){k(this,"canvas");k(this,"_size_observer");k(this,"_devicePixelRatioObserver");k(this,"drawAnimationRequest",null);this.container=e,getComputedStyle(e).position!="absolute"&&(e.style.position="relative"),this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.left="0",this.canvas.style.top="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.container.appendChild(this.canvas),this.setCanvasSize=this.setCanvasSize.bind(this),this._size_observer=new ResizeObserver(this.setCanvasSize),this._size_observer.observe(e),this._devicePixelRatioObserver=new Wn(this.setCanvasSize),window.requestAnimationFrame(()=>{this.setCanvasSize()})}destroy(){this._size_observer.disconnect(),this._devicePixelRatioObserver.destroy(),this.canvas.remove(),this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null)}setNeedsRedraw(){this.drawAnimationRequest===null&&(this.drawAnimationRequest=window.requestAnimationFrame(()=>{this.drawAnimationRequest=null,this.canvasViewRedraw()}))}redrawIfNeeded(){this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null,this.canvasViewRedraw())}canvasViewRedraw(){const e=this.canvas.getContext("2d");e&&(e.resetTransform(),e.scale(window.devicePixelRatio,window.devicePixelRatio),this.redraw(e,{width:this.canvas.width/window.devicePixelRatio,height:this.canvas.height/window.devicePixelRatio}))}get width(){return this.canvas.width/window.devicePixelRatio}get height(){return this.canvas.height/window.devicePixelRatio}setCanvasSize(){const e=window.devicePixelRatio;this.canvas.height=this.container.clientHeight*e,this.canvas.width=this.container.clientWidth*e,this.canvasViewRedraw()}}function jn(i){let e,t=i[2]=="self"?"self":"time",n,s,o,l=i[3](i[0].time)+"";return{c(){e=h("div"),n=L(t),s=T(),o=h("div"),a(e,"class","label svelte-ci3g2p"),a(o,"class","time-val svelte-ci3g2p")},m(r,c){I(r,e,c),u(e,n),I(r,s,c),I(r,o,c),o.innerHTML=l},p(r,c){c&4&&t!==(t=r[2]=="self"?"self":"time")&&we(n,t),c&1&&l!==(l=r[3](r[0].time)+"")&&(o.innerHTML=l)},d(r){r&&(S(e),S(s),S(o))}}}function Yn(i){let e,t,n,s,o=i[3](i[0].time)+"",l,r=i[0].selfTime/i[0].time>.001&&li(i);return{c(){e=h("div"),e.textContent="time",t=T(),n=h("div"),s=h("div"),l=T(),r&&r.c(),a(e,"class","label svelte-ci3g2p"),a(s,"class","time-val svelte-ci3g2p"),a(n,"class","time-row svelte-ci3g2p")},m(c,d){I(c,e,d),I(c,t,d),I(c,n,d),u(n,s),s.innerHTML=o,u(n,l),r&&r.m(n,null)},p(c,d){d&1&&o!==(o=c[3](c[0].time)+"")&&(s.innerHTML=o),c[0].selfTime/c[0].time>.001?r?r.p(c,d):(r=li(c),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},d(c){c&&(S(e),S(t),S(n)),r&&r.d()}}}function li(i){let e,t,n,s=i[3](i[0].selfTime)+"";return{c(){e=h("div"),e.textContent="self",t=T(),n=h("div"),a(e,"class","label svelte-ci3g2p"),a(n,"class","time-val svelte-ci3g2p")},m(o,l){I(o,e,l),I(o,t,l),I(o,n,l),n.innerHTML=s},p(o,l){l&1&&s!==(s=o[3](o[0].selfTime)+"")&&(n.innerHTML=s)},d(o){o&&(S(e),S(t),S(n))}}}function Xn(i){let e,t,n=i[0].name+"",s,o,l,r,c,d,p,v,m,f;function g(y,A){return y[2]=="both"?Yn:jn}let w=g(i),b=w(i);return{c(){e=h("div"),t=h("div"),s=L(n),o=T(),b.c(),l=T(),r=h("div"),r.textContent="loc",c=T(),d=h("div"),p=h("div"),m=T(),f=new xi(!1),a(t,"class","name svelte-ci3g2p"),a(r,"class","label svelte-ci3g2p"),a(p,"class","location-color svelte-ci3g2p"),a(p,"style",v=`background: ${i[0].locationColor}`),f.a=null,a(d,"class","location-row"),a(e,"class","timeline-canvas-view-tooltip svelte-ci3g2p"),a(e,"style",`font: ${Pi}; max-width: ${Kn}px;`)},m(y,A){I(y,e,A),u(e,t),u(t,s),u(e,o),b.m(e,null),u(e,l),u(e,r),u(e,c),u(e,d),u(d,p),u(d,m),f.m(i[1],d)},p(y,[A]){A&1&&n!==(n=y[0].name+"")&&we(s,n),w===(w=g(y))&&b?b.p(y,A):(b.d(1),b=w(y),b&&(b.c(),b.m(e,l))),A&1&&v!==(v=`background: ${y[0].locationColor}`)&&a(p,"style",v),A&2&&f.p(y[1])},i:R,o:R,d(y){y&&S(e),b.d()}}}function Fi(i){return i.selfTime==i.time?"self":i.selfTime/i.time>.001?"both":"time"}function Gn(i,e){i.font=Pi;const t=Fi(e)=="both"?140:70,n=i.measureText(e.name).width,s=i.measureText(e.location).width+46;let l=Math.max(t,n,s)+20;return l>310&&(l=310),l}const Kn=310,Pi="400 13px Source Sans Pro, sans-serif";function Zn(i,e,t){let{f:n}=e,s,o;function l(r){return`${r.toFixed(3)}`}return i.$$set=r=>{"f"in r&&t(0,n=r.f)},i.$$.update=()=>{i.$$.dirty&1&&t(1,s=Et(n.location)),i.$$.dirty&1&&t(2,o=Fi(n))},[n,s,o,l]}class Qn extends ue{constructor(e){super(),ce(this,e,Zn,Xn,oe,{f:0})}}const Jn="#212325",ai=18,es=17,Pe=28,at=17,ci=29,ts=["#3475BA","#318DBC","#47A298","#8AAE5D","#C1A731","#C07210","#B84210","#B53134","#9A3586","#4958B5","#3475BA"],is=ts.map(cn);class ns extends Un{constructor(t){super(t);k(this,"zoom",1);k(this,"startT",0);k(this,"yOffset",0);k(this,"frames",[]);k(this,"isZoomedIn",!1);k(this,"tooltipContainer");k(this,"tooltipComponent",null);k(this,"_rootFrame",null);k(this,"maxDepth",0);k(this,"tooltipLocation",null);k(this,"lastDrawWidth",0);k(this,"lastDrawHeight",0);k(this,"_libraryOrder",null);k(this,"_colors",[]);k(this,"_frameMaxT");k(this,"mouseLocation",null);k(this,"mouseDownLocation",null);k(this,"touches",{});this.onWheel=this.onWheel.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.windowMouseUp=this.windowMouseUp.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onTouchcancel=this.onTouchend.bind(this),this.canvas.addEventListener("wheel",this.onWheel),this.canvas.addEventListener("mousemove",this.onMouseMove),this.canvas.addEventListener("mouseleave",this.onMouseLeave),this.canvas.addEventListener("mousedown",this.onMouseDown),this.canvas.addEventListener("touchstart",this.onTouchstart),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend),this.canvas.addEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer=document.createElement("div"),this.tooltipContainer.style.position="absolute",this.tooltipContainer.style.pointerEvents="none",this.container.appendChild(this.tooltipContainer)}destroy(){this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("mousemove",this.onMouseMove),this.canvas.removeEventListener("mouseleave",this.onMouseLeave),this.canvas.removeEventListener("mousedown",this.onMouseDown),this.canvas.removeEventListener("touchstart",this.onTouchstart),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend),this.canvas.removeEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer.remove(),super.destroy()}setRootFrame(t){this._rootFrame=t,this.frames=[],this._frameMaxT=void 0,this.maxDepth=0,this._collectFrames(t,0),this.fitContents(),this.setNeedsRedraw()}_collectFrames(t,n){this.frames.push({frame:t,depth:n,isApplicationCode:t.isApplicationCode,library:t.library,className:t.className,filePathShort:t.filePathShort}),this.maxDepth=Math.max(this.maxDepth,n);for(const s of t.children)s.identifier!==et&&this._collectFrames(s,n+1)}updateTooltip(t,n){var s;if(n){const o={name:this.frameName(n),time:n.frame.time,selfTime:this.frameSelfTime(n),totalTime:((s=this._rootFrame)==null?void 0:s.time)??1e-12,location:`${n.filePathShort}:${n.frame.lineNo}`,locationColor:this.colorForFrame(n)};if(this.tooltipComponent?this.tooltipComponent.$set({f:o}):this.tooltipComponent=new Qn({target:this.tooltipContainer,props:{f:o}}),this.tooltipLocation){const l={x:this.tooltipLocation.x+12,y:this.tooltipLocation.y+12},r=Gn(t,o),c=this.width-10-r;l.x>c&&(l.x=c);const p=this.height-10-60;l.y>p&&(l.y=p),this.tooltipContainer.style.left=`${l.x}px`,this.tooltipContainer.style.top=`${l.y}px`}}n||this.tooltipComponent&&(this.tooltipComponent.$destroy(),this.tooltipComponent=null)}redraw(t,n){const{width:s,height:o}=n;(s!==this.lastDrawWidth||o!==this.lastDrawHeight)&&(this.isZoomedIn?this.clampViewport():this.fitContents()),this.lastDrawWidth=s,this.lastDrawHeight=o,t.fillStyle=Jn,t.fillRect(0,0,s,o),this.drawAxes(t);for(const d of this.frames)this.drawFrame(t,d);t.globalAlpha=1;const l=this.maxYOffset>0||this.isZoomedIn,r=!!this.mouseDownLocation;this.canvas.style.cursor=r&&l?"grabbing":"initial",t.fillStyle="red",t.font='23px "Source Sans Pro", sans-serif';let c=null;!r&&this.tooltipLocation&&(c=this.hitTest(this.tooltipLocation)),this.updateTooltip(t,c)}drawAxes(t){const n=Math.max(800,this.width)/this.zoom;if(n==0)return;const s=Math.log10(n);let o=Math.ceil(s)+2;o<0&&(o=0);const l=Math.ceil(s)-3,r=c=>ze(c,{from:[s,s-3],to:[.71,0],clamp:!0});for(let c=l;c.01){t.globalAlpha=f,t.font='13px "Source Sans Pro", sans-serif';let g=d.toFixed(c);g=="0"&&(g="0s");let w=m+10;t.fillText(g,p+3,w);let b=this.height+at+10-this.yOffset;bthis.width)return;if(t.fillStyle=this.colorForFrame(n),t.globalAlpha=n.isApplicationCode?1:.5,l<2){t.fillRect(s,o,l,r);return}let d=this.frameName(n);const p=Math.floor(l/3.3);if(d.length>p&&(d=d.substring(0,p)),d.length==0){t.fillRect(s,o,l,r);return}t.save(),t.beginPath(),t.rect(s,o,l,r),t.fill(),t.clip(),t.font='13px "Source Sans Pro", sans-serif',t.fillStyle="white";let v=s;v<0&&(v=0),t.fillText(d,v+2,o+13),t.restore()}_assignLibraryOrder(){const t={};for(const s of this.frames){const l=s.frame.library??"";t[l]=(t[l]||0)+s.frame.time}const n=Object.keys(t);n.sort((s,o)=>t[o]-t[s]),this._libraryOrder=n}colorForLibraryIndex(t){if(this._colors[t]!==void 0)return this._colors[t];const n=Math.pow(2,Math.ceil(Math.log2(t+1))),o=(2*t-n+1)/n,l=rn(is,o);return this._colors[t]=l,l}libraryIndexForFrame(t){this._libraryOrder||this._assignLibraryOrder();const n=t.library||"";let s=this._libraryOrder.indexOf(n);return s===-1&&(s=this._libraryOrder.length,this._libraryOrder.push(n)),s}colorForFrame(t){const n=this.libraryIndexForFrame(t);return this.colorForLibraryIndex(n)}get frameMaxT(){return this._frameMaxT===void 0&&(this._frameMaxT=this.frames.reduce((t,n)=>Math.max(t,n.frame.startTime+n.frame.time),0)),this._frameMaxT}get maxYOffset(){return Math.max(0,(this.maxDepth+1)*ai+at*2+ci-this.height)}get minZoom(){return(this.width-2*Pe)/this.frameMaxT}get maxZoom(){return 10/15e-8}fitContents(){this.startT=0,this.zoom=this.minZoom,this.isZoomedIn=!1}clampViewport(){this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.startT<0&&(this.startT=0);const t=this.frameMaxT-(this.width-2*Pe)/this.zoom;this.startT>t&&(this.startT=t),this.yOffset<0&&(this.yOffset=0),this.yOffset>this.maxYOffset&&(this.yOffset=this.maxYOffset)}frameDims(t){const n=t.depth*ai+at+ci-this.yOffset,s=es;let o=this.xForT(t.frame.startTime),r=this.xForT(t.frame.startTime+t.frame.time)-o;return r<1&&(r=1),r>1&&(r-=ze(r,{from:[1,3],to:[0,1],clamp:!0})),{x:o,y:n,w:r,h:s}}xForT(t){return(t-this.startT)*this.zoom+Pe}tForX(t){return(t-Pe)/this.zoom+this.startT}frameName(t){let n;return t.className?n=`${t.className}.${t.frame.function}`:t.frame.function==""?n=t.filePathShort??t.frame.filePath??"":n=t.frame.function,n}frameSelfTime(t){let n=t.frame.time;const s=t.frame.children.filter(o=>!o.isSynthetic);for(const o of s)n-=o.time;return n}hitTest(t){for(const n of this.frames){const{x:s,y:o,w:l,h:r}=this.frameDims(n);if(t.x>=s&&t.x<=s+l&&t.y>=o&&t.y<=o+r)return n}return null}onWheel(t){const n=t.ctrlKey||t.metaKey,s=n?.01:.0023,o=this.tForX(t.offsetX);this.zoom*=1-t.deltaY*s,this.clampViewport(),this.startT=o-(t.offsetX-Pe)/this.zoom,n||(this.startT+=t.deltaX/this.zoom),this.clampViewport(),this.setNeedsRedraw(),t.preventDefault()}onMouseMove(t){const n={x:t.offsetX,y:t.offsetY},s=this.mouseLocation;if(this.mouseLocation=n,s&&this.mouseDownLocation){const o={x:n.x-s.x,y:n.y-s.y};this.startT-=o.x/this.zoom,this.yOffset-=o.y,this.clampViewport()}this.tooltipLocation=n,this.setNeedsRedraw()}onMouseLeave(t){this.mouseLocation=null,this.tooltipLocation=null,this.setNeedsRedraw()}onMouseDown(t){(t.button===0||t.button===1)&&(this.mouseDownLocation={x:t.offsetX,y:t.offsetY},window.addEventListener("mouseup",this.windowMouseUp),this.setNeedsRedraw())}windowMouseUp(t){window.removeEventListener("mouseup",this.windowMouseUp),this.mouseDownLocation=null,this.setNeedsRedraw()}onTouchstart(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))this.touches[n.identifier]={x:n.clientX,y:n.clientY,downT:this.tForX(n.clientX),startDate:Date.now(),downX:n.clientX,downY:n.clientY}}onTouchmove(t){t.preventDefault(),t.stopPropagation();let n=0;for(const o of Array.from(t.changedTouches)){const l=this.touches[o.identifier];l&&(n+=o.clientY-l.y,this.touches[o.identifier]={...l,x:o.clientX,y:o.clientY})}const s=n/Object.keys(this.touches).length;this.yOffset-=s,this.adjustXAxisForTouches(),this.setNeedsRedraw()}onTouchend(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}onTouchcancel(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}adjustXAxisForTouches(){const t=Object.keys(this.touches).map(Number);if(t.length!=0){if(t.length==1){const n=this.touches[t[0]];this.startT=n.downT-(n.x-Pe)/this.zoom}if(t.length>=2){const n=this.touches[t[0]],s=this.touches[t[1]],o=(s.x-n.x)/(s.downT-n.downT),l=n.downT-(n.x-Pe)/o;this.startT=l,this.zoom=o}this.clampViewport()}}}function ss(i){let e;return{c(){e=h("div"),e.innerHTML="",a(e,"class","timeline svelte-p2tt1k")},m(t,n){I(t,e,n),i[6](e)},p:R,i:R,o:R,d(t){t&&S(e),i[6](null)}}}function os(i,e,t){let n,{session:s}=e;const o=vi([Ge],([p])=>({processors:[p.removeImportlib?Rt:null,p.removeTracebackHide?St:null,p.removePyinstrument?Ci:null].filter(f=>f!==null),options:{}}));_e(i,o,p=>t(5,n=p));let l,r=null,c=null;$i(()=>{c==null||c.destroy()});function d(p){Ae[p?"unshift":"push"](()=>{r=p,t(0,r)})}return i.$$set=p=>{"session"in p&&t(2,s=p.session)},i.$$.update=()=>{i.$$.dirty&36&&t(3,l=bi(s.rootFrame.cloneDeep(),n.processors,n.options)),i.$$.dirty&1&&r&&t(4,c=new ns(r)),i.$$.dirty&24&&l&&c&&c.setRootFrame(l)},[r,o,s,l,c,n,d]}class rs extends ue{constructor(e){super(),ce(this,e,os,ss,oe,{session:2})}}function ls(i){let e,t,n=i[1].viewMode+"",s;return{c(){e=h("div"),t=L("Unknown view mode: "),s=L(n),a(e,"class","error")},m(o,l){I(o,e,l),u(e,t),u(e,s)},p(o,l){l&2&&n!==(n=o[1].viewMode+"")&&we(s,n)},i:R,o:R,d(o){o&&S(e)}}}function as(i){let e,t;return e=new rs({props:{session:i[0]}}),{c(){be(e.$$.fragment)},m(n,s){me(e,n,s),t=!0},p(n,s){const o={};s&1&&(o.session=n[0]),e.$set(o)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){pe(e,n)}}}function cs(i){let e,t;return e=new qn({props:{session:i[0]}}),{c(){be(e.$$.fragment)},m(n,s){me(e,n,s),t=!0},p(n,s){const o={};s&1&&(o.session=n[0]),e.$set(o)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){pe(e,n)}}}function us(i){let e;return{c(){e=h("div"),e.innerHTML='
No samples recorded.
',a(e,"class","margins")},m(t,n){I(t,e,n)},p:R,i:R,o:R,d(t){t&&S(e)}}}function ds(i){let e,t,n,s,o,l,r,c;n=new Cn({props:{session:i[0]}});const d=[us,cs,as,ls],p=[];function v(m,f){return m[0].rootFrame?m[1].viewMode==="call-stack"?1:m[1].viewMode==="timeline"?2:3:0}return l=v(i),r=p[l]=d[l](i),{c(){e=h("div"),t=h("div"),be(n.$$.fragment),s=T(),o=h("div"),r.c(),a(t,"class","header"),a(o,"class","body svelte-1vwroj7"),a(e,"class","app svelte-1vwroj7")},m(m,f){I(m,e,f),u(e,t),me(n,t,null),u(e,s),u(e,o),p[l].m(o,null),c=!0},p(m,[f]){const g={};f&1&&(g.session=m[0]),n.$set(g);let w=l;l=v(m),l===w?p[l].p(m,f):($e(),$(p[w],1,1,()=>{p[w]=null}),qe(),r=p[l],r?r.p(m,f):(r=p[l]=d[l](m),r.c()),H(r,1),r.m(o,null))},i(m){c||(H(n.$$.fragment,m),H(r),c=!0)},o(m){$(n.$$.fragment,m),$(r),c=!1},d(m){m&&S(e),pe(n),p[l].d()}}}function fs(i,e,t){let n;_e(i,Ze,v=>t(1,n=v));let{session:s}=e;const o=document.createElement("link");o.rel="shortcut icon",o.href=Mn,document.head.appendChild(o);const l=document.createElement("link");l.rel="preload",l.as="style",l.onload=()=>{l.rel="stylesheet"},l.href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,600&display=swap",document.head.appendChild(l);const r=s.rootFrame,c=r==null?void 0:r.time.toLocaleString(void 0,{maximumSignificantDigits:3});let d,p;return(p=/[^\s/]+(:\d+)?$/.exec(s.target_description))?d=p[0]:d=s.target_description,document.title=`${c}s - ${d} - pyinstrument`,i.$$set=v=>{"session"in v&&t(0,s=v.session)},[s,n]}class hs extends ue{constructor(e){super(),ce(this,e,fs,ds,oe,{session:0})}}class ms{constructor(e){k(this,"startTime");k(this,"duration");k(this,"minInterval");k(this,"maxInterval");k(this,"sampleCount");k(this,"target_description");k(this,"cpuTime");k(this,"rootFrame");k(this,"sysPath");k(this,"sysPrefixes");k(this,"_shortenPathCache",{});this.startTime=e.session.start_time,this.duration=e.session.duration,this.minInterval=e.session.min_interval,this.maxInterval=e.session.max_interval,this.sampleCount=e.session.sample_count,this.target_description=e.session.target_description,this.cpuTime=e.session.cpu_time,this.sysPath=e.session.sys_path,this.sysPrefixes=e.session.sys_prefixes,this.rootFrame=new Je(e.frame_tree,this)}shortenPath(e){if(this._shortenPathCache[e])return this._shortenPathCache[e];let t=e;if(xe(e).length>1)for(const s of this.sysPath){const o=ps(e,s);xe(o).length0&&e[0].endsWith(":")?e[0]:null}function ps(i,e){if(ui(i)!=ui(e))return i;const t=xe(i),n=xe(e);let s=0;for(;s"..").concat(t.slice(s)).join("/")}const vs={render(i,e){const t=new ms(e);return new hs({target:i,props:{session:t}})}};function di(i,e,t){const n=i.slice();return n[10]=e[t],n}function fi(i){let e,t=i[10].name+"",n;return{c(){e=h("option"),n=L(t),e.__value=i[10],le(e,e.__value)},m(s,o){I(s,e,o),u(e,n)},p:R,d(s){s&&S(e)}}}function gs(i){let e,t,n=i[3].message+"",s;return{c(){e=h("div"),t=L("Error loading file: "),s=L(n)},m(o,l){I(o,e,l),u(e,t),u(e,s)},p(o,l){l&8&&n!==(n=o[3].message+"")&&we(s,n)},d(o){o&&S(e)}}}function _s(i){let e;return{c(){e=h("div"),e.textContent="Loading..."},m(t,n){I(t,e,n)},p:R,d(t){t&&S(e)}}}function ws(i){let e,t,n,s,o,l,r,c,d,p,v,m,f,g,w=dt(i[5]),b=[];for(let M=0;Mi[7].call(r)),a(o,"class","right"),a(t,"class","header svelte-1980ffz"),a(v,"class","result-element"),a(v,"style",m=i[1]?"":"display: none"),a(d,"class","body svelte-1980ffz"),a(e,"class","demo-app svelte-1980ffz")},m(M,D){I(M,e,D),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(o,r);for(let E=0;E_t(()=>import("./django_template_render-CIkNzFIy.js"),[],import.meta.url).then(f=>f.default),"../demo-data/sympy_calculation.json":()=>_t(()=>import("./sympy_calculation-B9Pn_4RL.js"),[],import.meta.url).then(f=>f.default),"../demo-data/wikipedia_article_word_count.json":()=>_t(()=>import("./wikipedia_article_word_count-CGt_pvsZ.js"),[],import.meta.url).then(f=>f.default)})).map(([f,g])=>({name:f.split("/").pop().split(".").slice(0,-1).join("."),promiseFn:g}));let o=s[0],l=null,r=null,c=!1,d=null,p;function v(){o=Bi(this),t(0,o),t(5,s)}function m(f){Ae[f?"unshift":"push"](()=>{p=f,t(2,p)})}return i.$$.update=()=>{i.$$.dirty&1&&(t(4,c=!0),t(3,r=null),t(1,l=null),o.promiseFn().then(f=>{t(1,l=f),t(3,r=null)}).catch(f=>{t(3,r=f)}).finally(()=>{t(4,c=!1)})),i.$$.dirty&70&&p&&l&&(d&&d.$destroy(),t(6,d=vs.render(p,l)))},[o,l,p,r,c,s,d,v,m]}class ys extends ue{constructor(e){super(),ce(this,e,bs,ws,oe,{})}}new ys({target:document.body}); diff --git a/docs/_static/preview/assets/index-DhaBtkCM.js b/docs/_static/preview/assets/index-DhaBtkCM.js new file mode 100644 index 00000000..67b77838 --- /dev/null +++ b/docs/_static/preview/assets/index-DhaBtkCM.js @@ -0,0 +1,15 @@ +var Li=Object.defineProperty;var Ri=(i,e,t)=>e in i?Li(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var C=(i,e,t)=>Ri(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function t(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=t(s);fetch(s.href,o)}})();const Si="modulepreload",Ii=function(i,e){return new URL(i,e).href},jt={},_t=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),r=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=Promise.all(t.map(a=>{if(a=Ii(a,n),a in jt)return;jt[a]=!0;const d=a.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!n)for(let f=o.length-1;f>=0;f--){const g=o[f];if(g.href===a&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Si,d||(m.as="script",m.crossOrigin=""),m.href=a,r&&m.setAttribute("nonce",r),document.head.appendChild(m),d)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${a}`)))})}))}return s.then(()=>e()).catch(o=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o})};function R(){}function hi(i){return i()}function Yt(){return Object.create(null)}function ae(i){i.forEach(hi)}function kt(i){return typeof i=="function"}function oe(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Oi(i){return Object.keys(i).length===0}function mi(i,...e){if(i==null){for(const n of e)n(void 0);return R}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function we(i,e,t){i.$$.on_destroy.push(mi(e,t))}function Di(i,e,t){return i.set(t),e}function u(i,e){i.appendChild(e)}function O(i,e,t){i.insertBefore(e,t||null)}function I(i){i.parentNode&&i.parentNode.removeChild(i)}function Hi(i,e){for(let t=0;ti.removeEventListener(e,t,n)}function Ct(i){return function(e){return e.preventDefault(),i.call(this,e)}}function Mt(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function c(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function yt(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Ni(i){return Array.from(i.childNodes)}function me(i,e){e=""+e,i.data!==e&&(i.data=e)}function le(i,e){i.value=e??""}function Z(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function Xt(i,e,t){for(let n=0;n{const s=i.$$.callbacks[e];if(s){const o=zi(e,t,{cancelable:n});return s.slice().forEach(l=>{l.call(i,o)}),!o.defaultPrevented}return!0}}const Ne=[],Ae=[];let Be=[];const Gt=[],Wi=Promise.resolve();let At=!1;function Ui(){At||(At=!0,Wi.then(pi))}function ut(i){Be.push(i)}const wt=new Set;let He=0;function pi(){if(He!==0)return;const i=Qe;do{try{for(;Hei.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Be=e}const ct=new Set;let Le;function xe(){Le={r:0,c:[],p:Le}}function qe(){Le.r||ae(Le.c),Le=Le.p}function H(i,e){i&&i.i&&(ct.delete(i),i.i(e))}function $(i,e,t,n){if(i&&i.o){if(ct.has(i))return;ct.add(i),Le.c.push(()=>{ct.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function dt(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Xi(i,e){$(i,1,1,()=>{e.delete(i.key)})}function Gi(i,e,t,n,s,o,l,r,a,d,p,v){let m=i.length,f=o.length,g=m;const _={};for(;g--;)_[i[g].key]=g;const b=[],M=new Map,T=new Map,y=[];for(g=f;g--;){const P=v(s,o,g),w=t(P);let k=l.get(w);k?y.push(()=>k.p(P,e)):(k=d(w,P),k.c()),M.set(w,b[g]=k),w in _&&T.set(w,Math.abs(g-_[w]))}const F=new Set,D=new Set;function E(P){H(P,1),P.m(r,p),l.set(P.key,P),p=P.first,f--}for(;m&&f;){const P=b[f-1],w=i[m-1],k=P.key,S=w.key;P===w?(p=P.first,m--,f--):M.has(S)?!l.has(k)||F.has(k)?E(P):D.has(S)?m--:T.get(k)>T.get(S)?(D.add(k),E(P)):(F.add(S),m--):(a(w,l),m--)}for(;m--;){const P=i[m];M.has(P.key)||a(P,l)}for(;f;)E(b[f-1]);return ae(y),b}function be(i){i&&i.c()}function pe(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ut(()=>{const o=i.$$.on_mount.map(hi).filter(kt);i.$$.on_destroy?i.$$.on_destroy.push(...o):ae(o),i.$$.on_mount=[]}),s.forEach(ut)}function ve(i,e){const t=i.$$;t.fragment!==null&&(Yi(t.after_update),ae(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ki(i,e){i.$$.dirty[0]===-1&&(Ne.push(i),Ui(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<{const g=f.length?f[0]:m;return d.ctx&&s(d.ctx[v],d.ctx[v]=g)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](g),p&&Ki(i,v)),m}):[],d.update(),p=!0,ae(d.before_update),d.fragment=n?n(d.ctx):!1,e.target){if(e.hydrate){const v=Ni(e.target);d.fragment&&d.fragment.l(v),v.forEach(I)}else d.fragment&&d.fragment.c();e.intro&&H(i.$$.fragment),pe(i,e.target,e.anchor),pi()}Ke(a)}class ue{constructor(){C(this,"$$");C(this,"$$set")}$destroy(){ve(this,1),this.$destroy=R}$on(e,t){if(!kt(t))return R;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!Oi(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zi="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zi);function Qi(i){let e,t;return{c(){e=z("svg"),t=z("path"),c(t,"fill-rule","evenodd"),c(t,"clip-rule","evenodd"),c(t,"d","M5.11634 0.889422C4.86506 -0.296474 3.17237 -0.296474 2.92109 0.889422C2.78291 1.54158 2.10994 1.93011 1.47607 1.72371C0.323418 1.34837 -0.522932 2.81429 0.378448 3.62484C0.87414 4.07059 0.87414 4.84767 0.378448 5.29341C-0.522931 6.10397 0.323418 7.56989 1.47607 7.19455C2.10994 6.98814 2.78291 7.37668 2.92109 8.02883C3.17237 9.21473 4.86506 9.21473 5.11634 8.02883C5.25452 7.37668 5.92749 6.98814 6.56136 7.19455C7.71401 7.56989 8.56036 6.10397 7.65898 5.29341C7.16329 4.84767 7.16329 4.07059 7.65898 3.62484C8.56036 2.81429 7.71401 1.34837 6.56136 1.72371C5.92749 1.93011 5.25452 1.54158 5.11634 0.889422ZM4.01883 6.33408C5.05436 6.33408 5.89383 5.49462 5.89383 4.45908C5.89383 3.42355 5.05436 2.58408 4.01883 2.58408C2.98329 2.58408 2.14383 3.42355 2.14383 4.45908C2.14383 5.49462 2.98329 6.33408 4.01883 6.33408Z"),c(t,"fill","currentColor"),c(e,"width","9"),c(e,"height","9"),c(e,"viewBox","0 0 9 9"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(n,s){O(n,e,s),u(e,t)},p:R,i:R,o:R,d(n){n&&I(e)}}}class Ji extends ue{constructor(e){super(),ce(this,e,null,Qi,oe,{})}}function en(i){let e,t,n,s,o,l,r,a,d,p,v,m,f,g,_,b,M;return{c(){e=z("svg"),t=z("g"),n=z("path"),s=z("path"),o=z("defs"),l=z("filter"),r=z("feFlood"),a=z("feBlend"),d=z("feGaussianBlur"),p=z("linearGradient"),v=z("stop"),m=z("stop"),f=z("stop"),g=z("linearGradient"),_=z("stop"),b=z("stop"),M=z("stop"),c(n,"fill-rule","evenodd"),c(n,"clip-rule","evenodd"),c(n,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),c(n,"fill","url(#paint0_linear_67_262)"),c(t,"opacity","0.5"),c(t,"filter","url(#filter0_f_67_262)"),c(s,"fill-rule","evenodd"),c(s,"clip-rule","evenodd"),c(s,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),c(s,"fill","url(#paint1_linear_67_262)"),c(r,"flood-opacity","0"),c(r,"result","BackgroundImageFix"),c(a,"mode","normal"),c(a,"in","SourceGraphic"),c(a,"in2","BackgroundImageFix"),c(a,"result","shape"),c(d,"stdDeviation","3.39785"),c(d,"result","effect1_foregroundBlur_67_262"),c(l,"id","filter0_f_67_262"),c(l,"x","3.2043"),c(l,"y","2.2043"),c(l,"width","36.0914"),c(l,"height","41.0914"),c(l,"filterUnits","userSpaceOnUse"),c(l,"color-interpolation-filters","sRGB"),c(v,"stop-color","#FFAA00"),c(m,"offset","0.514478"),c(m,"stop-color","#FFEB00"),c(f,"offset","1"),c(f,"stop-color","#98FF05"),c(p,"id","paint0_linear_67_262"),c(p,"x1","7.3769"),c(p,"y1","18.4566"),c(p,"x2","20.6583"),c(p,"y2","33.1038"),c(p,"gradientUnits","userSpaceOnUse"),c(_,"stop-color","#FFC834"),c(b,"offset","0.514478"),c(b,"stop-color","#FAF534"),c(M,"offset","1"),c(M,"stop-color","#B8FF38"),c(g,"id","paint1_linear_67_262"),c(g,"x1","7.3769"),c(g,"y1","18.4566"),c(g,"x2","20.6583"),c(g,"y2","33.1038"),c(g,"gradientUnits","userSpaceOnUse"),c(e,"width","44"),c(e,"height","44"),c(e,"viewBox","0 0 44 44"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(T,y){O(T,e,y),u(e,t),u(t,n),u(e,s),u(e,o),u(o,l),u(l,r),u(l,a),u(l,d),u(o,p),u(p,v),u(p,m),u(p,f),u(o,g),u(g,_),u(g,b),u(g,M)},p:R,i:R,o:R,d(T){T&&I(e)}}}class tn extends ue{constructor(e){super(),ce(this,e,null,en,oe,{})}}const Ve=[];function nn(i,e){return{subscribe:ft(i,e).subscribe}}function ft(i,e=R){let t;const n=new Set;function s(r){if(oe(i,r)&&(i=r,t)){const a=!Ve.length;for(const d of n)d[1](),Ve.push(d,i);if(a){for(let d=0;d{n.delete(d),n.size===0&&t&&(t(),t=null)}}return{set:s,update:o,subscribe:l}}function vi(i,e,t){const n=!Array.isArray(i),s=n?[i]:i;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return nn(t,(l,r)=>{let a=!1;const d=[];let p=0,v=R;const m=()=>{if(p)return;v();const g=e(n?d[0]:d,l,r);o?l(g):v=kt(g)?g:R},f=s.map((g,_)=>mi(g,b=>{d[_]=b,p&=~(1<<_),a&&m()},()=>{p|=1<<_}));return a=!0,m(),function(){ae(f),v(),a=!1}})}var bt={local:{},session:{}};function sn(i){return i==="local"?localStorage:sessionStorage}function Pt(i,e,t){var n,s,o,l,r,a,d,p;t!=null&&t.onError&&console.warn("onError has been deprecated. Please use onWriteError instead");const v=(n=t==null?void 0:t.serializer)!=null?n:JSON,m=(s=t==null?void 0:t.storage)!=null?s:"local",f=(o=t==null?void 0:t.syncTabs)!=null?o:!0,g=(r=(l=t==null?void 0:t.onWriteError)!=null?l:t==null?void 0:t.onError)!=null?r:E=>console.error(`Error when writing value from persisted store "${i}" to ${m}`,E),_=(a=t==null?void 0:t.onParseError)!=null?a:(E,P)=>console.error(`Error when parsing ${E?'"'+E+'"':"value"} from persisted store "${i}"`,P),b=(d=t==null?void 0:t.beforeRead)!=null?d:E=>E,M=(p=t==null?void 0:t.beforeWrite)!=null?p:E=>E,T=typeof window<"u"&&typeof document<"u",y=T?sn(m):null;function F(E,P){const w=M(P);try{y==null||y.setItem(E,v.stringify(w))}catch(k){g(k)}}function D(){function E(S){try{return v.parse(S)}catch(x){_(S,x)}}const P=y==null?void 0:y.getItem(i);if(P==null)return e;const w=E(P);return w==null?e:b(w)}if(!bt[m][i]){const E=D(),P=ft(E,S=>{if(T&&m=="local"&&f){const x=J=>{if(J.key===i&&J.newValue){let B;try{B=v.parse(J.newValue)}catch(ee){_(J.newValue,ee);return}const Fe=b(B);S(Fe)}};return window.addEventListener("storage",x),()=>window.removeEventListener("storage",x)}}),{subscribe:w,set:k}=P;bt[m][i]={set(S){k(S),F(i,S)},update(S){return P.update(x=>{const J=S(x);return F(i,J),J})},reset(){this.set(e)},subscribe:w}}return bt[m][i]}function Kt(){return{collapseMode:"non-application",collapseCustomHide:"",collapseCustomShow:"",removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:.001,timeFormat:"absolute"}}const K=Pt("pyinstrument:viewOptionsCallStack",Kt(),{syncTabs:!0,beforeRead(i){return{...Kt(),...i}}}),Ze=Pt("pyinstrument:viewOptions",{viewMode:"call-stack"},{syncTabs:!1}),Ge=Pt("pyinstrument:viewOptionsTimeline",{removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:1e-4},{syncTabs:!0});class on extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function rn(i,e){const t=e*(i.length-1),n=Math.floor(t),s=Math.ceil(t),o=i[n],l=i[s],r=t-n;return an(r,{to:[o,l]})}function ln(i,e,t){return i===1/0?(console.warn("clamp: value is Infinity, returning `max`",i),t):i===-1/0?(console.warn("clamp: value is -Infinity, returning `min`",i),e):Number.isFinite(i)?it?t:i:(console.warn("clamp: value isn't finite, returning `min`",i),e)}function ze(i,e){const{from:t=[0,1],to:n=[0,1]}=e,s=e.clamp||!1;let o=(i-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return s&&(o=ln(o,Math.min(n[0],n[1]),Math.max(n[0],n[1]))),o}function an(i,e){return`rgb( + ${ze(i,{from:e.from,to:[e.to[0][0],e.to[1][0]],clamp:e.clamp})}, + ${ze(i,{from:e.from,to:[e.to[0][1],e.to[1][1]],clamp:e.clamp})}, + ${ze(i,{from:e.from,to:[e.to[0][2],e.to[1][2]],clamp:e.clamp})} + )`}function cn(i){if(i.substr(0,1)=="#"){var e=(i.length-1)/3,t=[17,1,.062272][e-1];return[Math.round(parseInt(i.substr(1,e),16)*t),Math.round(parseInt(i.substr(1+e,e),16)*t),Math.round(parseInt(i.substr(1+2*e,e),16)*t)]}else return i.split("(")[1].split(")")[0].split(",").map(n=>+n)}function un(i,e,t={}){const{ignore:n=[],capture:s=!0}=t,o=window;if(!o)return()=>{};let l=!0,r=!1;const a=f=>n.some(g=>typeof g=="string"?Array.from(document.querySelectorAll(g)).some(_=>_===f.target||f.composedPath().includes(_)):g&&(f.target===g||f.composedPath().includes(g))),d=f=>{if(!(!i||i===f.target||f.composedPath().includes(i))){if(f.detail===0&&(l=!a(f)),!l){l=!0;return}e(f)}},p=f=>{r||(r=!0,setTimeout(()=>{r=!1},0),d(f))},v=f=>{l=!a(f)&&!!(i&&!f.composedPath().includes(i))};return o.addEventListener("click",p,{passive:!0,capture:s}),o.addEventListener("pointerdown",v,{passive:!0}),()=>{o.removeEventListener("click",p,{capture:s}),o.removeEventListener("pointerdown",v)}}function dn(i){const e=document.createElement("div");return e.appendChild(document.createTextNode(i)),e.innerHTML}function Et(i){return dn(i).replace(/(\/|\\)/g,t=>`${t}`)}function fn(i,e){if(i.length==0)return null;let t=i[0],n=e(t);for(const s of i){const o=e(s);o>n&&(t=s,n=o)}return t}function ht(){return Math.random().toString(36).substring(2)}function hn(i){let e,t,n,s,o,l,r,a,d,p,v,m,f,g,_,b,M,T,y,F,D,E,P,w,k,S,x,J,B,Fe,ee,Q,j,Ee,W,We,Ue,re,U,je,te,de,fe,ge,he,ye,Ye,Te,G,Re,ke,Xe,q,V,Y,It,tt,Ot,Dt,Se,Ce,Ht,Ie,it,Vt,Nt,_e,Bt,zt,Oe,nt,$t,De,st,ot,ie,xt,qt,rt,lt,ne,Wt,pt,vt,gt,Ut;return pt=yt(i[5][0]),vt=yt(i[5][1]),{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Collapse frames",s=A(),o=h("div"),l=h("div"),r=h("input"),a=A(),d=h("label"),p=L("Library code"),v=A(),m=h("div"),m.textContent="Code run from the Python stdlib, a virtualenv, or a conda env will be collapsed.",f=A(),g=h("div"),_=h("input"),b=A(),M=h("label"),T=L("Custom"),y=A(),F=h("div"),D=L(`Regex on the source file path. + `),E=h("div"),P=h("label"),P.textContent="Show",w=A(),k=h("input"),S=A(),x=h("label"),x.textContent="Hide",J=A(),B=h("input"),Fe=L(` + If neither match, the library code rule is used.`),ee=A(),Q=h("div"),j=h("input"),Ee=A(),W=h("label"),We=L("Disabled"),Ue=A(),re=h("div"),U=h("div"),U.textContent="Remove frames",je=A(),te=h("div"),de=h("div"),fe=h("input"),ge=A(),he=h("label"),ye=L("importlib machinery"),Ye=A(),Te=h("div"),G=h("input"),Re=A(),ke=h("label"),Xe=L("Frames declaring __traceback_hide__"),q=A(),V=h("div"),Y=h("input"),It=A(),tt=h("label"),Ot=L("pyinstrument frames"),Dt=A(),Se=h("div"),Ce=h("input"),Ht=A(),Ie=h("span"),it=h("label"),Vt=L("Frames with durations less than"),Nt=A(),_e=h("input"),Bt=L(` + % of the total time`),zt=A(),Oe=h("div"),nt=h("div"),nt.textContent="Time format",$t=A(),De=h("div"),st=h("div"),ot=h("label"),ie=h("input"),xt=L(` + Absolute time in seconds`),qt=A(),rt=h("div"),lt=h("label"),ne=h("input"),Wt=L(` + Percentage of the total run time`),c(n,"class","name svelte-1pecl4m"),c(r,"id",i[1]+"collapseModeAll"),c(r,"type","radio"),r.__value="non-application",le(r,r.__value),c(r,"class","svelte-1pecl4m"),c(d,"for",i[1]+"collapseModeAll"),c(m,"class","description svelte-1pecl4m"),c(l,"class","option svelte-1pecl4m"),c(_,"id",i[1]+"collapseModeCustom"),c(_,"type","radio"),_.__value="custom",le(_,_.__value),c(_,"class","svelte-1pecl4m"),c(M,"for",i[1]+"collapseModeCustom"),c(P,"for","collapseCustomShow"),c(P,"class","svelte-1pecl4m"),c(k,"id","collapseCustomShow"),c(k,"type","text"),c(k,"placeholder","myproject"),c(k,"spellcheck","false"),c(k,"autocapitalize","off"),c(k,"autocomplete","off"),c(k,"autocorrect","off"),c(k,"class","svelte-1pecl4m"),c(x,"for","collapseCustomHide"),c(x,"class","svelte-1pecl4m"),c(B,"id","collapseCustomHide"),c(B,"type","text"),c(B,"placeholder",".*/lib/.*"),c(B,"spellcheck","false"),c(B,"autocapitalize","off"),c(B,"autocomplete","off"),c(B,"autocorrect","off"),c(B,"class","svelte-1pecl4m"),c(E,"class","mini-input-grid svelte-1pecl4m"),c(F,"class","description svelte-1pecl4m"),c(g,"class","option svelte-1pecl4m"),c(j,"id",i[1]+"collapseModeDisabled"),c(j,"type","radio"),j.__value="disabled",le(j,j.__value),c(j,"class","svelte-1pecl4m"),c(W,"for",i[1]+"collapseModeDisabled"),c(Q,"class","option svelte-1pecl4m"),c(o,"class","body"),c(t,"class","option-group svelte-1pecl4m"),c(U,"class","name svelte-1pecl4m"),c(fe,"id",i[1]+"removeImportlib"),c(fe,"type","checkbox"),c(fe,"class","svelte-1pecl4m"),c(he,"for",i[1]+"removeImportlib"),c(de,"class","option svelte-1pecl4m"),c(G,"id",i[1]+"removeTracebackHide"),c(G,"type","checkbox"),c(G,"class","svelte-1pecl4m"),c(ke,"for",i[1]+"removeTracebackHide"),c(Te,"class","option svelte-1pecl4m"),c(Y,"id",i[1]+"removePyinstrument"),c(Y,"type","checkbox"),c(Y,"class","svelte-1pecl4m"),c(tt,"for",i[1]+"removePyinstrument"),c(V,"class","option svelte-1pecl4m"),c(Ce,"id",i[1]+"removeIrrelevant"),c(Ce,"type","checkbox"),c(Ce,"class","svelte-1pecl4m"),c(it,"for",i[1]+"removeIrrelevant"),c(_e,"type","number"),_e.value=i[2](),c(_e,"min","0"),c(_e,"max","99"),c(_e,"step","0.01"),Z(_e,"width","4em"),c(_e,"class","svelte-1pecl4m"),c(Se,"class","option svelte-1pecl4m"),c(te,"class","body"),c(re,"class","option-group svelte-1pecl4m"),c(nt,"class","name svelte-1pecl4m"),c(ie,"type","radio"),ie.__value="absolute",le(ie,ie.__value),c(ie,"class","svelte-1pecl4m"),c(st,"class","option svelte-1pecl4m"),c(ne,"type","radio"),ne.__value="proportion",le(ne,ne.__value),c(ne,"class","svelte-1pecl4m"),c(rt,"class","option svelte-1pecl4m"),c(De,"class","body"),c(Oe,"class","option-group svelte-1pecl4m"),c(e,"class","view-options-call-stack svelte-1pecl4m"),pt.p(ie,ne),vt.p(r,_,j)},m(X,se){O(X,e,se),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(l,r),r.checked=r.__value===i[0].collapseMode,u(l,a),u(l,d),u(d,p),u(l,v),u(l,m),u(o,f),u(o,g),u(g,_),_.checked=_.__value===i[0].collapseMode,u(g,b),u(g,M),u(M,T),u(g,y),u(g,F),u(F,D),u(F,E),u(E,P),u(E,w),u(E,k),le(k,i[0].collapseCustomShow),u(E,S),u(E,x),u(E,J),u(E,B),le(B,i[0].collapseCustomHide),u(F,Fe),u(o,ee),u(o,Q),u(Q,j),j.checked=j.__value===i[0].collapseMode,u(Q,Ee),u(Q,W),u(W,We),u(e,Ue),u(e,re),u(re,U),u(re,je),u(re,te),u(te,de),u(de,fe),fe.checked=i[0].removeImportlib,u(de,ge),u(de,he),u(he,ye),u(te,Ye),u(te,Te),u(Te,G),G.checked=i[0].removeTracebackHide,u(Te,Re),u(Te,ke),u(ke,Xe),u(te,q),u(te,V),u(V,Y),Y.checked=i[0].removePyinstrument,u(V,It),u(V,tt),u(tt,Ot),u(te,Dt),u(te,Se),u(Se,Ce),Ce.checked=i[0].removeIrrelevant,u(Se,Ht),u(Se,Ie),u(Ie,it),u(it,Vt),u(Ie,Nt),u(Ie,_e),u(Ie,Bt),u(e,zt),u(e,Oe),u(Oe,nt),u(Oe,$t),u(Oe,De),u(De,st),u(st,ot),u(ot,ie),ie.checked=ie.__value===i[0].timeFormat,u(ot,xt),u(De,qt),u(De,rt),u(rt,lt),u(lt,ne),ne.checked=ne.__value===i[0].timeFormat,u(lt,Wt),gt||(Ut=[N(r,"change",i[4]),N(_,"change",i[6]),N(k,"input",i[7]),N(B,"input",i[8]),N(j,"change",i[9]),N(fe,"change",i[10]),N(G,"change",i[11]),N(Y,"change",i[12]),N(Ce,"change",i[13]),N(_e,"input",i[3]),N(ie,"change",i[14]),N(ne,"change",i[15])],gt=!0)},p(X,[se]){se&1&&(r.checked=r.__value===X[0].collapseMode),se&1&&(_.checked=_.__value===X[0].collapseMode),se&1&&k.value!==X[0].collapseCustomShow&&le(k,X[0].collapseCustomShow),se&1&&B.value!==X[0].collapseCustomHide&&le(B,X[0].collapseCustomHide),se&1&&(j.checked=j.__value===X[0].collapseMode),se&1&&(fe.checked=X[0].removeImportlib),se&1&&(G.checked=X[0].removeTracebackHide),se&1&&(Y.checked=X[0].removePyinstrument),se&1&&(Ce.checked=X[0].removeIrrelevant),se&1&&(ie.checked=ie.__value===X[0].timeFormat),se&1&&(ne.checked=ne.__value===X[0].timeFormat)},i:R,o:R,d(X){X&&I(e),pt.r(),vt.r(),gt=!1,ae(Ut)}}}function mn(i,e,t){let n;we(i,K,y=>t(0,n=y));const s=ht();function o(){return(n.removeIrrelevantThreshold*100).toLocaleString(void 0,{maximumFractionDigits:4})}function l(y){Di(K,n.removeIrrelevantThreshold=y.currentTarget.valueAsNumber/100,n)}const r=[[],[]];function a(){n.collapseMode=this.__value,K.set(n)}function d(){n.collapseMode=this.__value,K.set(n)}function p(){n.collapseCustomShow=this.value,K.set(n)}function v(){n.collapseCustomHide=this.value,K.set(n)}function m(){n.collapseMode=this.__value,K.set(n)}function f(){n.removeImportlib=this.checked,K.set(n)}function g(){n.removeTracebackHide=this.checked,K.set(n)}function _(){n.removePyinstrument=this.checked,K.set(n)}function b(){n.removeIrrelevant=this.checked,K.set(n)}function M(){n.timeFormat=this.__value,K.set(n)}function T(){n.timeFormat=this.__value,K.set(n)}return[n,s,o,l,a,r,d,p,v,m,f,g,_,b,M,T]}class pn extends ue{constructor(e){super(),ce(this,e,mn,hn,oe,{})}}function vn(i){let e,t,n,s,o,l,r,a,d,p,v,m,f,g,_,b,M,T,y,F,D,E,P,w;return{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Remove frames",s=A(),o=h("div"),l=h("div"),r=h("input"),a=A(),d=h("label"),p=L("importlib machinery"),v=A(),m=h("div"),f=h("input"),g=A(),_=h("label"),b=L("Frames declaring __traceback_hide__"),M=A(),T=h("div"),y=h("input"),F=A(),D=h("label"),E=L("pyinstrument frames"),c(n,"class","name"),c(r,"id",i[1]+"removeImportlib"),c(r,"type","checkbox"),c(d,"for",i[1]+"removeImportlib"),c(l,"class","option"),c(f,"id",i[1]+"removeTracebackHide"),c(f,"type","checkbox"),c(_,"for",i[1]+"removeTracebackHide"),c(m,"class","option"),c(y,"id",i[1]+"removePyinstrument"),c(y,"type","checkbox"),c(D,"for",i[1]+"removePyinstrument"),c(T,"class","option"),c(o,"class","body"),c(t,"class","option-group"),c(e,"class","view-options-timeline svelte-vsz8zm")},m(k,S){O(k,e,S),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(l,r),r.checked=i[0].removeImportlib,u(l,a),u(l,d),u(d,p),u(o,v),u(o,m),u(m,f),f.checked=i[0].removeTracebackHide,u(m,g),u(m,_),u(_,b),u(o,M),u(o,T),u(T,y),y.checked=i[0].removePyinstrument,u(T,F),u(T,D),u(D,E),P||(w=[N(r,"change",i[2]),N(f,"change",i[3]),N(y,"change",i[4])],P=!0)},p(k,[S]){S&1&&(r.checked=k[0].removeImportlib),S&1&&(f.checked=k[0].removeTracebackHide),S&1&&(y.checked=k[0].removePyinstrument)},i:R,o:R,d(k){k&&I(e),P=!1,ae(w)}}}function gn(i,e,t){let n;we(i,Ge,a=>t(0,n=a));const s=ht();function o(){n.removeImportlib=this.checked,Ge.set(n)}function l(){n.removeTracebackHide=this.checked,Ge.set(n)}function r(){n.removePyinstrument=this.checked,Ge.set(n)}return[n,s,o,l,r]}class _n extends ue{constructor(e){super(),ce(this,e,gn,vn,oe,{})}}function wn(i){let e,t;return e=new _n({}),{c(){be(e.$$.fragment)},m(n,s){pe(e,n,s),t=!0},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ve(e,n)}}}function bn(i){let e,t;return e=new pn({}),{c(){be(e.$$.fragment)},m(n,s){pe(e,n,s),t=!0},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ve(e,n)}}}function yn(i){let e,t,n,s,o,l,r,a,d;const p=[bn,wn],v=[];function m(f,g){return f[0].viewMode==="call-stack"?0:f[0].viewMode==="timeline"?1:-1}return~(r=m(i))&&(a=v[r]=p[r](i)),{c(){e=h("div"),t=h("div"),n=h("div"),s=L(i[3]),o=A(),l=h("div"),a&&a.c(),c(n,"class","title-row svelte-rpk7lo"),c(l,"class","body svelte-rpk7lo"),c(t,"class","box svelte-rpk7lo"),c(e,"class","view-options svelte-rpk7lo")},m(f,g){O(f,e,g),u(e,t),u(t,n),u(n,s),u(t,o),u(t,l),~r&&v[r].m(l,null),i[4](t),i[5](e),d=!0},p(f,[g]){(!d||g&8)&&me(s,f[3]);let _=r;r=m(f),r!==_&&(a&&(xe(),$(v[_],1,1,()=>{v[_]=null}),qe()),~r?(a=v[r],a||(a=v[r]=p[r](f),a.c()),H(a,1),a.m(l,null)):a=null)},i(f){d||(H(a),d=!0)},o(f){$(a),d=!1},d(f){f&&I(e),~r&&v[r].d(),i[4](null),i[5](null)}}}function Tn(i,e,t){let n;we(i,Ze,m=>t(0,n=m));const s=qi();function o(){s("close")}let l,r;Tt(()=>{if(r)return un(r,o,{ignore:[".js-view-options-button"]})});function a(){if(!l||!r)return;const m=l.getBoundingClientRect(),g=r.getBoundingClientRect().width;m.right-g-20<0?t(2,r.style.right=`${m.right-g-20}px`,r):t(2,r.style.right="0",r)}Tt(()=>(a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)));let d="View options";function p(m){Ae[m?"unshift":"push"](()=>{r=m,t(2,r)})}function v(m){Ae[m?"unshift":"push"](()=>{l=m,t(1,l)})}return i.$$.update=()=>{i.$$.dirty&1&&(n.viewMode==="call-stack"?t(3,d="Call stack view options"):n.viewMode==="timeline"&&t(3,d="Timeline view options"))},[n,l,r,d,p,v]}class An extends ue{constructor(e){super(),ce(this,e,Tn,yn,oe,{})}}function Zt(i){let e,t;return e=new An({}),e.$on("close",i[9]),{c(){be(e.$$.fragment)},m(n,s){pe(e,n,s),t=!0},p:R,i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ve(e,n)}}}function En(i){let e,t,n,s,o,l,r,a,d=Et(i[0].target_description)+"",p,v,m,f,g,_,b,M,T,y,F,D,E,P=i[0].sampleCount+"",w,k,S,x,J,B,Fe,ee,Q,j,Ee,W,We,Ue,re,U,je,te,de,fe,ge,he,ye,Ye,Te,G,Re,ke,Xe;o=new tn({}),ye=new Ji({});let q=i[1]&&Zt(i);return Re=yt(i[7][0]),{c(){e=h("div"),t=h("div"),n=h("div"),s=h("div"),be(o.$$.fragment),l=A(),r=h("div"),a=h("div"),p=A(),v=h("div"),m=h("div"),f=h("span"),f.textContent="Recorded:",g=A(),_=h("span"),_.textContent=`${i[3]}`,b=A(),M=h("br"),T=A(),y=h("div"),F=h("span"),F.textContent="Samples:",D=A(),E=h("span"),w=L(P),k=A(),S=h("div"),x=h("span"),x.textContent="CPU utilization:",J=A(),B=h("span"),B.textContent=`${(i[4]*100).toFixed(0)}%`,Fe=A(),ee=h("div"),Q=h("div"),j=L(`View: + `),Ee=h("label"),W=h("input"),We=L(` + Call stack`),Ue=A(),re=h("label"),U=h("input"),je=L(` + Timeline`),te=A(),de=h("div"),fe=A(),ge=h("div"),he=h("button"),be(ye.$$.fragment),Ye=L(` + View options`),Te=A(),q&&q.c(),c(s,"class","logo svelte-qdxst2"),c(a,"class","target-description svelte-qdxst2"),c(f,"class","metric-label svelte-qdxst2"),c(_,"class","metric-value svelte-qdxst2"),c(m,"class","metric date svelte-qdxst2"),c(M,"class","svelte-qdxst2"),c(F,"class","metric-label svelte-qdxst2"),c(E,"class","metric-value svelte-qdxst2"),c(y,"class","metric svelte-qdxst2"),c(x,"class","metric-label svelte-qdxst2"),c(B,"class","metric-value svelte-qdxst2"),c(S,"class","metric svelte-qdxst2"),c(v,"class","metrics svelte-qdxst2"),c(W,"type","radio"),W.__value="call-stack",le(W,W.__value),c(W,"class","svelte-qdxst2"),c(Ee,"class","svelte-qdxst2"),c(U,"type","radio"),U.__value="timeline",le(U,U.__value),c(U,"class","svelte-qdxst2"),c(re,"class","svelte-qdxst2"),c(Q,"class","toggle"),c(de,"class","spacer"),Z(de,"flex","1"),c(he,"class","js-view-options-button svelte-qdxst2"),c(ge,"class","button-container svelte-qdxst2"),c(ee,"class","view-options svelte-qdxst2"),c(r,"class","layout svelte-qdxst2"),c(n,"class","row svelte-qdxst2"),c(t,"class","margins"),c(e,"class","header svelte-qdxst2"),Re.p(W,U)},m(V,Y){O(V,e,Y),u(e,t),u(t,n),u(n,s),pe(o,s,null),u(n,l),u(n,r),u(r,a),a.innerHTML=d,u(r,p),u(r,v),u(v,m),u(m,f),u(m,g),u(m,_),u(v,b),u(v,M),u(v,T),u(v,y),u(y,F),u(y,D),u(y,E),u(E,w),u(v,k),u(v,S),u(S,x),u(S,J),u(S,B),u(r,Fe),u(r,ee),u(ee,Q),u(Q,j),u(Q,Ee),u(Ee,W),W.checked=W.__value===i[2].viewMode,u(Ee,We),u(Q,Ue),u(Q,re),u(re,U),U.checked=U.__value===i[2].viewMode,u(re,je),u(ee,te),u(ee,de),u(ee,fe),u(ee,ge),u(ge,he),pe(ye,he,null),u(he,Ye),u(ge,Te),q&&q.m(ge,null),G=!0,ke||(Xe=[N(W,"change",i[6]),N(U,"change",i[8]),N(he,"click",Mt(Ct(i[5])))],ke=!0)},p(V,[Y]){(!G||Y&1)&&d!==(d=Et(V[0].target_description)+"")&&(a.innerHTML=d),(!G||Y&1)&&P!==(P=V[0].sampleCount+"")&&me(w,P),Y&4&&(W.checked=W.__value===V[2].viewMode),Y&4&&(U.checked=U.__value===V[2].viewMode),V[1]?q?(q.p(V,Y),Y&2&&H(q,1)):(q=Zt(V),q.c(),H(q,1),q.m(ge,null)):q&&(xe(),$(q,1,1,()=>{q=null}),qe())},i(V){G||(H(o.$$.fragment,V),H(ye.$$.fragment,V),H(q),G=!0)},o(V){$(o.$$.fragment,V),$(ye.$$.fragment,V),$(q),G=!1},d(V){V&&I(e),ve(o),ve(ye),q&&q.d(),Re.r(),ke=!1,ae(Xe)}}}function kn(i,e,t){let n;we(i,Ze,f=>t(2,n=f));let{session:s}=e;const o=new Date(s.startTime*1e3).toLocaleString(void 0,{dateStyle:"long",timeStyle:"medium"}),l=s.cpuTime/s.duration;let r=!1;function a(f){t(1,r=!r)}const d=[[]];function p(){n.viewMode=this.__value,Ze.set(n)}function v(){n.viewMode=this.__value,Ze.set(n)}const m=()=>t(1,r=!1);return i.$$set=f=>{"session"in f&&t(0,s=f.session)},[s,r,n,o,l,a,p,d,v,m]}class Cn extends ue{constructor(e){super(),ce(this,e,kn,En,oe,{session:0})}}const Mn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAWmSURBVHgBtVc7i11VFF5rn3PvPKoLFlqmDGPhaGVpJQoWAZEEGxERFBsDgnY6KFpaWWrQysRGf4BgmSKQFCKWKQMKTqNzz2svv/XY55ybeycTCw+z736cs/f61rdee5hmz/Hx85c66m4QyTEzrdAo4cd6EuuJ2P4wtbmUgfZkCyRoWVcwyMI29ybW47sfhRfXf793+z4X4ZchPEl3F2esElYrbRVaEjQGEKGE3jcUofGwlIEBygoACAa0fmDrdV4AOAg6FV4+W49nUPdlEW4AElGNtqjZ+hqIdI2NAC7KuvAZloyJCR+IukGmF5A6iH/IbEBWLN2NevbBFQ6tCoAF3u7VggYQtQJyFlygOAADI74Jf669QDiWWh6xFRMUgLF6PAGYkcgGgGkBE/x8AiSVaykG0AUxlgm7BY0BUMAQL8R77LM96F98A98kBeu+kAdlgA0MntUGACmOFDQl5sm+Rai6lwpMLtiEgSVGE8wVFBkAB7XcU+rdJOoLSU0x8Aii3ta/0AWqMHjlM6LDPaYDHLSsnRn9pjMny2jBCDSu9H3tDqpCmw4C6lgHqAQmWB05uwwF8RCAQpU7jIbQYCElBsjAlabfqJdnD7lKwzVcIVVOgmKpF2g921pS8/QRvuETmwDEKZdwFHMocYHffYSfBc0opojVIomjx/dY64CkxVktMsgar16/IhbKygANruwWA+YDkURUcNHQaK5ps1XhBwaAzf6M9YzWq3Ac1EKACm80cB8KV6IdPsCR0aQAMBAaUkxXPyU6WDqlypKaSEOtmCCpDyAKFgu1gSecrhdar4n++VsiGUVWDHUpdJkYEPEkEyDc7paHTShXbkuNhqQfaF5wMt16lff69JYFFYT3A8AYgFxku5xtBtw9R7YsEiH85hcYLIsfuO0lfCCHvTtMWxszNRhDebp+LRsTGobFr0zBiO5tBnhWaZgiDwD5gi3Wiw+YcDAwoDfB+MaFq83RsP8M5zSYdFjsBwfh9YAjErbyQLHNVNUsH2Dl2odCh4dE+0vQXjtI9YG2z05zOKvSbdR3eKdtLTbugVKzoOQxC+7KA5NtJPiXEZaH5xDglMrOBMHTWxdWhA/QVqtgEdx3EtVwSkDOxE4GHESpCZzcHLe+4gg3HA7P69jpfvutTA0GTQNNkXAs5UYJVjC593keik/JBohzALjQsXbrJtRksRgntzm7nVX4GnZumtC4D23N4aIAZWdv9LyZv+3IA87AlHY1HQu9+q7Qwb7nAQ01FbQ+g5NBaNOKA2jdD0bg4+UjzCrbqu6IgrLB6aLRF6KWB0ZNUj15QvLCRVa8PNanqiq7pM7kbVXDEvdaipMmHIRfBa2//aYC9WI5vjH6ydLsB1ezpePiK9PhYcoLnjSK5kljNUWqvXppKdVxo4XFhIsJ93gXy/8clxIvt0X7i4XrU8+1D+wGgKPGW/UCzHfew9VsXywVZxbz8GYdKqS4rCTfZ/NZvD8WA/Yxu/aW661F7q+cIbsXVO6EcVf3b0t9SIXFx9N+kwEO3w8QVmhggq+/9xSroVdiv5TZlr0SanL6/KXOK5SaL9b/G4DRdDzONZbPuAjXS4bnfPWBPrJkjhzpYbdR8OeXz62nvBt3HD3z3F/2f0Fyx9O7XL2HAoj7YG33AK8Bag4TrJlOa0DrrVtrj7DsPBtKlgstsZGIcOW+B0wvlMP1EOqcCh1rTldb+/Xcw2woqbaLeh/Vbl7vH/Vgx08TABrehO53ccJKK1ZWP+gjpRqAKdaN8jxLs5r7Bx5TMBm18kjxOOZ0ub/3flUW/nzw4PSJp568CT0vYXq5aGJgslc4o7doPI6dcis2eUq950Ug1DqF9NvQ/uVf79y5v+E1IptedEInNj+iT2L9Nfv9jf7gI/pFdP4D5rfoaYw/Lv+pReVRq/JOEEXOee/PAf7/PP8C3bt510T4rIwAAAAASUVORK5CYII=",Qt=ft({}),Jt=ft({});function gi(i){return i>.6?"#FF4159":i>.3?"#F5A623":i>.15?"#D8CB2A":i>.05?"#7ED321":"#58984f"}function ei(i,e,t){const n=i.slice();return n[21]=e[t],n}function ti(i){let e,t,n,s,o,l,r,a,d,p,v,m,f,g,_,b,M;return{c(){e=h("div"),t=h("div"),n=z("svg"),s=z("path"),o=A(),l=h("div"),r=L(i[6]),a=A(),d=h("div"),p=L(i[4]),v=A(),m=h("div"),f=L(i[5]),g=A(),_=h("div"),c(s,"d","M.937-.016L5.793 4.84.937 9.696z"),c(s,"fill",i[8]),c(s,"fill-rule","evenodd"),c(s,"fill-opacity",".582"),c(n,"width","6"),c(n,"height","10"),c(t,"class","frame-triangle svelte-7e9kco"),Me(t,"rotate",!i[9]),Z(t,"visibility",i[0].children.length>0?"visible":"hidden"),c(l,"class","time svelte-7e9kco"),Z(l,"color",i[8]),Z(l,"font-weight",i[11]<.15?500:600),c(d,"class","name svelte-7e9kco"),c(m,"class","code-position svelte-7e9kco"),c(e,"class","frame-description svelte-7e9kco"),c(e,"role","button"),c(e,"tabindex","0"),Me(e,"application-code",i[0].isApplicationCode),Me(e,"children-visible",!i[9]),Z(e,"padding-left",`${i[2]*35}px`),c(_,"class","visual-guide svelte-7e9kco"),Z(_,"left",`${i[2]*35+21}px`),Z(_,"background-color",i[8])},m(T,y){O(T,e,y),u(e,t),u(t,n),u(n,s),u(e,o),u(e,l),u(l,r),u(e,a),u(e,d),u(d,p),u(e,v),u(e,m),u(m,f),O(T,g,y),O(T,_,y),b||(M=[N(e,"keydown",i[14]),N(e,"click",Mt(Ct(i[12])))],b=!0)},p(T,y){y&256&&c(s,"fill",T[8]),y&512&&Me(t,"rotate",!T[9]),y&1&&Z(t,"visibility",T[0].children.length>0?"visible":"hidden"),y&64&&me(r,T[6]),y&256&&Z(l,"color",T[8]),y&16&&me(p,T[4]),y&32&&me(f,T[5]),y&1&&Me(e,"application-code",T[0].isApplicationCode),y&512&&Me(e,"children-visible",!T[9]),y&4&&Z(e,"padding-left",`${T[2]*35}px`),y&4&&Z(_,"left",`${T[2]*35+21}px`),y&256&&Z(_,"background-color",T[8])},d(T){T&&(I(e),I(g),I(_)),b=!1,ae(M)}}}function ii(i){let e,t,n,s,o=i[0].group.frames.length-1+"",l,r,a,d,p,v;return{c(){e=h("div"),t=h("div"),n=h("div"),n.innerHTML='',s=A(),l=L(o),r=L(" frames hidden ("),a=L(i[7]),d=L(")"),c(n,"class","group-triangle svelte-7e9kco"),Me(n,"rotate",i[10]),c(t,"class","group-header-button svelte-7e9kco"),c(e,"class","group-header svelte-7e9kco"),c(e,"role","button"),c(e,"tabindex","0"),Z(e,"padding-left",`${i[2]*35}px`)},m(m,f){O(m,e,f),u(e,t),u(t,n),u(t,s),u(t,l),u(t,r),u(t,a),u(t,d),p||(v=[N(e,"keydown",i[15]),N(e,"click",Mt(Ct(i[13])))],p=!0)},p(m,f){f&1024&&Me(n,"rotate",m[10]),f&1&&o!==(o=m[0].group.frames.length-1+"")&&me(l,o),f&128&&me(a,m[7]),f&4&&Z(e,"padding-left",`${m[2]*35}px`)},d(m){m&&I(e),p=!1,ae(v)}}}function ni(i){let e,t=[],n=new Map,s,o=dt(i[0].children);const l=r=>r[21].uuid;for(let r=0;r0&&ni(i);return{c(){e=h("div"),o&&o.c(),t=A(),l&&l.c(),n=A(),r&&r.c(),c(e,"class","frame svelte-7e9kco")},m(a,d){O(a,e,d),o&&o.m(e,null),u(e,t),l&&l.m(e,null),u(e,n),r&&r.m(e,null),s=!0},p(a,[d]){a[3]?o?o.p(a,d):(o=ti(a),o.c(),o.m(e,t)):o&&(o.d(1),o=null),a[0].group&&a[0].group.rootFrame==a[0]&&!a[9]?l?l.p(a,d):(l=ii(a),l.c(),l.m(e,n)):l&&(l.d(1),l=null),!a[9]&&a[0].children.length>0?r?(r.p(a,d),d&513&&H(r,1)):(r=ni(a),r.c(),H(r,1),r.m(e,null)):r&&(xe(),$(r,1,1,()=>{r=null}),qe())},i(a){s||(H(r),s=!0)},o(a){$(r),s=!1},d(a){a&&I(e),o&&o.d(),l&&l.d(),r&&r.d()}}}function _i(){const i='a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])',e=document.querySelector(".call-stack-view");if(!e)throw new Error("callStackElement not found");var t=Array.prototype.filter.call(e.querySelectorAll(i),function(n){return n.offsetWidth>0||n.offsetHeight>0||n===document.activeElement});return t}function oi(){const i=_i();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e+1];t&&t.focus()}}function ri(){const i=_i();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e-1];t&&t.focus()}}function Pn(i,e,t){let n,s,o,l,r;we(i,Jt,w=>t(16,o=w)),we(i,Qt,w=>t(17,l=w)),we(i,K,w=>t(18,r=w));let{frame:a}=e,{rootFrame:d}=e,{indent:p=0}=e,v;const m=a.time/d.time;let f,g;a.isSynthetic||a.filePathShort==null?g="":a.lineNo==null||a.lineNo===0?g=a.filePathShort:g=`${a.filePathShort}:${a.lineNo}`;let _,b=null;if(a.group){const w=a.group.libraries;w.length<4?b=w.join(", "):b=`${w[0]}, ${w[1]}, ${w[2]}...`}let M;M=gi(m);function T(w){y(a,!s,w.altKey)}function y(w,k,S=!0){if(Jt.update(x=>({...x,[w.uuid]:k})),S)for(const x of w.children)y(x,k,!0),w.group&&w.group.rootFrame==w&&F(w.group.id,!k)}function F(w,k){Qt.update(S=>({...S,[w]:k}))}function D(){a.group&&F(a.group.id,!n)}function E(w){let k=!0;w.key==="Enter"||w.key===" "?T(w):w.key==="ArrowLeft"&&!s?y(a,!0,w.altKey):w.key==="ArrowRight"&&s?y(a,!1,w.altKey):w.key==="ArrowUp"?ri():w.key==="ArrowDown"?oi():k=!1,k&&(w.preventDefault(),w.stopPropagation())}function P(w){let k=!0;w.key==="Enter"||w.key===" "?D():w.key==="ArrowLeft"&&a.group?F(a.group.id,!1):w.key==="ArrowRight"&&a.group?F(a.group.id,!0):w.key==="ArrowUp"?ri():w.key==="ArrowDown"?oi():k=!1,k&&(w.preventDefault(),w.stopPropagation())}return i.$$set=w=>{"frame"in w&&t(0,a=w.frame),"rootFrame"in w&&t(1,d=w.rootFrame),"indent"in w&&t(2,p=w.indent)},i.$$.update=()=>{var w,k;if(i.$$.dirty&131073&&(a.group?l[a.group.id??""]||((w=a.group)==null?void 0:w.rootFrame)===a||a.children.filter(S=>!S.group).length>1?t(3,v=!0):t(3,v=!1):t(3,v=!0)),i.$$.dirty&1&&(a.className?t(4,f=`${a.className}.${a.function}`):t(4,f=a.function)),i.$$.dirty&262145)if(r.timeFormat==="absolute")t(6,_=a.time.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:3}));else if(r.timeFormat==="proportion")t(6,_=`${(m*100).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}%`);else throw new Error("unknown timeFormat");i.$$.dirty&131073&&t(10,n=l[((k=a.group)==null?void 0:k.id)??""]===!0),i.$$.dirty&65537&&t(9,s=o[a.uuid]===!0)},[a,d,p,v,f,g,_,b,M,s,n,m,T,D,E,P,o,l,r]}let wi=class extends ue{constructor(e){super(),ce(this,e,Pn,Fn,oe,{frame:0,rootFrame:1,indent:2})}};function bi(i,e,t){let n=i;for(const s of e)if(n=s(n,t),!n)return null;return n}const Ln="\0",Rn="[await]",et="[self]",Sn="[out-of-context]",In="[root]",On=[Rn,et,Sn,In],Dn="c",Hn="h";class Je{constructor(e,t){C(this,"uuid",ht());C(this,"identifier");C(this,"_identifierParts");C(this,"startTime");C(this,"time",0);C(this,"absorbedTime",0);C(this,"group",null);C(this,"attributes");C(this,"_children",[]);C(this,"parent",null);C(this,"context");var o;this.identifier=e.identifier,this._identifierParts=this.identifier.split(Ln),this.startTime=e.startTime??0,this.time=e.time??0,this.attributes=e.attributes??{},this.context=t;let n=this.startTime;const s=(o=e.children)==null?void 0:o.map(l=>(l.startTime===void 0&&(l={...l,startTime:n},n+=l.time??0),n=l.startTime+(l.time??0),new Je(l,t)));s&&this.addChildren(s)}cloneDeep(){return new Je(this,this.context)}get children(){return this._children}addChild(e,t={}){if(e.removeFromParent(),e.parent=this,t.after){const n=this._children.indexOf(t.after);if(n==-1)throw new Error("After frame not found");this._children.splice(n+1,0,e)}else this._children.push(e)}addChildren(e,t={}){e=e.slice(),t.after?(e.slice().reverse(),e.forEach(s=>this.addChild(s,t))):e.forEach(n=>this.addChild(n,t))}removeFromParent(){if(this.parent){const e=this.parent._children.indexOf(this);this.parent._children.splice(e,1),this.parent=null}}getAttributes(e){return Object.keys(this.attributes).filter(n=>n.startsWith(e)).map(n=>({data:n.slice(1),time:this.attributes[n]}))}getAttributeValue(e){const t=this.getAttributes(e);if(!t||t.length==0)return null;let n=0;for(let s=0;st[n].time&&(n=s);return t[n].data}get hasTracebackHide(){return this.getAttributeValue(Hn)=="1"}get function(){return this._identifierParts[0]}get filePath(){return this._identifierParts[1]??null}get lineNo(){const e=this._identifierParts[2];return e?parseInt(e):null}get isSynthetic(){return On.includes(this.identifier)}get filePathShort(){return this.isSynthetic&&this.parent?this.parent.filePathShort:this.filePath?this.context.shortenPath(this.filePath):null}get isApplicationCode(){if(this.isSynthetic)return!1;const e=this.filePath;return!e||this.context.sysPrefixes.some(n=>e.startsWith(n))?!1:e.startsWith("<")?e.startsWith(""||e==""?this.parent?this.parent.isApplicationCode:!0:!1:!0}get proportionOfParent(){return this.parent?this.time/this.parent.time:1}get className(){return this.getAttributeValue(Dn)??""}get library(){const e=this.filePathShort;return e?/^[\\/.]*[^\\/.]*/.exec(e)[0]??"":null}}class Vn{constructor(e){C(this,"id");C(this,"rootFrame");C(this,"_frames",[]);this.id=ht(),this.rootFrame=e}addFrame(e){e.group&&e.group.removeFrame(e),this._frames.push(e),e.group=this}removeFrame(e){if(e.group!==this)throw new Error("Frame not in group.");const t=this._frames.indexOf(e);if(t===-1)throw new Error("Frame not found in group.");this._frames.splice(t,1),e.group=null}get frames(){return this._frames}get exitFrames(){const e=[];for(const t of this.frames){let n=!1;for(const s of t.children)if(s.group!=this){n=!0;break}n&&e.push(t)}return e}get libraries(){const e=[];for(const t of this.frames){const n=t.library;n&&(e.includes(n)||e.push(n))}return e}}function mt(i,e){const{replaceWith:t}=e,n=i.parent;if(!n)throw new Error("Cannot delete the root frame");if(t=="children")n.addChildren(i.children,{after:i});else if(t=="self_time")n.addChild(new Je({identifier:et,time:i.time},n.context),{after:i});else if(t=="nothing")n.absorbedTime+=i.time;else throw new on(t);i.removeFromParent(),Lt(i,!0)}function Nn(i,e){if(i.parent!==e.parent)throw new Error("Both frames must have the same parent.");e.absorbedTime+=i.absorbedTime,e.time+=i.time,Object.entries(i.attributes).forEach(([t,n])=>{e.attributes[t]!==void 0?e.attributes[t]+=n:e.attributes[t]=n}),e.addChildren(i.children),i.removeFromParent(),Lt(i,!1)}function Lt(i,e){if(e&&i.children&&i.children.forEach(t=>{Lt(t,!0)}),i.group){const t=i.group;t.removeFrame(i),t.frames.length===1&&t.removeFrame(t.frames[0])}}function Rt(i,e){if(!i)return null;for(const t of i.children)Rt(t),t.filePath&&t.filePath.includes("yi(n)),i._children.sort((n,s)=>s.time-n.time),i}function Ti(i,e){if(!i)return null;const t=e.hideRegex,n=e.showRegex;function s(l){const r=l.filePath||"",a=n&&new RegExp(n).test(r),d=t&&new RegExp(t).test(r);return a?!1:d?!0:!l.isApplicationCode}function o(l,r){r.addFrame(l),l.children.forEach(a=>{s(a)&&o(a,r)})}return i.children.forEach(l=>{if(!l.group&&s(l)&&l.children.some(s)){const r=new Vn(l);o(l,r)}Ti(l,e)}),i}function Ai(i,e,t=!0){if(!i)return null;let n=null;for(const s of i.children)s.identifier===et?n?(n.time+=s.time,s.removeFromParent()):n=s:n=null;return t&&i.children.forEach(s=>Ai(s,e,!0)),i}function Ei(i,e){return i?(i.children.length===1&&i.children[0].identifier===et&&mt(i.children[0],{replaceWith:"nothing"}),i.children.forEach(t=>Ei(t)),i):null}function ki(i,e,t=null){if(!i)return null;t===null&&(t=i.time,t<=0&&(t=1e-44));const n=e.filterThreshold??.01;for(const s of i.children.slice())s.time/tki(s,e,t)),i}function Ci(i,e){if(!i)return null;const t=r=>fn(r,a=>a.time),n=r=>{var a;return((a=r.filePath)==null?void 0:a.includes("pyinstrument/__main__.py"))&&r.children.length>0},s=r=>{var a;return r.proportionOfParent>.8&&((a=r.filePath)==null?void 0:a.includes(""))&&r.children.length>0},o=r=>{var a;return r.proportionOfParent>.8&&(new RegExp(".*runpy.py").test(r.filePath??"")||((a=r.filePath)==null?void 0:a.includes("")))&&r.children.length>0};let l=i;if(!n(l)||(l=t(l.children),!s(l))||(l=t(l.children),!o(l)))return i;for(;o(l);)l=t(l.children);return l.removeFromParent(),l}function Mi(i,e){return i?(i.children.forEach(t=>Mi(t)),i.group&&i.group.frames.length<3&&i.group.removeFrame(i),i):null}function Bn(i){let e,t,n;return t=new wi({props:{frame:i[3],rootFrame:i[3]}}),{c(){e=h("div"),be(t.$$.fragment),c(e,"class","call-stack-margins svelte-1hebm9u")},m(s,o){O(s,e,o),pe(t,e,null),n=!0},p(s,o){const l={};o&8&&(l.frame=s[3]),o&8&&(l.rootFrame=s[3]),t.$set(l)},i(s){n||(H(t.$$.fragment,s),n=!0)},o(s){$(t.$$.fragment,s),n=!1},d(s){s&&I(e),ve(t)}}}function zn(i){let e;return{c(){e=h("div"),e.innerHTML='
All frames were filtered out.
',c(e,"class","margins")},m(t,n){O(t,e,n)},p:R,i:R,o:R,d(t){t&&I(e)}}}function $n(i){let e,t,n,s,o,l,r;const a=[zn,Bn],d=[];function p(v,m){return v[3]?1:0}return n=p(i),s=d[n]=a[n](i),{c(){e=h("div"),t=h("div"),s.c(),o=A(),l=h("div"),c(t,"class","scroll-inner svelte-1hebm9u"),c(l,"class","scroll-size-fixer svelte-1hebm9u"),c(e,"class","call-stack-view svelte-1hebm9u")},m(v,m){O(v,e,m),u(e,t),d[n].m(t,null),i[7](t),u(e,o),u(e,l),i[8](l),i[9](e),r=!0},p(v,[m]){let f=n;n=p(v),n===f?d[n].p(v,m):(xe(),$(d[f],1,1,()=>{d[f]=null}),qe(),s=d[n],s?s.p(v,m):(s=d[n]=a[n](v),s.c()),H(s,1),s.m(t,null))},i(v){r||(H(s),r=!0)},o(v){$(s),r=!1},d(v){v&&I(e),d[n].d(),i[7](null),i[8](null),i[9](null)}}}function xn(i,e,t){let n,{session:s}=e;const o=vi([K],([f])=>{const g=[f.removeImportlib?Rt:null,f.removeTracebackHide?St:null,Ai,yi,Ei,f.removeIrrelevant?ki:null,f.removePyinstrument?Ci:null,f.collapseMode!=="disabled"?Ti:null,Mi].filter(b=>b!==null),_={filterThreshold:f.removeIrrelevantThreshold,hideRegex:f.collapseMode=="custom"?f.collapseCustomHide:void 0,showRegex:f.collapseMode=="custom"?f.collapseCustomShow:void 0};return{processors:g,options:_}});we(i,o,f=>t(6,n=f));let l,r,a;Tt(()=>{let f=0;const g=l;if(!g)throw new Error("element not set");if(!r)throw new Error("scrollInnerElement not set");if(!a)throw new Error("scrollSizeFixerElement not set");const _=new ResizeObserver(()=>{const M=r.getBoundingClientRect().height;M>f&&(f=M,t(2,a.style.top=`${f-1}px`,a))});_.observe(r);let b;return g.addEventListener("scroll",b=()=>{let M=g.scrollTop+g.clientHeight;const T=r.getBoundingClientRect().height;M{_.disconnect(),g.removeEventListener("scroll",b)}});let d;function p(f){Ae[f?"unshift":"push"](()=>{r=f,t(1,r)})}function v(f){Ae[f?"unshift":"push"](()=>{a=f,t(2,a)})}function m(f){Ae[f?"unshift":"push"](()=>{l=f,t(0,l)})}return i.$$set=f=>{"session"in f&&t(5,s=f.session)},i.$$.update=()=>{i.$$.dirty&96&&t(3,d=bi(s.rootFrame.cloneDeep(),n.processors,n.options))},[l,r,a,d,o,s,n,p,v,m]}class qn extends ue{constructor(e){super(),ce(this,e,xn,$n,oe,{session:5})}}class Wn{constructor(e){C(this,"mediaQueryList",null);this.onDevicePixelRatioChanged=e,this._onChange=this._onChange.bind(this),this.createMediaQueryList()}createMediaQueryList(){this.removeMediaQueryList();let e=`(resolution: ${window.devicePixelRatio}dppx)`;this.mediaQueryList=matchMedia(e),this.mediaQueryList.addEventListener("change",this._onChange)}removeMediaQueryList(){var e;(e=this.mediaQueryList)==null||e.removeEventListener("change",this._onChange),this.mediaQueryList=null}_onChange(e){this.onDevicePixelRatioChanged(),this.createMediaQueryList()}destroy(){this.removeMediaQueryList()}}class Un{constructor(e){C(this,"canvas");C(this,"_size_observer");C(this,"_devicePixelRatioObserver");C(this,"drawAnimationRequest",null);this.container=e,getComputedStyle(e).position!="absolute"&&(e.style.position="relative"),this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.left="0",this.canvas.style.top="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.container.appendChild(this.canvas),this.setCanvasSize=this.setCanvasSize.bind(this),this._size_observer=new ResizeObserver(this.setCanvasSize),this._size_observer.observe(e),this._devicePixelRatioObserver=new Wn(this.setCanvasSize),window.requestAnimationFrame(()=>{this.setCanvasSize()})}destroy(){this._size_observer.disconnect(),this._devicePixelRatioObserver.destroy(),this.canvas.remove(),this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null)}setNeedsRedraw(){this.drawAnimationRequest===null&&(this.drawAnimationRequest=window.requestAnimationFrame(()=>{this.drawAnimationRequest=null,this.canvasViewRedraw()}))}redrawIfNeeded(){this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null,this.canvasViewRedraw())}canvasViewRedraw(){const e=this.canvas.getContext("2d");e&&(e.resetTransform(),e.scale(window.devicePixelRatio,window.devicePixelRatio),this.redraw(e,{width:this.canvas.width/window.devicePixelRatio,height:this.canvas.height/window.devicePixelRatio}))}get width(){return this.canvas.width/window.devicePixelRatio}get height(){return this.canvas.height/window.devicePixelRatio}setCanvasSize(){const e=window.devicePixelRatio;this.canvas.height=this.container.clientHeight*e,this.canvas.width=this.container.clientWidth*e,this.canvasViewRedraw()}}function jn(i){let e,t=i[2]=="self"?"self":"time",n,s,o,l=i[3](i[0].time)+"";return{c(){e=h("div"),n=L(t),s=A(),o=h("div"),c(e,"class","label svelte-ci3g2p"),c(o,"class","time-val svelte-ci3g2p")},m(r,a){O(r,e,a),u(e,n),O(r,s,a),O(r,o,a),o.innerHTML=l},p(r,a){a&4&&t!==(t=r[2]=="self"?"self":"time")&&me(n,t),a&1&&l!==(l=r[3](r[0].time)+"")&&(o.innerHTML=l)},d(r){r&&(I(e),I(s),I(o))}}}function Yn(i){let e,t,n,s,o=i[3](i[0].time)+"",l,r=i[0].selfTime/i[0].time>.001&&li(i);return{c(){e=h("div"),e.textContent="time",t=A(),n=h("div"),s=h("div"),l=A(),r&&r.c(),c(e,"class","label svelte-ci3g2p"),c(s,"class","time-val svelte-ci3g2p"),c(n,"class","time-row svelte-ci3g2p")},m(a,d){O(a,e,d),O(a,t,d),O(a,n,d),u(n,s),s.innerHTML=o,u(n,l),r&&r.m(n,null)},p(a,d){d&1&&o!==(o=a[3](a[0].time)+"")&&(s.innerHTML=o),a[0].selfTime/a[0].time>.001?r?r.p(a,d):(r=li(a),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},d(a){a&&(I(e),I(t),I(n)),r&&r.d()}}}function li(i){let e,t,n,s=i[3](i[0].selfTime)+"";return{c(){e=h("div"),e.textContent="self",t=A(),n=h("div"),c(e,"class","label svelte-ci3g2p"),c(n,"class","time-val svelte-ci3g2p")},m(o,l){O(o,e,l),O(o,t,l),O(o,n,l),n.innerHTML=s},p(o,l){l&1&&s!==(s=o[3](o[0].selfTime)+"")&&(n.innerHTML=s)},d(o){o&&(I(e),I(t),I(n))}}}function Xn(i){let e,t,n=i[0].name+"",s,o,l,r,a,d,p,v,m,f;function g(M,T){return M[2]=="both"?Yn:jn}let _=g(i),b=_(i);return{c(){e=h("div"),t=h("div"),s=L(n),o=A(),b.c(),l=A(),r=h("div"),r.textContent="loc",a=A(),d=h("div"),p=h("div"),m=A(),f=new $i(!1),c(t,"class","name svelte-ci3g2p"),c(r,"class","label svelte-ci3g2p"),c(p,"class","location-color svelte-ci3g2p"),c(p,"style",v=`background: ${i[0].locationColor}`),f.a=null,c(d,"class","location-row"),c(e,"class","timeline-canvas-view-tooltip svelte-ci3g2p"),c(e,"style",`font: ${Pi}; max-width: ${Kn}px;`)},m(M,T){O(M,e,T),u(e,t),u(t,s),u(e,o),b.m(e,null),u(e,l),u(e,r),u(e,a),u(e,d),u(d,p),u(d,m),f.m(i[1],d)},p(M,[T]){T&1&&n!==(n=M[0].name+"")&&me(s,n),_===(_=g(M))&&b?b.p(M,T):(b.d(1),b=_(M),b&&(b.c(),b.m(e,l))),T&1&&v!==(v=`background: ${M[0].locationColor}`)&&c(p,"style",v),T&2&&f.p(M[1])},i:R,o:R,d(M){M&&I(e),b.d()}}}function Fi(i){return i.selfTime==i.time?"self":i.selfTime/i.time>.001?"both":"time"}function Gn(i,e){i.font=Pi;const t=Fi(e)=="both"?140:70,n=i.measureText(e.name).width,s=i.measureText(e.location).width+46;let l=Math.max(t,n,s)+20;return l>310&&(l=310),l}const Kn=310,Pi="400 13px Source Sans Pro, sans-serif";function Zn(i,e,t){let{f:n}=e,s,o;function l(r){return`${r.toFixed(3)}`}return i.$$set=r=>{"f"in r&&t(0,n=r.f)},i.$$.update=()=>{i.$$.dirty&1&&t(1,s=Et(n.location)),i.$$.dirty&1&&t(2,o=Fi(n))},[n,s,o,l]}class Qn extends ue{constructor(e){super(),ce(this,e,Zn,Xn,oe,{f:0})}}const Jn="#212325",ai=18,es=17,Pe=28,at=17,ci=29,ts=["#3475BA","#318DBC","#47A298","#8AAE5D","#C1A731","#C07210","#B84210","#B53134","#9A3586","#4958B5","#3475BA"],is=ts.map(cn);class ns extends Un{constructor(t){super(t);C(this,"zoom",1);C(this,"startT",0);C(this,"yOffset",0);C(this,"frames",[]);C(this,"isZoomedIn",!1);C(this,"tooltipContainer");C(this,"tooltipComponent",null);C(this,"_rootFrame",null);C(this,"maxDepth",0);C(this,"tooltipLocation",null);C(this,"lastDrawWidth",0);C(this,"lastDrawHeight",0);C(this,"_libraryOrder",null);C(this,"_colors",[]);C(this,"_frameMaxT");C(this,"mouseLocation",null);C(this,"mouseDownLocation",null);C(this,"touches",{});this.onWheel=this.onWheel.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.windowMouseUp=this.windowMouseUp.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onTouchcancel=this.onTouchend.bind(this),this.canvas.addEventListener("wheel",this.onWheel),this.canvas.addEventListener("mousemove",this.onMouseMove),this.canvas.addEventListener("mouseleave",this.onMouseLeave),this.canvas.addEventListener("mousedown",this.onMouseDown),this.canvas.addEventListener("touchstart",this.onTouchstart),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend),this.canvas.addEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer=document.createElement("div"),this.tooltipContainer.style.position="absolute",this.tooltipContainer.style.pointerEvents="none",this.container.appendChild(this.tooltipContainer)}destroy(){this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("mousemove",this.onMouseMove),this.canvas.removeEventListener("mouseleave",this.onMouseLeave),this.canvas.removeEventListener("mousedown",this.onMouseDown),this.canvas.removeEventListener("touchstart",this.onTouchstart),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend),this.canvas.removeEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer.remove(),super.destroy()}setRootFrame(t){this._rootFrame=t,this.frames=[],this._frameMaxT=void 0,this.maxDepth=0,this._collectFrames(t,0),this.fitContents(),this.setNeedsRedraw()}_collectFrames(t,n){this.frames.push({frame:t,depth:n,isApplicationCode:t.isApplicationCode,library:t.library,className:t.className,filePathShort:t.filePathShort}),this.maxDepth=Math.max(this.maxDepth,n);for(const s of t.children)s.identifier!==et&&this._collectFrames(s,n+1)}updateTooltip(t,n){var s;if(n){const o={name:this.frameName(n),time:n.frame.time,selfTime:this.frameSelfTime(n),totalTime:((s=this._rootFrame)==null?void 0:s.time)??1e-12,location:`${n.filePathShort}:${n.frame.lineNo}`,locationColor:this.colorForFrame(n)};if(this.tooltipComponent?this.tooltipComponent.$set({f:o}):this.tooltipComponent=new Qn({target:this.tooltipContainer,props:{f:o}}),this.tooltipLocation){const l={x:this.tooltipLocation.x+12,y:this.tooltipLocation.y+12},r=Gn(t,o),a=this.width-10-r;l.x>a&&(l.x=a);const p=this.height-10-60;l.y>p&&(l.y=p),this.tooltipContainer.style.left=`${l.x}px`,this.tooltipContainer.style.top=`${l.y}px`}}n||this.tooltipComponent&&(this.tooltipComponent.$destroy(),this.tooltipComponent=null)}redraw(t,n){const{width:s,height:o}=n;(s!==this.lastDrawWidth||o!==this.lastDrawHeight)&&(this.isZoomedIn?this.clampViewport():this.fitContents()),this.lastDrawWidth=s,this.lastDrawHeight=o,t.fillStyle=Jn,t.fillRect(0,0,s,o),this.drawAxes(t);for(const d of this.frames)this.drawFrame(t,d);t.globalAlpha=1;const l=this.maxYOffset>0||this.isZoomedIn,r=!!this.mouseDownLocation;this.canvas.style.cursor=r&&l?"grabbing":"initial",t.fillStyle="red",t.font='23px "Source Sans Pro", sans-serif';let a=null;!r&&this.tooltipLocation&&(a=this.hitTest(this.tooltipLocation)),this.updateTooltip(t,a)}drawAxes(t){const n=Math.max(800,this.width)/this.zoom;if(n==0)return;const s=Math.log10(n);let o=Math.ceil(s)+2;o<0&&(o=0);const l=Math.ceil(s)-3,r=a=>ze(a,{from:[s,s-3],to:[.71,0],clamp:!0});for(let a=l;a.01){t.globalAlpha=f,t.font='13px "Source Sans Pro", sans-serif';let g=d.toFixed(a);g=="0"&&(g="0s");let _=m+10;t.fillText(g,p+3,_);let b=this.height+at+10-this.yOffset;bthis.width)return;if(t.fillStyle=this.colorForFrame(n),t.globalAlpha=n.isApplicationCode?1:.5,l<2){t.fillRect(s,o,l,r);return}let d=this.frameName(n);const p=Math.floor(l/3.3);if(d.length>p&&(d=d.substring(0,p)),d.length==0){t.fillRect(s,o,l,r);return}t.save(),t.beginPath(),t.rect(s,o,l,r),t.fill(),t.clip(),t.font='13px "Source Sans Pro", sans-serif',t.fillStyle="white";let v=s;v<0&&(v=0),t.fillText(d,v+2,o+13),t.restore()}_assignLibraryOrder(){const t={};for(const s of this.frames){const l=s.frame.library??"";t[l]=(t[l]||0)+s.frame.time}const n=Object.keys(t);n.sort((s,o)=>t[o]-t[s]),this._libraryOrder=n}colorForLibraryIndex(t){if(this._colors[t]!==void 0)return this._colors[t];const n=Math.pow(2,Math.ceil(Math.log2(t+1))),o=(2*t-n+1)/n,l=rn(is,o);return this._colors[t]=l,l}libraryIndexForFrame(t){this._libraryOrder||this._assignLibraryOrder();const n=t.library||"";let s=this._libraryOrder.indexOf(n);return s===-1&&(s=this._libraryOrder.length,this._libraryOrder.push(n)),s}colorForFrame(t){const n=this.libraryIndexForFrame(t);return this.colorForLibraryIndex(n)}get frameMaxT(){return this._frameMaxT===void 0&&(this._frameMaxT=this.frames.reduce((t,n)=>Math.max(t,n.frame.startTime+n.frame.time),0)),this._frameMaxT}get maxYOffset(){return Math.max(0,(this.maxDepth+1)*ai+at*2+ci-this.height)}get minZoom(){return(this.width-2*Pe)/this.frameMaxT}get maxZoom(){return 10/15e-8}fitContents(){this.startT=0,this.zoom=this.minZoom,this.isZoomedIn=!1}clampViewport(){this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.startT<0&&(this.startT=0);const t=this.frameMaxT-(this.width-2*Pe)/this.zoom;this.startT>t&&(this.startT=t),this.yOffset<0&&(this.yOffset=0),this.yOffset>this.maxYOffset&&(this.yOffset=this.maxYOffset)}frameDims(t){const n=t.depth*ai+at+ci-this.yOffset,s=es;let o=this.xForT(t.frame.startTime),r=this.xForT(t.frame.startTime+t.frame.time)-o;return r<1&&(r=1),r>1&&(r-=ze(r,{from:[1,3],to:[0,1],clamp:!0})),{x:o,y:n,w:r,h:s}}xForT(t){return(t-this.startT)*this.zoom+Pe}tForX(t){return(t-Pe)/this.zoom+this.startT}frameName(t){let n;return t.className?n=`${t.className}.${t.frame.function}`:t.frame.function==""?n=t.filePathShort??t.frame.filePath??"":n=t.frame.function,n}frameSelfTime(t){let n=t.frame.time;const s=t.frame.children.filter(o=>!o.isSynthetic);for(const o of s)n-=o.time;return n}hitTest(t){for(const n of this.frames){const{x:s,y:o,w:l,h:r}=this.frameDims(n);if(t.x>=s&&t.x<=s+l&&t.y>=o&&t.y<=o+r)return n}return null}onWheel(t){const n=t.ctrlKey||t.metaKey,s=n?.01:.0023,o=this.tForX(t.offsetX);this.zoom*=1-t.deltaY*s,this.clampViewport(),this.startT=o-(t.offsetX-Pe)/this.zoom,n||(this.startT+=t.deltaX/this.zoom),this.clampViewport(),this.setNeedsRedraw(),t.preventDefault()}onMouseMove(t){const n={x:t.offsetX,y:t.offsetY},s=this.mouseLocation;if(this.mouseLocation=n,s&&this.mouseDownLocation){const o={x:n.x-s.x,y:n.y-s.y};this.startT-=o.x/this.zoom,this.yOffset-=o.y,this.clampViewport()}this.tooltipLocation=n,this.setNeedsRedraw()}onMouseLeave(t){this.mouseLocation=null,this.tooltipLocation=null,this.setNeedsRedraw()}onMouseDown(t){(t.button===0||t.button===1)&&(this.mouseDownLocation={x:t.offsetX,y:t.offsetY},window.addEventListener("mouseup",this.windowMouseUp),this.setNeedsRedraw())}windowMouseUp(t){window.removeEventListener("mouseup",this.windowMouseUp),this.mouseDownLocation=null,this.setNeedsRedraw()}onTouchstart(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))this.touches[n.identifier]={x:n.clientX,y:n.clientY,downT:this.tForX(n.clientX),startDate:Date.now(),downX:n.clientX,downY:n.clientY}}onTouchmove(t){t.preventDefault(),t.stopPropagation();let n=0;for(const o of Array.from(t.changedTouches)){const l=this.touches[o.identifier];l&&(n+=o.clientY-l.y,this.touches[o.identifier]={...l,x:o.clientX,y:o.clientY})}const s=n/Object.keys(this.touches).length;this.yOffset-=s,this.adjustXAxisForTouches(),this.setNeedsRedraw()}onTouchend(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}onTouchcancel(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}adjustXAxisForTouches(){const t=Object.keys(this.touches).map(Number);if(t.length!=0){if(t.length==1){const n=this.touches[t[0]];this.startT=n.downT-(n.x-Pe)/this.zoom}if(t.length>=2){const n=this.touches[t[0]],s=this.touches[t[1]],o=(s.x-n.x)/(s.downT-n.downT),l=n.downT-(n.x-Pe)/o;this.startT=l,this.zoom=o}this.clampViewport()}}}function ss(i){let e;return{c(){e=h("div"),e.innerHTML="",c(e,"class","timeline svelte-p2tt1k")},m(t,n){O(t,e,n),i[6](e)},p:R,i:R,o:R,d(t){t&&I(e),i[6](null)}}}function os(i,e,t){let n,{session:s}=e;const o=vi([Ge],([p])=>({processors:[p.removeImportlib?Rt:null,p.removeTracebackHide?St:null,p.removePyinstrument?Ci:null].filter(f=>f!==null),options:{}}));we(i,o,p=>t(5,n=p));let l,r=null,a=null;xi(()=>{a==null||a.destroy()});function d(p){Ae[p?"unshift":"push"](()=>{r=p,t(0,r)})}return i.$$set=p=>{"session"in p&&t(2,s=p.session)},i.$$.update=()=>{i.$$.dirty&36&&t(3,l=bi(s.rootFrame.cloneDeep(),n.processors,n.options)),i.$$.dirty&1&&r&&t(4,a=new ns(r)),i.$$.dirty&24&&l&&a&&a.setRootFrame(l)},[r,o,s,l,a,n,d]}class rs extends ue{constructor(e){super(),ce(this,e,os,ss,oe,{session:2})}}function ls(i){let e,t,n=i[1].viewMode+"",s;return{c(){e=h("div"),t=L("Unknown view mode: "),s=L(n),c(e,"class","error")},m(o,l){O(o,e,l),u(e,t),u(e,s)},p(o,l){l&2&&n!==(n=o[1].viewMode+"")&&me(s,n)},i:R,o:R,d(o){o&&I(e)}}}function as(i){let e,t;return e=new rs({props:{session:i[0]}}),{c(){be(e.$$.fragment)},m(n,s){pe(e,n,s),t=!0},p(n,s){const o={};s&1&&(o.session=n[0]),e.$set(o)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ve(e,n)}}}function cs(i){let e,t;return e=new qn({props:{session:i[0]}}),{c(){be(e.$$.fragment)},m(n,s){pe(e,n,s),t=!0},p(n,s){const o={};s&1&&(o.session=n[0]),e.$set(o)},i(n){t||(H(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ve(e,n)}}}function us(i){let e;return{c(){e=h("div"),e.innerHTML='
No samples recorded.
',c(e,"class","margins")},m(t,n){O(t,e,n)},p:R,i:R,o:R,d(t){t&&I(e)}}}function ds(i){let e,t,n,s,o,l,r,a;n=new Cn({props:{session:i[0]}});const d=[us,cs,as,ls],p=[];function v(m,f){return m[0].rootFrame?m[1].viewMode==="call-stack"?1:m[1].viewMode==="timeline"?2:3:0}return l=v(i),r=p[l]=d[l](i),{c(){e=h("div"),t=h("div"),be(n.$$.fragment),s=A(),o=h("div"),r.c(),c(t,"class","header"),c(o,"class","body svelte-1vwroj7"),c(e,"class","app svelte-1vwroj7")},m(m,f){O(m,e,f),u(e,t),pe(n,t,null),u(e,s),u(e,o),p[l].m(o,null),a=!0},p(m,[f]){const g={};f&1&&(g.session=m[0]),n.$set(g);let _=l;l=v(m),l===_?p[l].p(m,f):(xe(),$(p[_],1,1,()=>{p[_]=null}),qe(),r=p[l],r?r.p(m,f):(r=p[l]=d[l](m),r.c()),H(r,1),r.m(o,null))},i(m){a||(H(n.$$.fragment,m),H(r),a=!0)},o(m){$(n.$$.fragment,m),$(r),a=!1},d(m){m&&I(e),ve(n),p[l].d()}}}function fs(i,e,t){let n;we(i,Ze,v=>t(1,n=v));let{session:s}=e;const o=document.createElement("link");o.rel="shortcut icon",o.href=Mn,document.head.appendChild(o);const l=document.createElement("link");l.rel="preload",l.as="style",l.onload=()=>{l.rel="stylesheet"},l.href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,600&display=swap",document.head.appendChild(l);const r=s.rootFrame,a=r==null?void 0:r.time.toLocaleString(void 0,{maximumSignificantDigits:3});let d,p;return(p=/[^\s/]+(:\d+)?$/.exec(s.target_description))?d=p[0]:d=s.target_description,document.title=`${a}s - ${d} - pyinstrument`,i.$$set=v=>{"session"in v&&t(0,s=v.session)},[s,n]}class hs extends ue{constructor(e){super(),ce(this,e,fs,ds,oe,{session:0})}}class ms{constructor(e){C(this,"startTime");C(this,"duration");C(this,"minInterval");C(this,"maxInterval");C(this,"sampleCount");C(this,"target_description");C(this,"cpuTime");C(this,"rootFrame");C(this,"sysPath");C(this,"sysPrefixes");C(this,"_shortenPathCache",{});this.startTime=e.session.start_time,this.duration=e.session.duration,this.minInterval=e.session.min_interval,this.maxInterval=e.session.max_interval,this.sampleCount=e.session.sample_count,this.target_description=e.session.target_description,this.cpuTime=e.session.cpu_time,this.sysPath=e.session.sys_path,this.sysPrefixes=e.session.sys_prefixes,this.rootFrame=new Je(e.frame_tree,this)}shortenPath(e){if(this._shortenPathCache[e])return this._shortenPathCache[e];let t=e;if($e(e).length>1)for(const s of this.sysPath){const o=ps(e,s);$e(o).length<$e(t).length&&(t=o)}return this._shortenPathCache[e]=t,t}}function $e(i){return i.split(/[/\\]/)}function ui(i){const e=$e(i);return e.length>0&&e[0].endsWith(":")?e[0]:null}function ps(i,e){if(ui(i)!=ui(e))return i;const t=$e(i),n=$e(e);let s=0;for(;s"..").concat(t.slice(s)).join("/")}const vs={render(i,e){const t=new ms(e);return new hs({target:i,props:{session:t}})}};function di(i,e,t){const n=i.slice();return n[10]=e[t],n}function fi(i){let e,t=i[10].name+"",n;return{c(){e=h("option"),n=L(t),e.__value=i[10],le(e,e.__value)},m(s,o){O(s,e,o),u(e,n)},p:R,d(s){s&&I(e)}}}function gs(i){let e,t,n=i[3].message+"",s;return{c(){e=h("div"),t=L("Error loading file: "),s=L(n)},m(o,l){O(o,e,l),u(e,t),u(e,s)},p(o,l){l&8&&n!==(n=o[3].message+"")&&me(s,n)},d(o){o&&I(e)}}}function _s(i){let e;return{c(){e=h("div"),e.textContent="Loading..."},m(t,n){O(t,e,n)},p:R,d(t){t&&I(e)}}}function ws(i){let e,t,n,s,o,l,r,a,d,p,v,m,f,g,_=dt(i[5]),b=[];for(let F=0;F<_.length;F+=1)b[F]=fi(di(i,_,F));function M(F,D){if(F[4])return _s;if(F[3])return gs}let T=M(i),y=T&&T(i);return{c(){e=h("div"),t=h("div"),n=h("div"),s=A(),o=h("div"),l=L(`Choose a demo profile: + `),r=h("select");for(let F=0;Fi[7].call(r)),c(o,"class","right"),c(t,"class","header svelte-1980ffz"),c(v,"class","result-element"),c(v,"style",m=i[1]?"":"display: none"),c(d,"class","body svelte-1980ffz"),c(e,"class","demo-app svelte-1980ffz")},m(F,D){O(F,e,D),u(e,t),u(t,n),u(t,s),u(t,o),u(o,l),u(o,r);for(let E=0;E_t(()=>import("./django_template_render-CIkNzFIy.js"),[],import.meta.url).then(f=>f.default),"../demo-data/sympy_calculation.json":()=>_t(()=>import("./sympy_calculation-B9Pn_4RL.js"),[],import.meta.url).then(f=>f.default),"../demo-data/wikipedia_article_word_count.json":()=>_t(()=>import("./wikipedia_article_word_count-CGt_pvsZ.js"),[],import.meta.url).then(f=>f.default)})).map(([f,g])=>({name:f.split("/").pop().split(".").slice(0,-1).join("."),promiseFn:g}));let o=s[0],l=null,r=null,a=!1,d=null,p;function v(){o=Bi(this),t(0,o),t(5,s)}function m(f){Ae[f?"unshift":"push"](()=>{p=f,t(2,p)})}return i.$$.update=()=>{i.$$.dirty&1&&(t(4,a=!0),t(3,r=null),t(1,l=null),o.promiseFn().then(f=>{t(1,l=f),t(3,r=null)}).catch(f=>{t(3,r=f)}).finally(()=>{t(4,a=!1)})),i.$$.dirty&70&&p&&l&&(d&&d.$destroy(),t(6,d=vs.render(p,l)))},[o,l,p,r,a,s,d,v,m]}class ys extends ue{constructor(e){super(),ce(this,e,bs,ws,oe,{})}}new ys({target:document.body}); diff --git a/docs/_static/preview/index.html b/docs/_static/preview/index.html index ac97fe4e..2b78d52c 100644 --- a/docs/_static/preview/index.html +++ b/docs/_static/preview/index.html @@ -5,7 +5,7 @@ Pyinstrument Demo - + diff --git a/html_renderer/src/components/Frame.svelte b/html_renderer/src/components/Frame.svelte index 4d4e8f95..a0633753 100644 --- a/html_renderer/src/components/Frame.svelte +++ b/html_renderer/src/components/Frame.svelte @@ -77,7 +77,16 @@ name = frame.function; } - const codePosition = `${frame.filePathShort}:${frame.lineNo?.toString().padEnd(4, " ")}`; + let codePosition: string + if (frame.isSynthetic) { + codePosition = ""; + } else if (frame.filePathShort == null) { + codePosition = ""; + } else if (frame.lineNo == null || frame.lineNo === 0) { + codePosition = frame.filePathShort; + } else { + codePosition = `${frame.filePathShort}:${frame.lineNo}`; + } let formattedTime: string; $: if ($viewOptionsCallStack.timeFormat === "absolute") { @@ -224,7 +233,7 @@
{formattedTime}
@@ -262,7 +271,7 @@ /> - {frame.group.frames.length} frames hidden ({groupLibrarySummary}) + {frame.group.frames.length-1} frames hidden ({groupLibrarySummary}) {/if} diff --git a/html_renderer/src/lib/color.ts b/html_renderer/src/lib/color.ts index a51219c2..2f2ca898 100644 --- a/html_renderer/src/lib/color.ts +++ b/html_renderer/src/lib/color.ts @@ -3,9 +3,11 @@ export function colorForFrameProportionOfTotal(proportion: number): string { return '#FF4159' } else if (proportion > 0.3) { return '#F5A623' - } else if (proportion > 0.2) { + } else if (proportion > 0.15) { return '#D8CB2A' - } else { + } else if (proportion > 0.05) { return '#7ED321' + } else { + return '#58984f' } } diff --git a/pyinstrument/renderers/html_resources/app.js b/pyinstrument/renderers/html_resources/app.js index b9efd967..07e51fd8 100644 --- a/pyinstrument/renderers/html_resources/app.js +++ b/pyinstrument/renderers/html_resources/app.js @@ -1,14 +1,14 @@ -var pyinstrumentHTMLRenderer=function(){"use strict";var is=Object.defineProperty;var ns=(M,ve,Pe)=>ve in M?is(M,ve,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):M[ve]=Pe;var T=(M,ve,Pe)=>ns(M,typeof ve!="symbol"?ve+"":ve,Pe);function M(){}function ve(i){return i()}function Pe(){return Object.create(null)}function oe(i){i.forEach(ve)}function pt(i){return typeof i=="function"}function re(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function ki(i){return Object.keys(i).length===0}function St(i,...e){if(i==null){for(const n of e)n(void 0);return M}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function ge(i,e,t){i.$$.on_destroy.push(St(e,t))}function Ci(i,e,t){return i.set(t),e}function u(i,e){i.appendChild(e)}function L(i,e,t){i.insertBefore(e,t||null)}function I(i){i.parentNode&&i.parentNode.removeChild(i)}function f(i){return document.createElement(i)}function x(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function R(i){return document.createTextNode(i)}function y(){return R(" ")}function Mi(){return R("")}function N(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function vt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function gt(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function a(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function _t(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Fi(i){return Array.from(i.childNodes)}function ye(i,e){e=""+e,i.data!==e&&(i.data=e)}function ae(i,e){i.value=e??""}function Z(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function Ee(i,e,t){i.classList.toggle(e,!!t)}function Pi(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}class Ri{constructor(e=!1){T(this,"is_svg",!1);T(this,"e");T(this,"n");T(this,"t");T(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=x(t.nodeName):this.e=f(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t{const s=i.$$.callbacks[e];if(s){const l=Pi(e,t,{cancelable:n});return s.slice().forEach(r=>{r.call(i,l)}),!l.defaultPrevented}return!0}}const Se=[],ke=[];let De=[];const Dt=[],Si=Promise.resolve();let yt=!1;function Di(){yt||(yt=!0,Si.then(Ht))}function Tt(i){De.push(i)}const At=new Set;let He=0;function Ht(){if(He!==0)return;const i=Ye;do{try{for(;Hei.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),De=e}const nt=new Set;let Re;function Oe(){Re={r:0,c:[],p:Re}}function Ve(){Re.r||oe(Re.c),Re=Re.p}function D(i,e){i&&i.i&&(nt.delete(i),i.i(e))}function $(i,e,t,n){if(i&&i.o){if(nt.has(i))return;nt.add(i),Re.c.push(()=>{nt.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function Ot(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Vi(i,e){$(i,1,1,()=>{e.delete(i.key)})}function xi(i,e,t,n,s,l,r,o,c,d,v,p){let m=i.length,h=l.length,_=m;const w={};for(;_--;)w[i[_].key]=_;const E=[],b=new Map,A=new Map,P=[];for(_=h;_--;){const k=p(s,l,_),S=t(k);let g=r.get(S);g?P.push(()=>g.p(k,e)):(g=d(S,k),g.c()),b.set(S,E[_]=g),S in w&&A.set(S,Math.abs(_-w[S]))}const H=new Set,W=new Set;function F(k){D(k,1),k.m(o,v),r.set(k.key,k),v=k.first,h--}for(;m&&h;){const k=E[h-1],S=i[m-1],g=k.key,C=S.key;k===S?(v=k.first,m--,h--):b.has(C)?!r.has(g)||H.has(g)?F(k):W.has(C)?m--:A.get(g)>A.get(C)?(W.add(g),F(k)):(H.add(C),m--):(c(S,r),m--)}for(;m--;){const k=i[m];b.has(k.key)||c(k,r)}for(;h;)F(E[h-1]);return oe(P),E}function _e(i){i&&i.c()}function ce(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),Tt(()=>{const l=i.$$.on_mount.map(ve).filter(pt);i.$$.on_destroy?i.$$.on_destroy.push(...l):oe(l),i.$$.on_mount=[]}),s.forEach(Tt)}function ue(i,e){const t=i.$$;t.fragment!==null&&(Oi(t.after_update),oe(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ni(i,e){i.$$.dirty[0]===-1&&(Se.push(i),Di(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<{const _=h.length?h[0]:m;return d.ctx&&s(d.ctx[p],d.ctx[p]=_)&&(!d.skip_bound&&d.bound[p]&&d.bound[p](_),v&&Ni(i,p)),m}):[],d.update(),v=!0,oe(d.before_update),d.fragment=n?n(d.ctx):!1,e.target){if(e.hydrate){const p=Fi(e.target);d.fragment&&d.fragment.l(p),p.forEach(I)}else d.fragment&&d.fragment.c();e.intro&&D(i.$$.fragment),ce(i,e.target,e.anchor),Ht()}Xe(c)}class he{constructor(){T(this,"$$");T(this,"$$set")}$destroy(){ue(this,1),this.$destroy=M}$on(e,t){if(!pt(t))return M;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!ki(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const $i="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add($i);function Bi(i){let e,t;return{c(){e=x("svg"),t=x("path"),a(t,"fill-rule","evenodd"),a(t,"clip-rule","evenodd"),a(t,"d","M5.11634 0.889422C4.86506 -0.296474 3.17237 -0.296474 2.92109 0.889422C2.78291 1.54158 2.10994 1.93011 1.47607 1.72371C0.323418 1.34837 -0.522932 2.81429 0.378448 3.62484C0.87414 4.07059 0.87414 4.84767 0.378448 5.29341C-0.522931 6.10397 0.323418 7.56989 1.47607 7.19455C2.10994 6.98814 2.78291 7.37668 2.92109 8.02883C3.17237 9.21473 4.86506 9.21473 5.11634 8.02883C5.25452 7.37668 5.92749 6.98814 6.56136 7.19455C7.71401 7.56989 8.56036 6.10397 7.65898 5.29341C7.16329 4.84767 7.16329 4.07059 7.65898 3.62484C8.56036 2.81429 7.71401 1.34837 6.56136 1.72371C5.92749 1.93011 5.25452 1.54158 5.11634 0.889422ZM4.01883 6.33408C5.05436 6.33408 5.89383 5.49462 5.89383 4.45908C5.89383 3.42355 5.05436 2.58408 4.01883 2.58408C2.98329 2.58408 2.14383 3.42355 2.14383 4.45908C2.14383 5.49462 2.98329 6.33408 4.01883 6.33408Z"),a(t,"fill","currentColor"),a(e,"width","9"),a(e,"height","9"),a(e,"viewBox","0 0 9 9"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(n,s){L(n,e,s),u(e,t)},p:M,i:M,o:M,d(n){n&&I(e)}}}class zi extends he{constructor(e){super(),de(this,e,null,Bi,re,{})}}function Wi(i){let e,t,n,s,l,r,o,c,d,v,p,m,h,_,w,E,b;return{c(){e=x("svg"),t=x("g"),n=x("path"),s=x("path"),l=x("defs"),r=x("filter"),o=x("feFlood"),c=x("feBlend"),d=x("feGaussianBlur"),v=x("linearGradient"),p=x("stop"),m=x("stop"),h=x("stop"),_=x("linearGradient"),w=x("stop"),E=x("stop"),b=x("stop"),a(n,"fill-rule","evenodd"),a(n,"clip-rule","evenodd"),a(n,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(n,"fill","url(#paint0_linear_67_262)"),a(t,"opacity","0.5"),a(t,"filter","url(#filter0_f_67_262)"),a(s,"fill-rule","evenodd"),a(s,"clip-rule","evenodd"),a(s,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(s,"fill","url(#paint1_linear_67_262)"),a(o,"flood-opacity","0"),a(o,"result","BackgroundImageFix"),a(c,"mode","normal"),a(c,"in","SourceGraphic"),a(c,"in2","BackgroundImageFix"),a(c,"result","shape"),a(d,"stdDeviation","3.39785"),a(d,"result","effect1_foregroundBlur_67_262"),a(r,"id","filter0_f_67_262"),a(r,"x","3.2043"),a(r,"y","2.2043"),a(r,"width","36.0914"),a(r,"height","41.0914"),a(r,"filterUnits","userSpaceOnUse"),a(r,"color-interpolation-filters","sRGB"),a(p,"stop-color","#FFAA00"),a(m,"offset","0.514478"),a(m,"stop-color","#FFEB00"),a(h,"offset","1"),a(h,"stop-color","#98FF05"),a(v,"id","paint0_linear_67_262"),a(v,"x1","7.3769"),a(v,"y1","18.4566"),a(v,"x2","20.6583"),a(v,"y2","33.1038"),a(v,"gradientUnits","userSpaceOnUse"),a(w,"stop-color","#FFC834"),a(E,"offset","0.514478"),a(E,"stop-color","#FAF534"),a(b,"offset","1"),a(b,"stop-color","#B8FF38"),a(_,"id","paint1_linear_67_262"),a(_,"x1","7.3769"),a(_,"y1","18.4566"),a(_,"x2","20.6583"),a(_,"y2","33.1038"),a(_,"gradientUnits","userSpaceOnUse"),a(e,"width","44"),a(e,"height","44"),a(e,"viewBox","0 0 44 44"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(A,P){L(A,e,P),u(e,t),u(t,n),u(e,s),u(e,l),u(l,r),u(r,o),u(r,c),u(r,d),u(l,v),u(v,p),u(v,m),u(v,h),u(l,_),u(_,w),u(_,E),u(_,b)},p:M,i:M,o:M,d(A){A&&I(e)}}}class qi extends he{constructor(e){super(),de(this,e,null,Wi,re,{})}}const xe=[];function Ui(i,e){return{subscribe:st(i,e).subscribe}}function st(i,e=M){let t;const n=new Set;function s(o){if(re(i,o)&&(i=o,t)){const c=!xe.length;for(const d of n)d[1](),xe.push(d,i);if(c){for(let d=0;d{n.delete(d),n.size===0&&t&&(t(),t=null)}}return{set:s,update:l,subscribe:r}}function Vt(i,e,t){const n=!Array.isArray(i),s=n?[i]:i;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const l=e.length<2;return Ui(t,(r,o)=>{let c=!1;const d=[];let v=0,p=M;const m=()=>{if(v)return;p();const _=e(n?d[0]:d,r,o);l?r(_):p=pt(_)?_:M},h=s.map((_,w)=>St(_,E=>{d[w]=E,v&=~(1<{v|=1<console.error(`Error when writing value from persisted store "${i}" to ${m}`,F),w=(c=t==null?void 0:t.onParseError)!=null?c:(F,k)=>console.error(`Error when parsing ${F?'"'+F+'"':"value"} from persisted store "${i}"`,k),E=(d=t==null?void 0:t.beforeRead)!=null?d:F=>F,b=(v=t==null?void 0:t.beforeWrite)!=null?v:F=>F,A=typeof window<"u"&&typeof document<"u",P=A?Yi(m):null;function H(F,k){const S=b(k);try{P==null||P.setItem(F,p.stringify(S))}catch(g){_(g)}}function W(){function F(C){try{return p.parse(C)}catch(V){w(C,V)}}const k=P==null?void 0:P.getItem(i);if(k==null)return e;const S=F(k);return S==null?e:E(S)}if(!Et[m][i]){const F=W(),k=st(F,C=>{if(A&&m=="local"&&h){const V=Y=>{if(Y.key===i&&Y.newValue){let B;try{B=p.parse(Y.newValue)}catch(ee){w(Y.newValue,ee);return}const Le=E(B);C(Le)}};return window.addEventListener("storage",V),()=>window.removeEventListener("storage",V)}}),{subscribe:S,set:g}=k;Et[m][i]={set(C){g(C),H(i,C)},update(C){return k.update(V=>{const Y=C(V);return H(i,Y),Y})},reset(){this.set(e)},subscribe:S}}return Et[m][i]}function xt(){return{collapseMode:"non-application",collapseCustomHide:"",collapseCustomShow:"",removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:.001,timeFormat:"absolute"}}const K=kt("pyinstrument:viewOptionsCallStack",xt(),{syncTabs:!0,beforeRead(i){return{...xt(),...i}}}),Ge=kt("pyinstrument:viewOptions",{viewMode:"call-stack"},{syncTabs:!1}),je=kt("pyinstrument:viewOptionsTimeline",{removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:1e-4},{syncTabs:!0});class Xi extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Gi(i,e){const t=e*(i.length-1),n=Math.floor(t),s=Math.ceil(t),l=i[n],r=i[s],o=t-n;return Zi(o,{to:[l,r]})}function ji(i,e,t){return i===1/0?(console.warn("clamp: value is Infinity, returning `max`",i),t):i===-1/0?(console.warn("clamp: value is -Infinity, returning `min`",i),e):Number.isFinite(i)?it?t:i:(console.warn("clamp: value isn't finite, returning `min`",i),e)}function Ne(i,e){const{from:t=[0,1],to:n=[0,1]}=e,s=e.clamp||!1;let l=(i-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return s&&(l=ji(l,Math.min(n[0],n[1]),Math.max(n[0],n[1]))),l}function Zi(i,e){return`rgb( - ${Ne(i,{from:e.from,to:[e.to[0][0],e.to[1][0]],clamp:e.clamp})}, - ${Ne(i,{from:e.from,to:[e.to[0][1],e.to[1][1]],clamp:e.clamp})}, - ${Ne(i,{from:e.from,to:[e.to[0][2],e.to[1][2]],clamp:e.clamp})} - )`}function Ki(i){if(i.substr(0,1)=="#"){var e=(i.length-1)/3,t=[17,1,.062272][e-1];return[Math.round(parseInt(i.substr(1,e),16)*t),Math.round(parseInt(i.substr(1+e,e),16)*t),Math.round(parseInt(i.substr(1+2*e,e),16)*t)]}else return i.split("(")[1].split(")")[0].split(",").map(n=>+n)}function Qi(i,e,t={}){const{ignore:n=[],capture:s=!0}=t,l=window;if(!l)return()=>{};let r=!0,o=!1;const c=h=>n.some(_=>typeof _=="string"?Array.from(document.querySelectorAll(_)).some(w=>w===h.target||h.composedPath().includes(w)):_&&(h.target===_||h.composedPath().includes(_))),d=h=>{if(!(!i||i===h.target||h.composedPath().includes(i))){if(h.detail===0&&(r=!c(h)),!r){r=!0;return}e(h)}},v=h=>{o||(o=!0,setTimeout(()=>{o=!1},0),d(h))},p=h=>{r=!c(h)&&!!(i&&!h.composedPath().includes(i))};return l.addEventListener("click",v,{passive:!0,capture:s}),l.addEventListener("pointerdown",p,{passive:!0}),()=>{l.removeEventListener("click",v,{capture:s}),l.removeEventListener("pointerdown",p)}}function Ji(i){const e=document.createElement("div");return e.appendChild(document.createTextNode(i)),e.innerHTML}function Ct(i){return Ji(i).replace(/(\/|\\)/g,t=>`${t}`)}function en(i,e){if(i.length==0)return null;let t=i[0],n=e(t);for(const s of i){const l=e(s);l>n&&(t=s,n=l)}return t}function ot(){return Math.random().toString(36).substring(2)}function tn(i){let e,t,n,s,l,r,o,c,d,v,p,m,h,_,w,E,b,A,P,H,W,F,k,S,g,C,V,Y,B,Le,ee,J,X,Ce,q,Qe,Je,le,U,et,te,fe,me,we,pe,Te,tt,Ae,Q,Be,Me,it,z,O,G,hi,at,fi,mi,ze,Fe,pi,We,ct,vi,gi,be,_i,wi,qe,ut,bi,Ue,dt,ht,ie,yi,Ti,ft,mt,ne,Ai,Rt,It,Lt,Ei;return Rt=_t(i[5][0]),It=_t(i[5][1]),{c(){e=f("div"),t=f("div"),n=f("div"),n.textContent="Collapse frames",s=y(),l=f("div"),r=f("div"),o=f("input"),c=y(),d=f("label"),v=R("Library code"),p=y(),m=f("div"),m.textContent="Code run from the Python stdlib, a virtualenv, or a conda env will be collapsed.",h=y(),_=f("div"),w=f("input"),E=y(),b=f("label"),A=R("Custom"),P=y(),H=f("div"),W=R(`Regex on the source file path. - `),F=f("div"),k=f("label"),k.textContent="Show",S=y(),g=f("input"),C=y(),V=f("label"),V.textContent="Hide",Y=y(),B=f("input"),Le=R(` - If neither match, the library code rule is used.`),ee=y(),J=f("div"),X=f("input"),Ce=y(),q=f("label"),Qe=R("Disabled"),Je=y(),le=f("div"),U=f("div"),U.textContent="Remove frames",et=y(),te=f("div"),fe=f("div"),me=f("input"),we=y(),pe=f("label"),Te=R("importlib machinery"),tt=y(),Ae=f("div"),Q=f("input"),Be=y(),Me=f("label"),it=R("Frames declaring __traceback_hide__"),z=y(),O=f("div"),G=f("input"),hi=y(),at=f("label"),fi=R("pyinstrument frames"),mi=y(),ze=f("div"),Fe=f("input"),pi=y(),We=f("span"),ct=f("label"),vi=R("Frames with durations less than"),gi=y(),be=f("input"),_i=R(` - % of the total time`),wi=y(),qe=f("div"),ut=f("div"),ut.textContent="Time format",bi=y(),Ue=f("div"),dt=f("div"),ht=f("label"),ie=f("input"),yi=R(` - Absolute time in seconds`),Ti=y(),ft=f("div"),mt=f("label"),ne=f("input"),Ai=R(` - Percentage of the total run time`),a(n,"class","name svelte-1pecl4m"),a(o,"id",i[1]+"collapseModeAll"),a(o,"type","radio"),o.__value="non-application",ae(o,o.__value),a(o,"class","svelte-1pecl4m"),a(d,"for",i[1]+"collapseModeAll"),a(m,"class","description svelte-1pecl4m"),a(r,"class","option svelte-1pecl4m"),a(w,"id",i[1]+"collapseModeCustom"),a(w,"type","radio"),w.__value="custom",ae(w,w.__value),a(w,"class","svelte-1pecl4m"),a(b,"for",i[1]+"collapseModeCustom"),a(k,"for","collapseCustomShow"),a(k,"class","svelte-1pecl4m"),a(g,"id","collapseCustomShow"),a(g,"type","text"),a(g,"placeholder","myproject"),a(g,"spellcheck","false"),a(g,"autocapitalize","off"),a(g,"autocomplete","off"),a(g,"autocorrect","off"),a(g,"class","svelte-1pecl4m"),a(V,"for","collapseCustomHide"),a(V,"class","svelte-1pecl4m"),a(B,"id","collapseCustomHide"),a(B,"type","text"),a(B,"placeholder",".*/lib/.*"),a(B,"spellcheck","false"),a(B,"autocapitalize","off"),a(B,"autocomplete","off"),a(B,"autocorrect","off"),a(B,"class","svelte-1pecl4m"),a(F,"class","mini-input-grid svelte-1pecl4m"),a(H,"class","description svelte-1pecl4m"),a(_,"class","option svelte-1pecl4m"),a(X,"id",i[1]+"collapseModeDisabled"),a(X,"type","radio"),X.__value="disabled",ae(X,X.__value),a(X,"class","svelte-1pecl4m"),a(q,"for",i[1]+"collapseModeDisabled"),a(J,"class","option svelte-1pecl4m"),a(l,"class","body"),a(t,"class","option-group svelte-1pecl4m"),a(U,"class","name svelte-1pecl4m"),a(me,"id",i[1]+"removeImportlib"),a(me,"type","checkbox"),a(me,"class","svelte-1pecl4m"),a(pe,"for",i[1]+"removeImportlib"),a(fe,"class","option svelte-1pecl4m"),a(Q,"id",i[1]+"removeTracebackHide"),a(Q,"type","checkbox"),a(Q,"class","svelte-1pecl4m"),a(Me,"for",i[1]+"removeTracebackHide"),a(Ae,"class","option svelte-1pecl4m"),a(G,"id",i[1]+"removePyinstrument"),a(G,"type","checkbox"),a(G,"class","svelte-1pecl4m"),a(at,"for",i[1]+"removePyinstrument"),a(O,"class","option svelte-1pecl4m"),a(Fe,"id",i[1]+"removeIrrelevant"),a(Fe,"type","checkbox"),a(Fe,"class","svelte-1pecl4m"),a(ct,"for",i[1]+"removeIrrelevant"),a(be,"type","number"),be.value=i[2](),a(be,"min","0"),a(be,"max","99"),a(be,"step","0.01"),Z(be,"width","4em"),a(be,"class","svelte-1pecl4m"),a(ze,"class","option svelte-1pecl4m"),a(te,"class","body"),a(le,"class","option-group svelte-1pecl4m"),a(ut,"class","name svelte-1pecl4m"),a(ie,"type","radio"),ie.__value="absolute",ae(ie,ie.__value),a(ie,"class","svelte-1pecl4m"),a(dt,"class","option svelte-1pecl4m"),a(ne,"type","radio"),ne.__value="proportion",ae(ne,ne.__value),a(ne,"class","svelte-1pecl4m"),a(ft,"class","option svelte-1pecl4m"),a(Ue,"class","body"),a(qe,"class","option-group svelte-1pecl4m"),a(e,"class","view-options-call-stack svelte-1pecl4m"),Rt.p(ie,ne),It.p(o,w,X)},m(j,se){L(j,e,se),u(e,t),u(t,n),u(t,s),u(t,l),u(l,r),u(r,o),o.checked=o.__value===i[0].collapseMode,u(r,c),u(r,d),u(d,v),u(r,p),u(r,m),u(l,h),u(l,_),u(_,w),w.checked=w.__value===i[0].collapseMode,u(_,E),u(_,b),u(b,A),u(_,P),u(_,H),u(H,W),u(H,F),u(F,k),u(F,S),u(F,g),ae(g,i[0].collapseCustomShow),u(F,C),u(F,V),u(F,Y),u(F,B),ae(B,i[0].collapseCustomHide),u(H,Le),u(l,ee),u(l,J),u(J,X),X.checked=X.__value===i[0].collapseMode,u(J,Ce),u(J,q),u(q,Qe),u(e,Je),u(e,le),u(le,U),u(le,et),u(le,te),u(te,fe),u(fe,me),me.checked=i[0].removeImportlib,u(fe,we),u(fe,pe),u(pe,Te),u(te,tt),u(te,Ae),u(Ae,Q),Q.checked=i[0].removeTracebackHide,u(Ae,Be),u(Ae,Me),u(Me,it),u(te,z),u(te,O),u(O,G),G.checked=i[0].removePyinstrument,u(O,hi),u(O,at),u(at,fi),u(te,mi),u(te,ze),u(ze,Fe),Fe.checked=i[0].removeIrrelevant,u(ze,pi),u(ze,We),u(We,ct),u(ct,vi),u(We,gi),u(We,be),u(We,_i),u(e,wi),u(e,qe),u(qe,ut),u(qe,bi),u(qe,Ue),u(Ue,dt),u(dt,ht),u(ht,ie),ie.checked=ie.__value===i[0].timeFormat,u(ht,yi),u(Ue,Ti),u(Ue,ft),u(ft,mt),u(mt,ne),ne.checked=ne.__value===i[0].timeFormat,u(mt,Ai),Lt||(Ei=[N(o,"change",i[4]),N(w,"change",i[6]),N(g,"input",i[7]),N(B,"input",i[8]),N(X,"change",i[9]),N(me,"change",i[10]),N(Q,"change",i[11]),N(G,"change",i[12]),N(Fe,"change",i[13]),N(be,"input",i[3]),N(ie,"change",i[14]),N(ne,"change",i[15])],Lt=!0)},p(j,[se]){se&1&&(o.checked=o.__value===j[0].collapseMode),se&1&&(w.checked=w.__value===j[0].collapseMode),se&1&&g.value!==j[0].collapseCustomShow&&ae(g,j[0].collapseCustomShow),se&1&&B.value!==j[0].collapseCustomHide&&ae(B,j[0].collapseCustomHide),se&1&&(X.checked=X.__value===j[0].collapseMode),se&1&&(me.checked=j[0].removeImportlib),se&1&&(Q.checked=j[0].removeTracebackHide),se&1&&(G.checked=j[0].removePyinstrument),se&1&&(Fe.checked=j[0].removeIrrelevant),se&1&&(ie.checked=ie.__value===j[0].timeFormat),se&1&&(ne.checked=ne.__value===j[0].timeFormat)},i:M,o:M,d(j){j&&I(e),Rt.r(),It.r(),Lt=!1,oe(Ei)}}}function nn(i,e,t){let n;ge(i,K,P=>t(0,n=P));const s=ot();function l(){return(n.removeIrrelevantThreshold*100).toLocaleString(void 0,{maximumFractionDigits:4})}function r(P){Ci(K,n.removeIrrelevantThreshold=P.currentTarget.valueAsNumber/100,n)}const o=[[],[]];function c(){n.collapseMode=this.__value,K.set(n)}function d(){n.collapseMode=this.__value,K.set(n)}function v(){n.collapseCustomShow=this.value,K.set(n)}function p(){n.collapseCustomHide=this.value,K.set(n)}function m(){n.collapseMode=this.__value,K.set(n)}function h(){n.removeImportlib=this.checked,K.set(n)}function _(){n.removeTracebackHide=this.checked,K.set(n)}function w(){n.removePyinstrument=this.checked,K.set(n)}function E(){n.removeIrrelevant=this.checked,K.set(n)}function b(){n.timeFormat=this.__value,K.set(n)}function A(){n.timeFormat=this.__value,K.set(n)}return[n,s,l,r,c,o,d,v,p,m,h,_,w,E,b,A]}class sn extends he{constructor(e){super(),de(this,e,nn,tn,re,{})}}function on(i){let e,t,n,s,l,r,o,c,d,v,p,m,h,_,w,E,b,A,P,H,W,F,k,S;return{c(){e=f("div"),t=f("div"),n=f("div"),n.textContent="Remove frames",s=y(),l=f("div"),r=f("div"),o=f("input"),c=y(),d=f("label"),v=R("importlib machinery"),p=y(),m=f("div"),h=f("input"),_=y(),w=f("label"),E=R("Frames declaring __traceback_hide__"),b=y(),A=f("div"),P=f("input"),H=y(),W=f("label"),F=R("pyinstrument frames"),a(n,"class","name"),a(o,"id",i[1]+"removeImportlib"),a(o,"type","checkbox"),a(d,"for",i[1]+"removeImportlib"),a(r,"class","option"),a(h,"id",i[1]+"removeTracebackHide"),a(h,"type","checkbox"),a(w,"for",i[1]+"removeTracebackHide"),a(m,"class","option"),a(P,"id",i[1]+"removePyinstrument"),a(P,"type","checkbox"),a(W,"for",i[1]+"removePyinstrument"),a(A,"class","option"),a(l,"class","body"),a(t,"class","option-group"),a(e,"class","view-options-timeline svelte-vsz8zm")},m(g,C){L(g,e,C),u(e,t),u(t,n),u(t,s),u(t,l),u(l,r),u(r,o),o.checked=i[0].removeImportlib,u(r,c),u(r,d),u(d,v),u(l,p),u(l,m),u(m,h),h.checked=i[0].removeTracebackHide,u(m,_),u(m,w),u(w,E),u(l,b),u(l,A),u(A,P),P.checked=i[0].removePyinstrument,u(A,H),u(A,W),u(W,F),k||(S=[N(o,"change",i[2]),N(h,"change",i[3]),N(P,"change",i[4])],k=!0)},p(g,[C]){C&1&&(o.checked=g[0].removeImportlib),C&1&&(h.checked=g[0].removeTracebackHide),C&1&&(P.checked=g[0].removePyinstrument)},i:M,o:M,d(g){g&&I(e),k=!1,oe(S)}}}function rn(i,e,t){let n;ge(i,je,c=>t(0,n=c));const s=ot();function l(){n.removeImportlib=this.checked,je.set(n)}function r(){n.removeTracebackHide=this.checked,je.set(n)}function o(){n.removePyinstrument=this.checked,je.set(n)}return[n,s,l,r,o]}class ln extends he{constructor(e){super(),de(this,e,rn,on,re,{})}}function an(i){let e,t;return e=new ln({}),{c(){_e(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function cn(i){let e,t;return e=new sn({}),{c(){_e(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function un(i){let e,t,n,s,l,r,o,c,d;const v=[cn,an],p=[];function m(h,_){return h[0].viewMode==="call-stack"?0:h[0].viewMode==="timeline"?1:-1}return~(o=m(i))&&(c=p[o]=v[o](i)),{c(){e=f("div"),t=f("div"),n=f("div"),s=R(i[3]),l=y(),r=f("div"),c&&c.c(),a(n,"class","title-row svelte-rpk7lo"),a(r,"class","body svelte-rpk7lo"),a(t,"class","box svelte-rpk7lo"),a(e,"class","view-options svelte-rpk7lo")},m(h,_){L(h,e,_),u(e,t),u(t,n),u(n,s),u(t,l),u(t,r),~o&&p[o].m(r,null),i[4](t),i[5](e),d=!0},p(h,[_]){(!d||_&8)&&ye(s,h[3]);let w=o;o=m(h),o!==w&&(c&&(Oe(),$(p[w],1,1,()=>{p[w]=null}),Ve()),~o?(c=p[o],c||(c=p[o]=v[o](h),c.c()),D(c,1),c.m(r,null)):c=null)},i(h){d||(D(c),d=!0)},o(h){$(c),d=!1},d(h){h&&I(e),~o&&p[o].d(),i[4](null),i[5](null)}}}function dn(i,e,t){let n;ge(i,Ge,m=>t(0,n=m));const s=Li();function l(){s("close")}let r,o;bt(()=>{if(o)return Qi(o,l,{ignore:[".js-view-options-button"]})});function c(){if(!r||!o)return;const m=r.getBoundingClientRect(),_=o.getBoundingClientRect().width;m.right-_-20<0?t(2,o.style.right=`${m.right-_-20}px`,o):t(2,o.style.right="0",o)}bt(()=>(c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)));let d="View options";function v(m){ke[m?"unshift":"push"](()=>{o=m,t(2,o)})}function p(m){ke[m?"unshift":"push"](()=>{r=m,t(1,r)})}return i.$$.update=()=>{i.$$.dirty&1&&(n.viewMode==="call-stack"?t(3,d="Call stack view options"):n.viewMode==="timeline"&&t(3,d="Timeline view options"))},[n,r,o,d,v,p]}class hn extends he{constructor(e){super(),de(this,e,dn,un,re,{})}}function Nt(i){let e,t;return e=new hn({}),e.$on("close",i[9]),{c(){_e(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p:M,i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function fn(i){let e,t,n,s,l,r,o,c,d=Ct(i[0].target_description)+"",v,p,m,h,_,w,E,b,A,P,H,W,F,k=i[0].sampleCount+"",S,g,C,V,Y,B,Le,ee,J,X,Ce,q,Qe,Je,le,U,et,te,fe,me,we,pe,Te,tt,Ae,Q,Be,Me,it;l=new qi({}),Te=new zi({});let z=i[1]&&Nt(i);return Be=_t(i[7][0]),{c(){e=f("div"),t=f("div"),n=f("div"),s=f("div"),_e(l.$$.fragment),r=y(),o=f("div"),c=f("div"),v=y(),p=f("div"),m=f("div"),h=f("span"),h.textContent="Recorded:",_=y(),w=f("span"),w.textContent=`${i[3]}`,E=y(),b=f("br"),A=y(),P=f("div"),H=f("span"),H.textContent="Samples:",W=y(),F=f("span"),S=R(k),g=y(),C=f("div"),V=f("span"),V.textContent="CPU utilization:",Y=y(),B=f("span"),B.textContent=`${(i[4]*100).toFixed(0)}%`,Le=y(),ee=f("div"),J=f("div"),X=R(`View: - `),Ce=f("label"),q=f("input"),Qe=R(` - Call stack`),Je=y(),le=f("label"),U=f("input"),et=R(` - Timeline`),te=y(),fe=f("div"),me=y(),we=f("div"),pe=f("button"),_e(Te.$$.fragment),tt=R(` - View options`),Ae=y(),z&&z.c(),a(s,"class","logo svelte-qdxst2"),a(c,"class","target-description svelte-qdxst2"),a(h,"class","metric-label svelte-qdxst2"),a(w,"class","metric-value svelte-qdxst2"),a(m,"class","metric date svelte-qdxst2"),a(b,"class","svelte-qdxst2"),a(H,"class","metric-label svelte-qdxst2"),a(F,"class","metric-value svelte-qdxst2"),a(P,"class","metric svelte-qdxst2"),a(V,"class","metric-label svelte-qdxst2"),a(B,"class","metric-value svelte-qdxst2"),a(C,"class","metric svelte-qdxst2"),a(p,"class","metrics svelte-qdxst2"),a(q,"type","radio"),q.__value="call-stack",ae(q,q.__value),a(q,"class","svelte-qdxst2"),a(Ce,"class","svelte-qdxst2"),a(U,"type","radio"),U.__value="timeline",ae(U,U.__value),a(U,"class","svelte-qdxst2"),a(le,"class","svelte-qdxst2"),a(J,"class","toggle"),a(fe,"class","spacer"),Z(fe,"flex","1"),a(pe,"class","js-view-options-button svelte-qdxst2"),a(we,"class","button-container svelte-qdxst2"),a(ee,"class","view-options svelte-qdxst2"),a(o,"class","layout svelte-qdxst2"),a(n,"class","row svelte-qdxst2"),a(t,"class","margins"),a(e,"class","header svelte-qdxst2"),Be.p(q,U)},m(O,G){L(O,e,G),u(e,t),u(t,n),u(n,s),ce(l,s,null),u(n,r),u(n,o),u(o,c),c.innerHTML=d,u(o,v),u(o,p),u(p,m),u(m,h),u(m,_),u(m,w),u(p,E),u(p,b),u(p,A),u(p,P),u(P,H),u(P,W),u(P,F),u(F,S),u(p,g),u(p,C),u(C,V),u(C,Y),u(C,B),u(o,Le),u(o,ee),u(ee,J),u(J,X),u(J,Ce),u(Ce,q),q.checked=q.__value===i[2].viewMode,u(Ce,Qe),u(J,Je),u(J,le),u(le,U),U.checked=U.__value===i[2].viewMode,u(le,et),u(ee,te),u(ee,fe),u(ee,me),u(ee,we),u(we,pe),ce(Te,pe,null),u(pe,tt),u(we,Ae),z&&z.m(we,null),Q=!0,Me||(it=[N(q,"change",i[6]),N(U,"change",i[8]),N(pe,"click",gt(vt(i[5])))],Me=!0)},p(O,[G]){(!Q||G&1)&&d!==(d=Ct(O[0].target_description)+"")&&(c.innerHTML=d),(!Q||G&1)&&k!==(k=O[0].sampleCount+"")&&ye(S,k),G&4&&(q.checked=q.__value===O[2].viewMode),G&4&&(U.checked=U.__value===O[2].viewMode),O[1]?z?(z.p(O,G),G&2&&D(z,1)):(z=Nt(O),z.c(),D(z,1),z.m(we,null)):z&&(Oe(),$(z,1,1,()=>{z=null}),Ve())},i(O){Q||(D(l.$$.fragment,O),D(Te.$$.fragment,O),D(z),Q=!0)},o(O){$(l.$$.fragment,O),$(Te.$$.fragment,O),$(z),Q=!1},d(O){O&&I(e),ue(l),ue(Te),z&&z.d(),Be.r(),Me=!1,oe(it)}}}function mn(i,e,t){let n;ge(i,Ge,h=>t(2,n=h));let{session:s}=e;const l=new Date(s.startTime*1e3).toLocaleString(void 0,{dateStyle:"long",timeStyle:"medium"}),r=s.cpuTime/s.duration;let o=!1;function c(h){t(1,o=!o)}const d=[[]];function v(){n.viewMode=this.__value,Ge.set(n)}function p(){n.viewMode=this.__value,Ge.set(n)}const m=()=>t(1,o=!1);return i.$$set=h=>{"session"in h&&t(0,s=h.session)},[s,o,n,l,r,c,v,d,p,m]}class pn extends he{constructor(e){super(),de(this,e,mn,fn,re,{session:0})}}const vn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAWmSURBVHgBtVc7i11VFF5rn3PvPKoLFlqmDGPhaGVpJQoWAZEEGxERFBsDgnY6KFpaWWrQysRGf4BgmSKQFCKWKQMKTqNzz2svv/XY55ybeycTCw+z736cs/f61rdee5hmz/Hx85c66m4QyTEzrdAo4cd6EuuJ2P4wtbmUgfZkCyRoWVcwyMI29ybW47sfhRfXf793+z4X4ZchPEl3F2esElYrbRVaEjQGEKGE3jcUofGwlIEBygoACAa0fmDrdV4AOAg6FV4+W49nUPdlEW4AElGNtqjZ+hqIdI2NAC7KuvAZloyJCR+IukGmF5A6iH/IbEBWLN2NevbBFQ6tCoAF3u7VggYQtQJyFlygOAADI74Jf669QDiWWh6xFRMUgLF6PAGYkcgGgGkBE/x8AiSVaykG0AUxlgm7BY0BUMAQL8R77LM96F98A98kBeu+kAdlgA0MntUGACmOFDQl5sm+Rai6lwpMLtiEgSVGE8wVFBkAB7XcU+rdJOoLSU0x8Aii3ta/0AWqMHjlM6LDPaYDHLSsnRn9pjMny2jBCDSu9H3tDqpCmw4C6lgHqAQmWB05uwwF8RCAQpU7jIbQYCElBsjAlabfqJdnD7lKwzVcIVVOgmKpF2g921pS8/QRvuETmwDEKZdwFHMocYHffYSfBc0opojVIomjx/dY64CkxVktMsgar16/IhbKygANruwWA+YDkURUcNHQaK5ps1XhBwaAzf6M9YzWq3Ac1EKACm80cB8KV6IdPsCR0aQAMBAaUkxXPyU6WDqlypKaSEOtmCCpDyAKFgu1gSecrhdar4n++VsiGUVWDHUpdJkYEPEkEyDc7paHTShXbkuNhqQfaF5wMt16lff69JYFFYT3A8AYgFxku5xtBtw9R7YsEiH85hcYLIsfuO0lfCCHvTtMWxszNRhDebp+LRsTGobFr0zBiO5tBnhWaZgiDwD5gi3Wiw+YcDAwoDfB+MaFq83RsP8M5zSYdFjsBwfh9YAjErbyQLHNVNUsH2Dl2odCh4dE+0vQXjtI9YG2z05zOKvSbdR3eKdtLTbugVKzoOQxC+7KA5NtJPiXEZaH5xDglMrOBMHTWxdWhA/QVqtgEdx3EtVwSkDOxE4GHESpCZzcHLe+4gg3HA7P69jpfvutTA0GTQNNkXAs5UYJVjC593keik/JBohzALjQsXbrJtRksRgntzm7nVX4GnZumtC4D23N4aIAZWdv9LyZv+3IA87AlHY1HQu9+q7Qwb7nAQ01FbQ+g5NBaNOKA2jdD0bg4+UjzCrbqu6IgrLB6aLRF6KWB0ZNUj15QvLCRVa8PNanqiq7pM7kbVXDEvdaipMmHIRfBa2//aYC9WI5vjH6ydLsB1ezpePiK9PhYcoLnjSK5kljNUWqvXppKdVxo4XFhIsJ93gXy/8clxIvt0X7i4XrU8+1D+wGgKPGW/UCzHfew9VsXywVZxbz8GYdKqS4rCTfZ/NZvD8WA/Yxu/aW661F7q+cIbsXVO6EcVf3b0t9SIXFx9N+kwEO3w8QVmhggq+/9xSroVdiv5TZlr0SanL6/KXOK5SaL9b/G4DRdDzONZbPuAjXS4bnfPWBPrJkjhzpYbdR8OeXz62nvBt3HD3z3F/2f0Fyx9O7XL2HAoj7YG33AK8Bag4TrJlOa0DrrVtrj7DsPBtKlgstsZGIcOW+B0wvlMP1EOqcCh1rTldb+/Xcw2woqbaLeh/Vbl7vH/Vgx08TABrehO53ccJKK1ZWP+gjpRqAKdaN8jxLs5r7Bx5TMBm18kjxOOZ0ub/3flUW/nzw4PSJp568CT0vYXq5aGJgslc4o7doPI6dcis2eUq950Ug1DqF9NvQ/uVf79y5v+E1IptedEInNj+iT2L9Nfv9jf7gI/pFdP4D5rfoaYw/Lv+pReVRq/JOEEXOee/PAf7/PP8C3bt510T4rIwAAAAASUVORK5CYII=",$t=st({}),Bt=st({});function zt(i){return i>.6?"#FF4159":i>.3?"#F5A623":i>.2?"#D8CB2A":"#7ED321"}function Wt(i,e,t){const n=i.slice();return n[21]=e[t],n}function qt(i){let e,t,n,s,l,r,o,c,d,v,p,m,h,_,w,E;return{c(){e=f("div"),t=f("div"),n=x("svg"),s=x("path"),l=y(),r=f("div"),o=R(i[5]),c=y(),d=f("div"),v=R(i[4]),p=y(),m=f("div"),m.textContent=`${i[11]}`,h=y(),_=f("div"),a(s,"d","M.937-.016L5.793 4.84.937 9.696z"),a(s,"fill",i[7]),a(s,"fill-rule","evenodd"),a(s,"fill-opacity",".582"),a(n,"width","6"),a(n,"height","10"),a(t,"class","frame-triangle svelte-7e9kco"),Ee(t,"rotate",!i[8]),Z(t,"visibility",i[0].children.length>0?"visible":"hidden"),a(r,"class","time svelte-7e9kco"),Z(r,"color",i[7]),Z(r,"font-weight",i[10]<.2?500:600),a(d,"class","name svelte-7e9kco"),a(m,"class","code-position svelte-7e9kco"),a(e,"class","frame-description svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),Ee(e,"application-code",i[0].isApplicationCode),Ee(e,"children-visible",!i[8]),Z(e,"padding-left",`${i[2]*35}px`),a(_,"class","visual-guide svelte-7e9kco"),Z(_,"left",`${i[2]*35+21}px`),Z(_,"background-color",i[7])},m(b,A){L(b,e,A),u(e,t),u(t,n),u(n,s),u(e,l),u(e,r),u(r,o),u(e,c),u(e,d),u(d,v),u(e,p),u(e,m),L(b,h,A),L(b,_,A),w||(E=[N(e,"keydown",i[14]),N(e,"click",gt(vt(i[12])))],w=!0)},p(b,A){A&128&&a(s,"fill",b[7]),A&256&&Ee(t,"rotate",!b[8]),A&1&&Z(t,"visibility",b[0].children.length>0?"visible":"hidden"),A&32&&ye(o,b[5]),A&128&&Z(r,"color",b[7]),A&16&&ye(v,b[4]),A&1&&Ee(e,"application-code",b[0].isApplicationCode),A&256&&Ee(e,"children-visible",!b[8]),A&4&&Z(e,"padding-left",`${b[2]*35}px`),A&4&&Z(_,"left",`${b[2]*35+21}px`),A&128&&Z(_,"background-color",b[7])},d(b){b&&(I(e),I(h),I(_)),w=!1,oe(E)}}}function Ut(i){let e,t,n,s,l=i[0].group.frames.length+"",r,o,c,d,v,p;return{c(){e=f("div"),t=f("div"),n=f("div"),n.innerHTML='',s=y(),r=R(l),o=R(" frames hidden ("),c=R(i[6]),d=R(")"),a(n,"class","group-triangle svelte-7e9kco"),Ee(n,"rotate",i[9]),a(t,"class","group-header-button svelte-7e9kco"),a(e,"class","group-header svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),Z(e,"padding-left",`${i[2]*35}px`)},m(m,h){L(m,e,h),u(e,t),u(t,n),u(t,s),u(t,r),u(t,o),u(t,c),u(t,d),v||(p=[N(e,"keydown",i[15]),N(e,"click",gt(vt(i[13])))],v=!0)},p(m,h){h&512&&Ee(n,"rotate",m[9]),h&1&&l!==(l=m[0].group.frames.length+"")&&ye(r,l),h&64&&ye(c,m[6]),h&4&&Z(e,"padding-left",`${m[2]*35}px`)},d(m){m&&I(e),v=!1,oe(p)}}}function Yt(i){let e,t=[],n=new Map,s,l=Ot(i[0].children);const r=o=>o[21].uuid;for(let o=0;o0&&Yt(i);return{c(){e=f("div"),l&&l.c(),t=y(),r&&r.c(),n=y(),o&&o.c(),a(e,"class","frame svelte-7e9kco")},m(c,d){L(c,e,d),l&&l.m(e,null),u(e,t),r&&r.m(e,null),u(e,n),o&&o.m(e,null),s=!0},p(c,[d]){c[3]?l?l.p(c,d):(l=qt(c),l.c(),l.m(e,t)):l&&(l.d(1),l=null),c[0].group&&c[0].group.rootFrame==c[0]&&!c[8]?r?r.p(c,d):(r=Ut(c),r.c(),r.m(e,n)):r&&(r.d(1),r=null),!c[8]&&c[0].children.length>0?o?(o.p(c,d),d&257&&D(o,1)):(o=Yt(c),o.c(),D(o,1),o.m(e,null)):o&&(Oe(),$(o,1,1,()=>{o=null}),Ve())},i(c){s||(D(o),s=!0)},o(c){$(o),s=!1},d(c){c&&I(e),l&&l.d(),r&&r.d(),o&&o.d()}}}function Gt(){const i='a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])',e=document.querySelector(".call-stack-view");if(!e)throw new Error("callStackElement not found");var t=Array.prototype.filter.call(e.querySelectorAll(i),function(n){return n.offsetWidth>0||n.offsetHeight>0||n===document.activeElement});return t}function jt(){const i=Gt();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e+1];t&&t.focus()}}function Zt(){const i=Gt();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e-1];t&&t.focus()}}function _n(i,e,t){var S;let n,s,l,r,o;ge(i,Bt,g=>t(16,l=g)),ge(i,$t,g=>t(17,r=g)),ge(i,K,g=>t(18,o=g));let{frame:c}=e,{rootFrame:d}=e,{indent:v=0}=e,p;const m=c.time/d.time;let h;const _=`${c.filePathShort}:${(S=c.lineNo)==null?void 0:S.toString().padEnd(4," ")}`;let w,E=null;if(c.group){const g=c.group.libraries;g.length<4?E=g.join(", "):E=`${g[0]}, ${g[1]}, ${g[2]}...`}let b;b=zt(m);function A(g){P(c,!s,g.altKey)}function P(g,C,V=!0){if(Bt.update(Y=>({...Y,[g.uuid]:C})),V)for(const Y of g.children)P(Y,C,!0),g.group&&g.group.rootFrame==g&&H(g.group.id,!C)}function H(g,C){$t.update(V=>({...V,[g]:C}))}function W(){c.group&&H(c.group.id,!n)}function F(g){let C=!0;g.key==="Enter"||g.key===" "?A(g):g.key==="ArrowLeft"&&!s?P(c,!0,g.altKey):g.key==="ArrowRight"&&s?P(c,!1,g.altKey):g.key==="ArrowUp"?Zt():g.key==="ArrowDown"?jt():C=!1,C&&(g.preventDefault(),g.stopPropagation())}function k(g){let C=!0;g.key==="Enter"||g.key===" "?W():g.key==="ArrowLeft"&&c.group?H(c.group.id,!1):g.key==="ArrowRight"&&c.group?H(c.group.id,!0):g.key==="ArrowUp"?Zt():g.key==="ArrowDown"?jt():C=!1,C&&(g.preventDefault(),g.stopPropagation())}return i.$$set=g=>{"frame"in g&&t(0,c=g.frame),"rootFrame"in g&&t(1,d=g.rootFrame),"indent"in g&&t(2,v=g.indent)},i.$$.update=()=>{var g,C;if(i.$$.dirty&131073&&(c.group?r[c.group.id??""]||((g=c.group)==null?void 0:g.rootFrame)===c||c.children.filter(V=>!V.group).length>1?t(3,p=!0):t(3,p=!1):t(3,p=!0)),i.$$.dirty&1&&(c.className?t(4,h=`${c.className}.${c.function}`):t(4,h=c.function)),i.$$.dirty&262145)if(o.timeFormat==="absolute")t(5,w=c.time.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:3}));else if(o.timeFormat==="proportion")t(5,w=`${(m*100).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}%`);else throw new Error("unknown timeFormat");i.$$.dirty&131073&&t(9,n=r[((C=c.group)==null?void 0:C.id)??""]===!0),i.$$.dirty&65537&&t(8,s=l[c.uuid]===!0)},[c,d,v,p,h,w,E,b,s,n,m,_,A,W,F,k,l,r,o]}let Kt=class extends he{constructor(e){super(),de(this,e,_n,gn,re,{frame:0,rootFrame:1,indent:2})}};function Qt(i,e,t){let n=i;for(const s of e)if(n=s(n,t),!n)return null;return n}const wn="\0",bn="[await]",Ze="[self]",yn=[bn,Ze,"[out-of-context]","[root]"],Tn="c",An="h";class Ke{constructor(e,t){T(this,"uuid",ot());T(this,"identifier");T(this,"_identifierParts");T(this,"startTime");T(this,"time",0);T(this,"absorbedTime",0);T(this,"group",null);T(this,"attributes");T(this,"_children",[]);T(this,"parent",null);T(this,"context");var l;this.identifier=e.identifier,this._identifierParts=this.identifier.split(wn),this.startTime=e.startTime??0,this.time=e.time??0,this.attributes=e.attributes??{},this.context=t;let n=this.startTime;const s=(l=e.children)==null?void 0:l.map(r=>(r.startTime===void 0&&(r={...r,startTime:n},n+=r.time??0),n=r.startTime+(r.time??0),new Ke(r,t)));s&&this.addChildren(s)}cloneDeep(){return new Ke(this,this.context)}get children(){return this._children}addChild(e,t={}){if(e.removeFromParent(),e.parent=this,t.after){const n=this._children.indexOf(t.after);if(n==-1)throw new Error("After frame not found");this._children.splice(n+1,0,e)}else this._children.push(e)}addChildren(e,t={}){e=e.slice(),t.after?(e.slice().reverse(),e.forEach(s=>this.addChild(s,t))):e.forEach(n=>this.addChild(n,t))}removeFromParent(){if(this.parent){const e=this.parent._children.indexOf(this);this.parent._children.splice(e,1),this.parent=null}}getAttributes(e){return Object.keys(this.attributes).filter(n=>n.startsWith(e)).map(n=>({data:n.slice(1),time:this.attributes[n]}))}getAttributeValue(e){const t=this.getAttributes(e);if(!t||t.length==0)return null;let n=0;for(let s=0;st[n].time&&(n=s);return t[n].data}get hasTracebackHide(){return this.getAttributeValue(An)=="1"}get function(){return this._identifierParts[0]}get filePath(){return this._identifierParts[1]??null}get lineNo(){const e=this._identifierParts[2];return e?parseInt(e):null}get isSynthetic(){return yn.includes(this.identifier)}get filePathShort(){return this.isSynthetic&&this.parent?this.parent.filePathShort:this.filePath?this.context.shortenPath(this.filePath):null}get isApplicationCode(){if(this.isSynthetic)return!1;const e=this.filePath;return!e||this.context.sysPrefixes.some(n=>e.startsWith(n))?!1:e.startsWith("<")?e.startsWith(""||e==""?this.parent?this.parent.isApplicationCode:!0:!1:!0}get proportionOfParent(){return this.parent?this.time/this.parent.time:1}get className(){return this.getAttributeValue(Tn)??""}get library(){const e=this.filePathShort;return e?/^[\\/.]*[^\\/.]*/.exec(e)[0]??"":null}}class En{constructor(e){T(this,"id");T(this,"rootFrame");T(this,"_frames",[]);this.id=ot(),this.rootFrame=e}addFrame(e){e.group&&e.group.removeFrame(e),this._frames.push(e),e.group=this}removeFrame(e){if(e.group!==this)throw new Error("Frame not in group.");const t=this._frames.indexOf(e);if(t===-1)throw new Error("Frame not found in group.");this._frames.splice(t,1),e.group=null}get frames(){return this._frames}get exitFrames(){const e=[];for(const t of this.frames){let n=!1;for(const s of t.children)if(s.group!=this){n=!0;break}n&&e.push(t)}return e}get libraries(){const e=[];for(const t of this.frames){const n=t.library;n&&(e.includes(n)||e.push(n))}return e}}function rt(i,e){const{replaceWith:t}=e,n=i.parent;if(!n)throw new Error("Cannot delete the root frame");if(t=="children")n.addChildren(i.children,{after:i});else if(t=="self_time")n.addChild(new Ke({identifier:Ze,time:i.time},n.context),{after:i});else if(t=="nothing")n.absorbedTime+=i.time;else throw new Xi(t);i.removeFromParent(),Mt(i,!0)}function kn(i,e){if(i.parent!==e.parent)throw new Error("Both frames must have the same parent.");e.absorbedTime+=i.absorbedTime,e.time+=i.time,Object.entries(i.attributes).forEach(([t,n])=>{e.attributes[t]!==void 0?e.attributes[t]+=n:e.attributes[t]=n}),e.addChildren(i.children),i.removeFromParent(),Mt(i,!1)}function Mt(i,e){if(e&&i.children&&i.children.forEach(t=>{Mt(t,!0)}),i.group){const t=i.group;t.removeFrame(i),t.frames.length===1&&t.removeFrame(t.frames[0])}}function Ft(i,e){if(!i)return null;for(const t of i.children)Ft(t),t.filePath&&t.filePath.includes("Jt(n)),i._children.sort((n,s)=>s.time-n.time),i}function ei(i,e){if(!i)return null;const t=e.hideRegex,n=e.showRegex;function s(r){const o=r.filePath||"",c=n&&new RegExp(n).test(o),d=t&&new RegExp(t).test(o);return c?!1:d?!0:!r.isApplicationCode}function l(r,o){o.addFrame(r),r.children.forEach(c=>{s(c)&&l(c,o)})}return i.children.forEach(r=>{if(!r.group&&s(r)&&r.children.some(s)){const o=new En(r);l(r,o)}ei(r,e)}),i}function ti(i,e,t=!0){if(!i)return null;let n=null;for(const s of i.children)s.identifier===Ze?n?(n.time+=s.time,s.removeFromParent()):n=s:n=null;return t&&i.children.forEach(s=>ti(s,e,!0)),i}function ii(i,e){return i?(i.children.length===1&&i.children[0].identifier===Ze&&rt(i.children[0],{replaceWith:"nothing"}),i.children.forEach(t=>ii(t)),i):null}function ni(i,e,t=null){if(!i)return null;t===null&&(t=i.time,t<=0&&(t=1e-44));const n=e.filterThreshold??.01;for(const s of i.children.slice())s.time/tni(s,e,t)),i}function si(i,e){if(!i)return null;const t=o=>en(o,c=>c.time),n=o=>{var c;return((c=o.filePath)==null?void 0:c.includes("pyinstrument/__main__.py"))&&o.children.length>0},s=o=>{var c;return o.proportionOfParent>.8&&((c=o.filePath)==null?void 0:c.includes(""))&&o.children.length>0},l=o=>{var c;return o.proportionOfParent>.8&&(new RegExp(".*runpy.py").test(o.filePath??"")||((c=o.filePath)==null?void 0:c.includes("")))&&o.children.length>0};let r=i;if(!n(r)||(r=t(r.children),!s(r))||(r=t(r.children),!l(r)))return i;for(;l(r);)r=t(r.children);return r.removeFromParent(),r}function oi(i,e){return i?(i.children.forEach(t=>oi(t)),i.group&&i.group.frames.length<3&&i.group.removeFrame(i),i):null}function Cn(i){let e,t,n;return t=new Kt({props:{frame:i[3],rootFrame:i[3]}}),{c(){e=f("div"),_e(t.$$.fragment),a(e,"class","call-stack-margins svelte-1hebm9u")},m(s,l){L(s,e,l),ce(t,e,null),n=!0},p(s,l){const r={};l&8&&(r.frame=s[3]),l&8&&(r.rootFrame=s[3]),t.$set(r)},i(s){n||(D(t.$$.fragment,s),n=!0)},o(s){$(t.$$.fragment,s),n=!1},d(s){s&&I(e),ue(t)}}}function Mn(i){let e;return{c(){e=f("div"),e.innerHTML='
All frames were filtered out.
',a(e,"class","margins")},m(t,n){L(t,e,n)},p:M,i:M,o:M,d(t){t&&I(e)}}}function Fn(i){let e,t,n,s,l,r,o;const c=[Mn,Cn],d=[];function v(p,m){return p[3]?1:0}return n=v(i),s=d[n]=c[n](i),{c(){e=f("div"),t=f("div"),s.c(),l=y(),r=f("div"),a(t,"class","scroll-inner svelte-1hebm9u"),a(r,"class","scroll-size-fixer svelte-1hebm9u"),a(e,"class","call-stack-view svelte-1hebm9u")},m(p,m){L(p,e,m),u(e,t),d[n].m(t,null),i[7](t),u(e,l),u(e,r),i[8](r),i[9](e),o=!0},p(p,[m]){let h=n;n=v(p),n===h?d[n].p(p,m):(Oe(),$(d[h],1,1,()=>{d[h]=null}),Ve(),s=d[n],s?s.p(p,m):(s=d[n]=c[n](p),s.c()),D(s,1),s.m(t,null))},i(p){o||(D(s),o=!0)},o(p){$(s),o=!1},d(p){p&&I(e),d[n].d(),i[7](null),i[8](null),i[9](null)}}}function Pn(i,e,t){let n,{session:s}=e;const l=Vt([K],([h])=>{const _=[h.removeImportlib?Ft:null,h.removeTracebackHide?Pt:null,ti,Jt,ii,h.removeIrrelevant?ni:null,h.removePyinstrument?si:null,h.collapseMode!=="disabled"?ei:null,oi].filter(E=>E!==null),w={filterThreshold:h.removeIrrelevantThreshold,hideRegex:h.collapseMode=="custom"?h.collapseCustomHide:void 0,showRegex:h.collapseMode=="custom"?h.collapseCustomShow:void 0};return{processors:_,options:w}});ge(i,l,h=>t(6,n=h));let r,o,c;bt(()=>{let h=0;const _=r;if(!_)throw new Error("element not set");if(!o)throw new Error("scrollInnerElement not set");if(!c)throw new Error("scrollSizeFixerElement not set");const w=new ResizeObserver(()=>{const b=o.getBoundingClientRect().height;b>h&&(h=b,t(2,c.style.top=`${h-1}px`,c))});w.observe(o);let E;return _.addEventListener("scroll",E=()=>{let b=_.scrollTop+_.clientHeight;const A=o.getBoundingClientRect().height;b{w.disconnect(),_.removeEventListener("scroll",E)}});let d;function v(h){ke[h?"unshift":"push"](()=>{o=h,t(1,o)})}function p(h){ke[h?"unshift":"push"](()=>{c=h,t(2,c)})}function m(h){ke[h?"unshift":"push"](()=>{r=h,t(0,r)})}return i.$$set=h=>{"session"in h&&t(5,s=h.session)},i.$$.update=()=>{i.$$.dirty&96&&t(3,d=Qt(s.rootFrame.cloneDeep(),n.processors,n.options))},[r,o,c,d,l,s,n,v,p,m]}class Rn extends he{constructor(e){super(),de(this,e,Pn,Fn,re,{session:5})}}class In{constructor(e){T(this,"mediaQueryList",null);this.onDevicePixelRatioChanged=e,this._onChange=this._onChange.bind(this),this.createMediaQueryList()}createMediaQueryList(){this.removeMediaQueryList();let e=`(resolution: ${window.devicePixelRatio}dppx)`;this.mediaQueryList=matchMedia(e),this.mediaQueryList.addEventListener("change",this._onChange)}removeMediaQueryList(){var e;(e=this.mediaQueryList)==null||e.removeEventListener("change",this._onChange),this.mediaQueryList=null}_onChange(e){this.onDevicePixelRatioChanged(),this.createMediaQueryList()}destroy(){this.removeMediaQueryList()}}class Ln{constructor(e){T(this,"canvas");T(this,"_size_observer");T(this,"_devicePixelRatioObserver");T(this,"drawAnimationRequest",null);this.container=e,getComputedStyle(e).position!="absolute"&&(e.style.position="relative"),this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.left="0",this.canvas.style.top="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.container.appendChild(this.canvas),this.setCanvasSize=this.setCanvasSize.bind(this),this._size_observer=new ResizeObserver(this.setCanvasSize),this._size_observer.observe(e),this._devicePixelRatioObserver=new In(this.setCanvasSize),window.requestAnimationFrame(()=>{this.setCanvasSize()})}destroy(){this._size_observer.disconnect(),this._devicePixelRatioObserver.destroy(),this.canvas.remove(),this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null)}setNeedsRedraw(){this.drawAnimationRequest===null&&(this.drawAnimationRequest=window.requestAnimationFrame(()=>{this.drawAnimationRequest=null,this.canvasViewRedraw()}))}redrawIfNeeded(){this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null,this.canvasViewRedraw())}canvasViewRedraw(){const e=this.canvas.getContext("2d");e&&(e.resetTransform(),e.scale(window.devicePixelRatio,window.devicePixelRatio),this.redraw(e,{width:this.canvas.width/window.devicePixelRatio,height:this.canvas.height/window.devicePixelRatio}))}get width(){return this.canvas.width/window.devicePixelRatio}get height(){return this.canvas.height/window.devicePixelRatio}setCanvasSize(){const e=window.devicePixelRatio;this.canvas.height=this.container.clientHeight*e,this.canvas.width=this.container.clientWidth*e,this.canvasViewRedraw()}}function Sn(i){let e,t=i[2]=="self"?"self":"time",n,s,l,r=i[3](i[0].time)+"";return{c(){e=f("div"),n=R(t),s=y(),l=f("div"),a(e,"class","label svelte-ci3g2p"),a(l,"class","time-val svelte-ci3g2p")},m(o,c){L(o,e,c),u(e,n),L(o,s,c),L(o,l,c),l.innerHTML=r},p(o,c){c&4&&t!==(t=o[2]=="self"?"self":"time")&&ye(n,t),c&1&&r!==(r=o[3](o[0].time)+"")&&(l.innerHTML=r)},d(o){o&&(I(e),I(s),I(l))}}}function Dn(i){let e,t,n,s,l=i[3](i[0].time)+"",r,o=i[0].selfTime/i[0].time>.001&&ri(i);return{c(){e=f("div"),e.textContent="time",t=y(),n=f("div"),s=f("div"),r=y(),o&&o.c(),a(e,"class","label svelte-ci3g2p"),a(s,"class","time-val svelte-ci3g2p"),a(n,"class","time-row svelte-ci3g2p")},m(c,d){L(c,e,d),L(c,t,d),L(c,n,d),u(n,s),s.innerHTML=l,u(n,r),o&&o.m(n,null)},p(c,d){d&1&&l!==(l=c[3](c[0].time)+"")&&(s.innerHTML=l),c[0].selfTime/c[0].time>.001?o?o.p(c,d):(o=ri(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(I(e),I(t),I(n)),o&&o.d()}}}function ri(i){let e,t,n,s=i[3](i[0].selfTime)+"";return{c(){e=f("div"),e.textContent="self",t=y(),n=f("div"),a(e,"class","label svelte-ci3g2p"),a(n,"class","time-val svelte-ci3g2p")},m(l,r){L(l,e,r),L(l,t,r),L(l,n,r),n.innerHTML=s},p(l,r){r&1&&s!==(s=l[3](l[0].selfTime)+"")&&(n.innerHTML=s)},d(l){l&&(I(e),I(t),I(n))}}}function Hn(i){let e,t,n=i[0].name+"",s,l,r,o,c,d,v,p,m,h;function _(b,A){return b[2]=="both"?Dn:Sn}let w=_(i),E=w(i);return{c(){e=f("div"),t=f("div"),s=R(n),l=y(),E.c(),r=y(),o=f("div"),o.textContent="loc",c=y(),d=f("div"),v=f("div"),m=y(),h=new Ri(!1),a(t,"class","name svelte-ci3g2p"),a(o,"class","label svelte-ci3g2p"),a(v,"class","location-color svelte-ci3g2p"),a(v,"style",p=`background: ${i[0].locationColor}`),h.a=null,a(d,"class","location-row"),a(e,"class","timeline-canvas-view-tooltip svelte-ci3g2p"),a(e,"style",`font: ${ai}; max-width: ${Vn}px;`)},m(b,A){L(b,e,A),u(e,t),u(t,s),u(e,l),E.m(e,null),u(e,r),u(e,o),u(e,c),u(e,d),u(d,v),u(d,m),h.m(i[1],d)},p(b,[A]){A&1&&n!==(n=b[0].name+"")&&ye(s,n),w===(w=_(b))&&E?E.p(b,A):(E.d(1),E=w(b),E&&(E.c(),E.m(e,r))),A&1&&p!==(p=`background: ${b[0].locationColor}`)&&a(v,"style",p),A&2&&h.p(b[1])},i:M,o:M,d(b){b&&I(e),E.d()}}}function li(i){return i.selfTime==i.time?"self":i.selfTime/i.time>.001?"both":"time"}function On(i,e){i.font=ai;const t=li(e)=="both"?140:70,n=i.measureText(e.name).width,s=i.measureText(e.location).width+46;let r=Math.max(t,n,s)+20;return r>310&&(r=310),r}const Vn=310,ai="400 13px Source Sans Pro, sans-serif";function xn(i,e,t){let{f:n}=e,s,l;function r(o){return`${o.toFixed(3)}`}return i.$$set=o=>{"f"in o&&t(0,n=o.f)},i.$$.update=()=>{i.$$.dirty&1&&t(1,s=Ct(n.location)),i.$$.dirty&1&&t(2,l=li(n))},[n,s,l,r]}class Nn extends he{constructor(e){super(),de(this,e,xn,Hn,re,{f:0})}}const $n="#212325",ci=18,Bn=17,Ie=28,lt=17,ui=29,zn=["#3475BA","#318DBC","#47A298","#8AAE5D","#C1A731","#C07210","#B84210","#B53134","#9A3586","#4958B5","#3475BA"].map(Ki);class Wn extends Ln{constructor(t){super(t);T(this,"zoom",1);T(this,"startT",0);T(this,"yOffset",0);T(this,"frames",[]);T(this,"isZoomedIn",!1);T(this,"tooltipContainer");T(this,"tooltipComponent",null);T(this,"_rootFrame",null);T(this,"maxDepth",0);T(this,"tooltipLocation",null);T(this,"lastDrawWidth",0);T(this,"lastDrawHeight",0);T(this,"_libraryOrder",null);T(this,"_colors",[]);T(this,"_frameMaxT");T(this,"mouseLocation",null);T(this,"mouseDownLocation",null);T(this,"touches",{});this.onWheel=this.onWheel.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.windowMouseUp=this.windowMouseUp.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onTouchcancel=this.onTouchend.bind(this),this.canvas.addEventListener("wheel",this.onWheel),this.canvas.addEventListener("mousemove",this.onMouseMove),this.canvas.addEventListener("mouseleave",this.onMouseLeave),this.canvas.addEventListener("mousedown",this.onMouseDown),this.canvas.addEventListener("touchstart",this.onTouchstart),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend),this.canvas.addEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer=document.createElement("div"),this.tooltipContainer.style.position="absolute",this.tooltipContainer.style.pointerEvents="none",this.container.appendChild(this.tooltipContainer)}destroy(){this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("mousemove",this.onMouseMove),this.canvas.removeEventListener("mouseleave",this.onMouseLeave),this.canvas.removeEventListener("mousedown",this.onMouseDown),this.canvas.removeEventListener("touchstart",this.onTouchstart),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend),this.canvas.removeEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer.remove(),super.destroy()}setRootFrame(t){this._rootFrame=t,this.frames=[],this._frameMaxT=void 0,this.maxDepth=0,this._collectFrames(t,0),this.fitContents(),this.setNeedsRedraw()}_collectFrames(t,n){this.frames.push({frame:t,depth:n,isApplicationCode:t.isApplicationCode,library:t.library,className:t.className,filePathShort:t.filePathShort}),this.maxDepth=Math.max(this.maxDepth,n);for(const s of t.children)s.identifier!==Ze&&this._collectFrames(s,n+1)}updateTooltip(t,n){var s;if(n){const l={name:this.frameName(n),time:n.frame.time,selfTime:this.frameSelfTime(n),totalTime:((s=this._rootFrame)==null?void 0:s.time)??1e-12,location:`${n.filePathShort}:${n.frame.lineNo}`,locationColor:this.colorForFrame(n)};if(this.tooltipComponent?this.tooltipComponent.$set({f:l}):this.tooltipComponent=new Nn({target:this.tooltipContainer,props:{f:l}}),this.tooltipLocation){const r={x:this.tooltipLocation.x+12,y:this.tooltipLocation.y+12},o=On(t,l),c=this.width-10-o;r.x>c&&(r.x=c);const v=this.height-10-60;r.y>v&&(r.y=v),this.tooltipContainer.style.left=`${r.x}px`,this.tooltipContainer.style.top=`${r.y}px`}}n||this.tooltipComponent&&(this.tooltipComponent.$destroy(),this.tooltipComponent=null)}redraw(t,n){const{width:s,height:l}=n;(s!==this.lastDrawWidth||l!==this.lastDrawHeight)&&(this.isZoomedIn?this.clampViewport():this.fitContents()),this.lastDrawWidth=s,this.lastDrawHeight=l,t.fillStyle=$n,t.fillRect(0,0,s,l),this.drawAxes(t);for(const d of this.frames)this.drawFrame(t,d);t.globalAlpha=1;const r=this.maxYOffset>0||this.isZoomedIn,o=!!this.mouseDownLocation;this.canvas.style.cursor=o&&r?"grabbing":"initial",t.fillStyle="red",t.font='23px "Source Sans Pro", sans-serif';let c=null;!o&&this.tooltipLocation&&(c=this.hitTest(this.tooltipLocation)),this.updateTooltip(t,c)}drawAxes(t){const n=Math.max(800,this.width)/this.zoom;if(n==0)return;const s=Math.log10(n);let l=Math.ceil(s)+2;l<0&&(l=0);const r=Math.ceil(s)-3,o=c=>Ne(c,{from:[s,s-3],to:[.71,0],clamp:!0});for(let c=r;c.01){t.globalAlpha=h,t.font='13px "Source Sans Pro", sans-serif';let _=d.toFixed(c);_=="0"&&(_="0s");let w=m+10;t.fillText(_,v+3,w);let E=this.height+lt+10-this.yOffset;Ethis.width)return;if(t.fillStyle=this.colorForFrame(n),t.globalAlpha=n.isApplicationCode?1:.5,r<2){t.fillRect(s,l,r,o);return}let d=this.frameName(n);const v=Math.floor(r/3.3);if(d.length>v&&(d=d.substring(0,v)),d.length==0){t.fillRect(s,l,r,o);return}t.save(),t.beginPath(),t.rect(s,l,r,o),t.fill(),t.clip(),t.font='13px "Source Sans Pro", sans-serif',t.fillStyle="white";let p=s;p<0&&(p=0),t.fillText(d,p+2,l+13),t.restore()}_assignLibraryOrder(){const t={};for(const s of this.frames){const r=s.frame.library??"";t[r]=(t[r]||0)+s.frame.time}const n=Object.keys(t);n.sort((s,l)=>t[l]-t[s]),this._libraryOrder=n}colorForLibraryIndex(t){if(this._colors[t]!==void 0)return this._colors[t];const n=Math.pow(2,Math.ceil(Math.log2(t+1))),l=(2*t-n+1)/n,r=Gi(zn,l);return this._colors[t]=r,r}libraryIndexForFrame(t){this._libraryOrder||this._assignLibraryOrder();const n=t.library||"";let s=this._libraryOrder.indexOf(n);return s===-1&&(s=this._libraryOrder.length,this._libraryOrder.push(n)),s}colorForFrame(t){const n=this.libraryIndexForFrame(t);return this.colorForLibraryIndex(n)}get frameMaxT(){return this._frameMaxT===void 0&&(this._frameMaxT=this.frames.reduce((t,n)=>Math.max(t,n.frame.startTime+n.frame.time),0)),this._frameMaxT}get maxYOffset(){return Math.max(0,(this.maxDepth+1)*ci+lt*2+ui-this.height)}get minZoom(){return(this.width-2*Ie)/this.frameMaxT}get maxZoom(){return 6666666666666667e-8}fitContents(){this.startT=0,this.zoom=this.minZoom,this.isZoomedIn=!1}clampViewport(){this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.startT<0&&(this.startT=0);const t=this.frameMaxT-(this.width-2*Ie)/this.zoom;this.startT>t&&(this.startT=t),this.yOffset<0&&(this.yOffset=0),this.yOffset>this.maxYOffset&&(this.yOffset=this.maxYOffset)}frameDims(t){const n=t.depth*ci+lt+ui-this.yOffset,s=Bn;let l=this.xForT(t.frame.startTime),o=this.xForT(t.frame.startTime+t.frame.time)-l;return o<1&&(o=1),o>1&&(o-=Ne(o,{from:[1,3],to:[0,1],clamp:!0})),{x:l,y:n,w:o,h:s}}xForT(t){return(t-this.startT)*this.zoom+Ie}tForX(t){return(t-Ie)/this.zoom+this.startT}frameName(t){let n;return t.className?n=`${t.className}.${t.frame.function}`:t.frame.function==""?n=t.filePathShort??t.frame.filePath??"":n=t.frame.function,n}frameSelfTime(t){let n=t.frame.time;const s=t.frame.children.filter(l=>!l.isSynthetic);for(const l of s)n-=l.time;return n}hitTest(t){for(const n of this.frames){const{x:s,y:l,w:r,h:o}=this.frameDims(n);if(t.x>=s&&t.x<=s+r&&t.y>=l&&t.y<=l+o)return n}return null}onWheel(t){const n=t.ctrlKey||t.metaKey,s=n?.01:.0023,l=this.tForX(t.offsetX);this.zoom*=1-t.deltaY*s,this.clampViewport(),this.startT=l-(t.offsetX-Ie)/this.zoom,n||(this.startT+=t.deltaX/this.zoom),this.clampViewport(),this.setNeedsRedraw(),t.preventDefault()}onMouseMove(t){const n={x:t.offsetX,y:t.offsetY},s=this.mouseLocation;if(this.mouseLocation=n,s&&this.mouseDownLocation){const l={x:n.x-s.x,y:n.y-s.y};this.startT-=l.x/this.zoom,this.yOffset-=l.y,this.clampViewport()}this.tooltipLocation=n,this.setNeedsRedraw()}onMouseLeave(t){this.mouseLocation=null,this.tooltipLocation=null,this.setNeedsRedraw()}onMouseDown(t){(t.button===0||t.button===1)&&(this.mouseDownLocation={x:t.offsetX,y:t.offsetY},window.addEventListener("mouseup",this.windowMouseUp),this.setNeedsRedraw())}windowMouseUp(t){window.removeEventListener("mouseup",this.windowMouseUp),this.mouseDownLocation=null,this.setNeedsRedraw()}onTouchstart(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))this.touches[n.identifier]={x:n.clientX,y:n.clientY,downT:this.tForX(n.clientX),startDate:Date.now(),downX:n.clientX,downY:n.clientY}}onTouchmove(t){t.preventDefault(),t.stopPropagation();let n=0;for(const l of Array.from(t.changedTouches)){const r=this.touches[l.identifier];r&&(n+=l.clientY-r.y,this.touches[l.identifier]={...r,x:l.clientX,y:l.clientY})}const s=n/Object.keys(this.touches).length;this.yOffset-=s,this.adjustXAxisForTouches(),this.setNeedsRedraw()}onTouchend(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}onTouchcancel(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}adjustXAxisForTouches(){const t=Object.keys(this.touches).map(Number);if(t.length!=0){if(t.length==1){const n=this.touches[t[0]];this.startT=n.downT-(n.x-Ie)/this.zoom}if(t.length>=2){const n=this.touches[t[0]],s=this.touches[t[1]],l=(s.x-n.x)/(s.downT-n.downT),r=n.downT-(n.x-Ie)/l;this.startT=r,this.zoom=l}this.clampViewport()}}}function qn(i){let e;return{c(){e=f("div"),e.innerHTML="",a(e,"class","timeline svelte-p2tt1k")},m(t,n){L(t,e,n),i[6](e)},p:M,i:M,o:M,d(t){t&&I(e),i[6](null)}}}function Un(i,e,t){let n,{session:s}=e;const l=Vt([je],([v])=>({processors:[v.removeImportlib?Ft:null,v.removeTracebackHide?Pt:null,v.removePyinstrument?si:null].filter(h=>h!==null),options:{}}));ge(i,l,v=>t(5,n=v));let r,o=null,c=null;Ii(()=>{c==null||c.destroy()});function d(v){ke[v?"unshift":"push"](()=>{o=v,t(0,o)})}return i.$$set=v=>{"session"in v&&t(2,s=v.session)},i.$$.update=()=>{i.$$.dirty&36&&t(3,r=Qt(s.rootFrame.cloneDeep(),n.processors,n.options)),i.$$.dirty&1&&o&&t(4,c=new Wn(o)),i.$$.dirty&24&&r&&c&&c.setRootFrame(r)},[o,l,s,r,c,n,d]}class Yn extends he{constructor(e){super(),de(this,e,Un,qn,re,{session:2})}}function Xn(i){let e,t,n=i[1].viewMode+"",s;return{c(){e=f("div"),t=R("Unknown view mode: "),s=R(n),a(e,"class","error")},m(l,r){L(l,e,r),u(e,t),u(e,s)},p(l,r){r&2&&n!==(n=l[1].viewMode+"")&&ye(s,n)},i:M,o:M,d(l){l&&I(e)}}}function Gn(i){let e,t;return e=new Yn({props:{session:i[0]}}),{c(){_e(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p(n,s){const l={};s&1&&(l.session=n[0]),e.$set(l)},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function jn(i){let e,t;return e=new Rn({props:{session:i[0]}}),{c(){_e(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p(n,s){const l={};s&1&&(l.session=n[0]),e.$set(l)},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){$(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function Zn(i){let e;return{c(){e=f("div"),e.innerHTML='
No samples recorded.
',a(e,"class","margins")},m(t,n){L(t,e,n)},p:M,i:M,o:M,d(t){t&&I(e)}}}function Kn(i){let e,t,n,s,l,r,o,c;n=new pn({props:{session:i[0]}});const d=[Zn,jn,Gn,Xn],v=[];function p(m,h){return m[0].rootFrame?m[1].viewMode==="call-stack"?1:m[1].viewMode==="timeline"?2:3:0}return r=p(i),o=v[r]=d[r](i),{c(){e=f("div"),t=f("div"),_e(n.$$.fragment),s=y(),l=f("div"),o.c(),a(t,"class","header"),a(l,"class","body svelte-1vwroj7"),a(e,"class","app svelte-1vwroj7")},m(m,h){L(m,e,h),u(e,t),ce(n,t,null),u(e,s),u(e,l),v[r].m(l,null),c=!0},p(m,[h]){const _={};h&1&&(_.session=m[0]),n.$set(_);let w=r;r=p(m),r===w?v[r].p(m,h):(Oe(),$(v[w],1,1,()=>{v[w]=null}),Ve(),o=v[r],o?o.p(m,h):(o=v[r]=d[r](m),o.c()),D(o,1),o.m(l,null))},i(m){c||(D(n.$$.fragment,m),D(o),c=!0)},o(m){$(n.$$.fragment,m),$(o),c=!1},d(m){m&&I(e),ue(n),v[r].d()}}}function Qn(i,e,t){let n;ge(i,Ge,p=>t(1,n=p));let{session:s}=e;const l=document.createElement("link");l.rel="shortcut icon",l.href=vn,document.head.appendChild(l);const r=document.createElement("link");r.rel="preload",r.as="style",r.onload=()=>{r.rel="stylesheet"},r.href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,600&display=swap",document.head.appendChild(r);const o=s.rootFrame,c=o==null?void 0:o.time.toLocaleString(void 0,{maximumSignificantDigits:3});let d,v;return(v=/[^\s/]+(:\d+)?$/.exec(s.target_description))?d=v[0]:d=s.target_description,document.title=`${c}s - ${d} - pyinstrument`,i.$$set=p=>{"session"in p&&t(0,s=p.session)},[s,n]}class Jn extends he{constructor(e){super(),de(this,e,Qn,Kn,re,{session:0})}}class es{constructor(e){T(this,"startTime");T(this,"duration");T(this,"minInterval");T(this,"maxInterval");T(this,"sampleCount");T(this,"target_description");T(this,"cpuTime");T(this,"rootFrame");T(this,"sysPath");T(this,"sysPrefixes");T(this,"_shortenPathCache",{});this.startTime=e.session.start_time,this.duration=e.session.duration,this.minInterval=e.session.min_interval,this.maxInterval=e.session.max_interval,this.sampleCount=e.session.sample_count,this.target_description=e.session.target_description,this.cpuTime=e.session.cpu_time,this.sysPath=e.session.sys_path,this.sysPrefixes=e.session.sys_prefixes,this.rootFrame=new Ke(e.frame_tree,this)}shortenPath(e){if(this._shortenPathCache[e])return this._shortenPathCache[e];let t=e;if($e(e).length>1)for(const s of this.sysPath){const l=ts(e,s);$e(l).length<$e(t).length&&(t=l)}return this._shortenPathCache[e]=t,t}}function $e(i){return i.split(/[/\\]/)}function di(i){const e=$e(i);return e.length>0&&e[0].endsWith(":")?e[0]:null}function ts(i,e){if(di(i)!=di(e))return i;const t=$e(i),n=$e(e);let s=0;for(;s"..").concat(t.slice(s)).join("/")}return{render(i,e){const t=new es(e);return new Jn({target:i,props:{session:t}})}}}(); +var pyinstrumentHTMLRenderer=function(){"use strict";var is=Object.defineProperty;var ns=(F,ve,Pe)=>ve in F?is(F,ve,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):F[ve]=Pe;var A=(F,ve,Pe)=>ns(F,typeof ve!="symbol"?ve+"":ve,Pe);function F(){}function ve(i){return i()}function Pe(){return Object.create(null)}function oe(i){i.forEach(ve)}function pt(i){return typeof i=="function"}function re(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function ki(i){return Object.keys(i).length===0}function St(i,...e){if(i==null){for(const n of e)n(void 0);return F}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function ge(i,e,t){i.$$.on_destroy.push(St(e,t))}function Ci(i,e,t){return i.set(t),e}function u(i,e){i.appendChild(e)}function S(i,e,t){i.insertBefore(e,t||null)}function L(i){i.parentNode&&i.parentNode.removeChild(i)}function h(i){return document.createElement(i)}function V(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function I(i){return document.createTextNode(i)}function b(){return I(" ")}function Mi(){return I("")}function N(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function vt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function gt(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function a(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function _t(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Fi(i){return Array.from(i.childNodes)}function _e(i,e){e=""+e,i.data!==e&&(i.data=e)}function ae(i,e){i.value=e??""}function j(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function Ee(i,e,t){i.classList.toggle(e,!!t)}function Pi(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}class Ri{constructor(e=!1){A(this,"is_svg",!1);A(this,"e");A(this,"n");A(this,"t");A(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=V(t.nodeName):this.e=h(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t{const s=i.$$.callbacks[e];if(s){const l=Pi(e,t,{cancelable:n});return s.slice().forEach(r=>{r.call(i,l)}),!l.defaultPrevented}return!0}}const Se=[],ke=[];let De=[];const Dt=[],Si=Promise.resolve();let yt=!1;function Di(){yt||(yt=!0,Si.then(Ht))}function Tt(i){De.push(i)}const At=new Set;let He=0;function Ht(){if(He!==0)return;const i=Ye;do{try{for(;Hei.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),De=e}const nt=new Set;let Re;function Oe(){Re={r:0,c:[],p:Re}}function Ve(){Re.r||oe(Re.c),Re=Re.p}function D(i,e){i&&i.i&&(nt.delete(i),i.i(e))}function x(i,e,t,n){if(i&&i.o){if(nt.has(i))return;nt.add(i),Re.c.push(()=>{nt.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function Ot(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Vi(i,e){x(i,1,1,()=>{e.delete(i.key)})}function Ni(i,e,t,n,s,l,r,o,c,d,v,p){let m=i.length,f=l.length,g=m;const w={};for(;g--;)w[i[g].key]=g;const E=[],C=new Map,y=new Map,k=[];for(g=f;g--;){const M=p(s,l,g),_=t(M);let T=r.get(_);T?k.push(()=>T.p(M,e)):(T=d(_,M),T.c()),C.set(_,E[g]=T),_ in w&&y.set(_,Math.abs(g-w[_]))}const H=new Set,W=new Set;function P(M){D(M,1),M.m(o,v),r.set(M.key,M),v=M.first,f--}for(;m&&f;){const M=E[f-1],_=i[m-1],T=M.key,R=_.key;M===_?(v=M.first,m--,f--):C.has(R)?!r.has(T)||H.has(T)?P(M):W.has(R)?m--:y.get(T)>y.get(R)?(W.add(T),P(M)):(H.add(R),m--):(c(_,r),m--)}for(;m--;){const M=i[m];C.has(M.key)||c(M,r)}for(;f;)P(E[f-1]);return oe(k),E}function we(i){i&&i.c()}function ce(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),Tt(()=>{const l=i.$$.on_mount.map(ve).filter(pt);i.$$.on_destroy?i.$$.on_destroy.push(...l):oe(l),i.$$.on_mount=[]}),s.forEach(Tt)}function ue(i,e){const t=i.$$;t.fragment!==null&&(Oi(t.after_update),oe(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function xi(i,e){i.$$.dirty[0]===-1&&(Se.push(i),Di(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<{const g=f.length?f[0]:m;return d.ctx&&s(d.ctx[p],d.ctx[p]=g)&&(!d.skip_bound&&d.bound[p]&&d.bound[p](g),v&&xi(i,p)),m}):[],d.update(),v=!0,oe(d.before_update),d.fragment=n?n(d.ctx):!1,e.target){if(e.hydrate){const p=Fi(e.target);d.fragment&&d.fragment.l(p),p.forEach(L)}else d.fragment&&d.fragment.c();e.intro&&D(i.$$.fragment),ce(i,e.target,e.anchor),Ht()}Xe(c)}class fe{constructor(){A(this,"$$");A(this,"$$set")}$destroy(){ue(this,1),this.$destroy=F}$on(e,t){if(!pt(t))return F;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!ki(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const $i="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add($i);function Bi(i){let e,t;return{c(){e=V("svg"),t=V("path"),a(t,"fill-rule","evenodd"),a(t,"clip-rule","evenodd"),a(t,"d","M5.11634 0.889422C4.86506 -0.296474 3.17237 -0.296474 2.92109 0.889422C2.78291 1.54158 2.10994 1.93011 1.47607 1.72371C0.323418 1.34837 -0.522932 2.81429 0.378448 3.62484C0.87414 4.07059 0.87414 4.84767 0.378448 5.29341C-0.522931 6.10397 0.323418 7.56989 1.47607 7.19455C2.10994 6.98814 2.78291 7.37668 2.92109 8.02883C3.17237 9.21473 4.86506 9.21473 5.11634 8.02883C5.25452 7.37668 5.92749 6.98814 6.56136 7.19455C7.71401 7.56989 8.56036 6.10397 7.65898 5.29341C7.16329 4.84767 7.16329 4.07059 7.65898 3.62484C8.56036 2.81429 7.71401 1.34837 6.56136 1.72371C5.92749 1.93011 5.25452 1.54158 5.11634 0.889422ZM4.01883 6.33408C5.05436 6.33408 5.89383 5.49462 5.89383 4.45908C5.89383 3.42355 5.05436 2.58408 4.01883 2.58408C2.98329 2.58408 2.14383 3.42355 2.14383 4.45908C2.14383 5.49462 2.98329 6.33408 4.01883 6.33408Z"),a(t,"fill","currentColor"),a(e,"width","9"),a(e,"height","9"),a(e,"viewBox","0 0 9 9"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(n,s){S(n,e,s),u(e,t)},p:F,i:F,o:F,d(n){n&&L(e)}}}class zi extends fe{constructor(e){super(),de(this,e,null,Bi,re,{})}}function Wi(i){let e,t,n,s,l,r,o,c,d,v,p,m,f,g,w,E,C;return{c(){e=V("svg"),t=V("g"),n=V("path"),s=V("path"),l=V("defs"),r=V("filter"),o=V("feFlood"),c=V("feBlend"),d=V("feGaussianBlur"),v=V("linearGradient"),p=V("stop"),m=V("stop"),f=V("stop"),g=V("linearGradient"),w=V("stop"),E=V("stop"),C=V("stop"),a(n,"fill-rule","evenodd"),a(n,"clip-rule","evenodd"),a(n,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(n,"fill","url(#paint0_linear_67_262)"),a(t,"opacity","0.5"),a(t,"filter","url(#filter0_f_67_262)"),a(s,"fill-rule","evenodd"),a(s,"clip-rule","evenodd"),a(s,"d","M30 9H10V11.5H30V9ZM30 19H12.5V21.5H30V19ZM12.5 14H32.5V16.5H12.5V14ZM20 24H12.5V26.5H20V24ZM12.5 29H20V31.5H12.5V29ZM22.5 34H10V36.5H22.5V34Z"),a(s,"fill","url(#paint1_linear_67_262)"),a(o,"flood-opacity","0"),a(o,"result","BackgroundImageFix"),a(c,"mode","normal"),a(c,"in","SourceGraphic"),a(c,"in2","BackgroundImageFix"),a(c,"result","shape"),a(d,"stdDeviation","3.39785"),a(d,"result","effect1_foregroundBlur_67_262"),a(r,"id","filter0_f_67_262"),a(r,"x","3.2043"),a(r,"y","2.2043"),a(r,"width","36.0914"),a(r,"height","41.0914"),a(r,"filterUnits","userSpaceOnUse"),a(r,"color-interpolation-filters","sRGB"),a(p,"stop-color","#FFAA00"),a(m,"offset","0.514478"),a(m,"stop-color","#FFEB00"),a(f,"offset","1"),a(f,"stop-color","#98FF05"),a(v,"id","paint0_linear_67_262"),a(v,"x1","7.3769"),a(v,"y1","18.4566"),a(v,"x2","20.6583"),a(v,"y2","33.1038"),a(v,"gradientUnits","userSpaceOnUse"),a(w,"stop-color","#FFC834"),a(E,"offset","0.514478"),a(E,"stop-color","#FAF534"),a(C,"offset","1"),a(C,"stop-color","#B8FF38"),a(g,"id","paint1_linear_67_262"),a(g,"x1","7.3769"),a(g,"y1","18.4566"),a(g,"x2","20.6583"),a(g,"y2","33.1038"),a(g,"gradientUnits","userSpaceOnUse"),a(e,"width","44"),a(e,"height","44"),a(e,"viewBox","0 0 44 44"),a(e,"fill","none"),a(e,"xmlns","http://www.w3.org/2000/svg")},m(y,k){S(y,e,k),u(e,t),u(t,n),u(e,s),u(e,l),u(l,r),u(r,o),u(r,c),u(r,d),u(l,v),u(v,p),u(v,m),u(v,f),u(l,g),u(g,w),u(g,E),u(g,C)},p:F,i:F,o:F,d(y){y&&L(e)}}}class qi extends fe{constructor(e){super(),de(this,e,null,Wi,re,{})}}const Ne=[];function Ui(i,e){return{subscribe:st(i,e).subscribe}}function st(i,e=F){let t;const n=new Set;function s(o){if(re(i,o)&&(i=o,t)){const c=!Ne.length;for(const d of n)d[1](),Ne.push(d,i);if(c){for(let d=0;d{n.delete(d),n.size===0&&t&&(t(),t=null)}}return{set:s,update:l,subscribe:r}}function Vt(i,e,t){const n=!Array.isArray(i),s=n?[i]:i;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const l=e.length<2;return Ui(t,(r,o)=>{let c=!1;const d=[];let v=0,p=F;const m=()=>{if(v)return;p();const g=e(n?d[0]:d,r,o);l?r(g):p=pt(g)?g:F},f=s.map((g,w)=>St(g,E=>{d[w]=E,v&=~(1<{v|=1<console.error(`Error when writing value from persisted store "${i}" to ${m}`,P),w=(c=t==null?void 0:t.onParseError)!=null?c:(P,M)=>console.error(`Error when parsing ${P?'"'+P+'"':"value"} from persisted store "${i}"`,M),E=(d=t==null?void 0:t.beforeRead)!=null?d:P=>P,C=(v=t==null?void 0:t.beforeWrite)!=null?v:P=>P,y=typeof window<"u"&&typeof document<"u",k=y?Yi(m):null;function H(P,M){const _=C(M);try{k==null||k.setItem(P,p.stringify(_))}catch(T){g(T)}}function W(){function P(R){try{return p.parse(R)}catch(B){w(R,B)}}const M=k==null?void 0:k.getItem(i);if(M==null)return e;const _=P(M);return _==null?e:E(_)}if(!Et[m][i]){const P=W(),M=st(P,R=>{if(y&&m=="local"&&f){const B=J=>{if(J.key===i&&J.newValue){let $;try{$=p.parse(J.newValue)}catch(ee){w(J.newValue,ee);return}const Le=E($);R(Le)}};return window.addEventListener("storage",B),()=>window.removeEventListener("storage",B)}}),{subscribe:_,set:T}=M;Et[m][i]={set(R){T(R),H(i,R)},update(R){return M.update(B=>{const J=R(B);return H(i,J),J})},reset(){this.set(e)},subscribe:_}}return Et[m][i]}function Nt(){return{collapseMode:"non-application",collapseCustomHide:"",collapseCustomShow:"",removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:.001,timeFormat:"absolute"}}const Z=kt("pyinstrument:viewOptionsCallStack",Nt(),{syncTabs:!0,beforeRead(i){return{...Nt(),...i}}}),Ge=kt("pyinstrument:viewOptions",{viewMode:"call-stack"},{syncTabs:!1}),je=kt("pyinstrument:viewOptionsTimeline",{removeImportlib:!0,removeTracebackHide:!0,removePyinstrument:!0,removeIrrelevant:!0,removeIrrelevantThreshold:1e-4},{syncTabs:!0});class Xi extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Gi(i,e){const t=e*(i.length-1),n=Math.floor(t),s=Math.ceil(t),l=i[n],r=i[s],o=t-n;return Zi(o,{to:[l,r]})}function ji(i,e,t){return i===1/0?(console.warn("clamp: value is Infinity, returning `max`",i),t):i===-1/0?(console.warn("clamp: value is -Infinity, returning `min`",i),e):Number.isFinite(i)?it?t:i:(console.warn("clamp: value isn't finite, returning `min`",i),e)}function xe(i,e){const{from:t=[0,1],to:n=[0,1]}=e,s=e.clamp||!1;let l=(i-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return s&&(l=ji(l,Math.min(n[0],n[1]),Math.max(n[0],n[1]))),l}function Zi(i,e){return`rgb( + ${xe(i,{from:e.from,to:[e.to[0][0],e.to[1][0]],clamp:e.clamp})}, + ${xe(i,{from:e.from,to:[e.to[0][1],e.to[1][1]],clamp:e.clamp})}, + ${xe(i,{from:e.from,to:[e.to[0][2],e.to[1][2]],clamp:e.clamp})} + )`}function Ki(i){if(i.substr(0,1)=="#"){var e=(i.length-1)/3,t=[17,1,.062272][e-1];return[Math.round(parseInt(i.substr(1,e),16)*t),Math.round(parseInt(i.substr(1+e,e),16)*t),Math.round(parseInt(i.substr(1+2*e,e),16)*t)]}else return i.split("(")[1].split(")")[0].split(",").map(n=>+n)}function Qi(i,e,t={}){const{ignore:n=[],capture:s=!0}=t,l=window;if(!l)return()=>{};let r=!0,o=!1;const c=f=>n.some(g=>typeof g=="string"?Array.from(document.querySelectorAll(g)).some(w=>w===f.target||f.composedPath().includes(w)):g&&(f.target===g||f.composedPath().includes(g))),d=f=>{if(!(!i||i===f.target||f.composedPath().includes(i))){if(f.detail===0&&(r=!c(f)),!r){r=!0;return}e(f)}},v=f=>{o||(o=!0,setTimeout(()=>{o=!1},0),d(f))},p=f=>{r=!c(f)&&!!(i&&!f.composedPath().includes(i))};return l.addEventListener("click",v,{passive:!0,capture:s}),l.addEventListener("pointerdown",p,{passive:!0}),()=>{l.removeEventListener("click",v,{capture:s}),l.removeEventListener("pointerdown",p)}}function Ji(i){const e=document.createElement("div");return e.appendChild(document.createTextNode(i)),e.innerHTML}function Ct(i){return Ji(i).replace(/(\/|\\)/g,t=>`${t}`)}function en(i,e){if(i.length==0)return null;let t=i[0],n=e(t);for(const s of i){const l=e(s);l>n&&(t=s,n=l)}return t}function ot(){return Math.random().toString(36).substring(2)}function tn(i){let e,t,n,s,l,r,o,c,d,v,p,m,f,g,w,E,C,y,k,H,W,P,M,_,T,R,B,J,$,Le,ee,Q,Y,Ce,q,Qe,Je,le,U,et,te,he,me,be,pe,Te,tt,Ae,K,Be,Me,it,z,O,X,fi,at,hi,mi,ze,Fe,pi,We,ct,vi,gi,ye,_i,wi,qe,ut,bi,Ue,dt,ft,ie,yi,Ti,ht,mt,ne,Ai,Rt,It,Lt,Ei;return Rt=_t(i[5][0]),It=_t(i[5][1]),{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Collapse frames",s=b(),l=h("div"),r=h("div"),o=h("input"),c=b(),d=h("label"),v=I("Library code"),p=b(),m=h("div"),m.textContent="Code run from the Python stdlib, a virtualenv, or a conda env will be collapsed.",f=b(),g=h("div"),w=h("input"),E=b(),C=h("label"),y=I("Custom"),k=b(),H=h("div"),W=I(`Regex on the source file path. + `),P=h("div"),M=h("label"),M.textContent="Show",_=b(),T=h("input"),R=b(),B=h("label"),B.textContent="Hide",J=b(),$=h("input"),Le=I(` + If neither match, the library code rule is used.`),ee=b(),Q=h("div"),Y=h("input"),Ce=b(),q=h("label"),Qe=I("Disabled"),Je=b(),le=h("div"),U=h("div"),U.textContent="Remove frames",et=b(),te=h("div"),he=h("div"),me=h("input"),be=b(),pe=h("label"),Te=I("importlib machinery"),tt=b(),Ae=h("div"),K=h("input"),Be=b(),Me=h("label"),it=I("Frames declaring __traceback_hide__"),z=b(),O=h("div"),X=h("input"),fi=b(),at=h("label"),hi=I("pyinstrument frames"),mi=b(),ze=h("div"),Fe=h("input"),pi=b(),We=h("span"),ct=h("label"),vi=I("Frames with durations less than"),gi=b(),ye=h("input"),_i=I(` + % of the total time`),wi=b(),qe=h("div"),ut=h("div"),ut.textContent="Time format",bi=b(),Ue=h("div"),dt=h("div"),ft=h("label"),ie=h("input"),yi=I(` + Absolute time in seconds`),Ti=b(),ht=h("div"),mt=h("label"),ne=h("input"),Ai=I(` + Percentage of the total run time`),a(n,"class","name svelte-1pecl4m"),a(o,"id",i[1]+"collapseModeAll"),a(o,"type","radio"),o.__value="non-application",ae(o,o.__value),a(o,"class","svelte-1pecl4m"),a(d,"for",i[1]+"collapseModeAll"),a(m,"class","description svelte-1pecl4m"),a(r,"class","option svelte-1pecl4m"),a(w,"id",i[1]+"collapseModeCustom"),a(w,"type","radio"),w.__value="custom",ae(w,w.__value),a(w,"class","svelte-1pecl4m"),a(C,"for",i[1]+"collapseModeCustom"),a(M,"for","collapseCustomShow"),a(M,"class","svelte-1pecl4m"),a(T,"id","collapseCustomShow"),a(T,"type","text"),a(T,"placeholder","myproject"),a(T,"spellcheck","false"),a(T,"autocapitalize","off"),a(T,"autocomplete","off"),a(T,"autocorrect","off"),a(T,"class","svelte-1pecl4m"),a(B,"for","collapseCustomHide"),a(B,"class","svelte-1pecl4m"),a($,"id","collapseCustomHide"),a($,"type","text"),a($,"placeholder",".*/lib/.*"),a($,"spellcheck","false"),a($,"autocapitalize","off"),a($,"autocomplete","off"),a($,"autocorrect","off"),a($,"class","svelte-1pecl4m"),a(P,"class","mini-input-grid svelte-1pecl4m"),a(H,"class","description svelte-1pecl4m"),a(g,"class","option svelte-1pecl4m"),a(Y,"id",i[1]+"collapseModeDisabled"),a(Y,"type","radio"),Y.__value="disabled",ae(Y,Y.__value),a(Y,"class","svelte-1pecl4m"),a(q,"for",i[1]+"collapseModeDisabled"),a(Q,"class","option svelte-1pecl4m"),a(l,"class","body"),a(t,"class","option-group svelte-1pecl4m"),a(U,"class","name svelte-1pecl4m"),a(me,"id",i[1]+"removeImportlib"),a(me,"type","checkbox"),a(me,"class","svelte-1pecl4m"),a(pe,"for",i[1]+"removeImportlib"),a(he,"class","option svelte-1pecl4m"),a(K,"id",i[1]+"removeTracebackHide"),a(K,"type","checkbox"),a(K,"class","svelte-1pecl4m"),a(Me,"for",i[1]+"removeTracebackHide"),a(Ae,"class","option svelte-1pecl4m"),a(X,"id",i[1]+"removePyinstrument"),a(X,"type","checkbox"),a(X,"class","svelte-1pecl4m"),a(at,"for",i[1]+"removePyinstrument"),a(O,"class","option svelte-1pecl4m"),a(Fe,"id",i[1]+"removeIrrelevant"),a(Fe,"type","checkbox"),a(Fe,"class","svelte-1pecl4m"),a(ct,"for",i[1]+"removeIrrelevant"),a(ye,"type","number"),ye.value=i[2](),a(ye,"min","0"),a(ye,"max","99"),a(ye,"step","0.01"),j(ye,"width","4em"),a(ye,"class","svelte-1pecl4m"),a(ze,"class","option svelte-1pecl4m"),a(te,"class","body"),a(le,"class","option-group svelte-1pecl4m"),a(ut,"class","name svelte-1pecl4m"),a(ie,"type","radio"),ie.__value="absolute",ae(ie,ie.__value),a(ie,"class","svelte-1pecl4m"),a(dt,"class","option svelte-1pecl4m"),a(ne,"type","radio"),ne.__value="proportion",ae(ne,ne.__value),a(ne,"class","svelte-1pecl4m"),a(ht,"class","option svelte-1pecl4m"),a(Ue,"class","body"),a(qe,"class","option-group svelte-1pecl4m"),a(e,"class","view-options-call-stack svelte-1pecl4m"),Rt.p(ie,ne),It.p(o,w,Y)},m(G,se){S(G,e,se),u(e,t),u(t,n),u(t,s),u(t,l),u(l,r),u(r,o),o.checked=o.__value===i[0].collapseMode,u(r,c),u(r,d),u(d,v),u(r,p),u(r,m),u(l,f),u(l,g),u(g,w),w.checked=w.__value===i[0].collapseMode,u(g,E),u(g,C),u(C,y),u(g,k),u(g,H),u(H,W),u(H,P),u(P,M),u(P,_),u(P,T),ae(T,i[0].collapseCustomShow),u(P,R),u(P,B),u(P,J),u(P,$),ae($,i[0].collapseCustomHide),u(H,Le),u(l,ee),u(l,Q),u(Q,Y),Y.checked=Y.__value===i[0].collapseMode,u(Q,Ce),u(Q,q),u(q,Qe),u(e,Je),u(e,le),u(le,U),u(le,et),u(le,te),u(te,he),u(he,me),me.checked=i[0].removeImportlib,u(he,be),u(he,pe),u(pe,Te),u(te,tt),u(te,Ae),u(Ae,K),K.checked=i[0].removeTracebackHide,u(Ae,Be),u(Ae,Me),u(Me,it),u(te,z),u(te,O),u(O,X),X.checked=i[0].removePyinstrument,u(O,fi),u(O,at),u(at,hi),u(te,mi),u(te,ze),u(ze,Fe),Fe.checked=i[0].removeIrrelevant,u(ze,pi),u(ze,We),u(We,ct),u(ct,vi),u(We,gi),u(We,ye),u(We,_i),u(e,wi),u(e,qe),u(qe,ut),u(qe,bi),u(qe,Ue),u(Ue,dt),u(dt,ft),u(ft,ie),ie.checked=ie.__value===i[0].timeFormat,u(ft,yi),u(Ue,Ti),u(Ue,ht),u(ht,mt),u(mt,ne),ne.checked=ne.__value===i[0].timeFormat,u(mt,Ai),Lt||(Ei=[N(o,"change",i[4]),N(w,"change",i[6]),N(T,"input",i[7]),N($,"input",i[8]),N(Y,"change",i[9]),N(me,"change",i[10]),N(K,"change",i[11]),N(X,"change",i[12]),N(Fe,"change",i[13]),N(ye,"input",i[3]),N(ie,"change",i[14]),N(ne,"change",i[15])],Lt=!0)},p(G,[se]){se&1&&(o.checked=o.__value===G[0].collapseMode),se&1&&(w.checked=w.__value===G[0].collapseMode),se&1&&T.value!==G[0].collapseCustomShow&&ae(T,G[0].collapseCustomShow),se&1&&$.value!==G[0].collapseCustomHide&&ae($,G[0].collapseCustomHide),se&1&&(Y.checked=Y.__value===G[0].collapseMode),se&1&&(me.checked=G[0].removeImportlib),se&1&&(K.checked=G[0].removeTracebackHide),se&1&&(X.checked=G[0].removePyinstrument),se&1&&(Fe.checked=G[0].removeIrrelevant),se&1&&(ie.checked=ie.__value===G[0].timeFormat),se&1&&(ne.checked=ne.__value===G[0].timeFormat)},i:F,o:F,d(G){G&&L(e),Rt.r(),It.r(),Lt=!1,oe(Ei)}}}function nn(i,e,t){let n;ge(i,Z,k=>t(0,n=k));const s=ot();function l(){return(n.removeIrrelevantThreshold*100).toLocaleString(void 0,{maximumFractionDigits:4})}function r(k){Ci(Z,n.removeIrrelevantThreshold=k.currentTarget.valueAsNumber/100,n)}const o=[[],[]];function c(){n.collapseMode=this.__value,Z.set(n)}function d(){n.collapseMode=this.__value,Z.set(n)}function v(){n.collapseCustomShow=this.value,Z.set(n)}function p(){n.collapseCustomHide=this.value,Z.set(n)}function m(){n.collapseMode=this.__value,Z.set(n)}function f(){n.removeImportlib=this.checked,Z.set(n)}function g(){n.removeTracebackHide=this.checked,Z.set(n)}function w(){n.removePyinstrument=this.checked,Z.set(n)}function E(){n.removeIrrelevant=this.checked,Z.set(n)}function C(){n.timeFormat=this.__value,Z.set(n)}function y(){n.timeFormat=this.__value,Z.set(n)}return[n,s,l,r,c,o,d,v,p,m,f,g,w,E,C,y]}class sn extends fe{constructor(e){super(),de(this,e,nn,tn,re,{})}}function on(i){let e,t,n,s,l,r,o,c,d,v,p,m,f,g,w,E,C,y,k,H,W,P,M,_;return{c(){e=h("div"),t=h("div"),n=h("div"),n.textContent="Remove frames",s=b(),l=h("div"),r=h("div"),o=h("input"),c=b(),d=h("label"),v=I("importlib machinery"),p=b(),m=h("div"),f=h("input"),g=b(),w=h("label"),E=I("Frames declaring __traceback_hide__"),C=b(),y=h("div"),k=h("input"),H=b(),W=h("label"),P=I("pyinstrument frames"),a(n,"class","name"),a(o,"id",i[1]+"removeImportlib"),a(o,"type","checkbox"),a(d,"for",i[1]+"removeImportlib"),a(r,"class","option"),a(f,"id",i[1]+"removeTracebackHide"),a(f,"type","checkbox"),a(w,"for",i[1]+"removeTracebackHide"),a(m,"class","option"),a(k,"id",i[1]+"removePyinstrument"),a(k,"type","checkbox"),a(W,"for",i[1]+"removePyinstrument"),a(y,"class","option"),a(l,"class","body"),a(t,"class","option-group"),a(e,"class","view-options-timeline svelte-vsz8zm")},m(T,R){S(T,e,R),u(e,t),u(t,n),u(t,s),u(t,l),u(l,r),u(r,o),o.checked=i[0].removeImportlib,u(r,c),u(r,d),u(d,v),u(l,p),u(l,m),u(m,f),f.checked=i[0].removeTracebackHide,u(m,g),u(m,w),u(w,E),u(l,C),u(l,y),u(y,k),k.checked=i[0].removePyinstrument,u(y,H),u(y,W),u(W,P),M||(_=[N(o,"change",i[2]),N(f,"change",i[3]),N(k,"change",i[4])],M=!0)},p(T,[R]){R&1&&(o.checked=T[0].removeImportlib),R&1&&(f.checked=T[0].removeTracebackHide),R&1&&(k.checked=T[0].removePyinstrument)},i:F,o:F,d(T){T&&L(e),M=!1,oe(_)}}}function rn(i,e,t){let n;ge(i,je,c=>t(0,n=c));const s=ot();function l(){n.removeImportlib=this.checked,je.set(n)}function r(){n.removeTracebackHide=this.checked,je.set(n)}function o(){n.removePyinstrument=this.checked,je.set(n)}return[n,s,l,r,o]}class ln extends fe{constructor(e){super(),de(this,e,rn,on,re,{})}}function an(i){let e,t;return e=new ln({}),{c(){we(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){x(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function cn(i){let e,t;return e=new sn({}),{c(){we(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){x(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function un(i){let e,t,n,s,l,r,o,c,d;const v=[cn,an],p=[];function m(f,g){return f[0].viewMode==="call-stack"?0:f[0].viewMode==="timeline"?1:-1}return~(o=m(i))&&(c=p[o]=v[o](i)),{c(){e=h("div"),t=h("div"),n=h("div"),s=I(i[3]),l=b(),r=h("div"),c&&c.c(),a(n,"class","title-row svelte-rpk7lo"),a(r,"class","body svelte-rpk7lo"),a(t,"class","box svelte-rpk7lo"),a(e,"class","view-options svelte-rpk7lo")},m(f,g){S(f,e,g),u(e,t),u(t,n),u(n,s),u(t,l),u(t,r),~o&&p[o].m(r,null),i[4](t),i[5](e),d=!0},p(f,[g]){(!d||g&8)&&_e(s,f[3]);let w=o;o=m(f),o!==w&&(c&&(Oe(),x(p[w],1,1,()=>{p[w]=null}),Ve()),~o?(c=p[o],c||(c=p[o]=v[o](f),c.c()),D(c,1),c.m(r,null)):c=null)},i(f){d||(D(c),d=!0)},o(f){x(c),d=!1},d(f){f&&L(e),~o&&p[o].d(),i[4](null),i[5](null)}}}function dn(i,e,t){let n;ge(i,Ge,m=>t(0,n=m));const s=Li();function l(){s("close")}let r,o;bt(()=>{if(o)return Qi(o,l,{ignore:[".js-view-options-button"]})});function c(){if(!r||!o)return;const m=r.getBoundingClientRect(),g=o.getBoundingClientRect().width;m.right-g-20<0?t(2,o.style.right=`${m.right-g-20}px`,o):t(2,o.style.right="0",o)}bt(()=>(c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)));let d="View options";function v(m){ke[m?"unshift":"push"](()=>{o=m,t(2,o)})}function p(m){ke[m?"unshift":"push"](()=>{r=m,t(1,r)})}return i.$$.update=()=>{i.$$.dirty&1&&(n.viewMode==="call-stack"?t(3,d="Call stack view options"):n.viewMode==="timeline"&&t(3,d="Timeline view options"))},[n,r,o,d,v,p]}class fn extends fe{constructor(e){super(),de(this,e,dn,un,re,{})}}function xt(i){let e,t;return e=new fn({}),e.$on("close",i[9]),{c(){we(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p:F,i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){x(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function hn(i){let e,t,n,s,l,r,o,c,d=Ct(i[0].target_description)+"",v,p,m,f,g,w,E,C,y,k,H,W,P,M=i[0].sampleCount+"",_,T,R,B,J,$,Le,ee,Q,Y,Ce,q,Qe,Je,le,U,et,te,he,me,be,pe,Te,tt,Ae,K,Be,Me,it;l=new qi({}),Te=new zi({});let z=i[1]&&xt(i);return Be=_t(i[7][0]),{c(){e=h("div"),t=h("div"),n=h("div"),s=h("div"),we(l.$$.fragment),r=b(),o=h("div"),c=h("div"),v=b(),p=h("div"),m=h("div"),f=h("span"),f.textContent="Recorded:",g=b(),w=h("span"),w.textContent=`${i[3]}`,E=b(),C=h("br"),y=b(),k=h("div"),H=h("span"),H.textContent="Samples:",W=b(),P=h("span"),_=I(M),T=b(),R=h("div"),B=h("span"),B.textContent="CPU utilization:",J=b(),$=h("span"),$.textContent=`${(i[4]*100).toFixed(0)}%`,Le=b(),ee=h("div"),Q=h("div"),Y=I(`View: + `),Ce=h("label"),q=h("input"),Qe=I(` + Call stack`),Je=b(),le=h("label"),U=h("input"),et=I(` + Timeline`),te=b(),he=h("div"),me=b(),be=h("div"),pe=h("button"),we(Te.$$.fragment),tt=I(` + View options`),Ae=b(),z&&z.c(),a(s,"class","logo svelte-qdxst2"),a(c,"class","target-description svelte-qdxst2"),a(f,"class","metric-label svelte-qdxst2"),a(w,"class","metric-value svelte-qdxst2"),a(m,"class","metric date svelte-qdxst2"),a(C,"class","svelte-qdxst2"),a(H,"class","metric-label svelte-qdxst2"),a(P,"class","metric-value svelte-qdxst2"),a(k,"class","metric svelte-qdxst2"),a(B,"class","metric-label svelte-qdxst2"),a($,"class","metric-value svelte-qdxst2"),a(R,"class","metric svelte-qdxst2"),a(p,"class","metrics svelte-qdxst2"),a(q,"type","radio"),q.__value="call-stack",ae(q,q.__value),a(q,"class","svelte-qdxst2"),a(Ce,"class","svelte-qdxst2"),a(U,"type","radio"),U.__value="timeline",ae(U,U.__value),a(U,"class","svelte-qdxst2"),a(le,"class","svelte-qdxst2"),a(Q,"class","toggle"),a(he,"class","spacer"),j(he,"flex","1"),a(pe,"class","js-view-options-button svelte-qdxst2"),a(be,"class","button-container svelte-qdxst2"),a(ee,"class","view-options svelte-qdxst2"),a(o,"class","layout svelte-qdxst2"),a(n,"class","row svelte-qdxst2"),a(t,"class","margins"),a(e,"class","header svelte-qdxst2"),Be.p(q,U)},m(O,X){S(O,e,X),u(e,t),u(t,n),u(n,s),ce(l,s,null),u(n,r),u(n,o),u(o,c),c.innerHTML=d,u(o,v),u(o,p),u(p,m),u(m,f),u(m,g),u(m,w),u(p,E),u(p,C),u(p,y),u(p,k),u(k,H),u(k,W),u(k,P),u(P,_),u(p,T),u(p,R),u(R,B),u(R,J),u(R,$),u(o,Le),u(o,ee),u(ee,Q),u(Q,Y),u(Q,Ce),u(Ce,q),q.checked=q.__value===i[2].viewMode,u(Ce,Qe),u(Q,Je),u(Q,le),u(le,U),U.checked=U.__value===i[2].viewMode,u(le,et),u(ee,te),u(ee,he),u(ee,me),u(ee,be),u(be,pe),ce(Te,pe,null),u(pe,tt),u(be,Ae),z&&z.m(be,null),K=!0,Me||(it=[N(q,"change",i[6]),N(U,"change",i[8]),N(pe,"click",gt(vt(i[5])))],Me=!0)},p(O,[X]){(!K||X&1)&&d!==(d=Ct(O[0].target_description)+"")&&(c.innerHTML=d),(!K||X&1)&&M!==(M=O[0].sampleCount+"")&&_e(_,M),X&4&&(q.checked=q.__value===O[2].viewMode),X&4&&(U.checked=U.__value===O[2].viewMode),O[1]?z?(z.p(O,X),X&2&&D(z,1)):(z=xt(O),z.c(),D(z,1),z.m(be,null)):z&&(Oe(),x(z,1,1,()=>{z=null}),Ve())},i(O){K||(D(l.$$.fragment,O),D(Te.$$.fragment,O),D(z),K=!0)},o(O){x(l.$$.fragment,O),x(Te.$$.fragment,O),x(z),K=!1},d(O){O&&L(e),ue(l),ue(Te),z&&z.d(),Be.r(),Me=!1,oe(it)}}}function mn(i,e,t){let n;ge(i,Ge,f=>t(2,n=f));let{session:s}=e;const l=new Date(s.startTime*1e3).toLocaleString(void 0,{dateStyle:"long",timeStyle:"medium"}),r=s.cpuTime/s.duration;let o=!1;function c(f){t(1,o=!o)}const d=[[]];function v(){n.viewMode=this.__value,Ge.set(n)}function p(){n.viewMode=this.__value,Ge.set(n)}const m=()=>t(1,o=!1);return i.$$set=f=>{"session"in f&&t(0,s=f.session)},[s,o,n,l,r,c,v,d,p,m]}class pn extends fe{constructor(e){super(),de(this,e,mn,hn,re,{session:0})}}const vn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAWmSURBVHgBtVc7i11VFF5rn3PvPKoLFlqmDGPhaGVpJQoWAZEEGxERFBsDgnY6KFpaWWrQysRGf4BgmSKQFCKWKQMKTqNzz2svv/XY55ybeycTCw+z736cs/f61rdee5hmz/Hx85c66m4QyTEzrdAo4cd6EuuJ2P4wtbmUgfZkCyRoWVcwyMI29ybW47sfhRfXf793+z4X4ZchPEl3F2esElYrbRVaEjQGEKGE3jcUofGwlIEBygoACAa0fmDrdV4AOAg6FV4+W49nUPdlEW4AElGNtqjZ+hqIdI2NAC7KuvAZloyJCR+IukGmF5A6iH/IbEBWLN2NevbBFQ6tCoAF3u7VggYQtQJyFlygOAADI74Jf669QDiWWh6xFRMUgLF6PAGYkcgGgGkBE/x8AiSVaykG0AUxlgm7BY0BUMAQL8R77LM96F98A98kBeu+kAdlgA0MntUGACmOFDQl5sm+Rai6lwpMLtiEgSVGE8wVFBkAB7XcU+rdJOoLSU0x8Aii3ta/0AWqMHjlM6LDPaYDHLSsnRn9pjMny2jBCDSu9H3tDqpCmw4C6lgHqAQmWB05uwwF8RCAQpU7jIbQYCElBsjAlabfqJdnD7lKwzVcIVVOgmKpF2g921pS8/QRvuETmwDEKZdwFHMocYHffYSfBc0opojVIomjx/dY64CkxVktMsgar16/IhbKygANruwWA+YDkURUcNHQaK5ps1XhBwaAzf6M9YzWq3Ac1EKACm80cB8KV6IdPsCR0aQAMBAaUkxXPyU6WDqlypKaSEOtmCCpDyAKFgu1gSecrhdar4n++VsiGUVWDHUpdJkYEPEkEyDc7paHTShXbkuNhqQfaF5wMt16lff69JYFFYT3A8AYgFxku5xtBtw9R7YsEiH85hcYLIsfuO0lfCCHvTtMWxszNRhDebp+LRsTGobFr0zBiO5tBnhWaZgiDwD5gi3Wiw+YcDAwoDfB+MaFq83RsP8M5zSYdFjsBwfh9YAjErbyQLHNVNUsH2Dl2odCh4dE+0vQXjtI9YG2z05zOKvSbdR3eKdtLTbugVKzoOQxC+7KA5NtJPiXEZaH5xDglMrOBMHTWxdWhA/QVqtgEdx3EtVwSkDOxE4GHESpCZzcHLe+4gg3HA7P69jpfvutTA0GTQNNkXAs5UYJVjC593keik/JBohzALjQsXbrJtRksRgntzm7nVX4GnZumtC4D23N4aIAZWdv9LyZv+3IA87AlHY1HQu9+q7Qwb7nAQ01FbQ+g5NBaNOKA2jdD0bg4+UjzCrbqu6IgrLB6aLRF6KWB0ZNUj15QvLCRVa8PNanqiq7pM7kbVXDEvdaipMmHIRfBa2//aYC9WI5vjH6ydLsB1ezpePiK9PhYcoLnjSK5kljNUWqvXppKdVxo4XFhIsJ93gXy/8clxIvt0X7i4XrU8+1D+wGgKPGW/UCzHfew9VsXywVZxbz8GYdKqS4rCTfZ/NZvD8WA/Yxu/aW661F7q+cIbsXVO6EcVf3b0t9SIXFx9N+kwEO3w8QVmhggq+/9xSroVdiv5TZlr0SanL6/KXOK5SaL9b/G4DRdDzONZbPuAjXS4bnfPWBPrJkjhzpYbdR8OeXz62nvBt3HD3z3F/2f0Fyx9O7XL2HAoj7YG33AK8Bag4TrJlOa0DrrVtrj7DsPBtKlgstsZGIcOW+B0wvlMP1EOqcCh1rTldb+/Xcw2woqbaLeh/Vbl7vH/Vgx08TABrehO53ccJKK1ZWP+gjpRqAKdaN8jxLs5r7Bx5TMBm18kjxOOZ0ub/3flUW/nzw4PSJp568CT0vYXq5aGJgslc4o7doPI6dcis2eUq950Ug1DqF9NvQ/uVf79y5v+E1IptedEInNj+iT2L9Nfv9jf7gI/pFdP4D5rfoaYw/Lv+pReVRq/JOEEXOee/PAf7/PP8C3bt510T4rIwAAAAASUVORK5CYII=",$t=st({}),Bt=st({});function zt(i){return i>.6?"#FF4159":i>.3?"#F5A623":i>.15?"#D8CB2A":i>.05?"#7ED321":"#58984f"}function Wt(i,e,t){const n=i.slice();return n[21]=e[t],n}function qt(i){let e,t,n,s,l,r,o,c,d,v,p,m,f,g,w,E,C;return{c(){e=h("div"),t=h("div"),n=V("svg"),s=V("path"),l=b(),r=h("div"),o=I(i[6]),c=b(),d=h("div"),v=I(i[4]),p=b(),m=h("div"),f=I(i[5]),g=b(),w=h("div"),a(s,"d","M.937-.016L5.793 4.84.937 9.696z"),a(s,"fill",i[8]),a(s,"fill-rule","evenodd"),a(s,"fill-opacity",".582"),a(n,"width","6"),a(n,"height","10"),a(t,"class","frame-triangle svelte-7e9kco"),Ee(t,"rotate",!i[9]),j(t,"visibility",i[0].children.length>0?"visible":"hidden"),a(r,"class","time svelte-7e9kco"),j(r,"color",i[8]),j(r,"font-weight",i[11]<.15?500:600),a(d,"class","name svelte-7e9kco"),a(m,"class","code-position svelte-7e9kco"),a(e,"class","frame-description svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),Ee(e,"application-code",i[0].isApplicationCode),Ee(e,"children-visible",!i[9]),j(e,"padding-left",`${i[2]*35}px`),a(w,"class","visual-guide svelte-7e9kco"),j(w,"left",`${i[2]*35+21}px`),j(w,"background-color",i[8])},m(y,k){S(y,e,k),u(e,t),u(t,n),u(n,s),u(e,l),u(e,r),u(r,o),u(e,c),u(e,d),u(d,v),u(e,p),u(e,m),u(m,f),S(y,g,k),S(y,w,k),E||(C=[N(e,"keydown",i[14]),N(e,"click",gt(vt(i[12])))],E=!0)},p(y,k){k&256&&a(s,"fill",y[8]),k&512&&Ee(t,"rotate",!y[9]),k&1&&j(t,"visibility",y[0].children.length>0?"visible":"hidden"),k&64&&_e(o,y[6]),k&256&&j(r,"color",y[8]),k&16&&_e(v,y[4]),k&32&&_e(f,y[5]),k&1&&Ee(e,"application-code",y[0].isApplicationCode),k&512&&Ee(e,"children-visible",!y[9]),k&4&&j(e,"padding-left",`${y[2]*35}px`),k&4&&j(w,"left",`${y[2]*35+21}px`),k&256&&j(w,"background-color",y[8])},d(y){y&&(L(e),L(g),L(w)),E=!1,oe(C)}}}function Ut(i){let e,t,n,s,l=i[0].group.frames.length-1+"",r,o,c,d,v,p;return{c(){e=h("div"),t=h("div"),n=h("div"),n.innerHTML='',s=b(),r=I(l),o=I(" frames hidden ("),c=I(i[7]),d=I(")"),a(n,"class","group-triangle svelte-7e9kco"),Ee(n,"rotate",i[10]),a(t,"class","group-header-button svelte-7e9kco"),a(e,"class","group-header svelte-7e9kco"),a(e,"role","button"),a(e,"tabindex","0"),j(e,"padding-left",`${i[2]*35}px`)},m(m,f){S(m,e,f),u(e,t),u(t,n),u(t,s),u(t,r),u(t,o),u(t,c),u(t,d),v||(p=[N(e,"keydown",i[15]),N(e,"click",gt(vt(i[13])))],v=!0)},p(m,f){f&1024&&Ee(n,"rotate",m[10]),f&1&&l!==(l=m[0].group.frames.length-1+"")&&_e(r,l),f&128&&_e(c,m[7]),f&4&&j(e,"padding-left",`${m[2]*35}px`)},d(m){m&&L(e),v=!1,oe(p)}}}function Yt(i){let e,t=[],n=new Map,s,l=Ot(i[0].children);const r=o=>o[21].uuid;for(let o=0;o0&&Yt(i);return{c(){e=h("div"),l&&l.c(),t=b(),r&&r.c(),n=b(),o&&o.c(),a(e,"class","frame svelte-7e9kco")},m(c,d){S(c,e,d),l&&l.m(e,null),u(e,t),r&&r.m(e,null),u(e,n),o&&o.m(e,null),s=!0},p(c,[d]){c[3]?l?l.p(c,d):(l=qt(c),l.c(),l.m(e,t)):l&&(l.d(1),l=null),c[0].group&&c[0].group.rootFrame==c[0]&&!c[9]?r?r.p(c,d):(r=Ut(c),r.c(),r.m(e,n)):r&&(r.d(1),r=null),!c[9]&&c[0].children.length>0?o?(o.p(c,d),d&513&&D(o,1)):(o=Yt(c),o.c(),D(o,1),o.m(e,null)):o&&(Oe(),x(o,1,1,()=>{o=null}),Ve())},i(c){s||(D(o),s=!0)},o(c){x(o),s=!1},d(c){c&&L(e),l&&l.d(),r&&r.d(),o&&o.d()}}}function Gt(){const i='a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])',e=document.querySelector(".call-stack-view");if(!e)throw new Error("callStackElement not found");var t=Array.prototype.filter.call(e.querySelectorAll(i),function(n){return n.offsetWidth>0||n.offsetHeight>0||n===document.activeElement});return t}function jt(){const i=Gt();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e+1];t&&t.focus()}}function Zt(){const i=Gt();var e=i.indexOf(document.activeElement);if(e>-1){var t=i[e-1];t&&t.focus()}}function _n(i,e,t){let n,s,l,r,o;ge(i,Bt,_=>t(16,l=_)),ge(i,$t,_=>t(17,r=_)),ge(i,Z,_=>t(18,o=_));let{frame:c}=e,{rootFrame:d}=e,{indent:v=0}=e,p;const m=c.time/d.time;let f,g;c.isSynthetic||c.filePathShort==null?g="":c.lineNo==null||c.lineNo===0?g=c.filePathShort:g=`${c.filePathShort}:${c.lineNo}`;let w,E=null;if(c.group){const _=c.group.libraries;_.length<4?E=_.join(", "):E=`${_[0]}, ${_[1]}, ${_[2]}...`}let C;C=zt(m);function y(_){k(c,!s,_.altKey)}function k(_,T,R=!0){if(Bt.update(B=>({...B,[_.uuid]:T})),R)for(const B of _.children)k(B,T,!0),_.group&&_.group.rootFrame==_&&H(_.group.id,!T)}function H(_,T){$t.update(R=>({...R,[_]:T}))}function W(){c.group&&H(c.group.id,!n)}function P(_){let T=!0;_.key==="Enter"||_.key===" "?y(_):_.key==="ArrowLeft"&&!s?k(c,!0,_.altKey):_.key==="ArrowRight"&&s?k(c,!1,_.altKey):_.key==="ArrowUp"?Zt():_.key==="ArrowDown"?jt():T=!1,T&&(_.preventDefault(),_.stopPropagation())}function M(_){let T=!0;_.key==="Enter"||_.key===" "?W():_.key==="ArrowLeft"&&c.group?H(c.group.id,!1):_.key==="ArrowRight"&&c.group?H(c.group.id,!0):_.key==="ArrowUp"?Zt():_.key==="ArrowDown"?jt():T=!1,T&&(_.preventDefault(),_.stopPropagation())}return i.$$set=_=>{"frame"in _&&t(0,c=_.frame),"rootFrame"in _&&t(1,d=_.rootFrame),"indent"in _&&t(2,v=_.indent)},i.$$.update=()=>{var _,T;if(i.$$.dirty&131073&&(c.group?r[c.group.id??""]||((_=c.group)==null?void 0:_.rootFrame)===c||c.children.filter(R=>!R.group).length>1?t(3,p=!0):t(3,p=!1):t(3,p=!0)),i.$$.dirty&1&&(c.className?t(4,f=`${c.className}.${c.function}`):t(4,f=c.function)),i.$$.dirty&262145)if(o.timeFormat==="absolute")t(6,w=c.time.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:3}));else if(o.timeFormat==="proportion")t(6,w=`${(m*100).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}%`);else throw new Error("unknown timeFormat");i.$$.dirty&131073&&t(10,n=r[((T=c.group)==null?void 0:T.id)??""]===!0),i.$$.dirty&65537&&t(9,s=l[c.uuid]===!0)},[c,d,v,p,f,g,w,E,C,s,n,m,y,W,P,M,l,r,o]}let Kt=class extends fe{constructor(e){super(),de(this,e,_n,gn,re,{frame:0,rootFrame:1,indent:2})}};function Qt(i,e,t){let n=i;for(const s of e)if(n=s(n,t),!n)return null;return n}const wn="\0",bn="[await]",Ze="[self]",yn=[bn,Ze,"[out-of-context]","[root]"],Tn="c",An="h";class Ke{constructor(e,t){A(this,"uuid",ot());A(this,"identifier");A(this,"_identifierParts");A(this,"startTime");A(this,"time",0);A(this,"absorbedTime",0);A(this,"group",null);A(this,"attributes");A(this,"_children",[]);A(this,"parent",null);A(this,"context");var l;this.identifier=e.identifier,this._identifierParts=this.identifier.split(wn),this.startTime=e.startTime??0,this.time=e.time??0,this.attributes=e.attributes??{},this.context=t;let n=this.startTime;const s=(l=e.children)==null?void 0:l.map(r=>(r.startTime===void 0&&(r={...r,startTime:n},n+=r.time??0),n=r.startTime+(r.time??0),new Ke(r,t)));s&&this.addChildren(s)}cloneDeep(){return new Ke(this,this.context)}get children(){return this._children}addChild(e,t={}){if(e.removeFromParent(),e.parent=this,t.after){const n=this._children.indexOf(t.after);if(n==-1)throw new Error("After frame not found");this._children.splice(n+1,0,e)}else this._children.push(e)}addChildren(e,t={}){e=e.slice(),t.after?(e.slice().reverse(),e.forEach(s=>this.addChild(s,t))):e.forEach(n=>this.addChild(n,t))}removeFromParent(){if(this.parent){const e=this.parent._children.indexOf(this);this.parent._children.splice(e,1),this.parent=null}}getAttributes(e){return Object.keys(this.attributes).filter(n=>n.startsWith(e)).map(n=>({data:n.slice(1),time:this.attributes[n]}))}getAttributeValue(e){const t=this.getAttributes(e);if(!t||t.length==0)return null;let n=0;for(let s=0;st[n].time&&(n=s);return t[n].data}get hasTracebackHide(){return this.getAttributeValue(An)=="1"}get function(){return this._identifierParts[0]}get filePath(){return this._identifierParts[1]??null}get lineNo(){const e=this._identifierParts[2];return e?parseInt(e):null}get isSynthetic(){return yn.includes(this.identifier)}get filePathShort(){return this.isSynthetic&&this.parent?this.parent.filePathShort:this.filePath?this.context.shortenPath(this.filePath):null}get isApplicationCode(){if(this.isSynthetic)return!1;const e=this.filePath;return!e||this.context.sysPrefixes.some(n=>e.startsWith(n))?!1:e.startsWith("<")?e.startsWith(""||e==""?this.parent?this.parent.isApplicationCode:!0:!1:!0}get proportionOfParent(){return this.parent?this.time/this.parent.time:1}get className(){return this.getAttributeValue(Tn)??""}get library(){const e=this.filePathShort;return e?/^[\\/.]*[^\\/.]*/.exec(e)[0]??"":null}}class En{constructor(e){A(this,"id");A(this,"rootFrame");A(this,"_frames",[]);this.id=ot(),this.rootFrame=e}addFrame(e){e.group&&e.group.removeFrame(e),this._frames.push(e),e.group=this}removeFrame(e){if(e.group!==this)throw new Error("Frame not in group.");const t=this._frames.indexOf(e);if(t===-1)throw new Error("Frame not found in group.");this._frames.splice(t,1),e.group=null}get frames(){return this._frames}get exitFrames(){const e=[];for(const t of this.frames){let n=!1;for(const s of t.children)if(s.group!=this){n=!0;break}n&&e.push(t)}return e}get libraries(){const e=[];for(const t of this.frames){const n=t.library;n&&(e.includes(n)||e.push(n))}return e}}function rt(i,e){const{replaceWith:t}=e,n=i.parent;if(!n)throw new Error("Cannot delete the root frame");if(t=="children")n.addChildren(i.children,{after:i});else if(t=="self_time")n.addChild(new Ke({identifier:Ze,time:i.time},n.context),{after:i});else if(t=="nothing")n.absorbedTime+=i.time;else throw new Xi(t);i.removeFromParent(),Mt(i,!0)}function kn(i,e){if(i.parent!==e.parent)throw new Error("Both frames must have the same parent.");e.absorbedTime+=i.absorbedTime,e.time+=i.time,Object.entries(i.attributes).forEach(([t,n])=>{e.attributes[t]!==void 0?e.attributes[t]+=n:e.attributes[t]=n}),e.addChildren(i.children),i.removeFromParent(),Mt(i,!1)}function Mt(i,e){if(e&&i.children&&i.children.forEach(t=>{Mt(t,!0)}),i.group){const t=i.group;t.removeFrame(i),t.frames.length===1&&t.removeFrame(t.frames[0])}}function Ft(i,e){if(!i)return null;for(const t of i.children)Ft(t),t.filePath&&t.filePath.includes("Jt(n)),i._children.sort((n,s)=>s.time-n.time),i}function ei(i,e){if(!i)return null;const t=e.hideRegex,n=e.showRegex;function s(r){const o=r.filePath||"",c=n&&new RegExp(n).test(o),d=t&&new RegExp(t).test(o);return c?!1:d?!0:!r.isApplicationCode}function l(r,o){o.addFrame(r),r.children.forEach(c=>{s(c)&&l(c,o)})}return i.children.forEach(r=>{if(!r.group&&s(r)&&r.children.some(s)){const o=new En(r);l(r,o)}ei(r,e)}),i}function ti(i,e,t=!0){if(!i)return null;let n=null;for(const s of i.children)s.identifier===Ze?n?(n.time+=s.time,s.removeFromParent()):n=s:n=null;return t&&i.children.forEach(s=>ti(s,e,!0)),i}function ii(i,e){return i?(i.children.length===1&&i.children[0].identifier===Ze&&rt(i.children[0],{replaceWith:"nothing"}),i.children.forEach(t=>ii(t)),i):null}function ni(i,e,t=null){if(!i)return null;t===null&&(t=i.time,t<=0&&(t=1e-44));const n=e.filterThreshold??.01;for(const s of i.children.slice())s.time/tni(s,e,t)),i}function si(i,e){if(!i)return null;const t=o=>en(o,c=>c.time),n=o=>{var c;return((c=o.filePath)==null?void 0:c.includes("pyinstrument/__main__.py"))&&o.children.length>0},s=o=>{var c;return o.proportionOfParent>.8&&((c=o.filePath)==null?void 0:c.includes(""))&&o.children.length>0},l=o=>{var c;return o.proportionOfParent>.8&&(new RegExp(".*runpy.py").test(o.filePath??"")||((c=o.filePath)==null?void 0:c.includes("")))&&o.children.length>0};let r=i;if(!n(r)||(r=t(r.children),!s(r))||(r=t(r.children),!l(r)))return i;for(;l(r);)r=t(r.children);return r.removeFromParent(),r}function oi(i,e){return i?(i.children.forEach(t=>oi(t)),i.group&&i.group.frames.length<3&&i.group.removeFrame(i),i):null}function Cn(i){let e,t,n;return t=new Kt({props:{frame:i[3],rootFrame:i[3]}}),{c(){e=h("div"),we(t.$$.fragment),a(e,"class","call-stack-margins svelte-1hebm9u")},m(s,l){S(s,e,l),ce(t,e,null),n=!0},p(s,l){const r={};l&8&&(r.frame=s[3]),l&8&&(r.rootFrame=s[3]),t.$set(r)},i(s){n||(D(t.$$.fragment,s),n=!0)},o(s){x(t.$$.fragment,s),n=!1},d(s){s&&L(e),ue(t)}}}function Mn(i){let e;return{c(){e=h("div"),e.innerHTML='
All frames were filtered out.
',a(e,"class","margins")},m(t,n){S(t,e,n)},p:F,i:F,o:F,d(t){t&&L(e)}}}function Fn(i){let e,t,n,s,l,r,o;const c=[Mn,Cn],d=[];function v(p,m){return p[3]?1:0}return n=v(i),s=d[n]=c[n](i),{c(){e=h("div"),t=h("div"),s.c(),l=b(),r=h("div"),a(t,"class","scroll-inner svelte-1hebm9u"),a(r,"class","scroll-size-fixer svelte-1hebm9u"),a(e,"class","call-stack-view svelte-1hebm9u")},m(p,m){S(p,e,m),u(e,t),d[n].m(t,null),i[7](t),u(e,l),u(e,r),i[8](r),i[9](e),o=!0},p(p,[m]){let f=n;n=v(p),n===f?d[n].p(p,m):(Oe(),x(d[f],1,1,()=>{d[f]=null}),Ve(),s=d[n],s?s.p(p,m):(s=d[n]=c[n](p),s.c()),D(s,1),s.m(t,null))},i(p){o||(D(s),o=!0)},o(p){x(s),o=!1},d(p){p&&L(e),d[n].d(),i[7](null),i[8](null),i[9](null)}}}function Pn(i,e,t){let n,{session:s}=e;const l=Vt([Z],([f])=>{const g=[f.removeImportlib?Ft:null,f.removeTracebackHide?Pt:null,ti,Jt,ii,f.removeIrrelevant?ni:null,f.removePyinstrument?si:null,f.collapseMode!=="disabled"?ei:null,oi].filter(E=>E!==null),w={filterThreshold:f.removeIrrelevantThreshold,hideRegex:f.collapseMode=="custom"?f.collapseCustomHide:void 0,showRegex:f.collapseMode=="custom"?f.collapseCustomShow:void 0};return{processors:g,options:w}});ge(i,l,f=>t(6,n=f));let r,o,c;bt(()=>{let f=0;const g=r;if(!g)throw new Error("element not set");if(!o)throw new Error("scrollInnerElement not set");if(!c)throw new Error("scrollSizeFixerElement not set");const w=new ResizeObserver(()=>{const C=o.getBoundingClientRect().height;C>f&&(f=C,t(2,c.style.top=`${f-1}px`,c))});w.observe(o);let E;return g.addEventListener("scroll",E=()=>{let C=g.scrollTop+g.clientHeight;const y=o.getBoundingClientRect().height;C{w.disconnect(),g.removeEventListener("scroll",E)}});let d;function v(f){ke[f?"unshift":"push"](()=>{o=f,t(1,o)})}function p(f){ke[f?"unshift":"push"](()=>{c=f,t(2,c)})}function m(f){ke[f?"unshift":"push"](()=>{r=f,t(0,r)})}return i.$$set=f=>{"session"in f&&t(5,s=f.session)},i.$$.update=()=>{i.$$.dirty&96&&t(3,d=Qt(s.rootFrame.cloneDeep(),n.processors,n.options))},[r,o,c,d,l,s,n,v,p,m]}class Rn extends fe{constructor(e){super(),de(this,e,Pn,Fn,re,{session:5})}}class In{constructor(e){A(this,"mediaQueryList",null);this.onDevicePixelRatioChanged=e,this._onChange=this._onChange.bind(this),this.createMediaQueryList()}createMediaQueryList(){this.removeMediaQueryList();let e=`(resolution: ${window.devicePixelRatio}dppx)`;this.mediaQueryList=matchMedia(e),this.mediaQueryList.addEventListener("change",this._onChange)}removeMediaQueryList(){var e;(e=this.mediaQueryList)==null||e.removeEventListener("change",this._onChange),this.mediaQueryList=null}_onChange(e){this.onDevicePixelRatioChanged(),this.createMediaQueryList()}destroy(){this.removeMediaQueryList()}}class Ln{constructor(e){A(this,"canvas");A(this,"_size_observer");A(this,"_devicePixelRatioObserver");A(this,"drawAnimationRequest",null);this.container=e,getComputedStyle(e).position!="absolute"&&(e.style.position="relative"),this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.left="0",this.canvas.style.top="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.container.appendChild(this.canvas),this.setCanvasSize=this.setCanvasSize.bind(this),this._size_observer=new ResizeObserver(this.setCanvasSize),this._size_observer.observe(e),this._devicePixelRatioObserver=new In(this.setCanvasSize),window.requestAnimationFrame(()=>{this.setCanvasSize()})}destroy(){this._size_observer.disconnect(),this._devicePixelRatioObserver.destroy(),this.canvas.remove(),this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null)}setNeedsRedraw(){this.drawAnimationRequest===null&&(this.drawAnimationRequest=window.requestAnimationFrame(()=>{this.drawAnimationRequest=null,this.canvasViewRedraw()}))}redrawIfNeeded(){this.drawAnimationRequest!==null&&(window.cancelAnimationFrame(this.drawAnimationRequest),this.drawAnimationRequest=null,this.canvasViewRedraw())}canvasViewRedraw(){const e=this.canvas.getContext("2d");e&&(e.resetTransform(),e.scale(window.devicePixelRatio,window.devicePixelRatio),this.redraw(e,{width:this.canvas.width/window.devicePixelRatio,height:this.canvas.height/window.devicePixelRatio}))}get width(){return this.canvas.width/window.devicePixelRatio}get height(){return this.canvas.height/window.devicePixelRatio}setCanvasSize(){const e=window.devicePixelRatio;this.canvas.height=this.container.clientHeight*e,this.canvas.width=this.container.clientWidth*e,this.canvasViewRedraw()}}function Sn(i){let e,t=i[2]=="self"?"self":"time",n,s,l,r=i[3](i[0].time)+"";return{c(){e=h("div"),n=I(t),s=b(),l=h("div"),a(e,"class","label svelte-ci3g2p"),a(l,"class","time-val svelte-ci3g2p")},m(o,c){S(o,e,c),u(e,n),S(o,s,c),S(o,l,c),l.innerHTML=r},p(o,c){c&4&&t!==(t=o[2]=="self"?"self":"time")&&_e(n,t),c&1&&r!==(r=o[3](o[0].time)+"")&&(l.innerHTML=r)},d(o){o&&(L(e),L(s),L(l))}}}function Dn(i){let e,t,n,s,l=i[3](i[0].time)+"",r,o=i[0].selfTime/i[0].time>.001&&ri(i);return{c(){e=h("div"),e.textContent="time",t=b(),n=h("div"),s=h("div"),r=b(),o&&o.c(),a(e,"class","label svelte-ci3g2p"),a(s,"class","time-val svelte-ci3g2p"),a(n,"class","time-row svelte-ci3g2p")},m(c,d){S(c,e,d),S(c,t,d),S(c,n,d),u(n,s),s.innerHTML=l,u(n,r),o&&o.m(n,null)},p(c,d){d&1&&l!==(l=c[3](c[0].time)+"")&&(s.innerHTML=l),c[0].selfTime/c[0].time>.001?o?o.p(c,d):(o=ri(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(L(e),L(t),L(n)),o&&o.d()}}}function ri(i){let e,t,n,s=i[3](i[0].selfTime)+"";return{c(){e=h("div"),e.textContent="self",t=b(),n=h("div"),a(e,"class","label svelte-ci3g2p"),a(n,"class","time-val svelte-ci3g2p")},m(l,r){S(l,e,r),S(l,t,r),S(l,n,r),n.innerHTML=s},p(l,r){r&1&&s!==(s=l[3](l[0].selfTime)+"")&&(n.innerHTML=s)},d(l){l&&(L(e),L(t),L(n))}}}function Hn(i){let e,t,n=i[0].name+"",s,l,r,o,c,d,v,p,m,f;function g(C,y){return C[2]=="both"?Dn:Sn}let w=g(i),E=w(i);return{c(){e=h("div"),t=h("div"),s=I(n),l=b(),E.c(),r=b(),o=h("div"),o.textContent="loc",c=b(),d=h("div"),v=h("div"),m=b(),f=new Ri(!1),a(t,"class","name svelte-ci3g2p"),a(o,"class","label svelte-ci3g2p"),a(v,"class","location-color svelte-ci3g2p"),a(v,"style",p=`background: ${i[0].locationColor}`),f.a=null,a(d,"class","location-row"),a(e,"class","timeline-canvas-view-tooltip svelte-ci3g2p"),a(e,"style",`font: ${ai}; max-width: ${Vn}px;`)},m(C,y){S(C,e,y),u(e,t),u(t,s),u(e,l),E.m(e,null),u(e,r),u(e,o),u(e,c),u(e,d),u(d,v),u(d,m),f.m(i[1],d)},p(C,[y]){y&1&&n!==(n=C[0].name+"")&&_e(s,n),w===(w=g(C))&&E?E.p(C,y):(E.d(1),E=w(C),E&&(E.c(),E.m(e,r))),y&1&&p!==(p=`background: ${C[0].locationColor}`)&&a(v,"style",p),y&2&&f.p(C[1])},i:F,o:F,d(C){C&&L(e),E.d()}}}function li(i){return i.selfTime==i.time?"self":i.selfTime/i.time>.001?"both":"time"}function On(i,e){i.font=ai;const t=li(e)=="both"?140:70,n=i.measureText(e.name).width,s=i.measureText(e.location).width+46;let r=Math.max(t,n,s)+20;return r>310&&(r=310),r}const Vn=310,ai="400 13px Source Sans Pro, sans-serif";function Nn(i,e,t){let{f:n}=e,s,l;function r(o){return`${o.toFixed(3)}`}return i.$$set=o=>{"f"in o&&t(0,n=o.f)},i.$$.update=()=>{i.$$.dirty&1&&t(1,s=Ct(n.location)),i.$$.dirty&1&&t(2,l=li(n))},[n,s,l,r]}class xn extends fe{constructor(e){super(),de(this,e,Nn,Hn,re,{f:0})}}const $n="#212325",ci=18,Bn=17,Ie=28,lt=17,ui=29,zn=["#3475BA","#318DBC","#47A298","#8AAE5D","#C1A731","#C07210","#B84210","#B53134","#9A3586","#4958B5","#3475BA"].map(Ki);class Wn extends Ln{constructor(t){super(t);A(this,"zoom",1);A(this,"startT",0);A(this,"yOffset",0);A(this,"frames",[]);A(this,"isZoomedIn",!1);A(this,"tooltipContainer");A(this,"tooltipComponent",null);A(this,"_rootFrame",null);A(this,"maxDepth",0);A(this,"tooltipLocation",null);A(this,"lastDrawWidth",0);A(this,"lastDrawHeight",0);A(this,"_libraryOrder",null);A(this,"_colors",[]);A(this,"_frameMaxT");A(this,"mouseLocation",null);A(this,"mouseDownLocation",null);A(this,"touches",{});this.onWheel=this.onWheel.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.windowMouseUp=this.windowMouseUp.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onTouchcancel=this.onTouchend.bind(this),this.canvas.addEventListener("wheel",this.onWheel),this.canvas.addEventListener("mousemove",this.onMouseMove),this.canvas.addEventListener("mouseleave",this.onMouseLeave),this.canvas.addEventListener("mousedown",this.onMouseDown),this.canvas.addEventListener("touchstart",this.onTouchstart),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend),this.canvas.addEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer=document.createElement("div"),this.tooltipContainer.style.position="absolute",this.tooltipContainer.style.pointerEvents="none",this.container.appendChild(this.tooltipContainer)}destroy(){this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("mousemove",this.onMouseMove),this.canvas.removeEventListener("mouseleave",this.onMouseLeave),this.canvas.removeEventListener("mousedown",this.onMouseDown),this.canvas.removeEventListener("touchstart",this.onTouchstart),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend),this.canvas.removeEventListener("touchcancel",this.onTouchcancel),this.tooltipContainer.remove(),super.destroy()}setRootFrame(t){this._rootFrame=t,this.frames=[],this._frameMaxT=void 0,this.maxDepth=0,this._collectFrames(t,0),this.fitContents(),this.setNeedsRedraw()}_collectFrames(t,n){this.frames.push({frame:t,depth:n,isApplicationCode:t.isApplicationCode,library:t.library,className:t.className,filePathShort:t.filePathShort}),this.maxDepth=Math.max(this.maxDepth,n);for(const s of t.children)s.identifier!==Ze&&this._collectFrames(s,n+1)}updateTooltip(t,n){var s;if(n){const l={name:this.frameName(n),time:n.frame.time,selfTime:this.frameSelfTime(n),totalTime:((s=this._rootFrame)==null?void 0:s.time)??1e-12,location:`${n.filePathShort}:${n.frame.lineNo}`,locationColor:this.colorForFrame(n)};if(this.tooltipComponent?this.tooltipComponent.$set({f:l}):this.tooltipComponent=new xn({target:this.tooltipContainer,props:{f:l}}),this.tooltipLocation){const r={x:this.tooltipLocation.x+12,y:this.tooltipLocation.y+12},o=On(t,l),c=this.width-10-o;r.x>c&&(r.x=c);const v=this.height-10-60;r.y>v&&(r.y=v),this.tooltipContainer.style.left=`${r.x}px`,this.tooltipContainer.style.top=`${r.y}px`}}n||this.tooltipComponent&&(this.tooltipComponent.$destroy(),this.tooltipComponent=null)}redraw(t,n){const{width:s,height:l}=n;(s!==this.lastDrawWidth||l!==this.lastDrawHeight)&&(this.isZoomedIn?this.clampViewport():this.fitContents()),this.lastDrawWidth=s,this.lastDrawHeight=l,t.fillStyle=$n,t.fillRect(0,0,s,l),this.drawAxes(t);for(const d of this.frames)this.drawFrame(t,d);t.globalAlpha=1;const r=this.maxYOffset>0||this.isZoomedIn,o=!!this.mouseDownLocation;this.canvas.style.cursor=o&&r?"grabbing":"initial",t.fillStyle="red",t.font='23px "Source Sans Pro", sans-serif';let c=null;!o&&this.tooltipLocation&&(c=this.hitTest(this.tooltipLocation)),this.updateTooltip(t,c)}drawAxes(t){const n=Math.max(800,this.width)/this.zoom;if(n==0)return;const s=Math.log10(n);let l=Math.ceil(s)+2;l<0&&(l=0);const r=Math.ceil(s)-3,o=c=>xe(c,{from:[s,s-3],to:[.71,0],clamp:!0});for(let c=r;c.01){t.globalAlpha=f,t.font='13px "Source Sans Pro", sans-serif';let g=d.toFixed(c);g=="0"&&(g="0s");let w=m+10;t.fillText(g,v+3,w);let E=this.height+lt+10-this.yOffset;Ethis.width)return;if(t.fillStyle=this.colorForFrame(n),t.globalAlpha=n.isApplicationCode?1:.5,r<2){t.fillRect(s,l,r,o);return}let d=this.frameName(n);const v=Math.floor(r/3.3);if(d.length>v&&(d=d.substring(0,v)),d.length==0){t.fillRect(s,l,r,o);return}t.save(),t.beginPath(),t.rect(s,l,r,o),t.fill(),t.clip(),t.font='13px "Source Sans Pro", sans-serif',t.fillStyle="white";let p=s;p<0&&(p=0),t.fillText(d,p+2,l+13),t.restore()}_assignLibraryOrder(){const t={};for(const s of this.frames){const r=s.frame.library??"";t[r]=(t[r]||0)+s.frame.time}const n=Object.keys(t);n.sort((s,l)=>t[l]-t[s]),this._libraryOrder=n}colorForLibraryIndex(t){if(this._colors[t]!==void 0)return this._colors[t];const n=Math.pow(2,Math.ceil(Math.log2(t+1))),l=(2*t-n+1)/n,r=Gi(zn,l);return this._colors[t]=r,r}libraryIndexForFrame(t){this._libraryOrder||this._assignLibraryOrder();const n=t.library||"";let s=this._libraryOrder.indexOf(n);return s===-1&&(s=this._libraryOrder.length,this._libraryOrder.push(n)),s}colorForFrame(t){const n=this.libraryIndexForFrame(t);return this.colorForLibraryIndex(n)}get frameMaxT(){return this._frameMaxT===void 0&&(this._frameMaxT=this.frames.reduce((t,n)=>Math.max(t,n.frame.startTime+n.frame.time),0)),this._frameMaxT}get maxYOffset(){return Math.max(0,(this.maxDepth+1)*ci+lt*2+ui-this.height)}get minZoom(){return(this.width-2*Ie)/this.frameMaxT}get maxZoom(){return 6666666666666667e-8}fitContents(){this.startT=0,this.zoom=this.minZoom,this.isZoomedIn=!1}clampViewport(){this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.startT<0&&(this.startT=0);const t=this.frameMaxT-(this.width-2*Ie)/this.zoom;this.startT>t&&(this.startT=t),this.yOffset<0&&(this.yOffset=0),this.yOffset>this.maxYOffset&&(this.yOffset=this.maxYOffset)}frameDims(t){const n=t.depth*ci+lt+ui-this.yOffset,s=Bn;let l=this.xForT(t.frame.startTime),o=this.xForT(t.frame.startTime+t.frame.time)-l;return o<1&&(o=1),o>1&&(o-=xe(o,{from:[1,3],to:[0,1],clamp:!0})),{x:l,y:n,w:o,h:s}}xForT(t){return(t-this.startT)*this.zoom+Ie}tForX(t){return(t-Ie)/this.zoom+this.startT}frameName(t){let n;return t.className?n=`${t.className}.${t.frame.function}`:t.frame.function==""?n=t.filePathShort??t.frame.filePath??"":n=t.frame.function,n}frameSelfTime(t){let n=t.frame.time;const s=t.frame.children.filter(l=>!l.isSynthetic);for(const l of s)n-=l.time;return n}hitTest(t){for(const n of this.frames){const{x:s,y:l,w:r,h:o}=this.frameDims(n);if(t.x>=s&&t.x<=s+r&&t.y>=l&&t.y<=l+o)return n}return null}onWheel(t){const n=t.ctrlKey||t.metaKey,s=n?.01:.0023,l=this.tForX(t.offsetX);this.zoom*=1-t.deltaY*s,this.clampViewport(),this.startT=l-(t.offsetX-Ie)/this.zoom,n||(this.startT+=t.deltaX/this.zoom),this.clampViewport(),this.setNeedsRedraw(),t.preventDefault()}onMouseMove(t){const n={x:t.offsetX,y:t.offsetY},s=this.mouseLocation;if(this.mouseLocation=n,s&&this.mouseDownLocation){const l={x:n.x-s.x,y:n.y-s.y};this.startT-=l.x/this.zoom,this.yOffset-=l.y,this.clampViewport()}this.tooltipLocation=n,this.setNeedsRedraw()}onMouseLeave(t){this.mouseLocation=null,this.tooltipLocation=null,this.setNeedsRedraw()}onMouseDown(t){(t.button===0||t.button===1)&&(this.mouseDownLocation={x:t.offsetX,y:t.offsetY},window.addEventListener("mouseup",this.windowMouseUp),this.setNeedsRedraw())}windowMouseUp(t){window.removeEventListener("mouseup",this.windowMouseUp),this.mouseDownLocation=null,this.setNeedsRedraw()}onTouchstart(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))this.touches[n.identifier]={x:n.clientX,y:n.clientY,downT:this.tForX(n.clientX),startDate:Date.now(),downX:n.clientX,downY:n.clientY}}onTouchmove(t){t.preventDefault(),t.stopPropagation();let n=0;for(const l of Array.from(t.changedTouches)){const r=this.touches[l.identifier];r&&(n+=l.clientY-r.y,this.touches[l.identifier]={...r,x:l.clientX,y:l.clientY})}const s=n/Object.keys(this.touches).length;this.yOffset-=s,this.adjustXAxisForTouches(),this.setNeedsRedraw()}onTouchend(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}onTouchcancel(t){t.preventDefault(),t.stopPropagation();for(const n of Array.from(t.changedTouches))delete this.touches[n.identifier];this.setNeedsRedraw()}adjustXAxisForTouches(){const t=Object.keys(this.touches).map(Number);if(t.length!=0){if(t.length==1){const n=this.touches[t[0]];this.startT=n.downT-(n.x-Ie)/this.zoom}if(t.length>=2){const n=this.touches[t[0]],s=this.touches[t[1]],l=(s.x-n.x)/(s.downT-n.downT),r=n.downT-(n.x-Ie)/l;this.startT=r,this.zoom=l}this.clampViewport()}}}function qn(i){let e;return{c(){e=h("div"),e.innerHTML="",a(e,"class","timeline svelte-p2tt1k")},m(t,n){S(t,e,n),i[6](e)},p:F,i:F,o:F,d(t){t&&L(e),i[6](null)}}}function Un(i,e,t){let n,{session:s}=e;const l=Vt([je],([v])=>({processors:[v.removeImportlib?Ft:null,v.removeTracebackHide?Pt:null,v.removePyinstrument?si:null].filter(f=>f!==null),options:{}}));ge(i,l,v=>t(5,n=v));let r,o=null,c=null;Ii(()=>{c==null||c.destroy()});function d(v){ke[v?"unshift":"push"](()=>{o=v,t(0,o)})}return i.$$set=v=>{"session"in v&&t(2,s=v.session)},i.$$.update=()=>{i.$$.dirty&36&&t(3,r=Qt(s.rootFrame.cloneDeep(),n.processors,n.options)),i.$$.dirty&1&&o&&t(4,c=new Wn(o)),i.$$.dirty&24&&r&&c&&c.setRootFrame(r)},[o,l,s,r,c,n,d]}class Yn extends fe{constructor(e){super(),de(this,e,Un,qn,re,{session:2})}}function Xn(i){let e,t,n=i[1].viewMode+"",s;return{c(){e=h("div"),t=I("Unknown view mode: "),s=I(n),a(e,"class","error")},m(l,r){S(l,e,r),u(e,t),u(e,s)},p(l,r){r&2&&n!==(n=l[1].viewMode+"")&&_e(s,n)},i:F,o:F,d(l){l&&L(e)}}}function Gn(i){let e,t;return e=new Yn({props:{session:i[0]}}),{c(){we(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p(n,s){const l={};s&1&&(l.session=n[0]),e.$set(l)},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){x(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function jn(i){let e,t;return e=new Rn({props:{session:i[0]}}),{c(){we(e.$$.fragment)},m(n,s){ce(e,n,s),t=!0},p(n,s){const l={};s&1&&(l.session=n[0]),e.$set(l)},i(n){t||(D(e.$$.fragment,n),t=!0)},o(n){x(e.$$.fragment,n),t=!1},d(n){ue(e,n)}}}function Zn(i){let e;return{c(){e=h("div"),e.innerHTML='
No samples recorded.
',a(e,"class","margins")},m(t,n){S(t,e,n)},p:F,i:F,o:F,d(t){t&&L(e)}}}function Kn(i){let e,t,n,s,l,r,o,c;n=new pn({props:{session:i[0]}});const d=[Zn,jn,Gn,Xn],v=[];function p(m,f){return m[0].rootFrame?m[1].viewMode==="call-stack"?1:m[1].viewMode==="timeline"?2:3:0}return r=p(i),o=v[r]=d[r](i),{c(){e=h("div"),t=h("div"),we(n.$$.fragment),s=b(),l=h("div"),o.c(),a(t,"class","header"),a(l,"class","body svelte-1vwroj7"),a(e,"class","app svelte-1vwroj7")},m(m,f){S(m,e,f),u(e,t),ce(n,t,null),u(e,s),u(e,l),v[r].m(l,null),c=!0},p(m,[f]){const g={};f&1&&(g.session=m[0]),n.$set(g);let w=r;r=p(m),r===w?v[r].p(m,f):(Oe(),x(v[w],1,1,()=>{v[w]=null}),Ve(),o=v[r],o?o.p(m,f):(o=v[r]=d[r](m),o.c()),D(o,1),o.m(l,null))},i(m){c||(D(n.$$.fragment,m),D(o),c=!0)},o(m){x(n.$$.fragment,m),x(o),c=!1},d(m){m&&L(e),ue(n),v[r].d()}}}function Qn(i,e,t){let n;ge(i,Ge,p=>t(1,n=p));let{session:s}=e;const l=document.createElement("link");l.rel="shortcut icon",l.href=vn,document.head.appendChild(l);const r=document.createElement("link");r.rel="preload",r.as="style",r.onload=()=>{r.rel="stylesheet"},r.href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,600&display=swap",document.head.appendChild(r);const o=s.rootFrame,c=o==null?void 0:o.time.toLocaleString(void 0,{maximumSignificantDigits:3});let d,v;return(v=/[^\s/]+(:\d+)?$/.exec(s.target_description))?d=v[0]:d=s.target_description,document.title=`${c}s - ${d} - pyinstrument`,i.$$set=p=>{"session"in p&&t(0,s=p.session)},[s,n]}class Jn extends fe{constructor(e){super(),de(this,e,Qn,Kn,re,{session:0})}}class es{constructor(e){A(this,"startTime");A(this,"duration");A(this,"minInterval");A(this,"maxInterval");A(this,"sampleCount");A(this,"target_description");A(this,"cpuTime");A(this,"rootFrame");A(this,"sysPath");A(this,"sysPrefixes");A(this,"_shortenPathCache",{});this.startTime=e.session.start_time,this.duration=e.session.duration,this.minInterval=e.session.min_interval,this.maxInterval=e.session.max_interval,this.sampleCount=e.session.sample_count,this.target_description=e.session.target_description,this.cpuTime=e.session.cpu_time,this.sysPath=e.session.sys_path,this.sysPrefixes=e.session.sys_prefixes,this.rootFrame=new Ke(e.frame_tree,this)}shortenPath(e){if(this._shortenPathCache[e])return this._shortenPathCache[e];let t=e;if($e(e).length>1)for(const s of this.sysPath){const l=ts(e,s);$e(l).length<$e(t).length&&(t=l)}return this._shortenPathCache[e]=t,t}}function $e(i){return i.split(/[/\\]/)}function di(i){const e=$e(i);return e.length>0&&e[0].endsWith(":")?e[0]:null}function ts(i,e){if(di(i)!=di(e))return i;const t=$e(i),n=$e(e);let s=0;for(;s"..").concat(t.slice(s)).join("/")}return{render(i,e){const t=new es(e);return new Jn({target:i,props:{session:t}})}}}();