vite-plugin-vue-devtools 9.0.0-rc.3 → 9.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/client/assets/{Checkbox-CsgLgOjf.js → Checkbox-BcOsupnb.js} +1 -1
  2. package/client/assets/InspectorState-CxoxiYJv.js +1 -0
  3. package/client/assets/InspectorTree-B5ZtDinH.js +1 -0
  4. package/client/assets/InspectorTree-qN67Pdkz.css +1 -0
  5. package/client/assets/{RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-By717ouR.js → RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-Ko5HVMry.js} +1 -1
  6. package/client/assets/_plugin-vue_export-helper-7VP3XblN.js +5 -0
  7. package/client/assets/components-BzDcdL_G.js +3 -0
  8. package/client/assets/{custom-inspector-DikTGJYk.js → custom-inspector-DsCNPUv8.js} +1 -1
  9. package/client/assets/{graph-DT4Zl2Ge.js → graph-B6uUU3Mu.js} +1 -1
  10. package/client/assets/index-DppbHKeW.js +3 -0
  11. package/client/assets/{overview-CBnqLe5W.js → overview-nbXAZw6F.js} +1 -1
  12. package/client/assets/{pages-BnEiKDB1.js → pages-M10glbio.js} +1 -1
  13. package/client/assets/{plugins-D7N7tBMP.js → plugins-sTXXC8HU.js} +1 -1
  14. package/client/assets/{settings-DVRsqvUy.js → settings-B6GCd_60.js} +1 -1
  15. package/client/assets/{splitpanes.esm-Cr-PYWE3.js → splitpanes.esm-8w8po8hd.js} +1 -1
  16. package/client/assets/{timeline-DemFeH2V.js → timeline-Bw29uBP-.js} +1 -1
  17. package/client/index.html +2 -2
  18. package/dist/client.d.mts +1 -1
  19. package/dist/client.mjs +1 -1
  20. package/dist/index.mjs +3 -3
  21. package/package.json +7 -7
  22. package/client/assets/InspectorState-CXPxKmUf.js +0 -1
  23. package/client/assets/InspectorTree-BgcS7_BF.js +0 -1
  24. package/client/assets/InspectorTree-CyiZHbQn.css +0 -1
  25. package/client/assets/_plugin-vue_export-helper-CdLdzBIA.js +0 -5
  26. package/client/assets/components--Uqqnist.js +0 -3
  27. package/client/assets/index-Ctr1uf78.js +0 -3
