fuli-context 0.12.4 → 0.20.0-beta.1
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.
- package/dist/web/assets/{AboutPage-DKsgqteA.js → AboutPage-DC3Eu95G.js} +1 -1
- package/dist/web/assets/{AgentHand-B5lezlek.js → AgentHand-Bex3jrOr.js} +1 -1
- package/dist/web/assets/{AgentName-C-V41xs0.js → AgentName-E3TrVNIR.js} +1 -1
- package/dist/web/assets/AgentProfilePage-pHzDx457.js +1 -0
- package/dist/web/assets/{AgentsDirectoryPage-IgN5QEdW.js → AgentsDirectoryPage-itsP9chX.js} +1 -1
- package/dist/web/assets/{ConnectionsPage-CXtNiTEF.js → ConnectionsPage-D0L5VcbN.js} +1 -1
- package/dist/web/assets/{EmployeeRecruitDialog-o6eyMw2g.js → EmployeeRecruitDialog-DcYqq75q.js} +1 -1
- package/dist/web/assets/{EmployeeWorkbenchPage-4EnGLauW.js → EmployeeWorkbenchPage-BDN6whBV.js} +1 -1
- package/dist/web/assets/{KnowledgeEditDialog-BlBd6Xql.js → KnowledgeEditDialog-BnFbCSK7.js} +1 -1
- package/dist/web/assets/{KnowledgeInspector-Dl7SAgaY.js → KnowledgeInspector-u0HypEW7.js} +1 -1
- package/dist/web/assets/{KnowledgeOrganizerPage-CpH4x6UA.js → KnowledgeOrganizerPage-B3GoSV-E.js} +1 -1
- package/dist/web/assets/KnowledgePage-DrRnvfrO.js +1 -0
- package/dist/web/assets/{KnowledgeWorkspace-4q_HfXas.js → KnowledgeWorkspace-_wWZQw_h.js} +1 -1
- package/dist/web/assets/{NotFoundPage-DtmfJSGx.js → NotFoundPage-BcPx7tfG.js} +1 -1
- package/dist/web/assets/{OverviewPage-C1zw_8_6.js → OverviewPage-C2jrJWDc.js} +1 -1
- package/dist/web/assets/{PersonalProfilePage-tQyS7qsa.js → PersonalProfilePage-DkOcops6.js} +1 -1
- package/dist/web/assets/PersonalProjectsPage-uJXnueKw.js +1 -0
- package/dist/web/assets/{ProjectAgentFirstTask-Caf7c6F_.js → ProjectAgentFirstTask-Cwto-bOU.js} +1 -1
- package/dist/web/assets/ProjectAgentsPage-DDuhJnAH.js +12 -0
- package/dist/web/assets/{ProjectAgentsPage-DWGkgIsr.css → ProjectAgentsPage-VYiEOpFJ.css} +1 -1
- package/dist/web/assets/{ProjectScopePicker-NyqcG6Iz.js → ProjectScopePicker-Bc7A6Rdj.js} +1 -1
- package/dist/web/assets/{PublicProjectsPage-CYwQLZmy.js → PublicProjectsPage-KvmU4tDo.js} +1 -1
- package/dist/web/assets/{ReviewPage-EyuAtIOq.js → ReviewPage-BfKG8Hgw.js} +1 -1
- package/dist/web/assets/{RoundtablesPage-JVBXsJrs.js → RoundtablesPage-IXKQq62P.js} +1 -1
- package/dist/web/assets/SettingsPage-6FZ7_3-X.css +1 -0
- package/dist/web/assets/SettingsPage-Clhe1bei.js +1 -0
- package/dist/web/assets/{SharedJefaReportPage-DFy5Ty7o.js → SharedJefaReportPage-B55966fF.js} +1 -1
- package/dist/web/assets/TaskExecutionPlan-BuEIInIV.css +1 -0
- package/dist/web/assets/TaskExecutionPlan-ZoOE8Ltc.js +2 -0
- package/dist/web/assets/{UiButton-neeym_gA.js → UiButton-DYcQLYXP.js} +1 -1
- package/dist/web/assets/{UiDialog-BFVoqFnc.js → UiDialog-D70VuNpZ.js} +1 -1
- package/dist/web/assets/{UiDisclosure-B-T7BmB5.js → UiDisclosure-CaeBp1mn.js} +1 -1
- package/dist/web/assets/{UiSegmented-D_kyRKDw.js → UiSegmented-DpXRULl-.js} +1 -1
- package/dist/web/assets/{UiSelect-DDyct4mf.js → UiSelect-Alpe2iY3.js} +1 -1
- package/dist/web/assets/{WritingTastePage-BPRq6kJ6.js → WritingTastePage-BwNCyys9.js} +1 -1
- package/dist/web/assets/{agent-pins-6LRHTMF6.js → agent-pins-DbcPCnxU.js} +1 -1
- package/dist/web/assets/{agent-profile-UgNiXgpU.css → agent-profile-DTn-2VAG.css} +1 -1
- package/dist/web/assets/{agent-work-summary-C-yW7x7A.js → agent-work-summary-DRJy9v48.js} +1 -1
- package/dist/web/assets/{attention-store-BGHyzWfv.js → attention-store-AfhjzTC5.js} +1 -1
- package/dist/web/assets/{catalog-kb-cA8t6.js → catalog-ykylXINx.js} +1 -1
- package/dist/web/assets/{client-DodUFQDp.js → client-mT6kHxUd.js} +1 -1
- package/dist/web/assets/{console-C2Lfifq-.js → console-CDOkjZU8.js} +1 -1
- package/dist/web/assets/{conversation-launcher-settings-CowfVz7l.js → conversation-launcher-settings-CJfHOqqX.js} +1 -1
- package/dist/web/assets/{i18n-B4Fp9Oa5.js → i18n-DUTWmrzf.js} +3 -3
- package/dist/web/assets/{identity-DG_za-J7.js → identity-CAQk8V-Q.js} +1 -1
- package/dist/web/assets/{index-RxlM8aQV.js → index-DSUd-aqC.js} +3 -3
- package/dist/web/assets/{judgment-types-DRqrjStd.js → judgment-types-aERVgHxJ.js} +1 -1
- package/dist/web/assets/{model-C0eHDNsF.js → model-DiN6uWZA.js} +1 -1
- package/dist/web/assets/{personal-profile-graph-CHY3WYhi.js → personal-profile-graph-C6IZoTJK.js} +1 -1
- package/dist/web/assets/project-team-api-B3dwwoUU.js +1 -0
- package/dist/web/assets/{shared-report-8JFvD9TZ.js → shared-report-n864kqhr.js} +1 -1
- package/dist/web/assets/task-evidence-i9SDhd3E.js +1 -0
- package/dist/web/assets/{useAgentRoster-QDbOwtLj.js → useAgentRoster-BF8eZGbq.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-IuC5qwny.js → useApi-CROJJdhE-sOV3uq1T.js} +1 -1
- package/dist/web/assets/{vue-router-nZMhR3dI.js → vue-router-CBdnor1K.js} +1 -1
- package/dist/web/index.html +15 -15
- package/docs/agent-conversations-and-collaboration.md +91 -127
- package/docs/agent-interface-architecture.md +11 -0
- package/docs/client-connections.md +42 -6
- package/docs/project-agent-memory.md +86 -138
- package/graph-provider/fuli_graph/agent_conversation_models.py +1 -1
- package/graph-provider/fuli_graph/app.py +6 -0
- package/graph-provider/fuli_graph/collaboration_context.py +38 -7
- package/graph-provider/fuli_graph/conversation_context.py +183 -20
- package/graph-provider/fuli_graph/default_project_lead.py +3 -2
- package/graph-provider/fuli_graph/models.py +3 -0
- package/graph-provider/fuli_graph/project_agent_access.py +6 -4
- package/graph-provider/fuli_graph/project_agent_context_models.py +4 -0
- package/graph-provider/fuli_graph/project_agent_memory_models.py +4 -4
- package/graph-provider/fuli_graph/project_agent_memory_routes.py +1 -1
- package/graph-provider/fuli_graph/project_agent_routes.py +6 -1
- package/graph-provider/fuli_graph/project_agent_task_models.py +41 -1
- package/graph-provider/fuli_graph/project_agent_work_log.py +3 -1
- package/graph-provider/fuli_graph/store_agent_conversations.py +20 -7
- package/graph-provider/fuli_graph/store_knowledge.py +6 -0
- package/graph-provider/fuli_graph/store_project_agent_context.py +28 -2
- package/graph-provider/fuli_graph/store_project_agent_memory.py +17 -7
- package/graph-provider/fuli_graph/store_project_agent_task_activity.py +2 -0
- package/graph-provider/fuli_graph/store_project_agent_task_reads.py +3 -0
- package/graph-provider/fuli_graph/store_project_agent_task_staffing.py +115 -31
- package/graph-provider/fuli_graph/store_project_agent_tasks.py +34 -8
- package/graph-provider/fuli_graph/store_task_contexts.py +3 -3
- package/graph-provider/fuli_graph/task_context_models.py +0 -6
- package/graph-provider/fuli_graph/task_notifications.py +54 -0
- package/npm-shrinkwrap.json +13 -0
- package/package.json +2 -1
- package/skills/capturing-session-knowledge/SKILL.md +8 -0
- package/src/agent-tools/agent-collaboration-definitions.js +8 -2
- package/src/agent-tools/agent-conversation-definitions.js +5 -5
- package/src/agent-tools/graph-definitions.js +3 -1
- package/src/agent-tools/graph-handlers.js +1 -0
- package/src/agent-tools/interface-catalog.js +1 -0
- package/src/agent-tools/interface-definitions.js +2 -2
- package/src/agent-tools/project-agent-definitions.js +13 -0
- package/src/agent-tools/project-agent-memory-definitions.js +13 -5
- package/src/agents/claude-code/lifecycle-hook.js +17 -11
- package/src/agents/codex/conversation-transcript.js +2 -0
- package/src/agents/directory-snapshots.js +303 -0
- package/src/agents/identity-receipt.js +4 -2
- package/src/cli/mcp-command.js +1 -2
- package/src/conversations/current-task-lookup.js +2 -1
- package/src/conversations/task-context-view.js +70 -15
- package/src/conversations/transcript-reader.js +9 -1
- package/src/graphiti/agent-collaboration.js +125 -22
- package/src/graphiti/agent-conversations.js +7 -5
- package/src/graphiti/agent-knowledge-workflows.js +16 -3
- package/src/graphiti/collaboration-preference-projection.js +1 -0
- package/src/graphiti/collaboration-preference-workflow.js +15 -4
- package/src/graphiti/federated-application.js +14 -6
- package/src/graphiti/preference-task-scope.js +26 -0
- package/src/graphiti/project-agent-control-plane.js +21 -3
- package/src/graphiti/project-agent-mapping.js +2 -0
- package/src/graphiti/project-agent-memory.js +127 -7
- package/src/graphiti/project-agent-mention.js +2 -2
- package/src/graphiti/project-agent-task-entry.js +55 -19
- package/src/graphiti/project-agent-workflows.js +1 -0
- package/src/graphiti/provider-client.js +22 -7
- package/src/graphiti/task-entry-preferences.js +21 -2
- package/src/graphiti/task-entry-project-scope.js +10 -1
- package/src/graphiti/task-knowledge-recall.js +15 -2
- package/src/http/api-router.js +6 -0
- package/src/http/graph-api-router.js +11 -0
- package/src/http/task-events-api-router.js +34 -0
- package/src/judgment/routing.js +1 -1
- package/src/mcp/agent-tool-catalog.js +14 -0
- package/src/mcp/create-mcp-server.js +41 -7
- package/src/mcp/runtime.js +2 -1
- package/src/mcp/session-id.js +2 -0
- package/src/mcp/tool-annotations.js +1 -0
- package/src/mcp/tool-profiles.js +1 -0
- package/src/mcp/tool-result.js +4 -0
- package/src/server.js +2 -0
- package/src/setup/agent-installation-status.js +3 -0
- package/src/setup/claude-code-config.js +5 -1
- package/src/setup/client-connection.js +1 -1
- package/src/setup/installed-tool-profile.js +11 -0
- package/src/setup/paths.js +1 -0
- package/src/system/client-connection-status.js +163 -0
- package/src/system/system-service.js +19 -0
- package/dist/web/assets/AgentConversations-BnFsfRj3.js +0 -2
- package/dist/web/assets/AgentConversations-XqNEBY_2.css +0 -1
- package/dist/web/assets/AgentProfilePage-DjgqtOdz.js +0 -1
- package/dist/web/assets/KnowledgePage-C-gFr7ln.js +0 -1
- package/dist/web/assets/PersonalProjectsPage-Cgd_bjeK.js +0 -1
- package/dist/web/assets/ProjectAgentsPage-BOGkN5ZN.js +0 -12
- package/dist/web/assets/SettingsPage-BARo0Ds0.css +0 -1
- package/dist/web/assets/SettingsPage-Dfi7kl9c.js +0 -1
- package/dist/web/assets/project-team-api-Dfm8C4B8.js +0 -1
- package/dist/web/assets/task-evidence-DTiPCs7r.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,E as t,H as n,I as r,M as i,N as a,P as o,Q as s,S as c,T as l,U as u,a as d,b as f,f as p,g as m,h,it as g,j as _,l as v,n as y,ot as b,p as x,rt as S,u as C,v as w,w as T,x as E,y as D}from"./i18n-B4Fp9Oa5.js";import{t as O}from"./console-C2Lfifq-.js";import{a as k,o as A,r as j,s as M}from"./client-DodUFQDp.js";import{t as N}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as P}from"./UiButton-neeym_gA.js";import{h as F,m as ee}from"./useApi-CROJJdhE-IuC5qwny.js";import{t as I}from"./vue-router-nZMhR3dI.js";import{t as te}from"./UiDialog-BFVoqFnc.js";import{t as ne}from"./UiSelect-DDyct4mf.js";import{t as re}from"./UiDisclosure-B-T7BmB5.js";import{n as L,t as R}from"./paths-CDREouhi.js";import{t as z}from"./AgentName-C-V41xs0.js";import{t as B}from"./project-team-api-Dfm8C4B8.js";import{n as V,r as ie,t as ae}from"./identity-DG_za-J7.js";import{n as oe,t as se}from"./KnowledgeInspector-Dl7SAgaY.js";import{i as ce,n as le,r as ue,t as de}from"./KnowledgeEditDialog-BlBd6Xql.js";import{C as fe,D as pe,E as me,S as he,_ as ge,b as _e,d as H,f as ve,g as ye,h as be,l as xe,m as Se,s as Ce,u as we,v as Te,w as Ee,y as De}from"./model-C0eHDNsF.js";function Oe(e,t){let n=null;function r(){n=null,e()}return{schedule(){n!==null&&clearTimeout(n),n=setTimeout(r,t)},flush(){n!==null&&(clearTimeout(n),r())},cancel(){n!==null&&(clearTimeout(n),n=null)}}}var ke={value:()=>{}};function Ae(){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 je(n)}function je(e){this._=e}function U(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}})}je.prototype=Ae.prototype={constructor:je,on:function(e,t){var n=this._,r=U(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=W(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=G(n[i],e.name,t);else if(t==null)for(i in n)n[i]=G(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 je(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 W(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function G(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ke,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Me={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function K(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Me.hasOwnProperty(t)?{space:Me[t],local:e}:e}function Ne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Pe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fe(e){var t=K(e);return(t.local?Pe:Ne)(t)}function Ie(){}function Le(e){return e==null?Ie:function(){return this.querySelector(e)}}function Re(e){typeof e!=`function`&&(e=Le(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 q(r,this._parents)}function ze(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Be(){return[]}function Ve(e){return e==null?Be:function(){return this.querySelectorAll(e)}}function He(e){return function(){return ze(e.apply(this,arguments))}}function Ue(e){e=typeof e==`function`?He(e):Ve(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 q(r,i)}function We(e){return function(){return this.matches(e)}}function Ge(e){return function(t){return t.matches(e)}}var Ke=Array.prototype.find;function qe(e){return function(){return Ke.call(this.children,e)}}function Je(){return this.firstElementChild}function Ye(e){return this.select(e==null?Je:qe(typeof e==`function`?e:Ge(e)))}var Xe=Array.prototype.filter;function Ze(){return Array.from(this.children)}function Qe(e){return function(){return Xe.call(this.children,e)}}function $e(e){return this.selectAll(e==null?Ze:Qe(typeof e==`function`?e:Ge(e)))}function et(e){typeof e!=`function`&&(e=We(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 q(r,this._parents)}function tt(e){return Array(e.length)}function nt(){return new q(this._enter||this._groups.map(tt),this._parents)}function rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rt.prototype={constructor:rt,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 it(e){return function(){return e}}function at(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 rt(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function ot(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 rt(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function st(e){return e.__data__}function ct(e,t){if(!arguments.length)return Array.from(this,st);var n=t?ot:at,r=this._parents,i=this._groups;typeof e!=`function`&&(e=it(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=lt(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 q(o,r),o._enter=s,o._exit=c,o}function lt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function ut(){return new q(this._exit||this._groups.map(tt),this._parents)}function dt(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 ft(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 q(s,this._parents)}function pt(){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 mt(e){e||=ht;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 q(i,this._parents).order()}function ht(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _t(){return Array.from(this)}function vt(){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 yt(){let e=0;for(let t of this)++e;return e}function bt(){return!this.node()}function xt(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 St(e){return function(){this.removeAttribute(e)}}function Ct(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wt(e,t){return function(){this.setAttribute(e,t)}}function Tt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Et(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dt(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 Ot(e,t){var n=K(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?Ct:St:typeof t==`function`?n.local?Dt:Et:n.local?Tt:wt)(n,t))}function kt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function At(e){return function(){this.style.removeProperty(e)}}function jt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Mt(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Nt(e,t,n){return arguments.length>1?this.each((t==null?At:typeof t==`function`?Mt:jt)(e,t,n??``)):Pt(this.node(),e)}function Pt(e,t){return e.style.getPropertyValue(t)||kt(e).getComputedStyle(e,null).getPropertyValue(t)}function Ft(e){return function(){delete this[e]}}function It(e,t){return function(){this[e]=t}}function Lt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Rt(e,t){return arguments.length>1?this.each((t==null?Ft:typeof t==`function`?Lt:It)(e,t)):this.node()[e]}function zt(e){return e.trim().split(/^|\s+/)}function Bt(e){return e.classList||new Vt(e)}function Vt(e){this._node=e,this._names=zt(e.getAttribute(`class`)||``)}Vt.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 Ht(e,t){for(var n=Bt(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ut(e,t){for(var n=Bt(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Wt(e){return function(){Ht(this,e)}}function Gt(e){return function(){Ut(this,e)}}function Kt(e,t){return function(){(t.apply(this,arguments)?Ht:Ut)(this,e)}}function qt(e,t){var n=zt(e+``);if(arguments.length<2){for(var r=Bt(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Kt:t?Wt:Gt)(n,t))}function Jt(){this.textContent=``}function Yt(e){return function(){this.textContent=e}}function Xt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Zt(e){return arguments.length?this.each(e==null?Jt:(typeof e==`function`?Xt:Yt)(e)):this.node().textContent}function Qt(){this.innerHTML=``}function $t(e){return function(){this.innerHTML=e}}function en(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function tn(e){return arguments.length?this.each(e==null?Qt:(typeof e==`function`?en:$t)(e)):this.node().innerHTML}function nn(){this.nextSibling&&this.parentNode.appendChild(this)}function rn(){return this.each(nn)}function an(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function on(){return this.each(an)}function sn(e){var t=typeof e==`function`?e:Fe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cn(){return null}function ln(e,t){var n=typeof e==`function`?e:Fe(e),r=t==null?cn:typeof t==`function`?t:Le(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function un(){var e=this.parentNode;e&&e.removeChild(this)}function dn(){return this.each(un)}function fn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mn(e){return this.select(e?pn:fn)}function hn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function gn(e){return function(t){e.call(this,t,this.__data__)}}function _n(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 vn(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 yn(e,t,n){return function(){var r=this.__on,i,a=gn(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 bn(e,t,n){var r=_n(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}return}for(s=t?yn:vn,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function xn(e,t,n){var r=kt(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 Sn(e,t){return function(){return xn(this,e,t)}}function Cn(e,t){return function(){return xn(this,e,t.apply(this,arguments))}}function wn(e,t){return this.each((typeof t==`function`?Cn:Sn)(e,t))}function*Tn(){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 En=[null];function q(e,t){this._groups=e,this._parents=t}function Dn(){return new q([[document.documentElement]],En)}function On(){return this}q.prototype=Dn.prototype={constructor:q,select:Re,selectAll:Ue,selectChild:Ye,selectChildren:$e,filter:et,data:ct,enter:nt,exit:ut,join:dt,merge:ft,selection:On,order:pt,sort:mt,call:gt,nodes:_t,node:vt,size:yt,empty:bt,each:xt,attr:Ot,style:Nt,property:Rt,classed:qt,text:Zt,html:tn,raise:rn,lower:on,append:sn,insert:ln,remove:dn,clone:mn,datum:hn,on:bn,dispatch:wn,[Symbol.iterator]:Tn};function kn(e){return typeof e==`string`?new q([[document.querySelector(e)]],[document.documentElement]):new q([[e]],En)}function An(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jn(e,t){if(e=An(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 Mn={passive:!1},Nn={capture:!0,passive:!1};function Pn(e){e.stopImmediatePropagation()}function Fn(e){e.preventDefault(),e.stopImmediatePropagation()}function In(e){var t=e.document.documentElement,n=kn(e).on(`dragstart.drag`,Fn,Nn);`onselectstart`in t?n.on(`selectstart.drag`,Fn,Nn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Ln(e,t){var n=e.document.documentElement,r=kn(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Fn,Nn),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Rn=e=>()=>e;function zn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}zn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bn(e){return!e.ctrlKey&&!e.button}function Vn(){return this.parentNode}function Hn(e,t){return t??{x:e.x,y:e.y}}function Un(){return navigator.maxTouchPoints||`ontouchstart`in this}function Wn(){var e=Bn,t=Vn,n=Hn,r=Un,i={},a=Ae(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Mn).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(kn(n.view).on(`mousemove.drag`,m,Nn).on(`mouseup.drag`,h,Nn),In(n.view),Pn(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Fn(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){kn(e.view).on(`mousemove.drag mouseup.drag`,null),Ln(e.view,l),Fn(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(Pn(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(Fn(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(Pn(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=jn(l||r,t),p,m,h;if((h=n.call(e,new zn(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=jn(l||a,t),_=o;break}u.call(r,e,new zn(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Rn(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Rn(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Rn(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Rn(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Kn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function qn(){}var Jn=.7,Yn=1/Jn,Xn=`\\s*([+-]?\\d+)\\s*`,Zn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Qn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,$n=/^#([0-9a-f]{3,8})$/,er=RegExp(`^rgb\\(${Xn},${Xn},${Xn}\\)$`),tr=RegExp(`^rgb\\(${Qn},${Qn},${Qn}\\)$`),nr=RegExp(`^rgba\\(${Xn},${Xn},${Xn},${Zn}\\)$`),rr=RegExp(`^rgba\\(${Qn},${Qn},${Qn},${Zn}\\)$`),ir=RegExp(`^hsl\\(${Zn},${Qn},${Qn}\\)$`),ar=RegExp(`^hsla\\(${Zn},${Qn},${Qn},${Zn}\\)$`),or={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};Gn(qn,dr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sr,formatHex:sr,formatHex8:cr,formatHsl:lr,formatRgb:ur,toString:ur});function sr(){return this.rgb().formatHex()}function cr(){return this.rgb().formatHex8()}function lr(){return Cr(this).formatHsl()}function ur(){return this.rgb().formatRgb()}function dr(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=$n.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fr(t):n===3?new J(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pr(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=er.exec(e))?new J(t[1],t[2],t[3],1):(t=tr.exec(e))?new J(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nr.exec(e))?pr(t[1],t[2],t[3],t[4]):(t=rr.exec(e))?pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ir.exec(e))?Sr(t[1],t[2]/100,t[3]/100,1):(t=ar.exec(e))?Sr(t[1],t[2]/100,t[3]/100,t[4]):or.hasOwnProperty(e)?fr(or[e]):e===`transparent`?new J(NaN,NaN,NaN,0):null}function fr(e){return new J(e>>16&255,e>>8&255,e&255,1)}function pr(e,t,n,r){return r<=0&&(e=t=n=NaN),new J(e,t,n,r)}function mr(e){return e instanceof qn||(e=dr(e)),e?(e=e.rgb(),new J(e.r,e.g,e.b,e.opacity)):new J}function hr(e,t,n,r){return arguments.length===1?mr(e):new J(e,t,n,r??1)}function J(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Gn(J,hr,Kn(qn,{brighter(e){return e=e==null?Yn:Yn**+e,new J(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jn:Jn**+e,new J(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new J(br(this.r),br(this.g),br(this.b),yr(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:gr,formatHex:gr,formatHex8:_r,formatRgb:vr,toString:vr}));function gr(){return`#${xr(this.r)}${xr(this.g)}${xr(this.b)}`}function _r(){return`#${xr(this.r)}${xr(this.g)}${xr(this.b)}${xr((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){let e=yr(this.opacity);return`${e===1?`rgb(`:`rgba(`}${br(this.r)}, ${br(this.g)}, ${br(this.b)}${e===1?`)`:`, ${e})`}`}function yr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function br(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xr(e){return e=br(e),(e<16?`0`:``)+e.toString(16)}function Sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tr(e,t,n,r)}function Cr(e){if(e instanceof Tr)return new Tr(e.h,e.s,e.l,e.opacity);if(e instanceof qn||(e=dr(e)),!e)return new Tr;if(e instanceof Tr)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 Tr(o,s,c,e.opacity)}function wr(e,t,n,r){return arguments.length===1?Cr(e):new Tr(e,t,n,r??1)}function Tr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Gn(Tr,wr,Kn(qn,{brighter(e){return e=e==null?Yn:Yn**+e,new Tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jn:Jn**+e,new Tr(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 J(Or(e>=240?e-240:e+120,i,r),Or(e,i,r),Or(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Tr(Er(this.h),Dr(this.s),Dr(this.l),yr(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=yr(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Er(this.h)}, ${Dr(this.s)*100}%, ${Dr(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Er(e){return e=(e||0)%360,e<0?e+360:e}function Dr(e){return Math.max(0,Math.min(1,e||0))}function Or(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 kr=e=>()=>e;function Ar(e,t){return function(n){return e+n*t}}function jr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Mr(e){return(e=+e)==1?Nr:function(t,n){return n-t?jr(t,n,e):kr(isNaN(t)?n:t)}}function Nr(e,t){var n=t-e;return n?Ar(e,n):kr(isNaN(e)?t:e)}var Pr=(function e(t){var n=Mr(t);function r(e,t){var r=n((e=hr(e)).r,(t=hr(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Nr(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 Fr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ir=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lr=new RegExp(Ir.source,`g`);function Rr(e){return function(){return e}}function zr(e){return function(t){return e(t)+``}}function Br(e,t){var n=Ir.lastIndex=Lr.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Ir.exec(e))&&(i=Lr.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:Fr(r,i)})),n=Lr.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?zr(c[0].x):Rr(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 Vr=180/Math.PI,Hr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ur(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)*Vr,skewX:Math.atan(c)*Vr,scaleX:o,scaleY:s}}var Wr;function Gr(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Hr:Ur(t.a,t.b,t.c,t.d,t.e,t.f)}function Kr(e){return e==null||(Wr||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Wr.setAttribute(`transform`,e),!(e=Wr.transform.baseVal.consolidate()))?Hr:(e=e.matrix,Ur(e.a,e.b,e.c,e.d,e.e,e.f))}function qr(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:Fr(e,i)},{i:c-2,x:Fr(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:Fr(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:Fr(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:Fr(e,n)},{i:s-2,x:Fr(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 Jr=qr(Gr,`px, `,`px)`,`deg)`),Yr=qr(Kr,`, `,`)`,`)`),Xr=1e-12;function Zr(e){return((e=Math.exp(e))+1/e)/2}function Qr(e){return((e=Math.exp(e))-1/e)/2}function $r(e){return((e=Math.exp(2*e))-1)/(e+1)}var ei=(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<Xr)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=Zr(y),c=s/(n*g)*(i*$r(t*r+y)-Qr(y));return[a+c*d,o+c*f,s*i/Zr(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),ti=0,ni=0,ri=0,ii=1e3,ai,oi,si=0,ci=0,li=0,ui=typeof performance==`object`&&performance.now?performance:Date,di=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function fi(){return ci||=(di(pi),ui.now()+li)}function pi(){ci=0}function mi(){this._call=this._time=this._next=null}mi.prototype=hi.prototype={constructor:mi,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?fi():+n)+(t==null?0:+t),!this._next&&oi!==this&&(oi?oi._next=this:ai=this,oi=this),this._call=e,this._time=n,bi()},stop:function(){this._call&&(this._call=null,this._time=1/0,bi())}};function hi(e,t,n){var r=new mi;return r.restart(e,t,n),r}function gi(){fi(),++ti;for(var e=ai,t;e;)(t=ci-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ti}function _i(){ci=(si=ui.now())+li,ti=ni=0;try{gi()}finally{ti=0,yi(),ci=0}}function vi(){var e=ui.now(),t=e-si;t>ii&&(li-=t,si=e)}function yi(){for(var e,t=ai,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:ai=n);oi=e,bi(r)}function bi(e){ti||(ni&&=clearTimeout(ni),e-ci>24?(e<1/0&&(ni=setTimeout(_i,e-ui.now()-li)),ri&&=clearInterval(ri)):(ri||=(si=ui.now(),setInterval(vi,ii)),ti=1,di(_i)))}function xi(e,t,n){var r=new mi;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Si=Ae(`start`,`end`,`cancel`,`interrupt`),Ci=[];function wi(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Oi(e,n,{name:t,index:r,group:i,on:Si,tween:Ci,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ti(e,t){var n=Di(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Ei(e,t){var n=Di(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Di(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Oi(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=hi(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 xi(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(xi(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 ki(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}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&&delete e.__transition}}function Ai(e){return this.each(function(){ki(this,e)})}function ji(e,t){var n,r;return function(){var i=Ei(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 Mi(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Ei(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 Ni(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Di(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?ji:Mi)(n,e,t))}function Pi(e,t,n){var r=e._id;return e.each(function(){var e=Ei(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Di(e,r).value[t]}}function Fi(e,t){var n;return(typeof t==`number`?Fr:t instanceof dr?Pr:(n=dr(t))?(t=n,Pr):Br)(e,t)}function Ii(e){return function(){this.removeAttribute(e)}}function Li(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ri(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 zi(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 Bi(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 Vi(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 Hi(e,t){var n=K(e),r=n===`transform`?Yr:Fi;return this.attrTween(e,typeof t==`function`?(n.local?Vi:Bi)(n,r,Pi(this,`attr.`+e,t)):t==null?(n.local?Li:Ii)(n):(n.local?zi:Ri)(n,r,t))}function Ui(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wi(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Gi(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Wi(e,i)),n}return i._value=t,i}function Ki(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ui(e,i)),n}return i._value=t,i}function qi(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=K(e);return this.tween(n,(r.local?Gi:Ki)(r,t))}function Ji(e,t){return function(){Ti(this,e).delay=+t.apply(this,arguments)}}function Yi(e,t){return t=+t,function(){Ti(this,e).delay=t}}function Xi(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ji:Yi)(t,e)):Di(this.node(),t).delay}function Zi(e,t){return function(){Ei(this,e).duration=+t.apply(this,arguments)}}function Qi(e,t){return t=+t,function(){Ei(this,e).duration=t}}function $i(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Zi:Qi)(t,e)):Di(this.node(),t).duration}function ea(e,t){if(typeof t!=`function`)throw Error();return function(){Ei(this,e).ease=t}}function ta(e){var t=this._id;return arguments.length?this.each(ea(t,e)):Di(this.node(),t).ease}function na(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Ei(this,e).ease=n}}function ra(e){if(typeof e!=`function`)throw Error();return this.each(na(this._id,e))}function ia(e){typeof e!=`function`&&(e=We(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 Na(r,this._parents,this._name,this._id)}function aa(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 Na(o,this._parents,this._name,this._id)}function oa(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 sa(e,t,n){var r,i,a=oa(t)?Ti:Ei;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function ca(e,t){var n=this._id;return arguments.length<2?Di(this.node(),n).on.on(e):this.each(sa(n,e,t))}function la(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ua(){return this.on(`end.remove`,la(this._id))}function da(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Le(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,wi(l[f],t,n,f,l,Di(u,n)));return new Na(a,this._parents,t,n)}function fa(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ve(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=Di(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&wi(p,t,n,h,f,m);a.push(f),o.push(u)}return new Na(a,o,t,n)}var pa=Dn.prototype.constructor;function ma(){return new pa(this._groups,this._parents)}function ha(e,t){var n,r,i;return function(){var a=Pt(this,e),o=(this.style.removeProperty(e),Pt(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ga(e){return function(){this.style.removeProperty(e)}}function _a(e,t,n){var r,i=n+``,a;return function(){var o=Pt(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function va(e,t,n){var r,i,a;return function(){var o=Pt(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Pt(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ya(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Ei(this,e),l=c.on,u=c.value[a]==null?s||=ga(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ba(e,t,n){var r=(e+=``)==`transform`?Jr:Fi;return t==null?this.styleTween(e,ha(e,r)).on(`end.style.`+e,ga(e)):typeof t==`function`?this.styleTween(e,va(e,r,Pi(this,`style.`+e,t))).each(ya(this._id,e)):this.styleTween(e,_a(e,r,t),n).on(`end.style.`+e,null)}function xa(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sa(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&xa(e,a,n)),r}return a._value=t,a}function Ca(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,Sa(e,t,n??``))}function wa(e){return function(){this.textContent=e}}function Ta(e){return function(){var t=e(this);this.textContent=t??``}}function Ea(e){return this.tween(`text`,typeof e==`function`?Ta(Pi(this,`text`,e)):wa(e==null?``:e+``))}function Da(e){return function(t){this.textContent=e.call(this,t)}}function Oa(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Da(r)),t}return r._value=e,r}function ka(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,Oa(e))}function Aa(){for(var e=this._name,t=this._id,n=Fa(),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=Di(c,t);wi(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Na(r,this._parents,e,n)}function ja(){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=Ei(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 Ma=0;function Na(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Pa(e){return Dn().transition(e)}function Fa(){return++Ma}var Ia=Dn.prototype;Na.prototype=Pa.prototype={constructor:Na,select:da,selectAll:fa,selectChild:Ia.selectChild,selectChildren:Ia.selectChildren,filter:ia,merge:aa,selection:ma,transition:Aa,call:Ia.call,nodes:Ia.nodes,node:Ia.node,size:Ia.size,empty:Ia.empty,each:Ia.each,on:ca,attr:Hi,attrTween:qi,style:ba,styleTween:Ca,text:Ea,textTween:ka,remove:ua,tween:Ni,delay:Xi,duration:$i,ease:ta,easeVarying:ra,end:ja,[Symbol.iterator]:Ia[Symbol.iterator]};function La(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ra={time:null,delay:0,duration:250,ease:La};function za(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ba(e){var t,n;e instanceof Na?(t=e._id,e=e._name):(t=Fa(),(n=Ra).time=fi(),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])&&wi(c,e,t,l,o,n||za(c,t));return new Na(r,this._parents,e,t)}Dn.prototype.interrupt=Ai,Dn.prototype.transition=Ba;var{abs:Va,max:Ha,min:Ua}=Math;[`w`,`e`].map(Wa),[`n`,`s`].map(Wa),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Wa);function Wa(e){return{type:e}}function Ga(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i<a;++i)o=n[i],s+=o.x,c+=o.y;for(s=(s/a-e)*r,c=(c/a-t)*r,i=0;i<a;++i)o=n[i],o.x-=s,o.y-=c}return i.initialize=function(e){n=e},i.x=function(t){return arguments.length?(e=+t,i):e},i.y=function(e){return arguments.length?(t=+e,i):t},i.strength=function(e){return arguments.length?(r=+e,i):r},i}function Ka(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return qa(this.cover(t,n),t,n,e)}function qa(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 Ja(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)qa(this,o[n],s[n],e[n]);return this}function Ya(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;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Xa(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Za(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 Y(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function Qa(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 Y(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 Y(p[3],g,_,c,l),new Y(p[2],o,_,g,l),new Y(p[1],g,s,c,_),new Y(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 $a(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 eo(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function to(){return this._root}function no(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function ro(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new Y(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 Y(i,l,u,s,c)),(i=r[2])&&t.push(new Y(i,a,u,l,c)),(i=r[1])&&t.push(new Y(i,l,o,s,u)),(i=r[0])&&t.push(new Y(i,a,o,l,u))}return this}function io(e){var t=[],n=[],r;for(this._root&&t.push(new Y(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 Y(a,o,s,u,d)),(a=i[1])&&t.push(new Y(a,u,s,c,d)),(a=i[2])&&t.push(new Y(a,o,d,u,l)),(a=i[3])&&t.push(new Y(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 ao(e){return e[0]}function oo(e){return arguments.length?(this._x=e,this):this._x}function so(e){return e[1]}function co(e){return arguments.length?(this._y=e,this):this._y}function lo(e,t,n){var r=new uo(t??ao,n??so,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function uo(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 fo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var X=lo.prototype=uo.prototype;X.copy=function(){var e=new uo(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=fo(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]=fo(r));return e},X.add=Ka,X.addAll=Ja,X.cover=Ya,X.data=Xa,X.extent=Za,X.find=Qa,X.remove=$a,X.removeAll=eo,X.root=to,X.size=no,X.visit=ro,X.visitAfter=io,X.x=oo,X.y=co;function Z(e){return function(){return e}}function po(e){return(e()-.5)*1e-6}function mo(e){return e.x+e.vx}function ho(e){return e.y+e.vy}function go(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=Z(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=lo(t,mo,ho).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=po(r),_+=h*h),g===0&&(g=po(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)}return}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:Z(+t),c(),o):e},o}function _o(e){return e.index}function vo(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function yo(e){var t=_o,n=d,r,i=Z(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||po(l),m=f.y+f.vy-d.y-d.vy||po(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=vo(u,d.source)),typeof d.target!=`object`&&(d.target=vo(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:Z(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),h(),f):i},f}var bo=1664525,xo=1013904223,So=4294967296;function Co(){let e=1;return()=>(e=(bo*e+xo)%So)/So}function wo(e){return e.x}function To(e){return e.y}var Eo=10,Do=Math.PI*(3-Math.sqrt(5));function Oo(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=hi(d),l=Ae(`tick`,`end`),u=Co();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=Eo*Math.sqrt(.5+t),a=t*Do;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 ko(){var e,t,n,r,i=Z(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=lo(e,wo,To).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=po(n),m+=d*d),f===0&&(f=po(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=po(n),m+=d*d),f===0&&(f=po(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:Z(+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 Ao(e,t,n){var r,i=Z(.1),a,o;typeof e!=`function`&&(e=Z(+e)),t??=0,n??=0;function s(e){for(var i=0,s=r.length;i<s;++i){var c=r[i],l=c.x-t||1e-6,u=c.y-n||1e-6,d=Math.sqrt(l*l+u*u),f=(o[i]-d)*a[i]*e/d;c.vx+=l*f,c.vy+=u*f}}function c(){if(r){var t,n=r.length;for(a=Array(n),o=Array(n),t=0;t<n;++t)o[t]=+e(r[t],t,r),a[t]=isNaN(o[t])?0:+i(r[t],t,r)}}return s.initialize=function(e){r=e,c()},s.strength=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),c(),s):i},s.radius=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),c(),s):e},s.x=function(e){return arguments.length?(t=+e,s):t},s.y=function(e){return arguments.length?(n=+e,s):n},s}function jo(e){var t=Z(.1),n,r,i;typeof e!=`function`&&(e=Z(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:Z(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),o(),a):e},a}function Mo(e){var t=Z(.1),n,r,i;typeof e!=`function`&&(e=Z(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:Z(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),o(),a):e},a}var No=e=>()=>e;function Po(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 Fo(e,t,n){this.k=e,this.x=t,this.y=n}Fo.prototype={constructor:Fo,scale:function(e){return e===1?this:new Fo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fo(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 Io=new Fo(1,0,0);Lo.prototype=Fo.prototype;function Lo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Io;return e.__zoom}function Ro(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function Bo(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Vo(){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 Ho(){return this.__zoom||Io}function Uo(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Wo(){return navigator.maxTouchPoints||`ontouchstart`in this}function Go(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 Ko(){var e=Bo,t=Vo,n=Go,r=Uo,i=Wo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ei,l=Ae(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ho).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).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`,Ho),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(Io.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 Fo(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 Fo(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 Fo(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 C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.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=kn(this.that).datum();l.call(e,this.that,new Po(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(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=jn(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)],ki(this),s.start();zo(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 T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=kn(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=jn(t,i),l=t.clientX,u=t.clientY;In(t.view),Ro(t),a.mouse=[c,this.__zoom.invert(c)],ki(this),a.start();function d(e){if(zo(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]=jn(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Ln(e.view,a.moved),zo(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=jn(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);zo(r),s>0?kn(this).transition().duration(s).call(x,d,c,r):kn(this).call(_.transform,d,c,r)}}function D(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(Ro(t),s=0;s<i;++s)c=r[s],l=jn(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)),ki(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(zo(e),s=0;s<a;++s)c=i[s],l=jn(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 k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Ro(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=jn(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=kn(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:No(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:No(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:No(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:No([[+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 qo=`0 0 24 24`,Q={assessment:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM8 12l2.7 2.7L16 9`,code:`M8 9l-4 3 4 3M16 9l4 3-4 3M14 5l-4 14`,decision:`M5 4h14v16H5zM8 12l2.5 2.5L16 9`,folder:`M3 6h7l2 2h9v11H3z`,hierarchy:`M9 3h6v4H9zM4 17h6v4H4zM14 17h6v4h-6zM12 7v5M7 12h10M7 12v5M17 12v5`,link:`M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.8 1.7M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.8-1.7`,measure:`M4 16 16 4l4 4L8 20zM13 7l4 4M10 10l2 2M7 13l4 4`,purpose:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12ZM12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4`,scope:`M8 3H3v5M16 3h5v5M3 16v5h5M21 16v5h-5`,shield:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10ZM9 12l2 2 4-4`,source:`M6 3h8l4 4v14H6zM14 3v5h4M9 13h6M9 17h6`,transfer:`M4 7h11M12 4l3 3-3 3M20 17H9M12 14l-3 3 3 3`},Jo={PART_OF:{messageKey:`PART_OF`,iconPath:Q.hierarchy},HAS_SOURCE:{messageKey:`HAS_SOURCE`,iconPath:Q.source},HAS_PURPOSE:{messageKey:`HAS_PURPOSE`,iconPath:Q.purpose},HAS_SCOPE:{messageKey:`HAS_SCOPE`,iconPath:Q.scope},GOVERNS:{messageKey:`GOVERNS`,iconPath:Q.shield},HAS_TECHNICAL_SUMMARY:{messageKey:`HAS_TECHNICAL_SUMMARY`,iconPath:Q.code},ASSESSED_AS:{messageKey:`ASSESSED_AS`,iconPath:Q.assessment},MEASURES:{messageKey:`MEASURES`,iconPath:Q.measure},CONTAINS_PROJECT:{messageKey:`CONTAINS_PROJECT`,iconPath:Q.folder},USES_KNOWLEDGE_FROM:{messageKey:`USES_KNOWLEDGE_FROM`,iconPath:Q.transfer},USES_EXTERNAL_KNOWLEDGE:{messageKey:`USES_EXTERNAL_KNOWLEDGE`,iconPath:Q.transfer},DEPENDS_ON:{messageKey:`DEPENDS_ON`,iconPath:Q.link},PROVIDES_TO:{messageKey:`PROVIDES_TO`,iconPath:Q.transfer},SHARES_CAPABILITY_WITH:{messageKey:`SHARES_CAPABILITY_WITH`,iconPath:Q.link},RELATED_TO:{messageKey:`RELATED_TO`,iconPath:Q.link},HAS_DECISION:{messageKey:`HAS_DECISION`,iconPath:Q.decision}},Yo={messageKey:`fallback`,iconPath:Q.link},Xo=RegExp(`\\b(${Object.keys(Jo).join(`|`)})\\b`,`g`);function Zo(e){let t=Jo[e.trim().toUpperCase()]??Yo,n=`knowledge.domain.relations.${t.messageKey}`;return{type:e,label:d(`${n}.label`),description:d(`${n}.description`),iconPath:t.iconPath}}function Qo(e){return e.replace(Xo,e=>d(`knowledge.domain.relations.quoted`,{label:Zo(e).label}))}function $o(e){let t=new Set,n=[];for(let r of e){let e=r.trim().toUpperCase();!e||t.has(e)||(t.add(e),n.push(Zo(r)))}return n}var es=[`blue`,`teal`,`violet`,`amber`,`rose`,`cyan`,`slate`].map(e=>`var(--color-chart-${e})`),ts=.18,ns=5,rs=1.5,is=.72;function as(e,t,n={}){let r=typeof n==`function`?{onNodeSelect:n}:n,i=Math.max(e.clientWidth||0,760),a=Math.max(e.clientHeight||0,520),o=t.nodes.map(e=>({...e})),s=new Set(o.map(({id:e})=>e)),c=t.edges.map(os).filter(({sourceId:e,targetId:t})=>s.has(e)&&s.has(t)),l=kn(e);l.selectAll(`*`).remove(),l.attr(`viewBox`,`0 0 ${i} ${a}`).attr(`preserveAspectRatio`,`xMidYMid meet`);let u=`graph-arrow-${Math.random().toString(36).slice(2)}`;l.append(`defs`).append(`marker`).attr(`id`,u).attr(`viewBox`,`0 -5 10 10`).attr(`refX`,28).attr(`refY`,0).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M0,-5L10,0L0,5`).attr(`class`,`graph-arrow`);let f=l.append(`g`).attr(`class`,`graph-viewport`),p=f.append(`g`).attr(`class`,`graph-edges`),m=f.append(`g`).attr(`class`,`graph-edge-labels`),h=f.append(`g`).attr(`class`,`graph-nodes`),g=p.selectAll(`line.graph-edge`).data(c).join(`line`).attr(`class`,e=>[`graph-edge`,e.invalid_at?`historical`:null,ds(e)?`human-change-pending`:null,e.human_change_status===`viewed`?`human-change-viewed`:null].filter(Boolean).join(` `)).attr(`marker-end`,`url(#${u})`),_=p.selectAll(`line.graph-edge-hit`).data(c).join(`line`).attr(`class`,`graph-edge-hit`).attr(`role`,`button`).attr(`tabindex`,0).attr(`aria-label`,e=>{let t=Zo(e.type);return`${t.label}:${Qo(e.fact||t.description)}`});_.append(`title`).text(e=>{let t=Zo(e.type);return`${t.label}:${Qo(e.fact||t.description)}`});let v=c.length<=90?m.selectAll(`g.graph-edge-label`).data(c).join(`g`).attr(`class`,`graph-edge-label`).attr(`data-relation-type`,e=>e.type):m.selectAll(`g.graph-edge-label`);v.append(`rect`).attr(`class`,`graph-edge-label-bg`).attr(`x`,e=>-ps(e)/2).attr(`y`,-10).attr(`width`,ps).attr(`height`,20).attr(`rx`,10),v.append(`path`).attr(`class`,`graph-edge-label-icon`).attr(`d`,e=>Zo(e.type).iconPath).attr(`transform`,e=>`translate(${-ps(e)/2+6},-6) scale(.5)`),v.append(`text`).attr(`class`,`graph-edge-label-text`).attr(`x`,e=>-ps(e)/2+22).attr(`y`,3.5).text(e=>Zo(e.type).label),v.append(`title`).text(e=>{let t=Zo(e.type);return`${t.label}:${t.description}`});let y=h.selectAll(`g.graph-node`).data(o).join(`g`).attr(`class`,e=>[`graph-node`,$(e)?`project-node`:null,ds(e)?`human-change-pending`:null,e.human_change_status===`viewed`?`human-change-viewed`:null].filter(Boolean).join(` `)).attr(`tabindex`,0).attr(`role`,`button`).attr(`aria-label`,e=>`${Qo(e.name)},ID ${V(e)}`);y.filter(e=>!$(e)).append(`circle`).attr(`class`,`graph-node-shape`).attr(`r`,e=>10+Math.min(7,fs(e.id,c))).attr(`fill`,e=>us(e.type)),y.filter($).append(`circle`).attr(`class`,`graph-project-ring`).attr(`r`,24),y.filter($).append(`circle`).attr(`class`,`graph-node-shape`).attr(`r`,19),y.filter($).append(`path`).attr(`class`,`graph-project-icon`).attr(`d`,`M-9,-7H-3L0,-4H9V7H-9Z`),y.filter(ds).append(`circle`).attr(`class`,`graph-node-human-marker`).attr(`cx`,e=>$(e)?20:12).attr(`cy`,e=>$(e)?-20:-12).attr(`r`,4),y.append(`text`).attr(`class`,`graph-node-label`).attr(`y`,e=>$(e)?39:26+Math.min(7,fs(e.id,c))).text(e=>ms(Qo(e.name),22)),y.append(`text`).attr(`class`,`graph-node-id`).attr(`y`,e=>$(e)?51:38+Math.min(7,fs(e.id,c))).text(e=>`#${V(e)}`);let b=y.append(`g`).attr(`class`,`graph-search-badge`).attr(`transform`,e=>`translate(0,${$(e)?-36:-28})`);b.append(`rect`).attr(`x`,-15).attr(`y`,-8).attr(`width`,30).attr(`height`,15).attr(`rx`,4),b.append(`text`).attr(`y`,3).text(d(`knowledge.domain.graph.hit`)),y.append(`title`).text(e=>[Qo(e.name),e.type,`ID: ${e.id}`,$(e)?d(`knowledge.domain.graph.projectMarked`):null,ds(e)?e.human_change_status===`unseen`?d(`knowledge.domain.graph.humanUnseen`):d(`knowledge.domain.graph.humanViewed`):null].filter(Boolean).join(`
|
|
1
|
+
import{B as e,E as t,H as n,I as r,M as i,N as a,P as o,Q as s,S as c,T as l,U as u,a as d,b as f,f as p,g as m,h,it as g,j as _,l as v,n as y,ot as b,p as x,rt as S,u as C,v as w,w as T,x as E,y as D}from"./i18n-DUTWmrzf.js";import{t as O}from"./console-CDOkjZU8.js";import{a as k,o as A,r as j,s as M}from"./client-mT6kHxUd.js";import{t as N}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as P}from"./UiButton-DYcQLYXP.js";import{h as F,m as ee}from"./useApi-CROJJdhE-sOV3uq1T.js";import{t as I}from"./vue-router-CBdnor1K.js";import{t as te}from"./UiDialog-D70VuNpZ.js";import{t as ne}from"./UiSelect-Alpe2iY3.js";import{t as re}from"./UiDisclosure-CaeBp1mn.js";import{n as L,t as R}from"./paths-CDREouhi.js";import{t as z}from"./AgentName-E3TrVNIR.js";import{t as B}from"./project-team-api-B3dwwoUU.js";import{n as V,r as ie,t as ae}from"./identity-CAQk8V-Q.js";import{n as oe,t as se}from"./KnowledgeInspector-u0HypEW7.js";import{i as ce,n as le,r as ue,t as de}from"./KnowledgeEditDialog-BnFbCSK7.js";import{C as fe,D as pe,E as me,S as he,_ as ge,b as _e,d as H,f as ve,g as ye,h as be,l as xe,m as Se,s as Ce,u as we,v as Te,w as Ee,y as De}from"./model-DiN6uWZA.js";function Oe(e,t){let n=null;function r(){n=null,e()}return{schedule(){n!==null&&clearTimeout(n),n=setTimeout(r,t)},flush(){n!==null&&(clearTimeout(n),r())},cancel(){n!==null&&(clearTimeout(n),n=null)}}}var ke={value:()=>{}};function Ae(){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 je(n)}function je(e){this._=e}function U(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}})}je.prototype=Ae.prototype={constructor:je,on:function(e,t){var n=this._,r=U(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=W(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=G(n[i],e.name,t);else if(t==null)for(i in n)n[i]=G(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 je(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 W(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function G(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ke,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Me={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function K(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Me.hasOwnProperty(t)?{space:Me[t],local:e}:e}function Ne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Pe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fe(e){var t=K(e);return(t.local?Pe:Ne)(t)}function Ie(){}function Le(e){return e==null?Ie:function(){return this.querySelector(e)}}function Re(e){typeof e!=`function`&&(e=Le(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 q(r,this._parents)}function ze(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Be(){return[]}function Ve(e){return e==null?Be:function(){return this.querySelectorAll(e)}}function He(e){return function(){return ze(e.apply(this,arguments))}}function Ue(e){e=typeof e==`function`?He(e):Ve(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 q(r,i)}function We(e){return function(){return this.matches(e)}}function Ge(e){return function(t){return t.matches(e)}}var Ke=Array.prototype.find;function qe(e){return function(){return Ke.call(this.children,e)}}function Je(){return this.firstElementChild}function Ye(e){return this.select(e==null?Je:qe(typeof e==`function`?e:Ge(e)))}var Xe=Array.prototype.filter;function Ze(){return Array.from(this.children)}function Qe(e){return function(){return Xe.call(this.children,e)}}function $e(e){return this.selectAll(e==null?Ze:Qe(typeof e==`function`?e:Ge(e)))}function et(e){typeof e!=`function`&&(e=We(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 q(r,this._parents)}function tt(e){return Array(e.length)}function nt(){return new q(this._enter||this._groups.map(tt),this._parents)}function rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rt.prototype={constructor:rt,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 it(e){return function(){return e}}function at(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 rt(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function ot(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 rt(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function st(e){return e.__data__}function ct(e,t){if(!arguments.length)return Array.from(this,st);var n=t?ot:at,r=this._parents,i=this._groups;typeof e!=`function`&&(e=it(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=lt(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 q(o,r),o._enter=s,o._exit=c,o}function lt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function ut(){return new q(this._exit||this._groups.map(tt),this._parents)}function dt(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 ft(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 q(s,this._parents)}function pt(){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 mt(e){e||=ht;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 q(i,this._parents).order()}function ht(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _t(){return Array.from(this)}function vt(){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 yt(){let e=0;for(let t of this)++e;return e}function bt(){return!this.node()}function xt(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 St(e){return function(){this.removeAttribute(e)}}function Ct(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wt(e,t){return function(){this.setAttribute(e,t)}}function Tt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Et(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dt(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 Ot(e,t){var n=K(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?Ct:St:typeof t==`function`?n.local?Dt:Et:n.local?Tt:wt)(n,t))}function kt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function At(e){return function(){this.style.removeProperty(e)}}function jt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Mt(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Nt(e,t,n){return arguments.length>1?this.each((t==null?At:typeof t==`function`?Mt:jt)(e,t,n??``)):Pt(this.node(),e)}function Pt(e,t){return e.style.getPropertyValue(t)||kt(e).getComputedStyle(e,null).getPropertyValue(t)}function Ft(e){return function(){delete this[e]}}function It(e,t){return function(){this[e]=t}}function Lt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Rt(e,t){return arguments.length>1?this.each((t==null?Ft:typeof t==`function`?Lt:It)(e,t)):this.node()[e]}function zt(e){return e.trim().split(/^|\s+/)}function Bt(e){return e.classList||new Vt(e)}function Vt(e){this._node=e,this._names=zt(e.getAttribute(`class`)||``)}Vt.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 Ht(e,t){for(var n=Bt(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ut(e,t){for(var n=Bt(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Wt(e){return function(){Ht(this,e)}}function Gt(e){return function(){Ut(this,e)}}function Kt(e,t){return function(){(t.apply(this,arguments)?Ht:Ut)(this,e)}}function qt(e,t){var n=zt(e+``);if(arguments.length<2){for(var r=Bt(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Kt:t?Wt:Gt)(n,t))}function Jt(){this.textContent=``}function Yt(e){return function(){this.textContent=e}}function Xt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Zt(e){return arguments.length?this.each(e==null?Jt:(typeof e==`function`?Xt:Yt)(e)):this.node().textContent}function Qt(){this.innerHTML=``}function $t(e){return function(){this.innerHTML=e}}function en(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function tn(e){return arguments.length?this.each(e==null?Qt:(typeof e==`function`?en:$t)(e)):this.node().innerHTML}function nn(){this.nextSibling&&this.parentNode.appendChild(this)}function rn(){return this.each(nn)}function an(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function on(){return this.each(an)}function sn(e){var t=typeof e==`function`?e:Fe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cn(){return null}function ln(e,t){var n=typeof e==`function`?e:Fe(e),r=t==null?cn:typeof t==`function`?t:Le(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function un(){var e=this.parentNode;e&&e.removeChild(this)}function dn(){return this.each(un)}function fn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mn(e){return this.select(e?pn:fn)}function hn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function gn(e){return function(t){e.call(this,t,this.__data__)}}function _n(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 vn(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 yn(e,t,n){return function(){var r=this.__on,i,a=gn(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 bn(e,t,n){var r=_n(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}return}for(s=t?yn:vn,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function xn(e,t,n){var r=kt(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 Sn(e,t){return function(){return xn(this,e,t)}}function Cn(e,t){return function(){return xn(this,e,t.apply(this,arguments))}}function wn(e,t){return this.each((typeof t==`function`?Cn:Sn)(e,t))}function*Tn(){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 En=[null];function q(e,t){this._groups=e,this._parents=t}function Dn(){return new q([[document.documentElement]],En)}function On(){return this}q.prototype=Dn.prototype={constructor:q,select:Re,selectAll:Ue,selectChild:Ye,selectChildren:$e,filter:et,data:ct,enter:nt,exit:ut,join:dt,merge:ft,selection:On,order:pt,sort:mt,call:gt,nodes:_t,node:vt,size:yt,empty:bt,each:xt,attr:Ot,style:Nt,property:Rt,classed:qt,text:Zt,html:tn,raise:rn,lower:on,append:sn,insert:ln,remove:dn,clone:mn,datum:hn,on:bn,dispatch:wn,[Symbol.iterator]:Tn};function kn(e){return typeof e==`string`?new q([[document.querySelector(e)]],[document.documentElement]):new q([[e]],En)}function An(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jn(e,t){if(e=An(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 Mn={passive:!1},Nn={capture:!0,passive:!1};function Pn(e){e.stopImmediatePropagation()}function Fn(e){e.preventDefault(),e.stopImmediatePropagation()}function In(e){var t=e.document.documentElement,n=kn(e).on(`dragstart.drag`,Fn,Nn);`onselectstart`in t?n.on(`selectstart.drag`,Fn,Nn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Ln(e,t){var n=e.document.documentElement,r=kn(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Fn,Nn),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Rn=e=>()=>e;function zn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}zn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bn(e){return!e.ctrlKey&&!e.button}function Vn(){return this.parentNode}function Hn(e,t){return t??{x:e.x,y:e.y}}function Un(){return navigator.maxTouchPoints||`ontouchstart`in this}function Wn(){var e=Bn,t=Vn,n=Hn,r=Un,i={},a=Ae(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Mn).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(kn(n.view).on(`mousemove.drag`,m,Nn).on(`mouseup.drag`,h,Nn),In(n.view),Pn(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Fn(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){kn(e.view).on(`mousemove.drag mouseup.drag`,null),Ln(e.view,l),Fn(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(Pn(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(Fn(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(Pn(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=jn(l||r,t),p,m,h;if((h=n.call(e,new zn(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=jn(l||a,t),_=o;break}u.call(r,e,new zn(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Rn(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Rn(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Rn(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Rn(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Kn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function qn(){}var Jn=.7,Yn=1/Jn,Xn=`\\s*([+-]?\\d+)\\s*`,Zn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Qn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,$n=/^#([0-9a-f]{3,8})$/,er=RegExp(`^rgb\\(${Xn},${Xn},${Xn}\\)$`),tr=RegExp(`^rgb\\(${Qn},${Qn},${Qn}\\)$`),nr=RegExp(`^rgba\\(${Xn},${Xn},${Xn},${Zn}\\)$`),rr=RegExp(`^rgba\\(${Qn},${Qn},${Qn},${Zn}\\)$`),ir=RegExp(`^hsl\\(${Zn},${Qn},${Qn}\\)$`),ar=RegExp(`^hsla\\(${Zn},${Qn},${Qn},${Zn}\\)$`),or={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};Gn(qn,dr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sr,formatHex:sr,formatHex8:cr,formatHsl:lr,formatRgb:ur,toString:ur});function sr(){return this.rgb().formatHex()}function cr(){return this.rgb().formatHex8()}function lr(){return Cr(this).formatHsl()}function ur(){return this.rgb().formatRgb()}function dr(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=$n.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fr(t):n===3?new J(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pr(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=er.exec(e))?new J(t[1],t[2],t[3],1):(t=tr.exec(e))?new J(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nr.exec(e))?pr(t[1],t[2],t[3],t[4]):(t=rr.exec(e))?pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ir.exec(e))?Sr(t[1],t[2]/100,t[3]/100,1):(t=ar.exec(e))?Sr(t[1],t[2]/100,t[3]/100,t[4]):or.hasOwnProperty(e)?fr(or[e]):e===`transparent`?new J(NaN,NaN,NaN,0):null}function fr(e){return new J(e>>16&255,e>>8&255,e&255,1)}function pr(e,t,n,r){return r<=0&&(e=t=n=NaN),new J(e,t,n,r)}function mr(e){return e instanceof qn||(e=dr(e)),e?(e=e.rgb(),new J(e.r,e.g,e.b,e.opacity)):new J}function hr(e,t,n,r){return arguments.length===1?mr(e):new J(e,t,n,r??1)}function J(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Gn(J,hr,Kn(qn,{brighter(e){return e=e==null?Yn:Yn**+e,new J(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jn:Jn**+e,new J(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new J(br(this.r),br(this.g),br(this.b),yr(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:gr,formatHex:gr,formatHex8:_r,formatRgb:vr,toString:vr}));function gr(){return`#${xr(this.r)}${xr(this.g)}${xr(this.b)}`}function _r(){return`#${xr(this.r)}${xr(this.g)}${xr(this.b)}${xr((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){let e=yr(this.opacity);return`${e===1?`rgb(`:`rgba(`}${br(this.r)}, ${br(this.g)}, ${br(this.b)}${e===1?`)`:`, ${e})`}`}function yr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function br(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xr(e){return e=br(e),(e<16?`0`:``)+e.toString(16)}function Sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tr(e,t,n,r)}function Cr(e){if(e instanceof Tr)return new Tr(e.h,e.s,e.l,e.opacity);if(e instanceof qn||(e=dr(e)),!e)return new Tr;if(e instanceof Tr)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 Tr(o,s,c,e.opacity)}function wr(e,t,n,r){return arguments.length===1?Cr(e):new Tr(e,t,n,r??1)}function Tr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Gn(Tr,wr,Kn(qn,{brighter(e){return e=e==null?Yn:Yn**+e,new Tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jn:Jn**+e,new Tr(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 J(Or(e>=240?e-240:e+120,i,r),Or(e,i,r),Or(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Tr(Er(this.h),Dr(this.s),Dr(this.l),yr(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=yr(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Er(this.h)}, ${Dr(this.s)*100}%, ${Dr(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Er(e){return e=(e||0)%360,e<0?e+360:e}function Dr(e){return Math.max(0,Math.min(1,e||0))}function Or(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 kr=e=>()=>e;function Ar(e,t){return function(n){return e+n*t}}function jr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Mr(e){return(e=+e)==1?Nr:function(t,n){return n-t?jr(t,n,e):kr(isNaN(t)?n:t)}}function Nr(e,t){var n=t-e;return n?Ar(e,n):kr(isNaN(e)?t:e)}var Pr=(function e(t){var n=Mr(t);function r(e,t){var r=n((e=hr(e)).r,(t=hr(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Nr(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 Fr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ir=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lr=new RegExp(Ir.source,`g`);function Rr(e){return function(){return e}}function zr(e){return function(t){return e(t)+``}}function Br(e,t){var n=Ir.lastIndex=Lr.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Ir.exec(e))&&(i=Lr.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:Fr(r,i)})),n=Lr.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?zr(c[0].x):Rr(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 Vr=180/Math.PI,Hr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ur(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)*Vr,skewX:Math.atan(c)*Vr,scaleX:o,scaleY:s}}var Wr;function Gr(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Hr:Ur(t.a,t.b,t.c,t.d,t.e,t.f)}function Kr(e){return e==null||(Wr||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Wr.setAttribute(`transform`,e),!(e=Wr.transform.baseVal.consolidate()))?Hr:(e=e.matrix,Ur(e.a,e.b,e.c,e.d,e.e,e.f))}function qr(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:Fr(e,i)},{i:c-2,x:Fr(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:Fr(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:Fr(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:Fr(e,n)},{i:s-2,x:Fr(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 Jr=qr(Gr,`px, `,`px)`,`deg)`),Yr=qr(Kr,`, `,`)`,`)`),Xr=1e-12;function Zr(e){return((e=Math.exp(e))+1/e)/2}function Qr(e){return((e=Math.exp(e))-1/e)/2}function $r(e){return((e=Math.exp(2*e))-1)/(e+1)}var ei=(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<Xr)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=Zr(y),c=s/(n*g)*(i*$r(t*r+y)-Qr(y));return[a+c*d,o+c*f,s*i/Zr(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),ti=0,ni=0,ri=0,ii=1e3,ai,oi,si=0,ci=0,li=0,ui=typeof performance==`object`&&performance.now?performance:Date,di=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function fi(){return ci||=(di(pi),ui.now()+li)}function pi(){ci=0}function mi(){this._call=this._time=this._next=null}mi.prototype=hi.prototype={constructor:mi,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?fi():+n)+(t==null?0:+t),!this._next&&oi!==this&&(oi?oi._next=this:ai=this,oi=this),this._call=e,this._time=n,bi()},stop:function(){this._call&&(this._call=null,this._time=1/0,bi())}};function hi(e,t,n){var r=new mi;return r.restart(e,t,n),r}function gi(){fi(),++ti;for(var e=ai,t;e;)(t=ci-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ti}function _i(){ci=(si=ui.now())+li,ti=ni=0;try{gi()}finally{ti=0,yi(),ci=0}}function vi(){var e=ui.now(),t=e-si;t>ii&&(li-=t,si=e)}function yi(){for(var e,t=ai,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:ai=n);oi=e,bi(r)}function bi(e){ti||(ni&&=clearTimeout(ni),e-ci>24?(e<1/0&&(ni=setTimeout(_i,e-ui.now()-li)),ri&&=clearInterval(ri)):(ri||=(si=ui.now(),setInterval(vi,ii)),ti=1,di(_i)))}function xi(e,t,n){var r=new mi;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Si=Ae(`start`,`end`,`cancel`,`interrupt`),Ci=[];function wi(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Oi(e,n,{name:t,index:r,group:i,on:Si,tween:Ci,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ti(e,t){var n=Di(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Ei(e,t){var n=Di(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Di(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Oi(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=hi(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 xi(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(xi(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 ki(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}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&&delete e.__transition}}function Ai(e){return this.each(function(){ki(this,e)})}function ji(e,t){var n,r;return function(){var i=Ei(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 Mi(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Ei(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 Ni(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Di(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?ji:Mi)(n,e,t))}function Pi(e,t,n){var r=e._id;return e.each(function(){var e=Ei(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Di(e,r).value[t]}}function Fi(e,t){var n;return(typeof t==`number`?Fr:t instanceof dr?Pr:(n=dr(t))?(t=n,Pr):Br)(e,t)}function Ii(e){return function(){this.removeAttribute(e)}}function Li(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ri(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 zi(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 Bi(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 Vi(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 Hi(e,t){var n=K(e),r=n===`transform`?Yr:Fi;return this.attrTween(e,typeof t==`function`?(n.local?Vi:Bi)(n,r,Pi(this,`attr.`+e,t)):t==null?(n.local?Li:Ii)(n):(n.local?zi:Ri)(n,r,t))}function Ui(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wi(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Gi(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Wi(e,i)),n}return i._value=t,i}function Ki(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ui(e,i)),n}return i._value=t,i}function qi(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=K(e);return this.tween(n,(r.local?Gi:Ki)(r,t))}function Ji(e,t){return function(){Ti(this,e).delay=+t.apply(this,arguments)}}function Yi(e,t){return t=+t,function(){Ti(this,e).delay=t}}function Xi(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ji:Yi)(t,e)):Di(this.node(),t).delay}function Zi(e,t){return function(){Ei(this,e).duration=+t.apply(this,arguments)}}function Qi(e,t){return t=+t,function(){Ei(this,e).duration=t}}function $i(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Zi:Qi)(t,e)):Di(this.node(),t).duration}function ea(e,t){if(typeof t!=`function`)throw Error();return function(){Ei(this,e).ease=t}}function ta(e){var t=this._id;return arguments.length?this.each(ea(t,e)):Di(this.node(),t).ease}function na(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Ei(this,e).ease=n}}function ra(e){if(typeof e!=`function`)throw Error();return this.each(na(this._id,e))}function ia(e){typeof e!=`function`&&(e=We(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 Na(r,this._parents,this._name,this._id)}function aa(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 Na(o,this._parents,this._name,this._id)}function oa(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 sa(e,t,n){var r,i,a=oa(t)?Ti:Ei;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function ca(e,t){var n=this._id;return arguments.length<2?Di(this.node(),n).on.on(e):this.each(sa(n,e,t))}function la(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ua(){return this.on(`end.remove`,la(this._id))}function da(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Le(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,wi(l[f],t,n,f,l,Di(u,n)));return new Na(a,this._parents,t,n)}function fa(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ve(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=Di(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&wi(p,t,n,h,f,m);a.push(f),o.push(u)}return new Na(a,o,t,n)}var pa=Dn.prototype.constructor;function ma(){return new pa(this._groups,this._parents)}function ha(e,t){var n,r,i;return function(){var a=Pt(this,e),o=(this.style.removeProperty(e),Pt(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ga(e){return function(){this.style.removeProperty(e)}}function _a(e,t,n){var r,i=n+``,a;return function(){var o=Pt(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function va(e,t,n){var r,i,a;return function(){var o=Pt(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Pt(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ya(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Ei(this,e),l=c.on,u=c.value[a]==null?s||=ga(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ba(e,t,n){var r=(e+=``)==`transform`?Jr:Fi;return t==null?this.styleTween(e,ha(e,r)).on(`end.style.`+e,ga(e)):typeof t==`function`?this.styleTween(e,va(e,r,Pi(this,`style.`+e,t))).each(ya(this._id,e)):this.styleTween(e,_a(e,r,t),n).on(`end.style.`+e,null)}function xa(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sa(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&xa(e,a,n)),r}return a._value=t,a}function Ca(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,Sa(e,t,n??``))}function wa(e){return function(){this.textContent=e}}function Ta(e){return function(){var t=e(this);this.textContent=t??``}}function Ea(e){return this.tween(`text`,typeof e==`function`?Ta(Pi(this,`text`,e)):wa(e==null?``:e+``))}function Da(e){return function(t){this.textContent=e.call(this,t)}}function Oa(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Da(r)),t}return r._value=e,r}function ka(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,Oa(e))}function Aa(){for(var e=this._name,t=this._id,n=Fa(),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=Di(c,t);wi(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Na(r,this._parents,e,n)}function ja(){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=Ei(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 Ma=0;function Na(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Pa(e){return Dn().transition(e)}function Fa(){return++Ma}var Ia=Dn.prototype;Na.prototype=Pa.prototype={constructor:Na,select:da,selectAll:fa,selectChild:Ia.selectChild,selectChildren:Ia.selectChildren,filter:ia,merge:aa,selection:ma,transition:Aa,call:Ia.call,nodes:Ia.nodes,node:Ia.node,size:Ia.size,empty:Ia.empty,each:Ia.each,on:ca,attr:Hi,attrTween:qi,style:ba,styleTween:Ca,text:Ea,textTween:ka,remove:ua,tween:Ni,delay:Xi,duration:$i,ease:ta,easeVarying:ra,end:ja,[Symbol.iterator]:Ia[Symbol.iterator]};function La(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ra={time:null,delay:0,duration:250,ease:La};function za(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ba(e){var t,n;e instanceof Na?(t=e._id,e=e._name):(t=Fa(),(n=Ra).time=fi(),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])&&wi(c,e,t,l,o,n||za(c,t));return new Na(r,this._parents,e,t)}Dn.prototype.interrupt=Ai,Dn.prototype.transition=Ba;var{abs:Va,max:Ha,min:Ua}=Math;[`w`,`e`].map(Wa),[`n`,`s`].map(Wa),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Wa);function Wa(e){return{type:e}}function Ga(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i<a;++i)o=n[i],s+=o.x,c+=o.y;for(s=(s/a-e)*r,c=(c/a-t)*r,i=0;i<a;++i)o=n[i],o.x-=s,o.y-=c}return i.initialize=function(e){n=e},i.x=function(t){return arguments.length?(e=+t,i):e},i.y=function(e){return arguments.length?(t=+e,i):t},i.strength=function(e){return arguments.length?(r=+e,i):r},i}function Ka(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return qa(this.cover(t,n),t,n,e)}function qa(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 Ja(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)qa(this,o[n],s[n],e[n]);return this}function Ya(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;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Xa(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Za(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 Y(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function Qa(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 Y(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 Y(p[3],g,_,c,l),new Y(p[2],o,_,g,l),new Y(p[1],g,s,c,_),new Y(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 $a(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 eo(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function to(){return this._root}function no(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function ro(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new Y(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 Y(i,l,u,s,c)),(i=r[2])&&t.push(new Y(i,a,u,l,c)),(i=r[1])&&t.push(new Y(i,l,o,s,u)),(i=r[0])&&t.push(new Y(i,a,o,l,u))}return this}function io(e){var t=[],n=[],r;for(this._root&&t.push(new Y(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 Y(a,o,s,u,d)),(a=i[1])&&t.push(new Y(a,u,s,c,d)),(a=i[2])&&t.push(new Y(a,o,d,u,l)),(a=i[3])&&t.push(new Y(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 ao(e){return e[0]}function oo(e){return arguments.length?(this._x=e,this):this._x}function so(e){return e[1]}function co(e){return arguments.length?(this._y=e,this):this._y}function lo(e,t,n){var r=new uo(t??ao,n??so,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function uo(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 fo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var X=lo.prototype=uo.prototype;X.copy=function(){var e=new uo(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=fo(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]=fo(r));return e},X.add=Ka,X.addAll=Ja,X.cover=Ya,X.data=Xa,X.extent=Za,X.find=Qa,X.remove=$a,X.removeAll=eo,X.root=to,X.size=no,X.visit=ro,X.visitAfter=io,X.x=oo,X.y=co;function Z(e){return function(){return e}}function po(e){return(e()-.5)*1e-6}function mo(e){return e.x+e.vx}function ho(e){return e.y+e.vy}function go(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=Z(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=lo(t,mo,ho).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=po(r),_+=h*h),g===0&&(g=po(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)}return}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:Z(+t),c(),o):e},o}function _o(e){return e.index}function vo(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function yo(e){var t=_o,n=d,r,i=Z(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||po(l),m=f.y+f.vy-d.y-d.vy||po(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=vo(u,d.source)),typeof d.target!=`object`&&(d.target=vo(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:Z(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),h(),f):i},f}var bo=1664525,xo=1013904223,So=4294967296;function Co(){let e=1;return()=>(e=(bo*e+xo)%So)/So}function wo(e){return e.x}function To(e){return e.y}var Eo=10,Do=Math.PI*(3-Math.sqrt(5));function Oo(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=hi(d),l=Ae(`tick`,`end`),u=Co();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=Eo*Math.sqrt(.5+t),a=t*Do;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 ko(){var e,t,n,r,i=Z(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=lo(e,wo,To).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=po(n),m+=d*d),f===0&&(f=po(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=po(n),m+=d*d),f===0&&(f=po(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:Z(+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 Ao(e,t,n){var r,i=Z(.1),a,o;typeof e!=`function`&&(e=Z(+e)),t??=0,n??=0;function s(e){for(var i=0,s=r.length;i<s;++i){var c=r[i],l=c.x-t||1e-6,u=c.y-n||1e-6,d=Math.sqrt(l*l+u*u),f=(o[i]-d)*a[i]*e/d;c.vx+=l*f,c.vy+=u*f}}function c(){if(r){var t,n=r.length;for(a=Array(n),o=Array(n),t=0;t<n;++t)o[t]=+e(r[t],t,r),a[t]=isNaN(o[t])?0:+i(r[t],t,r)}}return s.initialize=function(e){r=e,c()},s.strength=function(e){return arguments.length?(i=typeof e==`function`?e:Z(+e),c(),s):i},s.radius=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),c(),s):e},s.x=function(e){return arguments.length?(t=+e,s):t},s.y=function(e){return arguments.length?(n=+e,s):n},s}function jo(e){var t=Z(.1),n,r,i;typeof e!=`function`&&(e=Z(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:Z(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),o(),a):e},a}function Mo(e){var t=Z(.1),n,r,i;typeof e!=`function`&&(e=Z(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:Z(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:Z(+t),o(),a):e},a}var No=e=>()=>e;function Po(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 Fo(e,t,n){this.k=e,this.x=t,this.y=n}Fo.prototype={constructor:Fo,scale:function(e){return e===1?this:new Fo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fo(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 Io=new Fo(1,0,0);Lo.prototype=Fo.prototype;function Lo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Io;return e.__zoom}function Ro(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function Bo(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Vo(){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 Ho(){return this.__zoom||Io}function Uo(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Wo(){return navigator.maxTouchPoints||`ontouchstart`in this}function Go(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 Ko(){var e=Bo,t=Vo,n=Go,r=Uo,i=Wo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ei,l=Ae(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ho).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).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`,Ho),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(Io.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 Fo(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 Fo(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 Fo(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 C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.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=kn(this.that).datum();l.call(e,this.that,new Po(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(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=jn(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)],ki(this),s.start();zo(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 T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=kn(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=jn(t,i),l=t.clientX,u=t.clientY;In(t.view),Ro(t),a.mouse=[c,this.__zoom.invert(c)],ki(this),a.start();function d(e){if(zo(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]=jn(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Ln(e.view,a.moved),zo(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=jn(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);zo(r),s>0?kn(this).transition().duration(s).call(x,d,c,r):kn(this).call(_.transform,d,c,r)}}function D(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(Ro(t),s=0;s<i;++s)c=r[s],l=jn(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)),ki(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(zo(e),s=0;s<a;++s)c=i[s],l=jn(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 k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Ro(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=jn(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=kn(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:No(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:No(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:No(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:No([[+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 qo=`0 0 24 24`,Q={assessment:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM8 12l2.7 2.7L16 9`,code:`M8 9l-4 3 4 3M16 9l4 3-4 3M14 5l-4 14`,decision:`M5 4h14v16H5zM8 12l2.5 2.5L16 9`,folder:`M3 6h7l2 2h9v11H3z`,hierarchy:`M9 3h6v4H9zM4 17h6v4H4zM14 17h6v4h-6zM12 7v5M7 12h10M7 12v5M17 12v5`,link:`M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.8 1.7M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.8-1.7`,measure:`M4 16 16 4l4 4L8 20zM13 7l4 4M10 10l2 2M7 13l4 4`,purpose:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12ZM12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4`,scope:`M8 3H3v5M16 3h5v5M3 16v5h5M21 16v5h-5`,shield:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10ZM9 12l2 2 4-4`,source:`M6 3h8l4 4v14H6zM14 3v5h4M9 13h6M9 17h6`,transfer:`M4 7h11M12 4l3 3-3 3M20 17H9M12 14l-3 3 3 3`},Jo={PART_OF:{messageKey:`PART_OF`,iconPath:Q.hierarchy},HAS_SOURCE:{messageKey:`HAS_SOURCE`,iconPath:Q.source},HAS_PURPOSE:{messageKey:`HAS_PURPOSE`,iconPath:Q.purpose},HAS_SCOPE:{messageKey:`HAS_SCOPE`,iconPath:Q.scope},GOVERNS:{messageKey:`GOVERNS`,iconPath:Q.shield},HAS_TECHNICAL_SUMMARY:{messageKey:`HAS_TECHNICAL_SUMMARY`,iconPath:Q.code},ASSESSED_AS:{messageKey:`ASSESSED_AS`,iconPath:Q.assessment},MEASURES:{messageKey:`MEASURES`,iconPath:Q.measure},CONTAINS_PROJECT:{messageKey:`CONTAINS_PROJECT`,iconPath:Q.folder},USES_KNOWLEDGE_FROM:{messageKey:`USES_KNOWLEDGE_FROM`,iconPath:Q.transfer},USES_EXTERNAL_KNOWLEDGE:{messageKey:`USES_EXTERNAL_KNOWLEDGE`,iconPath:Q.transfer},DEPENDS_ON:{messageKey:`DEPENDS_ON`,iconPath:Q.link},PROVIDES_TO:{messageKey:`PROVIDES_TO`,iconPath:Q.transfer},SHARES_CAPABILITY_WITH:{messageKey:`SHARES_CAPABILITY_WITH`,iconPath:Q.link},RELATED_TO:{messageKey:`RELATED_TO`,iconPath:Q.link},HAS_DECISION:{messageKey:`HAS_DECISION`,iconPath:Q.decision}},Yo={messageKey:`fallback`,iconPath:Q.link},Xo=RegExp(`\\b(${Object.keys(Jo).join(`|`)})\\b`,`g`);function Zo(e){let t=Jo[e.trim().toUpperCase()]??Yo,n=`knowledge.domain.relations.${t.messageKey}`;return{type:e,label:d(`${n}.label`),description:d(`${n}.description`),iconPath:t.iconPath}}function Qo(e){return e.replace(Xo,e=>d(`knowledge.domain.relations.quoted`,{label:Zo(e).label}))}function $o(e){let t=new Set,n=[];for(let r of e){let e=r.trim().toUpperCase();!e||t.has(e)||(t.add(e),n.push(Zo(r)))}return n}var es=[`blue`,`teal`,`violet`,`amber`,`rose`,`cyan`,`slate`].map(e=>`var(--color-chart-${e})`),ts=.18,ns=5,rs=1.5,is=.72;function as(e,t,n={}){let r=typeof n==`function`?{onNodeSelect:n}:n,i=Math.max(e.clientWidth||0,760),a=Math.max(e.clientHeight||0,520),o=t.nodes.map(e=>({...e})),s=new Set(o.map(({id:e})=>e)),c=t.edges.map(os).filter(({sourceId:e,targetId:t})=>s.has(e)&&s.has(t)),l=kn(e);l.selectAll(`*`).remove(),l.attr(`viewBox`,`0 0 ${i} ${a}`).attr(`preserveAspectRatio`,`xMidYMid meet`);let u=`graph-arrow-${Math.random().toString(36).slice(2)}`;l.append(`defs`).append(`marker`).attr(`id`,u).attr(`viewBox`,`0 -5 10 10`).attr(`refX`,28).attr(`refY`,0).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M0,-5L10,0L0,5`).attr(`class`,`graph-arrow`);let f=l.append(`g`).attr(`class`,`graph-viewport`),p=f.append(`g`).attr(`class`,`graph-edges`),m=f.append(`g`).attr(`class`,`graph-edge-labels`),h=f.append(`g`).attr(`class`,`graph-nodes`),g=p.selectAll(`line.graph-edge`).data(c).join(`line`).attr(`class`,e=>[`graph-edge`,e.invalid_at?`historical`:null,ds(e)?`human-change-pending`:null,e.human_change_status===`viewed`?`human-change-viewed`:null].filter(Boolean).join(` `)).attr(`marker-end`,`url(#${u})`),_=p.selectAll(`line.graph-edge-hit`).data(c).join(`line`).attr(`class`,`graph-edge-hit`).attr(`role`,`button`).attr(`tabindex`,0).attr(`aria-label`,e=>{let t=Zo(e.type);return`${t.label}:${Qo(e.fact||t.description)}`});_.append(`title`).text(e=>{let t=Zo(e.type);return`${t.label}:${Qo(e.fact||t.description)}`});let v=c.length<=90?m.selectAll(`g.graph-edge-label`).data(c).join(`g`).attr(`class`,`graph-edge-label`).attr(`data-relation-type`,e=>e.type):m.selectAll(`g.graph-edge-label`);v.append(`rect`).attr(`class`,`graph-edge-label-bg`).attr(`x`,e=>-ps(e)/2).attr(`y`,-10).attr(`width`,ps).attr(`height`,20).attr(`rx`,10),v.append(`path`).attr(`class`,`graph-edge-label-icon`).attr(`d`,e=>Zo(e.type).iconPath).attr(`transform`,e=>`translate(${-ps(e)/2+6},-6) scale(.5)`),v.append(`text`).attr(`class`,`graph-edge-label-text`).attr(`x`,e=>-ps(e)/2+22).attr(`y`,3.5).text(e=>Zo(e.type).label),v.append(`title`).text(e=>{let t=Zo(e.type);return`${t.label}:${t.description}`});let y=h.selectAll(`g.graph-node`).data(o).join(`g`).attr(`class`,e=>[`graph-node`,$(e)?`project-node`:null,ds(e)?`human-change-pending`:null,e.human_change_status===`viewed`?`human-change-viewed`:null].filter(Boolean).join(` `)).attr(`tabindex`,0).attr(`role`,`button`).attr(`aria-label`,e=>`${Qo(e.name)},ID ${V(e)}`);y.filter(e=>!$(e)).append(`circle`).attr(`class`,`graph-node-shape`).attr(`r`,e=>10+Math.min(7,fs(e.id,c))).attr(`fill`,e=>us(e.type)),y.filter($).append(`circle`).attr(`class`,`graph-project-ring`).attr(`r`,24),y.filter($).append(`circle`).attr(`class`,`graph-node-shape`).attr(`r`,19),y.filter($).append(`path`).attr(`class`,`graph-project-icon`).attr(`d`,`M-9,-7H-3L0,-4H9V7H-9Z`),y.filter(ds).append(`circle`).attr(`class`,`graph-node-human-marker`).attr(`cx`,e=>$(e)?20:12).attr(`cy`,e=>$(e)?-20:-12).attr(`r`,4),y.append(`text`).attr(`class`,`graph-node-label`).attr(`y`,e=>$(e)?39:26+Math.min(7,fs(e.id,c))).text(e=>ms(Qo(e.name),22)),y.append(`text`).attr(`class`,`graph-node-id`).attr(`y`,e=>$(e)?51:38+Math.min(7,fs(e.id,c))).text(e=>`#${V(e)}`);let b=y.append(`g`).attr(`class`,`graph-search-badge`).attr(`transform`,e=>`translate(0,${$(e)?-36:-28})`);b.append(`rect`).attr(`x`,-15).attr(`y`,-8).attr(`width`,30).attr(`height`,15).attr(`rx`,4),b.append(`text`).attr(`y`,3).text(d(`knowledge.domain.graph.hit`)),y.append(`title`).text(e=>[Qo(e.name),e.type,`ID: ${e.id}`,$(e)?d(`knowledge.domain.graph.projectMarked`):null,ds(e)?e.human_change_status===`unseen`?d(`knowledge.domain.graph.humanUnseen`):d(`knowledge.domain.graph.humanViewed`):null].filter(Boolean).join(`
|
|
2
2
|
`));let x=Ko().scaleExtent([ts,ns]).on(`zoom`,e=>{f.attr(`transform`,e.transform.toString()).classed(`graph-viewport--compact-labels`,e.transform.k<is)});l.call(x).on(`dblclick.zoom`,null);let S=Oo(o).force(`link`,yo(c).id(({id:e})=>e).distance(118).strength(.42)).force(`charge`,ko().strength(-390).distanceMax(620)).force(`collide`,go().radius(e=>$(e)?58:38+Math.min(10,fs(e.id,c)))).force(`project-focus`,Ao(e=>$(e)?70:210,i/2,a/2).strength(e=>$(e)?.55:.008)).force(`center`,Ga(i/2,a/2)).force(`x`,jo(i/2).strength(.025)).force(`y`,Mo(a/2).strength(.025)).stop();for(let e=0;e<220;e+=1)S.tick();T();let C=null,w=Wn().on(`start`,(e,t)=>{e.sourceEvent?.stopPropagation(),t.dragMoved=!1,t.fx=t.x,t.fy=t.y}).on(`drag`,function(e,t){t.dragMoved=!0,t.fx=e.x,t.fy=e.y,t.x=e.x,t.y=e.y,kn(this).classed(`pinned`,!0),T()}).on(`end`,function(e,t){t.dragMoved?(t.fx=t.x,t.fy=t.y):(t.fx=null,t.fy=null,kn(this).classed(`pinned`,!1)),delete t.dragMoved});return y.call(w),y.on(`click`,(e,t)=>{e.stopPropagation(),E(t)}).on(`keydown`,(e,t)=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),E(t))}).on(`dblclick`,(e,t)=>{e.stopPropagation(),t.fx=null,t.fy=null,kn(e.currentTarget).classed(`pinned`,!1),S.alpha(.35).restart(),C!==null&&window.clearTimeout(C),C=window.setTimeout(()=>{C=null,S.stop()},700)}),_.on(`click`,(e,t)=>{e.stopPropagation(),O(t)}).on(`keydown`,(e,t)=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),O(t))}).on(`mouseenter.labels`,(e,t)=>k(t,`hovered`,!0)).on(`mouseleave.labels`,(e,t)=>k(t,`hovered`,!1)).on(`focus.labels`,(e,t)=>k(t,`focused`,!0)).on(`blur.labels`,(e,t)=>k(t,`focused`,!1)),l.on(`click.selection`,t=>{t.target===e&&M()}),P(o,0),{zoomIn:()=>N(1.32),zoomOut:()=>N(.76),fit:()=>P(o),reset:()=>{M(),l.transition().duration(220).call(x.transform,Io)},selectItem(e,t){if(e===`entity`){let e=o.find(e=>e.id===t);return e?(D(e),P([e]),!0):!1}let n=c.find(e=>e.id===t);return n?(A(n),P([cs(n.source),cs(n.target)]),!0):!1},focusByNames(e,{projectOnly:t=!1,searchMatch:n=!1}={}){let r=o.filter(n=>e.has(n.name)&&(!t||$(n)));if(!r.length)return n?j({nodeIds:new Set,edgeIds:new Set,selectedNodeId:null,selectedEdgeId:null,searchMatch:n}):M(),0;let i=new Set(r.map(({id:e})=>e));return j({nodeIds:i,edgeIds:new Set(c.filter(({sourceId:e,targetId:t})=>i.has(e)&&i.has(t)).map(({id:e})=>e)),selectedNodeId:null,selectedEdgeId:null,searchMatch:n}),P(r),r.length},clearSelection:M,destroy(){C!==null&&(window.clearTimeout(C),C=null),S.stop(),l.on(`.zoom`,null).on(`.selection`,null),l.selectAll(`*`).remove()}};function T(){g.attr(`x1`,e=>ls(e.source,`x`)).attr(`y1`,e=>ls(e.source,`y`)).attr(`x2`,e=>ls(e.target,`x`)).attr(`y2`,e=>ls(e.target,`y`)),_.attr(`x1`,e=>ls(e.source,`x`)).attr(`y1`,e=>ls(e.source,`y`)).attr(`x2`,e=>ls(e.target,`x`)).attr(`y2`,e=>ls(e.target,`y`)),v.attr(`transform`,e=>`translate(${(ls(e.source,`x`)+ls(e.target,`x`))/2},${(ls(e.source,`y`)+ls(e.target,`y`))/2-5})`),y.attr(`transform`,e=>`translate(${e.x??i/2},${e.y??a/2})`)}function E(e){D(e),r.onNodeSelect?.(e)}function D(e){let t=new Set([e.id]),n=new Set;for(let r of c)r.sourceId!==e.id&&r.targetId!==e.id||(n.add(r.id),t.add(r.sourceId),t.add(r.targetId));j({nodeIds:t,edgeIds:n,selectedNodeId:e.id,selectedEdgeId:null})}function O(e){A(e),r.onEdgeSelect?.(e.raw)}function k(e,t,n){v.filter(({id:t})=>t===e.id).classed(t,n)}function A(e){j({nodeIds:new Set([e.sourceId,e.targetId]),edgeIds:new Set([e.id]),selectedNodeId:null,selectedEdgeId:e.id})}function j({nodeIds:e,edgeIds:t,selectedNodeId:n,selectedEdgeId:r,searchMatch:i=!1}){y.classed(`selected`,({id:e})=>e===n).classed(`related`,({id:t})=>e.has(t)&&t!==n).classed(`dimmed`,({id:t})=>!e.has(t)).classed(`search-match`,({id:t})=>i&&e.has(t)),g.classed(`selected`,({id:e})=>e===r).classed(`related`,({id:e})=>t.has(e)).classed(`dimmed`,({id:e})=>t.size>0?!t.has(e):!0).classed(`search-match`,({id:e})=>i&&t.has(e)),v.classed(`selected`,({id:e})=>e===r).classed(`related`,({id:e})=>t.has(e)).classed(`dimmed`,({id:e})=>t.size>0?!t.has(e):!0).classed(`search-match`,({id:e})=>i&&t.has(e))}function M(){y.classed(`selected related dimmed search-match`,!1),g.classed(`selected related dimmed search-match`,!1),v.classed(`selected related dimmed search-match`,!1)}function N(e){l.transition().duration(180).call(x.scaleBy,e)}function P(e,t=220){if(!e.length)return;let n=e.map(({x:e})=>e??i/2),r=e.map(({y:e})=>e??a/2),o=Math.min(...n),s=Math.max(...n),c=Math.min(...r),u=Math.max(...r),d=Math.max(s-o,90),f=Math.max(u-c,90),p=Math.max(ts,Math.min(rs,.82/Math.max(d/i,f/a))),m=(o+s)/2,h=(c+u)/2,g=Io.translate(i/2-p*m,a/2-p*h).scale(p);t?l.transition().duration(t).call(x.transform,g):l.call(x.transform,g)}}function os(e,t){let n=ss(e.source),r=ss(e.target);return{id:e.id||`edge-${t}-${n}-${r}`,sourceId:n,targetId:r,source:n,target:r,type:e.type,fact:e.fact,invalid_at:e.invalid_at,human_change_status:e.human_change_status,raw:e}}function ss(e){return typeof e==`object`&&e?e.id:e}function cs(e){if(typeof e==`object`&&e)return e;throw Error(`Graph edge endpoint was not linked: ${e}`)}function ls(e,t){return cs(e)[t]??0}function us(e){return es[Math.floor(hs(e)*es.length)%es.length]}function $(e){return e?.type===`PersonalProject`||e?.type===`RelatedPersonalProject`}function ds(e){return e?.human_change_status===`unseen`||e?.human_change_status===`viewed`}function fs(e,t){return t.reduce((t,n)=>t+Number(n.sourceId===e||n.targetId===e),0)}function ps(e){return Math.max(54,31+[...Zo(e.type).label].length*10)}function ms(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function hs(e=``){let t=2166136261;for(let n of e)t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0)%1e4/1e4}var gs=[`aria-label`],_s=t({__name:`GraphCanvas`,props:{graph:{},selectedItem:{}},emits:[`selectNode`,`selectEdge`],setup(t,{expose:n,emit:r}){let l=t,u=r,f=s(null),p=null;a(m),e(()=>l.graph,m,{deep:!1}),e(()=>y(),m),e([()=>l.selectedItem?.itemKind,()=>l.selectedItem?.id],h),i(()=>p?.destroy()),n({zoomIn:()=>p?.zoomIn(),zoomOut:()=>p?.zoomOut(),fit:()=>p?.fit(),reset:()=>p?.reset(),clearSelection:()=>p?.clearSelection(),selectItem:(e,t)=>p?.selectItem(e,t)??!1,focusByNames:(e,t)=>p?.focusByNames(e,t)??0});async function m(){await _(),f.value&&(p?.destroy(),p=as(f.value,l.graph,{onNodeSelect:e=>u(`selectNode`,e),onEdgeSelect:e=>u(`selectEdge`,e)}),h())}function h(){let e=l.selectedItem;e&&p?.selectItem(e.itemKind,e.id)}return(e,t)=>(o(),c(`svg`,{id:`knowledge-graph`,ref_key:`svg`,ref:f,class:`knowledge-graph-canvas`,viewBox:`0 0 1000 620`,role:`img`,"aria-label":S(d)(`knowledge.workspace.graph.aria`)},null,8,gs))}}),vs={key:0,class:`graph-relation-legend`},ys=[`viewBox`],bs={class:`graph-relation-legend-panel`},xs=[`viewBox`],Ss=[`d`],Cs=t({__name:`GraphRelationLegend`,props:{relationTypes:{}},setup(e){let t=e,n=w(()=>$o(t.relationTypes));return(e,t)=>n.value.length?(o(),c(`details`,vs,[D(`summary`,null,[(o(),c(`svg`,{viewBox:S(qo),"aria-hidden":`true`},[...t[0]||=[D(`path`,{d:`M5 5h4v4H5zM15 15h4v4h-4zM9 7h4a4 4 0 0 1 4 4v4`},null,-1)]],8,ys)),D(`span`,null,b(S(d)(`knowledge.workspace.graph.legend`)),1),D(`small`,null,b(n.value.length),1),t[1]||=D(`i`,{"aria-hidden":`true`},null,-1)]),D(`div`,bs,[D(`header`,null,[D(`strong`,null,b(S(d)(`knowledge.workspace.graph.legend`)),1),D(`span`,null,b(S(d)(`knowledge.workspace.graph.legendCopy`)),1)]),D(`ul`,null,[(o(!0),c(m,null,r(n.value,e=>(o(),c(`li`,{key:e.type},[(o(),c(`svg`,{viewBox:S(qo),"aria-hidden":`true`},[D(`path`,{d:e.iconPath},null,8,Ss)],8,xs)),D(`span`,null,[D(`strong`,null,b(e.label),1),D(`small`,null,b(e.description),1)])]))),128))])])])):E(``,!0)}}),ws=[`aria-label`],Ts=[`aria-label`],Es=[`aria-selected`],Ds=[`aria-selected`],Os={key:1,id:`directory-panel-knowledge`,class:`directory-tab-panel`,role:`tabpanel`,"aria-labelledby":`directory-tab-knowledge`},ks={class:`directory-section-heading`},As={class:`directory-section-copy`},js=[`aria-label`],Ms=[`aria-pressed`],Ns=[`aria-pressed`],Ps=[`aria-pressed`],Fs={class:`directory-section-count`},Is={class:`knowledge-table-head`,"aria-hidden":`true`},Ls={class:`knowledge-column-content`},Rs={class:`knowledge-column-quadrant`},zs={class:`knowledge-column-review`},Bs={class:`knowledge-column-type`},Vs={class:`knowledge-column-source`},Hs={class:`knowledge-column-time`},Us={class:`knowledge-column-validity`},Ws=[`data-item-key`,`onClick`],Gs={class:`knowledge-row-content`},Ks={class:`knowledge-row-title`},qs={class:`knowledge-row-type`},Js={class:`knowledge-row-source`},Ys={class:`knowledge-row-time`},Xs={class:`empty-state`},Zs={key:2,id:`directory-panel-materials`,class:`directory-tab-panel`,role:`tabpanel`,"aria-labelledby":`directory-tab-materials`},Qs={class:`directory-section-heading`},$s={class:`directory-section-copy`},ec={class:`directory-section-count`},tc=[`data-item-key`,`onClick`],nc={class:`project-material-copy`},rc={class:`project-material-type`},ic={class:`project-material-link`},ac={class:`empty-state`},oc=t({__name:`KnowledgeDirectoryPanel`,props:{personalProjectsOnly:{type:Boolean},directorySection:{},knowledgeTabCount:{},materialTabCount:{},contentStatus:{},currentItemCount:{},historicalItemCount:{},allItems:{},visibleItems:{},projectMaterialItems:{},visibleProjectMaterialItems:{},selectedItem:{},listResetKey:{},sourceLabel:{type:Function}},emits:[`change-section`,`update-status`,`select-item`],setup(e,{emit:t}){let r=e,i=t;function a(e){return`${e.itemKind}:${e.id}`}let s=w(()=>r.selectedItem?r.visibleItems.findIndex(e=>a(e)===a(r.selectedItem)):-1),u=w(()=>r.selectedItem?r.visibleProjectMaterialItems.findIndex(e=>a(e)===a(r.selectedItem)):-1);return(t,r)=>(o(),c(`section`,{class:g([`knowledge-directory-panel`,{"has-directory-tabs":e.personalProjectsOnly}]),"aria-label":e.directorySection===`materials`?S(d)(`knowledge.workspace.workspace.view.materialDirectory`):S(d)(`knowledge.workspace.workspace.view.knowledgeDirectory`)},[e.personalProjectsOnly?(o(),c(`div`,{key:0,class:`directory-kind-tabs`,role:`tablist`,"aria-label":S(d)(`knowledge.workspace.workspace.view.directoryTypeAria`)},[D(`button`,{id:`directory-tab-knowledge`,class:`directory-kind-tab`,type:`button`,role:`tab`,"aria-controls":`directory-panel-knowledge`,"aria-selected":e.directorySection===`knowledge`,onClick:r[0]||=e=>i(`change-section`,`knowledge`)},[D(`span`,null,b(S(d)(`knowledge.workspace.workspace.view.knowledgeContent`)),1),D(`small`,null,b(e.knowledgeTabCount),1)],8,Es),D(`button`,{id:`directory-tab-materials`,class:`directory-kind-tab`,type:`button`,role:`tab`,"aria-controls":`directory-panel-materials`,"aria-selected":e.directorySection===`materials`,onClick:r[1]||=e=>i(`change-section`,`materials`)},[D(`span`,null,b(S(d)(`knowledge.workspace.workspace.view.projectMaterials`)),1),D(`small`,null,b(e.materialTabCount),1)],8,Ds)],8,Ts)):E(``,!0),e.directorySection===`knowledge`?(o(),c(`div`,Os,[D(`header`,ks,[D(`div`,As,[D(`strong`,null,b(S(d)(`knowledge.workspace.workspace.view.knowledgeContent`)),1)]),D(`div`,{class:`knowledge-status-filter`,role:`group`,"aria-label":S(d)(`knowledge.workspace.workspace.view.knowledgeStatusAria`)},[D(`button`,{class:`knowledge-status-option`,"data-status":`current`,type:`button`,"aria-pressed":e.contentStatus===`current`,onClick:r[2]||=e=>i(`update-status`,`current`)},[T(b(S(d)(`common.status.current`))+` `,1),D(`span`,null,b(e.currentItemCount),1)],8,Ms),D(`button`,{class:`knowledge-status-option`,"data-status":`historical`,type:`button`,"aria-pressed":e.contentStatus===`historical`,onClick:r[3]||=e=>i(`update-status`,`historical`)},[T(b(S(d)(`common.status.invalid`))+` `,1),D(`span`,null,b(e.historicalItemCount),1)],8,Ns),D(`button`,{class:`knowledge-status-option`,"data-status":`all`,type:`button`,"aria-pressed":e.contentStatus===`all`,onClick:r[4]||=e=>i(`update-status`,`all`)},[T(b(S(d)(`common.status.all`))+` `,1),D(`span`,null,b(e.allItems.length),1)],8,Ps)],8,js),D(`small`,Fs,b(S(d)(`common.counts.items`,{count:e.visibleItems.length})),1)]),l(oe,{class:`knowledge-directory-virtual-list`,items:e.visibleItems,"row-height":68,"active-index":s.value,"reset-key":e.listResetKey,"item-key":a,label:S(d)(`knowledge.workspace.workspace.view.knowledgeDirectory`)},{header:n(()=>[D(`div`,Is,[D(`span`,Ls,b(S(d)(`knowledge.workspace.workspace.view.columns.content`)),1),D(`span`,Rs,b(S(d)(`knowledge.workspace.workspace.view.columns.quadrant`)),1),D(`span`,zs,b(S(d)(`knowledge.workspace.workspace.view.columns.review`)),1),D(`span`,Bs,b(S(d)(`knowledge.workspace.workspace.view.columns.type`)),1),D(`span`,Vs,b(S(d)(`knowledge.workspace.workspace.view.columns.source`)),1),D(`span`,Hs,b(S(d)(`knowledge.workspace.workspace.view.columns.updated`)),1),D(`span`,Us,b(S(d)(`knowledge.workspace.workspace.view.columns.validity`)),1)])]),default:n(({item:t})=>[D(`button`,{class:g([`knowledge-row`,{selected:e.selectedItem?.itemKind===t.itemKind&&e.selectedItem?.id===t.id}]),type:`button`,"data-item-key":a(t),onClick:e=>i(`select-item`,t)},[D(`span`,Gs,[D(`span`,Ks,[D(`strong`,null,b(t.title),1),t.humanChangeStatus===`unseen`||t.humanChangeStatus===`viewed`?(o(),c(`em`,{key:0,class:g([`human-change-badge`,`state-${t.humanChangeStatus}`])},b(S(H)(t.humanChangeStatus)),3)):E(``,!0)]),D(`small`,null,b(t.profileAspect?`${S(fe)(t.profileAspect)} · ${t.body}`:t.body),1)]),D(`span`,{class:g([`knowledge-row-quadrant`,t.originQuadrant])},b(S(me)(t.originQuadrant)),3),D(`span`,{class:g([`knowledge-review-state`,`state-${S(ge)(t)}`])},b(S(pe)(t)),3),D(`span`,qs,b(t.type),1),D(`span`,Js,b(e.sourceLabel(t)),1),D(`span`,Ys,b(S(we)(S(Te)(t))),1),D(`span`,{class:g([`knowledge-status`,t.invalidAt?`historical`:`current`])},b(t.invalidAt?S(d)(`common.status.invalid`):S(d)(`knowledge.workspace.workspace.view.active`)),3)],10,Ws)]),empty:n(()=>[D(`div`,Xs,b(e.allItems.length?S(d)(`knowledge.workspace.workspace.view.noFilteredKnowledge`):S(d)(`knowledge.workspace.workspace.view.noKnowledge`)),1)]),_:1},8,[`items`,`active-index`,`reset-key`,`label`])])):(o(),c(`div`,Zs,[D(`header`,Qs,[D(`div`,$s,[D(`strong`,null,b(S(d)(`knowledge.workspace.workspace.view.projectMaterials`)),1)]),D(`small`,ec,b(S(d)(`common.counts.items`,{count:e.visibleProjectMaterialItems.length})),1)]),l(oe,{class:`project-material-virtual-list`,items:e.visibleProjectMaterialItems,"row-height":61,"active-index":u.value,"reset-key":e.listResetKey,"item-key":a,label:S(d)(`knowledge.workspace.workspace.view.materialDirectory`)},{default:n(({item:t})=>[D(`button`,{class:g([`project-material-row`,{selected:e.selectedItem?.itemKind===t.itemKind&&e.selectedItem?.id===t.id}]),type:`button`,"data-item-key":a(t),onClick:e=>i(`select-item`,t)},[D(`span`,nc,[D(`strong`,null,b(t.itemKind===`entity`?t.title:t.type),1),D(`small`,null,b(t.body),1)]),D(`span`,rc,b(S(Ee)(t)),1),D(`span`,ic,b(S(d)(`knowledge.workspace.workspace.view.viewDetails`)),1)],10,tc)]),empty:n(()=>[D(`div`,ac,b(e.projectMaterialItems.length?S(d)(`knowledge.workspace.workspace.view.noFilteredMaterials`):S(d)(`knowledge.workspace.workspace.view.noMaterials`)),1)]),_:1},8,[`items`,`active-index`,`reset-key`,`label`])]))],10,ws))}}),sc=[`disabled`],cc={class:`knowledge-project-source`},lc={class:`ui-meta`},uc={class:`knowledge-project-mode`},dc=[`disabled`],fc={key:0,class:`knowledge-project-fields`},pc={class:`ui-field`},mc={class:`ui-field`},hc={class:`ui-field knowledge-project-wide`},gc={key:2,class:`knowledge-project-relation`},_c={class:`ui-check`},vc={class:`ui-meta`},yc={class:`knowledge-project-preview`},bc={key:1},xc={class:`ui-meta`},Sc={key:2,class:`knowledge-project-compare`},Cc={class:`ui-meta`},wc={class:`ui-meta`},Tc={key:3,class:`knowledge-project-conflict-options`},Ec={class:`ui-check`},Dc={class:`ui-check`},Oc={class:`ui-check`},kc={class:`ui-check`},Ac={class:`ui-field`},jc=N(t({__name:`KnowledgeProjectDialog`,props:{item:{},personalSpaceId:{},personalProjectId:{},projects:{}},emits:[`close`,`saved`],setup(t,{emit:r}){let i=t,a=r,m=O(),h=s(`create`),_=s(``),y=s(``),x=s(``),A=s(``),j=s(!0),N=s(`RELATED_TO`),F=s(`defer`),ee=s(``),I=s(null),re=s(!1),L=s(!1),R=s(``),z=s(!1),B=0,V=w(()=>i.item?.itemKind===`entity`?i.item.raw:null),oe=w(()=>i.item?.assignments.at(0)?.project_id??i.item?.evidence.find(({personal_project_id:e})=>e)?.personal_project_id??i.personalProjectId??null),se=w(()=>i.projects.filter(({project_id:e})=>e!==oe.value)),ce=w(()=>se.value.map(e=>({value:e.project_id,label:e.profile.name,meta:`#${ae(e.project_id,26)}`,search:ie(e.project_id)}))),le=w(()=>se.value.find(({project_id:e})=>e===_.value)??null),ue=w(()=>{if(h.value===`create`)return{label:d(`projects.knowledgeDialog.previews.create.label`),title:d(`projects.knowledgeDialog.previews.create.title`),copy:oe.value?d(`projects.knowledgeDialog.previews.create.linkedCopy`):d(`projects.knowledgeDialog.previews.create.ownedCopy`)};if(re.value)return{label:d(`projects.knowledgeDialog.previews.checking.label`),title:d(`projects.knowledgeDialog.previews.checking.title`),copy:d(`projects.knowledgeDialog.previews.checking.copy`)};if(!I.value)return{label:d(`projects.knowledgeDialog.previews.waiting.label`),title:d(`projects.knowledgeDialog.previews.waiting.title`),copy:d(`projects.knowledgeDialog.previews.waiting.copy`)};let e=Object.fromEntries([`none`,`already_linked`,`exact_duplicate`,`conflict`].map(e=>[e,[d(`projects.knowledgeDialog.previews.outcomes.${e}.title`),d(`projects.knowledgeDialog.previews.outcomes.${e}.copy`)]])),[t,n]=e[I.value.match.kind]??e.none;return{label:t,title:n,copy:I.value.match.reason}}),de=w(()=>{let e=h.value===`existing`?d(`projects.knowledgeDialog.relationActors.sourceProject`):d(`projects.knowledgeDialog.relationActors.newProject`),t=h.value===`existing`?d(`projects.knowledgeDialog.relationActors.targetProject`):d(`projects.knowledgeDialog.relationActors.sourceProject`);return{RELATED_TO:d(`projects.knowledgeDialog.relations.related`,{object:t}),PART_OF:d(`projects.knowledgeDialog.relations.partOf`,{subject:e,object:t}),USES_KNOWLEDGE_FROM:d(`projects.knowledgeDialog.relations.usesKnowledge`,{subject:e,object:t}),DEPENDS_ON:d(`projects.knowledgeDialog.relations.dependsOn`,{subject:e,object:t}),PROVIDES_TO:d(`projects.knowledgeDialog.relations.providesTo`,{subject:e,object:t}),SHARES_CAPABILITY_WITH:d(`projects.knowledgeDialog.relations.sharesCapability`,{object:t}),SUCCESSOR_OF:d(`projects.knowledgeDialog.relations.successorOf`,{subject:e,object:t})}}),fe=w(()=>Object.entries(de.value).map(([e,t])=>({value:e,label:t}))),pe=w(()=>h.value===`create`?d(`projects.knowledgeDialog.actions.create`):I.value?.match.kind===`exact_duplicate`?d(`projects.knowledgeDialog.actions.reuse`):d(`projects.knowledgeDialog.actions.add`)),me=w(()=>h.value===`create`?d(`projects.knowledgeDialog.actions.creating`):I.value?.match.kind===`exact_duplicate`?d(`projects.knowledgeDialog.actions.reusing`):d(`projects.knowledgeDialog.actions.adding`)),he=w(()=>L.value||h.value===`existing`&&(re.value||!I.value));e(()=>i.item,e=>{B+=1,I.value=null,re.value=!1,R.value=``,h.value=`create`,z.value=!1;let t=e?.itemKind===`entity`?e.raw:null;y.value=t?.name??``,x.value=H(t?.name??``),A.value=t?.summary??``,ee.value=t?d(`projects.knowledgeDialog.defaultReason`,{name:t.name}):``,j.value=!0,N.value=`RELATED_TO`,F.value=`defer`,_.value=se.value[0]?.project_id??``},{immediate:!0}),e(y,e=>{z.value||(x.value=H(e))}),e([h,_,()=>i.item],()=>{h.value===`existing`?ge():(B+=1,I.value=null,re.value=!1,R.value=``)});async function ge(){let e=i.item;if(!e||e.itemKind!==`entity`||!_.value)return;let t=++B;re.value=!0,I.value=null,R.value=``;try{let n=await k(`/api/knowledge/entity/${encodeURIComponent(e.id)}/project-action/preview`,{personalSpaceId:i.personalSpaceId,targetProjectId:_.value});if(t!==B||i.item?.id!==e.id)return;I.value=n,n.match.kind===`conflict`&&(F.value=`defer`)}catch(e){if(t!==B)return;ye(ve(e)),m.reportError(e)}finally{t===B&&(re.value=!1)}}async function _e(){if(L.value)return;let e=i.item;if(!(!e||e.itemKind!==`entity`)){if(h.value===`create`&&(!y.value.trim()||!x.value.trim()))return ye(d(`projects.knowledgeDialog.errors.projectIdentityRequired`));if(h.value===`existing`&&!_.value)return ye(d(`projects.knowledgeDialog.errors.targetRequired`));if(h.value===`existing`&&!I.value)return ye(d(`projects.knowledgeDialog.errors.previewRequired`));if(!ee.value.trim())return ye(d(`projects.knowledgeDialog.errors.reasonRequired`));L.value=!0,R.value=``;try{let t=await k(`/api/knowledge/entity/${encodeURIComponent(e.id)}/project-action`,{personalSpaceId:i.personalSpaceId,mode:h.value,targetProjectId:h.value===`existing`?_.value:null,newProjectId:h.value===`create`?x.value.trim():null,newProjectName:h.value===`create`?y.value.trim():null,newProjectPurpose:h.value===`create`?A.value.trim():null,keepSourceRelation:!!(oe.value&&j.value),relationType:N.value,conflictResolution:F.value,reason:ee.value.trim()}),n=h.value===`create`?y.value.trim():le.value?.profile.name??d(`projects.knowledgeDialog.relationActors.targetProject`);a(`close`),a(`saved`,t,n)}catch(e){ye(ve(e)),m.reportError(e)}finally{L.value=!1}}}function H(e){return e.normalize(`NFKC`).toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,128)||`new-project`}function ve(e){let t=e instanceof Error?e.message:String(e);try{let e=JSON.parse(t);return e.message??e.detail??t}catch{return t}}function ye(e){R.value=e}return(e,r)=>t.item?(o(),f(te,{key:0,open:``,class:`knowledge-project-dialog`,size:`lg`,form:``,busy:L.value,error:R.value,title:S(d)(`projects.knowledgeDialog.title`),description:S(d)(`projects.knowledgeDialog.intro`),onClose:r[15]||=e=>a(`close`),onSubmit:_e},{footer:n(()=>[l(P,{variant:`ghost`,disabled:L.value,onClick:r[14]||=e=>a(`close`)},{default:n(()=>[T(b(S(d)(`common.actions.cancel`)),1)]),_:1},8,[`disabled`]),l(P,{variant:`primary`,type:`submit`,disabled:he.value,busy:L.value,"busy-label":me.value},{default:n(()=>[T(b(pe.value),1)]),_:1},8,[`disabled`,`busy`,`busy-label`])]),default:n(()=>[D(`fieldset`,{class:`knowledge-project-body`,disabled:L.value},[D(`div`,cc,[D(`span`,lc,b(S(d)(`projects.knowledgeDialog.sourceNode`)),1),D(`strong`,null,b(V.value?.name),1),D(`p`,null,b(V.value?.summary||S(d)(`common.status.noDescription`)),1)]),D(`fieldset`,uc,[D(`legend`,null,b(S(d)(`projects.knowledgeDialog.chooseAction`)),1),D(`label`,null,[u(D(`input`,{"onUpdate:modelValue":r[0]||=e=>h.value=e,type:`radio`,value:`create`},null,512),[[C,h.value]]),D(`span`,null,[D(`strong`,null,b(S(d)(`projects.knowledgeDialog.createNew`)),1),D(`small`,null,b(S(d)(`projects.knowledgeDialog.createNewCopy`)),1)])]),D(`label`,{class:g({disabled:se.value.length===0})},[u(D(`input`,{"onUpdate:modelValue":r[1]||=e=>h.value=e,type:`radio`,value:`existing`,disabled:se.value.length===0},null,8,dc),[[C,h.value]]),D(`span`,null,[D(`strong`,null,b(S(d)(`projects.knowledgeDialog.addExisting`)),1),D(`small`,null,b(S(d)(`projects.knowledgeDialog.addExistingCopy`)),1)])],2)]),h.value===`create`?(o(),c(`section`,fc,[D(`label`,pc,[T(b(S(d)(`projects.knowledgeDialog.projectName`))+` `,1),u(D(`input`,{"onUpdate:modelValue":r[2]||=e=>y.value=e,maxlength:`512`,required:``},null,512),[[p,y.value]])]),D(`label`,mc,[T(b(S(d)(`projects.knowledgeDialog.projectId`))+` `,1),u(D(`input`,{"onUpdate:modelValue":r[3]||=e=>x.value=e,maxlength:`128`,required:``,onInput:r[4]||=e=>z.value=!0},null,544),[[p,x.value]])]),D(`label`,hc,[T(b(S(d)(`projects.knowledgeDialog.purpose`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":r[5]||=e=>A.value=e,maxlength:`4096`,rows:`3`},null,512),[[p,A.value]])])])):(o(),f(ne,{key:1,modelValue:_.value,"onUpdate:modelValue":r[6]||=e=>_.value=e,field:``,options:ce.value,label:S(d)(`projects.knowledgeDialog.targetPersonalProject`),searchable:``,required:``},null,8,[`modelValue`,`options`,`label`])),oe.value?(o(),c(`section`,gc,[D(`label`,_c,[u(D(`input`,{"onUpdate:modelValue":r[7]||=e=>j.value=e,type:`checkbox`},null,512),[[v,j.value]]),D(`span`,null,[D(`strong`,null,b(S(d)(`projects.knowledgeDialog.preserveRelation`)),1),D(`small`,vc,b(S(d)(`projects.knowledgeDialog.preserveRelationCopy`)),1)])]),l(ne,{modelValue:N.value,"onUpdate:modelValue":r[8]||=e=>N.value=e,field:``,options:fe.value,label:S(d)(`projects.knowledgeDialog.projectRelation`),disabled:!j.value},null,8,[`modelValue`,`options`,`label`,`disabled`])])):E(``,!0),D(`section`,yc,[re.value?(o(),f(M,{key:0,variant:`compact`,label:S(d)(`projects.knowledgeDialog.previews.checking.title`)},null,8,[`label`])):(o(),c(`div`,bc,[D(`span`,xc,b(ue.value.label),1),D(`strong`,null,b(ue.value.title),1),D(`p`,null,b(ue.value.copy),1)])),I.value&&[`exact_duplicate`,`conflict`].includes(I.value.match.kind)?(o(),c(`div`,Sc,[D(`article`,null,[D(`span`,Cc,b(S(d)(`projects.knowledgeDialog.currentNode`)),1),D(`strong`,null,b(I.value.item_name),1),D(`p`,null,b(I.value.item_summary||S(d)(`common.status.noDescription`)),1)]),D(`article`,null,[D(`span`,wc,b(S(d)(`projects.knowledgeDialog.targetContent`)),1),D(`strong`,null,b(I.value.match.item_name||S(d)(`projects.knowledgeDialog.targetContentFallback`)),1),D(`p`,null,b(I.value.match.item_summary||S(d)(`common.status.noDescription`)),1)])])):E(``,!0),I.value?.match.kind===`conflict`?(o(),c(`fieldset`,Tc,[D(`legend`,null,b(S(d)(`projects.knowledgeDialog.conflictResolution`)),1),D(`label`,Ec,[u(D(`input`,{"onUpdate:modelValue":r[9]||=e=>F.value=e,type:`radio`,value:`defer`},null,512),[[C,F.value]]),D(`span`,null,b(S(d)(`projects.knowledgeDialog.defer`)),1)]),D(`label`,Dc,[u(D(`input`,{"onUpdate:modelValue":r[10]||=e=>F.value=e,type:`radio`,value:`keep_target`},null,512),[[C,F.value]]),D(`span`,null,b(S(d)(`projects.knowledgeDialog.keepTarget`)),1)]),D(`label`,Oc,[u(D(`input`,{"onUpdate:modelValue":r[11]||=e=>F.value=e,type:`radio`,value:`use_source`},null,512),[[C,F.value]]),D(`span`,null,b(S(d)(`projects.knowledgeDialog.useSource`)),1)]),D(`label`,kc,[u(D(`input`,{"onUpdate:modelValue":r[12]||=e=>F.value=e,type:`radio`,value:`coexist`},null,512),[[C,F.value]]),D(`span`,null,b(S(d)(`projects.knowledgeDialog.coexist`)),1)])])):E(``,!0)]),D(`label`,Ac,[T(b(S(d)(`projects.knowledgeDialog.operationReason`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":r[13]||=e=>ee.value=e,maxlength:`2048`,rows:`3`,required:``},null,512),[[p,ee.value]])])],8,sc)]),_:1},8,[`busy`,`error`,`title`,`description`])):E(``,!0)}}),[[`__scopeId`,`data-v-75e03db0`]]),Mc={class:`project-profile-fields`},Nc={class:`ui-field`},Pc={class:`ui-field project-profile-wide-field`},Fc=[`autofocus`,`placeholder`],Ic={class:`ui-field project-profile-wide-field`},Lc=[`autofocus`,`placeholder`],Rc={class:`ui-field project-profile-wide-field`},zc=[`placeholder`],Bc={class:`ui-field project-profile-wide-field`},Vc=[`autofocus`,`placeholder`],Hc={class:`ui-field-hint`},Uc={class:`project-source-editor`},Wc=[`autofocus`],Gc={class:`ui-meta`},Kc={key:0,class:`project-source-list`},qc={class:`ui-field`},Jc=[`onUpdate:modelValue`],Yc={class:`ui-field project-source-wide-field`},Xc=[`onUpdate:modelValue`,`placeholder`],Zc={class:`ui-field project-source-wide-field`},Qc=[`onUpdate:modelValue`],$c={key:1,class:`ui-meta`},el={class:`ui-meta`},tl=N(t({__name:`PersonalProjectProfileDialog`,props:{project:{},materialType:{}},emits:[`close`,`saved`],setup(t,{emit:i}){let a=t,h=i,g=s(``),_=s(``),v=s(``),y=s(``),x=s(`planned`),C=s(``),O=s([]),k=s(``),j=s(!1),M=new Set([`ProjectPurpose`,`ProjectScope`,`ProjectSource`,`ProjectBoundary`,`ProjectAssessment`,`AssessmentDimension`,`PersonalProject`,`RelatedPersonalProject`]),N=w(()=>{let e=a.materialType??``;return M.has(e)?d(`projects.profileDialog.materialTypes.${e}`):d(`projects.profileDialog.materialTypes.fallback`)}),F=[`prd`,`product_document`,`technical_document`,`frontend_repository`,`backend_repository`,`repository`,`design`,`runbook`,`monitoring`,`issue_tracker`,`other`],ee=w(()=>F.map(e=>({value:e,label:e===`prd`?`PRD`:d(`projects.profileDialog.sourceTypes.${e}`)}))),I=w(()=>[`planned`,`active`,`maintenance`,`archived`].map(e=>({value:e,label:d(`projects.profileDialog.lifecycles.${e}`)}))),re=[`normal`,`private`,`restricted`],L=w(()=>re.map(e=>({value:e,label:d(`projects.profileDialog.sensitivities.${e}`)}))),R=new Set(F),z=new Set(re);e(()=>[a.project,a.materialType],([e])=>{if(!e)return;let t=e.profile;g.value=t.name,_.value=t.purpose??``,v.value=t.scope??``,y.value=t.technical_summary??``,x.value=t.lifecycle??`planned`,C.value=(t.boundaries??[]).map(e=>String(e)).join(`
|
|
3
3
|
`),O.value=(t.sources??[]).map(B),k.value=``},{immediate:!0});function B(e,t){let n=typeof e.kind==`string`&&R.has(e.kind)?e.kind:`other`,r=typeof e.sensitivity==`string`&&z.has(e.sensitivity)?e.sensitivity:`normal`;return{key:V(e.key)||`source-${t+1}`,kind:n,title:V(e.title)||V(e.name),uri:V(e.uri),summary:V(e.summary),sensitivity:r}}function V(e){return typeof e==`string`?e:``}function ie(e){return e.trim()||null}function ae(){return[...new Set(C.value.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean))].slice(0,64)}function oe(){O.value.push({key:`source-${Date.now().toString(36)}-${O.value.length+1}`,kind:`other`,title:``,uri:``,summary:``,sensitivity:`normal`})}function se(e){O.value.splice(e,1)}async function ce(){if(!a.project||j.value)return;let e=g.value.trim();if(!e){k.value=d(`projects.profileDialog.errors.nameRequired`);return}if(O.value.some(e=>!e.title.trim())){k.value=d(`projects.profileDialog.errors.sourceNameRequired`);return}j.value=!0,k.value=``;try{let t=await A(`/api/personal-projects`,{personalSpaceId:a.project.personal_space_id,projectId:a.project.project_id,profile:{name:e,purpose:ie(_.value),scope:ie(v.value),technicalSummary:ie(y.value),lifecycle:x.value,sources:O.value.map(e=>({key:e.key,kind:e.kind,title:e.title.trim(),uri:ie(e.uri),summary:ie(e.summary),sensitivity:e.sensitivity})),boundaries:ae(),assessment:a.project.profile.assessment??null}});h(`saved`,t),h(`close`)}catch(e){k.value=e instanceof Error?e.message:d(`projects.profileDialog.errors.saveFailed`)}finally{j.value=!1}}return(e,i)=>t.project?(o(),f(te,{key:0,open:``,class:`project-profile-dialog`,size:`lg`,form:``,busy:j.value,error:k.value,title:S(d)(`projects.profileDialog.title`,{material:N.value}),description:S(d)(`projects.profileDialog.intro`),onClose:i[7]||=e=>h(`close`),onSubmit:ce},{footer:n(()=>[l(P,{variant:`ghost`,disabled:j.value,onClick:i[6]||=e=>h(`close`)},{default:n(()=>[T(b(S(d)(`common.actions.cancel`)),1)]),_:1},8,[`disabled`]),l(P,{variant:`primary`,type:`submit`,busy:j.value,"busy-label":S(d)(`projects.profileDialog.saving`)},{default:n(()=>[T(b(S(d)(`projects.profileDialog.save`)),1)]),_:1},8,[`busy`,`busy-label`])]),default:n(()=>[D(`div`,Mc,[D(`label`,Nc,[T(b(S(d)(`projects.profileDialog.projectName`))+` `,1),u(D(`input`,{"onUpdate:modelValue":i[0]||=e=>g.value=e,name:`project-name`,maxlength:`160`,required:``},null,512),[[p,g.value]])]),l(ne,{modelValue:x.value,"onUpdate:modelValue":i[1]||=e=>x.value=e,field:``,name:`project-lifecycle`,label:S(d)(`projects.profileDialog.lifecycle`),options:I.value},null,8,[`modelValue`,`label`,`options`]),D(`label`,Pc,[T(b(S(d)(`projects.profileDialog.purpose`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":i[2]||=e=>_.value=e,name:`project-purpose`,maxlength:`4096`,rows:`4`,autofocus:t.materialType===`ProjectPurpose`,placeholder:S(d)(`projects.profileDialog.purposePlaceholder`)},null,8,Fc),[[p,_.value]])]),D(`label`,Ic,[T(b(S(d)(`projects.profileDialog.scope`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":i[3]||=e=>v.value=e,name:`project-scope`,maxlength:`4096`,rows:`4`,autofocus:t.materialType===`ProjectScope`,placeholder:S(d)(`projects.profileDialog.scopePlaceholder`)},null,8,Lc),[[p,v.value]])]),D(`label`,Rc,[T(b(S(d)(`projects.profileDialog.technicalSummary`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":i[4]||=e=>y.value=e,name:`project-technical-summary`,maxlength:`4096`,rows:`4`,placeholder:S(d)(`projects.profileDialog.technicalPlaceholder`)},null,8,zc),[[p,y.value]])]),D(`label`,Bc,[T(b(S(d)(`projects.profileDialog.boundary`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":i[5]||=e=>C.value=e,name:`project-boundaries`,maxlength:`8192`,rows:`5`,autofocus:t.materialType===`ProjectBoundary`,placeholder:S(d)(`projects.profileDialog.boundaryPlaceholder`)},null,8,Vc),[[p,C.value]]),D(`small`,Hc,b(S(d)(`projects.profileDialog.boundaryHint`)),1)])]),D(`section`,Uc,[D(`div`,{class:`project-source-editor-heading`,tabindex:`-1`,autofocus:t.materialType===`ProjectSource`},[D(`div`,null,[D(`h3`,null,b(S(d)(`projects.profileDialog.sources`)),1),D(`p`,Gc,b(S(d)(`projects.profileDialog.sourcesCopy`)),1)]),l(P,{size:`sm`,onClick:oe},{default:n(()=>[T(b(S(d)(`projects.profileDialog.addSource`)),1)]),_:1})],8,Wc),O.value.length?(o(),c(`div`,Kc,[(o(!0),c(m,null,r(O.value,(e,t)=>(o(),c(`article`,{key:e.key,class:`project-source-row`},[D(`label`,qc,[T(b(S(d)(`projects.profileDialog.sourceName`))+` `,1),u(D(`input`,{"onUpdate:modelValue":t=>e.title=t,maxlength:`512`,required:``},null,8,Jc),[[p,e.title]])]),l(ne,{modelValue:e.kind,"onUpdate:modelValue":t=>e.kind=t,field:``,label:S(d)(`projects.profileDialog.sourceType`),options:ee.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`]),D(`label`,Yc,[T(b(S(d)(`projects.profileDialog.sourceUri`))+` `,1),u(D(`input`,{"onUpdate:modelValue":t=>e.uri=t,maxlength:`2048`,placeholder:S(d)(`projects.profileDialog.sourceUriPlaceholder`)},null,8,Xc),[[p,e.uri]])]),D(`label`,Zc,[T(b(S(d)(`projects.profileDialog.sourceSummary`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":t=>e.summary=t,maxlength:`4096`,rows:`2`},null,8,Qc),[[p,e.summary]])]),l(ne,{modelValue:e.sensitivity,"onUpdate:modelValue":t=>e.sensitivity=t,field:``,label:S(d)(`projects.profileDialog.sensitivity`),options:L.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`]),l(P,{class:`project-source-remove`,size:`sm`,variant:`danger`,onClick:e=>se(t)},{default:n(()=>[T(b(S(d)(`common.actions.remove`)),1)]),_:1},8,[`onClick`])]))),128))])):(o(),c(`p`,$c,b(S(d)(`projects.profileDialog.noSources`)),1))]),D(`p`,el,b(S(d)(`projects.profileDialog.stateBoundary`)),1)]),_:1},8,[`busy`,`error`,`title`,`description`])):E(``,!0)}}),[[`__scopeId`,`data-v-c4ab96eb`]]),nl={class:`publish-dialog-project`},rl={class:`ui-field`},il=[`placeholder`],al={class:`ui-field-hint`},ol={class:`ui-field`},sl=[`placeholder`],cl=[`aria-label`],ll=N(t({__name:`PublishProjectDialog`,props:{project:{}},emits:[`close`,`published`],setup(t,{emit:r}){let i=t,a=r,c=O(),m=s(``),h=s(``),g=s(``),_=s(!1),v=w(()=>c.state?.projects.find(({publication_key:e})=>e&&e===i.project?.publication_key)??null),y=w(()=>v.value?.current_release?.version??null),x=w(()=>c.state?.providers?.workspaces?.find(({status:e})=>e===`ready`)?.providerUrl??null);e(()=>i.project,e=>{e&&(m.value=A(y.value),h.value=``,g.value=``)},{immediate:!0});async function C(){if(!_.value&&i.project){if(!x.value){g.value=d(`projects.publishDialog.errors.providerUnavailable`);return}if(!m.value.trim()){g.value=d(`projects.publishDialog.errors.versionRequired`);return}if(!h.value.trim()){g.value=d(`projects.publishDialog.errors.summaryRequired`);return}_.value=!0,g.value=``;try{await k(`/api/projects/publish`,{personalSpaceId:c.activePersonalSpace?.id,localProjectId:i.project.project_id,providerUrl:x.value,releaseVersion:m.value.trim(),updateSummary:h.value.trim()}),c.notify(d(`projects.publishDialog.published`,{name:i.project.profile.name,version:m.value.trim()})),await c.refresh(),a(`close`),a(`published`)}catch(e){g.value=e instanceof Error?e.message:d(`projects.publishDialog.errors.failed`),c.reportError(e)}finally{_.value=!1}}}function A(e){if(!e||e===`legacy`)return`v1.0.0`;let t=e.match(/^(v?)(\d+)\.(\d+)\.(\d+)$/);return t?`${t[1]}${t[2]}.${t[3]}.${Number(t[4])+1}`:``}return(e,r)=>t.project?(o(),f(te,{key:0,open:``,class:`publish-dialog`,title:S(d)(`projects.publishDialog.title`),description:S(d)(`projects.publishDialog.warning`),busy:_.value,error:g.value,onClose:r[3]||=e=>a(`close`)},{footer:n(()=>[l(P,{variant:`ghost`,disabled:_.value,onClick:r[2]||=e=>a(`close`)},{default:n(()=>[T(b(S(d)(`common.actions.cancel`)),1)]),_:1},8,[`disabled`]),l(P,{variant:`primary`,busy:_.value,"busy-label":S(d)(`projects.publishDialog.publishing`),onClick:C},{default:n(()=>[T(b(S(d)(`projects.publishDialog.confirm`)),1)]),_:1},8,[`busy`,`busy-label`])]),default:n(()=>[D(`p`,nl,b(t.project.profile.name),1),D(`label`,rl,[T(b(S(d)(`projects.publishDialog.version`))+` `,1),u(D(`input`,{"onUpdate:modelValue":r[0]||=e=>m.value=e,maxlength:`64`,placeholder:S(d)(`projects.publishDialog.versionPlaceholder`)},null,8,il),[[p,m.value]]),D(`small`,al,b(y.value?S(d)(`projects.publishDialog.currentVersion`,{version:y.value}):S(d)(`projects.publishDialog.firstRelease`)),1)]),D(`label`,ol,[T(b(S(d)(`projects.publishDialog.summary`))+` `,1),u(D(`textarea`,{"onUpdate:modelValue":r[1]||=e=>h.value=e,maxlength:`4096`,rows:`4`,placeholder:S(d)(`projects.publishDialog.summaryPlaceholder`)},null,8,sl),[[p,h.value]])]),D(`dl`,{class:`publish-impact`,"aria-label":S(d)(`projects.publishDialog.impactAria`)},[D(`div`,null,[D(`dt`,null,b(S(d)(`projects.publishDialog.discoverable`)),1),D(`dd`,null,b(S(d)(`projects.publishDialog.discoverableCopy`)),1)]),D(`div`,null,[D(`dt`,null,b(S(d)(`projects.publishDialog.owner`)),1),D(`dd`,null,b(S(d)(`projects.publishDialog.ownerCopy`)),1)]),D(`div`,null,[D(`dt`,null,b(S(d)(`projects.publishDialog.syncProfile`)),1),D(`dd`,null,b(S(d)(`projects.publishDialog.syncProfileCopy`)),1)])],8,cl)]),_:1},8,[`title`,`description`,`busy`,`error`])):E(``,!0)}}),[[`__scopeId`,`data-v-c2b80db1`]]),ul=t({__name:`KnowledgeWorkspaceDialogs`,props:{editingItem:{},confirmingItem:{},projectActionItem:{},publishingProject:{},managingProject:{},managingMaterialType:{},personalSpaceId:{},editingProjectId:{},confirmingProjectId:{},currentProjectId:{},projects:{},replacementItems:{}},emits:[`close-edit`,`close-confirm`,`close-project-action`,`close-publish`,`close-profile`,`refresh`,`project-saved`,`profile-saved`],setup(e,{emit:t}){let n=t;function r(e,t){n(`project-saved`,e,t)}function i(e){n(`profile-saved`,e)}return(t,a)=>(o(),c(m,null,[l(de,{item:e.editingItem,"personal-space-id":e.personalSpaceId,"personal-project-id":e.editingProjectId,projects:e.projects,"replacement-items":e.replacementItems,onClose:a[0]||=e=>n(`close-edit`),onSaved:a[1]||=e=>n(`refresh`)},null,8,[`item`,`personal-space-id`,`personal-project-id`,`projects`,`replacement-items`]),l(le,{item:e.confirmingItem,"personal-space-id":e.personalSpaceId,"personal-project-id":e.confirmingProjectId,onClose:a[2]||=e=>n(`close-confirm`),onSaved:a[3]||=e=>n(`refresh`)},null,8,[`item`,`personal-space-id`,`personal-project-id`]),l(jc,{item:e.projectActionItem,"personal-space-id":e.personalSpaceId,"personal-project-id":e.currentProjectId,projects:e.projects,onClose:a[4]||=e=>n(`close-project-action`),onSaved:r},null,8,[`item`,`personal-space-id`,`personal-project-id`,`projects`]),l(ll,{project:e.publishingProject,onClose:a[5]||=e=>n(`close-publish`),onPublished:a[6]||=e=>n(`refresh`)},null,8,[`project`]),l(tl,{project:e.managingProject,"material-type":e.managingMaterialType,onClose:a[7]||=e=>n(`close-profile`),onSaved:i},null,8,[`project`,`material-type`])],64))}}),dl=[`aria-label`],fl=[`aria-label`],pl=t({__name:`ProjectHierarchyAside`,props:{parents:{},activeProjectName:{},spaceId:{}},setup(e){let t=e;function i(){return t.activeProjectName||d(`knowledge.workspace.hierarchy.currentProject`)}return(t,a)=>e.parents.length?(o(),c(`aside`,{key:0,class:`project-hierarchy-aside`,"aria-label":S(d)(`knowledge.workspace.hierarchy.aria`)},[D(`header`,null,[D(`span`,null,b(S(d)(`knowledge.workspace.hierarchy.level`)),1),D(`strong`,null,b(S(d)(`knowledge.workspace.hierarchy.parents`)),1),D(`small`,null,b(S(d)(`common.counts.projects`,{count:e.parents.length})),1)]),D(`p`,null,b(S(d)(`knowledge.workspace.hierarchy.belongsTo`,{name:i()})),1),D(`nav`,{"aria-label":S(d)(`knowledge.workspace.hierarchy.listAria`)},[(o(!0),c(m,null,r(e.parents,t=>(o(),f(S(I),{key:t.nodeId,class:`project-parent-link`,to:S(L)(e.spaceId,`graph`,t.projectId),"aria-label":S(d)(`knowledge.workspace.hierarchy.openParent`,{name:t.name})},{default:n(()=>[a[0]||=D(`span`,{class:`project-parent-icon`,"aria-hidden":`true`},[D(`svg`,{viewBox:`0 0 24 24`},[D(`path`,{d:`M3 6h7l2 2h9v11H3zM12 16V9M9 12l3-3 3 3`})])],-1),D(`span`,null,[D(`small`,null,b(S(d)(`knowledge.workspace.hierarchy.parents`)),1),D(`strong`,null,b(t.name),1),D(`em`,null,b(S(d)(`knowledge.workspace.hierarchy.belongsToParent`,{name:i()})),1)]),a[1]||=D(`b`,{"aria-hidden":`true`},`→`,-1)]),_:2},1032,[`to`,`aria-label`]))),128))],8,fl)],8,dl)):E(``,!0)}}),ml={class:`project-team`,"aria-labelledby":`project-team-heading`},hl={class:`project-team-header`},gl={id:`project-team-heading`},_l={key:1,class:`project-team-stale`,role:`alert`},vl=[`aria-label`,`title`,`disabled`],yl={key:1,class:`project-team-state`,role:`alert`},bl=[`aria-expanded`,`aria-controls`,`aria-label`],xl={class:`project-team-avatar`,"aria-hidden":`true`},Sl={class:`project-team-lead-text`},Cl={class:`project-team-lead-name`},wl={class:`ui-meta`},Tl={key:0,class:`project-team-responsibility`},El={class:`ui-meta project-team-preview`},Dl={key:1,class:`project-team-state`,role:`status`},Ol=[`id`],kl={key:0,class:`project-team-list`},Al={class:`ui-meta`},jl={class:`project-team-list`},Ml={class:`project-team-avatar is-small`,"aria-hidden":`true`},Nl={class:`project-team-person`},Pl={key:0,class:`ui-meta`},Fl={key:0,class:`project-team-responsibility`},Il={key:1,class:`ui-meta`},Ll=t({__name:`ProjectTeamSummary`,props:{spaceId:{},projectId:{}},setup(t){let i=t,a=s(null),p=s(!1),h=s(!1),_=s(!1),v=ce(w(()=>p.value&&!a.value)),C=ce(w(()=>p.value&&!!a.value)),O=0,k=w(()=>`project-team-organization-${i.projectId}`),A=w(()=>({path:`/project-agents/manage`,query:{project:i.projectId}})),j=w(()=>{let e=a.value;if(!e)return``;let t=[];if(e.members.length){let n=new Intl.ListFormat(y(),{type:`conjunction`}).format(e.members.map(({name:e})=>e));t.push(`${d(`projects.overview.memberCount`,{count:e.members.length})} · ${n}`)}return e.collaborators.length&&t.push(d(`projects.overview.collaboratorCount`,{count:e.collaborators.length})),e.peers.length&&t.push(d(`projects.overview.peerCount`,{count:e.peers.length})),t.length?t.join(y()===`zh-CN`?`;`:`; `):d(`projects.overview.noMembers`)});e(()=>[i.spaceId,i.projectId],()=>{a.value=null,_.value=!1,N()},{immediate:!0});async function N(){if(!i.spaceId||!i.projectId)return;let e=++O;p.value=!0,h.value=!1;try{let t=await B(i.spaceId,i.projectId);e===O&&(a.value=t)}catch{e===O&&(h.value=!0)}finally{e===O&&(p.value=!1)}}function P(e){return e.occupationEmoji||[...e.name.trim()][0]?.toLocaleUpperCase()||`?`}function F(e){return e.employeeNumber?d(`projects.overview.employeeNumber`,{number:e.employeeNumber}):``}return(e,i)=>(o(),c(`section`,ml,[D(`header`,hl,[D(`h3`,gl,b(S(d)(`projects.overview.team`)),1),S(C)?(o(),f(M,{key:0,variant:`inline`,label:S(d)(`projects.overview.refreshingTeam`)},null,8,[`label`])):h.value&&a.value?(o(),c(`p`,_l,[T(b(S(d)(`projects.overview.refreshFailed`))+` `,1),D(`button`,{class:`quiet-button`,type:`button`,onClick:N},b(S(d)(`projects.overview.retry`)),1)])):E(``,!0),D(`button`,{class:`toolbar-action ui-button--icon`,type:`button`,"aria-label":S(d)(`projects.overview.refresh`),title:S(d)(`projects.overview.refresh`),disabled:p.value,onClick:N},[...i[1]||=[D(`svg`,{class:`project-team-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[D(`path`,{d:`M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5`})],-1)]],8,vl)]),S(v)?(o(),f(M,{key:0,variant:`compact`,label:S(d)(`projects.overview.loadingTeam`)},null,8,[`label`])):h.value&&!a.value?(o(),c(`div`,yl,[D(`p`,null,b(S(d)(`projects.overview.teamFailed`)),1),D(`button`,{class:`quiet-button`,type:`button`,onClick:N},b(S(d)(`projects.overview.retry`)),1)])):a.value?(o(),c(m,{key:2},[a.value.lead?(o(),c(`button`,{key:0,class:`project-team-lead`,type:`button`,"aria-expanded":_.value,"aria-controls":k.value,"aria-label":`${S(d)(`projects.overview.lead`)} ${a.value.lead.name}. ${_.value?S(d)(`projects.overview.hideOrganization`):S(d)(`projects.overview.showOrganization`)}`,onClick:i[0]||=e=>_.value=!_.value},[D(`span`,xl,b(P(a.value.lead)),1),D(`span`,Sl,[D(`span`,Cl,[D(`strong`,null,b(a.value.lead.name),1),D(`span`,wl,[T(b(S(d)(`projects.overview.lead`)),1),F(a.value.lead)?(o(),c(m,{key:0},[T(` · `+b(F(a.value.lead)),1)],64)):E(``,!0)])]),a.value.lead.responsibility?(o(),c(`span`,Tl,b(a.value.lead.responsibility),1)):E(``,!0),D(`span`,El,b(j.value),1)]),i[2]||=D(`svg`,{class:`project-team-chevron`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[D(`path`,{d:`m6 9 6 6 6-6`})],-1)],8,bl)):(o(),c(`div`,Dl,[D(`p`,null,[a.value.status===`lead_unavailable`?(o(),c(m,{key:0},[T(b(a.value.unavailableLead?.name?S(d)(`projects.overview.leadUnavailable`,{name:a.value.unavailableLead.name}):S(d)(`projects.overview.leadUnavailableUnnamed`)),1)],64)):(o(),c(m,{key:1},[T(b(S(d)(`projects.overview.noLead`)),1)],64))]),l(S(I),{class:`primary-button`,to:A.value},{default:n(()=>[T(b(a.value.status===`lead_unavailable`?S(d)(`projects.overview.changeLead`):S(d)(`projects.overview.setLead`)),1)]),_:1},8,[`to`])])),u(D(`div`,{id:k.value,class:`project-team-organization`},[a.value.lead?(o(),c(`ul`,kl,[D(`li`,null,[l(z,{"space-id":t.spaceId,"agent-id":a.value.lead.agentId,name:a.value.lead.name},null,8,[`space-id`,`agent-id`,`name`]),D(`span`,Al,[T(b(S(d)(`projects.overview.lead`)),1),F(a.value.lead)?(o(),c(m,{key:0},[T(` · `+b(F(a.value.lead)),1)],64)):E(``,!0)])])])):E(``,!0),(o(!0),c(m,null,r([{key:`members`,title:S(d)(`projects.overview.members`),people:a.value.members},{key:`collaborators`,title:S(d)(`projects.overview.collaborators`),people:a.value.collaborators},{key:`peers`,title:S(d)(`projects.overview.peers`),people:a.value.peers}],e=>(o(),c(m,{key:e.key},[e.people.length?(o(),c(`div`,{key:0,class:g([`project-team-group`,`is-${e.key}`])},[D(`h4`,null,b(e.title),1),D(`ul`,jl,[(o(!0),c(m,null,r(e.people,e=>(o(),c(`li`,{key:e.agentId},[D(`span`,Ml,b(P(e)),1),D(`span`,Nl,[D(`span`,null,[l(z,{"space-id":t.spaceId,"agent-id":e.agentId,name:e.name},null,8,[`space-id`,`agent-id`,`name`]),F(e)?(o(),c(`span`,Pl,` · `+b(F(e)),1)):E(``,!0)]),e.responsibility?(o(),c(`span`,Fl,b(e.responsibility),1)):E(``,!0)])]))),128))])],2)):E(``,!0)],64))),128)),a.value.unavailableMemberIds.length?(o(),c(`p`,Il,[T(b(S(d)(`projects.overview.unavailableMembers`,{count:a.value.unavailableMemberIds.length}))+` `,1),l(S(I),{to:A.value},{default:n(()=>[T(b(S(d)(`projects.overview.unavailableMembersLink`)),1)]),_:1},8,[`to`])])):E(``,!0)],8,Ol),[[x,_.value||!a.value.lead]])],64)):E(``,!0)]))}}),Rl={class:`project-overview`},zl={class:`project-overview-header`},Bl={class:`project-overview-title`},Vl={key:0,class:`project-overview-purpose`},Hl={key:1,class:`ui-meta`},Ul={class:`project-overview-actions`},Wl=[`aria-label`,`title`],Gl=t({__name:`ProjectOverview`,props:{spaceId:{},project:{},canPublish:{type:Boolean}},emits:[`edit-profile`,`publish`],setup(e){return(t,n)=>(o(),c(`div`,Rl,[D(`header`,zl,[D(`div`,Bl,[D(`h2`,null,b(e.project.profile.name),1),e.project.profile.purpose?(o(),c(`p`,Vl,b(e.project.profile.purpose),1)):(o(),c(`p`,Hl,b(S(d)(`projects.overview.noPurpose`)),1))]),D(`div`,Ul,[e.canPublish?(o(),c(`button`,{key:0,class:`toolbar-action`,type:`button`,onClick:n[0]||=e=>t.$emit(`publish`)},b(S(d)(`knowledge.workspace.workspace.view.publishProject`)),1)):E(``,!0),D(`button`,{class:`toolbar-action ui-button--icon`,type:`button`,"aria-label":S(d)(`projects.overview.editProfile`),title:S(d)(`projects.overview.editProfile`),onClick:n[1]||=e=>t.$emit(`edit-profile`)},[...n[2]||=[D(`svg`,{class:`project-team-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[D(`path`,{d:`M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4`})],-1)]],8,Wl)])]),l(Ll,{"space-id":e.spaceId,"project-id":e.project.project_id},null,8,[`space-id`,`project-id`])]))}}),Kl=15,ql=4;async function Jl({personalSpaceId:e,projects:t,query:n,baseline:r,signal:i,limit:a=Kl,request:o=j}){let s=Xl(r),c=t.slice(0,a),l=[];for(let t=0;t<c.length;t+=ql){i?.throwIfAborted();let r=c.slice(t,t+ql);l.push(...await Promise.all(r.map(async t=>{try{let r=Zl(await o(`/api/search?${new URLSearchParams({personalSpaceId:e,personalProjectId:t.project_id,q:n,limit:`30`})}`,{signal:i})).filter(({key:e})=>!s.has(e));return r.length?{status:`matched`,project:t,count:r.length,score:Math.max(...r.map(({score:e})=>e??0))}:{status:`empty`,project:t}}catch(e){if(i?.aborted)throw e;return{status:`failed`,project:t}}})))}return{matches:l.filter(e=>e.status===`matched`).sort((e,t)=>t.score-e.score||t.count-e.count||e.project.profile.name.localeCompare(t.project.profile.name)),checked:l.length,total:t.length,failed:l.filter(({status:e})=>e===`failed`).length}}function Yl(e){let t=e.failed?d(`knowledge.domain.discovery.failedSuffix`,{count:e.failed}):``;return e.matches.length?d(`knowledge.domain.discovery.matches`,{failure:t}):e.total?e.failed===e.checked?d(`knowledge.domain.discovery.allFailed`):e.checked<e.total?d(`knowledge.domain.discovery.checkedPartial`,{checked:e.checked,total:e.total,failure:t}):d(`knowledge.domain.discovery.checkedAll`,{failure:t}):d(`knowledge.domain.discovery.noOtherProjects`)}function Xl(e){return new Set(Zl(e).map(({key:e})=>e))}function Zl(e){return[...(e.entities??[]).map(e=>({key:`entity:${e.id}`,score:e.score})),...(e.facts??[]).map(e=>({key:`fact:${e.id}`,score:e.score}))]}function Ql(e,t){if(!t)return{graph:e,parents:[]};let n=e.nodes.find(e=>e.type===`PersonalProject`&&e.attributes?.projectId===t);if(!n)return{graph:e,parents:[]};let r=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges){if(t.type!==`PART_OF`||$l(t.source)!==n.id)continue;let e=r.get($l(t.target));if(!e||!eu(e))continue;let a=e.attributes?.projectId;typeof a!=`string`||!a||i.has(e.id)||i.set(e.id,{projectId:a,name:e.name,summary:e.summary||d(`knowledge.domain.hierarchy.parentSummary`),nodeId:e.id,relationId:t.id})}if(!i.size)return{graph:e,parents:[]};let a=new Set(i.keys()),o=e.nodes.filter(({id:e})=>!a.has(e)),s=new Set(o.map(({id:e})=>e)),c=e.edges.filter(e=>s.has($l(e.source))&&s.has($l(e.target)));return{graph:{...e,nodes:o,edges:c},parents:[...i.values()]}}function $l(e){return typeof e==`object`&&e?e.id:e}function eu(e){return e.type===`PersonalProject`||e.type===`RelatedPersonalProject`}var tu={class:`knowledge-view-heading`},nu=[`aria-label`],ru=[`aria-selected`],iu=[`aria-selected`],au=[`aria-selected`],ou={key:2,class:`muted`},su={key:2,class:`project-overview-failed`,role:`alert`},cu={key:3,class:`muted`,role:`status`},lu={class:`graph-toolbar`},uu={key:0,class:`personal-context-picker`},du={class:`personal-context-panel`},fu={class:`personal-context-list`},pu=[`value`,`checked`],mu=[`aria-label`],hu=[`placeholder`,`aria-label`,`value`],gu={class:`graph-view-actions`},_u=[`aria-label`],vu=[`aria-label`],yu=[`aria-label`],bu=[`aria-label`,`title`],xu={class:`knowledge-filter-controls`},Su={key:2,class:`view-loading`,"aria-busy":`true`},Cu={class:`graph-canvas-panel`},wu={key:0,class:`graph-search-status`,"aria-live":`polite`},Tu={class:`graph-search-status-kicker`},Eu={class:`graph-search-status-title`},Du={key:1,class:`graph-search-status-copy`},Ou={key:2,class:`graph-search-suggestions`},ku={key:3,class:`graph-empty`},Au={key:4,class:`graph-hint`},ju=t({__name:`KnowledgeWorkspace`,props:{personalProjectsOnly:{type:Boolean,default:!1}},setup(t){let a=t,u=O(),p=ee(),v=F(),y=s(!1),x=s(null),C=ue(),k=w(()=>C||y.value&&!x.value),A=ce(k),N=s(null),te=s(null),z=s($t(p.query.q)),B=s(``),V=s(!1),oe=s(null),le=s(null),de=s(null),fe=s(null),pe=s(null),ge=s(null),H=s(null),we=new Set,Te=0,ke=0,Ae=null,je=null,U=w(()=>a.personalProjectsOnly?`personal`:p.params.scope===`public`?`public`:`personal`),W=w(()=>String(p.params.spaceId??u.activePersonalSpace?.id??``)),G=w(()=>{let e=p.params.projectId;return typeof e==`string`&&e?e:null}),Me=w(()=>a.personalProjectsOnly&&!!G.value),K=w(()=>p.params.mode===`graph`?`graph`:p.params.mode===`overview`&&Me.value?`overview`:`directory`),Ne=w(()=>en(p.query.context)),Pe=w(()=>JSON.stringify([a.personalProjectsOnly,U.value,W.value,G.value,Ne.value])),Fe=w(()=>ye(x.value)),Ie=w(()=>a.personalProjectsOnly?De(x.value):[]),Le=w(()=>{let e=z.value.trim().toLocaleLowerCase();return e?Ie.value.filter(t=>[t.title,t.body,t.type,Ee(t)].some(t=>t.toLocaleLowerCase().includes(e))):Ie.value}),Re=w(()=>[...Ie.value,...Fe.value]),ze=w(()=>a.personalProjectsOnly?K.value===`directory`&&N.value?ve(N.value)?`materials`:`knowledge`:$t(p.query.section)===`materials`?`materials`:`knowledge`:`knowledge`),Be=w(()=>[...new Set(Fe.value.map(({type:e})=>e))].sort()),Ve=w(()=>[{value:`all`,label:d(`knowledge.workspace.workspace.filters.allTypes`)},...Be.value.map(e=>({value:e,label:e}))]),He=w(()=>[{value:`all`,label:d(`knowledge.workspace.workspace.filters.allQuadrants`)},...[`known_known`,`known_unknown`,`unknown_known`,`unknown_unknown`].map(e=>({value:e,label:me(e)}))]),Ue=w(()=>[{value:`all`,label:d(`knowledge.workspace.workspace.filters.allKnowledge`)},{value:`profile`,label:d(`knowledge.workspace.workspace.filters.preferences`)},{value:`regular`,label:d(`knowledge.workspace.workspace.filters.projectKnowledge`)}]),We=w(()=>[{value:`all`,label:d(`knowledge.workspace.workspace.filters.allHumanStates`)},{value:`human_changed`,label:d(`knowledge.workspace.workspace.filters.allHumanChanged`)},{value:`unseen`,label:d(`knowledge.workspace.workspace.filters.agentUnseen`)},{value:`viewed`,label:d(`knowledge.workspace.workspace.filters.viewedPending`)},{value:`reviewed`,label:d(`knowledge.workspace.workspace.filters.agentReviewed`)}]),Ge=w(()=>{let e=$t(p.query.status);return e===`historical`||e===`all`?e:`current`}),Ke=w(()=>({query:z.value,type:$t(p.query.type)||`all`,quadrant:$t(p.query.quadrant)||`all`,profile:$t(p.query.profile)||`all`,status:Ge.value,humanChange:$t(p.query.human)||`all`})),qe=w(()=>JSON.stringify([ze.value,Ke.value])),Je=w(()=>xe(Fe.value,Ke.value)),Ye=w(()=>Fe.value.filter(({invalidAt:e})=>!e).length),Xe=w(()=>Fe.value.length-Ye.value),Ze=w(()=>Ge.value===`current`?Ye.value:Ge.value===`historical`?Xe.value:Fe.value.length),Qe=w(()=>Ge.value===`current`?d(`common.status.current`):Ge.value===`historical`?d(`common.status.invalid`):d(`knowledge.workspace.workspace.status.all`)),$e=w(()=>x.value?Ce(x.value):null),et=w(()=>$e.value?Ql($e.value,G.value):null),tt=w(()=>et.value?.graph??null),nt=w(()=>et.value?.parents??[]),rt=w(()=>tt.value?.edges.map(({type:e})=>e)??[]),it=w(()=>{if(!x.value)return y.value?d(`common.status.loadingKnowledge`):d(`knowledge.workspace.workspace.status.graphUnread`);if(K.value===`graph`){let e=tt.value;return B.value||d(`knowledge.workspace.workspace.counts.graph`,{nodes:e?.nodes.length??0,edges:e?.edges.length??0})}return ze.value===`materials`?Le.value.length===Ie.value.length?d(`knowledge.workspace.workspace.counts.materials`,{count:Ie.value.length}):d(`knowledge.workspace.workspace.counts.visibleMaterials`,{visible:Le.value.length,total:Ie.value.length}):Je.value.length===Ze.value?d(`knowledge.workspace.workspace.counts.knowledge`,{status:Qe.value,count:Ze.value}):d(`knowledge.workspace.workspace.counts.visibleKnowledge`,{status:Qe.value,visible:Je.value.length,total:Ze.value})}),at=w(()=>String(Fe.value.length)),ot=w(()=>String(Ie.value.length)),st=w(()=>(u.state?.personalProjects??[]).filter(({personal_space_id:e})=>e===W.value)),ct=w(()=>st.value.filter(({project_id:e})=>e!==G.value)),lt=w(()=>{let e=u.state;if(!e)return[];let t=e.personalSpaces.flatMap(t=>[{key:Qt(`personal`,t.id,null),scope:`personal`,spaceId:t.id,projectId:null,providerUrl:null,label:d(`knowledge.workspace.workspace.spaces.allPersonalProjects`,{name:t.name})},...(e.personalProjects??[]).filter(({personal_space_id:e})=>e===t.id).map(e=>({key:Qt(`personal`,t.id,e.project_id),scope:`personal`,spaceId:t.id,projectId:e.project_id,providerUrl:null,label:d(`knowledge.workspace.workspace.spaces.personalProject`,{name:e.profile.name})}))]);if(a.personalProjectsOnly)return t;let n=e.projects.map(e=>({key:Qt(`public`,e.id,null),scope:`public`,spaceId:e.id,projectId:null,providerUrl:e.providerUrl,label:d(`knowledge.workspace.workspace.spaces.publicProject`,{name:e.name})}));return[...t,...n]}),ut=w(()=>Qt(U.value,W.value,G.value)),dt=w(()=>lt.value.map(e=>{let t=e.projectId??e.spaceId;return{value:e.key,label:e.label,meta:`#${ae(t,26)}`,search:ie(t)}})),ft=w(()=>U.value===`personal`),pt=w(()=>st.value.find(({project_id:e})=>e===G.value)??null),mt=w(()=>Kt(N.value)),ht=w(()=>H.value?H.value.checking?d(`knowledge.workspace.workspace.discovery.checking`):H.value.result?Yl(H.value.result):d(`knowledge.workspace.workspace.discovery.retry`):``),gt=Oe(()=>{At()},300);e([()=>u.state,()=>p.name,()=>p.params.mode,()=>p.params.spaceId],async([e])=>{e&&await _t()},{immediate:!0}),e([()=>u.state,Pe],async([e])=>{e&&await bt()},{immediate:!0}),e(()=>$t(p.query.q),e=>{e===z.value||we.has(e)||(gt.cancel(),Mt(),z.value=e,Nt(),K.value===`graph`&&e.trim()&&x.value&&!y.value&&je===Pe.value&&Pt(e.trim()))},{flush:`sync`}),e(K,async()=>{gt.cancel(),Mt(),Nt(),await _(),Rt(),At()}),e([()=>p.params.itemKind,()=>p.params.itemId],()=>Rt()),i(()=>{gt.cancel(),Mt()});async function _t(){let e=u.activePersonalSpace;if(e){if(p.name===`knowledge-default`){await v.replace(R(`personal`,e.id,`directory`));return}if(W.value===`current`){let t=a.personalProjectsOnly?L(e.id,K.value,G.value):R(U.value,e.id,K.value,{projectId:G.value});await v.replace({path:t,query:p.query});return}p.params.mode===`directory`||p.params.mode===`graph`||p.params.mode===`overview`&&Me.value||await wt(a.personalProjectsOnly?`graph`:`directory`,!0)}}function vt(e){if(!a.personalProjectsOnly||G.value||K.value!==`directory`||!e||e.itemKind!==`entity`||e.type!==`PersonalProject`)return null;let t=he(e);return st.value.some(({project_id:e})=>e===t)?t:null}async function yt(e,t){await v[t?`replace`:`push`](L(W.value,`overview`,e))}async function bt(){if(!W.value||W.value===`current`)return;let e=Pe.value,t=++Te;Mt(),y.value=!0,N.value=null,Nt();try{let n=G.value&&U.value===`personal`?await xt():await St(G.value);if(t!==Te)return;x.value=n,je=e,Rt(),K.value===`graph`&&z.value.trim()&&(await _(),Pt(z.value.trim()))}catch(e){if(t!==Te)return;x.value=null,je=null,u.reportError(e)}finally{t===Te&&(y.value=!1)}}async function xt(){let[e,...t]=await Promise.all([St(G.value),...Ne.value.map(e=>St(e))]);return _e([e,...t])}function St(e){let t=new URLSearchParams({spaceId:W.value,limit:`360`});if(U.value===`public`){let e=Ct();e?.providerUrl&&t.set(`providerUrl`,e.providerUrl)}return e&&t.set(`personalProjectId`,e),j(`/api/graph?${t}`)}function Ct(){return u.state?.projects.find(({id:e})=>e===W.value)??null}async function wt(e,t=!1){let n=N.value,r=a.personalProjectsOnly?L(W.value,e,G.value,{itemKind:n?.itemKind,itemId:n?.id}):R(U.value,W.value,e,{projectId:G.value,itemKind:n?.itemKind,itemId:n?.id}),i={...p.query};e===`graph`?delete i.section:a.personalProjectsOnly&&n&&(ve(n)?i.section=`materials`:delete i.section),await v[t?`replace`:`push`]({path:r,query:i})}async function Tt(e){if(!a.personalProjectsOnly||e===ze.value)return;N.value=null;let t={...p.query};e===`materials`?t.section=`materials`:delete t.section,await v.push({path:L(W.value,`directory`,G.value),query:t})}async function Et(e){let t=lt.value.find(({key:t})=>t===e);if(!t)return;let n=a.personalProjectsOnly?L(t.spaceId,K.value,t.projectId):R(t.scope,t.spaceId,K.value,{projectId:t.projectId});await v.push({path:n})}async function Dt(e,t){let n={...p.query};!t||t===`all`&&e!==`status`||e===`status`&&t===`current`?delete n[e]:n[e]=t,await v.replace({query:n})}function Ot(e){z.value=e,Mt(),Nt(),gt.schedule()}function kt(){gt.cancel(),At()}async function At(){let e=z.value,t=e.trim();if(await jt(e),!(z.value!==e||K.value!==`graph`)){if(!t){Mt(),Nt();return}y.value||!x.value||je!==Pe.value||await Pt(t)}}async function jt(e){if($t(p.query.q)!==e){we.add(e);try{await Dt(`q`,e)}catch(e){u.reportError(e)}finally{await _(),we.delete(e)}}}function Mt(){V.value=!1,ke+=1,Ae?.abort(),Ae=null}function Nt(){B.value=``,H.value=null,te.value?.clearSelection();let e=N.value;K.value===`graph`&&e&&te.value?.selectItem(e.itemKind,e.id)}async function Pt(e){let t=u.activePersonalSpace?.id;if(!t)return;Mt();let n=ke,r=new AbortController;Ae=r,H.value=null,V.value=!0,B.value=``;let i=new URLSearchParams({personalSpaceId:t,q:e,limit:`30`});G.value&&i.set(`personalProjectId`,G.value);for(let e of Ne.value)i.append(`contextPersonalProjectId`,e);U.value===`public`&&i.append(`projectId`,W.value);try{let a=await j(`/api/search?${i}`,{signal:r.signal});if(n!==ke)return;let o=a.facts??[],s=new Set([...(a.entities??[]).map(({name:e})=>e),...o.flatMap(({source_entity:e,target_entity:t})=>[e,t])]),c=te.value?.focusByNames(s,{searchMatch:!0})??0;if(c){B.value=d(`knowledge.workspace.workspace.search.results`,{entities:a.entities?.length??0,relationships:o.length,nodes:c});return}B.value=d(`knowledge.workspace.workspace.search.noResults`);let l=U.value===`personal`&&!G.value;if(H.value={query:e,checking:l,result:null},!l)return;let u=await Jl({personalSpaceId:t,projects:st.value,query:e,baseline:a,signal:r.signal});if(n!==ke)return;H.value={query:e,checking:!1,result:u}}catch(e){if(r.signal.aborted||n!==ke)return;B.value=d(`knowledge.workspace.workspace.search.failed`),u.reportError(e)}finally{Ae===r&&(Ae=null,V.value=!1)}}async function Ft(e){let t=vt(e);if(t){await yt(t,!1);return}N.value=e;let n=a.personalProjectsOnly?L(W.value,K.value,G.value,{itemKind:e.itemKind,itemId:e.id}):R(U.value,W.value,K.value,{projectId:G.value,itemKind:e.itemKind,itemId:e.id}),r={...p.query};K.value===`directory`&&a.personalProjectsOnly&&(ve(e)?r.section=`materials`:delete r.section),await v.replace({path:n,query:r})}function It(e){Ft(Re.value.find(({itemKind:t,id:n})=>t===`entity`&&n===e.id)??be(e))}function Lt(e){Ft(Re.value.find(({itemKind:t,id:n})=>t===`relationship`&&n===e.id)??Se(e,new Map(x.value?.nodes.map(e=>[e.id,e.name])??[])))}function Rt(){let e=p.params.itemKind,t=p.params.itemId;if(typeof e!=`string`||typeof t!=`string`){N.value=null;return}let n=Re.value.find(n=>n.itemKind===e&&n.id===t),r=e===`entity`?x.value?.nodes.find(({id:e})=>e===t):x.value?.edges.find(({id:e})=>e===t);N.value=n??(e===`entity`&&r?be(r):e===`relationship`&&r?Se(r,new Map(x.value?.nodes.map(e=>[e.id,e.name])??[])):null);let i=vt(N.value);if(i){yt(i,!0);return}if(N.value&&K.value===`directory`){let e=Zt(N.value);_(()=>{let t=[...document.querySelectorAll(`[data-item-key]`)].find(t=>t.dataset.itemKey===e);t?.scrollIntoView?.({block:`center`}),t?.focus({preventScroll:!0})})}}function zt(e){let t=e.currentTarget,n=new Set(Ne.value);t.checked?n.add(t.value):n.delete(t.value),Dt(`context`,[...n])}async function Bt(e){await yt(e,!1)}function Vt(){pt.value&&(ge.value=`PersonalProject`,pe.value=pt.value)}async function Ht(e,t){let n=a.personalProjectsOnly?L(W.value,t,G.value,{itemKind:e.itemKind,itemId:e.id}):R(U.value,W.value,t,{projectId:G.value,itemKind:e.itemKind,itemId:e.id}),r={...p.query};if(t===`directory`&&a.personalProjectsOnly&&ve(e)?r.section=`materials`:delete r.section,t===`directory`&&!ve(e)&&!xe([e],Ke.value).length)for(let e of[`q`,`type`,`quadrant`,`profile`,`status`,`human`])delete r[e];await v.push({path:n,query:r})}async function Ut(e){let t=a.personalProjectsOnly?L(W.value,`directory`,G.value,{itemKind:e.itemKind,itemId:e.id}):R(U.value,W.value,`directory`,{projectId:G.value,itemKind:e.itemKind,itemId:e.id}),n={...p.query};for(let e of[`q`,`type`,`quadrant`,`profile`,`human`,`section`])delete n[e];e.invalidAt?n.status=`historical`:delete n.status,await v.push({path:t,query:n})}function Wt(e){let t=Kt(e);if(!t){u.reportError(Error(d(`knowledge.workspace.workspace.errors.projectUnknown`)));return}ge.value=e.itemKind===`entity`?e.type:`PersonalProject`,pe.value=t}function Gt(e){return e?.profileAspect?null:G.value}function Kt(e){if(!e||!ve(e))return null;let t=he(e),n=G.value,r=new Set;if(e.itemKind===`entity`)r.add(e.id);else{let t=e.raw;r.add(typeof t.source==`string`?t.source:t.source.id),r.add(typeof t.target==`string`?t.target:t.target.id)}for(let e of x.value?.nodes??[]){if(!r.has(e.id))continue;let t=e.attributes?.projectId;typeof t==`string`&&t&&r.add(t)}if(!t&&!n)for(let e of x.value?.edges??[]){if(!String(e.id).startsWith(`project-profile-edge:`))continue;let t=typeof e.source==`string`?e.source:e.source.id,n=typeof e.target==`string`?e.target:e.target.id;if(!r.has(t)&&!r.has(n))continue;let i=r.has(t)?n:t,a=(x.value?.nodes.find(({id:e})=>e===i))?.attributes?.projectId;typeof a==`string`&&a&&r.add(a)}let i=t??n??[...r].find(e=>st.value.some(({project_id:t})=>t===e));return st.value.find(({project_id:e})=>e===i)??null}async function qt(e){await u.refresh(),await bt(),u.notify(d(`knowledge.workspace.workspace.notices.materialUpdated`,{name:e.profile.name}))}function Jt(e){let t=st.value.find(({project_id:t})=>t===e);t&&(fe.value=t)}async function Yt(e,t){let n={created:d(`knowledge.workspace.workspace.notices.projectCreated`,{name:t}),linked:d(`knowledge.workspace.workspace.notices.linked`,{name:t}),already_linked:d(`knowledge.workspace.workspace.notices.alreadyLinked`,{name:t}),duplicate_reused:d(`knowledge.workspace.workspace.notices.duplicateReused`,{name:t}),conflict_pending:d(`knowledge.workspace.workspace.notices.conflictPending`,{name:t}),conflict_resolved:d(`knowledge.workspace.workspace.notices.conflictResolved`)};await u.refresh(),await bt(),u.notify(n[e.status]??d(`knowledge.workspace.workspace.notices.scopeUpdated`))}function Xt(e){if(e.profileAspect)return`${e.preferenceScope===`project`?d(`knowledge.workspace.workspace.source.projectPreference`):d(`knowledge.workspace.workspace.source.personalGlobal`)} · ${e.evidence.length?d(`common.counts.sources`,{count:e.evidence.length}):d(`knowledge.workspace.workspace.source.noSources`)}`;let t=e.assignments.at(0),n=e.evidence.find(({personal_project_id:e})=>e)?.personal_project_id,r=t?.project_id??n,i=st.value.find(({project_id:e})=>e===r)?.profile.name;return`${i?d(`knowledge.workspace.workspace.source.primaryProject`,{name:i}):d(`knowledge.workspace.workspace.source.personalGlobal`)} · ${d(`common.counts.sources`,{count:e.evidence.length})}`}function Zt(e){return`${e.itemKind}:${e.id}`}function Qt(e,t,n){return JSON.stringify([e,t,n])}function $t(e){return typeof e==`string`?e:``}function en(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):typeof e==`string`?[e]:[]}return(e,i)=>(o(),c(`section`,{class:g([`view graph-view vue-knowledge-view`,{"graph-canvas-active":K.value===`graph`,"is-project-overview":K.value===`overview`}])},[D(`div`,tu,[D(`div`,{class:`knowledge-mode-switch`,role:`tablist`,"aria-label":S(d)(`knowledge.workspace.workspace.view.modeAria`)},[Me.value?(o(),c(`button`,{key:0,type:`button`,role:`tab`,"aria-selected":K.value===`overview`,onClick:i[0]||=e=>wt(`overview`)},b(S(d)(`projects.overview.tab`)),9,ru)):E(``,!0),D(`button`,{type:`button`,role:`tab`,"aria-selected":K.value===`directory`,onClick:i[1]||=e=>wt(`directory`)},b(S(d)(`knowledge.workspace.workspace.view.directory`)),9,iu),D(`button`,{type:`button`,role:`tab`,"aria-selected":K.value===`graph`,onClick:i[2]||=e=>wt(`graph`)},b(S(d)(`knowledge.workspace.workspace.view.graph`)),9,au)],8,nu),K.value===`overview`?E(``,!0):(o(),c(m,{key:0},[V.value&&!H.value?.checking?(o(),f(M,{key:0,variant:`inline`,label:S(d)(`knowledge.workspace.workspace.search.searching`)},null,8,[`label`])):y.value&&x.value&&!S(A)&&(K.value!==`graph`||tt.value?.nodes.length)?(o(),f(M,{key:1,variant:`inline`,label:S(d)(`common.status.loadingKnowledge`)},null,8,[`label`])):K.value===`graph`&&!S(A)?(o(),c(`span`,ou,b(it.value),1)):E(``,!0)],64))]),K.value===`overview`?(o(),c(m,{key:0},[pt.value?(o(),f(Gl,{key:0,"space-id":W.value,project:pt.value,"can-publish":!!S(u).state?.capabilities?.publishProject,onEditProfile:Vt,onPublish:i[3]||=e=>fe.value=pt.value},null,8,[`space-id`,`project`,`can-publish`])):!S(u).state&&S(u).runtimeStatus!==`error`||S(u).runtimeStatus===`loading`?(o(),f(M,{key:1,label:S(d)(`common.status.loadingConsole`)},null,8,[`label`])):S(u).state?(o(),c(`p`,cu,b(S(d)(`knowledge.workspace.workspace.errors.projectUnknown`)),1)):(o(),c(`div`,su,[D(`p`,null,b(S(d)(`common.errors.loadFailed`)),1),l(P,{onClick:S(u).refresh},{default:n(()=>[T(b(S(d)(`common.actions.retry`)),1)]),_:1},8,[`onClick`])]))],64)):(o(),c(m,{key:1},[D(`div`,lu,[l(ne,{"model-value":ut.value,options:dt.value,label:S(d)(`knowledge.workspace.workspace.view.graphSpace`),"control-id":`graph-space`,searchable:``,"onUpdate:modelValue":Et},null,8,[`model-value`,`options`,`label`]),G.value&&ct.value.length?(o(),c(`details`,uu,[D(`summary`,null,[T(b(S(d)(`knowledge.workspace.workspace.view.borrowProjects`))+` `,1),D(`span`,null,b(Ne.value.length?S(d)(`knowledge.workspace.workspace.view.selectedContexts`,{count:Ne.value.length}):S(d)(`knowledge.workspace.workspace.view.noneSelected`)),1),i[25]||=D(`i`,{class:`picker-chevron`,"aria-hidden":`true`},null,-1)]),D(`div`,du,[D(`strong`,null,b(S(d)(`knowledge.workspace.workspace.view.currentContext`)),1),D(`p`,null,b(S(d)(`knowledge.workspace.workspace.view.contextCopy`)),1),D(`div`,fu,[(o(!0),c(m,null,r(ct.value,e=>(o(),c(`label`,{key:e.project_id,class:`personal-context-option`},[D(`input`,{type:`checkbox`,value:e.project_id,checked:Ne.value.includes(e.project_id),onChange:zt},null,40,pu),D(`span`,null,[D(`strong`,null,b(e.profile.name),1),D(`small`,null,b(S(d)(`knowledge.workspace.workspace.view.currentScopeOnly`)),1)])]))),128))])])])):E(``,!0),D(`form`,{class:`search-form`,role:`search`,"aria-label":S(d)(`knowledge.workspace.workspace.search.aria`),onSubmit:h(kt,[`prevent`])},[D(`input`,{type:`search`,placeholder:K.value===`directory`&&ze.value===`materials`?S(d)(`knowledge.workspace.workspace.search.materialsPlaceholder`):S(d)(`knowledge.workspace.workspace.search.contentPlaceholder`),"aria-label":K.value===`directory`&&ze.value===`materials`?S(d)(`knowledge.workspace.workspace.search.materialsPlaceholder`):S(d)(`knowledge.workspace.workspace.search.knowledgeAria`),autocomplete:`off`,enterkeyhint:`search`,value:z.value,onInput:i[4]||=e=>Ot(e.currentTarget.value)},null,40,hu)],40,mu),D(`div`,gu,[t.personalProjectsOnly&&pt.value&&S(u).state?.capabilities?.publishProject?(o(),c(`button`,{key:0,class:`toolbar-action`,type:`button`,onClick:i[5]||=e=>fe.value=pt.value},b(S(d)(`knowledge.workspace.workspace.view.publishProject`)),1)):E(``,!0),K.value===`graph`?(o(),c(`div`,{key:1,class:`graph-controls`,role:`group`,"aria-label":S(d)(`knowledge.workspace.workspace.view.graphControls`)},[D(`button`,{class:`toolbar-action`,type:`button`,"aria-label":S(d)(`knowledge.workspace.workspace.view.zoomOut`),onClick:i[6]||=e=>te.value?.zoomOut()},`−`,8,vu),D(`button`,{class:`toolbar-action`,type:`button`,"aria-label":S(d)(`knowledge.workspace.workspace.view.zoomIn`),onClick:i[7]||=e=>te.value?.zoomIn()},`+`,8,yu),D(`button`,{class:`toolbar-action`,type:`button`,onClick:i[8]||=e=>te.value?.fit()},b(S(d)(`knowledge.workspace.workspace.view.fit`)),1),D(`button`,{class:`toolbar-action`,type:`button`,onClick:i[9]||=e=>te.value?.reset()},b(S(d)(`knowledge.workspace.workspace.view.reset`)),1)],8,_u)):E(``,!0),D(`button`,{class:`toolbar-action ui-button--icon`,type:`button`,"aria-label":S(d)(`common.actions.refresh`),title:S(d)(`common.actions.refresh`),onClick:bt},[...i[26]||=[D(`span`,{"aria-hidden":`true`},`↻`,-1)]],8,bu)])]),K.value===`directory`&&ze.value===`knowledge`?(o(),f(re,{key:0,class:`knowledge-filter-disclosure`,title:S(d)(`ui.filters`),open:Ke.value.type!==`all`||Ke.value.quadrant!==`all`||Ke.value.profile!==`all`||Ke.value.humanChange!==`all`},{default:n(()=>[D(`div`,xu,[l(ne,{"model-value":Ke.value.type,options:Ve.value,label:S(d)(`knowledge.workspace.workspace.view.contentType`),"control-id":`knowledge-type-filter`,"onUpdate:modelValue":i[10]||=e=>Dt(`type`,e)},null,8,[`model-value`,`options`,`label`]),l(ne,{"model-value":Ke.value.quadrant,options:He.value,label:S(d)(`knowledge.workspace.workspace.view.discoveryQuadrant`),"control-id":`knowledge-quadrant-filter`,"onUpdate:modelValue":i[11]||=e=>Dt(`quadrant`,e)},null,8,[`model-value`,`options`,`label`]),l(ne,{"model-value":Ke.value.profile,options:Ue.value,label:S(d)(`knowledge.workspace.workspace.view.classification`),"control-id":`knowledge-profile-filter`,"onUpdate:modelValue":i[12]||=e=>Dt(`profile`,e)},null,8,[`model-value`,`options`,`label`]),l(ne,{"model-value":Ke.value.humanChange,options:We.value,label:S(d)(`knowledge.workspace.workspace.view.humanChangeStatus`),"control-id":`knowledge-human-change-filter`,"onUpdate:modelValue":i[13]||=e=>Dt(`human`,e)},null,8,[`model-value`,`options`,`label`])])]),_:1},8,[`title`,`open`])):E(``,!0),S(A)?(o(),f(M,{key:1,label:S(d)(`common.status.loadingKnowledge`)},null,8,[`label`])):k.value?(o(),c(`div`,Su)):(o(),c(`div`,{key:3,class:g([`knowledge-layout`,{"has-selection":!!N.value}])},[K.value===`directory`?(o(),f(oc,{key:0,"personal-projects-only":t.personalProjectsOnly,"directory-section":ze.value,"knowledge-tab-count":at.value,"material-tab-count":ot.value,"content-status":Ge.value,"current-item-count":Ye.value,"historical-item-count":Xe.value,"all-items":Fe.value,"visible-items":Je.value,"project-material-items":Ie.value,"visible-project-material-items":Le.value,"selected-item":N.value,"list-reset-key":qe.value,"source-label":Xt,onChangeSection:Tt,onUpdateStatus:i[14]||=e=>Dt(`status`,e),onSelectItem:Ft},null,8,[`personal-projects-only`,`directory-section`,`knowledge-tab-count`,`material-tab-count`,`content-status`,`current-item-count`,`historical-item-count`,`all-items`,`visible-items`,`project-material-items`,`visible-project-material-items`,`selected-item`,`list-reset-key`])):(o(),c(`div`,{key:1,class:g([`graph-stage`,{"has-parent-projects":nt.value.length}])},[l(pl,{parents:nt.value,"active-project-name":pt.value?.profile.name,"space-id":W.value},null,8,[`parents`,`active-project-name`,`space-id`]),D(`div`,Cu,[H.value?(o(),c(`aside`,wu,[D(`span`,Tu,b(S(d)(`knowledge.workspace.workspace.discovery.noHitKicker`)),1),D(`strong`,Eu,b(S(d)(`knowledge.workspace.workspace.discovery.noResults`,{query:H.value.query})),1),H.value.checking?(o(),f(M,{key:0,variant:`inline`,label:ht.value},null,8,[`label`])):(o(),c(`p`,Du,b(ht.value),1)),H.value.result?.matches.length?(o(),c(`div`,Ou,[(o(!0),c(m,null,r(H.value.result.matches.slice(0,5),e=>(o(),f(S(I),{key:e.project.project_id,class:`graph-search-suggestion`,to:{path:S(L)(W.value,`graph`,e.project.project_id),query:{q:H.value.query}}},{default:n(()=>[D(`span`,null,[D(`strong`,null,b(e.project.profile.name),1),D(`small`,null,b(S(d)(`knowledge.workspace.workspace.discovery.candidateCount`,{count:e.count})),1)]),D(`b`,null,b(S(d)(`knowledge.workspace.workspace.discovery.enterProject`)),1)]),_:2},1032,[`to`]))),128))])):E(``,!0)])):E(``,!0),l(Cs,{"relation-types":rt.value},null,8,[`relation-types`]),tt.value?.nodes.length?(o(),f(_s,{key:1,ref_key:`graphCanvas`,ref:te,graph:tt.value,"selected-item":N.value,onSelectNode:It,onSelectEdge:Lt},null,8,[`graph`,`selected-item`])):y.value?(o(),f(M,{key:2,variant:`compact`,label:S(d)(`common.status.loadingKnowledge`)},null,8,[`label`])):(o(),c(`div`,ku,b(S(d)(`knowledge.workspace.workspace.view.noGraph`)),1))])],2)),l(se,{item:N.value,graph:x.value,editable:ft.value,"current-project-id":G.value,"can-publish-project":S(u).state?.capabilities?.publishProject,"can-manage-project":!!mt.value,mode:K.value,onConfirm:i[15]||=e=>oe.value=e,onEdit:i[16]||=e=>le.value=e,onCreateProject:i[17]||=e=>de.value=e,onOpenProject:Bt,onPublishProject:Jt,onOpenDirectory:i[18]||=e=>Ht(e,`directory`),onOpenGraph:i[19]||=e=>Ht(e,`graph`),onOpenReplacement:Ut,onManageProject:Wt},null,8,[`item`,`graph`,`editable`,`current-project-id`,`can-publish-project`,`can-manage-project`,`mode`])],2)),K.value===`graph`?(o(),c(`p`,Au,b(S(d)(`knowledge.workspace.workspace.view.graphHint`)),1)):E(``,!0)],64)),l(ul,{"editing-item":le.value,"confirming-item":oe.value,"project-action-item":de.value,"publishing-project":fe.value,"managing-project":pe.value,"managing-material-type":ge.value,"personal-space-id":S(u).activePersonalSpace?.id??W.value,"editing-project-id":Gt(le.value),"confirming-project-id":Gt(oe.value),"current-project-id":G.value,projects:S(u).state?.personalProjects??[],"replacement-items":Fe.value,onCloseEdit:i[20]||=e=>le.value=null,onCloseConfirm:i[21]||=e=>oe.value=null,onCloseProjectAction:i[22]||=e=>de.value=null,onClosePublish:i[23]||=e=>fe.value=null,onCloseProfile:i[24]||=e=>pe.value=null,onRefresh:bt,onProjectSaved:Yt,onProfileSaved:qt},null,8,[`editing-item`,`confirming-item`,`project-action-item`,`publishing-project`,`managing-project`,`managing-material-type`,`personal-space-id`,`editing-project-id`,`confirming-project-id`,`current-project-id`,`projects`,`replacement-items`])],2))}});export{ju as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,H as t,P as n,S as r,T as i,a,ot as o,rt as s,w as c,y as l}from"./i18n-
|
|
1
|
+
import{E as e,H as t,P as n,S as r,T as i,a,ot as o,rt as s,w as c,y as l}from"./i18n-DUTWmrzf.js";import{t as u}from"./vue-router-CBdnor1K.js";var d={class:`view`},f={class:`empty-state`,role:`status`},p=e({__name:`NotFoundPage`,setup(e){return(e,p)=>(n(),r(`section`,d,[l(`div`,f,[l(`p`,null,o(s(a)(`common.errors.pageNotFoundCopy`)),1),i(s(u),{class:`secondary-action`,to:`/`},{default:t(()=>[c(o(s(a)(`common.actions.backHome`)),1)]),_:1})])]))}});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,E as t,H as n,I as r,N as ee,P as i,Q as a,S as o,T as s,a as c,b as l,g as u,it as d,n as te,ot as f,rt as p,v as m,w as ne,x as h,y as g}from"./i18n-B4Fp9Oa5.js";import{t as re}from"./console-C2Lfifq-.js";import{r as ie,s as _}from"./client-DodUFQDp.js";import{t as v}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as y}from"./vue-router-nZMhR3dI.js";import{n as ae}from"./attention-store-BGHyzWfv.js";import{t as oe}from"./profile-model-BQO4zNs9.js";import{t as se}from"./useAgentRoster-QDbOwtLj.js";import{n as ce}from"./paths-CDREouhi.js";import{a as le,c as ue,l as de,o as fe,s as pe,t as me}from"./agent-work-summary-C-yW7x7A.js";var he={class:`view overview-view`},ge={key:1,class:`overview-content-grid`},_e={class:`overview-column`},ve={class:`overview-section overview-attention-section`,"aria-labelledby":`overview-attention-heading`},ye={class:`ui-toolbar overview-section-header`},be={id:`overview-attention-heading`},xe={key:0,class:`ui-badge overview-count`},Se={class:`overview-section-actions`},Ce={key:1,class:`ui-empty overview-state`,role:`alert`},we={key:2,class:`ui-empty overview-state`},b={key:3,class:`overview-attention-list`},x=[`onClick`],S={key:4,class:`overview-inline-error`,role:`alert`},C={class:`overview-section overview-work-section`,"aria-labelledby":`overview-work-heading`},w={class:`ui-toolbar overview-section-header`},T={id:`overview-work-heading`},E={class:`overview-section-actions`},D={key:1,class:`ui-empty overview-state`,role:`alert`},O={key:2,class:`ui-empty overview-state`,role:`status`},k={key:3,class:`ui-empty overview-state`},Te={key:4,class:`overview-work-list`},Ee={class:`overview-task-heading`},De={class:`overview-task-meta`},Oe={key:5,class:`overview-inline-notice`,role:`status`},ke={key:6,class:`overview-inline-error`,role:`alert`},Ae={class:`overview-column`},je={class:`overview-section overview-projects-section`,"aria-labelledby":`overview-projects-heading`},Me={class:`ui-toolbar overview-section-header`},Ne={id:`overview-projects-heading`},Pe={key:0,class:`ui-empty overview-state`},Fe={key:1,class:`overview-project-list`},Ie={class:`overview-section overview-services-section`,"aria-labelledby":`overview-services-heading`},Le={class:`ui-toolbar overview-section-header`},Re={id:`overview-services-heading`},ze={class:`overview-service-list`},Be={class:`overview-service-item`},Ve={class:`ui-badge`},He={class:`overview-service-item`},A={class:`ui-badge`},j=v(t({__name:`OverviewPage`,setup(t){let v=re(),j=ae(),M=m(()=>v.state),Ue=m(()=>!M.value&&(v.runtimeStatus===`idle`||v.runtimeStatus===`loading`)),We=m(()=>v.activePersonalSpace),N=m(()=>We.value?.id??M.value?.activePersonalSpaceId??``),{agents:Ge}=se(N),P=m(()=>{let e=N.value;return(M.value?.personalProjects??[]).filter(t=>!e||t.personal_space_id===e)}),F=m(()=>new Map(P.value.map(e=>[e.project_id,e.profile.name]))),Ke=m(()=>{let e=new Map;for(let t of Ge.value){if(t.personalSpaceId!==N.value)continue;let n=oe(t).trim();if(!(!n||n===t.agentId||t.legacyAgentIds?.includes(n))){e.set(t.agentId,n);for(let r of t.legacyAgentIds??[])e.set(r,n)}}return e}),I=a([]),L=a(!1),R=a(``),z=a(!1),B=0,V=m(()=>le(I.value)),H=m(()=>de(I.value,P.value).map(e=>({...e,name:e.name===e.id?F.value.get(e.id)??c(`overview.notReported`):e.name}))),U=m(()=>I.value.length>0),W=m(()=>j.previewItems),G=m(()=>W.value.length>0),K=m(()=>v.runtimeStatus===`error`||M.value?.providers?.personal?.status===`error`?`error`:v.runtimeStatus===`ready`&&M.value?.providers?.personal?.status!==`loading`?`ready`:`loading`),q=m(()=>v.publicRuntimeStatus===`ready`?`ready`:v.publicRuntimeStatus===`error`?`error`:`disconnected`),qe=m(()=>(M.value?.providers?.workspaces??[]).filter(({status:e})=>e===`ready`).length),Je=m(()=>q.value===`ready`?c(`overview.services.publicReadyDetail`,{count:qe.value}):q.value===`error`?c(`overview.services.publicErrorDetail`):c(`overview.services.publicOfflineDetail`));e(N,e=>{if(!e){B++,I.value=[],L.value=!1,R.value=``,z.value=!1;return}I.value=[],R.value=``,z.value=!1,J(e),j.refreshPreview(e)},{immediate:!0}),ee(()=>{v.runtimeStatus===`idle`&&v.refresh()});async function J(e){let t=++B;L.value=!0,R.value=``;try{let n=await ie(`/api/project-agent-tasks?${new URLSearchParams({personalSpaceId:e,limit:`200`})}`);if(t!==B)return;I.value=fe(n,e),z.value=!me(n,200)}catch(e){t===B&&(R.value=e instanceof Error?e.message:String(e))}finally{t===B&&(L.value=!1)}}function Y(){N.value&&J(N.value)}function X(){N.value&&j.refreshPreview(N.value,{force:!0})}function Z(e){return e?F.value.get(e)??c(`overview.notReported`):c(`overview.notReported`)}function Ye(e){return Ke.value.get(e)??``}function Xe(e){let t=Ye(e.agentId),n=Z(e.personalProjectId);return t?`${c(`overview.attention.agent`,{id:t})} · ${n}`:n}function Ze(e){return e.taskId?pe({...e,taskId:e.taskId}):`/project-agents/manage`}function Q(e){if(!e)return c(`overview.notReported`);let t=new Date(e);return Number.isNaN(t.valueOf())?c(`overview.notReported`):new Intl.DateTimeFormat(te(),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function Qe(e){let t=`overview.taskStatus.${e}`,n=c(t);return n===t?e:n}function $(e){return c(`overview.services.${e}`)}function $e(e){let t=e.personalProjectId?Z(e.personalProjectId):``,n=e.updatedAt??e.createdAt;return[t,n?c(`overview.work.updated`,{date:Q(n)}):``].filter(Boolean).join(` · `)}return(e,t)=>(i(),o(`section`,he,[Ue.value?(i(),l(_,{key:0,label:p(c)(`common.status.loadingConsole`)},null,8,[`label`])):(i(),o(`div`,ge,[g(`div`,_e,[g(`section`,ve,[g(`header`,ye,[g(`div`,null,[g(`h2`,be,f(p(c)(`overview.sections.attention`)),1),p(j).previewTotal?(i(),o(`span`,xe,f(p(c)(`overview.attention.count`,{count:p(j).previewTotal})),1)):h(``,!0)]),g(`div`,Se,[p(j).previewLoading&&G.value?(i(),l(_,{key:0,variant:`inline`,label:p(c)(`overview.attention.loading`)},null,8,[`label`])):h(``,!0),g(`button`,{class:`ui-button ui-button--ghost ui-button--sm`,type:`button`,"data-testid":`overview-attention-all`,onClick:t[0]||=e=>p(j).show()},f(p(c)(`overview.attention.open`)),1)])]),p(j).previewLoading&&!G.value?(i(),l(_,{key:0,variant:`compact`,label:p(c)(`overview.attention.loading`)},null,8,[`label`])):p(j).previewError&&!G.value?(i(),o(`div`,Ce,[g(`p`,null,f(p(c)(`overview.attention.loadFailed`))+` · `+f(p(j).previewError),1),g(`button`,{class:`quiet-button`,type:`button`,onClick:X},f(p(c)(`overview.attention.retry`)),1)])):G.value?(i(),o(`ul`,b,[(i(!0),o(u,null,r(W.value,e=>(i(),o(`li`,{key:e.requestId,class:`overview-attention-item`,"data-testid":`overview-attention-item`},[g(`button`,{class:`overview-attention-open`,"data-testid":`overview-attention-open`,type:`button`,onClick:t=>p(j).show(e.agentId)},[g(`strong`,null,f(e.title),1),g(`span`,null,f(Xe(e)),1)],8,x),e.taskId?(i(),l(p(y),{key:0,class:`quiet-button overview-task-link`,"data-testid":`overview-attention-task`,to:Ze(e)},{default:n(()=>[ne(f(p(c)(`overview.attention.openTask`)),1)]),_:1},8,[`to`])):h(``,!0)]))),128))])):(i(),o(`div`,we,[g(`p`,null,f(p(c)(`overview.attention.empty`)),1)])),p(j).previewError&&G.value?(i(),o(`div`,S,[g(`span`,null,f(p(c)(`overview.attention.loadFailed`))+` · `+f(p(j).previewError),1),g(`button`,{class:`quiet-button`,type:`button`,onClick:X},f(p(c)(`overview.attention.retry`)),1)])):h(``,!0)]),g(`section`,C,[g(`header`,w,[g(`div`,null,[g(`h2`,T,f(p(c)(`overview.sections.currentWork`)),1)]),g(`div`,E,[L.value&&U.value?(i(),l(_,{key:0,variant:`inline`,label:p(c)(`overview.work.loading`)},null,8,[`label`])):R.value?h(``,!0):(i(),o(`button`,{key:1,class:`ui-button ui-button--ghost ui-button--sm`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.refresh`)),1))])]),L.value&&!U.value?(i(),l(_,{key:0,variant:`compact`,label:p(c)(`overview.work.loading`)},null,8,[`label`])):R.value&&!U.value?(i(),o(`div`,D,[g(`p`,null,f(p(c)(`overview.work.loadFailed`))+` · `+f(R.value),1),g(`button`,{class:`quiet-button`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.retry`)),1)])):z.value&&!V.value.length?(i(),o(`div`,O,[g(`p`,null,f(p(c)(`agentProfiles.partial`)),1)])):V.value.length?(i(),o(`ul`,Te,[(i(!0),o(u,null,r(V.value,e=>(i(),o(`li`,{key:e.taskId,class:`overview-current-work-item`,"data-testid":`overview-current-work-item`},[s(p(y),{class:`overview-task-card`,to:p(ue)(e)},{default:n(()=>[g(`span`,Ee,[g(`strong`,null,f(e.title),1),g(`span`,{class:d([`ui-badge`,`overview-status-${e.status}`])},f(Qe(e.status)),3)]),g(`span`,De,f($e(e)),1)]),_:2},1032,[`to`])]))),128))])):(i(),o(`div`,k,[g(`p`,null,f(p(c)(`overview.work.empty`)),1)])),z.value&&V.value.length?(i(),o(`div`,Oe,f(p(c)(`agentProfiles.partial`)),1)):h(``,!0),R.value&&U.value?(i(),o(`div`,ke,[g(`span`,null,f(p(c)(`overview.work.loadFailed`))+` · `+f(R.value),1),g(`button`,{class:`quiet-button`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.retry`)),1)])):h(``,!0)])]),g(`div`,Ae,[g(`section`,je,[g(`header`,Me,[g(`h2`,Ne,f(p(c)(`overview.sections.recentProjects`)),1)]),H.value.length?(i(),o(`ul`,Fe,[(i(!0),o(u,null,r(H.value,e=>(i(),o(`li`,{key:e.id,class:`overview-recent-project`,"data-testid":`overview-recent-project`},[s(p(y),{to:p(ce)(N.value,`overview`,e.id)},{default:n(()=>[g(`strong`,null,f(e.name),1),g(`span`,null,f(e.updatedAt?p(c)(`overview.projects.updated`,{date:Q(e.updatedAt)}):p(c)(`overview.projects.noActivity`)),1)]),_:2},1032,[`to`])]))),128))])):(i(),o(`div`,Pe,[g(`p`,null,f(p(c)(`overview.projects.empty`)),1)]))]),g(`section`,Ie,[g(`header`,Le,[g(`h2`,Re,f(p(c)(`overview.sections.services`)),1)]),g(`ul`,ze,[g(`li`,Be,[g(`span`,{class:d([`overview-service-dot`,`is-${K.value}`]),"aria-hidden":`true`},null,2),g(`div`,null,[g(`strong`,null,f(p(c)(`overview.services.local`)),1),g(`span`,null,f(p(c)(`overview.services.localDetail`)),1)]),g(`span`,Ve,f($(K.value)),1)]),g(`li`,He,[g(`span`,{class:d([`overview-service-dot`,`is-${q.value}`]),"aria-hidden":`true`},null,2),g(`div`,null,[g(`strong`,null,f(p(c)(`overview.services.public`)),1),g(`span`,null,f(Je.value),1)]),g(`span`,A,f($(q.value)),1)])])])])]))]))}}),[[`__scopeId`,`data-v-8e47a8c8`]]);export{j as default};
|
|
1
|
+
import{B as e,E as t,H as n,I as r,N as ee,P as i,Q as a,S as o,T as s,a as c,b as l,g as u,it as d,n as te,ot as f,rt as p,v as m,w as ne,x as h,y as g}from"./i18n-DUTWmrzf.js";import{t as re}from"./console-CDOkjZU8.js";import{r as ie,s as _}from"./client-mT6kHxUd.js";import{t as v}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as y}from"./vue-router-CBdnor1K.js";import{n as ae}from"./attention-store-AfhjzTC5.js";import{t as oe}from"./profile-model-BQO4zNs9.js";import{t as se}from"./useAgentRoster-BF8eZGbq.js";import{n as ce}from"./paths-CDREouhi.js";import{a as le,c as ue,l as de,o as fe,s as pe,t as me}from"./agent-work-summary-DRJy9v48.js";var he={class:`view overview-view`},ge={key:1,class:`overview-content-grid`},_e={class:`overview-column`},ve={class:`overview-section overview-attention-section`,"aria-labelledby":`overview-attention-heading`},ye={class:`ui-toolbar overview-section-header`},be={id:`overview-attention-heading`},xe={key:0,class:`ui-badge overview-count`},Se={class:`overview-section-actions`},Ce={key:1,class:`ui-empty overview-state`,role:`alert`},we={key:2,class:`ui-empty overview-state`},b={key:3,class:`overview-attention-list`},x=[`onClick`],S={key:4,class:`overview-inline-error`,role:`alert`},C={class:`overview-section overview-work-section`,"aria-labelledby":`overview-work-heading`},w={class:`ui-toolbar overview-section-header`},T={id:`overview-work-heading`},E={class:`overview-section-actions`},D={key:1,class:`ui-empty overview-state`,role:`alert`},O={key:2,class:`ui-empty overview-state`,role:`status`},k={key:3,class:`ui-empty overview-state`},Te={key:4,class:`overview-work-list`},Ee={class:`overview-task-heading`},De={class:`overview-task-meta`},Oe={key:5,class:`overview-inline-notice`,role:`status`},ke={key:6,class:`overview-inline-error`,role:`alert`},Ae={class:`overview-column`},je={class:`overview-section overview-projects-section`,"aria-labelledby":`overview-projects-heading`},Me={class:`ui-toolbar overview-section-header`},Ne={id:`overview-projects-heading`},Pe={key:0,class:`ui-empty overview-state`},Fe={key:1,class:`overview-project-list`},Ie={class:`overview-section overview-services-section`,"aria-labelledby":`overview-services-heading`},Le={class:`ui-toolbar overview-section-header`},Re={id:`overview-services-heading`},ze={class:`overview-service-list`},Be={class:`overview-service-item`},Ve={class:`ui-badge`},He={class:`overview-service-item`},A={class:`ui-badge`},j=v(t({__name:`OverviewPage`,setup(t){let v=re(),j=ae(),M=m(()=>v.state),Ue=m(()=>!M.value&&(v.runtimeStatus===`idle`||v.runtimeStatus===`loading`)),We=m(()=>v.activePersonalSpace),N=m(()=>We.value?.id??M.value?.activePersonalSpaceId??``),{agents:Ge}=se(N),P=m(()=>{let e=N.value;return(M.value?.personalProjects??[]).filter(t=>!e||t.personal_space_id===e)}),F=m(()=>new Map(P.value.map(e=>[e.project_id,e.profile.name]))),Ke=m(()=>{let e=new Map;for(let t of Ge.value){if(t.personalSpaceId!==N.value)continue;let n=oe(t).trim();if(!(!n||n===t.agentId||t.legacyAgentIds?.includes(n))){e.set(t.agentId,n);for(let r of t.legacyAgentIds??[])e.set(r,n)}}return e}),I=a([]),L=a(!1),R=a(``),z=a(!1),B=0,V=m(()=>le(I.value)),H=m(()=>de(I.value,P.value).map(e=>({...e,name:e.name===e.id?F.value.get(e.id)??c(`overview.notReported`):e.name}))),U=m(()=>I.value.length>0),W=m(()=>j.previewItems),G=m(()=>W.value.length>0),K=m(()=>v.runtimeStatus===`error`||M.value?.providers?.personal?.status===`error`?`error`:v.runtimeStatus===`ready`&&M.value?.providers?.personal?.status!==`loading`?`ready`:`loading`),q=m(()=>v.publicRuntimeStatus===`ready`?`ready`:v.publicRuntimeStatus===`error`?`error`:`disconnected`),qe=m(()=>(M.value?.providers?.workspaces??[]).filter(({status:e})=>e===`ready`).length),Je=m(()=>q.value===`ready`?c(`overview.services.publicReadyDetail`,{count:qe.value}):q.value===`error`?c(`overview.services.publicErrorDetail`):c(`overview.services.publicOfflineDetail`));e(N,e=>{if(!e){B++,I.value=[],L.value=!1,R.value=``,z.value=!1;return}I.value=[],R.value=``,z.value=!1,J(e),j.refreshPreview(e)},{immediate:!0}),ee(()=>{v.runtimeStatus===`idle`&&v.refresh()});async function J(e){let t=++B;L.value=!0,R.value=``;try{let n=await ie(`/api/project-agent-tasks?${new URLSearchParams({personalSpaceId:e,limit:`200`})}`);if(t!==B)return;I.value=fe(n,e),z.value=!me(n,200)}catch(e){t===B&&(R.value=e instanceof Error?e.message:String(e))}finally{t===B&&(L.value=!1)}}function Y(){N.value&&J(N.value)}function X(){N.value&&j.refreshPreview(N.value,{force:!0})}function Z(e){return e?F.value.get(e)??c(`overview.notReported`):c(`overview.notReported`)}function Ye(e){return Ke.value.get(e)??``}function Xe(e){let t=Ye(e.agentId),n=Z(e.personalProjectId);return t?`${c(`overview.attention.agent`,{id:t})} · ${n}`:n}function Ze(e){return e.taskId?pe({...e,taskId:e.taskId}):`/project-agents/manage`}function Q(e){if(!e)return c(`overview.notReported`);let t=new Date(e);return Number.isNaN(t.valueOf())?c(`overview.notReported`):new Intl.DateTimeFormat(te(),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function Qe(e){let t=`overview.taskStatus.${e}`,n=c(t);return n===t?e:n}function $(e){return c(`overview.services.${e}`)}function $e(e){let t=e.personalProjectId?Z(e.personalProjectId):``,n=e.updatedAt??e.createdAt;return[t,n?c(`overview.work.updated`,{date:Q(n)}):``].filter(Boolean).join(` · `)}return(e,t)=>(i(),o(`section`,he,[Ue.value?(i(),l(_,{key:0,label:p(c)(`common.status.loadingConsole`)},null,8,[`label`])):(i(),o(`div`,ge,[g(`div`,_e,[g(`section`,ve,[g(`header`,ye,[g(`div`,null,[g(`h2`,be,f(p(c)(`overview.sections.attention`)),1),p(j).previewTotal?(i(),o(`span`,xe,f(p(c)(`overview.attention.count`,{count:p(j).previewTotal})),1)):h(``,!0)]),g(`div`,Se,[p(j).previewLoading&&G.value?(i(),l(_,{key:0,variant:`inline`,label:p(c)(`overview.attention.loading`)},null,8,[`label`])):h(``,!0),g(`button`,{class:`ui-button ui-button--ghost ui-button--sm`,type:`button`,"data-testid":`overview-attention-all`,onClick:t[0]||=e=>p(j).show()},f(p(c)(`overview.attention.open`)),1)])]),p(j).previewLoading&&!G.value?(i(),l(_,{key:0,variant:`compact`,label:p(c)(`overview.attention.loading`)},null,8,[`label`])):p(j).previewError&&!G.value?(i(),o(`div`,Ce,[g(`p`,null,f(p(c)(`overview.attention.loadFailed`))+` · `+f(p(j).previewError),1),g(`button`,{class:`quiet-button`,type:`button`,onClick:X},f(p(c)(`overview.attention.retry`)),1)])):G.value?(i(),o(`ul`,b,[(i(!0),o(u,null,r(W.value,e=>(i(),o(`li`,{key:e.requestId,class:`overview-attention-item`,"data-testid":`overview-attention-item`},[g(`button`,{class:`overview-attention-open`,"data-testid":`overview-attention-open`,type:`button`,onClick:t=>p(j).show(e.agentId)},[g(`strong`,null,f(e.title),1),g(`span`,null,f(Xe(e)),1)],8,x),e.taskId?(i(),l(p(y),{key:0,class:`quiet-button overview-task-link`,"data-testid":`overview-attention-task`,to:Ze(e)},{default:n(()=>[ne(f(p(c)(`overview.attention.openTask`)),1)]),_:1},8,[`to`])):h(``,!0)]))),128))])):(i(),o(`div`,we,[g(`p`,null,f(p(c)(`overview.attention.empty`)),1)])),p(j).previewError&&G.value?(i(),o(`div`,S,[g(`span`,null,f(p(c)(`overview.attention.loadFailed`))+` · `+f(p(j).previewError),1),g(`button`,{class:`quiet-button`,type:`button`,onClick:X},f(p(c)(`overview.attention.retry`)),1)])):h(``,!0)]),g(`section`,C,[g(`header`,w,[g(`div`,null,[g(`h2`,T,f(p(c)(`overview.sections.currentWork`)),1)]),g(`div`,E,[L.value&&U.value?(i(),l(_,{key:0,variant:`inline`,label:p(c)(`overview.work.loading`)},null,8,[`label`])):R.value?h(``,!0):(i(),o(`button`,{key:1,class:`ui-button ui-button--ghost ui-button--sm`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.refresh`)),1))])]),L.value&&!U.value?(i(),l(_,{key:0,variant:`compact`,label:p(c)(`overview.work.loading`)},null,8,[`label`])):R.value&&!U.value?(i(),o(`div`,D,[g(`p`,null,f(p(c)(`overview.work.loadFailed`))+` · `+f(R.value),1),g(`button`,{class:`quiet-button`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.retry`)),1)])):z.value&&!V.value.length?(i(),o(`div`,O,[g(`p`,null,f(p(c)(`agentProfiles.partial`)),1)])):V.value.length?(i(),o(`ul`,Te,[(i(!0),o(u,null,r(V.value,e=>(i(),o(`li`,{key:e.taskId,class:`overview-current-work-item`,"data-testid":`overview-current-work-item`},[s(p(y),{class:`overview-task-card`,to:p(ue)(e)},{default:n(()=>[g(`span`,Ee,[g(`strong`,null,f(e.title),1),g(`span`,{class:d([`ui-badge`,`overview-status-${e.status}`])},f(Qe(e.status)),3)]),g(`span`,De,f($e(e)),1)]),_:2},1032,[`to`])]))),128))])):(i(),o(`div`,k,[g(`p`,null,f(p(c)(`overview.work.empty`)),1)])),z.value&&V.value.length?(i(),o(`div`,Oe,f(p(c)(`agentProfiles.partial`)),1)):h(``,!0),R.value&&U.value?(i(),o(`div`,ke,[g(`span`,null,f(p(c)(`overview.work.loadFailed`))+` · `+f(R.value),1),g(`button`,{class:`quiet-button`,type:`button`,"data-testid":`overview-work-retry`,onClick:Y},f(p(c)(`overview.work.retry`)),1)])):h(``,!0)])]),g(`div`,Ae,[g(`section`,je,[g(`header`,Me,[g(`h2`,Ne,f(p(c)(`overview.sections.recentProjects`)),1)]),H.value.length?(i(),o(`ul`,Fe,[(i(!0),o(u,null,r(H.value,e=>(i(),o(`li`,{key:e.id,class:`overview-recent-project`,"data-testid":`overview-recent-project`},[s(p(y),{to:p(ce)(N.value,`overview`,e.id)},{default:n(()=>[g(`strong`,null,f(e.name),1),g(`span`,null,f(e.updatedAt?p(c)(`overview.projects.updated`,{date:Q(e.updatedAt)}):p(c)(`overview.projects.noActivity`)),1)]),_:2},1032,[`to`])]))),128))])):(i(),o(`div`,Pe,[g(`p`,null,f(p(c)(`overview.projects.empty`)),1)]))]),g(`section`,Ie,[g(`header`,Le,[g(`h2`,Re,f(p(c)(`overview.sections.services`)),1)]),g(`ul`,ze,[g(`li`,Be,[g(`span`,{class:d([`overview-service-dot`,`is-${K.value}`]),"aria-hidden":`true`},null,2),g(`div`,null,[g(`strong`,null,f(p(c)(`overview.services.local`)),1),g(`span`,null,f(p(c)(`overview.services.localDetail`)),1)]),g(`span`,Ve,f($(K.value)),1)]),g(`li`,He,[g(`span`,{class:d([`overview-service-dot`,`is-${q.value}`]),"aria-hidden":`true`},null,2),g(`div`,null,[g(`strong`,null,f(p(c)(`overview.services.public`)),1),g(`span`,null,f(Je.value),1)]),g(`span`,A,f($(q.value)),1)])])])])]))]))}}),[[`__scopeId`,`data-v-8e47a8c8`]]);export{j as default};
|