@@ -1 +1 @@
1
- import{A as e,D as t,Dt as n,Et as r,I as i,J as a,K as o,M as s,T as c,W as l,Y as u,b as d,d as f,et as p,f as m,h,i as g,j as _,l as v,m as y,nt as b,ot as x,p as S,rt as ee,v as te,wt as C,y as w,z as ne}from"./_plugin-vue_export-helper-CdLdzBIA.js";import{n as T}from"./RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-By717ouR.js";import{n as E,t as D}from"./splitpanes.esm-Cr-PYWE3.js";import{d as O,f as re,i as k,p as A}from"./index-Ctr1uf78.js";import{t as j}from"./InspectorTree-BgcS7_BF.js";import{t as ie}from"./component-tree-C3C12cZe.js";var M=8,N=16,P=7.2,F=172,I=76;function ae(e,t,n){let r=new Set(e.nodes.map(e=>e.id)),i=new Map(e.nodes.map(e=>[e.id,e.id])),a=new Map(e.nodes.map(e=>[e.id,0])),o=new Map(e.nodes.map(e=>[e.id,0]));function s(e){let t=i.get(e)??e;if(t===e)return t;let n=s(t);return i.set(e,n),n}function c(e,t){let n=s(e),r=s(t);n!==r&&i.set(r,n)}for(let t of e.relationships)r.has(t.from)&&r.has(t.to)&&(c(t.from,t.to),o.set(t.from,(o.get(t.from)??0)+1),a.set(t.to,(a.get(t.to)??0)+1));let l=new Map,u=[];for(let t of e.nodes){let e=s(t.id);if(l.has(e))continue;let n=l.size;l.set(e,n),u.push({id:n,nodeCount:0,relationshipCount:0})}let d=oe(u,t,n),f=e.nodes.map(e=>{let r=l.get(s(e.id))??0,i=(a.get(e.id)??0)+(o.get(e.id)??0),c=Math.min(N,M+Math.sqrt(i+1)*3),f=d.get(r)??{x:t/2,y:n/2},p=B(e.id)%360*(Math.PI/180),m=18+B(`${e.id}:distance`)%54,h=u[r];return h&&(h.nodeCount+=1),{id:e.id,type:e.type,label:e.label,group:r,incoming:a.get(e.id)??0,labelWidth:L(R(e)),outgoing:o.get(e.id)??0,radius:c,x:f.x+Math.cos(p)*m,y:f.y+Math.sin(p)*m}});return{groups:u,links:e.relationships.map(e=>{if(!r.has(e.from)||!r.has(e.to))return;let t=l.get(s(e.from))??0,n=u[t];return n&&(n.relationshipCount+=1),{...e,group:t,source:e.from,target:e.to,value:1}}).filter(e=>e!==void 0),nodes:f}}function oe(e,t,n){let r=new Map;if(!e.length)return r;let i=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/i),o=Math.min(170,Math.max(78,t*.12)),s=Math.min(128,Math.max(76,n*.16)),c=Math.max(1,t-o*2),l=Math.max(1,n-s*2);return e.forEach((e,t)=>{let n=t%i,u=Math.floor(t/i);r.set(e.id,{x:o+c*(n+.5)/i,y:s+l*(u+.5)/a})}),r}function se(e){return e.length<=22?e:`${e.slice(0,12)}...${e.slice(-7)}`}function L(e){return Math.min(F,Math.max(I,se(e).length*P+22))}function R(e){let t=z(e.type);return new Set([e.type,t,`component render`,`reactive.property`,`render/effect`,`watch callback`]).has(e.label)?t:e.label}function z(e){switch(e){case`ref`:return`Anonymous Ref`;case`computed`:return`Anonymous Computed`;case`reactive`:return`Reactive Property`;case`watch`:return`Anonymous Watch`;case`render`:return`Anonymous Render`;case`effect`:return`Anonymous Effect`;default:return`Unknown`}}function B(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n);return Math.abs(t)}var ce=[`ref`,`reactive`,`computed`,`watch`,`effect`,`render`,`unknown`];function V(e){switch(e){case`ref`:return`#21a67a`;case`computed`:return`#3b82d6`;case`reactive`:return`#d79822`;case`render`:return`#f97316`;case`watch`:return`#0f766e`;case`effect`:return`#d84f45`;default:return`#94a3b8`}}function H(e){switch(e){case`ref`:return`Ref`;case`computed`:return`Computed`;case`reactive`:return`Reactive`;case`render`:return`Render Effect`;case`watch`:return`Watch`;case`effect`:return`Effect`;default:return`Unknown`}}function le(e){return e.trim().toLowerCase()}function ue(e,t){return!t||[e.id,e.label,H(e.type),de(e),...Object.values(e.data).map(e=>String(e))].some(e=>e.toLowerCase().includes(t))}function de(e){if(!e)return``;let t=e.data;if(!t)return``;let n=t.value??t.cb??t.instanceName;if(n==null)return``;if(typeof n==`string`)return n;try{return JSON.stringify(n)}catch{return String(n)}}function fe(){return{nodeIds:new Set,orderedNodeIds:[],orderedRelationshipIds:[],relationshipIds:new Set}}function pe(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push(n),t.set(n.from,e)}return t}function me(e,t){let n=new Set(t.map(e=>e.to));return new Set(e.filter(e=>!n.has(e.id)).map(e=>e.id))}function he(e,t){let n=new Set([e]),r=[e];for(let e of r)for(let i of t.get(e)??[])n.has(i.to)||(n.add(i.to),r.push(i.to));return n.delete(e),n}function ge(e,t,n){if(!e||!t)return fe();let r=new Map,i=new Set([e]),a=[e];for(let e of a){if(i.has(t))break;for(let o of n.get(e)??[])if(!i.has(o.to)&&(i.add(o.to),r.set(o.to,o),a.push(o.to),o.to===t))break}let o=[t],s=[];if(i.has(t)){let n=t;for(;n!==e;){let e=r.get(n);s.push(e.id),o.push(e.from),n=e.from}}else o.push(e);return o.reverse(),s.reverse(),{nodeIds:new Set(o),orderedNodeIds:o,relationshipIds:new Set(s),orderedRelationshipIds:s}}var _e={class:`shrink-0 bg-base px-2`},ve={class:`min-w-0 flex items-center gap-2 py-2`},ye={key:0,class:`group relative min-w-0 flex flex-1 items-center justify-between gap-2 overflow-hidden rounded-1 border border-primary-100 px-3 py-0.75 color-base dark:border-gray-700`},be={key:1,class:`min-w-0 flex flex-1 items-center gap-2`},xe={class:`relative min-w-0 flex-1`},Se={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Ce={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},we=[`value`],Te={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Ee=[`onMousedown`],De={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Oe={class:`shrink-0 color-muted text-3`},ke={key:0,class:`px-2 py-2 color-muted text-3 italic`},Ae={class:`relative min-w-0 flex-1`},je={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Me={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ne=[`value`],Pe={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Fe=[`onMousedown`],Ie={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Le={class:`shrink-0 color-muted text-3`},Re={key:0,class:`px-2 py-2 color-muted text-3 italic`},ze=[`aria-pressed`],Be=[`aria-expanded`],Ve={class:`mb-1 flex items-center justify-between gap-2`},He={class:`w-14 shrink-0 text-right color-muted font-state-field text-3`},Ue=[`title`],We=[`checked`,`onChange`],Ge={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ke={class:`w-10 shrink-0 text-right color-muted text-3`},qe=220,Je=d({__name:`ReactivityGraphToolbar`,props:c({graph:{},filteredGraph:{}},{search:{required:!0},searchModifiers:{},activeTypes:{required:!0},activeTypesModifiers:{},pathSelectorOpen:{type:Boolean,required:!0},pathSelectorOpenModifiers:{},pathStartId:{required:!0},pathStartIdModifiers:{},pathEndId:{required:!0},pathEndIdModifiers:{},selectedNodeId:{},selectedNodeIdModifiers:{}}),emits:[`update:search`,`update:activeTypes`,`update:pathSelectorOpen`,`update:pathStartId`,`update:pathEndId`,`update:selectedNodeId`],setup(e){let t=e,a=ee(t,`filteredGraph`),c=l(e,`search`),d=l(e,`activeTypes`),g=l(e,`pathSelectorOpen`),b=l(e,`pathStartId`),S=l(e,`pathEndId`),te=l(e,`selectedNodeId`),T=p(),E=p(``),D=p(``),j=p(!1),ie,M=f(()=>{let e=new Map;for(let t of ce)e.set(t,0);for(let n of t.graph.nodes)e.set(n.type,(e.get(n.type)??0)+1);return e}),N=f(()=>new Map(t.graph.nodes.map(e=>[e.id,e]))),P=f(()=>[...a.value.nodes].sort((e,t)=>tt(e.id).localeCompare(tt(t.id)))),F=f(()=>me(a.value.nodes,a.value.relationships)),I=f(()=>pe(a.value.relationships)),ae=f(()=>et(E.value,S.value,F.value)),oe=f(()=>b.value?he(b.value,I.value):new Set),se=f(()=>et(D.value,b.value,oe.value)),L=f(()=>!!b.value&&!!S.value);function z(e){return e.target instanceof HTMLInputElement?e.target.value:``}function B(e){return d.value.has(e)}function de(e){let t=new Set(d.value);t.has(e)?t.delete(e):t.add(e),d.value=t,W()}function fe(){d.value=new Set(ce),W()}function ge(){d.value=new Set,W()}function Je(){ie&&=(clearTimeout(ie),void 0)}function Ye(){Je(),j.value=!0}function U(e){if(e instanceof FocusEvent){let t=e.currentTarget,n=e.relatedTarget;if(t instanceof Node&&n instanceof Node&&t.contains(n))return}Je(),ie=setTimeout(()=>{j.value=!1,ie=void 0},qe)}function Xe(){c.value=``,g.value=!0,T.value=`start`}function W(){g.value=!1,T.value=void 0,b.value=``,S.value=``,E.value=``,D.value=``}function Ze(e,t){e===`start`?(E.value=t,t&&t===tt(b.value)||(G(),E.value=t)):(D.value=t,t&&t===tt(S.value)||($e(),D.value=t))}function Qe(e,t){e===`start`?(b.value!==t&&$e(),b.value=t,E.value=tt(t),T.value=S.value?void 0:`end`):(S.value=t,D.value=tt(t),T.value=b.value?void 0:`start`),b.value&&S.value&&(te.value=void 0)}function G(){b.value=``,E.value=``,$e(),T.value=`start`}function $e(){S.value=``,D.value=``,T.value=`end`}function et(e,t,n){let r=le(e);return P.value.filter(e=>e.id===t||n&&!n.has(e.id)?!1:ue(e,r)).slice(0,8)}function tt(e){let t=N.value.get(e);return t?`${R(t)} (${H(t.type)})`:``}function nt(e){let t=N.value.get(e);return t?R(t):``}function rt(e){let t=N.value.get(e);return V(t?t.type:`unknown`)}return o(g,e=>{e||W()}),_(Je),(e,o)=>{let l=ne(`tooltip`);return s(),h(`div`,_e,[m(`div`,ve,[g.value?(s(),h(`div`,be,[m(`div`,xe,[b.value?(s(),h(`div`,Se,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(b.value)})},null,4),m(`span`,Ce,n(nt(b.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path start`,onClick:G},[w(k,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear start`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Start`,type:`search`,value:E.value,onFocus:o[2]||=e=>T.value=`start`,onInput:o[3]||=e=>Ze(`start`,z(e)),onKeydown:re(W,[`esc`])},null,40,we)),!b.value&&T.value===`start`?(s(),h(`div`,Te,[(s(!0),h(v,null,i(ae.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:A(t=>Qe(`start`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),m(`span`,De,n(x(R)(e)),1),m(`span`,Oe,n(x(H)(e.type)),1)],40,Ee))),128)),ae.value.length?y(``,!0):(s(),h(`div`,ke,` No matching nodes `))])):y(``,!0)]),w(k,{icon:`i-carbon-arrow-right`,class:`shrink-0 color-muted text-5`}),m(`div`,Ae,[S.value?(s(),h(`div`,je,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(S.value)})},null,4),m(`span`,Me,n(nt(S.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path end`,onClick:$e},[w(k,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear end`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`End`,type:`search`,value:D.value,onFocus:o[4]||=e=>T.value=`end`,onInput:o[5]||=e=>Ze(`end`,z(e)),onKeydown:re(W,[`esc`])},null,40,Ne)),!S.value&&T.value===`end`?(s(),h(`div`,Pe,[(s(!0),h(v,null,i(se.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:A(t=>Qe(`end`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),m(`span`,Ie,n(x(R)(e)),1),m(`span`,Le,n(x(H)(e.type)),1)],40,Fe))),128)),se.value.length?y(``,!0):(s(),h(`div`,Re,n(b.value?`No matching nodes`:`Select a start node to get end nodes`),1))])):y(``,!0)])])):(s(),h(`label`,ye,[w(k,{icon:`i-carbon-search`,class:`shrink-0 color-muted text-4`}),u(m(`input`,{"onUpdate:modelValue":o[0]||=e=>c.value=e,class:`min-w-0 w-full border-0 bg-transparent p-0 outline-none text-3.5 color-inherit placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Search graph...`,type:`search`},null,512),[[O,c.value]]),c.value?u((s(),h(`button`,{key:0,class:`h-6 w-6 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Clear search`,onClick:o[1]||=e=>c.value=``},[w(k,{icon:`i-carbon-close`,class:`text-3.5`})])),[[l,`Clear search`,void 0,{top:!0}]]):y(``,!0)])),g.value?u((s(),h(`button`,{key:3,class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Close path selector`,onClick:W},[w(k,{icon:`i-carbon-close`,class:`text-5`})])),[[l,`Close path selector`,void 0,{top:!0}]]):u((s(),h(`button`,{key:2,class:C([`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,g.value||L.value?`bg-active color-active`:``]),type:`button`,"aria-label":`Graph path selector`,"aria-pressed":g.value||L.value,onClick:o[6]||=e=>g.value?W():Xe()},[w(k,{icon:`i-ri-route-line`,class:`text-5.5`})],10,ze)),[[l,g.value?`Clear path selector`:`Graph path selector`,void 0,{top:!0}]]),m(`div`,{class:`relative shrink-0`,onFocusin:Ye,onFocusout:U,onMouseenter:Ye,onMouseleave:U},[u((s(),h(`button`,{class:C([`h-7 w-7 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,j.value?`bg-active color-base`:``]),type:`button`,"aria-label":`Filter reactivity types`,"aria-haspopup":`menu`,"aria-expanded":j.value},[w(k,{icon:`i-carbon-filter`,class:`text-4`})],10,Be)),[[l,`Filter reactivity types`,void 0,{top:!0}]]),m(`div`,{class:C([`absolute right-0 top-[calc(100%+4px)] z-50 w-62 rounded-1 border border-base bg-base p-2 shadow transition-opacity`,j.value?`pointer-events-auto op-100`:`pointer-events-none op-0`]),role:`menu`},[m(`div`,Ve,[o[7]||=m(`span`,{class:`color-muted text-3`},`Filter type`,-1),m(`span`,He,n(a.value.nodes.length)+` / `+n(t.graph.nodes.length),1)]),(s(!0),h(v,null,i(x(ce),e=>(s(),h(`label`,{key:e,class:C([`h-7 rounded-1 px-2 color-base flex items-center gap-1.5 select-none hover:bg-active`,B(e)?``:`op45 grayscale`]),title:x(H)(e)},[m(`input`,{class:`h-3.5 w-3.5 accent-emerald-600`,type:`checkbox`,checked:B(e),onChange:t=>de(e)},null,40,We),m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e)})},null,4),m(`span`,Ge,n(x(H)(e)),1),m(`span`,Ke,n(M.value.get(e)??0),1)],10,Ue))),128)),m(`div`,{class:`mt-1 flex items-center gap-1 border-t border-base pt-1`},[m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:fe},` Select all `),m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:ge},` Clear `)])],2)],32)])])}}});function Ye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return U(this.cover(t,n),t,n,e)}function U(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Xe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)U(this,o[n],s[n],e[n]);return this}function W(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Ze(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function G(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function $e(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new G(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new G(p[3],g,_,c,l),new G(p[2],o,_,g,l),new G(p[1],g,s,c,_),new G(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function et(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function nt(){return this._root}function rt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function it(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new G(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new G(i,l,u,s,c)),(i=r[2])&&t.push(new G(i,a,u,l,c)),(i=r[1])&&t.push(new G(i,l,o,s,u)),(i=r[0])&&t.push(new G(i,a,o,l,u))}return this}function at(e){var t=[],n=[],r;for(this._root&&t.push(new G(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new G(a,o,s,u,d)),(a=i[1])&&t.push(new G(a,u,s,c,d)),(a=i[2])&&t.push(new G(a,o,d,u,l)),(a=i[3])&&t.push(new G(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ot(e){return e[0]}function st(e){return arguments.length?(this._x=e,this):this._x}function ct(e){return e[1]}function lt(e){return arguments.length?(this._y=e,this):this._y}function ut(e,t,n){var r=new dt(t??ot,n??ct,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dt(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ft(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var K=ut.prototype=dt.prototype;K.copy=function(){var e=new dt(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ft(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ft(r));return e},K.add=Ye,K.addAll=Xe,K.cover=W,K.data=Ze,K.extent=Qe,K.find=$e,K.remove=et,K.removeAll=tt,K.root=nt,K.size=rt,K.visit=it,K.visitAfter=at,K.x=st,K.y=lt;var pt={value:()=>{}};function mt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ht(n)}function ht(e){this._=e}function gt(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ht.prototype=mt.prototype={constructor:ht,on:function(e,t){var n=this._,r=gt(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=_t(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=vt(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vt(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ht(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function _t(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function vt(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=pt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var yt=0,bt=0,xt=0,St=1e3,Ct,wt,Tt=0,Et=0,Dt=0,Ot=typeof performance==`object`&&performance.now?performance:Date,kt=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function At(){return Et||=(kt(jt),Ot.now()+Dt)}function jt(){Et=0}function Mt(){this._call=this._time=this._next=null}Mt.prototype=Nt.prototype={constructor:Mt,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?At():+n)+(t==null?0:+t),!this._next&&wt!==this&&(wt?wt._next=this:Ct=this,wt=this),this._call=e,this._time=n,Rt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rt())}};function Nt(e,t,n){var r=new Mt;return r.restart(e,t,n),r}function Pt(){At(),++yt;for(var e=Ct,t;e;)(t=Et-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yt}function Ft(){Et=(Tt=Ot.now())+Dt,yt=bt=0;try{Pt()}finally{yt=0,Lt(),Et=0}}function It(){var e=Ot.now(),t=e-Tt;t>St&&(Dt-=t,Tt=e)}function Lt(){for(var e,t=Ct,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ct=n);wt=e,Rt(r)}function Rt(e){yt||(bt&&=clearTimeout(bt),e-Et>24?(e<1/0&&(bt=setTimeout(Ft,e-Ot.now()-Dt)),xt&&=clearInterval(xt)):(xt||=(Tt=Ot.now(),setInterval(It,St)),yt=1,kt(Ft)))}function zt(e,t,n){var r=new Mt;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}function q(e){return function(){return e}}function Bt(e){return(e()-.5)*1e-6}function Vt(e){return e.x+e.vx}function Ht(e){return e.y+e.vy}function Ut(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=q(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=ut(t,Vt,Ht).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=Bt(r),_+=h*h),g===0&&(g=Bt(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),c(),o):e},o}function Wt(e){return e.index}function Gt(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Kt(e){var t=Wt,n=d,r,i=q(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||Bt(l),m=f.y+f.vy-d.y-d.vy||Bt(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=Gt(u,d.source)),typeof d.target!=`object`&&(d.target=Gt(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:q(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),h(),f):i},f}var qt=1664525,Jt=1013904223,Yt=4294967296;function Xt(){let e=1;return()=>(e=(qt*e+Jt)%Yt)/Yt}function Zt(e){return e.x}function Qt(e){return e.y}var $t=10,en=Math.PI*(3-Math.sqrt(5));function tn(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=Nt(d),l=mt(`tick`,`end`),u=Xt();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=$t*Math.sqrt(.5+t),a=t*en;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function nn(){var e,t,n,r,i=q(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=ut(e,Zt,Qt).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=Bt(n),m+=d*d),f===0&&(f=Bt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=Bt(n),m+=d*d),f===0&&(f=Bt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function rn(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}function an(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}var on=`http://www.w3.org/1999/xhtml`,sn={svg:`http://www.w3.org/2000/svg`,xhtml:on,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function cn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),sn.hasOwnProperty(t)?{space:sn[t],local:e}:e}function ln(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===on&&t.documentElement.namespaceURI===on?t.createElement(e):t.createElementNS(n,e)}}function un(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dn(e){var t=cn(e);return(t.local?un:ln)(t)}function fn(){}function pn(e){return e==null?fn:function(){return this.querySelector(e)}}function mn(e){typeof e!=`function`&&(e=pn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new J(r,this._parents)}function hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gn(){return[]}function _n(e){return e==null?gn:function(){return this.querySelectorAll(e)}}function vn(e){return function(){return hn(e.apply(this,arguments))}}function yn(e){e=typeof e==`function`?vn(e):_n(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new J(r,i)}function bn(e){return function(){return this.matches(e)}}function xn(e){return function(t){return t.matches(e)}}var Sn=Array.prototype.find;function Cn(e){return function(){return Sn.call(this.children,e)}}function wn(){return this.firstElementChild}function Tn(e){return this.select(e==null?wn:Cn(typeof e==`function`?e:xn(e)))}var En=Array.prototype.filter;function Dn(){return Array.from(this.children)}function On(e){return function(){return En.call(this.children,e)}}function kn(e){return this.selectAll(e==null?Dn:On(typeof e==`function`?e:xn(e)))}function An(e){typeof e!=`function`&&(e=bn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents)}function jn(e){return Array(e.length)}function Mn(){return new J(this._enter||this._groups.map(jn),this._parents)}function Nn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nn.prototype={constructor:Nn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Pn(e){return function(){return e}}function Fn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Nn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function In(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Nn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Ln(e){return e.__data__}function Rn(e,t){if(!arguments.length)return Array.from(this,Ln);var n=t?In:Fn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Pn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=zn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new J(o,r),o._enter=s,o._exit=c,o}function zn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Bn(){return new J(this._exit||this._groups.map(jn),this._parents)}function Vn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Hn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new J(s,this._parents)}function Un(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Wn(e){e||=Gn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new J(i,this._parents).order()}function Gn(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Kn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qn(){return Array.from(this)}function Jn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Yn(){let e=0;for(let t of this)++e;return e}function Xn(){return!this.node()}function Zn(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Qn(e){return function(){this.removeAttribute(e)}}function $n(e){return function(){this.removeAttributeNS(e.space,e.local)}}function er(e,t){return function(){this.setAttribute(e,t)}}function tr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function nr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function rr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ir(e,t){var n=cn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?$n:Qn:typeof t==`function`?n.local?rr:nr:n.local?tr:er)(n,t))}function ar(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function or(e){return function(){this.style.removeProperty(e)}}function sr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lr(e,t,n){return arguments.length>1?this.each((t==null?or:typeof t==`function`?cr:sr)(e,t,n??``)):ur(this.node(),e)}function ur(e,t){return e.style.getPropertyValue(t)||ar(e).getComputedStyle(e,null).getPropertyValue(t)}function dr(e){return function(){delete this[e]}}function fr(e,t){return function(){this[e]=t}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mr(e,t){return arguments.length>1?this.each((t==null?dr:typeof t==`function`?pr:fr)(e,t)):this.node()[e]}function hr(e){return e.trim().split(/^|\s+/)}function gr(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=hr(e.getAttribute(`class`)||``)}_r.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function vr(e,t){for(var n=gr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function yr(e,t){for(var n=gr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function br(e){return function(){vr(this,e)}}function xr(e){return function(){yr(this,e)}}function Sr(e,t){return function(){(t.apply(this,arguments)?vr:yr)(this,e)}}function Cr(e,t){var n=hr(e+``);if(arguments.length<2){for(var r=gr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Sr:t?br:xr)(n,t))}function wr(){this.textContent=``}function Tr(e){return function(){this.textContent=e}}function Er(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Dr(e){return arguments.length?this.each(e==null?wr:(typeof e==`function`?Er:Tr)(e)):this.node().textContent}function Or(){this.innerHTML=``}function kr(e){return function(){this.innerHTML=e}}function Ar(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function jr(e){return arguments.length?this.each(e==null?Or:(typeof e==`function`?Ar:kr)(e)):this.node().innerHTML}function Mr(){this.nextSibling&&this.parentNode.appendChild(this)}function Nr(){return this.each(Mr)}function Pr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fr(){return this.each(Pr)}function Ir(e){var t=typeof e==`function`?e:dn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lr(){return null}function Rr(e,t){var n=typeof e==`function`?e:dn(e),r=t==null?Lr:typeof t==`function`?t:pn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zr(){var e=this.parentNode;e&&e.removeChild(this)}function Br(){return this.each(zr)}function Vr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ur(e){return this.select(e?Hr:Vr)}function Wr(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Gr(e){return function(t){e.call(this,t,this.__data__)}}function Kr(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function qr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Jr(e,t,n){return function(){var r=this.__on,i,a=Gr(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Yr(e,t,n){var r=Kr(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?Jr:qr,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Xr(e,t,n){var r=ar(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Zr(e,t){return function(){return Xr(this,e,t)}}function Qr(e,t){return function(){return Xr(this,e,t.apply(this,arguments))}}function $r(e,t){return this.each((typeof t==`function`?Qr:Zr)(e,t))}function*ei(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var ti=[null];function J(e,t){this._groups=e,this._parents=t}function ni(){return new J([[document.documentElement]],ti)}function ri(){return this}J.prototype=ni.prototype={constructor:J,select:mn,selectAll:yn,selectChild:Tn,selectChildren:kn,filter:An,data:Rn,enter:Mn,exit:Bn,join:Vn,merge:Hn,selection:ri,order:Un,sort:Wn,call:Kn,nodes:qn,node:Jn,size:Yn,empty:Xn,each:Zn,attr:ir,style:lr,property:mr,classed:Cr,text:Dr,html:jr,raise:Nr,lower:Fr,append:Ir,insert:Rr,remove:Br,clone:Ur,datum:Wr,on:Yr,dispatch:$r,[Symbol.iterator]:ei};function Y(e){return typeof e==`string`?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],ti)}var ii=0;function ai(){return new oi}function oi(){this._=`@`+(++ii).toString(36)}oi.prototype=ai.prototype={constructor:oi,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};function si(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ci(e,t){if(e=si(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var li={capture:!0,passive:!1};function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function di(e){var t=e.document.documentElement,n=Y(e).on(`dragstart.drag`,ui,li);`onselectstart`in t?n.on(`selectstart.drag`,ui,li):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function fi(e,t){var n=e.document.documentElement,r=Y(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,ui,li),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function pi(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function hi(){}var gi=.7,_i=1/gi,vi=`\\s*([+-]?\\d+)\\s*`,yi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,X=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,bi=/^#([0-9a-f]{3,8})$/,xi=RegExp(`^rgb\\(${vi},${vi},${vi}\\)$`),Si=RegExp(`^rgb\\(${X},${X},${X}\\)$`),Ci=RegExp(`^rgba\\(${vi},${vi},${vi},${yi}\\)$`),wi=RegExp(`^rgba\\(${X},${X},${X},${yi}\\)$`),Ti=RegExp(`^hsl\\(${yi},${X},${X}\\)$`),Ei=RegExp(`^hsla\\(${yi},${X},${X},${yi}\\)$`),Di={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pi(hi,Mi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Oi,formatHex:Oi,formatHex8:ki,formatHsl:Ai,formatRgb:ji,toString:ji});function Oi(){return this.rgb().formatHex()}function ki(){return this.rgb().formatHex8()}function Ai(){return Wi(this).formatHsl()}function ji(){return this.rgb().formatRgb()}function Mi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=bi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ni(t):n===3?new Z(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xi.exec(e))?new Z(t[1],t[2],t[3],1):(t=Si.exec(e))?new Z(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ci.exec(e))?Pi(t[1],t[2],t[3],t[4]):(t=wi.exec(e))?Pi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ti.exec(e))?Ui(t[1],t[2]/100,t[3]/100,1):(t=Ei.exec(e))?Ui(t[1],t[2]/100,t[3]/100,t[4]):Di.hasOwnProperty(e)?Ni(Di[e]):e===`transparent`?new Z(NaN,NaN,NaN,0):null}function Ni(e){return new Z(e>>16&255,e>>8&255,e&255,1)}function Pi(e,t,n,r){return r<=0&&(e=t=n=NaN),new Z(e,t,n,r)}function Fi(e){return e instanceof hi||(e=Mi(e)),e?(e=e.rgb(),new Z(e.r,e.g,e.b,e.opacity)):new Z}function Ii(e,t,n,r){return arguments.length===1?Fi(e):new Z(e,t,n,r??1)}function Z(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}pi(Z,Ii,mi(hi,{brighter(e){return e=e==null?_i:_i**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gi:gi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Z(Vi(this.r),Vi(this.g),Vi(this.b),Bi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Li,formatHex:Li,formatHex8:Ri,formatRgb:zi,toString:zi}));function Li(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}`}function Ri(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}${Hi((isNaN(this.opacity)?1:this.opacity)*255)}`}function zi(){let e=Bi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Vi(this.r)}, ${Vi(this.g)}, ${Vi(this.b)}${e===1?`)`:`, ${e})`}`}function Bi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hi(e){return e=Vi(e),(e<16?`0`:``)+e.toString(16)}function Ui(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Wi(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof hi||(e=Mi(e)),!e)return new Q;if(e instanceof Q)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Q(o,s,c,e.opacity)}function Gi(e,t,n,r){return arguments.length===1?Wi(e):new Q(e,t,n,r??1)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}pi(Q,Gi,mi(hi,{brighter(e){return e=e==null?_i:_i**+e,new Q(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gi:gi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Z(Ji(e>=240?e-240:e+120,i,r),Ji(e,i,r),Ji(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Q(Ki(this.h),qi(this.s),qi(this.l),Bi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Bi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ki(this.h)}, ${qi(this.s)*100}%, ${qi(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ki(e){return e=(e||0)%360,e<0?e+360:e}function qi(e){return Math.max(0,Math.min(1,e||0))}function Ji(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Yi=e=>()=>e;function Xi(e,t){return function(n){return e+n*t}}function Zi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Qi(e){return(e=+e)==1?$i:function(t,n){return n-t?Zi(t,n,e):Yi(isNaN(t)?n:t)}}function $i(e,t){var n=t-e;return n?Xi(e,n):Yi(isNaN(e)?t:e)}var ea=(function e(t){var n=Qi(t);function r(e,t){var r=n((e=Ii(e)).r,(t=Ii(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$i(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function ta(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var na=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(na.source,`g`);function ia(e){return function(){return e}}function aa(e){return function(t){return e(t)+``}}function oa(e,t){var n=na.lastIndex=ra.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=na.exec(e))&&(i=ra.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:ta(r,i)})),n=ra.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?aa(c[0].x):ia(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var sa=180/Math.PI,ca={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function la(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*sa,skewX:Math.atan(c)*sa,scaleX:o,scaleY:s}}var ua;function da(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ca:la(t.a,t.b,t.c,t.d,t.e,t.f)}function fa(e){return e==null||(ua||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ua.setAttribute(`transform`,e),!(e=ua.transform.baseVal.consolidate()))?ca:(e=e.matrix,la(e.a,e.b,e.c,e.d,e.e,e.f))}function pa(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:ta(e,i)},{i:c-2,x:ta(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:ta(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:ta(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:ta(e,n)},{i:s-2,x:ta(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ma=pa(da,`px, `,`px)`,`deg)`),ha=pa(fa,`, `,`)`,`)`),ga=1e-12;function _a(e){return((e=Math.exp(e))+1/e)/2}function va(e){return((e=Math.exp(e))-1/e)/2}function ya(e){return((e=Math.exp(2*e))-1)/(e+1)}var ba=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<ga)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=_a(y),c=s/(n*g)*(i*ya(t*r+y)-va(y));return[a+c*d,o+c*f,s*i/_a(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),xa=mt(`start`,`end`,`cancel`,`interrupt`),Sa=[];function Ca(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ea(e,n,{name:t,index:r,group:i,on:xa,tween:Sa,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function wa(e,t){var n=$(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Ta(e,t){var n=$(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function $(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ea(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Nt(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return zt(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(zt(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Da(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function Oa(e){return this.each(function(){Da(this,e)})}function ka(e,t){var n,r;return function(){var i=Ta(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Aa(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Ta(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function ja(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=$(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ka:Aa)(n,e,t))}function Ma(e,t,n){var r=e._id;return e.each(function(){var e=Ta(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return $(e,r).value[t]}}function Na(e,t){var n;return(typeof t==`number`?ta:t instanceof Mi?ea:(n=Mi(t))?(t=n,ea):oa)(e,t)}function Pa(e){return function(){this.removeAttribute(e)}}function Fa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ia(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function La(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Ra(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function za(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ba(e,t){var n=cn(e),r=n===`transform`?ha:Na;return this.attrTween(e,typeof t==`function`?(n.local?za:Ra)(n,r,Ma(this,`attr.`+e,t)):t==null?(n.local?Fa:Pa)(n):(n.local?La:Ia)(n,r,t))}function Va(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ha(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ua(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ha(e,i)),n}return i._value=t,i}function Wa(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Va(e,i)),n}return i._value=t,i}function Ga(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=cn(e);return this.tween(n,(r.local?Ua:Wa)(r,t))}function Ka(e,t){return function(){wa(this,e).delay=+t.apply(this,arguments)}}function qa(e,t){return t=+t,function(){wa(this,e).delay=t}}function Ja(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ka:qa)(t,e)):$(this.node(),t).delay}function Ya(e,t){return function(){Ta(this,e).duration=+t.apply(this,arguments)}}function Xa(e,t){return t=+t,function(){Ta(this,e).duration=t}}function Za(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ya:Xa)(t,e)):$(this.node(),t).duration}function Qa(e,t){if(typeof t!=`function`)throw Error();return function(){Ta(this,e).ease=t}}function $a(e){var t=this._id;return arguments.length?this.each(Qa(t,e)):$(this.node(),t).ease}function eo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Ta(this,e).ease=n}}function to(e){if(typeof e!=`function`)throw Error();return this.each(eo(this._id,e))}function no(e){typeof e!=`function`&&(e=bn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Mo(r,this._parents,this._name,this._id)}function ro(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Mo(o,this._parents,this._name,this._id)}function io(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ao(e,t,n){var r,i,a=io(t)?wa:Ta;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function oo(e,t){var n=this._id;return arguments.length<2?$(this.node(),n).on.on(e):this.each(ao(n,e,t))}function so(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function co(){return this.on(`end.remove`,so(this._id))}function lo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=pn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ca(l[f],t,n,f,l,$(u,n)));return new Mo(a,this._parents,t,n)}function uo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=_n(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ca(p,t,n,h,f,m);a.push(f),o.push(u)}return new Mo(a,o,t,n)}var fo=ni.prototype.constructor;function po(){return new fo(this._groups,this._parents)}function mo(e,t){var n,r,i;return function(){var a=ur(this,e),o=(this.style.removeProperty(e),ur(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ho(e){return function(){this.style.removeProperty(e)}}function go(e,t,n){var r,i=n+``,a;return function(){var o=ur(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function _o(e,t,n){var r,i,a;return function(){var o=ur(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),ur(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function vo(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Ta(this,e),l=c.on,u=c.value[a]==null?s||=ho(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function yo(e,t,n){var r=(e+=``)==`transform`?ma:Na;return t==null?this.styleTween(e,mo(e,r)).on(`end.style.`+e,ho(e)):typeof t==`function`?this.styleTween(e,_o(e,r,Ma(this,`style.`+e,t))).each(vo(this._id,e)):this.styleTween(e,go(e,r,t),n).on(`end.style.`+e,null)}function bo(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function xo(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&bo(e,a,n)),r}return a._value=t,a}function So(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,xo(e,t,n??``))}function Co(e){return function(){this.textContent=e}}function wo(e){return function(){var t=e(this);this.textContent=t??``}}function To(e){return this.tween(`text`,typeof e==`function`?wo(Ma(this,`text`,e)):Co(e==null?``:e+``))}function Eo(e){return function(t){this.textContent=e.call(this,t)}}function Do(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Eo(r)),t}return r._value=e,r}function Oo(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Do(e))}function ko(){for(var e=this._name,t=this._id,n=No(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=$(c,t);Ca(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mo(r,this._parents,e,n)}function Ao(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Ta(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var jo=0;function Mo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function No(){return++jo}var Po=ni.prototype;Mo.prototype={constructor:Mo,select:lo,selectAll:uo,selectChild:Po.selectChild,selectChildren:Po.selectChildren,filter:no,merge:ro,selection:po,transition:ko,call:Po.call,nodes:Po.nodes,node:Po.node,size:Po.size,empty:Po.empty,each:Po.each,on:oo,attr:Ba,attrTween:Ga,style:yo,styleTween:So,text:To,textTween:Oo,remove:co,tween:ja,delay:Ja,duration:Za,ease:$a,easeVarying:to,end:Ao,[Symbol.iterator]:Po[Symbol.iterator]};function Fo(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Io={time:null,delay:0,duration:250,ease:Fo};function Lo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ro(e){var t,n;e instanceof Mo?(t=e._id,e=e._name):(t=No(),(n=Io).time=At(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ca(c,e,t,l,o,n||Lo(c,t));return new Mo(r,this._parents,e,t)}ni.prototype.interrupt=Oa,ni.prototype.transition=Ro;var zo=e=>()=>e;function Bo(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Vo(e,t,n){this.k=e,this.x=t,this.y=n}Vo.prototype={constructor:Vo,scale:function(e){return e===1?this:new Vo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Ho=new Vo(1,0,0);Uo.prototype=Vo.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ho;return e.__zoom}function Wo(e){e.stopImmediatePropagation()}function Go(e){e.preventDefault(),e.stopImmediatePropagation()}function Ko(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function qo(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Jo(){return this.__zoom||Ho}function Yo(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Xo(){return navigator.maxTouchPoints||`ontouchstart`in this}function Zo(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Qo(){var e=Ko,t=qo,n=Zo,r=Yo,i=Xo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ba,l=mt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Jo).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,w).filter(i).on(`touchstart.zoom`,ne).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,E).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Jo),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ho.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Vo(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Vo(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Vo(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Y(this.that).datum();l.call(e,this.that,new Bo(e,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ci(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Da(this),s.start();Go(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Y(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ci(t,i),l=t.clientX,u=t.clientY;di(t.view),Wo(t),a.mouse=[c,this.__zoom.invert(c)],Da(this),a.start();function d(e){if(Go(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ci(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),fi(e.view,a.moved),Go(e),a.event(e).end()}}function w(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ci(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Go(r),s>0?Y(this).transition().duration(s).call(x,d,c,r):Y(this).call(_.transform,d,c,r)}}function ne(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Wo(t),s=0;s<i;++s)c=r[s],l=ci(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Da(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Go(e),s=0;s<a;++s)c=i[s],l=ci(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function E(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Wo(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=ci(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Y(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:zo(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:zo(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:zo(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:zo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var $o=[`height`,`viewBox`,`width`],es=[`id`],ts=[`fill`],ns=[`transform`],rs=[`cx`,`cy`,`fill`,`fill-opacity`,`r`,`stroke`,`stroke-opacity`],is=[`stroke`,`stroke-opacity`,`stroke-width`,`marker-end`,`x1`,`x2`,`y1`,`y2`],as=[`stroke`,`marker-end`,`x1`,`x2`,`y1`,`y2`],os=[`opacity`,`aria-label`,`transform`,`onClick`,`onKeydown`,`onPointercancel`,`onPointerdown`,`onPointermove`,`onPointerup`],ss=[`fill`,`r`,`stroke`,`stroke-opacity`,`stroke-width`],cs={key:0,class:`pointer-events-none`},ls=[`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`width`,`x`],us=[`fill`,`text-anchor`,`x`],ds=[`fill`,`text-anchor`,`x`],fs={class:`absolute bottom-3 left-3 z-30 grid grid-cols-2 gap-x-3 gap-y-1.5 border border-base bg-glass px-3 py-2 shadow`},ps={class:`truncate`},ms={class:`absolute bottom-3 right-3 z-30 flex flex-col items-end gap-2`},hs={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},gs=[`disabled`],_s={class:`font-state-field h-8 w-8 rounded-full bg-active color-muted flex items-center justify-center text-3.5`},vs=[`disabled`],ys={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},bs=680,xs=460,Ss=34,Cs=1,ws=6,Ts=d({__name:`ReactivityGraphCanvas`,props:c({graph:{},path:{},pathSelectorOpen:{type:Boolean}},{selectedNodeId:{},selectedNodeIdModifiers:{},dependencyDepth:{required:!0},dependencyDepthModifiers:{}}),emits:c([`select`],[`update:selectedNodeId`,`update:dependencyDepth`]),setup(a,{emit:c}){let d=a,g=l(a,`selectedNodeId`),S=l(a,`dependencyDepth`),T=c,E=ee(d,`graph`),D=ee(d,`pathSelectorOpen`),O=f(()=>!!d.path),j=f(()=>d.path??fe());function ie(e){T(`select`,e)}let M=[`#13966f`,`#3b82d6`,`#c58119`,`#d84f45`,`#0891b2`,`#db2777`,`#7c3aed`,`#64748b`],N=p(),P=p(),F=p(960),I=p(640),L=p({x:0,y:0,k:1}),z=p(0),B=b([]),le=b([]),ue=f(()=>new Map(B.value.map(e=>[e.id,e]))),de=b([]),pe,me,he,ge,_e=f(()=>[E.value.nodes.map(e=>`${e.id}:${e.type}:${e.label}`).join(`|`),E.value.relationships.map(e=>`${e.id}:${e.from}:${e.to}`).join(`|`)].join(`::`)),ve=f(()=>({links:le.value,nodes:B.value,version:z.value})),ye=f(()=>{if(!O.value)return[];let e=j.value.relationshipIds;return ve.value.links.filter(t=>e.has(t.id))}),be=f(()=>{let e=oe(de.value,F.value,I.value);return de.value.map(t=>{let n=e.get(t.id)??{x:F.value/2,y:I.value/2};return{...t,color:it(t.id),radius:Math.max(86,Math.min(210,56+Math.sqrt(t.nodeCount)*34)),x:n.x,y:n.y}})}),xe=f(()=>`translate(${L.value.x} ${L.value.y}) scale(${L.value.k})`),Se=f(()=>`${Math.round(L.value.k*100)}%`),Ce=f(()=>B.value.find(e=>e.id===g.value)),we=f(()=>Ce.value?de.value.find(e=>e.id===Ce.value?.group):void 0),Te=f(()=>{if(!g.value)return Oe();let e=ke(g.value,`dependencies`,S.value),t=ke(g.value,`subscribers`,S.value),n=new Set([g.value,...e.nodeIds,...t.nodeIds]);return{dependencyNodeIds:e.nodeIds,nodeIds:n,relationshipIds:new Set([...e.relationshipIds,...t.relationshipIds]),subscriberNodeIds:t.nodeIds}}),Ee=f(()=>O.value?j.value.relationshipIds:Te.value.relationshipIds),De=f(()=>O.value?j.value.nodeIds:Te.value.nodeIds);function Oe(){return{dependencyNodeIds:new Set,nodeIds:new Set,relationshipIds:new Set,subscriberNodeIds:new Set}}function ke(e,t,n){let r=new Set,i=new Set,a=new Set([e]),o=new Set([e]);for(let e=0;e<n&&o.size;e+=1){let e=new Set;for(let n of le.value){let s=t===`dependencies`?n.from:n.to,c=t===`dependencies`?n.to:n.from;o.has(c)&&(i.add(n.id),r.add(s),a.has(s)||(a.add(s),e.add(s)))}o=e}return{nodeIds:r,relationshipIds:i}}function Ae(e){S.value=Math.min(ws,Math.max(Cs,e))}function je(e){Ae(S.value+e)}function Me(){me?.stop();let e=ae(E.value,F.value,I.value);if(B.value=e.nodes,le.value=e.links,de.value=e.groups,z.value+=1,g.value&&!e.nodes.some(e=>e.id===g.value)&&(g.value=void 0),g.value||D.value||O.value||(g.value=nt(e.nodes)?.id),!e.nodes.length){me=void 0;return}let t=oe(e.groups,F.value,I.value);me=tn(e.nodes).force(`link`,Kt(e.links).id(e=>e.id).distance(e=>e.group===we.value?.id?92:112).strength(.58)).force(`charge`,nn().strength(e=>-260-e.radius*14)).force(`collide`,Ut().radius(e=>e.radius+Qe(e))).force(`x`,rn(e=>t.get(e.group)?.x??F.value/2).strength(.085)).force(`y`,an(e=>t.get(e.group)?.y??I.value/2).strength(.085)).alpha(.95).alphaDecay(.022).on(`tick`,()=>{z.value+=1})}function Ne(){me&&me.force(`collide`,Ut().radius(e=>e.radius+Qe(e))).alpha(.32).restart()}function Pe(){P.value&&(he=Qo().scaleExtent([.32,2.6]).filter(e=>{let t=e.target;return e.type===`mousedown`&&t?.closest(`[data-graph-node]`)?!1:(!e.ctrlKey||e.type===`wheel`)&&!e.button}).on(`zoom`,e=>{L.value={k:e.transform.k,x:e.transform.x,y:e.transform.y}}),Y(P.value).call(he),t(Fe))}function Fe(){if(!P.value||!he)return;let e=Le();if(!e){Y(P.value).call(he.transform,Ho);return}let t=Math.max(1,e.maxX-e.minX),n=Math.max(1,e.maxY-e.minY),r=Math.min(1.45,Math.max(.42,Math.min((F.value-96)/t,(I.value-96)/n))),i=(e.minX+e.maxX)/2,a=(e.minY+e.maxY)/2,o=Ho.translate(F.value/2,I.value/2).scale(r).translate(-i,-a);Y(P.value).call(he.transform,o)}function Ie(e){P.value&&he&&Y(P.value).call(he.scaleBy,e)}function Le(){let e=B.value;if(!e.length)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=a.x??F.value/2,o=a.y??I.value/2;t=Math.min(t,e-a.radius-72),n=Math.min(n,o-a.radius-32),r=Math.max(r,e+a.radius+142),i=Math.max(i,o+a.radius+32)}return{minX:t,minY:n,maxX:r,maxY:i}}function Re(e,t){e.stopPropagation(),ie(t.id),ge=t.id,t.fx=t.x,t.fy=t.y,me?.alphaTarget(.28).restart(),e.currentTarget.setPointerCapture(e.pointerId)}function ze(e,t){if(ge!==t.id)return;let n=Ve(e);t.fx=n.x,t.fy=n.y,z.value+=1}function Be(e,t){ge===t.id&&(ge=void 0,t.fx=null,t.fy=null,me?.alphaTarget(0),e.currentTarget.releasePointerCapture(e.pointerId))}function Ve(e){if(!P.value)return{x:e.offsetX,y:e.offsetY};let t=P.value.createSVGPoint();t.x=e.clientX,t.y=e.clientY;let n=P.value.getScreenCTM(),r=n?t.matrixTransform(n.inverse()):t;return{x:(r.x-L.value.x)/L.value.k,y:(r.y-L.value.y)/L.value.k}}function He(e){return We(e.source)}function Ue(e){return We(e.target)}function We(e){if(typeof e==`object`)return e;if(e!=null)return ue.value.get(String(e))}function Ge(e){return Ye(e,`source`).x}function Ke(e){return Ye(e,`source`).y}function qe(e){return Ye(e,`target`).x}function Je(e){return Ye(e,`target`).y}function Ye(e,t){let n=He(e),r=Ue(e);if(!n||!r)return{x:F.value/2,y:I.value/2};let i=n.x??F.value/2,a=n.y??I.value/2,o=r.x??F.value/2,s=r.y??I.value/2,c=o-i,l=s-a,u=Math.hypot(c,l)||1,d=c/u,f=l/u;if(t===`source`){let e=n.radius+2;return{x:i+d*e,y:a+f*e}}let p=r.radius+6;return{x:o-d*p,y:s-f*p}}function U(e){return O.value?Ee.value.has(e.id):!g.value||Ee.value.has(e.id)}function Xe(e){return O.value?De.value.has(e.id):!g.value||De.value.has(e.id)}function W(e){return O.value&&De.value.has(e.id)}function Ze(e){return O.value?De.value.has(e.id):g.value?e.id===g.value||De.value.has(e.id):rt(e)>=4}function Qe(e){return Ze(e)?44+e.labelWidth*.16:20}function G(e){let t=F.value/2;return(e.x??t)>t?`left`:`right`}function $e(e){let t=e.radius+8;return G(e)===`left`?-e.labelWidth-t:t}function et(e){return G(e)===`left`?$e(e)+e.labelWidth-10:$e(e)+10}function tt(e){return G(e)===`left`?`end`:`start`}function nt(e){return[...e].sort((e,t)=>rt(t)-rt(e)).at(0)}function rt(e){let t=Math.min(e.incoming,e.outgoing)*2,n=e.type===`computed`?2:+(e.type===`watch`||e.type===`effect`);return e.incoming+e.outgoing+t+n}function it(e){return M[e%M.length]}function at(e){return O.value||g.value?U(e)?it(e.group):`#888888`:it(e.group)}function ot(e){return O.value?U(e)?.9:.08:g.value?U(e)?.72:.12:.42}function st(e){return O.value?U(e)?2.8:1:U(e)?1.8:1.1}function ct(e){return`url(#${(g.value||O.value)&&!U(e)?`reactivity-arrow-muted`:`reactivity-arrow-${e.group%M.length}`})`}function lt(e){return O.value?Xe(e)?1:.18:g.value?Xe(e)?1:.28:1}function ut(e){return e.id===g.value||W(e)?`#111827`:`#ffffff`}function dt(e){return e.id===g.value||W(e)?.72:.92}function ft(e){return e.id===g.value||W(e)?3:1.5}return e(()=>{N.value&&(pe=new ResizeObserver(([e])=>{F.value=Math.max(bs,e.contentRect.width),I.value=Math.max(xs,e.contentRect.height)}),pe.observe(N.value)),Pe()}),o([_e,F,I],()=>{Me(),t(Fe)},{immediate:!0}),o([g,S,()=>d.path],Ne),_(()=>{pe?.disconnect(),me?.stop()}),(e,t)=>{let a=ne(`tooltip`);return s(),h(`div`,{ref_key:`container`,ref:N,class:`relative h-full min-w-0 overflow-hidden bg-subtle bg-dots select-none`},[(s(),h(`svg`,{ref_key:`svg`,ref:P,class:`h-full w-full touch-none`,role:`img`,"aria-label":`Vue reactivity dependency graph`,height:I.value,viewBox:`0 0 ${F.value} ${I.value}`,width:F.value},[m(`defs`,null,[t[4]||=m(`marker`,{id:`reactivity-arrow-muted`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:`#888888`,opacity:`0.42`})],-1),(s(),h(v,null,i(M,(e,t)=>m(`marker`,{id:`reactivity-arrow-${t}`,key:`arrow-${t}`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:it(t),opacity:`0.82`},null,8,ts)],8,es)),64))]),m(`g`,{transform:xe.value},[(s(!0),h(v,null,i(be.value,e=>(s(),h(`circle`,{key:`group-${e.id}`,cx:e.x,cy:e.y,fill:e.color,"fill-opacity":we.value&&we.value.id!==e.id?.025:.07,r:e.radius,stroke:e.color,"stroke-opacity":we.value&&we.value.id!==e.id?.08:.18,"stroke-dasharray":`5 6`,"stroke-width":`1`},null,8,rs))),128)),(s(!0),h(v,null,i(ve.value.links,e=>(s(),h(`line`,{key:e.id,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":ot(e),"stroke-width":st(e),"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,is))),128)),(s(!0),h(v,null,i(ye.value,e=>(s(),h(`line`,{key:`path-${e.id}`,class:`pointer-events-none`,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":`0.96`,"stroke-width":`3.4`,"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,as))),128)),(s(!0),h(v,null,i(ve.value.nodes,e=>(s(),h(`g`,{key:e.id,"data-graph-node":``,class:`cursor-grab outline-none active:cursor-grabbing`,opacity:lt(e),role:`button`,tabindex:`0`,"aria-label":`Select ${x(R)(e)} graph node`,transform:`translate(${e.x??F.value/2} ${e.y??I.value/2})`,onClick:A(t=>ie(e.id),[`stop`]),onKeydown:re(A(t=>ie(e.id),[`prevent`]),[`enter`]),onPointercancel:t=>Be(t,e),onPointerdown:t=>Re(t,e),onPointermove:t=>ze(t,e),onPointerup:t=>Be(t,e)},[m(`circle`,{fill:x(V)(e.type),r:e.radius,stroke:ut(e),"stroke-opacity":dt(e),"stroke-width":ft(e),class:`dark:stroke-#f8fafc`},null,8,ss),Ze(e)?(s(),h(`g`,cs,[m(`rect`,{fill:e.id===g.value?`#f8fafc`:`#111827`,"fill-opacity":e.id===g.value?.96:.9,height:Ss,rx:`5`,stroke:it(e.group),"stroke-opacity":e.id===g.value?.82:.34,"stroke-width":`1`,width:e.labelWidth,x:$e(e),y:`-17`},null,8,ls),m(`text`,{class:`font-state-field text-3 font-700`,"dominant-baseline":`middle`,fill:e.id===g.value?`#111827`:`#f8fafc`,"text-anchor":tt(e),x:et(e),y:`-5`},n(x(se)(x(R)(e))),9,us),m(`text`,{class:`text-2.25 font-800`,"dominant-baseline":`middle`,fill:e.id===g.value?`#475569`:`#94a3b8`,"text-anchor":tt(e),x:et(e),y:`9`},n(x(H)(e.type)),9,ds)])):y(``,!0),m(`title`,null,n(x(R)(e))+` - `+n(x(H)(e.type)),1)],40,os))),128))],8,ns)],8,$o)),m(`div`,fs,[(s(!0),h(v,null,i(x(ce),e=>(s(),h(`div`,{key:e,class:`font-state-field min-w-23 flex items-center gap-1.5 color-base text-3.5`},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e)})},null,4),m(`span`,ps,n(x(H)(e)),1)]))),128))]),m(`div`,ms,[u((s(),h(`div`,hs,[u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value<=Cs?`op35`:``]),type:`button`,"aria-label":`Decrease relationship depth`,disabled:S.value<=Cs,onClick:t[0]||=A(e=>je(-1),[`stop`])},[w(k,{icon:`i-carbon-subtract`,class:`text-4`})],10,gs)),[[a,`Decrease relationship depth`,void 0,{top:!0}]]),m(`span`,_s,n(S.value),1),u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value>=ws?`op35`:``]),type:`button`,"aria-label":`Increase relationship depth`,disabled:S.value>=ws,onClick:t[1]||=A(e=>je(1),[`stop`])},[w(k,{icon:`i-carbon-add`,class:`text-4`})],10,vs)),[[a,`Increase relationship depth`,void 0,{top:!0}]])])),[[a,`Relationship depth`,void 0,{top:!0}]]),m(`div`,ys,[u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom out`,onClick:t[2]||=A(e=>Ie(.82),[`stop`])},[w(k,{icon:`i-carbon-zoom-out`,class:`text-4`})])),[[a,`Zoom out`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 min-w-10 rounded-full border-0 bg-transparent px-1.5 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,"aria-label":`Fit graph`,onClick:A(Fe,[`stop`])},[te(n(Se.value),1)])),[[a,`Fit graph`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom in`,onClick:t[3]||=A(e=>Ie(1.18),[`stop`])},[w(k,{icon:`i-carbon-zoom-in`,class:`text-4`})])),[[a,`Zoom in`,void 0,{top:!0}]])])])],512)}}}),Es={class:`h-full min-w-0 overflow-auto p-3`},Ds={key:0},Os={key:0,class:`grid gap-0.5`},ks=[`onClick`],As={class:`w-4 shrink-0 text-right color-muted font-state-field text-3`},js={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ms={key:0,class:`color-muted`},Ns={class:`shrink-0 color-muted text-3`},Ps={key:0,class:`h-7 color-muted flex items-center justify-center`},Fs={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Is={class:`pb-4`},Ls={class:`grid gap-0.5`},Rs={class:`state-key shrink-0 overflow-hidden text-ellipsis whitespace-nowrap op70`},zs={class:`border-t border-base pt-4`},Bs={class:`overflow-x-auto pb-2`},Vs=[`height`,`width`],Hs=[`d`],Us=[`onClick`],Ws={class:`min-w-0 flex items-center gap-1.5`},Gs={class:`truncate font-state-field text-3.5`},Ks={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},qs={key:2,class:`m-0 color-muted text-3 leading-5`},Js=20,Ys=d({__name:`ReactivityGraphDetails`,props:{graph:{},filteredGraph:{},selectedNodeId:{},dependencyDepth:{},path:{}},emits:[`select`],setup(e,{emit:t}){let a=e,o=t,c=ee(a,`selectedNodeId`),l=ee(a,`dependencyDepth`),d=ee(a,`filteredGraph`),p=f(()=>a.filteredGraph.nodes),g=f(()=>a.filteredGraph.relationships),_=f(()=>!!a.path),b=f(()=>a.path??fe());function S(e){o(`select`,e)}let T={width:180,height:30,padding:4,columnGap:52,canvasPadding:16,dot:16},E=f(()=>new Map(a.graph.nodes.map(e=>[e.id,e]))),D=f(()=>b.value.orderedNodeIds.map(e=>E.value.get(e)).filter(e=>e!==void 0)),O=f(()=>{let e=new Map(d.value.relationships.map(e=>[e.id,e]));return b.value.orderedRelationshipIds.map(t=>e.get(t)).filter(e=>e!==void 0)}),re=f(()=>new Map(p.value.map(e=>[e.id,e]))),A=f(()=>p.value.find(e=>e.id===c.value)),j=f(()=>c.value&&E.value.has(c.value)?L(E.value.get(c.value)):[]),ie=f(()=>F(`dependency`)),M=f(()=>F(`subscriber`)),N=f(()=>I());function P(e){return e?T.height*e+T.padding*(e+1):0}function F(e){let t=[],n=new Map,r=c.value;if(!r)return{depthById:n,layers:t};let i=new Set([r]),a=new Set([r]),o=0;for(let r=1;r<=l.value&&a.size;r+=1){let s=[],c=new Set;for(let t of g.value){let n=e===`dependency`?t.from:t.to,r=e===`dependency`?t.to:t.from;if(a.has(r)&&!(i.has(n)||c.has(n))&&re.value.has(n)&&(s.push(n),c.add(n),o+s.length>=Js))break}let l=s.slice(0,Js-o).map(e=>re.value.get(e)).filter(e=>e!==void 0);if(!l.length)break;for(let e of l)i.add(e.id),n.set(e.id,r);if(t.push(l),o+=l.length,a=new Set(l.map(e=>e.id)),o>=Js)break}return{depthById:n,layers:t}}function I(){let e=c.value;if(!e)return{centerX:T.canvasPadding+T.dot/2,centerY:T.dot/2,height:T.dot,links:[],nodes:[],width:T.canvasPadding*2+T.dot};let t=ie.value.layers,n=ie.value.depthById,r=M.value.layers,i=M.value.depthById,a=T.width+T.columnGap,o=T.canvasPadding+r.length*a+T.dot/2,s=T.canvasPadding*2+r.length*a+T.dot+t.length*a,l=Math.max(T.dot,...r.map(e=>P(e.length)),...t.map(e=>P(e.length))),u=l/2,d=[],f=[],p=new Map;r.forEach((e,t)=>{let n=t+1,r=P(e.length),i=(l-r)/2+T.padding,s=o-T.dot/2-T.columnGap-T.width-t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`subscriber`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),t.forEach((e,t)=>{let n=t+1,r=P(e.length),i=(l-r)/2+T.padding,s=o+T.dot/2+T.columnGap+t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`dependency`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),f.length&&(u=(Math.min(...f)+Math.max(...f))/2),p.set(e,{x:o,y:u});let m=[];for(let t of g.value){let r=n.get(t.from),a=t.to===e?0:n.get(t.to);if(r!==void 0&&a!==void 0&&r===a+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`dependency:${t.id}`,path:se(oe(e),e.y,n.x,n.y)})}let o=i.get(t.to),s=t.from===e?0:i.get(t.from);if(o!==void 0&&s!==void 0&&o===s+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`subscriber:${t.id}`,path:se(oe(e),e.y,ae(n),n.y)})}}return{centerX:o,centerY:u,height:l,links:m,nodes:d,width:s}}function ae(e){return e.node?e.x:e.x-T.dot/2}function oe(e){return e.node?e.x+T.width:e.x+T.dot/2}function se(e,t,n,r){let i=(e+n)/2;return`M ${e} ${t} C ${i} ${t} ${i} ${r} ${n} ${r}`}function L(e){let t=de(e);return[{key:`key`,value:z(R(e)),valueClass:`string-state-type`},{key:`type`,value:z(H(e.type)),valueClass:`string-state-type`},{key:`value`,value:t||`undefined`,valueClass:t?B(t):`null-state-type`}]}function z(e){return JSON.stringify(e)}function B(e){return e===`null`||e===`undefined`?`null-state-type`:e===`true`||e===`false`?`boolean-state-type`:e.startsWith(`"`)?`string-state-type`:/^-?\d/.test(e)||e.startsWith(`Symbol(`)?`literal-state-type`:`state-value`}function ce(e){let t=de(e);return t?t.length>28?`${t.slice(0,27)}...`:t:``}return(e,t)=>{let a=ne(`tooltip`);return s(),h(`aside`,Es,[_.value?(s(),h(`section`,Ds,[D.value.length?(s(),h(`div`,Os,[(s(!0),h(v,null,i(D.value,(e,t)=>(s(),h(v,{key:e.id},[m(`button`,{class:`min-w-0 rounded-1 border border-base bg-base px-2 py-1.5 text-left color-base flex items-center gap-2 hover:bg-active`,type:`button`,onClick:t=>S(e.id)},[m(`span`,As,n(t+1),1),m(`span`,{class:`h-2.5 w-2.5 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),u((s(),h(`span`,js,[m(`span`,null,n(x(R)(e)),1),ce(e)?(s(),h(`span`,Ms,` (`+n(ce(e))+`) `,1)):y(``,!0)])),[[a,x(de)(e),void 0,{top:!0}]]),m(`span`,Ns,n(x(H)(e.type)),1)],8,ks),t<O.value.length?(s(),h(`div`,Ps,[w(k,{icon:`i-carbon-arrow-down`,class:`text-4`})])):y(``,!0)],64))),128))])):(s(),h(`div`,Fs,` No relationship path found `))])):A.value?(s(),h(v,{key:1},[m(`section`,Is,[t[1]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Info`,-1),m(`div`,Ls,[(s(!0),h(v,null,i(j.value,e=>(s(),h(`div`,{key:e.key,class:`font-state-field min-w-0 flex items-center text-3.5`},[m(`span`,Rs,n(e.key),1),t[0]||=m(`span`,{class:`colon mx-1 shrink-0`},`:`,-1),u((s(),h(`span`,{class:C([`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap`,e.valueClass])},[te(n(e.value),1)],2)),[[a,e.value,void 0,{top:!0}]])]))),128))])]),m(`section`,zs,[t[2]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Relationships`,-1),m(`div`,Bs,[N.value.nodes.length?(s(),h(`div`,{key:0,class:`relative select-none`,style:r({width:`${N.value.width}px`,height:`${N.value.height}px`})},[(s(),h(`svg`,{"pointer-events-none":``,class:`absolute left-0 top-0 z-10`,height:N.value.height,width:N.value.width},[m(`g`,null,[(s(!0),h(v,null,i(N.value.links,e=>(s(),h(`path`,{key:e.id,d:e.path,fill:`none`,stroke:`#888888`,"stroke-opacity":`0.34`},null,8,Hs))),128))])],8,Vs)),m(`div`,{class:`absolute z-20 box-border rounded-full bg-base`,style:r({top:`${N.value.centerY-T.dot/2}px`,left:`${N.value.centerX-T.dot/2}px`,width:`${T.dot}px`,height:`${T.dot}px`,border:`3px solid ${A.value?x(V)(A.value.type):x(V)(`unknown`)}`})},null,4),(s(!0),h(v,null,i(N.value.nodes,e=>u((s(),h(`button`,{key:`${e.side}:${e.depth}:${e.node.id}`,class:`absolute z-20 min-w-0 block rounded-1 border border-base bg-base px-2 py-1 text-left color-base hover:bg-active`,type:`button`,style:r({left:`${e.x}px`,top:`${e.y-T.height/2}px`,width:`${T.width}px`,height:`${T.height}px`,overflow:`hidden`}),onClick:t=>S(e.node.id)},[m(`span`,Ws,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.node.type)})},null,4),m(`span`,Gs,n(x(R)(e.node)),1)])],12,Us)),[[a,`${x(R)(e.node)} - ${x(H)(e.node.type)}`,void 0,{top:!0}]])),128))],4)):(s(),h(`div`,Ks,` No data `))])])],64)):(s(),h(`p`,qs,` Select a node to inspect its dependencies and subscribers. `))])}}}),Xs={class:`h-full min-h-0 flex flex-col bg-base`},Zs=d({__name:`ReactivityGraph`,props:{graph:{}},setup(e){let t=e,n=p(),r=p(1),i=p(``),o=p(new Set(ce)),c=p(!1),l=p(``),u=p(``),d=f(()=>{let e=le(i.value),n=o.value,r=t.graph.nodes.filter(t=>n.has(t.type)&&ue(t,e)),a=new Set(r.map(e=>e.id));return{nodes:r,relationships:t.graph.relationships.filter(e=>a.has(e.from)&&a.has(e.to))}}),m=f(()=>pe(d.value.relationships)),g=f(()=>!!l.value&&!!u.value),_=f(()=>g.value?ge(l.value,u.value,m.value):fe());function v(e){c.value=!1,l.value=``,u.value=``,n.value=e}return(t,f)=>(s(),h(`div`,Xs,[w(Je,{search:i.value,"onUpdate:search":f[0]||=e=>i.value=e,"active-types":o.value,"onUpdate:activeTypes":f[1]||=e=>o.value=e,"path-selector-open":c.value,"onUpdate:pathSelectorOpen":f[2]||=e=>c.value=e,"path-start-id":l.value,"onUpdate:pathStartId":f[3]||=e=>l.value=e,"path-end-id":u.value,"onUpdate:pathEndId":f[4]||=e=>u.value=e,"selected-node-id":n.value,"onUpdate:selectedNodeId":f[5]||=e=>n.value=e,graph:e.graph,"filtered-graph":d.value},null,8,[`search`,`active-types`,`path-selector-open`,`path-start-id`,`path-end-id`,`selected-node-id`,`graph`,`filtered-graph`]),w(x(E),{class:`min-h-0 flex-1 overflow-hidden`},{default:a(()=>[w(x(D),{class:`h-full min-h-0`,"min-size":`30`,size:`53.333`},{default:a(()=>[w(Ts,{"selected-node-id":n.value,"onUpdate:selectedNodeId":f[6]||=e=>n.value=e,"dependency-depth":r.value,"onUpdate:dependencyDepth":f[7]||=e=>r.value=e,graph:d.value,path:g.value?_.value:void 0,"path-selector-open":c.value,onSelect:v},null,8,[`selected-node-id`,`dependency-depth`,`graph`,`path`,`path-selector-open`])]),_:1}),w(x(D),{class:`h-full min-h-0`,"min-size":`24`,size:`46.667`},{default:a(()=>[w(Ys,{graph:e.graph,"filtered-graph":d.value,"selected-node-id":n.value,"dependency-depth":r.value,path:g.value?_.value:void 0,onSelect:v},null,8,[`graph`,`filtered-graph`,`selected-node-id`,`dependency-depth`,`path`])]),_:1})]),_:1})]))}}),Qs={class:`h-full min-h-0 flex flex-col`},$s={key:0,class:`max-h-38 shrink-0 border-b border-base`},ec={class:`min-h-0 flex-1`},tc={key:1,class:`h-full min-h-0 flex items-center justify-center bg-subtle p-6`},nc={class:`m-0 max-w-78 text-center color-muted text-3.5 leading-5`},rc=d({__name:`graph`,setup(r){let{apps:i,cancelComponentInspection:o,componentInspecting:c,components:l,componentState:u,componentStateLoading:d,error:v,highlightComponent:b,inspectComponentInPage:ee,reactivityGraphEnabled:te,selectComponent:C,selectedComponent:ne,selectedComponentId:O,unhighlightComponent:re}=g(),k=p(),A=p(!1),M=p(``),N,P=f(()=>ie(l.value,M.value)),F=f(()=>u.value?.reactivityGraph),I=f(()=>te.value?ne.value?d.value?`Loading reactivity graph...`:`No data`:`Select a component to inspect its reactivity graph.`:`Reactivity Graph requires Vue 3.6 or later.`),ae=f(()=>[{icon:`i-carbon-select-window`,tooltip:c.value?`Cancel selecting component`:`Select component in the page`,ariaLabel:`Select component in the page`,active:c.value,pressed:c.value,rounded:`full`,run:se}]);async function oe(e){C(e),await t()}async function se(){if(c.value){await o();return}let e=await ee();e&&(M.value=``,C(e.componentId),await t())}function L(e){ae.value[e]?.run()}function R(e){z(e.target)||(e.key.toLowerCase()===`s`&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),se()):e.key===`Escape`&&c.value&&(e.preventDefault(),o()))}function z(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable}return e(()=>{N=new ResizeObserver(([e])=>{A.value=e.contentRect.width<760}),k.value&&N.observe(k.value),window.addEventListener(`keydown`,R)}),_(()=>{N?.disconnect(),window.removeEventListener(`keydown`,R),c.value&&o(),re()}),(e,t)=>(s(),h(`section`,{ref_key:`container`,ref:k,class:`h-full min-h-0`},[w(x(E),{class:`h-full min-h-0 overflow-hidden`,horizontal:A.value},{default:a(()=>[w(x(D),{class:`h-full min-h-0`,"min-size":`16`,size:A.value?34:18},{default:a(()=>[m(`div`,Qs,[x(i).length>1?(s(),h(`div`,$s,[w(T)])):y(``,!0),m(`div`,ec,[w(j,{filter:M.value,"onUpdate:filter":t[0]||=e=>M.value=e,actions:ae.value,"component-labels":``,"default-expand-depth":99,"empty-text":x(v)??`No components`,nodes:P.value,"no-matching-text":`No matching components`,placeholder:`Find components...`,"selected-node-id":x(O),"state-key":`reactivity-graph-components`,"refresh-visible":!1,onAction:L,onHover:t[1]||=e=>void x(b)(e),onLeave:t[2]||=()=>void x(re)(),onSelect:t[3]||=e=>void oe(e)},null,8,[`filter`,`actions`,`empty-text`,`nodes`,`selected-node-id`])])])]),_:1},8,[`size`]),w(x(D),{class:`h-full min-h-0`,"min-size":`32`},{default:a(()=>[x(te)&&F.value?.nodes.length?(s(),S(Zs,{key:0,graph:F.value},null,8,[`graph`])):(s(),h(`div`,tc,[m(`p`,nc,n(I.value),1)]))]),_:1})]),_:1},8,[`horizontal`])],512))}});export{rc as default};
1
+ import{A as e,D as t,Dt as n,Et as r,I as i,J as a,K as o,M as s,T as c,W as l,Y as u,b as d,d as f,et as p,f as m,h,i as g,j as _,l as v,m as y,nt as b,ot as x,p as S,rt as ee,v as te,wt as C,y as w,z as ne}from"./_plugin-vue_export-helper-7VP3XblN.js";import{n as T}from"./RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-Ko5HVMry.js";import{n as E,t as D}from"./splitpanes.esm-8w8po8hd.js";import{d as O,f as re,i as k,p as A}from"./index-DppbHKeW.js";import{t as j}from"./InspectorTree-B5ZtDinH.js";import{t as ie}from"./component-tree-C3C12cZe.js";var M=8,N=16,P=7.2,F=172,I=76;function ae(e,t,n){let r=new Set(e.nodes.map(e=>e.id)),i=new Map(e.nodes.map(e=>[e.id,e.id])),a=new Map(e.nodes.map(e=>[e.id,0])),o=new Map(e.nodes.map(e=>[e.id,0]));function s(e){let t=i.get(e)??e;if(t===e)return t;let n=s(t);return i.set(e,n),n}function c(e,t){let n=s(e),r=s(t);n!==r&&i.set(r,n)}for(let t of e.relationships)r.has(t.from)&&r.has(t.to)&&(c(t.from,t.to),o.set(t.from,(o.get(t.from)??0)+1),a.set(t.to,(a.get(t.to)??0)+1));let l=new Map,u=[];for(let t of e.nodes){let e=s(t.id);if(l.has(e))continue;let n=l.size;l.set(e,n),u.push({id:n,nodeCount:0,relationshipCount:0})}let d=oe(u,t,n),f=e.nodes.map(e=>{let r=l.get(s(e.id))??0,i=(a.get(e.id)??0)+(o.get(e.id)??0),c=Math.min(N,M+Math.sqrt(i+1)*3),f=d.get(r)??{x:t/2,y:n/2},p=B(e.id)%360*(Math.PI/180),m=18+B(`${e.id}:distance`)%54,h=u[r];return h&&(h.nodeCount+=1),{id:e.id,type:e.type,label:e.label,group:r,incoming:a.get(e.id)??0,labelWidth:L(R(e)),outgoing:o.get(e.id)??0,radius:c,x:f.x+Math.cos(p)*m,y:f.y+Math.sin(p)*m}});return{groups:u,links:e.relationships.map(e=>{if(!r.has(e.from)||!r.has(e.to))return;let t=l.get(s(e.from))??0,n=u[t];return n&&(n.relationshipCount+=1),{...e,group:t,source:e.from,target:e.to,value:1}}).filter(e=>e!==void 0),nodes:f}}function oe(e,t,n){let r=new Map;if(!e.length)return r;let i=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/i),o=Math.min(170,Math.max(78,t*.12)),s=Math.min(128,Math.max(76,n*.16)),c=Math.max(1,t-o*2),l=Math.max(1,n-s*2);return e.forEach((e,t)=>{let n=t%i,u=Math.floor(t/i);r.set(e.id,{x:o+c*(n+.5)/i,y:s+l*(u+.5)/a})}),r}function se(e){return e.length<=22?e:`${e.slice(0,12)}...${e.slice(-7)}`}function L(e){return Math.min(F,Math.max(I,se(e).length*P+22))}function R(e){let t=z(e.type);return new Set([e.type,t,`component render`,`reactive.property`,`render/effect`,`watch callback`]).has(e.label)?t:e.label}function z(e){switch(e){case`ref`:return`Anonymous Ref`;case`computed`:return`Anonymous Computed`;case`reactive`:return`Reactive Property`;case`watch`:return`Anonymous Watch`;case`render`:return`Anonymous Render`;case`effect`:return`Anonymous Effect`;default:return`Unknown`}}function B(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n);return Math.abs(t)}var ce=[`ref`,`reactive`,`computed`,`watch`,`effect`,`render`,`unknown`];function V(e){switch(e){case`ref`:return`#21a67a`;case`computed`:return`#3b82d6`;case`reactive`:return`#d79822`;case`render`:return`#f97316`;case`watch`:return`#0f766e`;case`effect`:return`#d84f45`;default:return`#94a3b8`}}function H(e){switch(e){case`ref`:return`Ref`;case`computed`:return`Computed`;case`reactive`:return`Reactive`;case`render`:return`Render Effect`;case`watch`:return`Watch`;case`effect`:return`Effect`;default:return`Unknown`}}function le(e){return e.trim().toLowerCase()}function ue(e,t){return!t||[e.id,e.label,H(e.type),de(e),...Object.values(e.data).map(e=>String(e))].some(e=>e.toLowerCase().includes(t))}function de(e){if(!e)return``;let t=e.data;if(!t)return``;let n=t.value??t.cb??t.instanceName;if(n==null)return``;if(typeof n==`string`)return n;try{return JSON.stringify(n)}catch{return String(n)}}function fe(){return{nodeIds:new Set,orderedNodeIds:[],orderedRelationshipIds:[],relationshipIds:new Set}}function pe(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push(n),t.set(n.from,e)}return t}function me(e,t){let n=new Set(t.map(e=>e.to));return new Set(e.filter(e=>!n.has(e.id)).map(e=>e.id))}function he(e,t){let n=new Set([e]),r=[e];for(let e of r)for(let i of t.get(e)??[])n.has(i.to)||(n.add(i.to),r.push(i.to));return n.delete(e),n}function ge(e,t,n){if(!e||!t)return fe();let r=new Map,i=new Set([e]),a=[e];for(let e of a){if(i.has(t))break;for(let o of n.get(e)??[])if(!i.has(o.to)&&(i.add(o.to),r.set(o.to,o),a.push(o.to),o.to===t))break}let o=[t],s=[];if(i.has(t)){let n=t;for(;n!==e;){let e=r.get(n);s.push(e.id),o.push(e.from),n=e.from}}else o.push(e);return o.reverse(),s.reverse(),{nodeIds:new Set(o),orderedNodeIds:o,relationshipIds:new Set(s),orderedRelationshipIds:s}}var _e={class:`shrink-0 bg-base px-2`},ve={class:`min-w-0 flex items-center gap-2 py-2`},ye={key:0,class:`group relative min-w-0 flex flex-1 items-center justify-between gap-2 overflow-hidden rounded-1 border border-primary-100 px-3 py-0.75 color-base dark:border-gray-700`},be={key:1,class:`min-w-0 flex flex-1 items-center gap-2`},xe={class:`relative min-w-0 flex-1`},Se={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Ce={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},we=[`value`],Te={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Ee=[`onMousedown`],De={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Oe={class:`shrink-0 color-muted text-3`},ke={key:0,class:`px-2 py-2 color-muted text-3 italic`},Ae={class:`relative min-w-0 flex-1`},je={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Me={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ne=[`value`],Pe={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Fe=[`onMousedown`],Ie={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Le={class:`shrink-0 color-muted text-3`},Re={key:0,class:`px-2 py-2 color-muted text-3 italic`},ze=[`aria-pressed`],Be=[`aria-expanded`],Ve={class:`mb-1 flex items-center justify-between gap-2`},He={class:`w-14 shrink-0 text-right color-muted font-state-field text-3`},Ue=[`title`],We=[`checked`,`onChange`],Ge={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ke={class:`w-10 shrink-0 text-right color-muted text-3`},qe=220,Je=d({__name:`ReactivityGraphToolbar`,props:c({graph:{},filteredGraph:{}},{search:{required:!0},searchModifiers:{},activeTypes:{required:!0},activeTypesModifiers:{},pathSelectorOpen:{type:Boolean,required:!0},pathSelectorOpenModifiers:{},pathStartId:{required:!0},pathStartIdModifiers:{},pathEndId:{required:!0},pathEndIdModifiers:{},selectedNodeId:{},selectedNodeIdModifiers:{}}),emits:[`update:search`,`update:activeTypes`,`update:pathSelectorOpen`,`update:pathStartId`,`update:pathEndId`,`update:selectedNodeId`],setup(e){let t=e,a=ee(t,`filteredGraph`),c=l(e,`search`),d=l(e,`activeTypes`),g=l(e,`pathSelectorOpen`),b=l(e,`pathStartId`),S=l(e,`pathEndId`),te=l(e,`selectedNodeId`),T=p(),E=p(``),D=p(``),j=p(!1),ie,M=f(()=>{let e=new Map;for(let t of ce)e.set(t,0);for(let n of t.graph.nodes)e.set(n.type,(e.get(n.type)??0)+1);return e}),N=f(()=>new Map(t.graph.nodes.map(e=>[e.id,e]))),P=f(()=>[...a.value.nodes].sort((e,t)=>tt(e.id).localeCompare(tt(t.id)))),F=f(()=>me(a.value.nodes,a.value.relationships)),I=f(()=>pe(a.value.relationships)),ae=f(()=>et(E.value,S.value,F.value)),oe=f(()=>b.value?he(b.value,I.value):new Set),se=f(()=>et(D.value,b.value,oe.value)),L=f(()=>!!b.value&&!!S.value);function z(e){return e.target instanceof HTMLInputElement?e.target.value:``}function B(e){return d.value.has(e)}function de(e){let t=new Set(d.value);t.has(e)?t.delete(e):t.add(e),d.value=t,W()}function fe(){d.value=new Set(ce),W()}function ge(){d.value=new Set,W()}function Je(){ie&&=(clearTimeout(ie),void 0)}function Ye(){Je(),j.value=!0}function U(e){if(e instanceof FocusEvent){let t=e.currentTarget,n=e.relatedTarget;if(t instanceof Node&&n instanceof Node&&t.contains(n))return}Je(),ie=setTimeout(()=>{j.value=!1,ie=void 0},qe)}function Xe(){c.value=``,g.value=!0,T.value=`start`}function W(){g.value=!1,T.value=void 0,b.value=``,S.value=``,E.value=``,D.value=``}function Ze(e,t){e===`start`?(E.value=t,t&&t===tt(b.value)||(G(),E.value=t)):(D.value=t,t&&t===tt(S.value)||($e(),D.value=t))}function Qe(e,t){e===`start`?(b.value!==t&&$e(),b.value=t,E.value=tt(t),T.value=S.value?void 0:`end`):(S.value=t,D.value=tt(t),T.value=b.value?void 0:`start`),b.value&&S.value&&(te.value=void 0)}function G(){b.value=``,E.value=``,$e(),T.value=`start`}function $e(){S.value=``,D.value=``,T.value=`end`}function et(e,t,n){let r=le(e);return P.value.filter(e=>e.id===t||n&&!n.has(e.id)?!1:ue(e,r)).slice(0,8)}function tt(e){let t=N.value.get(e);return t?`${R(t)} (${H(t.type)})`:``}function nt(e){let t=N.value.get(e);return t?R(t):``}function rt(e){let t=N.value.get(e);return V(t?t.type:`unknown`)}return o(g,e=>{e||W()}),_(Je),(e,o)=>{let l=ne(`tooltip`);return s(),h(`div`,_e,[m(`div`,ve,[g.value?(s(),h(`div`,be,[m(`div`,xe,[b.value?(s(),h(`div`,Se,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(b.value)})},null,4),m(`span`,Ce,n(nt(b.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path start`,onClick:G},[w(k,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear start`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Start`,type:`search`,value:E.value,onFocus:o[2]||=e=>T.value=`start`,onInput:o[3]||=e=>Ze(`start`,z(e)),onKeydown:re(W,[`esc`])},null,40,we)),!b.value&&T.value===`start`?(s(),h(`div`,Te,[(s(!0),h(v,null,i(ae.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:A(t=>Qe(`start`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),m(`span`,De,n(x(R)(e)),1),m(`span`,Oe,n(x(H)(e.type)),1)],40,Ee))),128)),ae.value.length?y(``,!0):(s(),h(`div`,ke,` No matching nodes `))])):y(``,!0)]),w(k,{icon:`i-carbon-arrow-right`,class:`shrink-0 color-muted text-5`}),m(`div`,Ae,[S.value?(s(),h(`div`,je,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(S.value)})},null,4),m(`span`,Me,n(nt(S.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path end`,onClick:$e},[w(k,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear end`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`End`,type:`search`,value:D.value,onFocus:o[4]||=e=>T.value=`end`,onInput:o[5]||=e=>Ze(`end`,z(e)),onKeydown:re(W,[`esc`])},null,40,Ne)),!S.value&&T.value===`end`?(s(),h(`div`,Pe,[(s(!0),h(v,null,i(se.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:A(t=>Qe(`end`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),m(`span`,Ie,n(x(R)(e)),1),m(`span`,Le,n(x(H)(e.type)),1)],40,Fe))),128)),se.value.length?y(``,!0):(s(),h(`div`,Re,n(b.value?`No matching nodes`:`Select a start node to get end nodes`),1))])):y(``,!0)])])):(s(),h(`label`,ye,[w(k,{icon:`i-carbon-search`,class:`shrink-0 color-muted text-4`}),u(m(`input`,{"onUpdate:modelValue":o[0]||=e=>c.value=e,class:`min-w-0 w-full border-0 bg-transparent p-0 outline-none text-3.5 color-inherit placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Search graph...`,type:`search`},null,512),[[O,c.value]]),c.value?u((s(),h(`button`,{key:0,class:`h-6 w-6 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Clear search`,onClick:o[1]||=e=>c.value=``},[w(k,{icon:`i-carbon-close`,class:`text-3.5`})])),[[l,`Clear search`,void 0,{top:!0}]]):y(``,!0)])),g.value?u((s(),h(`button`,{key:3,class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Close path selector`,onClick:W},[w(k,{icon:`i-carbon-close`,class:`text-5`})])),[[l,`Close path selector`,void 0,{top:!0}]]):u((s(),h(`button`,{key:2,class:C([`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,g.value||L.value?`bg-active color-active`:``]),type:`button`,"aria-label":`Graph path selector`,"aria-pressed":g.value||L.value,onClick:o[6]||=e=>g.value?W():Xe()},[w(k,{icon:`i-ri-route-line`,class:`text-5.5`})],10,ze)),[[l,g.value?`Clear path selector`:`Graph path selector`,void 0,{top:!0}]]),m(`div`,{class:`relative shrink-0`,onFocusin:Ye,onFocusout:U,onMouseenter:Ye,onMouseleave:U},[u((s(),h(`button`,{class:C([`h-7 w-7 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,j.value?`bg-active color-base`:``]),type:`button`,"aria-label":`Filter reactivity types`,"aria-haspopup":`menu`,"aria-expanded":j.value},[w(k,{icon:`i-carbon-filter`,class:`text-4`})],10,Be)),[[l,`Filter reactivity types`,void 0,{top:!0}]]),m(`div`,{class:C([`absolute right-0 top-[calc(100%+4px)] z-50 w-62 rounded-1 border border-base bg-base p-2 shadow transition-opacity`,j.value?`pointer-events-auto op-100`:`pointer-events-none op-0`]),role:`menu`},[m(`div`,Ve,[o[7]||=m(`span`,{class:`color-muted text-3`},`Filter type`,-1),m(`span`,He,n(a.value.nodes.length)+` / `+n(t.graph.nodes.length),1)]),(s(!0),h(v,null,i(x(ce),e=>(s(),h(`label`,{key:e,class:C([`h-7 rounded-1 px-2 color-base flex items-center gap-1.5 select-none hover:bg-active`,B(e)?``:`op45 grayscale`]),title:x(H)(e)},[m(`input`,{class:`h-3.5 w-3.5 accent-emerald-600`,type:`checkbox`,checked:B(e),onChange:t=>de(e)},null,40,We),m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e)})},null,4),m(`span`,Ge,n(x(H)(e)),1),m(`span`,Ke,n(M.value.get(e)??0),1)],10,Ue))),128)),m(`div`,{class:`mt-1 flex items-center gap-1 border-t border-base pt-1`},[m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:fe},` Select all `),m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:ge},` Clear `)])],2)],32)])])}}});function Ye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return U(this.cover(t,n),t,n,e)}function U(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Xe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)U(this,o[n],s[n],e[n]);return this}function W(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Ze(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function G(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function $e(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new G(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new G(p[3],g,_,c,l),new G(p[2],o,_,g,l),new G(p[1],g,s,c,_),new G(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function et(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function nt(){return this._root}function rt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function it(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new G(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new G(i,l,u,s,c)),(i=r[2])&&t.push(new G(i,a,u,l,c)),(i=r[1])&&t.push(new G(i,l,o,s,u)),(i=r[0])&&t.push(new G(i,a,o,l,u))}return this}function at(e){var t=[],n=[],r;for(this._root&&t.push(new G(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new G(a,o,s,u,d)),(a=i[1])&&t.push(new G(a,u,s,c,d)),(a=i[2])&&t.push(new G(a,o,d,u,l)),(a=i[3])&&t.push(new G(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ot(e){return e[0]}function st(e){return arguments.length?(this._x=e,this):this._x}function ct(e){return e[1]}function lt(e){return arguments.length?(this._y=e,this):this._y}function ut(e,t,n){var r=new dt(t??ot,n??ct,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dt(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ft(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var K=ut.prototype=dt.prototype;K.copy=function(){var e=new dt(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ft(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ft(r));return e},K.add=Ye,K.addAll=Xe,K.cover=W,K.data=Ze,K.extent=Qe,K.find=$e,K.remove=et,K.removeAll=tt,K.root=nt,K.size=rt,K.visit=it,K.visitAfter=at,K.x=st,K.y=lt;var pt={value:()=>{}};function mt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ht(n)}function ht(e){this._=e}function gt(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ht.prototype=mt.prototype={constructor:ht,on:function(e,t){var n=this._,r=gt(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=_t(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=vt(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vt(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ht(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function _t(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function vt(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=pt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var yt=0,bt=0,xt=0,St=1e3,Ct,wt,Tt=0,Et=0,Dt=0,Ot=typeof performance==`object`&&performance.now?performance:Date,kt=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function At(){return Et||=(kt(jt),Ot.now()+Dt)}function jt(){Et=0}function Mt(){this._call=this._time=this._next=null}Mt.prototype=Nt.prototype={constructor:Mt,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?At():+n)+(t==null?0:+t),!this._next&&wt!==this&&(wt?wt._next=this:Ct=this,wt=this),this._call=e,this._time=n,Rt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rt())}};function Nt(e,t,n){var r=new Mt;return r.restart(e,t,n),r}function Pt(){At(),++yt;for(var e=Ct,t;e;)(t=Et-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yt}function Ft(){Et=(Tt=Ot.now())+Dt,yt=bt=0;try{Pt()}finally{yt=0,Lt(),Et=0}}function It(){var e=Ot.now(),t=e-Tt;t>St&&(Dt-=t,Tt=e)}function Lt(){for(var e,t=Ct,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ct=n);wt=e,Rt(r)}function Rt(e){yt||(bt&&=clearTimeout(bt),e-Et>24?(e<1/0&&(bt=setTimeout(Ft,e-Ot.now()-Dt)),xt&&=clearInterval(xt)):(xt||=(Tt=Ot.now(),setInterval(It,St)),yt=1,kt(Ft)))}function zt(e,t,n){var r=new Mt;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}function q(e){return function(){return e}}function Bt(e){return(e()-.5)*1e-6}function Vt(e){return e.x+e.vx}function Ht(e){return e.y+e.vy}function Ut(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=q(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=ut(t,Vt,Ht).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=Bt(r),_+=h*h),g===0&&(g=Bt(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),c(),o):e},o}function Wt(e){return e.index}function Gt(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Kt(e){var t=Wt,n=d,r,i=q(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||Bt(l),m=f.y+f.vy-d.y-d.vy||Bt(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=Gt(u,d.source)),typeof d.target!=`object`&&(d.target=Gt(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:q(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),h(),f):i},f}var qt=1664525,Jt=1013904223,Yt=4294967296;function Xt(){let e=1;return()=>(e=(qt*e+Jt)%Yt)/Yt}function Zt(e){return e.x}function Qt(e){return e.y}var $t=10,en=Math.PI*(3-Math.sqrt(5));function tn(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=Nt(d),l=mt(`tick`,`end`),u=Xt();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=$t*Math.sqrt(.5+t),a=t*en;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function nn(){var e,t,n,r,i=q(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=ut(e,Zt,Qt).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=Bt(n),m+=d*d),f===0&&(f=Bt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=Bt(n),m+=d*d),f===0&&(f=Bt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function rn(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}function an(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}var on=`http://www.w3.org/1999/xhtml`,sn={svg:`http://www.w3.org/2000/svg`,xhtml:on,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function cn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),sn.hasOwnProperty(t)?{space:sn[t],local:e}:e}function ln(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===on&&t.documentElement.namespaceURI===on?t.createElement(e):t.createElementNS(n,e)}}function un(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dn(e){var t=cn(e);return(t.local?un:ln)(t)}function fn(){}function pn(e){return e==null?fn:function(){return this.querySelector(e)}}function mn(e){typeof e!=`function`&&(e=pn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new J(r,this._parents)}function hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gn(){return[]}function _n(e){return e==null?gn:function(){return this.querySelectorAll(e)}}function vn(e){return function(){return hn(e.apply(this,arguments))}}function yn(e){e=typeof e==`function`?vn(e):_n(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new J(r,i)}function bn(e){return function(){return this.matches(e)}}function xn(e){return function(t){return t.matches(e)}}var Sn=Array.prototype.find;function Cn(e){return function(){return Sn.call(this.children,e)}}function wn(){return this.firstElementChild}function Tn(e){return this.select(e==null?wn:Cn(typeof e==`function`?e:xn(e)))}var En=Array.prototype.filter;function Dn(){return Array.from(this.children)}function On(e){return function(){return En.call(this.children,e)}}function kn(e){return this.selectAll(e==null?Dn:On(typeof e==`function`?e:xn(e)))}function An(e){typeof e!=`function`&&(e=bn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents)}function jn(e){return Array(e.length)}function Mn(){return new J(this._enter||this._groups.map(jn),this._parents)}function Nn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nn.prototype={constructor:Nn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Pn(e){return function(){return e}}function Fn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Nn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function In(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Nn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Ln(e){return e.__data__}function Rn(e,t){if(!arguments.length)return Array.from(this,Ln);var n=t?In:Fn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Pn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=zn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new J(o,r),o._enter=s,o._exit=c,o}function zn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Bn(){return new J(this._exit||this._groups.map(jn),this._parents)}function Vn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Hn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new J(s,this._parents)}function Un(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Wn(e){e||=Gn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new J(i,this._parents).order()}function Gn(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Kn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qn(){return Array.from(this)}function Jn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Yn(){let e=0;for(let t of this)++e;return e}function Xn(){return!this.node()}function Zn(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Qn(e){return function(){this.removeAttribute(e)}}function $n(e){return function(){this.removeAttributeNS(e.space,e.local)}}function er(e,t){return function(){this.setAttribute(e,t)}}function tr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function nr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function rr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ir(e,t){var n=cn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?$n:Qn:typeof t==`function`?n.local?rr:nr:n.local?tr:er)(n,t))}function ar(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function or(e){return function(){this.style.removeProperty(e)}}function sr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lr(e,t,n){return arguments.length>1?this.each((t==null?or:typeof t==`function`?cr:sr)(e,t,n??``)):ur(this.node(),e)}function ur(e,t){return e.style.getPropertyValue(t)||ar(e).getComputedStyle(e,null).getPropertyValue(t)}function dr(e){return function(){delete this[e]}}function fr(e,t){return function(){this[e]=t}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mr(e,t){return arguments.length>1?this.each((t==null?dr:typeof t==`function`?pr:fr)(e,t)):this.node()[e]}function hr(e){return e.trim().split(/^|\s+/)}function gr(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=hr(e.getAttribute(`class`)||``)}_r.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function vr(e,t){for(var n=gr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function yr(e,t){for(var n=gr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function br(e){return function(){vr(this,e)}}function xr(e){return function(){yr(this,e)}}function Sr(e,t){return function(){(t.apply(this,arguments)?vr:yr)(this,e)}}function Cr(e,t){var n=hr(e+``);if(arguments.length<2){for(var r=gr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Sr:t?br:xr)(n,t))}function wr(){this.textContent=``}function Tr(e){return function(){this.textContent=e}}function Er(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Dr(e){return arguments.length?this.each(e==null?wr:(typeof e==`function`?Er:Tr)(e)):this.node().textContent}function Or(){this.innerHTML=``}function kr(e){return function(){this.innerHTML=e}}function Ar(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function jr(e){return arguments.length?this.each(e==null?Or:(typeof e==`function`?Ar:kr)(e)):this.node().innerHTML}function Mr(){this.nextSibling&&this.parentNode.appendChild(this)}function Nr(){return this.each(Mr)}function Pr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fr(){return this.each(Pr)}function Ir(e){var t=typeof e==`function`?e:dn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lr(){return null}function Rr(e,t){var n=typeof e==`function`?e:dn(e),r=t==null?Lr:typeof t==`function`?t:pn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zr(){var e=this.parentNode;e&&e.removeChild(this)}function Br(){return this.each(zr)}function Vr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ur(e){return this.select(e?Hr:Vr)}function Wr(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Gr(e){return function(t){e.call(this,t,this.__data__)}}function Kr(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function qr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Jr(e,t,n){return function(){var r=this.__on,i,a=Gr(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Yr(e,t,n){var r=Kr(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?Jr:qr,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Xr(e,t,n){var r=ar(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Zr(e,t){return function(){return Xr(this,e,t)}}function Qr(e,t){return function(){return Xr(this,e,t.apply(this,arguments))}}function $r(e,t){return this.each((typeof t==`function`?Qr:Zr)(e,t))}function*ei(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var ti=[null];function J(e,t){this._groups=e,this._parents=t}function ni(){return new J([[document.documentElement]],ti)}function ri(){return this}J.prototype=ni.prototype={constructor:J,select:mn,selectAll:yn,selectChild:Tn,selectChildren:kn,filter:An,data:Rn,enter:Mn,exit:Bn,join:Vn,merge:Hn,selection:ri,order:Un,sort:Wn,call:Kn,nodes:qn,node:Jn,size:Yn,empty:Xn,each:Zn,attr:ir,style:lr,property:mr,classed:Cr,text:Dr,html:jr,raise:Nr,lower:Fr,append:Ir,insert:Rr,remove:Br,clone:Ur,datum:Wr,on:Yr,dispatch:$r,[Symbol.iterator]:ei};function Y(e){return typeof e==`string`?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],ti)}var ii=0;function ai(){return new oi}function oi(){this._=`@`+(++ii).toString(36)}oi.prototype=ai.prototype={constructor:oi,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};function si(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ci(e,t){if(e=si(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var li={capture:!0,passive:!1};function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function di(e){var t=e.document.documentElement,n=Y(e).on(`dragstart.drag`,ui,li);`onselectstart`in t?n.on(`selectstart.drag`,ui,li):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function fi(e,t){var n=e.document.documentElement,r=Y(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,ui,li),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function pi(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function hi(){}var gi=.7,_i=1/gi,vi=`\\s*([+-]?\\d+)\\s*`,yi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,X=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,bi=/^#([0-9a-f]{3,8})$/,xi=RegExp(`^rgb\\(${vi},${vi},${vi}\\)$`),Si=RegExp(`^rgb\\(${X},${X},${X}\\)$`),Ci=RegExp(`^rgba\\(${vi},${vi},${vi},${yi}\\)$`),wi=RegExp(`^rgba\\(${X},${X},${X},${yi}\\)$`),Ti=RegExp(`^hsl\\(${yi},${X},${X}\\)$`),Ei=RegExp(`^hsla\\(${yi},${X},${X},${yi}\\)$`),Di={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pi(hi,Mi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Oi,formatHex:Oi,formatHex8:ki,formatHsl:Ai,formatRgb:ji,toString:ji});function Oi(){return this.rgb().formatHex()}function ki(){return this.rgb().formatHex8()}function Ai(){return Wi(this).formatHsl()}function ji(){return this.rgb().formatRgb()}function Mi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=bi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ni(t):n===3?new Z(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xi.exec(e))?new Z(t[1],t[2],t[3],1):(t=Si.exec(e))?new Z(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ci.exec(e))?Pi(t[1],t[2],t[3],t[4]):(t=wi.exec(e))?Pi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ti.exec(e))?Ui(t[1],t[2]/100,t[3]/100,1):(t=Ei.exec(e))?Ui(t[1],t[2]/100,t[3]/100,t[4]):Di.hasOwnProperty(e)?Ni(Di[e]):e===`transparent`?new Z(NaN,NaN,NaN,0):null}function Ni(e){return new Z(e>>16&255,e>>8&255,e&255,1)}function Pi(e,t,n,r){return r<=0&&(e=t=n=NaN),new Z(e,t,n,r)}function Fi(e){return e instanceof hi||(e=Mi(e)),e?(e=e.rgb(),new Z(e.r,e.g,e.b,e.opacity)):new Z}function Ii(e,t,n,r){return arguments.length===1?Fi(e):new Z(e,t,n,r??1)}function Z(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}pi(Z,Ii,mi(hi,{brighter(e){return e=e==null?_i:_i**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gi:gi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Z(Vi(this.r),Vi(this.g),Vi(this.b),Bi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Li,formatHex:Li,formatHex8:Ri,formatRgb:zi,toString:zi}));function Li(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}`}function Ri(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}${Hi((isNaN(this.opacity)?1:this.opacity)*255)}`}function zi(){let e=Bi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Vi(this.r)}, ${Vi(this.g)}, ${Vi(this.b)}${e===1?`)`:`, ${e})`}`}function Bi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hi(e){return e=Vi(e),(e<16?`0`:``)+e.toString(16)}function Ui(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Wi(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof hi||(e=Mi(e)),!e)return new Q;if(e instanceof Q)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Q(o,s,c,e.opacity)}function Gi(e,t,n,r){return arguments.length===1?Wi(e):new Q(e,t,n,r??1)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}pi(Q,Gi,mi(hi,{brighter(e){return e=e==null?_i:_i**+e,new Q(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gi:gi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Z(Ji(e>=240?e-240:e+120,i,r),Ji(e,i,r),Ji(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Q(Ki(this.h),qi(this.s),qi(this.l),Bi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Bi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ki(this.h)}, ${qi(this.s)*100}%, ${qi(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ki(e){return e=(e||0)%360,e<0?e+360:e}function qi(e){return Math.max(0,Math.min(1,e||0))}function Ji(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Yi=e=>()=>e;function Xi(e,t){return function(n){return e+n*t}}function Zi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Qi(e){return(e=+e)==1?$i:function(t,n){return n-t?Zi(t,n,e):Yi(isNaN(t)?n:t)}}function $i(e,t){var n=t-e;return n?Xi(e,n):Yi(isNaN(e)?t:e)}var ea=(function e(t){var n=Qi(t);function r(e,t){var r=n((e=Ii(e)).r,(t=Ii(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$i(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function ta(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var na=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(na.source,`g`);function ia(e){return function(){return e}}function aa(e){return function(t){return e(t)+``}}function oa(e,t){var n=na.lastIndex=ra.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=na.exec(e))&&(i=ra.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:ta(r,i)})),n=ra.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?aa(c[0].x):ia(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var sa=180/Math.PI,ca={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function la(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*sa,skewX:Math.atan(c)*sa,scaleX:o,scaleY:s}}var ua;function da(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ca:la(t.a,t.b,t.c,t.d,t.e,t.f)}function fa(e){return e==null||(ua||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ua.setAttribute(`transform`,e),!(e=ua.transform.baseVal.consolidate()))?ca:(e=e.matrix,la(e.a,e.b,e.c,e.d,e.e,e.f))}function pa(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:ta(e,i)},{i:c-2,x:ta(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:ta(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:ta(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:ta(e,n)},{i:s-2,x:ta(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ma=pa(da,`px, `,`px)`,`deg)`),ha=pa(fa,`, `,`)`,`)`),ga=1e-12;function _a(e){return((e=Math.exp(e))+1/e)/2}function va(e){return((e=Math.exp(e))-1/e)/2}function ya(e){return((e=Math.exp(2*e))-1)/(e+1)}var ba=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<ga)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=_a(y),c=s/(n*g)*(i*ya(t*r+y)-va(y));return[a+c*d,o+c*f,s*i/_a(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),xa=mt(`start`,`end`,`cancel`,`interrupt`),Sa=[];function Ca(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ea(e,n,{name:t,index:r,group:i,on:xa,tween:Sa,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function wa(e,t){var n=$(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Ta(e,t){var n=$(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function $(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ea(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Nt(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return zt(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(zt(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Da(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function Oa(e){return this.each(function(){Da(this,e)})}function ka(e,t){var n,r;return function(){var i=Ta(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Aa(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Ta(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function ja(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=$(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ka:Aa)(n,e,t))}function Ma(e,t,n){var r=e._id;return e.each(function(){var e=Ta(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return $(e,r).value[t]}}function Na(e,t){var n;return(typeof t==`number`?ta:t instanceof Mi?ea:(n=Mi(t))?(t=n,ea):oa)(e,t)}function Pa(e){return function(){this.removeAttribute(e)}}function Fa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ia(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function La(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Ra(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function za(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ba(e,t){var n=cn(e),r=n===`transform`?ha:Na;return this.attrTween(e,typeof t==`function`?(n.local?za:Ra)(n,r,Ma(this,`attr.`+e,t)):t==null?(n.local?Fa:Pa)(n):(n.local?La:Ia)(n,r,t))}function Va(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ha(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ua(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ha(e,i)),n}return i._value=t,i}function Wa(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Va(e,i)),n}return i._value=t,i}function Ga(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=cn(e);return this.tween(n,(r.local?Ua:Wa)(r,t))}function Ka(e,t){return function(){wa(this,e).delay=+t.apply(this,arguments)}}function qa(e,t){return t=+t,function(){wa(this,e).delay=t}}function Ja(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ka:qa)(t,e)):$(this.node(),t).delay}function Ya(e,t){return function(){Ta(this,e).duration=+t.apply(this,arguments)}}function Xa(e,t){return t=+t,function(){Ta(this,e).duration=t}}function Za(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ya:Xa)(t,e)):$(this.node(),t).duration}function Qa(e,t){if(typeof t!=`function`)throw Error();return function(){Ta(this,e).ease=t}}function $a(e){var t=this._id;return arguments.length?this.each(Qa(t,e)):$(this.node(),t).ease}function eo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Ta(this,e).ease=n}}function to(e){if(typeof e!=`function`)throw Error();return this.each(eo(this._id,e))}function no(e){typeof e!=`function`&&(e=bn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Mo(r,this._parents,this._name,this._id)}function ro(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Mo(o,this._parents,this._name,this._id)}function io(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ao(e,t,n){var r,i,a=io(t)?wa:Ta;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function oo(e,t){var n=this._id;return arguments.length<2?$(this.node(),n).on.on(e):this.each(ao(n,e,t))}function so(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function co(){return this.on(`end.remove`,so(this._id))}function lo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=pn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ca(l[f],t,n,f,l,$(u,n)));return new Mo(a,this._parents,t,n)}function uo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=_n(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ca(p,t,n,h,f,m);a.push(f),o.push(u)}return new Mo(a,o,t,n)}var fo=ni.prototype.constructor;function po(){return new fo(this._groups,this._parents)}function mo(e,t){var n,r,i;return function(){var a=ur(this,e),o=(this.style.removeProperty(e),ur(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ho(e){return function(){this.style.removeProperty(e)}}function go(e,t,n){var r,i=n+``,a;return function(){var o=ur(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function _o(e,t,n){var r,i,a;return function(){var o=ur(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),ur(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function vo(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Ta(this,e),l=c.on,u=c.value[a]==null?s||=ho(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function yo(e,t,n){var r=(e+=``)==`transform`?ma:Na;return t==null?this.styleTween(e,mo(e,r)).on(`end.style.`+e,ho(e)):typeof t==`function`?this.styleTween(e,_o(e,r,Ma(this,`style.`+e,t))).each(vo(this._id,e)):this.styleTween(e,go(e,r,t),n).on(`end.style.`+e,null)}function bo(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function xo(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&bo(e,a,n)),r}return a._value=t,a}function So(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,xo(e,t,n??``))}function Co(e){return function(){this.textContent=e}}function wo(e){return function(){var t=e(this);this.textContent=t??``}}function To(e){return this.tween(`text`,typeof e==`function`?wo(Ma(this,`text`,e)):Co(e==null?``:e+``))}function Eo(e){return function(t){this.textContent=e.call(this,t)}}function Do(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Eo(r)),t}return r._value=e,r}function Oo(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Do(e))}function ko(){for(var e=this._name,t=this._id,n=No(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=$(c,t);Ca(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mo(r,this._parents,e,n)}function Ao(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Ta(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var jo=0;function Mo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function No(){return++jo}var Po=ni.prototype;Mo.prototype={constructor:Mo,select:lo,selectAll:uo,selectChild:Po.selectChild,selectChildren:Po.selectChildren,filter:no,merge:ro,selection:po,transition:ko,call:Po.call,nodes:Po.nodes,node:Po.node,size:Po.size,empty:Po.empty,each:Po.each,on:oo,attr:Ba,attrTween:Ga,style:yo,styleTween:So,text:To,textTween:Oo,remove:co,tween:ja,delay:Ja,duration:Za,ease:$a,easeVarying:to,end:Ao,[Symbol.iterator]:Po[Symbol.iterator]};function Fo(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Io={time:null,delay:0,duration:250,ease:Fo};function Lo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ro(e){var t,n;e instanceof Mo?(t=e._id,e=e._name):(t=No(),(n=Io).time=At(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ca(c,e,t,l,o,n||Lo(c,t));return new Mo(r,this._parents,e,t)}ni.prototype.interrupt=Oa,ni.prototype.transition=Ro;var zo=e=>()=>e;function Bo(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Vo(e,t,n){this.k=e,this.x=t,this.y=n}Vo.prototype={constructor:Vo,scale:function(e){return e===1?this:new Vo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Ho=new Vo(1,0,0);Uo.prototype=Vo.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ho;return e.__zoom}function Wo(e){e.stopImmediatePropagation()}function Go(e){e.preventDefault(),e.stopImmediatePropagation()}function Ko(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function qo(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Jo(){return this.__zoom||Ho}function Yo(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Xo(){return navigator.maxTouchPoints||`ontouchstart`in this}function Zo(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Qo(){var e=Ko,t=qo,n=Zo,r=Yo,i=Xo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ba,l=mt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Jo).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,w).filter(i).on(`touchstart.zoom`,ne).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,E).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Jo),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ho.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Vo(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Vo(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Vo(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Y(this.that).datum();l.call(e,this.that,new Bo(e,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ci(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Da(this),s.start();Go(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Y(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ci(t,i),l=t.clientX,u=t.clientY;di(t.view),Wo(t),a.mouse=[c,this.__zoom.invert(c)],Da(this),a.start();function d(e){if(Go(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ci(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),fi(e.view,a.moved),Go(e),a.event(e).end()}}function w(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ci(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Go(r),s>0?Y(this).transition().duration(s).call(x,d,c,r):Y(this).call(_.transform,d,c,r)}}function ne(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Wo(t),s=0;s<i;++s)c=r[s],l=ci(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Da(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Go(e),s=0;s<a;++s)c=i[s],l=ci(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function E(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Wo(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=ci(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Y(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:zo(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:zo(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:zo(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:zo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var $o=[`height`,`viewBox`,`width`],es=[`id`],ts=[`fill`],ns=[`transform`],rs=[`cx`,`cy`,`fill`,`fill-opacity`,`r`,`stroke`,`stroke-opacity`],is=[`stroke`,`stroke-opacity`,`stroke-width`,`marker-end`,`x1`,`x2`,`y1`,`y2`],as=[`stroke`,`marker-end`,`x1`,`x2`,`y1`,`y2`],os=[`opacity`,`aria-label`,`transform`,`onClick`,`onKeydown`,`onPointercancel`,`onPointerdown`,`onPointermove`,`onPointerup`],ss=[`fill`,`r`,`stroke`,`stroke-opacity`,`stroke-width`],cs={key:0,class:`pointer-events-none`},ls=[`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`width`,`x`],us=[`fill`,`text-anchor`,`x`],ds=[`fill`,`text-anchor`,`x`],fs={class:`absolute bottom-3 left-3 z-30 grid grid-cols-2 gap-x-3 gap-y-1.5 border border-base bg-glass px-3 py-2 shadow`},ps={class:`truncate`},ms={class:`absolute bottom-3 right-3 z-30 flex flex-col items-end gap-2`},hs={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},gs=[`disabled`],_s={class:`font-state-field h-8 w-8 rounded-full bg-active color-muted flex items-center justify-center text-3.5`},vs=[`disabled`],ys={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},bs=680,xs=460,Ss=34,Cs=1,ws=6,Ts=d({__name:`ReactivityGraphCanvas`,props:c({graph:{},path:{},pathSelectorOpen:{type:Boolean}},{selectedNodeId:{},selectedNodeIdModifiers:{},dependencyDepth:{required:!0},dependencyDepthModifiers:{}}),emits:c([`select`],[`update:selectedNodeId`,`update:dependencyDepth`]),setup(a,{emit:c}){let d=a,g=l(a,`selectedNodeId`),S=l(a,`dependencyDepth`),T=c,E=ee(d,`graph`),D=ee(d,`pathSelectorOpen`),O=f(()=>!!d.path),j=f(()=>d.path??fe());function ie(e){T(`select`,e)}let M=[`#13966f`,`#3b82d6`,`#c58119`,`#d84f45`,`#0891b2`,`#db2777`,`#7c3aed`,`#64748b`],N=p(),P=p(),F=p(960),I=p(640),L=p({x:0,y:0,k:1}),z=p(0),B=b([]),le=b([]),ue=f(()=>new Map(B.value.map(e=>[e.id,e]))),de=b([]),pe,me,he,ge,_e=f(()=>[E.value.nodes.map(e=>`${e.id}:${e.type}:${e.label}`).join(`|`),E.value.relationships.map(e=>`${e.id}:${e.from}:${e.to}`).join(`|`)].join(`::`)),ve=f(()=>({links:le.value,nodes:B.value,version:z.value})),ye=f(()=>{if(!O.value)return[];let e=j.value.relationshipIds;return ve.value.links.filter(t=>e.has(t.id))}),be=f(()=>{let e=oe(de.value,F.value,I.value);return de.value.map(t=>{let n=e.get(t.id)??{x:F.value/2,y:I.value/2};return{...t,color:it(t.id),radius:Math.max(86,Math.min(210,56+Math.sqrt(t.nodeCount)*34)),x:n.x,y:n.y}})}),xe=f(()=>`translate(${L.value.x} ${L.value.y}) scale(${L.value.k})`),Se=f(()=>`${Math.round(L.value.k*100)}%`),Ce=f(()=>B.value.find(e=>e.id===g.value)),we=f(()=>Ce.value?de.value.find(e=>e.id===Ce.value?.group):void 0),Te=f(()=>{if(!g.value)return Oe();let e=ke(g.value,`dependencies`,S.value),t=ke(g.value,`subscribers`,S.value),n=new Set([g.value,...e.nodeIds,...t.nodeIds]);return{dependencyNodeIds:e.nodeIds,nodeIds:n,relationshipIds:new Set([...e.relationshipIds,...t.relationshipIds]),subscriberNodeIds:t.nodeIds}}),Ee=f(()=>O.value?j.value.relationshipIds:Te.value.relationshipIds),De=f(()=>O.value?j.value.nodeIds:Te.value.nodeIds);function Oe(){return{dependencyNodeIds:new Set,nodeIds:new Set,relationshipIds:new Set,subscriberNodeIds:new Set}}function ke(e,t,n){let r=new Set,i=new Set,a=new Set([e]),o=new Set([e]);for(let e=0;e<n&&o.size;e+=1){let e=new Set;for(let n of le.value){let s=t===`dependencies`?n.from:n.to,c=t===`dependencies`?n.to:n.from;o.has(c)&&(i.add(n.id),r.add(s),a.has(s)||(a.add(s),e.add(s)))}o=e}return{nodeIds:r,relationshipIds:i}}function Ae(e){S.value=Math.min(ws,Math.max(Cs,e))}function je(e){Ae(S.value+e)}function Me(){me?.stop();let e=ae(E.value,F.value,I.value);if(B.value=e.nodes,le.value=e.links,de.value=e.groups,z.value+=1,g.value&&!e.nodes.some(e=>e.id===g.value)&&(g.value=void 0),g.value||D.value||O.value||(g.value=nt(e.nodes)?.id),!e.nodes.length){me=void 0;return}let t=oe(e.groups,F.value,I.value);me=tn(e.nodes).force(`link`,Kt(e.links).id(e=>e.id).distance(e=>e.group===we.value?.id?92:112).strength(.58)).force(`charge`,nn().strength(e=>-260-e.radius*14)).force(`collide`,Ut().radius(e=>e.radius+Qe(e))).force(`x`,rn(e=>t.get(e.group)?.x??F.value/2).strength(.085)).force(`y`,an(e=>t.get(e.group)?.y??I.value/2).strength(.085)).alpha(.95).alphaDecay(.022).on(`tick`,()=>{z.value+=1})}function Ne(){me&&me.force(`collide`,Ut().radius(e=>e.radius+Qe(e))).alpha(.32).restart()}function Pe(){P.value&&(he=Qo().scaleExtent([.32,2.6]).filter(e=>{let t=e.target;return e.type===`mousedown`&&t?.closest(`[data-graph-node]`)?!1:(!e.ctrlKey||e.type===`wheel`)&&!e.button}).on(`zoom`,e=>{L.value={k:e.transform.k,x:e.transform.x,y:e.transform.y}}),Y(P.value).call(he),t(Fe))}function Fe(){if(!P.value||!he)return;let e=Le();if(!e){Y(P.value).call(he.transform,Ho);return}let t=Math.max(1,e.maxX-e.minX),n=Math.max(1,e.maxY-e.minY),r=Math.min(1.45,Math.max(.42,Math.min((F.value-96)/t,(I.value-96)/n))),i=(e.minX+e.maxX)/2,a=(e.minY+e.maxY)/2,o=Ho.translate(F.value/2,I.value/2).scale(r).translate(-i,-a);Y(P.value).call(he.transform,o)}function Ie(e){P.value&&he&&Y(P.value).call(he.scaleBy,e)}function Le(){let e=B.value;if(!e.length)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=a.x??F.value/2,o=a.y??I.value/2;t=Math.min(t,e-a.radius-72),n=Math.min(n,o-a.radius-32),r=Math.max(r,e+a.radius+142),i=Math.max(i,o+a.radius+32)}return{minX:t,minY:n,maxX:r,maxY:i}}function Re(e,t){e.stopPropagation(),ie(t.id),ge=t.id,t.fx=t.x,t.fy=t.y,me?.alphaTarget(.28).restart(),e.currentTarget.setPointerCapture(e.pointerId)}function ze(e,t){if(ge!==t.id)return;let n=Ve(e);t.fx=n.x,t.fy=n.y,z.value+=1}function Be(e,t){ge===t.id&&(ge=void 0,t.fx=null,t.fy=null,me?.alphaTarget(0),e.currentTarget.releasePointerCapture(e.pointerId))}function Ve(e){if(!P.value)return{x:e.offsetX,y:e.offsetY};let t=P.value.createSVGPoint();t.x=e.clientX,t.y=e.clientY;let n=P.value.getScreenCTM(),r=n?t.matrixTransform(n.inverse()):t;return{x:(r.x-L.value.x)/L.value.k,y:(r.y-L.value.y)/L.value.k}}function He(e){return We(e.source)}function Ue(e){return We(e.target)}function We(e){if(typeof e==`object`)return e;if(e!=null)return ue.value.get(String(e))}function Ge(e){return Ye(e,`source`).x}function Ke(e){return Ye(e,`source`).y}function qe(e){return Ye(e,`target`).x}function Je(e){return Ye(e,`target`).y}function Ye(e,t){let n=He(e),r=Ue(e);if(!n||!r)return{x:F.value/2,y:I.value/2};let i=n.x??F.value/2,a=n.y??I.value/2,o=r.x??F.value/2,s=r.y??I.value/2,c=o-i,l=s-a,u=Math.hypot(c,l)||1,d=c/u,f=l/u;if(t===`source`){let e=n.radius+2;return{x:i+d*e,y:a+f*e}}let p=r.radius+6;return{x:o-d*p,y:s-f*p}}function U(e){return O.value?Ee.value.has(e.id):!g.value||Ee.value.has(e.id)}function Xe(e){return O.value?De.value.has(e.id):!g.value||De.value.has(e.id)}function W(e){return O.value&&De.value.has(e.id)}function Ze(e){return O.value?De.value.has(e.id):g.value?e.id===g.value||De.value.has(e.id):rt(e)>=4}function Qe(e){return Ze(e)?44+e.labelWidth*.16:20}function G(e){let t=F.value/2;return(e.x??t)>t?`left`:`right`}function $e(e){let t=e.radius+8;return G(e)===`left`?-e.labelWidth-t:t}function et(e){return G(e)===`left`?$e(e)+e.labelWidth-10:$e(e)+10}function tt(e){return G(e)===`left`?`end`:`start`}function nt(e){return[...e].sort((e,t)=>rt(t)-rt(e)).at(0)}function rt(e){let t=Math.min(e.incoming,e.outgoing)*2,n=e.type===`computed`?2:+(e.type===`watch`||e.type===`effect`);return e.incoming+e.outgoing+t+n}function it(e){return M[e%M.length]}function at(e){return O.value||g.value?U(e)?it(e.group):`#888888`:it(e.group)}function ot(e){return O.value?U(e)?.9:.08:g.value?U(e)?.72:.12:.42}function st(e){return O.value?U(e)?2.8:1:U(e)?1.8:1.1}function ct(e){return`url(#${(g.value||O.value)&&!U(e)?`reactivity-arrow-muted`:`reactivity-arrow-${e.group%M.length}`})`}function lt(e){return O.value?Xe(e)?1:.18:g.value?Xe(e)?1:.28:1}function ut(e){return e.id===g.value||W(e)?`#111827`:`#ffffff`}function dt(e){return e.id===g.value||W(e)?.72:.92}function ft(e){return e.id===g.value||W(e)?3:1.5}return e(()=>{N.value&&(pe=new ResizeObserver(([e])=>{F.value=Math.max(bs,e.contentRect.width),I.value=Math.max(xs,e.contentRect.height)}),pe.observe(N.value)),Pe()}),o([_e,F,I],()=>{Me(),t(Fe)},{immediate:!0}),o([g,S,()=>d.path],Ne),_(()=>{pe?.disconnect(),me?.stop()}),(e,t)=>{let a=ne(`tooltip`);return s(),h(`div`,{ref_key:`container`,ref:N,class:`relative h-full min-w-0 overflow-hidden bg-subtle bg-dots select-none`},[(s(),h(`svg`,{ref_key:`svg`,ref:P,class:`h-full w-full touch-none`,role:`img`,"aria-label":`Vue reactivity dependency graph`,height:I.value,viewBox:`0 0 ${F.value} ${I.value}`,width:F.value},[m(`defs`,null,[t[4]||=m(`marker`,{id:`reactivity-arrow-muted`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:`#888888`,opacity:`0.42`})],-1),(s(),h(v,null,i(M,(e,t)=>m(`marker`,{id:`reactivity-arrow-${t}`,key:`arrow-${t}`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:it(t),opacity:`0.82`},null,8,ts)],8,es)),64))]),m(`g`,{transform:xe.value},[(s(!0),h(v,null,i(be.value,e=>(s(),h(`circle`,{key:`group-${e.id}`,cx:e.x,cy:e.y,fill:e.color,"fill-opacity":we.value&&we.value.id!==e.id?.025:.07,r:e.radius,stroke:e.color,"stroke-opacity":we.value&&we.value.id!==e.id?.08:.18,"stroke-dasharray":`5 6`,"stroke-width":`1`},null,8,rs))),128)),(s(!0),h(v,null,i(ve.value.links,e=>(s(),h(`line`,{key:e.id,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":ot(e),"stroke-width":st(e),"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,is))),128)),(s(!0),h(v,null,i(ye.value,e=>(s(),h(`line`,{key:`path-${e.id}`,class:`pointer-events-none`,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":`0.96`,"stroke-width":`3.4`,"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,as))),128)),(s(!0),h(v,null,i(ve.value.nodes,e=>(s(),h(`g`,{key:e.id,"data-graph-node":``,class:`cursor-grab outline-none active:cursor-grabbing`,opacity:lt(e),role:`button`,tabindex:`0`,"aria-label":`Select ${x(R)(e)} graph node`,transform:`translate(${e.x??F.value/2} ${e.y??I.value/2})`,onClick:A(t=>ie(e.id),[`stop`]),onKeydown:re(A(t=>ie(e.id),[`prevent`]),[`enter`]),onPointercancel:t=>Be(t,e),onPointerdown:t=>Re(t,e),onPointermove:t=>ze(t,e),onPointerup:t=>Be(t,e)},[m(`circle`,{fill:x(V)(e.type),r:e.radius,stroke:ut(e),"stroke-opacity":dt(e),"stroke-width":ft(e),class:`dark:stroke-#f8fafc`},null,8,ss),Ze(e)?(s(),h(`g`,cs,[m(`rect`,{fill:e.id===g.value?`#f8fafc`:`#111827`,"fill-opacity":e.id===g.value?.96:.9,height:Ss,rx:`5`,stroke:it(e.group),"stroke-opacity":e.id===g.value?.82:.34,"stroke-width":`1`,width:e.labelWidth,x:$e(e),y:`-17`},null,8,ls),m(`text`,{class:`font-state-field text-3 font-700`,"dominant-baseline":`middle`,fill:e.id===g.value?`#111827`:`#f8fafc`,"text-anchor":tt(e),x:et(e),y:`-5`},n(x(se)(x(R)(e))),9,us),m(`text`,{class:`text-2.25 font-800`,"dominant-baseline":`middle`,fill:e.id===g.value?`#475569`:`#94a3b8`,"text-anchor":tt(e),x:et(e),y:`9`},n(x(H)(e.type)),9,ds)])):y(``,!0),m(`title`,null,n(x(R)(e))+` - `+n(x(H)(e.type)),1)],40,os))),128))],8,ns)],8,$o)),m(`div`,fs,[(s(!0),h(v,null,i(x(ce),e=>(s(),h(`div`,{key:e,class:`font-state-field min-w-23 flex items-center gap-1.5 color-base text-3.5`},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e)})},null,4),m(`span`,ps,n(x(H)(e)),1)]))),128))]),m(`div`,ms,[u((s(),h(`div`,hs,[u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value<=Cs?`op35`:``]),type:`button`,"aria-label":`Decrease relationship depth`,disabled:S.value<=Cs,onClick:t[0]||=A(e=>je(-1),[`stop`])},[w(k,{icon:`i-carbon-subtract`,class:`text-4`})],10,gs)),[[a,`Decrease relationship depth`,void 0,{top:!0}]]),m(`span`,_s,n(S.value),1),u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value>=ws?`op35`:``]),type:`button`,"aria-label":`Increase relationship depth`,disabled:S.value>=ws,onClick:t[1]||=A(e=>je(1),[`stop`])},[w(k,{icon:`i-carbon-add`,class:`text-4`})],10,vs)),[[a,`Increase relationship depth`,void 0,{top:!0}]])])),[[a,`Relationship depth`,void 0,{top:!0}]]),m(`div`,ys,[u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom out`,onClick:t[2]||=A(e=>Ie(.82),[`stop`])},[w(k,{icon:`i-carbon-zoom-out`,class:`text-4`})])),[[a,`Zoom out`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 min-w-10 rounded-full border-0 bg-transparent px-1.5 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,"aria-label":`Fit graph`,onClick:A(Fe,[`stop`])},[te(n(Se.value),1)])),[[a,`Fit graph`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom in`,onClick:t[3]||=A(e=>Ie(1.18),[`stop`])},[w(k,{icon:`i-carbon-zoom-in`,class:`text-4`})])),[[a,`Zoom in`,void 0,{top:!0}]])])])],512)}}}),Es={class:`h-full min-w-0 overflow-auto p-3`},Ds={key:0},Os={key:0,class:`grid gap-0.5`},ks=[`onClick`],As={class:`w-4 shrink-0 text-right color-muted font-state-field text-3`},js={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ms={key:0,class:`color-muted`},Ns={class:`shrink-0 color-muted text-3`},Ps={key:0,class:`h-7 color-muted flex items-center justify-center`},Fs={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Is={class:`pb-4`},Ls={class:`grid gap-0.5`},Rs={class:`state-key shrink-0 overflow-hidden text-ellipsis whitespace-nowrap op70`},zs={class:`border-t border-base pt-4`},Bs={class:`overflow-x-auto pb-2`},Vs=[`height`,`width`],Hs=[`d`],Us=[`onClick`],Ws={class:`min-w-0 flex items-center gap-1.5`},Gs={class:`truncate font-state-field text-3.5`},Ks={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},qs={key:2,class:`m-0 color-muted text-3 leading-5`},Js=20,Ys=d({__name:`ReactivityGraphDetails`,props:{graph:{},filteredGraph:{},selectedNodeId:{},dependencyDepth:{},path:{}},emits:[`select`],setup(e,{emit:t}){let a=e,o=t,c=ee(a,`selectedNodeId`),l=ee(a,`dependencyDepth`),d=ee(a,`filteredGraph`),p=f(()=>a.filteredGraph.nodes),g=f(()=>a.filteredGraph.relationships),_=f(()=>!!a.path),b=f(()=>a.path??fe());function S(e){o(`select`,e)}let T={width:180,height:30,padding:4,columnGap:52,canvasPadding:16,dot:16},E=f(()=>new Map(a.graph.nodes.map(e=>[e.id,e]))),D=f(()=>b.value.orderedNodeIds.map(e=>E.value.get(e)).filter(e=>e!==void 0)),O=f(()=>{let e=new Map(d.value.relationships.map(e=>[e.id,e]));return b.value.orderedRelationshipIds.map(t=>e.get(t)).filter(e=>e!==void 0)}),re=f(()=>new Map(p.value.map(e=>[e.id,e]))),A=f(()=>p.value.find(e=>e.id===c.value)),j=f(()=>c.value&&E.value.has(c.value)?L(E.value.get(c.value)):[]),ie=f(()=>F(`dependency`)),M=f(()=>F(`subscriber`)),N=f(()=>I());function P(e){return e?T.height*e+T.padding*(e+1):0}function F(e){let t=[],n=new Map,r=c.value;if(!r)return{depthById:n,layers:t};let i=new Set([r]),a=new Set([r]),o=0;for(let r=1;r<=l.value&&a.size;r+=1){let s=[],c=new Set;for(let t of g.value){let n=e===`dependency`?t.from:t.to,r=e===`dependency`?t.to:t.from;if(a.has(r)&&!(i.has(n)||c.has(n))&&re.value.has(n)&&(s.push(n),c.add(n),o+s.length>=Js))break}let l=s.slice(0,Js-o).map(e=>re.value.get(e)).filter(e=>e!==void 0);if(!l.length)break;for(let e of l)i.add(e.id),n.set(e.id,r);if(t.push(l),o+=l.length,a=new Set(l.map(e=>e.id)),o>=Js)break}return{depthById:n,layers:t}}function I(){let e=c.value;if(!e)return{centerX:T.canvasPadding+T.dot/2,centerY:T.dot/2,height:T.dot,links:[],nodes:[],width:T.canvasPadding*2+T.dot};let t=ie.value.layers,n=ie.value.depthById,r=M.value.layers,i=M.value.depthById,a=T.width+T.columnGap,o=T.canvasPadding+r.length*a+T.dot/2,s=T.canvasPadding*2+r.length*a+T.dot+t.length*a,l=Math.max(T.dot,...r.map(e=>P(e.length)),...t.map(e=>P(e.length))),u=l/2,d=[],f=[],p=new Map;r.forEach((e,t)=>{let n=t+1,r=P(e.length),i=(l-r)/2+T.padding,s=o-T.dot/2-T.columnGap-T.width-t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`subscriber`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),t.forEach((e,t)=>{let n=t+1,r=P(e.length),i=(l-r)/2+T.padding,s=o+T.dot/2+T.columnGap+t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`dependency`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),f.length&&(u=(Math.min(...f)+Math.max(...f))/2),p.set(e,{x:o,y:u});let m=[];for(let t of g.value){let r=n.get(t.from),a=t.to===e?0:n.get(t.to);if(r!==void 0&&a!==void 0&&r===a+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`dependency:${t.id}`,path:se(oe(e),e.y,n.x,n.y)})}let o=i.get(t.to),s=t.from===e?0:i.get(t.from);if(o!==void 0&&s!==void 0&&o===s+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`subscriber:${t.id}`,path:se(oe(e),e.y,ae(n),n.y)})}}return{centerX:o,centerY:u,height:l,links:m,nodes:d,width:s}}function ae(e){return e.node?e.x:e.x-T.dot/2}function oe(e){return e.node?e.x+T.width:e.x+T.dot/2}function se(e,t,n,r){let i=(e+n)/2;return`M ${e} ${t} C ${i} ${t} ${i} ${r} ${n} ${r}`}function L(e){let t=de(e);return[{key:`key`,value:z(R(e)),valueClass:`string-state-type`},{key:`type`,value:z(H(e.type)),valueClass:`string-state-type`},{key:`value`,value:t||`undefined`,valueClass:t?B(t):`null-state-type`}]}function z(e){return JSON.stringify(e)}function B(e){return e===`null`||e===`undefined`?`null-state-type`:e===`true`||e===`false`?`boolean-state-type`:e.startsWith(`"`)?`string-state-type`:/^-?\d/.test(e)||e.startsWith(`Symbol(`)?`literal-state-type`:`state-value`}function ce(e){let t=de(e);return t?t.length>28?`${t.slice(0,27)}...`:t:``}return(e,t)=>{let a=ne(`tooltip`);return s(),h(`aside`,Es,[_.value?(s(),h(`section`,Ds,[D.value.length?(s(),h(`div`,Os,[(s(!0),h(v,null,i(D.value,(e,t)=>(s(),h(v,{key:e.id},[m(`button`,{class:`min-w-0 rounded-1 border border-base bg-base px-2 py-1.5 text-left color-base flex items-center gap-2 hover:bg-active`,type:`button`,onClick:t=>S(e.id)},[m(`span`,As,n(t+1),1),m(`span`,{class:`h-2.5 w-2.5 shrink-0 rounded-full`,style:r({background:x(V)(e.type)})},null,4),u((s(),h(`span`,js,[m(`span`,null,n(x(R)(e)),1),ce(e)?(s(),h(`span`,Ms,` (`+n(ce(e))+`) `,1)):y(``,!0)])),[[a,x(de)(e),void 0,{top:!0}]]),m(`span`,Ns,n(x(H)(e.type)),1)],8,ks),t<O.value.length?(s(),h(`div`,Ps,[w(k,{icon:`i-carbon-arrow-down`,class:`text-4`})])):y(``,!0)],64))),128))])):(s(),h(`div`,Fs,` No relationship path found `))])):A.value?(s(),h(v,{key:1},[m(`section`,Is,[t[1]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Info`,-1),m(`div`,Ls,[(s(!0),h(v,null,i(j.value,e=>(s(),h(`div`,{key:e.key,class:`font-state-field min-w-0 flex items-center text-3.5`},[m(`span`,Rs,n(e.key),1),t[0]||=m(`span`,{class:`colon mx-1 shrink-0`},`:`,-1),u((s(),h(`span`,{class:C([`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap`,e.valueClass])},[te(n(e.value),1)],2)),[[a,e.value,void 0,{top:!0}]])]))),128))])]),m(`section`,zs,[t[2]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Relationships`,-1),m(`div`,Bs,[N.value.nodes.length?(s(),h(`div`,{key:0,class:`relative select-none`,style:r({width:`${N.value.width}px`,height:`${N.value.height}px`})},[(s(),h(`svg`,{"pointer-events-none":``,class:`absolute left-0 top-0 z-10`,height:N.value.height,width:N.value.width},[m(`g`,null,[(s(!0),h(v,null,i(N.value.links,e=>(s(),h(`path`,{key:e.id,d:e.path,fill:`none`,stroke:`#888888`,"stroke-opacity":`0.34`},null,8,Hs))),128))])],8,Vs)),m(`div`,{class:`absolute z-20 box-border rounded-full bg-base`,style:r({top:`${N.value.centerY-T.dot/2}px`,left:`${N.value.centerX-T.dot/2}px`,width:`${T.dot}px`,height:`${T.dot}px`,border:`3px solid ${A.value?x(V)(A.value.type):x(V)(`unknown`)}`})},null,4),(s(!0),h(v,null,i(N.value.nodes,e=>u((s(),h(`button`,{key:`${e.side}:${e.depth}:${e.node.id}`,class:`absolute z-20 min-w-0 block rounded-1 border border-base bg-base px-2 py-1 text-left color-base hover:bg-active`,type:`button`,style:r({left:`${e.x}px`,top:`${e.y-T.height/2}px`,width:`${T.width}px`,height:`${T.height}px`,overflow:`hidden`}),onClick:t=>S(e.node.id)},[m(`span`,Ws,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(V)(e.node.type)})},null,4),m(`span`,Gs,n(x(R)(e.node)),1)])],12,Us)),[[a,`${x(R)(e.node)} - ${x(H)(e.node.type)}`,void 0,{top:!0}]])),128))],4)):(s(),h(`div`,Ks,` No data `))])])],64)):(s(),h(`p`,qs,` Select a node to inspect its dependencies and subscribers. `))])}}}),Xs={class:`h-full min-h-0 flex flex-col bg-base`},Zs=d({__name:`ReactivityGraph`,props:{graph:{}},setup(e){let t=e,n=p(),r=p(1),i=p(``),o=p(new Set(ce)),c=p(!1),l=p(``),u=p(``),d=f(()=>{let e=le(i.value),n=o.value,r=t.graph.nodes.filter(t=>n.has(t.type)&&ue(t,e)),a=new Set(r.map(e=>e.id));return{nodes:r,relationships:t.graph.relationships.filter(e=>a.has(e.from)&&a.has(e.to))}}),m=f(()=>pe(d.value.relationships)),g=f(()=>!!l.value&&!!u.value),_=f(()=>g.value?ge(l.value,u.value,m.value):fe());function v(e){c.value=!1,l.value=``,u.value=``,n.value=e}return(t,f)=>(s(),h(`div`,Xs,[w(Je,{search:i.value,"onUpdate:search":f[0]||=e=>i.value=e,"active-types":o.value,"onUpdate:activeTypes":f[1]||=e=>o.value=e,"path-selector-open":c.value,"onUpdate:pathSelectorOpen":f[2]||=e=>c.value=e,"path-start-id":l.value,"onUpdate:pathStartId":f[3]||=e=>l.value=e,"path-end-id":u.value,"onUpdate:pathEndId":f[4]||=e=>u.value=e,"selected-node-id":n.value,"onUpdate:selectedNodeId":f[5]||=e=>n.value=e,graph:e.graph,"filtered-graph":d.value},null,8,[`search`,`active-types`,`path-selector-open`,`path-start-id`,`path-end-id`,`selected-node-id`,`graph`,`filtered-graph`]),w(x(E),{class:`min-h-0 flex-1 overflow-hidden`},{default:a(()=>[w(x(D),{class:`h-full min-h-0`,"min-size":`30`,size:`53.333`},{default:a(()=>[w(Ts,{"selected-node-id":n.value,"onUpdate:selectedNodeId":f[6]||=e=>n.value=e,"dependency-depth":r.value,"onUpdate:dependencyDepth":f[7]||=e=>r.value=e,graph:d.value,path:g.value?_.value:void 0,"path-selector-open":c.value,onSelect:v},null,8,[`selected-node-id`,`dependency-depth`,`graph`,`path`,`path-selector-open`])]),_:1}),w(x(D),{class:`h-full min-h-0`,"min-size":`24`,size:`46.667`},{default:a(()=>[w(Ys,{graph:e.graph,"filtered-graph":d.value,"selected-node-id":n.value,"dependency-depth":r.value,path:g.value?_.value:void 0,onSelect:v},null,8,[`graph`,`filtered-graph`,`selected-node-id`,`dependency-depth`,`path`])]),_:1})]),_:1})]))}}),Qs={class:`h-full min-h-0 flex flex-col`},$s={key:0,class:`max-h-38 shrink-0 border-b border-base`},ec={class:`min-h-0 flex-1`},tc={key:1,class:`h-full min-h-0 flex items-center justify-center bg-subtle p-6`},nc={class:`m-0 max-w-78 text-center color-muted text-3.5 leading-5`},rc=d({__name:`graph`,setup(r){let{apps:i,cancelComponentInspection:o,componentInspecting:c,components:l,componentState:u,componentStateLoading:d,error:v,highlightComponent:b,inspectComponentInPage:ee,reactivityGraphEnabled:te,selectComponent:C,selectedComponent:ne,selectedComponentId:O,unhighlightComponent:re}=g(),k=p(),A=p(!1),M=p(``),N,P=f(()=>ie(l.value,M.value)),F=f(()=>u.value?.reactivityGraph),I=f(()=>te.value?ne.value?d.value?`Loading reactivity graph...`:`No data`:`Select a component to inspect its reactivity graph.`:`Reactivity Graph requires Vue 3.6 or later.`),ae=f(()=>[{icon:`i-carbon-select-window`,tooltip:c.value?`Cancel selecting component`:`Select component in the page`,ariaLabel:`Select component in the page`,active:c.value,pressed:c.value,rounded:`full`,run:se}]);async function oe(e){C(e),await t()}async function se(){if(c.value){await o();return}let e=await ee();e&&(M.value=``,C(e.componentId),await t())}function L(e){ae.value[e]?.run()}function R(e){z(e.target)||(e.key.toLowerCase()===`s`&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),se()):e.key===`Escape`&&c.value&&(e.preventDefault(),o()))}function z(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable}return e(()=>{N=new ResizeObserver(([e])=>{A.value=e.contentRect.width<760}),k.value&&N.observe(k.value),window.addEventListener(`keydown`,R)}),_(()=>{N?.disconnect(),window.removeEventListener(`keydown`,R),c.value&&o(),re()}),(e,t)=>(s(),h(`section`,{ref_key:`container`,ref:k,class:`h-full min-h-0`},[w(x(E),{class:`h-full min-h-0 overflow-hidden`,horizontal:A.value},{default:a(()=>[w(x(D),{class:`h-full min-h-0`,"min-size":`16`,size:A.value?34:18},{default:a(()=>[m(`div`,Qs,[x(i).length>1?(s(),h(`div`,$s,[w(T)])):y(``,!0),m(`div`,ec,[w(j,{filter:M.value,"onUpdate:filter":t[0]||=e=>M.value=e,actions:ae.value,"component-labels":``,"default-expand-depth":99,"empty-text":x(v)??`No components`,nodes:P.value,"no-matching-text":`No matching components`,placeholder:`Find components...`,"selected-node-id":x(O),"state-key":`reactivity-graph-components`,"refresh-visible":!1,onAction:L,onHover:t[1]||=e=>void x(b)(e),onLeave:t[2]||=()=>void x(re)(),onSelect:t[3]||=e=>void oe(e)},null,8,[`filter`,`actions`,`empty-text`,`nodes`,`selected-node-id`])])])]),_:1},8,[`size`]),w(x(D),{class:`h-full min-h-0`,"min-size":`32`},{default:a(()=>[x(te)&&F.value?.nodes.length?(s(),S(Zs,{key:0,graph:F.value},null,8,[`graph`])):(s(),h(`div`,tc,[m(`p`,nc,n(I.value),1)]))]),_:1})]),_:1},8,[`horizontal`])],512))}});export{rc as default};