@goondocks/myco 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-eval-RJSQI5S2.js +355 -0
- package/dist/agent-eval-RJSQI5S2.js.map +1 -0
- package/dist/{agent-run-PQXC246Y.js → agent-run-2JSYFOKU.js} +10 -8
- package/dist/{agent-run-PQXC246Y.js.map → agent-run-2JSYFOKU.js.map} +1 -1
- package/dist/{agent-tasks-323BZEBX.js → agent-tasks-APFJIM2T.js} +10 -8
- package/dist/{agent-tasks-323BZEBX.js.map → agent-tasks-APFJIM2T.js.map} +1 -1
- package/dist/{chunk-SRXTSI25.js → chunk-53RPGOEN.js} +57 -9
- package/dist/chunk-53RPGOEN.js.map +1 -0
- package/dist/chunk-54SXG5HF.js +26 -0
- package/dist/chunk-54SXG5HF.js.map +1 -0
- package/dist/{chunk-DCSGJ7W4.js → chunk-5ZG4RMUH.js} +2 -2
- package/dist/{chunk-FLLBJLHM.js → chunk-6C6QZ4PM.js} +9 -5
- package/dist/chunk-6C6QZ4PM.js.map +1 -0
- package/dist/chunk-6LB7XELY.js +406 -0
- package/dist/chunk-6LB7XELY.js.map +1 -0
- package/dist/{chunk-22JALAXN.js → chunk-75Z7UKDY.js} +4 -4
- package/dist/{chunk-AIYFHQRX.js → chunk-BUTL6IFS.js} +2 -2
- package/dist/chunk-CESKJD44.js +586 -0
- package/dist/chunk-CESKJD44.js.map +1 -0
- package/dist/chunk-CISWUP5W.js +101 -0
- package/dist/chunk-CISWUP5W.js.map +1 -0
- package/dist/chunk-DJ3IHNYO.js +50 -0
- package/dist/chunk-DJ3IHNYO.js.map +1 -0
- package/dist/chunk-F3OEQYLS.js +847 -0
- package/dist/chunk-F3OEQYLS.js.map +1 -0
- package/dist/{chunk-6RFZWV4R.js → chunk-FCJ5JV54.js} +1 -1
- package/dist/{chunk-6RFZWV4R.js.map → chunk-FCJ5JV54.js.map} +1 -1
- package/dist/{chunk-63ZGP4Q2.js → chunk-G6QIBNZM.js} +9 -6
- package/dist/{chunk-63ZGP4Q2.js.map → chunk-G6QIBNZM.js.map} +1 -1
- package/dist/{chunk-57O67XVF.js → chunk-ILJPRYES.js} +6 -4
- package/dist/{chunk-57O67XVF.js.map → chunk-ILJPRYES.js.map} +1 -1
- package/dist/{chunk-US4LNCAT.js → chunk-IPPMYQ2Y.js} +5 -1
- package/dist/chunk-IPPMYQ2Y.js.map +1 -0
- package/dist/{chunk-UEWMSIL3.js → chunk-JR54LTPP.js} +4 -4
- package/dist/{chunk-4M7EWPIA.js → chunk-JZS6GZ6T.js} +16 -93
- package/dist/chunk-JZS6GZ6T.js.map +1 -0
- package/dist/{chunk-5XIVBO25.js → chunk-LVIY7P35.js} +2 -2
- package/dist/chunk-NGH7U6A3.js +13844 -0
- package/dist/chunk-NGH7U6A3.js.map +1 -0
- package/dist/chunk-OUJSQSKE.js +113 -0
- package/dist/chunk-OUJSQSKE.js.map +1 -0
- package/dist/{chunk-3WWJOTYG.js → chunk-P66DLD6G.js} +22 -10
- package/dist/chunk-P66DLD6G.js.map +1 -0
- package/dist/{chunk-QS5TWZBL.js → chunk-R2JIJBCL.js} +18 -4
- package/dist/{chunk-QS5TWZBL.js.map → chunk-R2JIJBCL.js.map} +1 -1
- package/dist/{chunk-MYOZLMB2.js → chunk-RL5R4CQU.js} +538 -19
- package/dist/chunk-RL5R4CQU.js.map +1 -0
- package/dist/{chunk-EVDQKYCG.js → chunk-RQSJLWP4.js} +13 -2
- package/dist/chunk-RQSJLWP4.js.map +1 -0
- package/dist/{chunk-BPRIYNLE.js → chunk-TKAJ3JVF.js} +3 -3
- package/dist/{chunk-LZP4IJB3.js → chunk-VHNRMM4O.js} +3 -2
- package/dist/{chunk-FMRZ26U5.js → chunk-X3IGT5RV.js} +5 -2
- package/dist/{chunk-FMRZ26U5.js.map → chunk-X3IGT5RV.js.map} +1 -1
- package/dist/{chunk-KHT24OWC.js → chunk-YDUOSRGD.js} +8 -94
- package/dist/{chunk-KHT24OWC.js.map → chunk-YDUOSRGD.js.map} +1 -1
- package/dist/{cli-UWBAOHLL.js → cli-LNYSTDQM.js} +49 -42
- package/dist/cli-LNYSTDQM.js.map +1 -0
- package/dist/{client-SLDDMSKN.js → client-NWE4TCNO.js} +4 -4
- package/dist/{config-XPV5GDE4.js → config-VC4ACP42.js} +6 -4
- package/dist/{config-XPV5GDE4.js.map → config-VC4ACP42.js.map} +1 -1
- package/dist/{detect-providers-5KOPZ7J2.js → detect-providers-ILLQZROY.js} +4 -4
- package/dist/{doctor-UUUOVDZS.js → doctor-TI7EZ3RW.js} +48 -15
- package/dist/doctor-TI7EZ3RW.js.map +1 -0
- package/dist/executor-F2YU7HXJ.js +44 -0
- package/dist/{init-UDH3ZBDD.js → init-KG3TYVGE.js} +14 -12
- package/dist/{init-UDH3ZBDD.js.map → init-KG3TYVGE.js.map} +1 -1
- package/dist/{installer-I6KRGJOO.js → installer-UMH7OJ5A.js} +6 -4
- package/dist/{llm-TH4NLIRM.js → llm-AGVEF5XD.js} +5 -4
- package/dist/{loader-H7OFASVC.js → loader-LX7TFRM6.js} +5 -3
- package/dist/{loader-TSB5M7FD.js → loader-NAVVZK63.js} +4 -3
- package/dist/{main-E7HU4QYR.js → main-5PRQNEEE.js} +2457 -649
- package/dist/main-5PRQNEEE.js.map +1 -0
- package/dist/{open-4UGDPBKN.js → open-5A27BCSB.js} +10 -8
- package/dist/{open-4UGDPBKN.js.map → open-5A27BCSB.js.map} +1 -1
- package/dist/{post-compact-BFU3WZSV.js → post-compact-USAODKPQ.js} +6 -6
- package/dist/{post-tool-use-RYHXLCTC.js → post-tool-use-GMMSYBII.js} +9 -7
- package/dist/post-tool-use-GMMSYBII.js.map +1 -0
- package/dist/{post-tool-use-failure-DCVHK2P3.js → post-tool-use-failure-NZVSL2PO.js} +6 -6
- package/dist/{pre-compact-EZZCJ6AG.js → pre-compact-LZ57DLUS.js} +6 -6
- package/dist/{provider-check-43LAMSMH.js → provider-check-ZEV5P4KM.js} +4 -4
- package/dist/{registry-MGJSJBAS.js → registry-M2Z5QBWH.js} +5 -4
- package/dist/{remove-GBBQG3SJ.js → remove-T3KE6C5N.js} +10 -8
- package/dist/{remove-GBBQG3SJ.js.map → remove-T3KE6C5N.js.map} +1 -1
- package/dist/{restart-RMIGKMA6.js → restart-YWDEVZUJ.js} +11 -9
- package/dist/{restart-RMIGKMA6.js.map → restart-YWDEVZUJ.js.map} +1 -1
- package/dist/{search-2A5AJVNG.js → search-GKFDGELR.js} +11 -9
- package/dist/{search-2A5AJVNG.js.map → search-GKFDGELR.js.map} +1 -1
- package/dist/{server-TSYZMFFK.js → server-AHUR6CWF.js} +368 -269
- package/dist/server-AHUR6CWF.js.map +1 -0
- package/dist/{session-NKREOTEO.js → session-2ZEPLWW6.js} +11 -9
- package/dist/{session-NKREOTEO.js.map → session-2ZEPLWW6.js.map} +1 -1
- package/dist/{session-end-DQELLTGJ.js → session-end-LWJYQAXX.js} +5 -5
- package/dist/session-start-WTA6GCOQ.js +134 -0
- package/dist/session-start-WTA6GCOQ.js.map +1 -0
- package/dist/{setup-llm-SLX5764H.js → setup-llm-E7UU5IO7.js} +11 -9
- package/dist/{setup-llm-SLX5764H.js.map → setup-llm-E7UU5IO7.js.map} +1 -1
- package/dist/src/agent/definitions/agent.yaml +9 -5
- package/dist/src/agent/definitions/tasks/cortex-instructions.yaml +93 -0
- package/dist/src/agent/definitions/tasks/cortex-prompt-builder.yaml +67 -0
- package/dist/src/agent/definitions/tasks/digest-only.yaml +1 -1
- package/dist/src/agent/definitions/tasks/extract-only.yaml +1 -1
- package/dist/src/agent/definitions/tasks/review-session.yaml +10 -39
- package/dist/src/agent/definitions/tasks/skill-evolve.yaml +5 -4
- package/dist/src/agent/definitions/tasks/skill-generate.yaml +2 -1
- package/dist/src/agent/definitions/tasks/skill-survey.yaml +25 -13
- package/dist/src/agent/definitions/tasks/supersession-sweep.yaml +1 -1
- package/dist/src/agent/definitions/tasks/title-summary.yaml +12 -19
- package/dist/src/agent/definitions/tasks/{full-intelligence.yaml → vault-evolve.yaml} +18 -83
- package/dist/src/agent/definitions/tasks/vault-seed.yaml +370 -0
- package/dist/src/agent/prompts/agent.md +12 -38
- package/dist/src/cli.js +1 -1
- package/dist/src/daemon/main.js +1 -1
- package/dist/src/hooks/post-tool-use.js +1 -1
- package/dist/src/hooks/session-end.js +1 -1
- package/dist/src/hooks/session-start.js +1 -1
- package/dist/src/hooks/stop.js +1 -1
- package/dist/src/hooks/user-prompt-submit.js +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/symbionts/manifests/claude-code.yaml +4 -0
- package/dist/src/symbionts/manifests/pi.yaml +22 -0
- package/dist/src/symbionts/templates/pi/package.json +6 -0
- package/dist/src/symbionts/templates/pi/plugin.ts +559 -0
- package/dist/{stats-ARBLNEE3.js → stats-DFG6S23S.js} +11 -9
- package/dist/{stats-ARBLNEE3.js.map → stats-DFG6S23S.js.map} +1 -1
- package/dist/{stop-5AJXBKEE.js → stop-WRBTXEVT.js} +5 -5
- package/dist/{stop-failure-XGKTZPLR.js → stop-failure-32MGIG2Q.js} +6 -6
- package/dist/{subagent-start-2JLIPGJN.js → subagent-start-VFGHQFVL.js} +6 -6
- package/dist/{subagent-stop-FV4EOKWZ.js → subagent-stop-663FXG3P.js} +6 -6
- package/dist/{task-completed-XJKT366I.js → task-completed-ZCQYEFMZ.js} +6 -6
- package/dist/{team-3JKF7VAD.js → team-JTI5CDUO.js} +7 -5
- package/dist/{turns-YFNI5CQC.js → turns-HU2CTZAP.js} +2 -2
- package/dist/ui/assets/index-DGf1h-Ha.js +842 -0
- package/dist/ui/assets/index-_OP4ifzH.css +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/{update-XVSAMN4O.js → update-3NBQTG32.js} +10 -8
- package/dist/{update-XVSAMN4O.js.map → update-3NBQTG32.js.map} +1 -1
- package/dist/{user-prompt-submit-TTBTHBBH.js → user-prompt-submit-ME2TBKOS.js} +8 -7
- package/dist/{user-prompt-submit-TTBTHBBH.js.map → user-prompt-submit-ME2TBKOS.js.map} +1 -1
- package/dist/{verify-LMHNEYIP.js → verify-R76ZFJSZ.js} +8 -5
- package/dist/{verify-LMHNEYIP.js.map → verify-R76ZFJSZ.js.map} +1 -1
- package/dist/{version-HRVSEMUR.js → version-GQAFBBPX.js} +2 -2
- package/dist/version-GQAFBBPX.js.map +1 -0
- package/package.json +3 -1
- package/skills/myco/SKILL.md +16 -1
- package/skills/myco/references/cli-usage.md +1 -1
- package/skills/myco-curate/SKILL.md +1 -1
- package/dist/chunk-3WWJOTYG.js.map +0 -1
- package/dist/chunk-4M7EWPIA.js.map +0 -1
- package/dist/chunk-4YFKBL3F.js +0 -195
- package/dist/chunk-4YFKBL3F.js.map +0 -1
- package/dist/chunk-EVDQKYCG.js.map +0 -1
- package/dist/chunk-FGY7J6EZ.js +0 -2276
- package/dist/chunk-FGY7J6EZ.js.map +0 -1
- package/dist/chunk-FLLBJLHM.js.map +0 -1
- package/dist/chunk-MYOZLMB2.js.map +0 -1
- package/dist/chunk-SRXTSI25.js.map +0 -1
- package/dist/chunk-US4LNCAT.js.map +0 -1
- package/dist/cli-UWBAOHLL.js.map +0 -1
- package/dist/doctor-UUUOVDZS.js.map +0 -1
- package/dist/executor-J4IBXSBY.js +0 -2472
- package/dist/executor-J4IBXSBY.js.map +0 -1
- package/dist/main-E7HU4QYR.js.map +0 -1
- package/dist/post-tool-use-RYHXLCTC.js.map +0 -1
- package/dist/server-TSYZMFFK.js.map +0 -1
- package/dist/session-start-5SUTR5GP.js +0 -189
- package/dist/session-start-5SUTR5GP.js.map +0 -1
- package/dist/src/agent/definitions/tasks/graph-maintenance.yaml +0 -93
- package/dist/ui/assets/index-C2JuNtRB.css +0 -1
- package/dist/ui/assets/index-JLVaQKV2.js +0 -832
- /package/dist/{chunk-DCSGJ7W4.js.map → chunk-5ZG4RMUH.js.map} +0 -0
- /package/dist/{chunk-22JALAXN.js.map → chunk-75Z7UKDY.js.map} +0 -0
- /package/dist/{chunk-AIYFHQRX.js.map → chunk-BUTL6IFS.js.map} +0 -0
- /package/dist/{chunk-UEWMSIL3.js.map → chunk-JR54LTPP.js.map} +0 -0
- /package/dist/{chunk-5XIVBO25.js.map → chunk-LVIY7P35.js.map} +0 -0
- /package/dist/{chunk-BPRIYNLE.js.map → chunk-TKAJ3JVF.js.map} +0 -0
- /package/dist/{chunk-LZP4IJB3.js.map → chunk-VHNRMM4O.js.map} +0 -0
- /package/dist/{client-SLDDMSKN.js.map → client-NWE4TCNO.js.map} +0 -0
- /package/dist/{detect-providers-5KOPZ7J2.js.map → detect-providers-ILLQZROY.js.map} +0 -0
- /package/dist/{installer-I6KRGJOO.js.map → executor-F2YU7HXJ.js.map} +0 -0
- /package/dist/{llm-TH4NLIRM.js.map → installer-UMH7OJ5A.js.map} +0 -0
- /package/dist/{loader-H7OFASVC.js.map → llm-AGVEF5XD.js.map} +0 -0
- /package/dist/{loader-TSB5M7FD.js.map → loader-LX7TFRM6.js.map} +0 -0
- /package/dist/{provider-check-43LAMSMH.js.map → loader-NAVVZK63.js.map} +0 -0
- /package/dist/{post-compact-BFU3WZSV.js.map → post-compact-USAODKPQ.js.map} +0 -0
- /package/dist/{post-tool-use-failure-DCVHK2P3.js.map → post-tool-use-failure-NZVSL2PO.js.map} +0 -0
- /package/dist/{pre-compact-EZZCJ6AG.js.map → pre-compact-LZ57DLUS.js.map} +0 -0
- /package/dist/{registry-MGJSJBAS.js.map → provider-check-ZEV5P4KM.js.map} +0 -0
- /package/dist/{team-3JKF7VAD.js.map → registry-M2Z5QBWH.js.map} +0 -0
- /package/dist/{session-end-DQELLTGJ.js.map → session-end-LWJYQAXX.js.map} +0 -0
- /package/dist/{stop-5AJXBKEE.js.map → stop-WRBTXEVT.js.map} +0 -0
- /package/dist/{stop-failure-XGKTZPLR.js.map → stop-failure-32MGIG2Q.js.map} +0 -0
- /package/dist/{subagent-start-2JLIPGJN.js.map → subagent-start-VFGHQFVL.js.map} +0 -0
- /package/dist/{subagent-stop-FV4EOKWZ.js.map → subagent-stop-663FXG3P.js.map} +0 -0
- /package/dist/{task-completed-XJKT366I.js.map → task-completed-ZCQYEFMZ.js.map} +0 -0
- /package/dist/{turns-YFNI5CQC.js.map → team-JTI5CDUO.js.map} +0 -0
- /package/dist/{version-HRVSEMUR.js.map → turns-HU2CTZAP.js.map} +0 -0
|
@@ -1,832 +0,0 @@
|
|
|
1
|
-
var HC=e=>{throw TypeError(e)};var Vy=(e,t,n)=>t.has(e)||HC("Cannot "+n);var ee=(e,t,n)=>(Vy(e,t,"read from private field"),n?n.call(e):t.get(e)),et=(e,t,n)=>t.has(e)?HC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pe=(e,t,n,r)=>(Vy(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),mt=(e,t,n)=>(Vy(e,t,"access private method"),n);var vv=(e,t,n,r)=>({set _(a){Pe(e,t,a,n)},get _(){return ee(e,t,r)}});function M4(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hy={exports:{}},kf={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var GC;function _4(){if(GC)return kf;GC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var l=null;if(i!==void 0&&(l=""+i),a.key!==void 0&&(l=""+a.key),"key"in a){i={};for(var o in a)o!=="key"&&(i[o]=a[o])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:i}}return kf.Fragment=t,kf.jsx=n,kf.jsxs=n,kf}var $C;function O4(){return $C||($C=1,Hy.exports=_4()),Hy.exports}var d=O4(),Gy={exports:{}},ft={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var KC;function L4(){if(KC)return ft;KC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(U){return U===null||typeof U!="object"?null:(U=m&&U[m]||U["@@iterator"],typeof U=="function"?U:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function S(U,X,z){this.props=U,this.context=X,this.refs=w,this.updater=z||x}S.prototype.isReactComponent={},S.prototype.setState=function(U,X){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,X,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function N(){}N.prototype=S.prototype;function C(U,X,z){this.props=U,this.context=X,this.refs=w,this.updater=z||x}var T=C.prototype=new N;T.constructor=C,b(T,S.prototype),T.isPureReactComponent=!0;var R=Array.isArray;function A(){}var D={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function L(U,X,z){var Z=z.ref;return{$$typeof:e,type:U,key:X,ref:Z!==void 0?Z:null,props:z}}function M(U,X){return L(U.type,X,U.props)}function B(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function P(U){var X={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(z){return X[z]})}var q=/\/+/g;function H(U,X){return typeof U=="object"&&U!==null&&U.key!=null?P(""+U.key):X.toString(36)}function G(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(A,A):(U.status="pending",U.then(function(X){U.status==="pending"&&(U.status="fulfilled",U.value=X)},function(X){U.status==="pending"&&(U.status="rejected",U.reason=X)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function F(U,X,z,Z,re){var ae=typeof U;(ae==="undefined"||ae==="boolean")&&(U=null);var se=!1;if(U===null)se=!0;else switch(ae){case"bigint":case"string":case"number":se=!0;break;case"object":switch(U.$$typeof){case e:case t:se=!0;break;case h:return se=U._init,F(se(U._payload),X,z,Z,re)}}if(se)return re=re(U),se=Z===""?"."+H(U,0):Z,R(re)?(z="",se!=null&&(z=se.replace(q,"$&/")+"/"),F(re,X,z,"",function(W){return W})):re!=null&&(B(re)&&(re=M(re,z+(re.key==null||U&&U.key===re.key?"":(""+re.key).replace(q,"$&/")+"/")+se)),X.push(re)),1;se=0;var le=Z===""?".":Z+":";if(R(U))for(var ie=0;ie<U.length;ie++)Z=U[ie],ae=le+H(Z,ie),se+=F(Z,X,z,ae,re);else if(ie=y(U),typeof ie=="function")for(U=ie.call(U),ie=0;!(Z=U.next()).done;)Z=Z.value,ae=le+H(Z,ie++),se+=F(Z,X,z,ae,re);else if(ae==="object"){if(typeof U.then=="function")return F(G(U),X,z,Z,re);throw X=String(U),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return se}function V(U,X,z){if(U==null)return U;var Z=[],re=0;return F(U,Z,"","",function(ae){return X.call(z,ae,re++)}),Z}function Y(U){if(U._status===-1){var X=U._result;X=X(),X.then(function(z){(U._status===0||U._status===-1)&&(U._status=1,U._result=z)},function(z){(U._status===0||U._status===-1)&&(U._status=2,U._result=z)}),U._status===-1&&(U._status=0,U._result=X)}if(U._status===1)return U._result.default;throw U._result}var Q=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},I={map:V,forEach:function(U,X,z){V(U,function(){X.apply(this,arguments)},z)},count:function(U){var X=0;return V(U,function(){X++}),X},toArray:function(U){return V(U,function(X){return X})||[]},only:function(U){if(!B(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return ft.Activity=p,ft.Children=I,ft.Component=S,ft.Fragment=n,ft.Profiler=a,ft.PureComponent=C,ft.StrictMode=r,ft.Suspense=f,ft.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,ft.__COMPILER_RUNTIME={__proto__:null,c:function(U){return D.H.useMemoCache(U)}},ft.cache=function(U){return function(){return U.apply(null,arguments)}},ft.cacheSignal=function(){return null},ft.cloneElement=function(U,X,z){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var Z=b({},U.props),re=U.key;if(X!=null)for(ae in X.key!==void 0&&(re=""+X.key),X)!O.call(X,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&X.ref===void 0||(Z[ae]=X[ae]);var ae=arguments.length-2;if(ae===1)Z.children=z;else if(1<ae){for(var se=Array(ae),le=0;le<ae;le++)se[le]=arguments[le+2];Z.children=se}return L(U.type,re,Z)},ft.createContext=function(U){return U={$$typeof:l,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:i,_context:U},U},ft.createElement=function(U,X,z){var Z,re={},ae=null;if(X!=null)for(Z in X.key!==void 0&&(ae=""+X.key),X)O.call(X,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(re[Z]=X[Z]);var se=arguments.length-2;if(se===1)re.children=z;else if(1<se){for(var le=Array(se),ie=0;ie<se;ie++)le[ie]=arguments[ie+2];re.children=le}if(U&&U.defaultProps)for(Z in se=U.defaultProps,se)re[Z]===void 0&&(re[Z]=se[Z]);return L(U,ae,re)},ft.createRef=function(){return{current:null}},ft.forwardRef=function(U){return{$$typeof:o,render:U}},ft.isValidElement=B,ft.lazy=function(U){return{$$typeof:h,_payload:{_status:-1,_result:U},_init:Y}},ft.memo=function(U,X){return{$$typeof:c,type:U,compare:X===void 0?null:X}},ft.startTransition=function(U){var X=D.T,z={};D.T=z;try{var Z=U(),re=D.S;re!==null&&re(z,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(A,Q)}catch(ae){Q(ae)}finally{X!==null&&z.types!==null&&(X.types=z.types),D.T=X}},ft.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},ft.use=function(U){return D.H.use(U)},ft.useActionState=function(U,X,z){return D.H.useActionState(U,X,z)},ft.useCallback=function(U,X){return D.H.useCallback(U,X)},ft.useContext=function(U){return D.H.useContext(U)},ft.useDebugValue=function(){},ft.useDeferredValue=function(U,X){return D.H.useDeferredValue(U,X)},ft.useEffect=function(U,X){return D.H.useEffect(U,X)},ft.useEffectEvent=function(U){return D.H.useEffectEvent(U)},ft.useId=function(){return D.H.useId()},ft.useImperativeHandle=function(U,X,z){return D.H.useImperativeHandle(U,X,z)},ft.useInsertionEffect=function(U,X){return D.H.useInsertionEffect(U,X)},ft.useLayoutEffect=function(U,X){return D.H.useLayoutEffect(U,X)},ft.useMemo=function(U,X){return D.H.useMemo(U,X)},ft.useOptimistic=function(U,X){return D.H.useOptimistic(U,X)},ft.useReducer=function(U,X,z){return D.H.useReducer(U,X,z)},ft.useRef=function(U){return D.H.useRef(U)},ft.useState=function(U){return D.H.useState(U)},ft.useSyncExternalStore=function(U,X,z){return D.H.useSyncExternalStore(U,X,z)},ft.useTransition=function(){return D.H.useTransition()},ft.version="19.2.4",ft}var YC;function w1(){return YC||(YC=1,Gy.exports=L4()),Gy.exports}var j=w1();const Wi=kd(j),mR=M4({__proto__:null,default:Wi},[j]);var $y={exports:{}},Tf={},Ky={exports:{}},Yy={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var XC;function P4(){return XC||(XC=1,(function(e){function t(F,V){var Y=F.length;F.push(V);e:for(;0<Y;){var Q=Y-1>>>1,I=F[Q];if(0<a(I,V))F[Q]=V,F[Y]=I,Y=Q;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var V=F[0],Y=F.pop();if(Y!==V){F[0]=Y;e:for(var Q=0,I=F.length,U=I>>>1;Q<U;){var X=2*(Q+1)-1,z=F[X],Z=X+1,re=F[Z];if(0>a(z,Y))Z<I&&0>a(re,z)?(F[Q]=re,F[Z]=Y,Q=Z):(F[Q]=z,F[X]=Y,Q=X);else if(Z<I&&0>a(re,Y))F[Q]=re,F[Z]=Y,Q=Z;else break e}}return V}function a(F,V){var Y=F.sortIndex-V.sortIndex;return Y!==0?Y:F.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var f=[],c=[],h=1,p=null,m=3,y=!1,x=!1,b=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(F){for(var V=n(c);V!==null;){if(V.callback===null)r(c);else if(V.startTime<=F)r(c),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(c)}}function R(F){if(b=!1,T(F),!x)if(n(f)!==null)x=!0,A||(A=!0,P());else{var V=n(c);V!==null&&G(R,V.startTime-F)}}var A=!1,D=-1,O=5,L=-1;function M(){return w?!0:!(e.unstable_now()-L<O)}function B(){if(w=!1,A){var F=e.unstable_now();L=F;var V=!0;try{e:{x=!1,b&&(b=!1,N(D),D=-1),y=!0;var Y=m;try{t:{for(T(F),p=n(f);p!==null&&!(p.expirationTime>F&&M());){var Q=p.callback;if(typeof Q=="function"){p.callback=null,m=p.priorityLevel;var I=Q(p.expirationTime<=F);if(F=e.unstable_now(),typeof I=="function"){p.callback=I,T(F),V=!0;break t}p===n(f)&&r(f),T(F)}else r(f);p=n(f)}if(p!==null)V=!0;else{var U=n(c);U!==null&&G(R,U.startTime-F),V=!1}}break e}finally{p=null,m=Y,y=!1}V=void 0}}finally{V?P():A=!1}}}var P;if(typeof C=="function")P=function(){C(B)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,H=q.port2;q.port1.onmessage=B,P=function(){H.postMessage(null)}}else P=function(){S(B,0)};function G(F,V){D=S(function(){F(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(F){switch(m){case 1:case 2:case 3:var V=3;break;default:V=m}var Y=m;m=V;try{return F()}finally{m=Y}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Y=m;m=F;try{return V()}finally{m=Y}},e.unstable_scheduleCallback=function(F,V,Y){var Q=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Q+Y:Q):Y=Q,F){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=Y+I,F={id:h++,callback:V,priorityLevel:F,startTime:Y,expirationTime:I,sortIndex:-1},Y>Q?(F.sortIndex=Y,t(c,F),n(f)===null&&F===n(c)&&(b?(N(D),D=-1):b=!0,G(R,Y-Q))):(F.sortIndex=I,t(f,F),x||y||(x=!0,A||(A=!0,P()))),F},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(F){var V=m;return function(){var Y=m;m=V;try{return F.apply(this,arguments)}finally{m=Y}}}})(Yy)),Yy}var QC;function B4(){return QC||(QC=1,Ky.exports=P4()),Ky.exports}var Xy={exports:{}},gr={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var WC;function z4(){if(WC)return gr;WC=1;var e=w1();function t(f){var c="https://react.dev/errors/"+f;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+f+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function i(f,c,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:p==null?null:""+p,children:f,containerInfo:c,implementation:h}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(f,c){if(f==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,gr.createPortal=function(f,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(t(299));return i(f,c,null,h)},gr.flushSync=function(f){var c=l.T,h=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=c,r.p=h,r.d.f()}},gr.preconnect=function(f,c){typeof f=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,r.d.C(f,c))},gr.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},gr.preinit=function(f,c){if(typeof f=="string"&&c&&typeof c.as=="string"){var h=c.as,p=o(h,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,y=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;h==="style"?r.d.S(f,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:y}):h==="script"&&r.d.X(f,{crossOrigin:p,integrity:m,fetchPriority:y,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},gr.preinitModule=function(f,c){if(typeof f=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var h=o(c.as,c.crossOrigin);r.d.M(f,{crossOrigin:h,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(f)},gr.preload=function(f,c){if(typeof f=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var h=c.as,p=o(h,c.crossOrigin);r.d.L(f,h,{crossOrigin:p,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},gr.preloadModule=function(f,c){if(typeof f=="string")if(c){var h=o(c.as,c.crossOrigin);r.d.m(f,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:h,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(f)},gr.requestFormReset=function(f){r.d.r(f)},gr.unstable_batchedUpdates=function(f,c){return f(c)},gr.useFormState=function(f,c,h){return l.H.useFormState(f,c,h)},gr.useFormStatus=function(){return l.H.useHostTransitionStatus()},gr.version="19.2.4",gr}var ZC;function gR(){if(ZC)return Xy.exports;ZC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xy.exports=z4(),Xy.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var JC;function I4(){if(JC)return Tf;JC=1;var e=B4(),t=w1(),n=gR();function r(s){var u="https://react.dev/errors/"+s;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)u+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+s+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function i(s){var u=s,v=s;if(s.alternate)for(;u.return;)u=u.return;else{s=u;do u=s,(u.flags&4098)!==0&&(v=u.return),s=u.return;while(s)}return u.tag===3?v:null}function l(s){if(s.tag===13){var u=s.memoizedState;if(u===null&&(s=s.alternate,s!==null&&(u=s.memoizedState)),u!==null)return u.dehydrated}return null}function o(s){if(s.tag===31){var u=s.memoizedState;if(u===null&&(s=s.alternate,s!==null&&(u=s.memoizedState)),u!==null)return u.dehydrated}return null}function f(s){if(i(s)!==s)throw Error(r(188))}function c(s){var u=s.alternate;if(!u){if(u=i(s),u===null)throw Error(r(188));return u!==s?null:s}for(var v=s,g=u;;){var E=v.return;if(E===null)break;var k=E.alternate;if(k===null){if(g=E.return,g!==null){v=g;continue}break}if(E.child===k.child){for(k=E.child;k;){if(k===v)return f(E),s;if(k===g)return f(E),u;k=k.sibling}throw Error(r(188))}if(v.return!==g.return)v=E,g=k;else{for(var _=!1,$=E.child;$;){if($===v){_=!0,v=E,g=k;break}if($===g){_=!0,g=E,v=k;break}$=$.sibling}if(!_){for($=k.child;$;){if($===v){_=!0,v=k,g=E;break}if($===g){_=!0,g=k,v=E;break}$=$.sibling}if(!_)throw Error(r(189))}}if(v.alternate!==g)throw Error(r(190))}if(v.tag!==3)throw Error(r(188));return v.stateNode.current===v?s:u}function h(s){var u=s.tag;if(u===5||u===26||u===27||u===6)return s;for(s=s.child;s!==null;){if(u=h(s),u!==null)return u;s=s.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=B&&s[B]||s["@@iterator"],typeof s=="function"?s:null)}var q=Symbol.for("react.client.reference");function H(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===q?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case b:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case R:return"Suspense";case A:return"SuspenseList";case L:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case C:return s.displayName||"Context";case N:return(s._context.displayName||"Context")+".Consumer";case T:var u=s.render;return s=s.displayName,s||(s=u.displayName||u.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case D:return u=s.displayName||null,u!==null?u:H(s.type)||"Memo";case O:u=s._payload,s=s._init;try{return H(s(u))}catch{}}return null}var G=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Q=[],I=-1;function U(s){return{current:s}}function X(s){0>I||(s.current=Q[I],Q[I]=null,I--)}function z(s,u){I++,Q[I]=s.current,s.current=u}var Z=U(null),re=U(null),ae=U(null),se=U(null);function le(s,u){switch(z(ae,u),z(re,s),z(Z,null),u.nodeType){case 9:case 11:s=(s=u.documentElement)&&(s=s.namespaceURI)?hC(s):0;break;default:if(s=u.tagName,u=u.namespaceURI)u=hC(u),s=vC(u,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(Z),z(Z,s)}function ie(){X(Z),X(re),X(ae)}function W(s){s.memoizedState!==null&&z(se,s);var u=Z.current,v=vC(u,s.type);u!==v&&(z(re,s),z(Z,v))}function te(s){re.current===s&&(X(Z),X(re)),se.current===s&&(X(se),Sf._currentValue=Y)}var oe,ye;function Te(s){if(oe===void 0)try{throw Error()}catch(v){var u=v.stack.trim().match(/\n( *(at )?)/);oe=u&&u[1]||"",ye=-1<v.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<v.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+oe+s+ye}var Be=!1;function ot(s,u){if(!s||Be)return"";Be=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(ge){var pe=ge}Reflect.construct(s,[],Ee)}else{try{Ee.call()}catch(ge){pe=ge}s.call(Ee.prototype)}}else{try{throw Error()}catch(ge){pe=ge}(Ee=s())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(ge){if(ge&&pe&&typeof ge.stack=="string")return[ge.stack,pe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var E=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");E&&E.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=g.DetermineComponentFrameRoot(),_=k[0],$=k[1];if(_&&$){var J=_.split(`
|
|
44
|
-
`),de=$.split(`
|
|
45
|
-
`);for(E=g=0;g<J.length&&!J[g].includes("DetermineComponentFrameRoot");)g++;for(;E<de.length&&!de[E].includes("DetermineComponentFrameRoot");)E++;if(g===J.length||E===de.length)for(g=J.length-1,E=de.length-1;1<=g&&0<=E&&J[g]!==de[E];)E--;for(;1<=g&&0<=E;g--,E--)if(J[g]!==de[E]){if(g!==1||E!==1)do if(g--,E--,0>E||J[g]!==de[E]){var we=`
|
|
46
|
-
`+J[g].replace(" at new "," at ");return s.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",s.displayName)),we}while(1<=g&&0<=E);break}}}finally{Be=!1,Error.prepareStackTrace=v}return(v=s?s.displayName||s.name:"")?Te(v):""}function Je(s,u){switch(s.tag){case 26:case 27:case 5:return Te(s.type);case 16:return Te("Lazy");case 13:return s.child!==u&&u!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return ot(s.type,!1);case 11:return ot(s.type.render,!1);case 1:return ot(s.type,!0);case 31:return Te("Activity");default:return""}}function We(s){try{var u="",v=null;do u+=Je(s,v),v=s,s=s.return;while(s);return u}catch(g){return`
|
|
47
|
-
Error generating stack: `+g.message+`
|
|
48
|
-
`+g.stack}}var Ve=Object.prototype.hasOwnProperty,De=e.unstable_scheduleCallback,Ye=e.unstable_cancelCallback,Qe=e.unstable_shouldYield,st=e.unstable_requestPaint,ze=e.unstable_now,dt=e.unstable_getCurrentPriorityLevel,ve=e.unstable_ImmediatePriority,Ce=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,_e=e.unstable_IdlePriority,Oe=e.log,xe=e.unstable_setDisableYieldValue,K=null,ce=null;function me(s){if(typeof Oe=="function"&&xe(s),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(K,s)}catch{}}var he=Math.clz32?Math.clz32:Ne,be=Math.log,Le=Math.LN2;function Ne(s){return s>>>=0,s===0?32:31-(be(s)/Le|0)|0}var Ke=256,Fe=262144,Ze=4194304;function ut(s){var u=s&42;if(u!==0)return u;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ct(s,u,v){var g=s.pendingLanes;if(g===0)return 0;var E=0,k=s.suspendedLanes,_=s.pingedLanes;s=s.warmLanes;var $=g&134217727;return $!==0?(g=$&~k,g!==0?E=ut(g):(_&=$,_!==0?E=ut(_):v||(v=$&~s,v!==0&&(E=ut(v))))):($=g&~k,$!==0?E=ut($):_!==0?E=ut(_):v||(v=g&~s,v!==0&&(E=ut(v)))),E===0?0:u!==0&&u!==E&&(u&k)===0&&(k=E&-E,v=u&-u,k>=v||k===32&&(v&4194048)!==0)?u:E}function He(s,u){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&u)===0}function bt(s,u){switch(s){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vt(){var s=Ze;return Ze<<=1,(Ze&62914560)===0&&(Ze=4194304),s}function hn(s){for(var u=[],v=0;31>v;v++)u.push(s);return u}function Vt(s,u){s.pendingLanes|=u,u!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function sr(s,u,v,g,E,k){var _=s.pendingLanes;s.pendingLanes=v,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=v,s.entangledLanes&=v,s.errorRecoveryDisabledLanes&=v,s.shellSuspendCounter=0;var $=s.entanglements,J=s.expirationTimes,de=s.hiddenUpdates;for(v=_&~v;0<v;){var we=31-he(v),Ee=1<<we;$[we]=0,J[we]=-1;var pe=de[we];if(pe!==null)for(de[we]=null,we=0;we<pe.length;we++){var ge=pe[we];ge!==null&&(ge.lane&=-536870913)}v&=~Ee}g!==0&&vn(s,g,0),k!==0&&E===0&&s.tag!==0&&(s.suspendedLanes|=k&~(_&~u))}function vn(s,u,v){s.pendingLanes|=u,s.suspendedLanes&=~u;var g=31-he(u);s.entangledLanes|=u,s.entanglements[g]=s.entanglements[g]|1073741824|v&261930}function Cn(s,u){var v=s.entangledLanes|=u;for(s=s.entanglements;v;){var g=31-he(v),E=1<<g;E&u|s[g]&u&&(s[g]|=u),v&=~E}}function yn(s,u){var v=u&-u;return v=(v&42)!==0?1:Nn(v),(v&(s.suspendedLanes|u))!==0?0:v}function Nn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function va(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function pn(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:BC(s.type))}function pa(s,u){var v=V.p;try{return V.p=s,u()}finally{V.p=v}}var Xn=Math.random().toString(36).slice(2),un="__reactFiber$"+Xn,In="__reactProps$"+Xn,Pr="__reactContainer$"+Xn,Qn="__reactEvents$"+Xn,Wn="__reactListeners$"+Xn,pr="__reactHandles$"+Xn,ys="__reactResources$"+Xn,Zn="__reactMarker$"+Xn;function Io(s){delete s[un],delete s[In],delete s[Qn],delete s[Wn],delete s[pr]}function xs(s){var u=s[un];if(u)return u;for(var v=s.parentNode;v;){if(u=v[Pr]||v[un]){if(v=u.alternate,u.child!==null||v!==null&&v.child!==null)for(s=wC(s);s!==null;){if(v=s[un])return v;s=wC(s)}return u}s=v,v=s.parentNode}return null}function bs(s){if(s=s[un]||s[Pr]){var u=s.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return s}return null}function Bl(s){var u=s.tag;if(u===5||u===26||u===27||u===6)return s.stateNode;throw Error(r(33))}function ws(s){var u=s[ys];return u||(u=s[ys]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function An(s){s[Zn]=!0}var eh=new Set,th={};function Jr(s,u){ei(s,u),ei(s+"Capture",u)}function ei(s,u){for(th[s]=u,s=0;s<u.length;s++)eh.add(u[s])}var Fo=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Pc={},Bc={};function Lm(s){return Ve.call(Bc,s)?!0:Ve.call(Pc,s)?!1:Fo.test(s)?Bc[s]=!0:(Pc[s]=!0,!1)}function mr(s,u,v){if(Lm(u))if(v===null)s.removeAttribute(u);else{switch(typeof v){case"undefined":case"function":case"symbol":s.removeAttribute(u);return;case"boolean":var g=u.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){s.removeAttribute(u);return}}s.setAttribute(u,""+v)}}function Ss(s,u,v){if(v===null)s.removeAttribute(u);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttribute(u,""+v)}}function ma(s,u,v,g){if(g===null)s.removeAttribute(v);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(v);return}s.setAttributeNS(u,v,""+g)}}function Jn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Br(s){var u=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Pm(s,u,v){var g=Object.getOwnPropertyDescriptor(s.constructor.prototype,u);if(!s.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var E=g.get,k=g.set;return Object.defineProperty(s,u,{configurable:!0,get:function(){return E.call(this)},set:function(_){v=""+_,k.call(this,_)}}),Object.defineProperty(s,u,{enumerable:g.enumerable}),{getValue:function(){return v},setValue:function(_){v=""+_},stopTracking:function(){s._valueTracker=null,delete s[u]}}}}function nh(s){if(!s._valueTracker){var u=Br(s)?"checked":"value";s._valueTracker=Pm(s,u,""+s[u])}}function rh(s){if(!s)return!1;var u=s._valueTracker;if(!u)return!0;var v=u.getValue(),g="";return s&&(g=Br(s)?s.checked?"true":"false":s.value),s=g,s!==v?(u.setValue(s),!0):!1}function ah(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var k3=/[\n"\\]/g;function ga(s){return s.replace(k3,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function Bm(s,u,v,g,E,k,_,$){s.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.type=_:s.removeAttribute("type"),u!=null?_==="number"?(u===0&&s.value===""||s.value!=u)&&(s.value=""+Jn(u)):s.value!==""+Jn(u)&&(s.value=""+Jn(u)):_!=="submit"&&_!=="reset"||s.removeAttribute("value"),u!=null?zm(s,_,Jn(u)):v!=null?zm(s,_,Jn(v)):g!=null&&s.removeAttribute("value"),E==null&&k!=null&&(s.defaultChecked=!!k),E!=null&&(s.checked=E&&typeof E!="function"&&typeof E!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?s.name=""+Jn($):s.removeAttribute("name")}function lS(s,u,v,g,E,k,_,$){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.type=k),u!=null||v!=null){if(!(k!=="submit"&&k!=="reset"||u!=null)){nh(s);return}v=v!=null?""+Jn(v):"",u=u!=null?""+Jn(u):v,$||u===s.value||(s.value=u),s.defaultValue=u}g=g??E,g=typeof g!="function"&&typeof g!="symbol"&&!!g,s.checked=$?s.checked:!!g,s.defaultChecked=!!g,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.name=_),nh(s)}function zm(s,u,v){u==="number"&&ah(s.ownerDocument)===s||s.defaultValue===""+v||(s.defaultValue=""+v)}function Uo(s,u,v,g){if(s=s.options,u){u={};for(var E=0;E<v.length;E++)u["$"+v[E]]=!0;for(v=0;v<s.length;v++)E=u.hasOwnProperty("$"+s[v].value),s[v].selected!==E&&(s[v].selected=E),E&&g&&(s[v].defaultSelected=!0)}else{for(v=""+Jn(v),u=null,E=0;E<s.length;E++){if(s[E].value===v){s[E].selected=!0,g&&(s[E].defaultSelected=!0);return}u!==null||s[E].disabled||(u=s[E])}u!==null&&(u.selected=!0)}}function oS(s,u,v){if(u!=null&&(u=""+Jn(u),u!==s.value&&(s.value=u),v==null)){s.defaultValue!==u&&(s.defaultValue=u);return}s.defaultValue=v!=null?""+Jn(v):""}function uS(s,u,v,g){if(u==null){if(g!=null){if(v!=null)throw Error(r(92));if(G(g)){if(1<g.length)throw Error(r(93));g=g[0]}v=g}v==null&&(v=""),u=v}v=Jn(u),s.defaultValue=v,g=s.textContent,g===v&&g!==""&&g!==null&&(s.value=g),nh(s)}function qo(s,u){if(u){var v=s.firstChild;if(v&&v===s.lastChild&&v.nodeType===3){v.nodeValue=u;return}}s.textContent=u}var T3=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function cS(s,u,v){var g=u.indexOf("--")===0;v==null||typeof v=="boolean"||v===""?g?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="":g?s.setProperty(u,v):typeof v!="number"||v===0||T3.has(u)?u==="float"?s.cssFloat=v:s[u]=(""+v).trim():s[u]=v+"px"}function fS(s,u,v){if(u!=null&&typeof u!="object")throw Error(r(62));if(s=s.style,v!=null){for(var g in v)!v.hasOwnProperty(g)||u!=null&&u.hasOwnProperty(g)||(g.indexOf("--")===0?s.setProperty(g,""):g==="float"?s.cssFloat="":s[g]="");for(var E in u)g=u[E],u.hasOwnProperty(E)&&v[E]!==g&&cS(s,E,g)}else for(var k in u)u.hasOwnProperty(k)&&cS(s,k,u[k])}function Im(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var j3=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),A3=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ih(s){return A3.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ri(){}var Fm=null;function Um(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Vo=null,Ho=null;function dS(s){var u=bs(s);if(u&&(s=u.stateNode)){var v=s[In]||null;e:switch(s=u.stateNode,u.type){case"input":if(Bm(s,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name),u=v.name,v.type==="radio"&&u!=null){for(v=s;v.parentNode;)v=v.parentNode;for(v=v.querySelectorAll('input[name="'+ga(""+u)+'"][type="radio"]'),u=0;u<v.length;u++){var g=v[u];if(g!==s&&g.form===s.form){var E=g[In]||null;if(!E)throw Error(r(90));Bm(g,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name)}}for(u=0;u<v.length;u++)g=v[u],g.form===s.form&&rh(g)}break e;case"textarea":oS(s,v.value,v.defaultValue);break e;case"select":u=v.value,u!=null&&Uo(s,!!v.multiple,u,!1)}}}var qm=!1;function hS(s,u,v){if(qm)return s(u,v);qm=!0;try{var g=s(u);return g}finally{if(qm=!1,(Vo!==null||Ho!==null)&&($h(),Vo&&(u=Vo,s=Ho,Ho=Vo=null,dS(u),s)))for(u=0;u<s.length;u++)dS(s[u])}}function zc(s,u){var v=s.stateNode;if(v===null)return null;var g=v[In]||null;if(g===null)return null;v=g[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(v&&typeof v!="function")throw Error(r(231,u,typeof v));return v}var Di=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vm=!1;if(Di)try{var Ic={};Object.defineProperty(Ic,"passive",{get:function(){Vm=!0}}),window.addEventListener("test",Ic,Ic),window.removeEventListener("test",Ic,Ic)}catch{Vm=!1}var Es=null,Hm=null,sh=null;function vS(){if(sh)return sh;var s,u=Hm,v=u.length,g,E="value"in Es?Es.value:Es.textContent,k=E.length;for(s=0;s<v&&u[s]===E[s];s++);var _=v-s;for(g=1;g<=_&&u[v-g]===E[k-g];g++);return sh=E.slice(s,1<g?1-g:void 0)}function lh(s){var u=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&u===13&&(s=13)):s=u,s===10&&(s=13),32<=s||s===13?s:0}function oh(){return!0}function pS(){return!1}function zr(s){function u(v,g,E,k,_){this._reactName=v,this._targetInst=E,this.type=g,this.nativeEvent=k,this.target=_,this.currentTarget=null;for(var $ in s)s.hasOwnProperty($)&&(v=s[$],this[$]=v?v(k):k[$]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?oh:pS,this.isPropagationStopped=pS,this}return p(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var v=this.nativeEvent;v&&(v.preventDefault?v.preventDefault():typeof v.returnValue!="unknown"&&(v.returnValue=!1),this.isDefaultPrevented=oh)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=oh)},persist:function(){},isPersistent:oh}),u}var zl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uh=zr(zl),Fc=p({},zl,{view:0,detail:0}),R3=zr(Fc),Gm,$m,Uc,ch=p({},Fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ym,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Uc&&(Uc&&s.type==="mousemove"?(Gm=s.screenX-Uc.screenX,$m=s.screenY-Uc.screenY):$m=Gm=0,Uc=s),Gm)},movementY:function(s){return"movementY"in s?s.movementY:$m}}),mS=zr(ch),D3=p({},ch,{dataTransfer:0}),M3=zr(D3),_3=p({},Fc,{relatedTarget:0}),Km=zr(_3),O3=p({},zl,{animationName:0,elapsedTime:0,pseudoElement:0}),L3=zr(O3),P3=p({},zl,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),B3=zr(P3),z3=p({},zl,{data:0}),gS=zr(z3),I3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},F3={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},U3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function q3(s){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(s):(s=U3[s])?!!u[s]:!1}function Ym(){return q3}var V3=p({},Fc,{key:function(s){if(s.key){var u=I3[s.key]||s.key;if(u!=="Unidentified")return u}return s.type==="keypress"?(s=lh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?F3[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ym,charCode:function(s){return s.type==="keypress"?lh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?lh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),H3=zr(V3),G3=p({},ch,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yS=zr(G3),$3=p({},Fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ym}),K3=zr($3),Y3=p({},zl,{propertyName:0,elapsedTime:0,pseudoElement:0}),X3=zr(Y3),Q3=p({},ch,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),W3=zr(Q3),Z3=p({},zl,{newState:0,oldState:0}),J3=zr(Z3),e5=[9,13,27,32],Xm=Di&&"CompositionEvent"in window,qc=null;Di&&"documentMode"in document&&(qc=document.documentMode);var t5=Di&&"TextEvent"in window&&!qc,xS=Di&&(!Xm||qc&&8<qc&&11>=qc),bS=" ",wS=!1;function SS(s,u){switch(s){case"keyup":return e5.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ES(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Go=!1;function n5(s,u){switch(s){case"compositionend":return ES(u);case"keypress":return u.which!==32?null:(wS=!0,bS);case"textInput":return s=u.data,s===bS&&wS?null:s;default:return null}}function r5(s,u){if(Go)return s==="compositionend"||!Xm&&SS(s,u)?(s=vS(),sh=Hm=Es=null,Go=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return xS&&u.locale!=="ko"?null:u.data;default:return null}}var a5={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function CS(s){var u=s&&s.nodeName&&s.nodeName.toLowerCase();return u==="input"?!!a5[s.type]:u==="textarea"}function NS(s,u,v,g){Vo?Ho?Ho.push(g):Ho=[g]:Vo=g,u=Jh(u,"onChange"),0<u.length&&(v=new uh("onChange","change",null,v,g),s.push({event:v,listeners:u}))}var Vc=null,Hc=null;function i5(s){lC(s,0)}function fh(s){var u=Bl(s);if(rh(u))return s}function kS(s,u){if(s==="change")return u}var TS=!1;if(Di){var Qm;if(Di){var Wm="oninput"in document;if(!Wm){var jS=document.createElement("div");jS.setAttribute("oninput","return;"),Wm=typeof jS.oninput=="function"}Qm=Wm}else Qm=!1;TS=Qm&&(!document.documentMode||9<document.documentMode)}function AS(){Vc&&(Vc.detachEvent("onpropertychange",RS),Hc=Vc=null)}function RS(s){if(s.propertyName==="value"&&fh(Hc)){var u=[];NS(u,Hc,s,Um(s)),hS(i5,u)}}function s5(s,u,v){s==="focusin"?(AS(),Vc=u,Hc=v,Vc.attachEvent("onpropertychange",RS)):s==="focusout"&&AS()}function l5(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return fh(Hc)}function o5(s,u){if(s==="click")return fh(u)}function u5(s,u){if(s==="input"||s==="change")return fh(u)}function c5(s,u){return s===u&&(s!==0||1/s===1/u)||s!==s&&u!==u}var ea=typeof Object.is=="function"?Object.is:c5;function Gc(s,u){if(ea(s,u))return!0;if(typeof s!="object"||s===null||typeof u!="object"||u===null)return!1;var v=Object.keys(s),g=Object.keys(u);if(v.length!==g.length)return!1;for(g=0;g<v.length;g++){var E=v[g];if(!Ve.call(u,E)||!ea(s[E],u[E]))return!1}return!0}function DS(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function MS(s,u){var v=DS(s);s=0;for(var g;v;){if(v.nodeType===3){if(g=s+v.textContent.length,s<=u&&g>=u)return{node:v,offset:u-s};s=g}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=DS(v)}}function _S(s,u){return s&&u?s===u?!0:s&&s.nodeType===3?!1:u&&u.nodeType===3?_S(s,u.parentNode):"contains"in s?s.contains(u):s.compareDocumentPosition?!!(s.compareDocumentPosition(u)&16):!1:!1}function OS(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var u=ah(s.document);u instanceof s.HTMLIFrameElement;){try{var v=typeof u.contentWindow.location.href=="string"}catch{v=!1}if(v)s=u.contentWindow;else break;u=ah(s.document)}return u}function Zm(s){var u=s&&s.nodeName&&s.nodeName.toLowerCase();return u&&(u==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||u==="textarea"||s.contentEditable==="true")}var f5=Di&&"documentMode"in document&&11>=document.documentMode,$o=null,Jm=null,$c=null,eg=!1;function LS(s,u,v){var g=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;eg||$o==null||$o!==ah(g)||(g=$o,"selectionStart"in g&&Zm(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),$c&&Gc($c,g)||($c=g,g=Jh(Jm,"onSelect"),0<g.length&&(u=new uh("onSelect","select",null,u,v),s.push({event:u,listeners:g}),u.target=$o)))}function Il(s,u){var v={};return v[s.toLowerCase()]=u.toLowerCase(),v["Webkit"+s]="webkit"+u,v["Moz"+s]="moz"+u,v}var Ko={animationend:Il("Animation","AnimationEnd"),animationiteration:Il("Animation","AnimationIteration"),animationstart:Il("Animation","AnimationStart"),transitionrun:Il("Transition","TransitionRun"),transitionstart:Il("Transition","TransitionStart"),transitioncancel:Il("Transition","TransitionCancel"),transitionend:Il("Transition","TransitionEnd")},tg={},PS={};Di&&(PS=document.createElement("div").style,"AnimationEvent"in window||(delete Ko.animationend.animation,delete Ko.animationiteration.animation,delete Ko.animationstart.animation),"TransitionEvent"in window||delete Ko.transitionend.transition);function Fl(s){if(tg[s])return tg[s];if(!Ko[s])return s;var u=Ko[s],v;for(v in u)if(u.hasOwnProperty(v)&&v in PS)return tg[s]=u[v];return s}var BS=Fl("animationend"),zS=Fl("animationiteration"),IS=Fl("animationstart"),d5=Fl("transitionrun"),h5=Fl("transitionstart"),v5=Fl("transitioncancel"),FS=Fl("transitionend"),US=new Map,ng="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ng.push("scrollEnd");function za(s,u){US.set(s,u),Jr(u,[s])}var dh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},ya=[],Yo=0,rg=0;function hh(){for(var s=Yo,u=rg=Yo=0;u<s;){var v=ya[u];ya[u++]=null;var g=ya[u];ya[u++]=null;var E=ya[u];ya[u++]=null;var k=ya[u];if(ya[u++]=null,g!==null&&E!==null){var _=g.pending;_===null?E.next=E:(E.next=_.next,_.next=E),g.pending=E}k!==0&&qS(v,E,k)}}function vh(s,u,v,g){ya[Yo++]=s,ya[Yo++]=u,ya[Yo++]=v,ya[Yo++]=g,rg|=g,s.lanes|=g,s=s.alternate,s!==null&&(s.lanes|=g)}function ag(s,u,v,g){return vh(s,u,v,g),ph(s)}function Ul(s,u){return vh(s,null,null,u),ph(s)}function qS(s,u,v){s.lanes|=v;var g=s.alternate;g!==null&&(g.lanes|=v);for(var E=!1,k=s.return;k!==null;)k.childLanes|=v,g=k.alternate,g!==null&&(g.childLanes|=v),k.tag===22&&(s=k.stateNode,s===null||s._visibility&1||(E=!0)),s=k,k=k.return;return s.tag===3?(k=s.stateNode,E&&u!==null&&(E=31-he(v),s=k.hiddenUpdates,g=s[E],g===null?s[E]=[u]:g.push(u),u.lane=v|536870912),k):null}function ph(s){if(50<pf)throw pf=0,hy=null,Error(r(185));for(var u=s.return;u!==null;)s=u,u=s.return;return s.tag===3?s.stateNode:null}var Xo={};function p5(s,u,v,g){this.tag=s,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ta(s,u,v,g){return new p5(s,u,v,g)}function ig(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Mi(s,u){var v=s.alternate;return v===null?(v=ta(s.tag,u,s.key,s.mode),v.elementType=s.elementType,v.type=s.type,v.stateNode=s.stateNode,v.alternate=s,s.alternate=v):(v.pendingProps=u,v.type=s.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=s.flags&65011712,v.childLanes=s.childLanes,v.lanes=s.lanes,v.child=s.child,v.memoizedProps=s.memoizedProps,v.memoizedState=s.memoizedState,v.updateQueue=s.updateQueue,u=s.dependencies,v.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},v.sibling=s.sibling,v.index=s.index,v.ref=s.ref,v.refCleanup=s.refCleanup,v}function VS(s,u){s.flags&=65011714;var v=s.alternate;return v===null?(s.childLanes=0,s.lanes=u,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=v.childLanes,s.lanes=v.lanes,s.child=v.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=v.memoizedProps,s.memoizedState=v.memoizedState,s.updateQueue=v.updateQueue,s.type=v.type,u=v.dependencies,s.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),s}function mh(s,u,v,g,E,k){var _=0;if(g=s,typeof s=="function")ig(s)&&(_=1);else if(typeof s=="string")_=b4(s,v,Z.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case L:return s=ta(31,v,u,E),s.elementType=L,s.lanes=k,s;case b:return ql(v.children,E,k,u);case w:_=8,E|=24;break;case S:return s=ta(12,v,u,E|2),s.elementType=S,s.lanes=k,s;case R:return s=ta(13,v,u,E),s.elementType=R,s.lanes=k,s;case A:return s=ta(19,v,u,E),s.elementType=A,s.lanes=k,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case C:_=10;break e;case N:_=9;break e;case T:_=11;break e;case D:_=14;break e;case O:_=16,g=null;break e}_=29,v=Error(r(130,s===null?"null":typeof s,"")),g=null}return u=ta(_,v,u,E),u.elementType=s,u.type=g,u.lanes=k,u}function ql(s,u,v,g){return s=ta(7,s,g,u),s.lanes=v,s}function sg(s,u,v){return s=ta(6,s,null,u),s.lanes=v,s}function HS(s){var u=ta(18,null,null,0);return u.stateNode=s,u}function lg(s,u,v){return u=ta(4,s.children!==null?s.children:[],s.key,u),u.lanes=v,u.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},u}var GS=new WeakMap;function xa(s,u){if(typeof s=="object"&&s!==null){var v=GS.get(s);return v!==void 0?v:(u={value:s,source:u,stack:We(u)},GS.set(s,u),u)}return{value:s,source:u,stack:We(u)}}var Qo=[],Wo=0,gh=null,Kc=0,ba=[],wa=0,Cs=null,ti=1,ni="";function _i(s,u){Qo[Wo++]=Kc,Qo[Wo++]=gh,gh=s,Kc=u}function $S(s,u,v){ba[wa++]=ti,ba[wa++]=ni,ba[wa++]=Cs,Cs=s;var g=ti;s=ni;var E=32-he(g)-1;g&=~(1<<E),v+=1;var k=32-he(u)+E;if(30<k){var _=E-E%5;k=(g&(1<<_)-1).toString(32),g>>=_,E-=_,ti=1<<32-he(u)+E|v<<E|g,ni=k+s}else ti=1<<k|v<<E|g,ni=s}function og(s){s.return!==null&&(_i(s,1),$S(s,1,0))}function ug(s){for(;s===gh;)gh=Qo[--Wo],Qo[Wo]=null,Kc=Qo[--Wo],Qo[Wo]=null;for(;s===Cs;)Cs=ba[--wa],ba[wa]=null,ni=ba[--wa],ba[wa]=null,ti=ba[--wa],ba[wa]=null}function KS(s,u){ba[wa++]=ti,ba[wa++]=ni,ba[wa++]=Cs,ti=u.id,ni=u.overflow,Cs=s}var lr=null,an=null,jt=!1,Ns=null,Sa=!1,cg=Error(r(519));function ks(s){var u=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yc(xa(u,s)),cg}function YS(s){var u=s.stateNode,v=s.type,g=s.memoizedProps;switch(u[un]=s,u[In]=g,v){case"dialog":Ct("cancel",u),Ct("close",u);break;case"iframe":case"object":case"embed":Ct("load",u);break;case"video":case"audio":for(v=0;v<gf.length;v++)Ct(gf[v],u);break;case"source":Ct("error",u);break;case"img":case"image":case"link":Ct("error",u),Ct("load",u);break;case"details":Ct("toggle",u);break;case"input":Ct("invalid",u),lS(u,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Ct("invalid",u);break;case"textarea":Ct("invalid",u),uS(u,g.value,g.defaultValue,g.children)}v=g.children,typeof v!="string"&&typeof v!="number"&&typeof v!="bigint"||u.textContent===""+v||g.suppressHydrationWarning===!0||fC(u.textContent,v)?(g.popover!=null&&(Ct("beforetoggle",u),Ct("toggle",u)),g.onScroll!=null&&Ct("scroll",u),g.onScrollEnd!=null&&Ct("scrollend",u),g.onClick!=null&&(u.onclick=Ri),u=!0):u=!1,u||ks(s,!0)}function XS(s){for(lr=s.return;lr;)switch(lr.tag){case 5:case 31:case 13:Sa=!1;return;case 27:case 3:Sa=!0;return;default:lr=lr.return}}function Zo(s){if(s!==lr)return!1;if(!jt)return XS(s),jt=!0,!1;var u=s.tag,v;if((v=u!==3&&u!==27)&&((v=u===5)&&(v=s.type,v=!(v!=="form"&&v!=="button")||jy(s.type,s.memoizedProps)),v=!v),v&&an&&ks(s),XS(s),u===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));an=bC(s)}else if(u===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));an=bC(s)}else u===27?(u=an,Fs(s.type)?(s=_y,_y=null,an=s):an=u):an=lr?Ca(s.stateNode.nextSibling):null;return!0}function Vl(){an=lr=null,jt=!1}function fg(){var s=Ns;return s!==null&&(qr===null?qr=s:qr.push.apply(qr,s),Ns=null),s}function Yc(s){Ns===null?Ns=[s]:Ns.push(s)}var dg=U(null),Hl=null,Oi=null;function Ts(s,u,v){z(dg,u._currentValue),u._currentValue=v}function Li(s){s._currentValue=dg.current,X(dg)}function hg(s,u,v){for(;s!==null;){var g=s.alternate;if((s.childLanes&u)!==u?(s.childLanes|=u,g!==null&&(g.childLanes|=u)):g!==null&&(g.childLanes&u)!==u&&(g.childLanes|=u),s===v)break;s=s.return}}function vg(s,u,v,g){var E=s.child;for(E!==null&&(E.return=s);E!==null;){var k=E.dependencies;if(k!==null){var _=E.child;k=k.firstContext;e:for(;k!==null;){var $=k;k=E;for(var J=0;J<u.length;J++)if($.context===u[J]){k.lanes|=v,$=k.alternate,$!==null&&($.lanes|=v),hg(k.return,v,s),g||(_=null);break e}k=$.next}}else if(E.tag===18){if(_=E.return,_===null)throw Error(r(341));_.lanes|=v,k=_.alternate,k!==null&&(k.lanes|=v),hg(_,v,s),_=null}else _=E.child;if(_!==null)_.return=E;else for(_=E;_!==null;){if(_===s){_=null;break}if(E=_.sibling,E!==null){E.return=_.return,_=E;break}_=_.return}E=_}}function Jo(s,u,v,g){s=null;for(var E=u,k=!1;E!==null;){if(!k){if((E.flags&524288)!==0)k=!0;else if((E.flags&262144)!==0)break}if(E.tag===10){var _=E.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var $=E.type;ea(E.pendingProps.value,_.value)||(s!==null?s.push($):s=[$])}}else if(E===se.current){if(_=E.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==E.memoizedState.memoizedState&&(s!==null?s.push(Sf):s=[Sf])}E=E.return}s!==null&&vg(u,s,v,g),u.flags|=262144}function yh(s){for(s=s.firstContext;s!==null;){if(!ea(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Gl(s){Hl=s,Oi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function or(s){return QS(Hl,s)}function xh(s,u){return Hl===null&&Gl(s),QS(s,u)}function QS(s,u){var v=u._currentValue;if(u={context:u,memoizedValue:v,next:null},Oi===null){if(s===null)throw Error(r(308));Oi=u,s.dependencies={lanes:0,firstContext:u},s.flags|=524288}else Oi=Oi.next=u;return v}var m5=typeof AbortController<"u"?AbortController:function(){var s=[],u=this.signal={aborted:!1,addEventListener:function(v,g){s.push(g)}};this.abort=function(){u.aborted=!0,s.forEach(function(v){return v()})}},g5=e.unstable_scheduleCallback,y5=e.unstable_NormalPriority,Rn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pg(){return{controller:new m5,data:new Map,refCount:0}}function Xc(s){s.refCount--,s.refCount===0&&g5(y5,function(){s.controller.abort()})}var Qc=null,mg=0,eu=0,tu=null;function x5(s,u){if(Qc===null){var v=Qc=[];mg=0,eu=xy(),tu={status:"pending",value:void 0,then:function(g){v.push(g)}}}return mg++,u.then(WS,WS),u}function WS(){if(--mg===0&&Qc!==null){tu!==null&&(tu.status="fulfilled");var s=Qc;Qc=null,eu=0,tu=null;for(var u=0;u<s.length;u++)(0,s[u])()}}function b5(s,u){var v=[],g={status:"pending",value:null,reason:null,then:function(E){v.push(E)}};return s.then(function(){g.status="fulfilled",g.value=u;for(var E=0;E<v.length;E++)(0,v[E])(u)},function(E){for(g.status="rejected",g.reason=E,E=0;E<v.length;E++)(0,v[E])(void 0)}),g}var ZS=F.S;F.S=function(s,u){L2=ze(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&x5(s,u),ZS!==null&&ZS(s,u)};var $l=U(null);function gg(){var s=$l.current;return s!==null?s:Xt.pooledCache}function bh(s,u){u===null?z($l,$l.current):z($l,u.pool)}function JS(){var s=gg();return s===null?null:{parent:Rn._currentValue,pool:s}}var nu=Error(r(460)),yg=Error(r(474)),wh=Error(r(542)),Sh={then:function(){}};function eE(s){return s=s.status,s==="fulfilled"||s==="rejected"}function tE(s,u,v){switch(v=s[v],v===void 0?s.push(u):v!==u&&(u.then(Ri,Ri),u=v),u.status){case"fulfilled":return u.value;case"rejected":throw s=u.reason,rE(s),s;default:if(typeof u.status=="string")u.then(Ri,Ri);else{if(s=Xt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=u,s.status="pending",s.then(function(g){if(u.status==="pending"){var E=u;E.status="fulfilled",E.value=g}},function(g){if(u.status==="pending"){var E=u;E.status="rejected",E.reason=g}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw s=u.reason,rE(s),s}throw Yl=u,nu}}function Kl(s){try{var u=s._init;return u(s._payload)}catch(v){throw v!==null&&typeof v=="object"&&typeof v.then=="function"?(Yl=v,nu):v}}var Yl=null;function nE(){if(Yl===null)throw Error(r(459));var s=Yl;return Yl=null,s}function rE(s){if(s===nu||s===wh)throw Error(r(483))}var ru=null,Wc=0;function Eh(s){var u=Wc;return Wc+=1,ru===null&&(ru=[]),tE(ru,s,u)}function Zc(s,u){u=u.props.ref,s.ref=u!==void 0?u:null}function Ch(s,u){throw u.$$typeof===m?Error(r(525)):(s=Object.prototype.toString.call(u),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":s)))}function aE(s){function u(ue,ne){if(s){var fe=ue.deletions;fe===null?(ue.deletions=[ne],ue.flags|=16):fe.push(ne)}}function v(ue,ne){if(!s)return null;for(;ne!==null;)u(ue,ne),ne=ne.sibling;return null}function g(ue){for(var ne=new Map;ue!==null;)ue.key!==null?ne.set(ue.key,ue):ne.set(ue.index,ue),ue=ue.sibling;return ne}function E(ue,ne){return ue=Mi(ue,ne),ue.index=0,ue.sibling=null,ue}function k(ue,ne,fe){return ue.index=fe,s?(fe=ue.alternate,fe!==null?(fe=fe.index,fe<ne?(ue.flags|=67108866,ne):fe):(ue.flags|=67108866,ne)):(ue.flags|=1048576,ne)}function _(ue){return s&&ue.alternate===null&&(ue.flags|=67108866),ue}function $(ue,ne,fe,Se){return ne===null||ne.tag!==6?(ne=sg(fe,ue.mode,Se),ne.return=ue,ne):(ne=E(ne,fe),ne.return=ue,ne)}function J(ue,ne,fe,Se){var nt=fe.type;return nt===b?we(ue,ne,fe.props.children,Se,fe.key):ne!==null&&(ne.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===O&&Kl(nt)===ne.type)?(ne=E(ne,fe.props),Zc(ne,fe),ne.return=ue,ne):(ne=mh(fe.type,fe.key,fe.props,null,ue.mode,Se),Zc(ne,fe),ne.return=ue,ne)}function de(ue,ne,fe,Se){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==fe.containerInfo||ne.stateNode.implementation!==fe.implementation?(ne=lg(fe,ue.mode,Se),ne.return=ue,ne):(ne=E(ne,fe.children||[]),ne.return=ue,ne)}function we(ue,ne,fe,Se,nt){return ne===null||ne.tag!==7?(ne=ql(fe,ue.mode,Se,nt),ne.return=ue,ne):(ne=E(ne,fe),ne.return=ue,ne)}function Ee(ue,ne,fe){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=sg(""+ne,ue.mode,fe),ne.return=ue,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:return fe=mh(ne.type,ne.key,ne.props,null,ue.mode,fe),Zc(fe,ne),fe.return=ue,fe;case x:return ne=lg(ne,ue.mode,fe),ne.return=ue,ne;case O:return ne=Kl(ne),Ee(ue,ne,fe)}if(G(ne)||P(ne))return ne=ql(ne,ue.mode,fe,null),ne.return=ue,ne;if(typeof ne.then=="function")return Ee(ue,Eh(ne),fe);if(ne.$$typeof===C)return Ee(ue,xh(ue,ne),fe);Ch(ue,ne)}return null}function pe(ue,ne,fe,Se){var nt=ne!==null?ne.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return nt!==null?null:$(ue,ne,""+fe,Se);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:return fe.key===nt?J(ue,ne,fe,Se):null;case x:return fe.key===nt?de(ue,ne,fe,Se):null;case O:return fe=Kl(fe),pe(ue,ne,fe,Se)}if(G(fe)||P(fe))return nt!==null?null:we(ue,ne,fe,Se,null);if(typeof fe.then=="function")return pe(ue,ne,Eh(fe),Se);if(fe.$$typeof===C)return pe(ue,ne,xh(ue,fe),Se);Ch(ue,fe)}return null}function ge(ue,ne,fe,Se,nt){if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return ue=ue.get(fe)||null,$(ne,ue,""+Se,nt);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case y:return ue=ue.get(Se.key===null?fe:Se.key)||null,J(ne,ue,Se,nt);case x:return ue=ue.get(Se.key===null?fe:Se.key)||null,de(ne,ue,Se,nt);case O:return Se=Kl(Se),ge(ue,ne,fe,Se,nt)}if(G(Se)||P(Se))return ue=ue.get(fe)||null,we(ne,ue,Se,nt,null);if(typeof Se.then=="function")return ge(ue,ne,fe,Eh(Se),nt);if(Se.$$typeof===C)return ge(ue,ne,fe,xh(ne,Se),nt);Ch(ne,Se)}return null}function Ge(ue,ne,fe,Se){for(var nt=null,_t=null,Xe=ne,pt=ne=0,Tt=null;Xe!==null&&pt<fe.length;pt++){Xe.index>pt?(Tt=Xe,Xe=null):Tt=Xe.sibling;var Ot=pe(ue,Xe,fe[pt],Se);if(Ot===null){Xe===null&&(Xe=Tt);break}s&&Xe&&Ot.alternate===null&&u(ue,Xe),ne=k(Ot,ne,pt),_t===null?nt=Ot:_t.sibling=Ot,_t=Ot,Xe=Tt}if(pt===fe.length)return v(ue,Xe),jt&&_i(ue,pt),nt;if(Xe===null){for(;pt<fe.length;pt++)Xe=Ee(ue,fe[pt],Se),Xe!==null&&(ne=k(Xe,ne,pt),_t===null?nt=Xe:_t.sibling=Xe,_t=Xe);return jt&&_i(ue,pt),nt}for(Xe=g(Xe);pt<fe.length;pt++)Tt=ge(Xe,ue,pt,fe[pt],Se),Tt!==null&&(s&&Tt.alternate!==null&&Xe.delete(Tt.key===null?pt:Tt.key),ne=k(Tt,ne,pt),_t===null?nt=Tt:_t.sibling=Tt,_t=Tt);return s&&Xe.forEach(function(Gs){return u(ue,Gs)}),jt&&_i(ue,pt),nt}function it(ue,ne,fe,Se){if(fe==null)throw Error(r(151));for(var nt=null,_t=null,Xe=ne,pt=ne=0,Tt=null,Ot=fe.next();Xe!==null&&!Ot.done;pt++,Ot=fe.next()){Xe.index>pt?(Tt=Xe,Xe=null):Tt=Xe.sibling;var Gs=pe(ue,Xe,Ot.value,Se);if(Gs===null){Xe===null&&(Xe=Tt);break}s&&Xe&&Gs.alternate===null&&u(ue,Xe),ne=k(Gs,ne,pt),_t===null?nt=Gs:_t.sibling=Gs,_t=Gs,Xe=Tt}if(Ot.done)return v(ue,Xe),jt&&_i(ue,pt),nt;if(Xe===null){for(;!Ot.done;pt++,Ot=fe.next())Ot=Ee(ue,Ot.value,Se),Ot!==null&&(ne=k(Ot,ne,pt),_t===null?nt=Ot:_t.sibling=Ot,_t=Ot);return jt&&_i(ue,pt),nt}for(Xe=g(Xe);!Ot.done;pt++,Ot=fe.next())Ot=ge(Xe,ue,pt,Ot.value,Se),Ot!==null&&(s&&Ot.alternate!==null&&Xe.delete(Ot.key===null?pt:Ot.key),ne=k(Ot,ne,pt),_t===null?nt=Ot:_t.sibling=Ot,_t=Ot);return s&&Xe.forEach(function(D4){return u(ue,D4)}),jt&&_i(ue,pt),nt}function $t(ue,ne,fe,Se){if(typeof fe=="object"&&fe!==null&&fe.type===b&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:e:{for(var nt=fe.key;ne!==null;){if(ne.key===nt){if(nt=fe.type,nt===b){if(ne.tag===7){v(ue,ne.sibling),Se=E(ne,fe.props.children),Se.return=ue,ue=Se;break e}}else if(ne.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===O&&Kl(nt)===ne.type){v(ue,ne.sibling),Se=E(ne,fe.props),Zc(Se,fe),Se.return=ue,ue=Se;break e}v(ue,ne);break}else u(ue,ne);ne=ne.sibling}fe.type===b?(Se=ql(fe.props.children,ue.mode,Se,fe.key),Se.return=ue,ue=Se):(Se=mh(fe.type,fe.key,fe.props,null,ue.mode,Se),Zc(Se,fe),Se.return=ue,ue=Se)}return _(ue);case x:e:{for(nt=fe.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===fe.containerInfo&&ne.stateNode.implementation===fe.implementation){v(ue,ne.sibling),Se=E(ne,fe.children||[]),Se.return=ue,ue=Se;break e}else{v(ue,ne);break}else u(ue,ne);ne=ne.sibling}Se=lg(fe,ue.mode,Se),Se.return=ue,ue=Se}return _(ue);case O:return fe=Kl(fe),$t(ue,ne,fe,Se)}if(G(fe))return Ge(ue,ne,fe,Se);if(P(fe)){if(nt=P(fe),typeof nt!="function")throw Error(r(150));return fe=nt.call(fe),it(ue,ne,fe,Se)}if(typeof fe.then=="function")return $t(ue,ne,Eh(fe),Se);if(fe.$$typeof===C)return $t(ue,ne,xh(ue,fe),Se);Ch(ue,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint"?(fe=""+fe,ne!==null&&ne.tag===6?(v(ue,ne.sibling),Se=E(ne,fe),Se.return=ue,ue=Se):(v(ue,ne),Se=sg(fe,ue.mode,Se),Se.return=ue,ue=Se),_(ue)):v(ue,ne)}return function(ue,ne,fe,Se){try{Wc=0;var nt=$t(ue,ne,fe,Se);return ru=null,nt}catch(Xe){if(Xe===nu||Xe===wh)throw Xe;var _t=ta(29,Xe,null,ue.mode);return _t.lanes=Se,_t.return=ue,_t}finally{}}}var Xl=aE(!0),iE=aE(!1),js=!1;function xg(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bg(s,u){s=s.updateQueue,u.updateQueue===s&&(u.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function As(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Rs(s,u,v){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(Pt&2)!==0){var E=g.pending;return E===null?u.next=u:(u.next=E.next,E.next=u),g.pending=u,u=ph(s),qS(s,null,v),u}return vh(s,g,u,v),ph(s)}function Jc(s,u,v){if(u=u.updateQueue,u!==null&&(u=u.shared,(v&4194048)!==0)){var g=u.lanes;g&=s.pendingLanes,v|=g,u.lanes=v,Cn(s,v)}}function wg(s,u){var v=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,v===g)){var E=null,k=null;if(v=v.firstBaseUpdate,v!==null){do{var _={lane:v.lane,tag:v.tag,payload:v.payload,callback:null,next:null};k===null?E=k=_:k=k.next=_,v=v.next}while(v!==null);k===null?E=k=u:k=k.next=u}else E=k=u;v={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:k,shared:g.shared,callbacks:g.callbacks},s.updateQueue=v;return}s=v.lastBaseUpdate,s===null?v.firstBaseUpdate=u:s.next=u,v.lastBaseUpdate=u}var Sg=!1;function ef(){if(Sg){var s=tu;if(s!==null)throw s}}function tf(s,u,v,g){Sg=!1;var E=s.updateQueue;js=!1;var k=E.firstBaseUpdate,_=E.lastBaseUpdate,$=E.shared.pending;if($!==null){E.shared.pending=null;var J=$,de=J.next;J.next=null,_===null?k=de:_.next=de,_=J;var we=s.alternate;we!==null&&(we=we.updateQueue,$=we.lastBaseUpdate,$!==_&&($===null?we.firstBaseUpdate=de:$.next=de,we.lastBaseUpdate=J))}if(k!==null){var Ee=E.baseState;_=0,we=de=J=null,$=k;do{var pe=$.lane&-536870913,ge=pe!==$.lane;if(ge?(kt&pe)===pe:(g&pe)===pe){pe!==0&&pe===eu&&(Sg=!0),we!==null&&(we=we.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Ge=s,it=$;pe=u;var $t=v;switch(it.tag){case 1:if(Ge=it.payload,typeof Ge=="function"){Ee=Ge.call($t,Ee,pe);break e}Ee=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=it.payload,pe=typeof Ge=="function"?Ge.call($t,Ee,pe):Ge,pe==null)break e;Ee=p({},Ee,pe);break e;case 2:js=!0}}pe=$.callback,pe!==null&&(s.flags|=64,ge&&(s.flags|=8192),ge=E.callbacks,ge===null?E.callbacks=[pe]:ge.push(pe))}else ge={lane:pe,tag:$.tag,payload:$.payload,callback:$.callback,next:null},we===null?(de=we=ge,J=Ee):we=we.next=ge,_|=pe;if($=$.next,$===null){if($=E.shared.pending,$===null)break;ge=$,$=ge.next,ge.next=null,E.lastBaseUpdate=ge,E.shared.pending=null}}while(!0);we===null&&(J=Ee),E.baseState=J,E.firstBaseUpdate=de,E.lastBaseUpdate=we,k===null&&(E.shared.lanes=0),Ls|=_,s.lanes=_,s.memoizedState=Ee}}function sE(s,u){if(typeof s!="function")throw Error(r(191,s));s.call(u)}function lE(s,u){var v=s.callbacks;if(v!==null)for(s.callbacks=null,s=0;s<v.length;s++)sE(v[s],u)}var au=U(null),Nh=U(0);function oE(s,u){s=Hi,z(Nh,s),z(au,u),Hi=s|u.baseLanes}function Eg(){z(Nh,Hi),z(au,au.current)}function Cg(){Hi=Nh.current,X(au),X(Nh)}var na=U(null),Ea=null;function Ds(s){var u=s.alternate;z(kn,kn.current&1),z(na,s),Ea===null&&(u===null||au.current!==null||u.memoizedState!==null)&&(Ea=s)}function Ng(s){z(kn,kn.current),z(na,s),Ea===null&&(Ea=s)}function uE(s){s.tag===22?(z(kn,kn.current),z(na,s),Ea===null&&(Ea=s)):Ms()}function Ms(){z(kn,kn.current),z(na,na.current)}function ra(s){X(na),Ea===s&&(Ea=null),X(kn)}var kn=U(0);function kh(s){for(var u=s;u!==null;){if(u.tag===13){var v=u.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Dy(v)||My(v)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===s)break;for(;u.sibling===null;){if(u.return===null||u.return===s)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Pi=0,ht=null,Ht=null,Dn=null,Th=!1,iu=!1,Ql=!1,jh=0,nf=0,su=null,w5=0;function xn(){throw Error(r(321))}function kg(s,u){if(u===null)return!1;for(var v=0;v<u.length&&v<s.length;v++)if(!ea(s[v],u[v]))return!1;return!0}function Tg(s,u,v,g,E,k){return Pi=k,ht=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,F.H=s===null||s.memoizedState===null?$E:qg,Ql=!1,k=v(g,E),Ql=!1,iu&&(k=fE(u,v,g,E)),cE(s),k}function cE(s){F.H=sf;var u=Ht!==null&&Ht.next!==null;if(Pi=0,Dn=Ht=ht=null,Th=!1,nf=0,su=null,u)throw Error(r(300));s===null||Mn||(s=s.dependencies,s!==null&&yh(s)&&(Mn=!0))}function fE(s,u,v,g){ht=s;var E=0;do{if(iu&&(su=null),nf=0,iu=!1,25<=E)throw Error(r(301));if(E+=1,Dn=Ht=null,s.updateQueue!=null){var k=s.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}F.H=KE,k=u(v,g)}while(iu);return k}function S5(){var s=F.H,u=s.useState()[0];return u=typeof u.then=="function"?rf(u):u,s=s.useState()[0],(Ht!==null?Ht.memoizedState:null)!==s&&(ht.flags|=1024),u}function jg(){var s=jh!==0;return jh=0,s}function Ag(s,u,v){u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~v}function Rg(s){if(Th){for(s=s.memoizedState;s!==null;){var u=s.queue;u!==null&&(u.pending=null),s=s.next}Th=!1}Pi=0,Dn=Ht=ht=null,iu=!1,nf=jh=0,su=null}function Tr(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?ht.memoizedState=Dn=s:Dn=Dn.next=s,Dn}function Tn(){if(Ht===null){var s=ht.alternate;s=s!==null?s.memoizedState:null}else s=Ht.next;var u=Dn===null?ht.memoizedState:Dn.next;if(u!==null)Dn=u,Ht=s;else{if(s===null)throw ht.alternate===null?Error(r(467)):Error(r(310));Ht=s,s={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Dn===null?ht.memoizedState=Dn=s:Dn=Dn.next=s}return Dn}function Ah(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rf(s){var u=nf;return nf+=1,su===null&&(su=[]),s=tE(su,s,u),u=ht,(Dn===null?u.memoizedState:Dn.next)===null&&(u=u.alternate,F.H=u===null||u.memoizedState===null?$E:qg),s}function Rh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return rf(s);if(s.$$typeof===C)return or(s)}throw Error(r(438,String(s)))}function Dg(s){var u=null,v=ht.updateQueue;if(v!==null&&(u=v.memoCache),u==null){var g=ht.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(u={data:g.data.map(function(E){return E.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),v===null&&(v=Ah(),ht.updateQueue=v),v.memoCache=u,v=u.data[u.index],v===void 0)for(v=u.data[u.index]=Array(s),g=0;g<s;g++)v[g]=M;return u.index++,v}function Bi(s,u){return typeof u=="function"?u(s):u}function Dh(s){var u=Tn();return Mg(u,Ht,s)}function Mg(s,u,v){var g=s.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=v;var E=s.baseQueue,k=g.pending;if(k!==null){if(E!==null){var _=E.next;E.next=k.next,k.next=_}u.baseQueue=E=k,g.pending=null}if(k=s.baseState,E===null)s.memoizedState=k;else{u=E.next;var $=_=null,J=null,de=u,we=!1;do{var Ee=de.lane&-536870913;if(Ee!==de.lane?(kt&Ee)===Ee:(Pi&Ee)===Ee){var pe=de.revertLane;if(pe===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Ee===eu&&(we=!0);else if((Pi&pe)===pe){de=de.next,pe===eu&&(we=!0);continue}else Ee={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},J===null?($=J=Ee,_=k):J=J.next=Ee,ht.lanes|=pe,Ls|=pe;Ee=de.action,Ql&&v(k,Ee),k=de.hasEagerState?de.eagerState:v(k,Ee)}else pe={lane:Ee,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},J===null?($=J=pe,_=k):J=J.next=pe,ht.lanes|=Ee,Ls|=Ee;de=de.next}while(de!==null&&de!==u);if(J===null?_=k:J.next=$,!ea(k,s.memoizedState)&&(Mn=!0,we&&(v=tu,v!==null)))throw v;s.memoizedState=k,s.baseState=_,s.baseQueue=J,g.lastRenderedState=k}return E===null&&(g.lanes=0),[s.memoizedState,g.dispatch]}function _g(s){var u=Tn(),v=u.queue;if(v===null)throw Error(r(311));v.lastRenderedReducer=s;var g=v.dispatch,E=v.pending,k=u.memoizedState;if(E!==null){v.pending=null;var _=E=E.next;do k=s(k,_.action),_=_.next;while(_!==E);ea(k,u.memoizedState)||(Mn=!0),u.memoizedState=k,u.baseQueue===null&&(u.baseState=k),v.lastRenderedState=k}return[k,g]}function dE(s,u,v){var g=ht,E=Tn(),k=jt;if(k){if(v===void 0)throw Error(r(407));v=v()}else v=u();var _=!ea((Ht||E).memoizedState,v);if(_&&(E.memoizedState=v,Mn=!0),E=E.queue,Pg(pE.bind(null,g,E,s),[s]),E.getSnapshot!==u||_||Dn!==null&&Dn.memoizedState.tag&1){if(g.flags|=2048,lu(9,{destroy:void 0},vE.bind(null,g,E,v,u),null),Xt===null)throw Error(r(349));k||(Pi&127)!==0||hE(g,u,v)}return v}function hE(s,u,v){s.flags|=16384,s={getSnapshot:u,value:v},u=ht.updateQueue,u===null?(u=Ah(),ht.updateQueue=u,u.stores=[s]):(v=u.stores,v===null?u.stores=[s]:v.push(s))}function vE(s,u,v,g){u.value=v,u.getSnapshot=g,mE(u)&&gE(s)}function pE(s,u,v){return v(function(){mE(u)&&gE(s)})}function mE(s){var u=s.getSnapshot;s=s.value;try{var v=u();return!ea(s,v)}catch{return!0}}function gE(s){var u=Ul(s,2);u!==null&&Vr(u,s,2)}function Og(s){var u=Tr();if(typeof s=="function"){var v=s;if(s=v(),Ql){me(!0);try{v()}finally{me(!1)}}}return u.memoizedState=u.baseState=s,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:s},u}function yE(s,u,v,g){return s.baseState=v,Mg(s,Ht,typeof g=="function"?g:Bi)}function E5(s,u,v,g,E){if(Oh(s))throw Error(r(485));if(s=u.action,s!==null){var k={payload:E,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){k.listeners.push(_)}};F.T!==null?v(!0):k.isTransition=!1,g(k),v=u.pending,v===null?(k.next=u.pending=k,xE(u,k)):(k.next=v.next,u.pending=v.next=k)}}function xE(s,u){var v=u.action,g=u.payload,E=s.state;if(u.isTransition){var k=F.T,_={};F.T=_;try{var $=v(E,g),J=F.S;J!==null&&J(_,$),bE(s,u,$)}catch(de){Lg(s,u,de)}finally{k!==null&&_.types!==null&&(k.types=_.types),F.T=k}}else try{k=v(E,g),bE(s,u,k)}catch(de){Lg(s,u,de)}}function bE(s,u,v){v!==null&&typeof v=="object"&&typeof v.then=="function"?v.then(function(g){wE(s,u,g)},function(g){return Lg(s,u,g)}):wE(s,u,v)}function wE(s,u,v){u.status="fulfilled",u.value=v,SE(u),s.state=v,u=s.pending,u!==null&&(v=u.next,v===u?s.pending=null:(v=v.next,u.next=v,xE(s,v)))}function Lg(s,u,v){var g=s.pending;if(s.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=v,SE(u),u=u.next;while(u!==g)}s.action=null}function SE(s){s=s.listeners;for(var u=0;u<s.length;u++)(0,s[u])()}function EE(s,u){return u}function CE(s,u){if(jt){var v=Xt.formState;if(v!==null){e:{var g=ht;if(jt){if(an){t:{for(var E=an,k=Sa;E.nodeType!==8;){if(!k){E=null;break t}if(E=Ca(E.nextSibling),E===null){E=null;break t}}k=E.data,E=k==="F!"||k==="F"?E:null}if(E){an=Ca(E.nextSibling),g=E.data==="F!";break e}}ks(g)}g=!1}g&&(u=v[0])}}return v=Tr(),v.memoizedState=v.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:EE,lastRenderedState:u},v.queue=g,v=VE.bind(null,ht,g),g.dispatch=v,g=Og(!1),k=Ug.bind(null,ht,!1,g.queue),g=Tr(),E={state:u,dispatch:null,action:s,pending:null},g.queue=E,v=E5.bind(null,ht,E,k,v),E.dispatch=v,g.memoizedState=s,[u,v,!1]}function NE(s){var u=Tn();return kE(u,Ht,s)}function kE(s,u,v){if(u=Mg(s,u,EE)[0],s=Dh(Bi)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=rf(u)}catch(_){throw _===nu?wh:_}else g=u;u=Tn();var E=u.queue,k=E.dispatch;return v!==u.memoizedState&&(ht.flags|=2048,lu(9,{destroy:void 0},C5.bind(null,E,v),null)),[g,k,s]}function C5(s,u){s.action=u}function TE(s){var u=Tn(),v=Ht;if(v!==null)return kE(u,v,s);Tn(),u=u.memoizedState,v=Tn();var g=v.queue.dispatch;return v.memoizedState=s,[u,g,!1]}function lu(s,u,v,g){return s={tag:s,create:v,deps:g,inst:u,next:null},u=ht.updateQueue,u===null&&(u=Ah(),ht.updateQueue=u),v=u.lastEffect,v===null?u.lastEffect=s.next=s:(g=v.next,v.next=s,s.next=g,u.lastEffect=s),s}function jE(){return Tn().memoizedState}function Mh(s,u,v,g){var E=Tr();ht.flags|=s,E.memoizedState=lu(1|u,{destroy:void 0},v,g===void 0?null:g)}function _h(s,u,v,g){var E=Tn();g=g===void 0?null:g;var k=E.memoizedState.inst;Ht!==null&&g!==null&&kg(g,Ht.memoizedState.deps)?E.memoizedState=lu(u,k,v,g):(ht.flags|=s,E.memoizedState=lu(1|u,k,v,g))}function AE(s,u){Mh(8390656,8,s,u)}function Pg(s,u){_h(2048,8,s,u)}function N5(s){ht.flags|=4;var u=ht.updateQueue;if(u===null)u=Ah(),ht.updateQueue=u,u.events=[s];else{var v=u.events;v===null?u.events=[s]:v.push(s)}}function RE(s){var u=Tn().memoizedState;return N5({ref:u,nextImpl:s}),function(){if((Pt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}function DE(s,u){return _h(4,2,s,u)}function ME(s,u){return _h(4,4,s,u)}function _E(s,u){if(typeof u=="function"){s=s();var v=u(s);return function(){typeof v=="function"?v():u(null)}}if(u!=null)return s=s(),u.current=s,function(){u.current=null}}function OE(s,u,v){v=v!=null?v.concat([s]):null,_h(4,4,_E.bind(null,u,s),v)}function Bg(){}function LE(s,u){var v=Tn();u=u===void 0?null:u;var g=v.memoizedState;return u!==null&&kg(u,g[1])?g[0]:(v.memoizedState=[s,u],s)}function PE(s,u){var v=Tn();u=u===void 0?null:u;var g=v.memoizedState;if(u!==null&&kg(u,g[1]))return g[0];if(g=s(),Ql){me(!0);try{s()}finally{me(!1)}}return v.memoizedState=[g,u],g}function zg(s,u,v){return v===void 0||(Pi&1073741824)!==0&&(kt&261930)===0?s.memoizedState=u:(s.memoizedState=v,s=B2(),ht.lanes|=s,Ls|=s,v)}function BE(s,u,v,g){return ea(v,u)?v:au.current!==null?(s=zg(s,v,g),ea(s,u)||(Mn=!0),s):(Pi&42)===0||(Pi&1073741824)!==0&&(kt&261930)===0?(Mn=!0,s.memoizedState=v):(s=B2(),ht.lanes|=s,Ls|=s,u)}function zE(s,u,v,g,E){var k=V.p;V.p=k!==0&&8>k?k:8;var _=F.T,$={};F.T=$,Ug(s,!1,u,v);try{var J=E(),de=F.S;if(de!==null&&de($,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var we=b5(J,g);af(s,u,we,sa(s))}else af(s,u,g,sa(s))}catch(Ee){af(s,u,{then:function(){},status:"rejected",reason:Ee},sa())}finally{V.p=k,_!==null&&$.types!==null&&(_.types=$.types),F.T=_}}function k5(){}function Ig(s,u,v,g){if(s.tag!==5)throw Error(r(476));var E=IE(s).queue;zE(s,E,u,Y,v===null?k5:function(){return FE(s),v(g)})}function IE(s){var u=s.memoizedState;if(u!==null)return u;u={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:Y},next:null};var v={};return u.next={memoizedState:v,baseState:v,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:v},next:null},s.memoizedState=u,s=s.alternate,s!==null&&(s.memoizedState=u),u}function FE(s){var u=IE(s);u.next===null&&(u=s.alternate.memoizedState),af(s,u.next.queue,{},sa())}function Fg(){return or(Sf)}function UE(){return Tn().memoizedState}function qE(){return Tn().memoizedState}function T5(s){for(var u=s.return;u!==null;){switch(u.tag){case 24:case 3:var v=sa();s=As(v);var g=Rs(u,s,v);g!==null&&(Vr(g,u,v),Jc(g,u,v)),u={cache:pg()},s.payload=u;return}u=u.return}}function j5(s,u,v){var g=sa();v={lane:g,revertLane:0,gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},Oh(s)?HE(u,v):(v=ag(s,u,v,g),v!==null&&(Vr(v,s,g),GE(v,u,g)))}function VE(s,u,v){var g=sa();af(s,u,v,g)}function af(s,u,v,g){var E={lane:g,revertLane:0,gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null};if(Oh(s))HE(u,E);else{var k=s.alternate;if(s.lanes===0&&(k===null||k.lanes===0)&&(k=u.lastRenderedReducer,k!==null))try{var _=u.lastRenderedState,$=k(_,v);if(E.hasEagerState=!0,E.eagerState=$,ea($,_))return vh(s,u,E,0),Xt===null&&hh(),!1}catch{}finally{}if(v=ag(s,u,E,g),v!==null)return Vr(v,s,g),GE(v,u,g),!0}return!1}function Ug(s,u,v,g){if(g={lane:2,revertLane:xy(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Oh(s)){if(u)throw Error(r(479))}else u=ag(s,v,g,2),u!==null&&Vr(u,s,2)}function Oh(s){var u=s.alternate;return s===ht||u!==null&&u===ht}function HE(s,u){iu=Th=!0;var v=s.pending;v===null?u.next=u:(u.next=v.next,v.next=u),s.pending=u}function GE(s,u,v){if((v&4194048)!==0){var g=u.lanes;g&=s.pendingLanes,v|=g,u.lanes=v,Cn(s,v)}}var sf={readContext:or,use:Rh,useCallback:xn,useContext:xn,useEffect:xn,useImperativeHandle:xn,useLayoutEffect:xn,useInsertionEffect:xn,useMemo:xn,useReducer:xn,useRef:xn,useState:xn,useDebugValue:xn,useDeferredValue:xn,useTransition:xn,useSyncExternalStore:xn,useId:xn,useHostTransitionStatus:xn,useFormState:xn,useActionState:xn,useOptimistic:xn,useMemoCache:xn,useCacheRefresh:xn};sf.useEffectEvent=xn;var $E={readContext:or,use:Rh,useCallback:function(s,u){return Tr().memoizedState=[s,u===void 0?null:u],s},useContext:or,useEffect:AE,useImperativeHandle:function(s,u,v){v=v!=null?v.concat([s]):null,Mh(4194308,4,_E.bind(null,u,s),v)},useLayoutEffect:function(s,u){return Mh(4194308,4,s,u)},useInsertionEffect:function(s,u){Mh(4,2,s,u)},useMemo:function(s,u){var v=Tr();u=u===void 0?null:u;var g=s();if(Ql){me(!0);try{s()}finally{me(!1)}}return v.memoizedState=[g,u],g},useReducer:function(s,u,v){var g=Tr();if(v!==void 0){var E=v(u);if(Ql){me(!0);try{v(u)}finally{me(!1)}}}else E=u;return g.memoizedState=g.baseState=E,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:E},g.queue=s,s=s.dispatch=j5.bind(null,ht,s),[g.memoizedState,s]},useRef:function(s){var u=Tr();return s={current:s},u.memoizedState=s},useState:function(s){s=Og(s);var u=s.queue,v=VE.bind(null,ht,u);return u.dispatch=v,[s.memoizedState,v]},useDebugValue:Bg,useDeferredValue:function(s,u){var v=Tr();return zg(v,s,u)},useTransition:function(){var s=Og(!1);return s=zE.bind(null,ht,s.queue,!0,!1),Tr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,u,v){var g=ht,E=Tr();if(jt){if(v===void 0)throw Error(r(407));v=v()}else{if(v=u(),Xt===null)throw Error(r(349));(kt&127)!==0||hE(g,u,v)}E.memoizedState=v;var k={value:v,getSnapshot:u};return E.queue=k,AE(pE.bind(null,g,k,s),[s]),g.flags|=2048,lu(9,{destroy:void 0},vE.bind(null,g,k,v,u),null),v},useId:function(){var s=Tr(),u=Xt.identifierPrefix;if(jt){var v=ni,g=ti;v=(g&~(1<<32-he(g)-1)).toString(32)+v,u="_"+u+"R_"+v,v=jh++,0<v&&(u+="H"+v.toString(32)),u+="_"}else v=w5++,u="_"+u+"r_"+v.toString(32)+"_";return s.memoizedState=u},useHostTransitionStatus:Fg,useFormState:CE,useActionState:CE,useOptimistic:function(s){var u=Tr();u.memoizedState=u.baseState=s;var v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=v,u=Ug.bind(null,ht,!0,v),v.dispatch=u,[s,u]},useMemoCache:Dg,useCacheRefresh:function(){return Tr().memoizedState=T5.bind(null,ht)},useEffectEvent:function(s){var u=Tr(),v={impl:s};return u.memoizedState=v,function(){if((Pt&2)!==0)throw Error(r(440));return v.impl.apply(void 0,arguments)}}},qg={readContext:or,use:Rh,useCallback:LE,useContext:or,useEffect:Pg,useImperativeHandle:OE,useInsertionEffect:DE,useLayoutEffect:ME,useMemo:PE,useReducer:Dh,useRef:jE,useState:function(){return Dh(Bi)},useDebugValue:Bg,useDeferredValue:function(s,u){var v=Tn();return BE(v,Ht.memoizedState,s,u)},useTransition:function(){var s=Dh(Bi)[0],u=Tn().memoizedState;return[typeof s=="boolean"?s:rf(s),u]},useSyncExternalStore:dE,useId:UE,useHostTransitionStatus:Fg,useFormState:NE,useActionState:NE,useOptimistic:function(s,u){var v=Tn();return yE(v,Ht,s,u)},useMemoCache:Dg,useCacheRefresh:qE};qg.useEffectEvent=RE;var KE={readContext:or,use:Rh,useCallback:LE,useContext:or,useEffect:Pg,useImperativeHandle:OE,useInsertionEffect:DE,useLayoutEffect:ME,useMemo:PE,useReducer:_g,useRef:jE,useState:function(){return _g(Bi)},useDebugValue:Bg,useDeferredValue:function(s,u){var v=Tn();return Ht===null?zg(v,s,u):BE(v,Ht.memoizedState,s,u)},useTransition:function(){var s=_g(Bi)[0],u=Tn().memoizedState;return[typeof s=="boolean"?s:rf(s),u]},useSyncExternalStore:dE,useId:UE,useHostTransitionStatus:Fg,useFormState:TE,useActionState:TE,useOptimistic:function(s,u){var v=Tn();return Ht!==null?yE(v,Ht,s,u):(v.baseState=s,[s,v.queue.dispatch])},useMemoCache:Dg,useCacheRefresh:qE};KE.useEffectEvent=RE;function Vg(s,u,v,g){u=s.memoizedState,v=v(g,u),v=v==null?u:p({},u,v),s.memoizedState=v,s.lanes===0&&(s.updateQueue.baseState=v)}var Hg={enqueueSetState:function(s,u,v){s=s._reactInternals;var g=sa(),E=As(g);E.payload=u,v!=null&&(E.callback=v),u=Rs(s,E,g),u!==null&&(Vr(u,s,g),Jc(u,s,g))},enqueueReplaceState:function(s,u,v){s=s._reactInternals;var g=sa(),E=As(g);E.tag=1,E.payload=u,v!=null&&(E.callback=v),u=Rs(s,E,g),u!==null&&(Vr(u,s,g),Jc(u,s,g))},enqueueForceUpdate:function(s,u){s=s._reactInternals;var v=sa(),g=As(v);g.tag=2,u!=null&&(g.callback=u),u=Rs(s,g,v),u!==null&&(Vr(u,s,v),Jc(u,s,v))}};function YE(s,u,v,g,E,k,_){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,k,_):u.prototype&&u.prototype.isPureReactComponent?!Gc(v,g)||!Gc(E,k):!0}function XE(s,u,v,g){s=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(v,g),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(v,g),u.state!==s&&Hg.enqueueReplaceState(u,u.state,null)}function Wl(s,u){var v=u;if("ref"in u){v={};for(var g in u)g!=="ref"&&(v[g]=u[g])}if(s=s.defaultProps){v===u&&(v=p({},v));for(var E in s)v[E]===void 0&&(v[E]=s[E])}return v}function QE(s){dh(s)}function WE(s){console.error(s)}function ZE(s){dh(s)}function Lh(s,u){try{var v=s.onUncaughtError;v(u.value,{componentStack:u.stack})}catch(g){setTimeout(function(){throw g})}}function JE(s,u,v){try{var g=s.onCaughtError;g(v.value,{componentStack:v.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(E){setTimeout(function(){throw E})}}function Gg(s,u,v){return v=As(v),v.tag=3,v.payload={element:null},v.callback=function(){Lh(s,u)},v}function e2(s){return s=As(s),s.tag=3,s}function t2(s,u,v,g){var E=v.type.getDerivedStateFromError;if(typeof E=="function"){var k=g.value;s.payload=function(){return E(k)},s.callback=function(){JE(u,v,g)}}var _=v.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){JE(u,v,g),typeof E!="function"&&(Ps===null?Ps=new Set([this]):Ps.add(this));var $=g.stack;this.componentDidCatch(g.value,{componentStack:$!==null?$:""})})}function A5(s,u,v,g,E){if(v.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(u=v.alternate,u!==null&&Jo(u,v,E,!0),v=na.current,v!==null){switch(v.tag){case 31:case 13:return Ea===null?Kh():v.alternate===null&&bn===0&&(bn=3),v.flags&=-257,v.flags|=65536,v.lanes=E,g===Sh?v.flags|=16384:(u=v.updateQueue,u===null?v.updateQueue=new Set([g]):u.add(g),my(s,g,E)),!1;case 22:return v.flags|=65536,g===Sh?v.flags|=16384:(u=v.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([g])},v.updateQueue=u):(v=u.retryQueue,v===null?u.retryQueue=new Set([g]):v.add(g)),my(s,g,E)),!1}throw Error(r(435,v.tag))}return my(s,g,E),Kh(),!1}if(jt)return u=na.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=E,g!==cg&&(s=Error(r(422),{cause:g}),Yc(xa(s,v)))):(g!==cg&&(u=Error(r(423),{cause:g}),Yc(xa(u,v))),s=s.current.alternate,s.flags|=65536,E&=-E,s.lanes|=E,g=xa(g,v),E=Gg(s.stateNode,g,E),wg(s,E),bn!==4&&(bn=2)),!1;var k=Error(r(520),{cause:g});if(k=xa(k,v),vf===null?vf=[k]:vf.push(k),bn!==4&&(bn=2),u===null)return!0;g=xa(g,v),v=u;do{switch(v.tag){case 3:return v.flags|=65536,s=E&-E,v.lanes|=s,s=Gg(v.stateNode,g,s),wg(v,s),!1;case 1:if(u=v.type,k=v.stateNode,(v.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ps===null||!Ps.has(k))))return v.flags|=65536,E&=-E,v.lanes|=E,E=e2(E),t2(E,s,v,g),wg(v,E),!1}v=v.return}while(v!==null);return!1}var $g=Error(r(461)),Mn=!1;function ur(s,u,v,g){u.child=s===null?iE(u,null,v,g):Xl(u,s.child,v,g)}function n2(s,u,v,g,E){v=v.render;var k=u.ref;if("ref"in g){var _={};for(var $ in g)$!=="ref"&&(_[$]=g[$])}else _=g;return Gl(u),g=Tg(s,u,v,_,k,E),$=jg(),s!==null&&!Mn?(Ag(s,u,E),zi(s,u,E)):(jt&&$&&og(u),u.flags|=1,ur(s,u,g,E),u.child)}function r2(s,u,v,g,E){if(s===null){var k=v.type;return typeof k=="function"&&!ig(k)&&k.defaultProps===void 0&&v.compare===null?(u.tag=15,u.type=k,a2(s,u,k,g,E)):(s=mh(v.type,null,g,u,u.mode,E),s.ref=u.ref,s.return=u,u.child=s)}if(k=s.child,!ey(s,E)){var _=k.memoizedProps;if(v=v.compare,v=v!==null?v:Gc,v(_,g)&&s.ref===u.ref)return zi(s,u,E)}return u.flags|=1,s=Mi(k,g),s.ref=u.ref,s.return=u,u.child=s}function a2(s,u,v,g,E){if(s!==null){var k=s.memoizedProps;if(Gc(k,g)&&s.ref===u.ref)if(Mn=!1,u.pendingProps=g=k,ey(s,E))(s.flags&131072)!==0&&(Mn=!0);else return u.lanes=s.lanes,zi(s,u,E)}return Kg(s,u,v,g,E)}function i2(s,u,v,g){var E=g.children,k=s!==null?s.memoizedState:null;if(s===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((u.flags&128)!==0){if(k=k!==null?k.baseLanes|v:v,s!==null){for(g=u.child=s.child,E=0;g!==null;)E=E|g.lanes|g.childLanes,g=g.sibling;g=E&~k}else g=0,u.child=null;return s2(s,u,k,v,g)}if((v&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},s!==null&&bh(u,k!==null?k.cachePool:null),k!==null?oE(u,k):Eg(),uE(u);else return g=u.lanes=536870912,s2(s,u,k!==null?k.baseLanes|v:v,v,g)}else k!==null?(bh(u,k.cachePool),oE(u,k),Ms(),u.memoizedState=null):(s!==null&&bh(u,null),Eg(),Ms());return ur(s,u,E,v),u.child}function lf(s,u){return s!==null&&s.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function s2(s,u,v,g,E){var k=gg();return k=k===null?null:{parent:Rn._currentValue,pool:k},u.memoizedState={baseLanes:v,cachePool:k},s!==null&&bh(u,null),Eg(),uE(u),s!==null&&Jo(s,u,g,!0),u.childLanes=E,null}function Ph(s,u){return u=zh({mode:u.mode,children:u.children},s.mode),u.ref=s.ref,s.child=u,u.return=s,u}function l2(s,u,v){return Xl(u,s.child,null,v),s=Ph(u,u.pendingProps),s.flags|=2,ra(u),u.memoizedState=null,s}function R5(s,u,v){var g=u.pendingProps,E=(u.flags&128)!==0;if(u.flags&=-129,s===null){if(jt){if(g.mode==="hidden")return s=Ph(u,g),u.lanes=536870912,lf(null,s);if(Ng(u),(s=an)?(s=xC(s,Sa),s=s!==null&&s.data==="&"?s:null,s!==null&&(u.memoizedState={dehydrated:s,treeContext:Cs!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},v=HS(s),v.return=u,u.child=v,lr=u,an=null)):s=null,s===null)throw ks(u);return u.lanes=536870912,null}return Ph(u,g)}var k=s.memoizedState;if(k!==null){var _=k.dehydrated;if(Ng(u),E)if(u.flags&256)u.flags&=-257,u=l2(s,u,v);else if(u.memoizedState!==null)u.child=s.child,u.flags|=128,u=null;else throw Error(r(558));else if(Mn||Jo(s,u,v,!1),E=(v&s.childLanes)!==0,Mn||E){if(g=Xt,g!==null&&(_=yn(g,v),_!==0&&_!==k.retryLane))throw k.retryLane=_,Ul(s,_),Vr(g,s,_),$g;Kh(),u=l2(s,u,v)}else s=k.treeContext,an=Ca(_.nextSibling),lr=u,jt=!0,Ns=null,Sa=!1,s!==null&&KS(u,s),u=Ph(u,g),u.flags|=4096;return u}return s=Mi(s.child,{mode:g.mode,children:g.children}),s.ref=u.ref,u.child=s,s.return=u,s}function Bh(s,u){var v=u.ref;if(v===null)s!==null&&s.ref!==null&&(u.flags|=4194816);else{if(typeof v!="function"&&typeof v!="object")throw Error(r(284));(s===null||s.ref!==v)&&(u.flags|=4194816)}}function Kg(s,u,v,g,E){return Gl(u),v=Tg(s,u,v,g,void 0,E),g=jg(),s!==null&&!Mn?(Ag(s,u,E),zi(s,u,E)):(jt&&g&&og(u),u.flags|=1,ur(s,u,v,E),u.child)}function o2(s,u,v,g,E,k){return Gl(u),u.updateQueue=null,v=fE(u,g,v,E),cE(s),g=jg(),s!==null&&!Mn?(Ag(s,u,k),zi(s,u,k)):(jt&&g&&og(u),u.flags|=1,ur(s,u,v,k),u.child)}function u2(s,u,v,g,E){if(Gl(u),u.stateNode===null){var k=Xo,_=v.contextType;typeof _=="object"&&_!==null&&(k=or(_)),k=new v(g,k),u.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=Hg,u.stateNode=k,k._reactInternals=u,k=u.stateNode,k.props=g,k.state=u.memoizedState,k.refs={},xg(u),_=v.contextType,k.context=typeof _=="object"&&_!==null?or(_):Xo,k.state=u.memoizedState,_=v.getDerivedStateFromProps,typeof _=="function"&&(Vg(u,v,_,g),k.state=u.memoizedState),typeof v.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(_=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),_!==k.state&&Hg.enqueueReplaceState(k,k.state,null),tf(u,g,k,E),ef(),k.state=u.memoizedState),typeof k.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(s===null){k=u.stateNode;var $=u.memoizedProps,J=Wl(v,$);k.props=J;var de=k.context,we=v.contextType;_=Xo,typeof we=="object"&&we!==null&&(_=or(we));var Ee=v.getDerivedStateFromProps;we=typeof Ee=="function"||typeof k.getSnapshotBeforeUpdate=="function",$=u.pendingProps!==$,we||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||($||de!==_)&&XE(u,k,g,_),js=!1;var pe=u.memoizedState;k.state=pe,tf(u,g,k,E),ef(),de=u.memoizedState,$||pe!==de||js?(typeof Ee=="function"&&(Vg(u,v,Ee,g),de=u.memoizedState),(J=js||YE(u,v,J,g,pe,de,_))?(we||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(u.flags|=4194308)):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=de),k.props=g,k.state=de,k.context=_,g=J):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{k=u.stateNode,bg(s,u),_=u.memoizedProps,we=Wl(v,_),k.props=we,Ee=u.pendingProps,pe=k.context,de=v.contextType,J=Xo,typeof de=="object"&&de!==null&&(J=or(de)),$=v.getDerivedStateFromProps,(de=typeof $=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(_!==Ee||pe!==J)&&XE(u,k,g,J),js=!1,pe=u.memoizedState,k.state=pe,tf(u,g,k,E),ef();var ge=u.memoizedState;_!==Ee||pe!==ge||js||s!==null&&s.dependencies!==null&&yh(s.dependencies)?(typeof $=="function"&&(Vg(u,v,$,g),ge=u.memoizedState),(we=js||YE(u,v,we,g,pe,ge,J)||s!==null&&s.dependencies!==null&&yh(s.dependencies))?(de||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(g,ge,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(g,ge,J)),typeof k.componentDidUpdate=="function"&&(u.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof k.componentDidUpdate!="function"||_===s.memoizedProps&&pe===s.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&pe===s.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=ge),k.props=g,k.state=ge,k.context=J,g=we):(typeof k.componentDidUpdate!="function"||_===s.memoizedProps&&pe===s.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&pe===s.memoizedState||(u.flags|=1024),g=!1)}return k=g,Bh(s,u),g=(u.flags&128)!==0,k||g?(k=u.stateNode,v=g&&typeof v.getDerivedStateFromError!="function"?null:k.render(),u.flags|=1,s!==null&&g?(u.child=Xl(u,s.child,null,E),u.child=Xl(u,null,v,E)):ur(s,u,v,E),u.memoizedState=k.state,s=u.child):s=zi(s,u,E),s}function c2(s,u,v,g){return Vl(),u.flags|=256,ur(s,u,v,g),u.child}var Yg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xg(s){return{baseLanes:s,cachePool:JS()}}function Qg(s,u,v){return s=s!==null?s.childLanes&~v:0,u&&(s|=ia),s}function f2(s,u,v){var g=u.pendingProps,E=!1,k=(u.flags&128)!==0,_;if((_=k)||(_=s!==null&&s.memoizedState===null?!1:(kn.current&2)!==0),_&&(E=!0,u.flags&=-129),_=(u.flags&32)!==0,u.flags&=-33,s===null){if(jt){if(E?Ds(u):Ms(),(s=an)?(s=xC(s,Sa),s=s!==null&&s.data!=="&"?s:null,s!==null&&(u.memoizedState={dehydrated:s,treeContext:Cs!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},v=HS(s),v.return=u,u.child=v,lr=u,an=null)):s=null,s===null)throw ks(u);return My(s)?u.lanes=32:u.lanes=536870912,null}var $=g.children;return g=g.fallback,E?(Ms(),E=u.mode,$=zh({mode:"hidden",children:$},E),g=ql(g,E,v,null),$.return=u,g.return=u,$.sibling=g,u.child=$,g=u.child,g.memoizedState=Xg(v),g.childLanes=Qg(s,_,v),u.memoizedState=Yg,lf(null,g)):(Ds(u),Wg(u,$))}var J=s.memoizedState;if(J!==null&&($=J.dehydrated,$!==null)){if(k)u.flags&256?(Ds(u),u.flags&=-257,u=Zg(s,u,v)):u.memoizedState!==null?(Ms(),u.child=s.child,u.flags|=128,u=null):(Ms(),$=g.fallback,E=u.mode,g=zh({mode:"visible",children:g.children},E),$=ql($,E,v,null),$.flags|=2,g.return=u,$.return=u,g.sibling=$,u.child=g,Xl(u,s.child,null,v),g=u.child,g.memoizedState=Xg(v),g.childLanes=Qg(s,_,v),u.memoizedState=Yg,u=lf(null,g));else if(Ds(u),My($)){if(_=$.nextSibling&&$.nextSibling.dataset,_)var de=_.dgst;_=de,g=Error(r(419)),g.stack="",g.digest=_,Yc({value:g,source:null,stack:null}),u=Zg(s,u,v)}else if(Mn||Jo(s,u,v,!1),_=(v&s.childLanes)!==0,Mn||_){if(_=Xt,_!==null&&(g=yn(_,v),g!==0&&g!==J.retryLane))throw J.retryLane=g,Ul(s,g),Vr(_,s,g),$g;Dy($)||Kh(),u=Zg(s,u,v)}else Dy($)?(u.flags|=192,u.child=s.child,u=null):(s=J.treeContext,an=Ca($.nextSibling),lr=u,jt=!0,Ns=null,Sa=!1,s!==null&&KS(u,s),u=Wg(u,g.children),u.flags|=4096);return u}return E?(Ms(),$=g.fallback,E=u.mode,J=s.child,de=J.sibling,g=Mi(J,{mode:"hidden",children:g.children}),g.subtreeFlags=J.subtreeFlags&65011712,de!==null?$=Mi(de,$):($=ql($,E,v,null),$.flags|=2),$.return=u,g.return=u,g.sibling=$,u.child=g,lf(null,g),g=u.child,$=s.child.memoizedState,$===null?$=Xg(v):(E=$.cachePool,E!==null?(J=Rn._currentValue,E=E.parent!==J?{parent:J,pool:J}:E):E=JS(),$={baseLanes:$.baseLanes|v,cachePool:E}),g.memoizedState=$,g.childLanes=Qg(s,_,v),u.memoizedState=Yg,lf(s.child,g)):(Ds(u),v=s.child,s=v.sibling,v=Mi(v,{mode:"visible",children:g.children}),v.return=u,v.sibling=null,s!==null&&(_=u.deletions,_===null?(u.deletions=[s],u.flags|=16):_.push(s)),u.child=v,u.memoizedState=null,v)}function Wg(s,u){return u=zh({mode:"visible",children:u},s.mode),u.return=s,s.child=u}function zh(s,u){return s=ta(22,s,null,u),s.lanes=0,s}function Zg(s,u,v){return Xl(u,s.child,null,v),s=Wg(u,u.pendingProps.children),s.flags|=2,u.memoizedState=null,s}function d2(s,u,v){s.lanes|=u;var g=s.alternate;g!==null&&(g.lanes|=u),hg(s.return,u,v)}function Jg(s,u,v,g,E,k){var _=s.memoizedState;_===null?s.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:v,tailMode:E,treeForkCount:k}:(_.isBackwards=u,_.rendering=null,_.renderingStartTime=0,_.last=g,_.tail=v,_.tailMode=E,_.treeForkCount=k)}function h2(s,u,v){var g=u.pendingProps,E=g.revealOrder,k=g.tail;g=g.children;var _=kn.current,$=(_&2)!==0;if($?(_=_&1|2,u.flags|=128):_&=1,z(kn,_),ur(s,u,g,v),g=jt?Kc:0,!$&&s!==null&&(s.flags&128)!==0)e:for(s=u.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&d2(s,v,u);else if(s.tag===19)d2(s,v,u);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===u)break e;for(;s.sibling===null;){if(s.return===null||s.return===u)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(E){case"forwards":for(v=u.child,E=null;v!==null;)s=v.alternate,s!==null&&kh(s)===null&&(E=v),v=v.sibling;v=E,v===null?(E=u.child,u.child=null):(E=v.sibling,v.sibling=null),Jg(u,!1,E,v,k,g);break;case"backwards":case"unstable_legacy-backwards":for(v=null,E=u.child,u.child=null;E!==null;){if(s=E.alternate,s!==null&&kh(s)===null){u.child=E;break}s=E.sibling,E.sibling=v,v=E,E=s}Jg(u,!0,v,null,k,g);break;case"together":Jg(u,!1,null,null,void 0,g);break;default:u.memoizedState=null}return u.child}function zi(s,u,v){if(s!==null&&(u.dependencies=s.dependencies),Ls|=u.lanes,(v&u.childLanes)===0)if(s!==null){if(Jo(s,u,v,!1),(v&u.childLanes)===0)return null}else return null;if(s!==null&&u.child!==s.child)throw Error(r(153));if(u.child!==null){for(s=u.child,v=Mi(s,s.pendingProps),u.child=v,v.return=u;s.sibling!==null;)s=s.sibling,v=v.sibling=Mi(s,s.pendingProps),v.return=u;v.sibling=null}return u.child}function ey(s,u){return(s.lanes&u)!==0?!0:(s=s.dependencies,!!(s!==null&&yh(s)))}function D5(s,u,v){switch(u.tag){case 3:le(u,u.stateNode.containerInfo),Ts(u,Rn,s.memoizedState.cache),Vl();break;case 27:case 5:W(u);break;case 4:le(u,u.stateNode.containerInfo);break;case 10:Ts(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,Ng(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(Ds(u),u.flags|=128,null):(v&u.child.childLanes)!==0?f2(s,u,v):(Ds(u),s=zi(s,u,v),s!==null?s.sibling:null);Ds(u);break;case 19:var E=(s.flags&128)!==0;if(g=(v&u.childLanes)!==0,g||(Jo(s,u,v,!1),g=(v&u.childLanes)!==0),E){if(g)return h2(s,u,v);u.flags|=128}if(E=u.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),z(kn,kn.current),g)break;return null;case 22:return u.lanes=0,i2(s,u,v,u.pendingProps);case 24:Ts(u,Rn,s.memoizedState.cache)}return zi(s,u,v)}function v2(s,u,v){if(s!==null)if(s.memoizedProps!==u.pendingProps)Mn=!0;else{if(!ey(s,v)&&(u.flags&128)===0)return Mn=!1,D5(s,u,v);Mn=(s.flags&131072)!==0}else Mn=!1,jt&&(u.flags&1048576)!==0&&$S(u,Kc,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(s=Kl(u.elementType),u.type=s,typeof s=="function")ig(s)?(g=Wl(s,g),u.tag=1,u=u2(null,u,s,g,v)):(u.tag=0,u=Kg(null,u,s,g,v));else{if(s!=null){var E=s.$$typeof;if(E===T){u.tag=11,u=n2(null,u,s,g,v);break e}else if(E===D){u.tag=14,u=r2(null,u,s,g,v);break e}}throw u=H(s)||s,Error(r(306,u,""))}}return u;case 0:return Kg(s,u,u.type,u.pendingProps,v);case 1:return g=u.type,E=Wl(g,u.pendingProps),u2(s,u,g,E,v);case 3:e:{if(le(u,u.stateNode.containerInfo),s===null)throw Error(r(387));g=u.pendingProps;var k=u.memoizedState;E=k.element,bg(s,u),tf(u,g,null,v);var _=u.memoizedState;if(g=_.cache,Ts(u,Rn,g),g!==k.cache&&vg(u,[Rn],v,!0),ef(),g=_.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:_.cache},u.updateQueue.baseState=k,u.memoizedState=k,u.flags&256){u=c2(s,u,g,v);break e}else if(g!==E){E=xa(Error(r(424)),u),Yc(E),u=c2(s,u,g,v);break e}else{switch(s=u.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(an=Ca(s.firstChild),lr=u,jt=!0,Ns=null,Sa=!0,v=iE(u,null,g,v),u.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling}else{if(Vl(),g===E){u=zi(s,u,v);break e}ur(s,u,g,v)}u=u.child}return u;case 26:return Bh(s,u),s===null?(v=NC(u.type,null,u.pendingProps,null))?u.memoizedState=v:jt||(v=u.type,s=u.pendingProps,g=ev(ae.current).createElement(v),g[un]=u,g[In]=s,cr(g,v,s),An(g),u.stateNode=g):u.memoizedState=NC(u.type,s.memoizedProps,u.pendingProps,s.memoizedState),null;case 27:return W(u),s===null&&jt&&(g=u.stateNode=SC(u.type,u.pendingProps,ae.current),lr=u,Sa=!0,E=an,Fs(u.type)?(_y=E,an=Ca(g.firstChild)):an=E),ur(s,u,u.pendingProps.children,v),Bh(s,u),s===null&&(u.flags|=4194304),u.child;case 5:return s===null&&jt&&((E=g=an)&&(g=l4(g,u.type,u.pendingProps,Sa),g!==null?(u.stateNode=g,lr=u,an=Ca(g.firstChild),Sa=!1,E=!0):E=!1),E||ks(u)),W(u),E=u.type,k=u.pendingProps,_=s!==null?s.memoizedProps:null,g=k.children,jy(E,k)?g=null:_!==null&&jy(E,_)&&(u.flags|=32),u.memoizedState!==null&&(E=Tg(s,u,S5,null,null,v),Sf._currentValue=E),Bh(s,u),ur(s,u,g,v),u.child;case 6:return s===null&&jt&&((s=v=an)&&(v=o4(v,u.pendingProps,Sa),v!==null?(u.stateNode=v,lr=u,an=null,s=!0):s=!1),s||ks(u)),null;case 13:return f2(s,u,v);case 4:return le(u,u.stateNode.containerInfo),g=u.pendingProps,s===null?u.child=Xl(u,null,g,v):ur(s,u,g,v),u.child;case 11:return n2(s,u,u.type,u.pendingProps,v);case 7:return ur(s,u,u.pendingProps,v),u.child;case 8:return ur(s,u,u.pendingProps.children,v),u.child;case 12:return ur(s,u,u.pendingProps.children,v),u.child;case 10:return g=u.pendingProps,Ts(u,u.type,g.value),ur(s,u,g.children,v),u.child;case 9:return E=u.type._context,g=u.pendingProps.children,Gl(u),E=or(E),g=g(E),u.flags|=1,ur(s,u,g,v),u.child;case 14:return r2(s,u,u.type,u.pendingProps,v);case 15:return a2(s,u,u.type,u.pendingProps,v);case 19:return h2(s,u,v);case 31:return R5(s,u,v);case 22:return i2(s,u,v,u.pendingProps);case 24:return Gl(u),g=or(Rn),s===null?(E=gg(),E===null&&(E=Xt,k=pg(),E.pooledCache=k,k.refCount++,k!==null&&(E.pooledCacheLanes|=v),E=k),u.memoizedState={parent:g,cache:E},xg(u),Ts(u,Rn,E)):((s.lanes&v)!==0&&(bg(s,u),tf(u,null,null,v),ef()),E=s.memoizedState,k=u.memoizedState,E.parent!==g?(E={parent:g,cache:g},u.memoizedState=E,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=E),Ts(u,Rn,g)):(g=k.cache,Ts(u,Rn,g),g!==E.cache&&vg(u,[Rn],v,!0))),ur(s,u,u.pendingProps.children,v),u.child;case 29:throw u.pendingProps}throw Error(r(156,u.tag))}function Ii(s){s.flags|=4}function ty(s,u,v,g,E){if((u=(s.mode&32)!==0)&&(u=!1),u){if(s.flags|=16777216,(E&335544128)===E)if(s.stateNode.complete)s.flags|=8192;else if(U2())s.flags|=8192;else throw Yl=Sh,yg}else s.flags&=-16777217}function p2(s,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!RC(u))if(U2())s.flags|=8192;else throw Yl=Sh,yg}function Ih(s,u){u!==null&&(s.flags|=4),s.flags&16384&&(u=s.tag!==22?vt():536870912,s.lanes|=u,fu|=u)}function of(s,u){if(!jt)switch(s.tailMode){case"hidden":u=s.tail;for(var v=null;u!==null;)u.alternate!==null&&(v=u),u=u.sibling;v===null?s.tail=null:v.sibling=null;break;case"collapsed":v=s.tail;for(var g=null;v!==null;)v.alternate!==null&&(g=v),v=v.sibling;g===null?u||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function sn(s){var u=s.alternate!==null&&s.alternate.child===s.child,v=0,g=0;if(u)for(var E=s.child;E!==null;)v|=E.lanes|E.childLanes,g|=E.subtreeFlags&65011712,g|=E.flags&65011712,E.return=s,E=E.sibling;else for(E=s.child;E!==null;)v|=E.lanes|E.childLanes,g|=E.subtreeFlags,g|=E.flags,E.return=s,E=E.sibling;return s.subtreeFlags|=g,s.childLanes=v,u}function M5(s,u,v){var g=u.pendingProps;switch(ug(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(u),null;case 1:return sn(u),null;case 3:return v=u.stateNode,g=null,s!==null&&(g=s.memoizedState.cache),u.memoizedState.cache!==g&&(u.flags|=2048),Li(Rn),ie(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(s===null||s.child===null)&&(Zo(u)?Ii(u):s===null||s.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,fg())),sn(u),null;case 26:var E=u.type,k=u.memoizedState;return s===null?(Ii(u),k!==null?(sn(u),p2(u,k)):(sn(u),ty(u,E,null,g,v))):k?k!==s.memoizedState?(Ii(u),sn(u),p2(u,k)):(sn(u),u.flags&=-16777217):(s=s.memoizedProps,s!==g&&Ii(u),sn(u),ty(u,E,s,g,v)),null;case 27:if(te(u),v=ae.current,E=u.type,s!==null&&u.stateNode!=null)s.memoizedProps!==g&&Ii(u);else{if(!g){if(u.stateNode===null)throw Error(r(166));return sn(u),null}s=Z.current,Zo(u)?YS(u):(s=SC(E,g,v),u.stateNode=s,Ii(u))}return sn(u),null;case 5:if(te(u),E=u.type,s!==null&&u.stateNode!=null)s.memoizedProps!==g&&Ii(u);else{if(!g){if(u.stateNode===null)throw Error(r(166));return sn(u),null}if(k=Z.current,Zo(u))YS(u);else{var _=ev(ae.current);switch(k){case 1:k=_.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:k=_.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":k=_.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":k=_.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":k=_.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof g.is=="string"?_.createElement("select",{is:g.is}):_.createElement("select"),g.multiple?k.multiple=!0:g.size&&(k.size=g.size);break;default:k=typeof g.is=="string"?_.createElement(E,{is:g.is}):_.createElement(E)}}k[un]=u,k[In]=g;e:for(_=u.child;_!==null;){if(_.tag===5||_.tag===6)k.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===u)break e;for(;_.sibling===null;){if(_.return===null||_.return===u)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}u.stateNode=k;e:switch(cr(k,E,g),E){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Ii(u)}}return sn(u),ty(u,u.type,s===null?null:s.memoizedProps,u.pendingProps,v),null;case 6:if(s&&u.stateNode!=null)s.memoizedProps!==g&&Ii(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(s=ae.current,Zo(u)){if(s=u.stateNode,v=u.memoizedProps,g=null,E=lr,E!==null)switch(E.tag){case 27:case 5:g=E.memoizedProps}s[un]=u,s=!!(s.nodeValue===v||g!==null&&g.suppressHydrationWarning===!0||fC(s.nodeValue,v)),s||ks(u,!0)}else s=ev(s).createTextNode(g),s[un]=u,u.stateNode=s}return sn(u),null;case 31:if(v=u.memoizedState,s===null||s.memoizedState!==null){if(g=Zo(u),v!==null){if(s===null){if(!g)throw Error(r(318));if(s=u.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[un]=u}else Vl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;sn(u),s=!1}else v=fg(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=v),s=!0;if(!s)return u.flags&256?(ra(u),u):(ra(u),null);if((u.flags&128)!==0)throw Error(r(558))}return sn(u),null;case 13:if(g=u.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(E=Zo(u),g!==null&&g.dehydrated!==null){if(s===null){if(!E)throw Error(r(318));if(E=u.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[un]=u}else Vl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;sn(u),E=!1}else E=fg(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=E),E=!0;if(!E)return u.flags&256?(ra(u),u):(ra(u),null)}return ra(u),(u.flags&128)!==0?(u.lanes=v,u):(v=g!==null,s=s!==null&&s.memoizedState!==null,v&&(g=u.child,E=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(E=g.alternate.memoizedState.cachePool.pool),k=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(k=g.memoizedState.cachePool.pool),k!==E&&(g.flags|=2048)),v!==s&&v&&(u.child.flags|=8192),Ih(u,u.updateQueue),sn(u),null);case 4:return ie(),s===null&&Ey(u.stateNode.containerInfo),sn(u),null;case 10:return Li(u.type),sn(u),null;case 19:if(X(kn),g=u.memoizedState,g===null)return sn(u),null;if(E=(u.flags&128)!==0,k=g.rendering,k===null)if(E)of(g,!1);else{if(bn!==0||s!==null&&(s.flags&128)!==0)for(s=u.child;s!==null;){if(k=kh(s),k!==null){for(u.flags|=128,of(g,!1),s=k.updateQueue,u.updateQueue=s,Ih(u,s),u.subtreeFlags=0,s=v,v=u.child;v!==null;)VS(v,s),v=v.sibling;return z(kn,kn.current&1|2),jt&&_i(u,g.treeForkCount),u.child}s=s.sibling}g.tail!==null&&ze()>Hh&&(u.flags|=128,E=!0,of(g,!1),u.lanes=4194304)}else{if(!E)if(s=kh(k),s!==null){if(u.flags|=128,E=!0,s=s.updateQueue,u.updateQueue=s,Ih(u,s),of(g,!0),g.tail===null&&g.tailMode==="hidden"&&!k.alternate&&!jt)return sn(u),null}else 2*ze()-g.renderingStartTime>Hh&&v!==536870912&&(u.flags|=128,E=!0,of(g,!1),u.lanes=4194304);g.isBackwards?(k.sibling=u.child,u.child=k):(s=g.last,s!==null?s.sibling=k:u.child=k,g.last=k)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=ze(),s.sibling=null,v=kn.current,z(kn,E?v&1|2:v&1),jt&&_i(u,g.treeForkCount),s):(sn(u),null);case 22:case 23:return ra(u),Cg(),g=u.memoizedState!==null,s!==null?s.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(v&536870912)!==0&&(u.flags&128)===0&&(sn(u),u.subtreeFlags&6&&(u.flags|=8192)):sn(u),v=u.updateQueue,v!==null&&Ih(u,v.retryQueue),v=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(v=s.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==v&&(u.flags|=2048),s!==null&&X($l),null;case 24:return v=null,s!==null&&(v=s.memoizedState.cache),u.memoizedState.cache!==v&&(u.flags|=2048),Li(Rn),sn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function _5(s,u){switch(ug(u),u.tag){case 1:return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 3:return Li(Rn),ie(),s=u.flags,(s&65536)!==0&&(s&128)===0?(u.flags=s&-65537|128,u):null;case 26:case 27:case 5:return te(u),null;case 31:if(u.memoizedState!==null){if(ra(u),u.alternate===null)throw Error(r(340));Vl()}return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 13:if(ra(u),s=u.memoizedState,s!==null&&s.dehydrated!==null){if(u.alternate===null)throw Error(r(340));Vl()}return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 19:return X(kn),null;case 4:return ie(),null;case 10:return Li(u.type),null;case 22:case 23:return ra(u),Cg(),s!==null&&X($l),s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 24:return Li(Rn),null;case 25:return null;default:return null}}function m2(s,u){switch(ug(u),u.tag){case 3:Li(Rn),ie();break;case 26:case 27:case 5:te(u);break;case 4:ie();break;case 31:u.memoizedState!==null&&ra(u);break;case 13:ra(u);break;case 19:X(kn);break;case 10:Li(u.type);break;case 22:case 23:ra(u),Cg(),s!==null&&X($l);break;case 24:Li(Rn)}}function uf(s,u){try{var v=u.updateQueue,g=v!==null?v.lastEffect:null;if(g!==null){var E=g.next;v=E;do{if((v.tag&s)===s){g=void 0;var k=v.create,_=v.inst;g=k(),_.destroy=g}v=v.next}while(v!==E)}}catch($){Ut(u,u.return,$)}}function _s(s,u,v){try{var g=u.updateQueue,E=g!==null?g.lastEffect:null;if(E!==null){var k=E.next;g=k;do{if((g.tag&s)===s){var _=g.inst,$=_.destroy;if($!==void 0){_.destroy=void 0,E=u;var J=v,de=$;try{de()}catch(we){Ut(E,J,we)}}}g=g.next}while(g!==k)}}catch(we){Ut(u,u.return,we)}}function g2(s){var u=s.updateQueue;if(u!==null){var v=s.stateNode;try{lE(u,v)}catch(g){Ut(s,s.return,g)}}}function y2(s,u,v){v.props=Wl(s.type,s.memoizedProps),v.state=s.memoizedState;try{v.componentWillUnmount()}catch(g){Ut(s,u,g)}}function cf(s,u){try{var v=s.ref;if(v!==null){switch(s.tag){case 26:case 27:case 5:var g=s.stateNode;break;case 30:g=s.stateNode;break;default:g=s.stateNode}typeof v=="function"?s.refCleanup=v(g):v.current=g}}catch(E){Ut(s,u,E)}}function ri(s,u){var v=s.ref,g=s.refCleanup;if(v!==null)if(typeof g=="function")try{g()}catch(E){Ut(s,u,E)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof v=="function")try{v(null)}catch(E){Ut(s,u,E)}else v.current=null}function x2(s){var u=s.type,v=s.memoizedProps,g=s.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":v.autoFocus&&g.focus();break e;case"img":v.src?g.src=v.src:v.srcSet&&(g.srcset=v.srcSet)}}catch(E){Ut(s,s.return,E)}}function ny(s,u,v){try{var g=s.stateNode;t4(g,s.type,v,u),g[In]=u}catch(E){Ut(s,s.return,E)}}function b2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Fs(s.type)||s.tag===4}function ry(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||b2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Fs(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function ay(s,u,v){var g=s.tag;if(g===5||g===6)s=s.stateNode,u?(v.nodeType===9?v.body:v.nodeName==="HTML"?v.ownerDocument.body:v).insertBefore(s,u):(u=v.nodeType===9?v.body:v.nodeName==="HTML"?v.ownerDocument.body:v,u.appendChild(s),v=v._reactRootContainer,v!=null||u.onclick!==null||(u.onclick=Ri));else if(g!==4&&(g===27&&Fs(s.type)&&(v=s.stateNode,u=null),s=s.child,s!==null))for(ay(s,u,v),s=s.sibling;s!==null;)ay(s,u,v),s=s.sibling}function Fh(s,u,v){var g=s.tag;if(g===5||g===6)s=s.stateNode,u?v.insertBefore(s,u):v.appendChild(s);else if(g!==4&&(g===27&&Fs(s.type)&&(v=s.stateNode),s=s.child,s!==null))for(Fh(s,u,v),s=s.sibling;s!==null;)Fh(s,u,v),s=s.sibling}function w2(s){var u=s.stateNode,v=s.memoizedProps;try{for(var g=s.type,E=u.attributes;E.length;)u.removeAttributeNode(E[0]);cr(u,g,v),u[un]=s,u[In]=v}catch(k){Ut(s,s.return,k)}}var Fi=!1,_n=!1,iy=!1,S2=typeof WeakSet=="function"?WeakSet:Set,er=null;function O5(s,u){if(s=s.containerInfo,ky=lv,s=OS(s),Zm(s)){if("selectionStart"in s)var v={start:s.selectionStart,end:s.selectionEnd};else e:{v=(v=s.ownerDocument)&&v.defaultView||window;var g=v.getSelection&&v.getSelection();if(g&&g.rangeCount!==0){v=g.anchorNode;var E=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{v.nodeType,k.nodeType}catch{v=null;break e}var _=0,$=-1,J=-1,de=0,we=0,Ee=s,pe=null;t:for(;;){for(var ge;Ee!==v||E!==0&&Ee.nodeType!==3||($=_+E),Ee!==k||g!==0&&Ee.nodeType!==3||(J=_+g),Ee.nodeType===3&&(_+=Ee.nodeValue.length),(ge=Ee.firstChild)!==null;)pe=Ee,Ee=ge;for(;;){if(Ee===s)break t;if(pe===v&&++de===E&&($=_),pe===k&&++we===g&&(J=_),(ge=Ee.nextSibling)!==null)break;Ee=pe,pe=Ee.parentNode}Ee=ge}v=$===-1||J===-1?null:{start:$,end:J}}else v=null}v=v||{start:0,end:0}}else v=null;for(Ty={focusedElem:s,selectionRange:v},lv=!1,er=u;er!==null;)if(u=er,s=u.child,(u.subtreeFlags&1028)!==0&&s!==null)s.return=u,er=s;else for(;er!==null;){switch(u=er,k=u.alternate,s=u.flags,u.tag){case 0:if((s&4)!==0&&(s=u.updateQueue,s=s!==null?s.events:null,s!==null))for(v=0;v<s.length;v++)E=s[v],E.ref.impl=E.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&k!==null){s=void 0,v=u,E=k.memoizedProps,k=k.memoizedState,g=v.stateNode;try{var Ge=Wl(v.type,E);s=g.getSnapshotBeforeUpdate(Ge,k),g.__reactInternalSnapshotBeforeUpdate=s}catch(it){Ut(v,v.return,it)}}break;case 3:if((s&1024)!==0){if(s=u.stateNode.containerInfo,v=s.nodeType,v===9)Ry(s);else if(v===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Ry(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=u.sibling,s!==null){s.return=u.return,er=s;break}er=u.return}}function E2(s,u,v){var g=v.flags;switch(v.tag){case 0:case 11:case 15:qi(s,v),g&4&&uf(5,v);break;case 1:if(qi(s,v),g&4)if(s=v.stateNode,u===null)try{s.componentDidMount()}catch(_){Ut(v,v.return,_)}else{var E=Wl(v.type,u.memoizedProps);u=u.memoizedState;try{s.componentDidUpdate(E,u,s.__reactInternalSnapshotBeforeUpdate)}catch(_){Ut(v,v.return,_)}}g&64&&g2(v),g&512&&cf(v,v.return);break;case 3:if(qi(s,v),g&64&&(s=v.updateQueue,s!==null)){if(u=null,v.child!==null)switch(v.child.tag){case 27:case 5:u=v.child.stateNode;break;case 1:u=v.child.stateNode}try{lE(s,u)}catch(_){Ut(v,v.return,_)}}break;case 27:u===null&&g&4&&w2(v);case 26:case 5:qi(s,v),u===null&&g&4&&x2(v),g&512&&cf(v,v.return);break;case 12:qi(s,v);break;case 31:qi(s,v),g&4&&k2(s,v);break;case 13:qi(s,v),g&4&&T2(s,v),g&64&&(s=v.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(v=V5.bind(null,v),u4(s,v))));break;case 22:if(g=v.memoizedState!==null||Fi,!g){u=u!==null&&u.memoizedState!==null||_n,E=Fi;var k=_n;Fi=g,(_n=u)&&!k?Vi(s,v,(v.subtreeFlags&8772)!==0):qi(s,v),Fi=E,_n=k}break;case 30:break;default:qi(s,v)}}function C2(s){var u=s.alternate;u!==null&&(s.alternate=null,C2(u)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(u=s.stateNode,u!==null&&Io(u)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var cn=null,Ir=!1;function Ui(s,u,v){for(v=v.child;v!==null;)N2(s,u,v),v=v.sibling}function N2(s,u,v){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(K,v)}catch{}switch(v.tag){case 26:_n||ri(v,u),Ui(s,u,v),v.memoizedState?v.memoizedState.count--:v.stateNode&&(v=v.stateNode,v.parentNode.removeChild(v));break;case 27:_n||ri(v,u);var g=cn,E=Ir;Fs(v.type)&&(cn=v.stateNode,Ir=!1),Ui(s,u,v),xf(v.stateNode),cn=g,Ir=E;break;case 5:_n||ri(v,u);case 6:if(g=cn,E=Ir,cn=null,Ui(s,u,v),cn=g,Ir=E,cn!==null)if(Ir)try{(cn.nodeType===9?cn.body:cn.nodeName==="HTML"?cn.ownerDocument.body:cn).removeChild(v.stateNode)}catch(k){Ut(v,u,k)}else try{cn.removeChild(v.stateNode)}catch(k){Ut(v,u,k)}break;case 18:cn!==null&&(Ir?(s=cn,gC(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,v.stateNode),xu(s)):gC(cn,v.stateNode));break;case 4:g=cn,E=Ir,cn=v.stateNode.containerInfo,Ir=!0,Ui(s,u,v),cn=g,Ir=E;break;case 0:case 11:case 14:case 15:_s(2,v,u),_n||_s(4,v,u),Ui(s,u,v);break;case 1:_n||(ri(v,u),g=v.stateNode,typeof g.componentWillUnmount=="function"&&y2(v,u,g)),Ui(s,u,v);break;case 21:Ui(s,u,v);break;case 22:_n=(g=_n)||v.memoizedState!==null,Ui(s,u,v),_n=g;break;default:Ui(s,u,v)}}function k2(s,u){if(u.memoizedState===null&&(s=u.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{xu(s)}catch(v){Ut(u,u.return,v)}}}function T2(s,u){if(u.memoizedState===null&&(s=u.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{xu(s)}catch(v){Ut(u,u.return,v)}}function L5(s){switch(s.tag){case 31:case 13:case 19:var u=s.stateNode;return u===null&&(u=s.stateNode=new S2),u;case 22:return s=s.stateNode,u=s._retryCache,u===null&&(u=s._retryCache=new S2),u;default:throw Error(r(435,s.tag))}}function Uh(s,u){var v=L5(s);u.forEach(function(g){if(!v.has(g)){v.add(g);var E=H5.bind(null,s,g);g.then(E,E)}})}function Fr(s,u){var v=u.deletions;if(v!==null)for(var g=0;g<v.length;g++){var E=v[g],k=s,_=u,$=_;e:for(;$!==null;){switch($.tag){case 27:if(Fs($.type)){cn=$.stateNode,Ir=!1;break e}break;case 5:cn=$.stateNode,Ir=!1;break e;case 3:case 4:cn=$.stateNode.containerInfo,Ir=!0;break e}$=$.return}if(cn===null)throw Error(r(160));N2(k,_,E),cn=null,Ir=!1,k=E.alternate,k!==null&&(k.return=null),E.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)j2(u,s),u=u.sibling}var Ia=null;function j2(s,u){var v=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Fr(u,s),Ur(s),g&4&&(_s(3,s,s.return),uf(3,s),_s(5,s,s.return));break;case 1:Fr(u,s),Ur(s),g&512&&(_n||v===null||ri(v,v.return)),g&64&&Fi&&(s=s.updateQueue,s!==null&&(g=s.callbacks,g!==null&&(v=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=v===null?g:v.concat(g))));break;case 26:var E=Ia;if(Fr(u,s),Ur(s),g&512&&(_n||v===null||ri(v,v.return)),g&4){var k=v!==null?v.memoizedState:null;if(g=s.memoizedState,v===null)if(g===null)if(s.stateNode===null){e:{g=s.type,v=s.memoizedProps,E=E.ownerDocument||E;t:switch(g){case"title":k=E.getElementsByTagName("title")[0],(!k||k[Zn]||k[un]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=E.createElement(g),E.head.insertBefore(k,E.querySelector("head > title"))),cr(k,g,v),k[un]=s,An(k),g=k;break e;case"link":var _=jC("link","href",E).get(g+(v.href||""));if(_){for(var $=0;$<_.length;$++)if(k=_[$],k.getAttribute("href")===(v.href==null||v.href===""?null:v.href)&&k.getAttribute("rel")===(v.rel==null?null:v.rel)&&k.getAttribute("title")===(v.title==null?null:v.title)&&k.getAttribute("crossorigin")===(v.crossOrigin==null?null:v.crossOrigin)){_.splice($,1);break t}}k=E.createElement(g),cr(k,g,v),E.head.appendChild(k);break;case"meta":if(_=jC("meta","content",E).get(g+(v.content||""))){for($=0;$<_.length;$++)if(k=_[$],k.getAttribute("content")===(v.content==null?null:""+v.content)&&k.getAttribute("name")===(v.name==null?null:v.name)&&k.getAttribute("property")===(v.property==null?null:v.property)&&k.getAttribute("http-equiv")===(v.httpEquiv==null?null:v.httpEquiv)&&k.getAttribute("charset")===(v.charSet==null?null:v.charSet)){_.splice($,1);break t}}k=E.createElement(g),cr(k,g,v),E.head.appendChild(k);break;default:throw Error(r(468,g))}k[un]=s,An(k),g=k}s.stateNode=g}else AC(E,s.type,s.stateNode);else s.stateNode=TC(E,g,s.memoizedProps);else k!==g?(k===null?v.stateNode!==null&&(v=v.stateNode,v.parentNode.removeChild(v)):k.count--,g===null?AC(E,s.type,s.stateNode):TC(E,g,s.memoizedProps)):g===null&&s.stateNode!==null&&ny(s,s.memoizedProps,v.memoizedProps)}break;case 27:Fr(u,s),Ur(s),g&512&&(_n||v===null||ri(v,v.return)),v!==null&&g&4&&ny(s,s.memoizedProps,v.memoizedProps);break;case 5:if(Fr(u,s),Ur(s),g&512&&(_n||v===null||ri(v,v.return)),s.flags&32){E=s.stateNode;try{qo(E,"")}catch(Ge){Ut(s,s.return,Ge)}}g&4&&s.stateNode!=null&&(E=s.memoizedProps,ny(s,E,v!==null?v.memoizedProps:E)),g&1024&&(iy=!0);break;case 6:if(Fr(u,s),Ur(s),g&4){if(s.stateNode===null)throw Error(r(162));g=s.memoizedProps,v=s.stateNode;try{v.nodeValue=g}catch(Ge){Ut(s,s.return,Ge)}}break;case 3:if(rv=null,E=Ia,Ia=tv(u.containerInfo),Fr(u,s),Ia=E,Ur(s),g&4&&v!==null&&v.memoizedState.isDehydrated)try{xu(u.containerInfo)}catch(Ge){Ut(s,s.return,Ge)}iy&&(iy=!1,A2(s));break;case 4:g=Ia,Ia=tv(s.stateNode.containerInfo),Fr(u,s),Ur(s),Ia=g;break;case 12:Fr(u,s),Ur(s);break;case 31:Fr(u,s),Ur(s),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,Uh(s,g)));break;case 13:Fr(u,s),Ur(s),s.child.flags&8192&&s.memoizedState!==null!=(v!==null&&v.memoizedState!==null)&&(Vh=ze()),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,Uh(s,g)));break;case 22:E=s.memoizedState!==null;var J=v!==null&&v.memoizedState!==null,de=Fi,we=_n;if(Fi=de||E,_n=we||J,Fr(u,s),_n=we,Fi=de,Ur(s),g&8192)e:for(u=s.stateNode,u._visibility=E?u._visibility&-2:u._visibility|1,E&&(v===null||J||Fi||_n||Zl(s)),v=null,u=s;;){if(u.tag===5||u.tag===26){if(v===null){J=v=u;try{if(k=J.stateNode,E)_=k.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{$=J.stateNode;var Ee=J.memoizedProps.style,pe=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;$.style.display=pe==null||typeof pe=="boolean"?"":(""+pe).trim()}}catch(Ge){Ut(J,J.return,Ge)}}}else if(u.tag===6){if(v===null){J=u;try{J.stateNode.nodeValue=E?"":J.memoizedProps}catch(Ge){Ut(J,J.return,Ge)}}}else if(u.tag===18){if(v===null){J=u;try{var ge=J.stateNode;E?yC(ge,!0):yC(J.stateNode,!1)}catch(Ge){Ut(J,J.return,Ge)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===s)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===s)break e;for(;u.sibling===null;){if(u.return===null||u.return===s)break e;v===u&&(v=null),u=u.return}v===u&&(v=null),u.sibling.return=u.return,u=u.sibling}g&4&&(g=s.updateQueue,g!==null&&(v=g.retryQueue,v!==null&&(g.retryQueue=null,Uh(s,v))));break;case 19:Fr(u,s),Ur(s),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,Uh(s,g)));break;case 30:break;case 21:break;default:Fr(u,s),Ur(s)}}function Ur(s){var u=s.flags;if(u&2){try{for(var v,g=s.return;g!==null;){if(b2(g)){v=g;break}g=g.return}if(v==null)throw Error(r(160));switch(v.tag){case 27:var E=v.stateNode,k=ry(s);Fh(s,k,E);break;case 5:var _=v.stateNode;v.flags&32&&(qo(_,""),v.flags&=-33);var $=ry(s);Fh(s,$,_);break;case 3:case 4:var J=v.stateNode.containerInfo,de=ry(s);ay(s,de,J);break;default:throw Error(r(161))}}catch(we){Ut(s,s.return,we)}s.flags&=-3}u&4096&&(s.flags&=-4097)}function A2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var u=s;A2(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),s=s.sibling}}function qi(s,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)E2(s,u.alternate,u),u=u.sibling}function Zl(s){for(s=s.child;s!==null;){var u=s;switch(u.tag){case 0:case 11:case 14:case 15:_s(4,u,u.return),Zl(u);break;case 1:ri(u,u.return);var v=u.stateNode;typeof v.componentWillUnmount=="function"&&y2(u,u.return,v),Zl(u);break;case 27:xf(u.stateNode);case 26:case 5:ri(u,u.return),Zl(u);break;case 22:u.memoizedState===null&&Zl(u);break;case 30:Zl(u);break;default:Zl(u)}s=s.sibling}}function Vi(s,u,v){for(v=v&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var g=u.alternate,E=s,k=u,_=k.flags;switch(k.tag){case 0:case 11:case 15:Vi(E,k,v),uf(4,k);break;case 1:if(Vi(E,k,v),g=k,E=g.stateNode,typeof E.componentDidMount=="function")try{E.componentDidMount()}catch(de){Ut(g,g.return,de)}if(g=k,E=g.updateQueue,E!==null){var $=g.stateNode;try{var J=E.shared.hiddenCallbacks;if(J!==null)for(E.shared.hiddenCallbacks=null,E=0;E<J.length;E++)sE(J[E],$)}catch(de){Ut(g,g.return,de)}}v&&_&64&&g2(k),cf(k,k.return);break;case 27:w2(k);case 26:case 5:Vi(E,k,v),v&&g===null&&_&4&&x2(k),cf(k,k.return);break;case 12:Vi(E,k,v);break;case 31:Vi(E,k,v),v&&_&4&&k2(E,k);break;case 13:Vi(E,k,v),v&&_&4&&T2(E,k);break;case 22:k.memoizedState===null&&Vi(E,k,v),cf(k,k.return);break;case 30:break;default:Vi(E,k,v)}u=u.sibling}}function sy(s,u){var v=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(v=s.memoizedState.cachePool.pool),s=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(s=u.memoizedState.cachePool.pool),s!==v&&(s!=null&&s.refCount++,v!=null&&Xc(v))}function ly(s,u){s=null,u.alternate!==null&&(s=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==s&&(u.refCount++,s!=null&&Xc(s))}function Fa(s,u,v,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)R2(s,u,v,g),u=u.sibling}function R2(s,u,v,g){var E=u.flags;switch(u.tag){case 0:case 11:case 15:Fa(s,u,v,g),E&2048&&uf(9,u);break;case 1:Fa(s,u,v,g);break;case 3:Fa(s,u,v,g),E&2048&&(s=null,u.alternate!==null&&(s=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==s&&(u.refCount++,s!=null&&Xc(s)));break;case 12:if(E&2048){Fa(s,u,v,g),s=u.stateNode;try{var k=u.memoizedProps,_=k.id,$=k.onPostCommit;typeof $=="function"&&$(_,u.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(J){Ut(u,u.return,J)}}else Fa(s,u,v,g);break;case 31:Fa(s,u,v,g);break;case 13:Fa(s,u,v,g);break;case 23:break;case 22:k=u.stateNode,_=u.alternate,u.memoizedState!==null?k._visibility&2?Fa(s,u,v,g):ff(s,u):k._visibility&2?Fa(s,u,v,g):(k._visibility|=2,ou(s,u,v,g,(u.subtreeFlags&10256)!==0||!1)),E&2048&&sy(_,u);break;case 24:Fa(s,u,v,g),E&2048&&ly(u.alternate,u);break;default:Fa(s,u,v,g)}}function ou(s,u,v,g,E){for(E=E&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var k=s,_=u,$=v,J=g,de=_.flags;switch(_.tag){case 0:case 11:case 15:ou(k,_,$,J,E),uf(8,_);break;case 23:break;case 22:var we=_.stateNode;_.memoizedState!==null?we._visibility&2?ou(k,_,$,J,E):ff(k,_):(we._visibility|=2,ou(k,_,$,J,E)),E&&de&2048&&sy(_.alternate,_);break;case 24:ou(k,_,$,J,E),E&&de&2048&&ly(_.alternate,_);break;default:ou(k,_,$,J,E)}u=u.sibling}}function ff(s,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var v=s,g=u,E=g.flags;switch(g.tag){case 22:ff(v,g),E&2048&&sy(g.alternate,g);break;case 24:ff(v,g),E&2048&&ly(g.alternate,g);break;default:ff(v,g)}u=u.sibling}}var df=8192;function uu(s,u,v){if(s.subtreeFlags&df)for(s=s.child;s!==null;)D2(s,u,v),s=s.sibling}function D2(s,u,v){switch(s.tag){case 26:uu(s,u,v),s.flags&df&&s.memoizedState!==null&&w4(v,Ia,s.memoizedState,s.memoizedProps);break;case 5:uu(s,u,v);break;case 3:case 4:var g=Ia;Ia=tv(s.stateNode.containerInfo),uu(s,u,v),Ia=g;break;case 22:s.memoizedState===null&&(g=s.alternate,g!==null&&g.memoizedState!==null?(g=df,df=16777216,uu(s,u,v),df=g):uu(s,u,v));break;default:uu(s,u,v)}}function M2(s){var u=s.alternate;if(u!==null&&(s=u.child,s!==null)){u.child=null;do u=s.sibling,s.sibling=null,s=u;while(s!==null)}}function hf(s){var u=s.deletions;if((s.flags&16)!==0){if(u!==null)for(var v=0;v<u.length;v++){var g=u[v];er=g,O2(g,s)}M2(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)_2(s),s=s.sibling}function _2(s){switch(s.tag){case 0:case 11:case 15:hf(s),s.flags&2048&&_s(9,s,s.return);break;case 3:hf(s);break;case 12:hf(s);break;case 22:var u=s.stateNode;s.memoizedState!==null&&u._visibility&2&&(s.return===null||s.return.tag!==13)?(u._visibility&=-3,qh(s)):hf(s);break;default:hf(s)}}function qh(s){var u=s.deletions;if((s.flags&16)!==0){if(u!==null)for(var v=0;v<u.length;v++){var g=u[v];er=g,O2(g,s)}M2(s)}for(s=s.child;s!==null;){switch(u=s,u.tag){case 0:case 11:case 15:_s(8,u,u.return),qh(u);break;case 22:v=u.stateNode,v._visibility&2&&(v._visibility&=-3,qh(u));break;default:qh(u)}s=s.sibling}}function O2(s,u){for(;er!==null;){var v=er;switch(v.tag){case 0:case 11:case 15:_s(8,v,u);break;case 23:case 22:if(v.memoizedState!==null&&v.memoizedState.cachePool!==null){var g=v.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Xc(v.memoizedState.cache)}if(g=v.child,g!==null)g.return=v,er=g;else e:for(v=s;er!==null;){g=er;var E=g.sibling,k=g.return;if(C2(g),g===v){er=null;break e}if(E!==null){E.return=k,er=E;break e}er=k}}}var P5={getCacheForType:function(s){var u=or(Rn),v=u.data.get(s);return v===void 0&&(v=s(),u.data.set(s,v)),v},cacheSignal:function(){return or(Rn).controller.signal}},B5=typeof WeakMap=="function"?WeakMap:Map,Pt=0,Xt=null,Et=null,kt=0,Ft=0,aa=null,Os=!1,cu=!1,oy=!1,Hi=0,bn=0,Ls=0,Jl=0,uy=0,ia=0,fu=0,vf=null,qr=null,cy=!1,Vh=0,L2=0,Hh=1/0,Gh=null,Ps=null,Fn=0,Bs=null,du=null,Gi=0,fy=0,dy=null,P2=null,pf=0,hy=null;function sa(){return(Pt&2)!==0&&kt!==0?kt&-kt:F.T!==null?xy():pn()}function B2(){if(ia===0)if((kt&536870912)===0||jt){var s=Fe;Fe<<=1,(Fe&3932160)===0&&(Fe=262144),ia=s}else ia=536870912;return s=na.current,s!==null&&(s.flags|=32),ia}function Vr(s,u,v){(s===Xt&&(Ft===2||Ft===9)||s.cancelPendingCommit!==null)&&(hu(s,0),zs(s,kt,ia,!1)),Vt(s,v),((Pt&2)===0||s!==Xt)&&(s===Xt&&((Pt&2)===0&&(Jl|=v),bn===4&&zs(s,kt,ia,!1)),ai(s))}function z2(s,u,v){if((Pt&6)!==0)throw Error(r(327));var g=!v&&(u&127)===0&&(u&s.expiredLanes)===0||He(s,u),E=g?F5(s,u):py(s,u,!0),k=g;do{if(E===0){cu&&!g&&zs(s,u,0,!1);break}else{if(v=s.current.alternate,k&&!z5(v)){E=py(s,u,!1),k=!1;continue}if(E===2){if(k=u,s.errorRecoveryDisabledLanes&k)var _=0;else _=s.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){u=_;e:{var $=s;E=vf;var J=$.current.memoizedState.isDehydrated;if(J&&(hu($,_).flags|=256),_=py($,_,!1),_!==2){if(oy&&!J){$.errorRecoveryDisabledLanes|=k,Jl|=k,E=4;break e}k=qr,qr=E,k!==null&&(qr===null?qr=k:qr.push.apply(qr,k))}E=_}if(k=!1,E!==2)continue}}if(E===1){hu(s,0),zs(s,u,0,!0);break}e:{switch(g=s,k=E,k){case 0:case 1:throw Error(r(345));case 4:if((u&4194048)!==u)break;case 6:zs(g,u,ia,!Os);break e;case 2:qr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((u&62914560)===u&&(E=Vh+300-ze(),10<E)){if(zs(g,u,ia,!Os),ct(g,0,!0)!==0)break e;Gi=u,g.timeoutHandle=pC(I2.bind(null,g,v,qr,Gh,cy,u,ia,Jl,fu,Os,k,"Throttled",-0,0),E);break e}I2(g,v,qr,Gh,cy,u,ia,Jl,fu,Os,k,null,-0,0)}}break}while(!0);ai(s)}function I2(s,u,v,g,E,k,_,$,J,de,we,Ee,pe,ge){if(s.timeoutHandle=-1,Ee=u.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ri},D2(u,k,Ee);var Ge=(k&62914560)===k?Vh-ze():(k&4194048)===k?L2-ze():0;if(Ge=S4(Ee,Ge),Ge!==null){Gi=k,s.cancelPendingCommit=Ge(K2.bind(null,s,u,k,v,g,E,_,$,J,we,Ee,null,pe,ge)),zs(s,k,_,!de);return}}K2(s,u,k,v,g,E,_,$,J)}function z5(s){for(var u=s;;){var v=u.tag;if((v===0||v===11||v===15)&&u.flags&16384&&(v=u.updateQueue,v!==null&&(v=v.stores,v!==null)))for(var g=0;g<v.length;g++){var E=v[g],k=E.getSnapshot;E=E.value;try{if(!ea(k(),E))return!1}catch{return!1}}if(v=u.child,u.subtreeFlags&16384&&v!==null)v.return=u,u=v;else{if(u===s)break;for(;u.sibling===null;){if(u.return===null||u.return===s)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function zs(s,u,v,g){u&=~uy,u&=~Jl,s.suspendedLanes|=u,s.pingedLanes&=~u,g&&(s.warmLanes|=u),g=s.expirationTimes;for(var E=u;0<E;){var k=31-he(E),_=1<<k;g[k]=-1,E&=~_}v!==0&&vn(s,v,u)}function $h(){return(Pt&6)===0?(mf(0),!1):!0}function vy(){if(Et!==null){if(Ft===0)var s=Et.return;else s=Et,Oi=Hl=null,Rg(s),ru=null,Wc=0,s=Et;for(;s!==null;)m2(s.alternate,s),s=s.return;Et=null}}function hu(s,u){var v=s.timeoutHandle;v!==-1&&(s.timeoutHandle=-1,a4(v)),v=s.cancelPendingCommit,v!==null&&(s.cancelPendingCommit=null,v()),Gi=0,vy(),Xt=s,Et=v=Mi(s.current,null),kt=u,Ft=0,aa=null,Os=!1,cu=He(s,u),oy=!1,fu=ia=uy=Jl=Ls=bn=0,qr=vf=null,cy=!1,(u&8)!==0&&(u|=u&32);var g=s.entangledLanes;if(g!==0)for(s=s.entanglements,g&=u;0<g;){var E=31-he(g),k=1<<E;u|=s[E],g&=~k}return Hi=u,hh(),v}function F2(s,u){ht=null,F.H=sf,u===nu||u===wh?(u=nE(),Ft=3):u===yg?(u=nE(),Ft=4):Ft=u===$g?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,aa=u,Et===null&&(bn=1,Lh(s,xa(u,s.current)))}function U2(){var s=na.current;return s===null?!0:(kt&4194048)===kt?Ea===null:(kt&62914560)===kt||(kt&536870912)!==0?s===Ea:!1}function q2(){var s=F.H;return F.H=sf,s===null?sf:s}function V2(){var s=F.A;return F.A=P5,s}function Kh(){bn=4,Os||(kt&4194048)!==kt&&na.current!==null||(cu=!0),(Ls&134217727)===0&&(Jl&134217727)===0||Xt===null||zs(Xt,kt,ia,!1)}function py(s,u,v){var g=Pt;Pt|=2;var E=q2(),k=V2();(Xt!==s||kt!==u)&&(Gh=null,hu(s,u)),u=!1;var _=bn;e:do try{if(Ft!==0&&Et!==null){var $=Et,J=aa;switch(Ft){case 8:vy(),_=6;break e;case 3:case 2:case 9:case 6:na.current===null&&(u=!0);var de=Ft;if(Ft=0,aa=null,vu(s,$,J,de),v&&cu){_=0;break e}break;default:de=Ft,Ft=0,aa=null,vu(s,$,J,de)}}I5(),_=bn;break}catch(we){F2(s,we)}while(!0);return u&&s.shellSuspendCounter++,Oi=Hl=null,Pt=g,F.H=E,F.A=k,Et===null&&(Xt=null,kt=0,hh()),_}function I5(){for(;Et!==null;)H2(Et)}function F5(s,u){var v=Pt;Pt|=2;var g=q2(),E=V2();Xt!==s||kt!==u?(Gh=null,Hh=ze()+500,hu(s,u)):cu=He(s,u);e:do try{if(Ft!==0&&Et!==null){u=Et;var k=aa;t:switch(Ft){case 1:Ft=0,aa=null,vu(s,u,k,1);break;case 2:case 9:if(eE(k)){Ft=0,aa=null,G2(u);break}u=function(){Ft!==2&&Ft!==9||Xt!==s||(Ft=7),ai(s)},k.then(u,u);break e;case 3:Ft=7;break e;case 4:Ft=5;break e;case 7:eE(k)?(Ft=0,aa=null,G2(u)):(Ft=0,aa=null,vu(s,u,k,7));break;case 5:var _=null;switch(Et.tag){case 26:_=Et.memoizedState;case 5:case 27:var $=Et;if(_?RC(_):$.stateNode.complete){Ft=0,aa=null;var J=$.sibling;if(J!==null)Et=J;else{var de=$.return;de!==null?(Et=de,Yh(de)):Et=null}break t}}Ft=0,aa=null,vu(s,u,k,5);break;case 6:Ft=0,aa=null,vu(s,u,k,6);break;case 8:vy(),bn=6;break e;default:throw Error(r(462))}}U5();break}catch(we){F2(s,we)}while(!0);return Oi=Hl=null,F.H=g,F.A=E,Pt=v,Et!==null?0:(Xt=null,kt=0,hh(),bn)}function U5(){for(;Et!==null&&!Qe();)H2(Et)}function H2(s){var u=v2(s.alternate,s,Hi);s.memoizedProps=s.pendingProps,u===null?Yh(s):Et=u}function G2(s){var u=s,v=u.alternate;switch(u.tag){case 15:case 0:u=o2(v,u,u.pendingProps,u.type,void 0,kt);break;case 11:u=o2(v,u,u.pendingProps,u.type.render,u.ref,kt);break;case 5:Rg(u);default:m2(v,u),u=Et=VS(u,Hi),u=v2(v,u,Hi)}s.memoizedProps=s.pendingProps,u===null?Yh(s):Et=u}function vu(s,u,v,g){Oi=Hl=null,Rg(u),ru=null,Wc=0;var E=u.return;try{if(A5(s,E,u,v,kt)){bn=1,Lh(s,xa(v,s.current)),Et=null;return}}catch(k){if(E!==null)throw Et=E,k;bn=1,Lh(s,xa(v,s.current)),Et=null;return}u.flags&32768?(jt||g===1?s=!0:cu||(kt&536870912)!==0?s=!1:(Os=s=!0,(g===2||g===9||g===3||g===6)&&(g=na.current,g!==null&&g.tag===13&&(g.flags|=16384))),$2(u,s)):Yh(u)}function Yh(s){var u=s;do{if((u.flags&32768)!==0){$2(u,Os);return}s=u.return;var v=M5(u.alternate,u,Hi);if(v!==null){Et=v;return}if(u=u.sibling,u!==null){Et=u;return}Et=u=s}while(u!==null);bn===0&&(bn=5)}function $2(s,u){do{var v=_5(s.alternate,s);if(v!==null){v.flags&=32767,Et=v;return}if(v=s.return,v!==null&&(v.flags|=32768,v.subtreeFlags=0,v.deletions=null),!u&&(s=s.sibling,s!==null)){Et=s;return}Et=s=v}while(s!==null);bn=6,Et=null}function K2(s,u,v,g,E,k,_,$,J){s.cancelPendingCommit=null;do Xh();while(Fn!==0);if((Pt&6)!==0)throw Error(r(327));if(u!==null){if(u===s.current)throw Error(r(177));if(k=u.lanes|u.childLanes,k|=rg,sr(s,v,k,_,$,J),s===Xt&&(Et=Xt=null,kt=0),du=u,Bs=s,Gi=v,fy=k,dy=E,P2=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,G5(Me,function(){return Z2(),null})):(s.callbackNode=null,s.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,E=V.p,V.p=2,_=Pt,Pt|=4;try{O5(s,u,v)}finally{Pt=_,V.p=E,F.T=g}}Fn=1,Y2(),X2(),Q2()}}function Y2(){if(Fn===1){Fn=0;var s=Bs,u=du,v=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||v){v=F.T,F.T=null;var g=V.p;V.p=2;var E=Pt;Pt|=4;try{j2(u,s);var k=Ty,_=OS(s.containerInfo),$=k.focusedElem,J=k.selectionRange;if(_!==$&&$&&$.ownerDocument&&_S($.ownerDocument.documentElement,$)){if(J!==null&&Zm($)){var de=J.start,we=J.end;if(we===void 0&&(we=de),"selectionStart"in $)$.selectionStart=de,$.selectionEnd=Math.min(we,$.value.length);else{var Ee=$.ownerDocument||document,pe=Ee&&Ee.defaultView||window;if(pe.getSelection){var ge=pe.getSelection(),Ge=$.textContent.length,it=Math.min(J.start,Ge),$t=J.end===void 0?it:Math.min(J.end,Ge);!ge.extend&&it>$t&&(_=$t,$t=it,it=_);var ue=MS($,it),ne=MS($,$t);if(ue&&ne&&(ge.rangeCount!==1||ge.anchorNode!==ue.node||ge.anchorOffset!==ue.offset||ge.focusNode!==ne.node||ge.focusOffset!==ne.offset)){var fe=Ee.createRange();fe.setStart(ue.node,ue.offset),ge.removeAllRanges(),it>$t?(ge.addRange(fe),ge.extend(ne.node,ne.offset)):(fe.setEnd(ne.node,ne.offset),ge.addRange(fe))}}}}for(Ee=[],ge=$;ge=ge.parentNode;)ge.nodeType===1&&Ee.push({element:ge,left:ge.scrollLeft,top:ge.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<Ee.length;$++){var Se=Ee[$];Se.element.scrollLeft=Se.left,Se.element.scrollTop=Se.top}}lv=!!ky,Ty=ky=null}finally{Pt=E,V.p=g,F.T=v}}s.current=u,Fn=2}}function X2(){if(Fn===2){Fn=0;var s=Bs,u=du,v=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||v){v=F.T,F.T=null;var g=V.p;V.p=2;var E=Pt;Pt|=4;try{E2(s,u.alternate,u)}finally{Pt=E,V.p=g,F.T=v}}Fn=3}}function Q2(){if(Fn===4||Fn===3){Fn=0,st();var s=Bs,u=du,v=Gi,g=P2;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?Fn=5:(Fn=0,du=Bs=null,W2(s,s.pendingLanes));var E=s.pendingLanes;if(E===0&&(Ps=null),va(v),u=u.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(K,u,void 0,(u.current.flags&128)===128)}catch{}if(g!==null){u=F.T,E=V.p,V.p=2,F.T=null;try{for(var k=s.onRecoverableError,_=0;_<g.length;_++){var $=g[_];k($.value,{componentStack:$.stack})}}finally{F.T=u,V.p=E}}(Gi&3)!==0&&Xh(),ai(s),E=s.pendingLanes,(v&261930)!==0&&(E&42)!==0?s===hy?pf++:(pf=0,hy=s):pf=0,mf(0)}}function W2(s,u){(s.pooledCacheLanes&=u)===0&&(u=s.pooledCache,u!=null&&(s.pooledCache=null,Xc(u)))}function Xh(){return Y2(),X2(),Q2(),Z2()}function Z2(){if(Fn!==5)return!1;var s=Bs,u=fy;fy=0;var v=va(Gi),g=F.T,E=V.p;try{V.p=32>v?32:v,F.T=null,v=dy,dy=null;var k=Bs,_=Gi;if(Fn=0,du=Bs=null,Gi=0,(Pt&6)!==0)throw Error(r(331));var $=Pt;if(Pt|=4,_2(k.current),R2(k,k.current,_,v),Pt=$,mf(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(K,k)}catch{}return!0}finally{V.p=E,F.T=g,W2(s,u)}}function J2(s,u,v){u=xa(v,u),u=Gg(s.stateNode,u,2),s=Rs(s,u,2),s!==null&&(Vt(s,2),ai(s))}function Ut(s,u,v){if(s.tag===3)J2(s,s,v);else for(;u!==null;){if(u.tag===3){J2(u,s,v);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ps===null||!Ps.has(g))){s=xa(v,s),v=e2(2),g=Rs(u,v,2),g!==null&&(t2(v,g,u,s),Vt(g,2),ai(g));break}}u=u.return}}function my(s,u,v){var g=s.pingCache;if(g===null){g=s.pingCache=new B5;var E=new Set;g.set(u,E)}else E=g.get(u),E===void 0&&(E=new Set,g.set(u,E));E.has(v)||(oy=!0,E.add(v),s=q5.bind(null,s,u,v),u.then(s,s))}function q5(s,u,v){var g=s.pingCache;g!==null&&g.delete(u),s.pingedLanes|=s.suspendedLanes&v,s.warmLanes&=~v,Xt===s&&(kt&v)===v&&(bn===4||bn===3&&(kt&62914560)===kt&&300>ze()-Vh?(Pt&2)===0&&hu(s,0):uy|=v,fu===kt&&(fu=0)),ai(s)}function eC(s,u){u===0&&(u=vt()),s=Ul(s,u),s!==null&&(Vt(s,u),ai(s))}function V5(s){var u=s.memoizedState,v=0;u!==null&&(v=u.retryLane),eC(s,v)}function H5(s,u){var v=0;switch(s.tag){case 31:case 13:var g=s.stateNode,E=s.memoizedState;E!==null&&(v=E.retryLane);break;case 19:g=s.stateNode;break;case 22:g=s.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),eC(s,v)}function G5(s,u){return De(s,u)}var Qh=null,pu=null,gy=!1,Wh=!1,yy=!1,Is=0;function ai(s){s!==pu&&s.next===null&&(pu===null?Qh=pu=s:pu=pu.next=s),Wh=!0,gy||(gy=!0,K5())}function mf(s,u){if(!yy&&Wh){yy=!0;do for(var v=!1,g=Qh;g!==null;){if(s!==0){var E=g.pendingLanes;if(E===0)var k=0;else{var _=g.suspendedLanes,$=g.pingedLanes;k=(1<<31-he(42|s)+1)-1,k&=E&~(_&~$),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(v=!0,aC(g,k))}else k=kt,k=ct(g,g===Xt?k:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(k&3)===0||He(g,k)||(v=!0,aC(g,k));g=g.next}while(v);yy=!1}}function $5(){tC()}function tC(){Wh=gy=!1;var s=0;Is!==0&&r4()&&(s=Is);for(var u=ze(),v=null,g=Qh;g!==null;){var E=g.next,k=nC(g,u);k===0?(g.next=null,v===null?Qh=E:v.next=E,E===null&&(pu=v)):(v=g,(s!==0||(k&3)!==0)&&(Wh=!0)),g=E}Fn!==0&&Fn!==5||mf(s),Is!==0&&(Is=0)}function nC(s,u){for(var v=s.suspendedLanes,g=s.pingedLanes,E=s.expirationTimes,k=s.pendingLanes&-62914561;0<k;){var _=31-he(k),$=1<<_,J=E[_];J===-1?(($&v)===0||($&g)!==0)&&(E[_]=bt($,u)):J<=u&&(s.expiredLanes|=$),k&=~$}if(u=Xt,v=kt,v=ct(s,s===u?v:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),g=s.callbackNode,v===0||s===u&&(Ft===2||Ft===9)||s.cancelPendingCommit!==null)return g!==null&&g!==null&&Ye(g),s.callbackNode=null,s.callbackPriority=0;if((v&3)===0||He(s,v)){if(u=v&-v,u===s.callbackPriority)return u;switch(g!==null&&Ye(g),va(v)){case 2:case 8:v=Ce;break;case 32:v=Me;break;case 268435456:v=_e;break;default:v=Me}return g=rC.bind(null,s),v=De(v,g),s.callbackPriority=u,s.callbackNode=v,u}return g!==null&&g!==null&&Ye(g),s.callbackPriority=2,s.callbackNode=null,2}function rC(s,u){if(Fn!==0&&Fn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var v=s.callbackNode;if(Xh()&&s.callbackNode!==v)return null;var g=kt;return g=ct(s,s===Xt?g:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),g===0?null:(z2(s,g,u),nC(s,ze()),s.callbackNode!=null&&s.callbackNode===v?rC.bind(null,s):null)}function aC(s,u){if(Xh())return null;z2(s,u,!0)}function K5(){i4(function(){(Pt&6)!==0?De(ve,$5):tC()})}function xy(){if(Is===0){var s=eu;s===0&&(s=Ke,Ke<<=1,(Ke&261888)===0&&(Ke=256)),Is=s}return Is}function iC(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:ih(""+s)}function sC(s,u){var v=u.ownerDocument.createElement("input");return v.name=u.name,v.value=u.value,s.id&&v.setAttribute("form",s.id),u.parentNode.insertBefore(v,u),s=new FormData(s),v.parentNode.removeChild(v),s}function Y5(s,u,v,g,E){if(u==="submit"&&v&&v.stateNode===E){var k=iC((E[In]||null).action),_=g.submitter;_&&(u=(u=_[In]||null)?iC(u.formAction):_.getAttribute("formAction"),u!==null&&(k=u,_=null));var $=new uh("action","action",null,g,E);s.push({event:$,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Is!==0){var J=_?sC(E,_):new FormData(E);Ig(v,{pending:!0,data:J,method:E.method,action:k},null,J)}}else typeof k=="function"&&($.preventDefault(),J=_?sC(E,_):new FormData(E),Ig(v,{pending:!0,data:J,method:E.method,action:k},k,J))},currentTarget:E}]})}}for(var by=0;by<ng.length;by++){var wy=ng[by],X5=wy.toLowerCase(),Q5=wy[0].toUpperCase()+wy.slice(1);za(X5,"on"+Q5)}za(BS,"onAnimationEnd"),za(zS,"onAnimationIteration"),za(IS,"onAnimationStart"),za("dblclick","onDoubleClick"),za("focusin","onFocus"),za("focusout","onBlur"),za(d5,"onTransitionRun"),za(h5,"onTransitionStart"),za(v5,"onTransitionCancel"),za(FS,"onTransitionEnd"),ei("onMouseEnter",["mouseout","mouseover"]),ei("onMouseLeave",["mouseout","mouseover"]),ei("onPointerEnter",["pointerout","pointerover"]),ei("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),W5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gf));function lC(s,u){u=(u&4)!==0;for(var v=0;v<s.length;v++){var g=s[v],E=g.event;g=g.listeners;e:{var k=void 0;if(u)for(var _=g.length-1;0<=_;_--){var $=g[_],J=$.instance,de=$.currentTarget;if($=$.listener,J!==k&&E.isPropagationStopped())break e;k=$,E.currentTarget=de;try{k(E)}catch(we){dh(we)}E.currentTarget=null,k=J}else for(_=0;_<g.length;_++){if($=g[_],J=$.instance,de=$.currentTarget,$=$.listener,J!==k&&E.isPropagationStopped())break e;k=$,E.currentTarget=de;try{k(E)}catch(we){dh(we)}E.currentTarget=null,k=J}}}}function Ct(s,u){var v=u[Qn];v===void 0&&(v=u[Qn]=new Set);var g=s+"__bubble";v.has(g)||(oC(u,s,2,!1),v.add(g))}function Sy(s,u,v){var g=0;u&&(g|=4),oC(v,s,g,u)}var Zh="_reactListening"+Math.random().toString(36).slice(2);function Ey(s){if(!s[Zh]){s[Zh]=!0,eh.forEach(function(v){v!=="selectionchange"&&(W5.has(v)||Sy(v,!1,s),Sy(v,!0,s))});var u=s.nodeType===9?s:s.ownerDocument;u===null||u[Zh]||(u[Zh]=!0,Sy("selectionchange",!1,u))}}function oC(s,u,v,g){switch(BC(u)){case 2:var E=N4;break;case 8:E=k4;break;default:E=zy}v=E.bind(null,u,v,s),E=void 0,!Vm||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(E=!0),g?E!==void 0?s.addEventListener(u,v,{capture:!0,passive:E}):s.addEventListener(u,v,!0):E!==void 0?s.addEventListener(u,v,{passive:E}):s.addEventListener(u,v,!1)}function Cy(s,u,v,g,E){var k=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var _=g.tag;if(_===3||_===4){var $=g.stateNode.containerInfo;if($===E)break;if(_===4)for(_=g.return;_!==null;){var J=_.tag;if((J===3||J===4)&&_.stateNode.containerInfo===E)return;_=_.return}for(;$!==null;){if(_=xs($),_===null)return;if(J=_.tag,J===5||J===6||J===26||J===27){g=k=_;continue e}$=$.parentNode}}g=g.return}hS(function(){var de=k,we=Um(v),Ee=[];e:{var pe=US.get(s);if(pe!==void 0){var ge=uh,Ge=s;switch(s){case"keypress":if(lh(v)===0)break e;case"keydown":case"keyup":ge=H3;break;case"focusin":Ge="focus",ge=Km;break;case"focusout":Ge="blur",ge=Km;break;case"beforeblur":case"afterblur":ge=Km;break;case"click":if(v.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ge=mS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ge=M3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ge=K3;break;case BS:case zS:case IS:ge=L3;break;case FS:ge=X3;break;case"scroll":case"scrollend":ge=R3;break;case"wheel":ge=W3;break;case"copy":case"cut":case"paste":ge=B3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ge=yS;break;case"toggle":case"beforetoggle":ge=J3}var it=(u&4)!==0,$t=!it&&(s==="scroll"||s==="scrollend"),ue=it?pe!==null?pe+"Capture":null:pe;it=[];for(var ne=de,fe;ne!==null;){var Se=ne;if(fe=Se.stateNode,Se=Se.tag,Se!==5&&Se!==26&&Se!==27||fe===null||ue===null||(Se=zc(ne,ue),Se!=null&&it.push(yf(ne,Se,fe))),$t)break;ne=ne.return}0<it.length&&(pe=new ge(pe,Ge,null,v,we),Ee.push({event:pe,listeners:it}))}}if((u&7)===0){e:{if(pe=s==="mouseover"||s==="pointerover",ge=s==="mouseout"||s==="pointerout",pe&&v!==Fm&&(Ge=v.relatedTarget||v.fromElement)&&(xs(Ge)||Ge[Pr]))break e;if((ge||pe)&&(pe=we.window===we?we:(pe=we.ownerDocument)?pe.defaultView||pe.parentWindow:window,ge?(Ge=v.relatedTarget||v.toElement,ge=de,Ge=Ge?xs(Ge):null,Ge!==null&&($t=i(Ge),it=Ge.tag,Ge!==$t||it!==5&&it!==27&&it!==6)&&(Ge=null)):(ge=null,Ge=de),ge!==Ge)){if(it=mS,Se="onMouseLeave",ue="onMouseEnter",ne="mouse",(s==="pointerout"||s==="pointerover")&&(it=yS,Se="onPointerLeave",ue="onPointerEnter",ne="pointer"),$t=ge==null?pe:Bl(ge),fe=Ge==null?pe:Bl(Ge),pe=new it(Se,ne+"leave",ge,v,we),pe.target=$t,pe.relatedTarget=fe,Se=null,xs(we)===de&&(it=new it(ue,ne+"enter",Ge,v,we),it.target=fe,it.relatedTarget=$t,Se=it),$t=Se,ge&&Ge)t:{for(it=Z5,ue=ge,ne=Ge,fe=0,Se=ue;Se;Se=it(Se))fe++;Se=0;for(var nt=ne;nt;nt=it(nt))Se++;for(;0<fe-Se;)ue=it(ue),fe--;for(;0<Se-fe;)ne=it(ne),Se--;for(;fe--;){if(ue===ne||ne!==null&&ue===ne.alternate){it=ue;break t}ue=it(ue),ne=it(ne)}it=null}else it=null;ge!==null&&uC(Ee,pe,ge,it,!1),Ge!==null&&$t!==null&&uC(Ee,$t,Ge,it,!0)}}e:{if(pe=de?Bl(de):window,ge=pe.nodeName&&pe.nodeName.toLowerCase(),ge==="select"||ge==="input"&&pe.type==="file")var _t=kS;else if(CS(pe))if(TS)_t=u5;else{_t=l5;var Xe=s5}else ge=pe.nodeName,!ge||ge.toLowerCase()!=="input"||pe.type!=="checkbox"&&pe.type!=="radio"?de&&Im(de.elementType)&&(_t=kS):_t=o5;if(_t&&(_t=_t(s,de))){NS(Ee,_t,v,we);break e}Xe&&Xe(s,pe,de),s==="focusout"&&de&&pe.type==="number"&&de.memoizedProps.value!=null&&zm(pe,"number",pe.value)}switch(Xe=de?Bl(de):window,s){case"focusin":(CS(Xe)||Xe.contentEditable==="true")&&($o=Xe,Jm=de,$c=null);break;case"focusout":$c=Jm=$o=null;break;case"mousedown":eg=!0;break;case"contextmenu":case"mouseup":case"dragend":eg=!1,LS(Ee,v,we);break;case"selectionchange":if(f5)break;case"keydown":case"keyup":LS(Ee,v,we)}var pt;if(Xm)e:{switch(s){case"compositionstart":var Tt="onCompositionStart";break e;case"compositionend":Tt="onCompositionEnd";break e;case"compositionupdate":Tt="onCompositionUpdate";break e}Tt=void 0}else Go?SS(s,v)&&(Tt="onCompositionEnd"):s==="keydown"&&v.keyCode===229&&(Tt="onCompositionStart");Tt&&(xS&&v.locale!=="ko"&&(Go||Tt!=="onCompositionStart"?Tt==="onCompositionEnd"&&Go&&(pt=vS()):(Es=we,Hm="value"in Es?Es.value:Es.textContent,Go=!0)),Xe=Jh(de,Tt),0<Xe.length&&(Tt=new gS(Tt,s,null,v,we),Ee.push({event:Tt,listeners:Xe}),pt?Tt.data=pt:(pt=ES(v),pt!==null&&(Tt.data=pt)))),(pt=t5?n5(s,v):r5(s,v))&&(Tt=Jh(de,"onBeforeInput"),0<Tt.length&&(Xe=new gS("onBeforeInput","beforeinput",null,v,we),Ee.push({event:Xe,listeners:Tt}),Xe.data=pt)),Y5(Ee,s,de,v,we)}lC(Ee,u)})}function yf(s,u,v){return{instance:s,listener:u,currentTarget:v}}function Jh(s,u){for(var v=u+"Capture",g=[];s!==null;){var E=s,k=E.stateNode;if(E=E.tag,E!==5&&E!==26&&E!==27||k===null||(E=zc(s,v),E!=null&&g.unshift(yf(s,E,k)),E=zc(s,u),E!=null&&g.push(yf(s,E,k))),s.tag===3)return g;s=s.return}return[]}function Z5(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function uC(s,u,v,g,E){for(var k=u._reactName,_=[];v!==null&&v!==g;){var $=v,J=$.alternate,de=$.stateNode;if($=$.tag,J!==null&&J===g)break;$!==5&&$!==26&&$!==27||de===null||(J=de,E?(de=zc(v,k),de!=null&&_.unshift(yf(v,de,J))):E||(de=zc(v,k),de!=null&&_.push(yf(v,de,J)))),v=v.return}_.length!==0&&s.push({event:u,listeners:_})}var J5=/\r\n?/g,e4=/\u0000|\uFFFD/g;function cC(s){return(typeof s=="string"?s:""+s).replace(J5,`
|
|
49
|
-
`).replace(e4,"")}function fC(s,u){return u=cC(u),cC(s)===u}function Gt(s,u,v,g,E,k){switch(v){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||qo(s,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&qo(s,""+g);break;case"className":Ss(s,"class",g);break;case"tabIndex":Ss(s,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ss(s,v,g);break;case"style":fS(s,g,k);break;case"data":if(u!=="object"){Ss(s,"data",g);break}case"src":case"href":if(g===""&&(u!=="a"||v!=="href")){s.removeAttribute(v);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){s.removeAttribute(v);break}g=ih(""+g),s.setAttribute(v,g);break;case"action":case"formAction":if(typeof g=="function"){s.setAttribute(v,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(v==="formAction"?(u!=="input"&&Gt(s,u,"name",E.name,E,null),Gt(s,u,"formEncType",E.formEncType,E,null),Gt(s,u,"formMethod",E.formMethod,E,null),Gt(s,u,"formTarget",E.formTarget,E,null)):(Gt(s,u,"encType",E.encType,E,null),Gt(s,u,"method",E.method,E,null),Gt(s,u,"target",E.target,E,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){s.removeAttribute(v);break}g=ih(""+g),s.setAttribute(v,g);break;case"onClick":g!=null&&(s.onclick=Ri);break;case"onScroll":g!=null&&Ct("scroll",s);break;case"onScrollEnd":g!=null&&Ct("scrollend",s);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(v=g.__html,v!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=v}}break;case"multiple":s.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":s.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){s.removeAttribute("xlink:href");break}v=ih(""+g),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",v);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(v,""+g):s.removeAttribute(v);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(v,""):s.removeAttribute(v);break;case"capture":case"download":g===!0?s.setAttribute(v,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(v,g):s.removeAttribute(v);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?s.setAttribute(v,g):s.removeAttribute(v);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?s.removeAttribute(v):s.setAttribute(v,g);break;case"popover":Ct("beforetoggle",s),Ct("toggle",s),mr(s,"popover",g);break;case"xlinkActuate":ma(s,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":ma(s,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":ma(s,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":ma(s,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":ma(s,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":ma(s,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":ma(s,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":ma(s,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":ma(s,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":mr(s,"is",g);break;case"innerText":case"textContent":break;default:(!(2<v.length)||v[0]!=="o"&&v[0]!=="O"||v[1]!=="n"&&v[1]!=="N")&&(v=j3.get(v)||v,mr(s,v,g))}}function Ny(s,u,v,g,E,k){switch(v){case"style":fS(s,g,k);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(v=g.__html,v!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=v}}break;case"children":typeof g=="string"?qo(s,g):(typeof g=="number"||typeof g=="bigint")&&qo(s,""+g);break;case"onScroll":g!=null&&Ct("scroll",s);break;case"onScrollEnd":g!=null&&Ct("scrollend",s);break;case"onClick":g!=null&&(s.onclick=Ri);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!th.hasOwnProperty(v))e:{if(v[0]==="o"&&v[1]==="n"&&(E=v.endsWith("Capture"),u=v.slice(2,E?v.length-7:void 0),k=s[In]||null,k=k!=null?k[v]:null,typeof k=="function"&&s.removeEventListener(u,k,E),typeof g=="function")){typeof k!="function"&&k!==null&&(v in s?s[v]=null:s.hasAttribute(v)&&s.removeAttribute(v)),s.addEventListener(u,g,E);break e}v in s?s[v]=g:g===!0?s.setAttribute(v,""):mr(s,v,g)}}}function cr(s,u,v){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ct("error",s),Ct("load",s);var g=!1,E=!1,k;for(k in v)if(v.hasOwnProperty(k)){var _=v[k];if(_!=null)switch(k){case"src":g=!0;break;case"srcSet":E=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:Gt(s,u,k,_,v,null)}}E&&Gt(s,u,"srcSet",v.srcSet,v,null),g&&Gt(s,u,"src",v.src,v,null);return;case"input":Ct("invalid",s);var $=k=_=E=null,J=null,de=null;for(g in v)if(v.hasOwnProperty(g)){var we=v[g];if(we!=null)switch(g){case"name":E=we;break;case"type":_=we;break;case"checked":J=we;break;case"defaultChecked":de=we;break;case"value":k=we;break;case"defaultValue":$=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,u));break;default:Gt(s,u,g,we,v,null)}}lS(s,k,$,J,de,_,E,!1);return;case"select":Ct("invalid",s),g=_=k=null;for(E in v)if(v.hasOwnProperty(E)&&($=v[E],$!=null))switch(E){case"value":k=$;break;case"defaultValue":_=$;break;case"multiple":g=$;default:Gt(s,u,E,$,v,null)}u=k,v=_,s.multiple=!!g,u!=null?Uo(s,!!g,u,!1):v!=null&&Uo(s,!!g,v,!0);return;case"textarea":Ct("invalid",s),k=E=g=null;for(_ in v)if(v.hasOwnProperty(_)&&($=v[_],$!=null))switch(_){case"value":g=$;break;case"defaultValue":E=$;break;case"children":k=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(r(91));break;default:Gt(s,u,_,$,v,null)}uS(s,g,E,k);return;case"option":for(J in v)if(v.hasOwnProperty(J)&&(g=v[J],g!=null))switch(J){case"selected":s.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:Gt(s,u,J,g,v,null)}return;case"dialog":Ct("beforetoggle",s),Ct("toggle",s),Ct("cancel",s),Ct("close",s);break;case"iframe":case"object":Ct("load",s);break;case"video":case"audio":for(g=0;g<gf.length;g++)Ct(gf[g],s);break;case"image":Ct("error",s),Ct("load",s);break;case"details":Ct("toggle",s);break;case"embed":case"source":case"link":Ct("error",s),Ct("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(de in v)if(v.hasOwnProperty(de)&&(g=v[de],g!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:Gt(s,u,de,g,v,null)}return;default:if(Im(u)){for(we in v)v.hasOwnProperty(we)&&(g=v[we],g!==void 0&&Ny(s,u,we,g,v,void 0));return}}for($ in v)v.hasOwnProperty($)&&(g=v[$],g!=null&&Gt(s,u,$,g,v,null))}function t4(s,u,v,g){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var E=null,k=null,_=null,$=null,J=null,de=null,we=null;for(ge in v){var Ee=v[ge];if(v.hasOwnProperty(ge)&&Ee!=null)switch(ge){case"checked":break;case"value":break;case"defaultValue":J=Ee;default:g.hasOwnProperty(ge)||Gt(s,u,ge,null,g,Ee)}}for(var pe in g){var ge=g[pe];if(Ee=v[pe],g.hasOwnProperty(pe)&&(ge!=null||Ee!=null))switch(pe){case"type":k=ge;break;case"name":E=ge;break;case"checked":de=ge;break;case"defaultChecked":we=ge;break;case"value":_=ge;break;case"defaultValue":$=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,u));break;default:ge!==Ee&&Gt(s,u,pe,ge,g,Ee)}}Bm(s,_,$,J,de,we,k,E);return;case"select":ge=_=$=pe=null;for(k in v)if(J=v[k],v.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":ge=J;default:g.hasOwnProperty(k)||Gt(s,u,k,null,g,J)}for(E in g)if(k=g[E],J=v[E],g.hasOwnProperty(E)&&(k!=null||J!=null))switch(E){case"value":pe=k;break;case"defaultValue":$=k;break;case"multiple":_=k;default:k!==J&&Gt(s,u,E,k,g,J)}u=$,v=_,g=ge,pe!=null?Uo(s,!!v,pe,!1):!!g!=!!v&&(u!=null?Uo(s,!!v,u,!0):Uo(s,!!v,v?[]:"",!1));return;case"textarea":ge=pe=null;for($ in v)if(E=v[$],v.hasOwnProperty($)&&E!=null&&!g.hasOwnProperty($))switch($){case"value":break;case"children":break;default:Gt(s,u,$,null,g,E)}for(_ in g)if(E=g[_],k=v[_],g.hasOwnProperty(_)&&(E!=null||k!=null))switch(_){case"value":pe=E;break;case"defaultValue":ge=E;break;case"children":break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:E!==k&&Gt(s,u,_,E,g,k)}oS(s,pe,ge);return;case"option":for(var Ge in v)if(pe=v[Ge],v.hasOwnProperty(Ge)&&pe!=null&&!g.hasOwnProperty(Ge))switch(Ge){case"selected":s.selected=!1;break;default:Gt(s,u,Ge,null,g,pe)}for(J in g)if(pe=g[J],ge=v[J],g.hasOwnProperty(J)&&pe!==ge&&(pe!=null||ge!=null))switch(J){case"selected":s.selected=pe&&typeof pe!="function"&&typeof pe!="symbol";break;default:Gt(s,u,J,pe,g,ge)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var it in v)pe=v[it],v.hasOwnProperty(it)&&pe!=null&&!g.hasOwnProperty(it)&&Gt(s,u,it,null,g,pe);for(de in g)if(pe=g[de],ge=v[de],g.hasOwnProperty(de)&&pe!==ge&&(pe!=null||ge!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,u));break;default:Gt(s,u,de,pe,g,ge)}return;default:if(Im(u)){for(var $t in v)pe=v[$t],v.hasOwnProperty($t)&&pe!==void 0&&!g.hasOwnProperty($t)&&Ny(s,u,$t,void 0,g,pe);for(we in g)pe=g[we],ge=v[we],!g.hasOwnProperty(we)||pe===ge||pe===void 0&&ge===void 0||Ny(s,u,we,pe,g,ge);return}}for(var ue in v)pe=v[ue],v.hasOwnProperty(ue)&&pe!=null&&!g.hasOwnProperty(ue)&&Gt(s,u,ue,null,g,pe);for(Ee in g)pe=g[Ee],ge=v[Ee],!g.hasOwnProperty(Ee)||pe===ge||pe==null&&ge==null||Gt(s,u,Ee,pe,g,ge)}function dC(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n4(){if(typeof performance.getEntriesByType=="function"){for(var s=0,u=0,v=performance.getEntriesByType("resource"),g=0;g<v.length;g++){var E=v[g],k=E.transferSize,_=E.initiatorType,$=E.duration;if(k&&$&&dC(_)){for(_=0,$=E.responseEnd,g+=1;g<v.length;g++){var J=v[g],de=J.startTime;if(de>$)break;var we=J.transferSize,Ee=J.initiatorType;we&&dC(Ee)&&(J=J.responseEnd,_+=we*(J<$?1:($-de)/(J-de)))}if(--g,u+=8*(k+_)/(E.duration/1e3),s++,10<s)break}}if(0<s)return u/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var ky=null,Ty=null;function ev(s){return s.nodeType===9?s:s.ownerDocument}function hC(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vC(s,u){if(s===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&u==="foreignObject"?0:s}function jy(s,u){return s==="textarea"||s==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var Ay=null;function r4(){var s=window.event;return s&&s.type==="popstate"?s===Ay?!1:(Ay=s,!0):(Ay=null,!1)}var pC=typeof setTimeout=="function"?setTimeout:void 0,a4=typeof clearTimeout=="function"?clearTimeout:void 0,mC=typeof Promise=="function"?Promise:void 0,i4=typeof queueMicrotask=="function"?queueMicrotask:typeof mC<"u"?function(s){return mC.resolve(null).then(s).catch(s4)}:pC;function s4(s){setTimeout(function(){throw s})}function Fs(s){return s==="head"}function gC(s,u){var v=u,g=0;do{var E=v.nextSibling;if(s.removeChild(v),E&&E.nodeType===8)if(v=E.data,v==="/$"||v==="/&"){if(g===0){s.removeChild(E),xu(u);return}g--}else if(v==="$"||v==="$?"||v==="$~"||v==="$!"||v==="&")g++;else if(v==="html")xf(s.ownerDocument.documentElement);else if(v==="head"){v=s.ownerDocument.head,xf(v);for(var k=v.firstChild;k;){var _=k.nextSibling,$=k.nodeName;k[Zn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&k.rel.toLowerCase()==="stylesheet"||v.removeChild(k),k=_}}else v==="body"&&xf(s.ownerDocument.body);v=E}while(v);xu(u)}function yC(s,u){var v=s;s=0;do{var g=v.nextSibling;if(v.nodeType===1?u?(v._stashedDisplay=v.style.display,v.style.display="none"):(v.style.display=v._stashedDisplay||"",v.getAttribute("style")===""&&v.removeAttribute("style")):v.nodeType===3&&(u?(v._stashedText=v.nodeValue,v.nodeValue=""):v.nodeValue=v._stashedText||""),g&&g.nodeType===8)if(v=g.data,v==="/$"){if(s===0)break;s--}else v!=="$"&&v!=="$?"&&v!=="$~"&&v!=="$!"||s++;v=g}while(v)}function Ry(s){var u=s.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var v=u;switch(u=u.nextSibling,v.nodeName){case"HTML":case"HEAD":case"BODY":Ry(v),Io(v);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(v.rel.toLowerCase()==="stylesheet")continue}s.removeChild(v)}}function l4(s,u,v,g){for(;s.nodeType===1;){var E=v;if(s.nodeName.toLowerCase()!==u.toLowerCase()){if(!g&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(g){if(!s[Zn])switch(u){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(k=s.getAttribute("rel"),k==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(k!==E.rel||s.getAttribute("href")!==(E.href==null||E.href===""?null:E.href)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin)||s.getAttribute("title")!==(E.title==null?null:E.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(k=s.getAttribute("src"),(k!==(E.src==null?null:E.src)||s.getAttribute("type")!==(E.type==null?null:E.type)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin))&&k&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(u==="input"&&s.type==="hidden"){var k=E.name==null?null:""+E.name;if(E.type==="hidden"&&s.getAttribute("name")===k)return s}else return s;if(s=Ca(s.nextSibling),s===null)break}return null}function o4(s,u,v){if(u==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!v||(s=Ca(s.nextSibling),s===null))return null;return s}function xC(s,u){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=Ca(s.nextSibling),s===null))return null;return s}function Dy(s){return s.data==="$?"||s.data==="$~"}function My(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function u4(s,u){var v=s.ownerDocument;if(s.data==="$~")s._reactRetry=u;else if(s.data!=="$?"||v.readyState!=="loading")u();else{var g=function(){u(),v.removeEventListener("DOMContentLoaded",g)};v.addEventListener("DOMContentLoaded",g),s._reactRetry=g}}function Ca(s){for(;s!=null;s=s.nextSibling){var u=s.nodeType;if(u===1||u===3)break;if(u===8){if(u=s.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return s}var _y=null;function bC(s){s=s.nextSibling;for(var u=0;s;){if(s.nodeType===8){var v=s.data;if(v==="/$"||v==="/&"){if(u===0)return Ca(s.nextSibling);u--}else v!=="$"&&v!=="$!"&&v!=="$?"&&v!=="$~"&&v!=="&"||u++}s=s.nextSibling}return null}function wC(s){s=s.previousSibling;for(var u=0;s;){if(s.nodeType===8){var v=s.data;if(v==="$"||v==="$!"||v==="$?"||v==="$~"||v==="&"){if(u===0)return s;u--}else v!=="/$"&&v!=="/&"||u++}s=s.previousSibling}return null}function SC(s,u,v){switch(u=ev(v),s){case"html":if(s=u.documentElement,!s)throw Error(r(452));return s;case"head":if(s=u.head,!s)throw Error(r(453));return s;case"body":if(s=u.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function xf(s){for(var u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Io(s)}var Na=new Map,EC=new Set;function tv(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var $i=V.d;V.d={f:c4,r:f4,D:d4,C:h4,L:v4,m:p4,X:g4,S:m4,M:y4};function c4(){var s=$i.f(),u=$h();return s||u}function f4(s){var u=bs(s);u!==null&&u.tag===5&&u.type==="form"?FE(u):$i.r(s)}var mu=typeof document>"u"?null:document;function CC(s,u,v){var g=mu;if(g&&typeof u=="string"&&u){var E=ga(u);E='link[rel="'+s+'"][href="'+E+'"]',typeof v=="string"&&(E+='[crossorigin="'+v+'"]'),EC.has(E)||(EC.add(E),s={rel:s,crossOrigin:v,href:u},g.querySelector(E)===null&&(u=g.createElement("link"),cr(u,"link",s),An(u),g.head.appendChild(u)))}}function d4(s){$i.D(s),CC("dns-prefetch",s,null)}function h4(s,u){$i.C(s,u),CC("preconnect",s,u)}function v4(s,u,v){$i.L(s,u,v);var g=mu;if(g&&s&&u){var E='link[rel="preload"][as="'+ga(u)+'"]';u==="image"&&v&&v.imageSrcSet?(E+='[imagesrcset="'+ga(v.imageSrcSet)+'"]',typeof v.imageSizes=="string"&&(E+='[imagesizes="'+ga(v.imageSizes)+'"]')):E+='[href="'+ga(s)+'"]';var k=E;switch(u){case"style":k=gu(s);break;case"script":k=yu(s)}Na.has(k)||(s=p({rel:"preload",href:u==="image"&&v&&v.imageSrcSet?void 0:s,as:u},v),Na.set(k,s),g.querySelector(E)!==null||u==="style"&&g.querySelector(bf(k))||u==="script"&&g.querySelector(wf(k))||(u=g.createElement("link"),cr(u,"link",s),An(u),g.head.appendChild(u)))}}function p4(s,u){$i.m(s,u);var v=mu;if(v&&s){var g=u&&typeof u.as=="string"?u.as:"script",E='link[rel="modulepreload"][as="'+ga(g)+'"][href="'+ga(s)+'"]',k=E;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=yu(s)}if(!Na.has(k)&&(s=p({rel:"modulepreload",href:s},u),Na.set(k,s),v.querySelector(E)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(v.querySelector(wf(k)))return}g=v.createElement("link"),cr(g,"link",s),An(g),v.head.appendChild(g)}}}function m4(s,u,v){$i.S(s,u,v);var g=mu;if(g&&s){var E=ws(g).hoistableStyles,k=gu(s);u=u||"default";var _=E.get(k);if(!_){var $={loading:0,preload:null};if(_=g.querySelector(bf(k)))$.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":u},v),(v=Na.get(k))&&Oy(s,v);var J=_=g.createElement("link");An(J),cr(J,"link",s),J._p=new Promise(function(de,we){J.onload=de,J.onerror=we}),J.addEventListener("load",function(){$.loading|=1}),J.addEventListener("error",function(){$.loading|=2}),$.loading|=4,nv(_,u,g)}_={type:"stylesheet",instance:_,count:1,state:$},E.set(k,_)}}}function g4(s,u){$i.X(s,u);var v=mu;if(v&&s){var g=ws(v).hoistableScripts,E=yu(s),k=g.get(E);k||(k=v.querySelector(wf(E)),k||(s=p({src:s,async:!0},u),(u=Na.get(E))&&Ly(s,u),k=v.createElement("script"),An(k),cr(k,"link",s),v.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(E,k))}}function y4(s,u){$i.M(s,u);var v=mu;if(v&&s){var g=ws(v).hoistableScripts,E=yu(s),k=g.get(E);k||(k=v.querySelector(wf(E)),k||(s=p({src:s,async:!0,type:"module"},u),(u=Na.get(E))&&Ly(s,u),k=v.createElement("script"),An(k),cr(k,"link",s),v.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(E,k))}}function NC(s,u,v,g){var E=(E=ae.current)?tv(E):null;if(!E)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof v.precedence=="string"&&typeof v.href=="string"?(u=gu(v.href),v=ws(E).hoistableStyles,g=v.get(u),g||(g={type:"style",instance:null,count:0,state:null},v.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(v.rel==="stylesheet"&&typeof v.href=="string"&&typeof v.precedence=="string"){s=gu(v.href);var k=ws(E).hoistableStyles,_=k.get(s);if(_||(E=E.ownerDocument||E,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(s,_),(k=E.querySelector(bf(s)))&&!k._p&&(_.instance=k,_.state.loading=5),Na.has(s)||(v={rel:"preload",as:"style",href:v.href,crossOrigin:v.crossOrigin,integrity:v.integrity,media:v.media,hrefLang:v.hrefLang,referrerPolicy:v.referrerPolicy},Na.set(s,v),k||x4(E,s,v,_.state))),u&&g===null)throw Error(r(528,""));return _}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=v.async,v=v.src,typeof v=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=yu(v),v=ws(E).hoistableScripts,g=v.get(u),g||(g={type:"script",instance:null,count:0,state:null},v.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function gu(s){return'href="'+ga(s)+'"'}function bf(s){return'link[rel="stylesheet"]['+s+"]"}function kC(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function x4(s,u,v,g){s.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=s.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),cr(u,"link",v),An(u),s.head.appendChild(u))}function yu(s){return'[src="'+ga(s)+'"]'}function wf(s){return"script[async]"+s}function TC(s,u,v){if(u.count++,u.instance===null)switch(u.type){case"style":var g=s.querySelector('style[data-href~="'+ga(v.href)+'"]');if(g)return u.instance=g,An(g),g;var E=p({},v,{"data-href":v.href,"data-precedence":v.precedence,href:null,precedence:null});return g=(s.ownerDocument||s).createElement("style"),An(g),cr(g,"style",E),nv(g,v.precedence,s),u.instance=g;case"stylesheet":E=gu(v.href);var k=s.querySelector(bf(E));if(k)return u.state.loading|=4,u.instance=k,An(k),k;g=kC(v),(E=Na.get(E))&&Oy(g,E),k=(s.ownerDocument||s).createElement("link"),An(k);var _=k;return _._p=new Promise(function($,J){_.onload=$,_.onerror=J}),cr(k,"link",g),u.state.loading|=4,nv(k,v.precedence,s),u.instance=k;case"script":return k=yu(v.src),(E=s.querySelector(wf(k)))?(u.instance=E,An(E),E):(g=v,(E=Na.get(k))&&(g=p({},v),Ly(g,E)),s=s.ownerDocument||s,E=s.createElement("script"),An(E),cr(E,"link",g),s.head.appendChild(E),u.instance=E);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,nv(g,v.precedence,s));return u.instance}function nv(s,u,v){for(var g=v.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=g.length?g[g.length-1]:null,k=E,_=0;_<g.length;_++){var $=g[_];if($.dataset.precedence===u)k=$;else if(k!==E)break}k?k.parentNode.insertBefore(s,k.nextSibling):(u=v.nodeType===9?v.head:v,u.insertBefore(s,u.firstChild))}function Oy(s,u){s.crossOrigin==null&&(s.crossOrigin=u.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=u.referrerPolicy),s.title==null&&(s.title=u.title)}function Ly(s,u){s.crossOrigin==null&&(s.crossOrigin=u.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=u.referrerPolicy),s.integrity==null&&(s.integrity=u.integrity)}var rv=null;function jC(s,u,v){if(rv===null){var g=new Map,E=rv=new Map;E.set(v,g)}else E=rv,g=E.get(v),g||(g=new Map,E.set(v,g));if(g.has(s))return g;for(g.set(s,null),v=v.getElementsByTagName(s),E=0;E<v.length;E++){var k=v[E];if(!(k[Zn]||k[un]||s==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var _=k.getAttribute(u)||"";_=s+_;var $=g.get(_);$?$.push(k):g.set(_,[k])}}return g}function AC(s,u,v){s=s.ownerDocument||s,s.head.insertBefore(v,u==="title"?s.querySelector("head > title"):null)}function b4(s,u,v){if(v===1||u.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return s=u.disabled,typeof u.precedence=="string"&&s==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function RC(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function w4(s,u,v,g){if(v.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(v.state.loading&4)===0){if(v.instance===null){var E=gu(g.href),k=u.querySelector(bf(E));if(k){u=k._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(s.count++,s=av.bind(s),u.then(s,s)),v.state.loading|=4,v.instance=k,An(k);return}k=u.ownerDocument||u,g=kC(g),(E=Na.get(E))&&Oy(g,E),k=k.createElement("link"),An(k);var _=k;_._p=new Promise(function($,J){_.onload=$,_.onerror=J}),cr(k,"link",g),v.instance=k}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(v,u),(u=v.state.preload)&&(v.state.loading&3)===0&&(s.count++,v=av.bind(s),u.addEventListener("load",v),u.addEventListener("error",v))}}var Py=0;function S4(s,u){return s.stylesheets&&s.count===0&&sv(s,s.stylesheets),0<s.count||0<s.imgCount?function(v){var g=setTimeout(function(){if(s.stylesheets&&sv(s,s.stylesheets),s.unsuspend){var k=s.unsuspend;s.unsuspend=null,k()}},6e4+u);0<s.imgBytes&&Py===0&&(Py=62500*n4());var E=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&sv(s,s.stylesheets),s.unsuspend)){var k=s.unsuspend;s.unsuspend=null,k()}},(s.imgBytes>Py?50:800)+u);return s.unsuspend=v,function(){s.unsuspend=null,clearTimeout(g),clearTimeout(E)}}:null}function av(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sv(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var iv=null;function sv(s,u){s.stylesheets=null,s.unsuspend!==null&&(s.count++,iv=new Map,u.forEach(E4,s),iv=null,av.call(s))}function E4(s,u){if(!(u.state.loading&4)){var v=iv.get(s);if(v)var g=v.get(null);else{v=new Map,iv.set(s,v);for(var E=s.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<E.length;k++){var _=E[k];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(v.set(_.dataset.precedence,_),g=_)}g&&v.set(null,g)}E=u.instance,_=E.getAttribute("data-precedence"),k=v.get(_)||g,k===g&&v.set(null,E),v.set(_,E),this.count++,g=av.bind(this),E.addEventListener("load",g),E.addEventListener("error",g),k?k.parentNode.insertBefore(E,k.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(E,s.firstChild)),u.state.loading|=4}}var Sf={$$typeof:C,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function C4(s,u,v,g,E,k,_,$,J){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=hn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hn(0),this.hiddenUpdates=hn(null),this.identifierPrefix=g,this.onUncaughtError=E,this.onCaughtError=k,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function DC(s,u,v,g,E,k,_,$,J,de,we,Ee){return s=new C4(s,u,v,_,J,de,we,Ee,$),u=1,k===!0&&(u|=24),k=ta(3,null,null,u),s.current=k,k.stateNode=s,u=pg(),u.refCount++,s.pooledCache=u,u.refCount++,k.memoizedState={element:g,isDehydrated:v,cache:u},xg(k),s}function MC(s){return s?(s=Xo,s):Xo}function _C(s,u,v,g,E,k){E=MC(E),g.context===null?g.context=E:g.pendingContext=E,g=As(u),g.payload={element:v},k=k===void 0?null:k,k!==null&&(g.callback=k),v=Rs(s,g,u),v!==null&&(Vr(v,s,u),Jc(v,s,u))}function OC(s,u){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var v=s.retryLane;s.retryLane=v!==0&&v<u?v:u}}function By(s,u){OC(s,u),(s=s.alternate)&&OC(s,u)}function LC(s){if(s.tag===13||s.tag===31){var u=Ul(s,67108864);u!==null&&Vr(u,s,67108864),By(s,67108864)}}function PC(s){if(s.tag===13||s.tag===31){var u=sa();u=Nn(u);var v=Ul(s,u);v!==null&&Vr(v,s,u),By(s,u)}}var lv=!0;function N4(s,u,v,g){var E=F.T;F.T=null;var k=V.p;try{V.p=2,zy(s,u,v,g)}finally{V.p=k,F.T=E}}function k4(s,u,v,g){var E=F.T;F.T=null;var k=V.p;try{V.p=8,zy(s,u,v,g)}finally{V.p=k,F.T=E}}function zy(s,u,v,g){if(lv){var E=Iy(g);if(E===null)Cy(s,u,g,ov,v),zC(s,g);else if(j4(E,s,u,v,g))g.stopPropagation();else if(zC(s,g),u&4&&-1<T4.indexOf(s)){for(;E!==null;){var k=bs(E);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var _=ut(k.pendingLanes);if(_!==0){var $=k;for($.pendingLanes|=2,$.entangledLanes|=2;_;){var J=1<<31-he(_);$.entanglements[1]|=J,_&=~J}ai(k),(Pt&6)===0&&(Hh=ze()+500,mf(0))}}break;case 31:case 13:$=Ul(k,2),$!==null&&Vr($,k,2),$h(),By(k,2)}if(k=Iy(g),k===null&&Cy(s,u,g,ov,v),k===E)break;E=k}E!==null&&g.stopPropagation()}else Cy(s,u,g,null,v)}}function Iy(s){return s=Um(s),Fy(s)}var ov=null;function Fy(s){if(ov=null,s=xs(s),s!==null){var u=i(s);if(u===null)s=null;else{var v=u.tag;if(v===13){if(s=l(u),s!==null)return s;s=null}else if(v===31){if(s=o(u),s!==null)return s;s=null}else if(v===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;s=null}else u!==s&&(s=null)}}return ov=s,null}function BC(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dt()){case ve:return 2;case Ce:return 8;case Me:case Ie:return 32;case _e:return 268435456;default:return 32}default:return 32}}var Uy=!1,Us=null,qs=null,Vs=null,Ef=new Map,Cf=new Map,Hs=[],T4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function zC(s,u){switch(s){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":qs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Ef.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cf.delete(u.pointerId)}}function Nf(s,u,v,g,E,k){return s===null||s.nativeEvent!==k?(s={blockedOn:u,domEventName:v,eventSystemFlags:g,nativeEvent:k,targetContainers:[E]},u!==null&&(u=bs(u),u!==null&&LC(u)),s):(s.eventSystemFlags|=g,u=s.targetContainers,E!==null&&u.indexOf(E)===-1&&u.push(E),s)}function j4(s,u,v,g,E){switch(u){case"focusin":return Us=Nf(Us,s,u,v,g,E),!0;case"dragenter":return qs=Nf(qs,s,u,v,g,E),!0;case"mouseover":return Vs=Nf(Vs,s,u,v,g,E),!0;case"pointerover":var k=E.pointerId;return Ef.set(k,Nf(Ef.get(k)||null,s,u,v,g,E)),!0;case"gotpointercapture":return k=E.pointerId,Cf.set(k,Nf(Cf.get(k)||null,s,u,v,g,E)),!0}return!1}function IC(s){var u=xs(s.target);if(u!==null){var v=i(u);if(v!==null){if(u=v.tag,u===13){if(u=l(v),u!==null){s.blockedOn=u,pa(s.priority,function(){PC(v)});return}}else if(u===31){if(u=o(v),u!==null){s.blockedOn=u,pa(s.priority,function(){PC(v)});return}}else if(u===3&&v.stateNode.current.memoizedState.isDehydrated){s.blockedOn=v.tag===3?v.stateNode.containerInfo:null;return}}}s.blockedOn=null}function uv(s){if(s.blockedOn!==null)return!1;for(var u=s.targetContainers;0<u.length;){var v=Iy(s.nativeEvent);if(v===null){v=s.nativeEvent;var g=new v.constructor(v.type,v);Fm=g,v.target.dispatchEvent(g),Fm=null}else return u=bs(v),u!==null&&LC(u),s.blockedOn=v,!1;u.shift()}return!0}function FC(s,u,v){uv(s)&&v.delete(u)}function A4(){Uy=!1,Us!==null&&uv(Us)&&(Us=null),qs!==null&&uv(qs)&&(qs=null),Vs!==null&&uv(Vs)&&(Vs=null),Ef.forEach(FC),Cf.forEach(FC)}function cv(s,u){s.blockedOn===u&&(s.blockedOn=null,Uy||(Uy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,A4)))}var fv=null;function UC(s){fv!==s&&(fv=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){fv===s&&(fv=null);for(var u=0;u<s.length;u+=3){var v=s[u],g=s[u+1],E=s[u+2];if(typeof g!="function"){if(Fy(g||v)===null)continue;break}var k=bs(v);k!==null&&(s.splice(u,3),u-=3,Ig(k,{pending:!0,data:E,method:v.method,action:g},g,E))}}))}function xu(s){function u(J){return cv(J,s)}Us!==null&&cv(Us,s),qs!==null&&cv(qs,s),Vs!==null&&cv(Vs,s),Ef.forEach(u),Cf.forEach(u);for(var v=0;v<Hs.length;v++){var g=Hs[v];g.blockedOn===s&&(g.blockedOn=null)}for(;0<Hs.length&&(v=Hs[0],v.blockedOn===null);)IC(v),v.blockedOn===null&&Hs.shift();if(v=(s.ownerDocument||s).$$reactFormReplay,v!=null)for(g=0;g<v.length;g+=3){var E=v[g],k=v[g+1],_=E[In]||null;if(typeof k=="function")_||UC(v);else if(_){var $=null;if(k&&k.hasAttribute("formAction")){if(E=k,_=k[In]||null)$=_.formAction;else if(Fy(E)!==null)continue}else $=_.action;typeof $=="function"?v[g+1]=$:(v.splice(g,3),g-=3),UC(v)}}}function qC(){function s(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(_){return E=_})},focusReset:"manual",scroll:"manual"})}function u(){E!==null&&(E(),E=null),g||setTimeout(v,20)}function v(){if(!g&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,E=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(v,100),function(){g=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),E!==null&&(E(),E=null)}}}function qy(s){this._internalRoot=s}dv.prototype.render=qy.prototype.render=function(s){var u=this._internalRoot;if(u===null)throw Error(r(409));var v=u.current,g=sa();_C(v,g,s,u,null,null)},dv.prototype.unmount=qy.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var u=s.containerInfo;_C(s.current,2,null,s,null,null),$h(),u[Pr]=null}};function dv(s){this._internalRoot=s}dv.prototype.unstable_scheduleHydration=function(s){if(s){var u=pn();s={blockedOn:null,target:s,priority:u};for(var v=0;v<Hs.length&&u!==0&&u<Hs[v].priority;v++);Hs.splice(v,0,s),v===0&&IC(s)}};var VC=t.version;if(VC!=="19.2.4")throw Error(r(527,VC,"19.2.4"));V.findDOMNode=function(s){var u=s._reactInternals;if(u===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=c(u),s=s!==null?h(s):null,s=s===null?null:s.stateNode,s};var R4={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hv=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hv.isDisabled&&hv.supportsFiber)try{K=hv.inject(R4),ce=hv}catch{}}return Tf.createRoot=function(s,u){if(!a(s))throw Error(r(299));var v=!1,g="",E=QE,k=WE,_=ZE;return u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(E=u.onUncaughtError),u.onCaughtError!==void 0&&(k=u.onCaughtError),u.onRecoverableError!==void 0&&(_=u.onRecoverableError)),u=DC(s,1,!1,null,null,v,g,null,E,k,_,qC),s[Pr]=u.current,Ey(s),new qy(u)},Tf.hydrateRoot=function(s,u,v){if(!a(s))throw Error(r(299));var g=!1,E="",k=QE,_=WE,$=ZE,J=null;return v!=null&&(v.unstable_strictMode===!0&&(g=!0),v.identifierPrefix!==void 0&&(E=v.identifierPrefix),v.onUncaughtError!==void 0&&(k=v.onUncaughtError),v.onCaughtError!==void 0&&(_=v.onCaughtError),v.onRecoverableError!==void 0&&($=v.onRecoverableError),v.formState!==void 0&&(J=v.formState)),u=DC(s,1,!0,u,v??null,g,E,J,k,_,$,qC),u.context=MC(null),v=u.current,g=sa(),g=Nn(g),E=As(g),E.callback=null,Rs(v,E,g),v=g,u.current.lanes=v,Vt(u,v),ai(u),s[Pr]=u.current,Ey(s),new dv(u)},Tf.version="19.2.4",Tf}var eN;function F4(){if(eN)return $y.exports;eN=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),$y.exports=I4(),$y.exports}var U4=F4();const q4=kd(U4);var hc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fo,rl,Xu,iR,V4=(iR=class extends hc{constructor(){super();et(this,fo);et(this,rl);et(this,Xu);Pe(this,Xu,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ee(this,rl)||this.setEventListener(ee(this,Xu))}onUnsubscribe(){var t;this.hasListeners()||((t=ee(this,rl))==null||t.call(this),Pe(this,rl,void 0))}setEventListener(t){var n;Pe(this,Xu,t),(n=ee(this,rl))==null||n.call(this),Pe(this,rl,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){ee(this,fo)!==t&&(Pe(this,fo,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof ee(this,fo)=="boolean"?ee(this,fo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fo=new WeakMap,rl=new WeakMap,Xu=new WeakMap,iR),S1=new V4,H4={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},al,b1,sR,G4=(sR=class{constructor(){et(this,al,H4);et(this,b1,!1)}setTimeoutProvider(e){Pe(this,al,e)}setTimeout(e,t){return ee(this,al).setTimeout(e,t)}clearTimeout(e){ee(this,al).clearTimeout(e)}setInterval(e,t){return ee(this,al).setInterval(e,t)}clearInterval(e){ee(this,al).clearInterval(e)}},al=new WeakMap,b1=new WeakMap,sR),oo=new G4;function $4(e){setTimeout(e,0)}var K4=typeof window>"u"||"Deno"in globalThis;function Rr(){}function Y4(e,t){return typeof e=="function"?e(t):e}function cb(e){return typeof e=="number"&&e>=0&&e!==1/0}function yR(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pl(e,t){return typeof e=="function"?e(t):e}function Aa(e,t){return typeof e=="function"?e(t):e}function tN(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==E1(l,t.options))return!1}else if(!ad(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function nN(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Eo(t.options.mutationKey)!==Eo(i))return!1}else if(!ad(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function E1(e,t){return((t==null?void 0:t.queryKeyHashFn)||Eo)(e)}function Eo(e){return JSON.stringify(e,(t,n)=>fb(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function ad(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ad(e[n],t[n])):!1}var X4=Object.prototype.hasOwnProperty;function xR(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=rN(e)&&rN(t);if(!r&&!(fb(e)&&fb(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,f=r?new Array(o):{};let c=0;for(let h=0;h<o;h++){const p=r?h:l[h],m=e[p],y=t[p];if(m===y){f[p]=m,(r?h<i:X4.call(e,p))&&c++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){f[p]=y;continue}const x=xR(m,y,n+1);f[p]=x,x===m&&c++}return i===o&&c===i?e:f}function op(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function rN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fb(e){if(!aN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!aN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function aN(e){return Object.prototype.toString.call(e)==="[object Object]"}function Q4(e){return new Promise(t=>{oo.setTimeout(t,e)})}function db(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?xR(e,t):t}function W4(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Z4(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var C1=Symbol();function bR(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===C1?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function N1(e,t){return typeof e=="function"?e(...t):!!e}function J4(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var id=(()=>{let e=()=>K4;return{isServer(){return e()},setIsServer(t){e=t}}})();function hb(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var eP=$4;function tP(){let e=[],t=0,n=o=>{o()},r=o=>{o()},a=eP;const i=o=>{t?e.push(o):a(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&a(()=>{r(()=>{o.forEach(f=>{n(f)})})})};return{batch:o=>{let f;t++;try{f=o()}finally{t--,t||l()}return f},batchCalls:o=>(...f)=>{i(()=>{o(...f)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{a=o}}}var Vn=tP(),Qu,il,Wu,lR,nP=(lR=class extends hc{constructor(){super();et(this,Qu,!0);et(this,il);et(this,Wu);Pe(this,Wu,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ee(this,il)||this.setEventListener(ee(this,Wu))}onUnsubscribe(){var t;this.hasListeners()||((t=ee(this,il))==null||t.call(this),Pe(this,il,void 0))}setEventListener(t){var n;Pe(this,Wu,t),(n=ee(this,il))==null||n.call(this),Pe(this,il,t(this.setOnline.bind(this)))}setOnline(t){ee(this,Qu)!==t&&(Pe(this,Qu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return ee(this,Qu)}},Qu=new WeakMap,il=new WeakMap,Wu=new WeakMap,lR),up=new nP;function rP(e){return Math.min(1e3*2**e,3e4)}function wR(e){return(e??"online")==="online"?up.isOnline():!0}var vb=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function SR(e){let t=!1,n=0,r;const a=hb(),i=()=>a.status!=="pending",l=b=>{var w;if(!i()){const S=new vb(b);m(S),(w=e.onCancel)==null||w.call(e,S)}},o=()=>{t=!0},f=()=>{t=!1},c=()=>S1.isFocused()&&(e.networkMode==="always"||up.isOnline())&&e.canRun(),h=()=>wR(e.networkMode)&&e.canRun(),p=b=>{i()||(r==null||r(),a.resolve(b))},m=b=>{i()||(r==null||r(),a.reject(b))},y=()=>new Promise(b=>{var w;r=S=>{(i()||c())&&b(S)},(w=e.onPause)==null||w.call(e)}).then(()=>{var b;r=void 0,i()||(b=e.onContinue)==null||b.call(e)}),x=()=>{if(i())return;let b;const w=n===0?e.initialPromise:void 0;try{b=w??e.fn()}catch(S){b=Promise.reject(S)}Promise.resolve(b).then(p).catch(S=>{var A;if(i())return;const N=e.retry??(id.isServer()?0:3),C=e.retryDelay??rP,T=typeof C=="function"?C(n,S):C,R=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,S);if(t||!R){m(S);return}n++,(A=e.onFail)==null||A.call(e,n,S),Q4(T).then(()=>c()?void 0:y()).then(()=>{t?m(S):x()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:o,continueRetry:f,canStart:h,start:()=>(h()?x():y().then(x),a)}}var ho,oR,ER=(oR=class{constructor(){et(this,ho)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cb(this.gcTime)&&Pe(this,ho,oo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(id.isServer()?1/0:300*1e3))}clearGcTimeout(){ee(this,ho)&&(oo.clearTimeout(ee(this,ho)),Pe(this,ho,void 0))}},ho=new WeakMap,oR),vo,Zu,ja,po,tr,wd,mo,oa,CR,Qi,uR,aP=(uR=class extends ER{constructor(t){super();et(this,oa);et(this,vo);et(this,Zu);et(this,ja);et(this,po);et(this,tr);et(this,wd);et(this,mo);Pe(this,mo,!1),Pe(this,wd,t.defaultOptions),this.setOptions(t.options),this.observers=[],Pe(this,po,t.client),Pe(this,ja,ee(this,po).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Pe(this,vo,sN(this.options)),this.state=t.state??ee(this,vo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ee(this,tr))==null?void 0:t.promise}setOptions(t){if(this.options={...ee(this,wd),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=sN(this.options);n.data!==void 0&&(this.setState(iN(n.data,n.dataUpdatedAt)),Pe(this,vo,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ee(this,ja).remove(this)}setData(t,n){const r=db(this.state.data,t,this.options);return mt(this,oa,Qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){mt(this,oa,Qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=ee(this,tr))==null?void 0:r.promise;return(a=ee(this,tr))==null||a.cancel(t),n?n.then(Rr).catch(Rr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ee(this,vo)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Aa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===C1||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!yR(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=ee(this,tr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=ee(this,tr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ee(this,ja).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(ee(this,tr)&&(ee(this,mo)||mt(this,oa,CR).call(this)?ee(this,tr).cancel({revert:!0}):ee(this,tr).cancelRetry()),this.scheduleGc()),ee(this,ja).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||mt(this,oa,Qi).call(this,{type:"invalidate"})}async fetch(t,n){var f,c,h,p,m,y,x,b,w,S,N,C;if(this.state.fetchStatus!=="idle"&&((f=ee(this,tr))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ee(this,tr))return ee(this,tr).continueRetry(),ee(this,tr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const T=this.observers.find(R=>R.options.queryFn);T&&this.setOptions(T.options)}const r=new AbortController,a=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Pe(this,mo,!0),r.signal)})},i=()=>{const T=bR(this.options,n),A=(()=>{const D={client:ee(this,po),queryKey:this.queryKey,meta:this.meta};return a(D),D})();return Pe(this,mo,!1),this.options.persister?this.options.persister(T,A,this):T(A)},o=(()=>{const T={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ee(this,po),state:this.state,fetchFn:i};return a(T),T})();(c=this.options.behavior)==null||c.onFetch(o,this),Pe(this,Zu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=o.fetchOptions)==null?void 0:h.meta))&&mt(this,oa,Qi).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta}),Pe(this,tr,SR({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:T=>{T instanceof vb&&T.revert&&this.setState({...ee(this,Zu),fetchStatus:"idle"}),r.abort()},onFail:(T,R)=>{mt(this,oa,Qi).call(this,{type:"failed",failureCount:T,error:R})},onPause:()=>{mt(this,oa,Qi).call(this,{type:"pause"})},onContinue:()=>{mt(this,oa,Qi).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const T=await ee(this,tr).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(m=ee(this,ja).config).onSuccess)==null||y.call(m,T,this),(b=(x=ee(this,ja).config).onSettled)==null||b.call(x,T,this.state.error,this),T}catch(T){if(T instanceof vb){if(T.silent)return ee(this,tr).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw mt(this,oa,Qi).call(this,{type:"error",error:T}),(S=(w=ee(this,ja).config).onError)==null||S.call(w,T,this),(C=(N=ee(this,ja).config).onSettled)==null||C.call(N,this.state.data,T,this),T}finally{this.scheduleGc()}}},vo=new WeakMap,Zu=new WeakMap,ja=new WeakMap,po=new WeakMap,tr=new WeakMap,wd=new WeakMap,mo=new WeakMap,oa=new WeakSet,CR=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Qi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...NR(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...iN(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Pe(this,Zu,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Vn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ee(this,ja).notify({query:this,type:"updated",action:t})})},uR);function NR(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function iN(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function sN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Gr,At,Sd,jr,go,Ju,Ji,sl,Ed,ec,tc,yo,xo,ll,nc,It,$f,pb,mb,gb,yb,xb,bb,wb,kR,cR,iP=(cR=class extends hc{constructor(t,n){super();et(this,It);et(this,Gr);et(this,At);et(this,Sd);et(this,jr);et(this,go);et(this,Ju);et(this,Ji);et(this,sl);et(this,Ed);et(this,ec);et(this,tc);et(this,yo);et(this,xo);et(this,ll);et(this,nc,new Set);this.options=n,Pe(this,Gr,t),Pe(this,sl,null),Pe(this,Ji,hb()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ee(this,At).addObserver(this),lN(ee(this,At),this.options)?mt(this,It,$f).call(this):this.updateResult(),mt(this,It,yb).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sb(ee(this,At),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sb(ee(this,At),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,mt(this,It,xb).call(this),mt(this,It,bb).call(this),ee(this,At).removeObserver(this)}setOptions(t){const n=this.options,r=ee(this,At);if(this.options=ee(this,Gr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Aa(this.options.enabled,ee(this,At))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");mt(this,It,wb).call(this),ee(this,At).setOptions(this.options),n._defaulted&&!op(this.options,n)&&ee(this,Gr).getQueryCache().notify({type:"observerOptionsUpdated",query:ee(this,At),observer:this});const a=this.hasListeners();a&&oN(ee(this,At),r,this.options,n)&&mt(this,It,$f).call(this),this.updateResult(),a&&(ee(this,At)!==r||Aa(this.options.enabled,ee(this,At))!==Aa(n.enabled,ee(this,At))||pl(this.options.staleTime,ee(this,At))!==pl(n.staleTime,ee(this,At)))&&mt(this,It,pb).call(this);const i=mt(this,It,mb).call(this);a&&(ee(this,At)!==r||Aa(this.options.enabled,ee(this,At))!==Aa(n.enabled,ee(this,At))||i!==ee(this,ll))&&mt(this,It,gb).call(this,i)}getOptimisticResult(t){const n=ee(this,Gr).getQueryCache().build(ee(this,Gr),t),r=this.createResult(n,t);return lP(this,r)&&(Pe(this,jr,r),Pe(this,Ju,this.options),Pe(this,go,ee(this,At).state)),r}getCurrentResult(){return ee(this,jr)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ee(this,Ji).status==="pending"&&ee(this,Ji).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){ee(this,nc).add(t)}getCurrentQuery(){return ee(this,At)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=ee(this,Gr).defaultQueryOptions(t),r=ee(this,Gr).getQueryCache().build(ee(this,Gr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return mt(this,It,$f).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ee(this,jr)))}createResult(t,n){var L;const r=ee(this,At),a=this.options,i=ee(this,jr),l=ee(this,go),o=ee(this,Ju),c=t!==r?t.state:ee(this,Sd),{state:h}=t;let p={...h},m=!1,y;if(n._optimisticResults){const M=this.hasListeners(),B=!M&&lN(t,n),P=M&&oN(t,r,n,a);(B||P)&&(p={...p,...NR(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:b,status:w}=p;y=p.data;let S=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let M;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(M=i.data,S=!0):M=typeof n.placeholderData=="function"?n.placeholderData((L=ee(this,tc))==null?void 0:L.state.data,ee(this,tc)):n.placeholderData,M!==void 0&&(w="success",y=db(i==null?void 0:i.data,M,n),m=!0)}if(n.select&&y!==void 0&&!S)if(i&&y===(l==null?void 0:l.data)&&n.select===ee(this,Ed))y=ee(this,ec);else try{Pe(this,Ed,n.select),y=n.select(y),y=db(i==null?void 0:i.data,y,n),Pe(this,ec,y),Pe(this,sl,null)}catch(M){Pe(this,sl,M)}ee(this,sl)&&(x=ee(this,sl),y=ee(this,ec),b=Date.now(),w="error");const N=p.fetchStatus==="fetching",C=w==="pending",T=w==="error",R=C&&N,A=y!==void 0,O={status:w,fetchStatus:p.fetchStatus,isPending:C,isSuccess:w==="success",isError:T,isInitialLoading:R,isLoading:R,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>c.dataUpdateCount||p.errorUpdateCount>c.errorUpdateCount,isFetching:N,isRefetching:N&&!C,isLoadingError:T&&!A,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:T&&A,isStale:k1(t,n),refetch:this.refetch,promise:ee(this,Ji),isEnabled:Aa(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=O.data!==void 0,B=O.status==="error"&&!M,P=G=>{B?G.reject(O.error):M&&G.resolve(O.data)},q=()=>{const G=Pe(this,Ji,O.promise=hb());P(G)},H=ee(this,Ji);switch(H.status){case"pending":t.queryHash===r.queryHash&&P(H);break;case"fulfilled":(B||O.data!==H.value)&&q();break;case"rejected":(!B||O.error!==H.reason)&&q();break}}return O}updateResult(){const t=ee(this,jr),n=this.createResult(ee(this,At),this.options);if(Pe(this,go,ee(this,At).state),Pe(this,Ju,this.options),ee(this,go).data!==void 0&&Pe(this,tc,ee(this,At)),op(n,t))return;Pe(this,jr,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!ee(this,nc).size)return!0;const l=new Set(i??ee(this,nc));return this.options.throwOnError&&l.add("error"),Object.keys(ee(this,jr)).some(o=>{const f=o;return ee(this,jr)[f]!==t[f]&&l.has(f)})};mt(this,It,kR).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&mt(this,It,yb).call(this)}},Gr=new WeakMap,At=new WeakMap,Sd=new WeakMap,jr=new WeakMap,go=new WeakMap,Ju=new WeakMap,Ji=new WeakMap,sl=new WeakMap,Ed=new WeakMap,ec=new WeakMap,tc=new WeakMap,yo=new WeakMap,xo=new WeakMap,ll=new WeakMap,nc=new WeakMap,It=new WeakSet,$f=function(t){mt(this,It,wb).call(this);let n=ee(this,At).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Rr)),n},pb=function(){mt(this,It,xb).call(this);const t=pl(this.options.staleTime,ee(this,At));if(id.isServer()||ee(this,jr).isStale||!cb(t))return;const r=yR(ee(this,jr).dataUpdatedAt,t)+1;Pe(this,yo,oo.setTimeout(()=>{ee(this,jr).isStale||this.updateResult()},r))},mb=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ee(this,At)):this.options.refetchInterval)??!1},gb=function(t){mt(this,It,bb).call(this),Pe(this,ll,t),!(id.isServer()||Aa(this.options.enabled,ee(this,At))===!1||!cb(ee(this,ll))||ee(this,ll)===0)&&Pe(this,xo,oo.setInterval(()=>{(this.options.refetchIntervalInBackground||S1.isFocused())&&mt(this,It,$f).call(this)},ee(this,ll)))},yb=function(){mt(this,It,pb).call(this),mt(this,It,gb).call(this,mt(this,It,mb).call(this))},xb=function(){ee(this,yo)&&(oo.clearTimeout(ee(this,yo)),Pe(this,yo,void 0))},bb=function(){ee(this,xo)&&(oo.clearInterval(ee(this,xo)),Pe(this,xo,void 0))},wb=function(){const t=ee(this,Gr).getQueryCache().build(ee(this,Gr),this.options);if(t===ee(this,At))return;const n=ee(this,At);Pe(this,At,t),Pe(this,Sd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},kR=function(t){Vn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(ee(this,jr))}),ee(this,Gr).getQueryCache().notify({query:ee(this,At),type:"observerResultsUpdated"})})},cR);function sP(e,t){return Aa(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function lN(e,t){return sP(e,t)||e.state.data!==void 0&&Sb(e,t,t.refetchOnMount)}function Sb(e,t,n){if(Aa(t.enabled,e)!==!1&&pl(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&k1(e,t)}return!1}function oN(e,t,n,r){return(e!==t||Aa(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&k1(e,n)}function k1(e,t){return Aa(t.enabled,e)!==!1&&e.isStaleByTime(pl(t.staleTime,e))}function lP(e,t){return!op(e.getCurrentResult(),t)}function uN(e){return{onFetch:(t,n)=>{var h,p,m,y,x;const r=t.options,a=(m=(p=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,i=((y=t.state.data)==null?void 0:y.pages)||[],l=((x=t.state.data)==null?void 0:x.pageParams)||[];let o={pages:[],pageParams:[]},f=0;const c=async()=>{let b=!1;const w=C=>{J4(C,()=>t.signal,()=>b=!0)},S=bR(t.options,t.fetchOptions),N=async(C,T,R)=>{if(b)return Promise.reject();if(T==null&&C.pages.length)return Promise.resolve(C);const D=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:T,direction:R?"backward":"forward",meta:t.options.meta};return w(B),B})(),O=await S(D),{maxPages:L}=t.options,M=R?Z4:W4;return{pages:M(C.pages,O,L),pageParams:M(C.pageParams,T,L)}};if(a&&i.length){const C=a==="backward",T=C?oP:cN,R={pages:i,pageParams:l},A=T(r,R);o=await N(R,A,C)}else{const C=e??i.length;do{const T=f===0?l[0]??r.initialPageParam:cN(r,o);if(f>0&&T==null)break;o=await N(o,T),f++}while(f<C)}return o};t.options.persister?t.fetchFn=()=>{var b,w;return(w=(b=t.options).persister)==null?void 0:w.call(b,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function cN(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function oP(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Cd,ui,yr,bo,ci,Js,fR,uP=(fR=class extends ER{constructor(t){super();et(this,ci);et(this,Cd);et(this,ui);et(this,yr);et(this,bo);Pe(this,Cd,t.client),this.mutationId=t.mutationId,Pe(this,yr,t.mutationCache),Pe(this,ui,[]),this.state=t.state||TR(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ee(this,ui).includes(t)||(ee(this,ui).push(t),this.clearGcTimeout(),ee(this,yr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Pe(this,ui,ee(this,ui).filter(n=>n!==t)),this.scheduleGc(),ee(this,yr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ee(this,ui).length||(this.state.status==="pending"?this.scheduleGc():ee(this,yr).remove(this))}continue(){var t;return((t=ee(this,bo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,f,c,h,p,m,y,x,b,w,S,N,C,T,R,A,D;const n=()=>{mt(this,ci,Js).call(this,{type:"continue"})},r={client:ee(this,Cd),meta:this.options.meta,mutationKey:this.options.mutationKey};Pe(this,bo,SR({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,L)=>{mt(this,ci,Js).call(this,{type:"failed",failureCount:O,error:L})},onPause:()=>{mt(this,ci,Js).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ee(this,yr).canRun(this)}));const a=this.state.status==="pending",i=!ee(this,bo).canStart();try{if(a)n();else{mt(this,ci,Js).call(this,{type:"pending",variables:t,isPaused:i}),ee(this,yr).config.onMutate&&await ee(this,yr).config.onMutate(t,this,r);const L=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));L!==this.state.context&&mt(this,ci,Js).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const O=await ee(this,bo).start();return await((c=(f=ee(this,yr).config).onSuccess)==null?void 0:c.call(f,O,t,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,O,t,this.state.context,r)),await((y=(m=ee(this,yr).config).onSettled)==null?void 0:y.call(m,O,null,this.state.variables,this.state.context,this,r)),await((b=(x=this.options).onSettled)==null?void 0:b.call(x,O,null,t,this.state.context,r)),mt(this,ci,Js).call(this,{type:"success",data:O}),O}catch(O){try{await((S=(w=ee(this,yr).config).onError)==null?void 0:S.call(w,O,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((C=(N=this.options).onError)==null?void 0:C.call(N,O,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((R=(T=ee(this,yr).config).onSettled)==null?void 0:R.call(T,void 0,O,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((D=(A=this.options).onSettled)==null?void 0:D.call(A,void 0,O,t,this.state.context,r))}catch(L){Promise.reject(L)}throw mt(this,ci,Js).call(this,{type:"error",error:O}),O}finally{ee(this,yr).runNext(this)}}},Cd=new WeakMap,ui=new WeakMap,yr=new WeakMap,bo=new WeakMap,ci=new WeakSet,Js=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Vn.batch(()=>{ee(this,ui).forEach(r=>{r.onMutationUpdate(t)}),ee(this,yr).notify({mutation:this,type:"updated",action:t})})},fR);function TR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var es,qa,Nd,dR,cP=(dR=class extends hc{constructor(t={}){super();et(this,es);et(this,qa);et(this,Nd);this.config=t,Pe(this,es,new Set),Pe(this,qa,new Map),Pe(this,Nd,0)}build(t,n,r){const a=new uP({client:t,mutationCache:this,mutationId:++vv(this,Nd)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){ee(this,es).add(t);const n=pv(t);if(typeof n=="string"){const r=ee(this,qa).get(n);r?r.push(t):ee(this,qa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ee(this,es).delete(t)){const n=pv(t);if(typeof n=="string"){const r=ee(this,qa).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&ee(this,qa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=pv(t);if(typeof n=="string"){const r=ee(this,qa).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=pv(t);if(typeof n=="string"){const a=(r=ee(this,qa).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Vn.batch(()=>{ee(this,es).forEach(t=>{this.notify({type:"removed",mutation:t})}),ee(this,es).clear(),ee(this,qa).clear()})}getAll(){return Array.from(ee(this,es))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nN(n,r))}findAll(t={}){return this.getAll().filter(n=>nN(t,n))}notify(t){Vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Vn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Rr))))}},es=new WeakMap,qa=new WeakMap,Nd=new WeakMap,dR);function pv(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ts,ol,$r,ns,as,Hv,Eb,hR,fP=(hR=class extends hc{constructor(n,r){super();et(this,as);et(this,ts);et(this,ol);et(this,$r);et(this,ns);Pe(this,ts,n),this.setOptions(r),this.bindMethods(),mt(this,as,Hv).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=ee(this,ts).defaultMutationOptions(n),op(this.options,r)||ee(this,ts).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ee(this,$r),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Eo(r.mutationKey)!==Eo(this.options.mutationKey)?this.reset():((a=ee(this,$r))==null?void 0:a.state.status)==="pending"&&ee(this,$r).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=ee(this,$r))==null||n.removeObserver(this)}onMutationUpdate(n){mt(this,as,Hv).call(this),mt(this,as,Eb).call(this,n)}getCurrentResult(){return ee(this,ol)}reset(){var n;(n=ee(this,$r))==null||n.removeObserver(this),Pe(this,$r,void 0),mt(this,as,Hv).call(this),mt(this,as,Eb).call(this)}mutate(n,r){var a;return Pe(this,ns,r),(a=ee(this,$r))==null||a.removeObserver(this),Pe(this,$r,ee(this,ts).getMutationCache().build(ee(this,ts),this.options)),ee(this,$r).addObserver(this),ee(this,$r).execute(n)}},ts=new WeakMap,ol=new WeakMap,$r=new WeakMap,ns=new WeakMap,as=new WeakSet,Hv=function(){var r;const n=((r=ee(this,$r))==null?void 0:r.state)??TR();Pe(this,ol,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Eb=function(n){Vn.batch(()=>{var r,a,i,l,o,f,c,h;if(ee(this,ns)&&this.hasListeners()){const p=ee(this,ol).variables,m=ee(this,ol).context,y={client:ee(this,ts),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(a=(r=ee(this,ns)).onSuccess)==null||a.call(r,n.data,p,m,y)}catch(x){Promise.reject(x)}try{(l=(i=ee(this,ns)).onSettled)==null||l.call(i,n.data,null,p,m,y)}catch(x){Promise.reject(x)}}else if((n==null?void 0:n.type)==="error"){try{(f=(o=ee(this,ns)).onError)==null||f.call(o,n.error,p,m,y)}catch(x){Promise.reject(x)}try{(h=(c=ee(this,ns)).onSettled)==null||h.call(c,void 0,n.error,p,m,y)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(ee(this,ol))})})},hR),fi,vR,dP=(vR=class extends hc{constructor(t={}){super();et(this,fi);this.config=t,Pe(this,fi,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??E1(a,n);let l=this.get(i);return l||(l=new aP({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){ee(this,fi).has(t.queryHash)||(ee(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=ee(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&ee(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Vn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ee(this,fi).get(t)}getAll(){return[...ee(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>tN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>tN(t,r)):n}notify(t){Vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Vn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Vn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,vR),wn,ul,cl,rc,ac,fl,ic,sc,pR,hP=(pR=class{constructor(e={}){et(this,wn);et(this,ul);et(this,cl);et(this,rc);et(this,ac);et(this,fl);et(this,ic);et(this,sc);Pe(this,wn,e.queryCache||new dP),Pe(this,ul,e.mutationCache||new cP),Pe(this,cl,e.defaultOptions||{}),Pe(this,rc,new Map),Pe(this,ac,new Map),Pe(this,fl,0)}mount(){vv(this,fl)._++,ee(this,fl)===1&&(Pe(this,ic,S1.subscribe(async e=>{e&&(await this.resumePausedMutations(),ee(this,wn).onFocus())})),Pe(this,sc,up.subscribe(async e=>{e&&(await this.resumePausedMutations(),ee(this,wn).onOnline())})))}unmount(){var e,t;vv(this,fl)._--,ee(this,fl)===0&&((e=ee(this,ic))==null||e.call(this),Pe(this,ic,void 0),(t=ee(this,sc))==null||t.call(this),Pe(this,sc,void 0))}isFetching(e){return ee(this,wn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ee(this,ul).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ee(this,wn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=ee(this,wn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pl(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return ee(this,wn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=ee(this,wn).get(r.queryHash),i=a==null?void 0:a.state.data,l=Y4(t,i);if(l!==void 0)return ee(this,wn).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return Vn.batch(()=>ee(this,wn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ee(this,wn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=ee(this,wn);Vn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=ee(this,wn);return Vn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Vn.batch(()=>ee(this,wn).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(Rr).catch(Rr)}invalidateQueries(e,t={}){return Vn.batch(()=>(ee(this,wn).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Vn.batch(()=>ee(this,wn).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(Rr)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Rr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=ee(this,wn).build(this,t);return n.isStaleByTime(pl(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rr).catch(Rr)}fetchInfiniteQuery(e){return e.behavior=uN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rr).catch(Rr)}ensureInfiniteQueryData(e){return e.behavior=uN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return up.isOnline()?ee(this,ul).resumePausedMutations():Promise.resolve()}getQueryCache(){return ee(this,wn)}getMutationCache(){return ee(this,ul)}getDefaultOptions(){return ee(this,cl)}setDefaultOptions(e){Pe(this,cl,e)}setQueryDefaults(e,t){ee(this,rc).set(Eo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ee(this,rc).values()],n={};return t.forEach(r=>{ad(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){ee(this,ac).set(Eo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ee(this,ac).values()],n={};return t.forEach(r=>{ad(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ee(this,cl).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=E1(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===C1&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ee(this,cl).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ee(this,wn).clear(),ee(this,ul).clear()}},wn=new WeakMap,ul=new WeakMap,cl=new WeakMap,rc=new WeakMap,ac=new WeakMap,fl=new WeakMap,ic=new WeakMap,sc=new WeakMap,pR),jR=j.createContext(void 0),Sn=e=>{const t=j.useContext(jR);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},vP=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.jsx(jR.Provider,{value:e,children:t})),AR=j.createContext(!1),pP=()=>j.useContext(AR);AR.Provider;function mP(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var gP=j.createContext(mP()),yP=()=>j.useContext(gP),xP=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?N1(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},bP=e=>{j.useEffect(()=>{e.clearReset()},[e])},wP=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||N1(n,[e.error,r])),SP=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},EP=(e,t)=>e.isLoading&&e.isFetching&&!t,CP=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function NP(e,t,n){var m,y,x,b;const r=pP(),a=yP(),i=Sn(),l=i.defaultQueryOptions(e);(y=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",SP(l),xP(l,a,o),bP(a);const f=!i.getQueryCache().get(l.queryHash),[c]=j.useState(()=>new t(i,l)),h=c.getOptimisticResult(l),p=!r&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(w=>{const S=p?c.subscribe(Vn.batchCalls(w)):Rr;return c.updateResult(),S},[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),j.useEffect(()=>{c.setOptions(l)},[l,c]),CP(l,h))throw fN(l,c,a);if(wP({result:h,errorResetBoundary:a,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw h.error;if((b=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||b.call(x,l,h),l.experimental_prefetchInRender&&!id.isServer()&&EP(h,r)){const w=f?fN(l,c,a):o==null?void 0:o.promise;w==null||w.catch(Rr).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?h:c.trackResult(h)}function qt(e,t){return NP(e,iP)}function Er(e,t){const n=Sn(),[r]=j.useState(()=>new fP(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);const a=j.useSyncExternalStore(j.useCallback(l=>r.subscribe(Vn.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=j.useCallback((l,o)=>{r.mutate(l,o).catch(Rr)},[r]);if(a.error&&N1(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}/**
|
|
50
|
-
* react-router v7.13.1
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var dN="popstate";function hN(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function kP(e={}){function t(r,a){var c;let i=(c=a.state)==null?void 0:c.masked,{pathname:l,search:o,hash:f}=i||r.location;return Cb("",{pathname:l,search:o,hash:f},a.state&&a.state.usr||null,a.state&&a.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:sd(a)}return jP(t,n,null,e)}function mn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function TP(){return Math.random().toString(36).substring(2,10)}function vN(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Cb(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?vc(t):t,state:n,key:t&&t.key||r||TP(),unstable_mask:a}}function sd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function vc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function jP(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,o="POP",f=null,c=h();c==null&&(c=0,l.replaceState({...l.state,idx:c},""));function h(){return(l.state||{idx:null}).idx}function p(){o="POP";let w=h(),S=w==null?null:w-c;c=w,f&&f({action:o,location:b.location,delta:S})}function m(w,S){o="PUSH";let N=hN(w)?w:Cb(b.location,w,S);c=h()+1;let C=vN(N,c),T=b.createHref(N.unstable_mask||N);try{l.pushState(C,"",T)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(T)}i&&f&&f({action:o,location:b.location,delta:1})}function y(w,S){o="REPLACE";let N=hN(w)?w:Cb(b.location,w,S);c=h();let C=vN(N,c),T=b.createHref(N.unstable_mask||N);l.replaceState(C,"",T),i&&f&&f({action:o,location:b.location,delta:0})}function x(w){return AP(w)}let b={get action(){return o},get location(){return e(a,l)},listen(w){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(dN,p),f=w,()=>{a.removeEventListener(dN,p),f=null}},createHref(w){return t(a,w)},createURL:x,encodeLocation(w){let S=x(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:m,replace:y,go(w){return l.go(w)}};return b}function AP(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),mn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:sd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function RR(e,t,n="/"){return RP(e,t,n,!1)}function RP(e,t,n,r){let a=typeof t=="string"?vc(t):t,i=is(a.pathname||"/",n);if(i==null)return null;let l=DR(e);DP(l);let o=null;for(let f=0;o==null&&f<l.length;++f){let c=qP(i);o=FP(l[f],c,r)}return o}function DR(e,t=[],n=[],r="",a=!1){let i=(l,o,f=a,c)=>{let h={relativePath:c===void 0?l.path||"":c,caseSensitive:l.caseSensitive===!0,childrenIndex:o,route:l};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&f)return;mn(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let p=pi([r,h.relativePath]),m=n.concat(h);l.children&&l.children.length>0&&(mn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),DR(l.children,t,m,p,f)),!(l.path==null&&!l.index)&&t.push({path:p,score:zP(p,l.index),routesMeta:m})};return e.forEach((l,o)=>{var f;if(l.path===""||!((f=l.path)!=null&&f.includes("?")))i(l,o);else for(let c of MR(l.path))i(l,o,!0,c)}),t}function MR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=MR(r.join("/")),o=[];return o.push(...l.map(f=>f===""?i:[i,f].join("/"))),a&&o.push(...l),o.map(f=>e.startsWith("/")&&f===""?"/":f)}function DP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:IP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var MP=/^:[\w-]+$/,_P=3,OP=2,LP=1,PP=10,BP=-2,pN=e=>e==="*";function zP(e,t){let n=e.split("/"),r=n.length;return n.some(pN)&&(r+=BP),t&&(r+=OP),n.filter(a=>!pN(a)).reduce((a,i)=>a+(MP.test(i)?_P:i===""?LP:PP),r)}function IP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function FP(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",l=[];for(let o=0;o<r.length;++o){let f=r[o],c=o===r.length-1,h=i==="/"?t:t.slice(i.length)||"/",p=cp({path:f.relativePath,caseSensitive:f.caseSensitive,end:c},h),m=f.route;if(!p&&c&&n&&!r[r.length-1].route.index&&(p=cp({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},h)),!p)return null;Object.assign(a,p.params),l.push({params:a,pathname:pi([i,p.pathname]),pathnameBase:$P(pi([i,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(i=pi([i,p.pathnameBase]))}return l}function cp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=UP(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],l=i.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((c,{paramName:h,isOptional:p},m)=>{if(h==="*"){let x=o[m]||"";l=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const y=o[m];return p&&!y?c[h]=void 0:c[h]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:l,pattern:e}}function UP(e,t=!1,n=!0){xi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,f,c,h)=>{if(r.push({paramName:o,isOptional:f!=null}),f){let p=h.charAt(c+l.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function qP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function is(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var VP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function HP(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?vc(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=mN(n.substring(1),"/"):i=mN(n,t)):i=t,{pathname:i,search:KP(r),hash:YP(a)}}function mN(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Qy(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function GP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _R(e){let t=GP(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function T1(e,t,n,r=!1){let a;typeof e=="string"?a=vc(e):(a={...e},mn(!a.pathname||!a.pathname.includes("?"),Qy("?","pathname","search",a)),mn(!a.pathname||!a.pathname.includes("#"),Qy("#","pathname","hash",a)),mn(!a.search||!a.search.includes("#"),Qy("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,o;if(l==null)o=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let m=l.split("/");for(;m[0]==="..";)m.shift(),p-=1;a.pathname=m.join("/")}o=p>=0?t[p]:"/"}let f=HP(a,o),c=l&&l!=="/"&&l.endsWith("/"),h=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(c||h)&&(f.pathname+="/"),f}var pi=e=>e.join("/").replace(/\/\/+/g,"/"),$P=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),KP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,XP=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function QP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function WP(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var OR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function LR(e,t){let n=e;if(typeof n!="string"||!VP.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(OR)try{let i=new URL(window.location.href),l=n.startsWith("//")?new URL(i.protocol+n):new URL(n),o=is(l.pathname,t);l.origin===i.origin&&o!=null?n=o+l.search+l.hash:a=!0}catch{xi(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var PR=["POST","PUT","PATCH","DELETE"];new Set(PR);var ZP=["GET",...PR];new Set(ZP);var pc=j.createContext(null);pc.displayName="DataRouter";var Up=j.createContext(null);Up.displayName="DataRouterState";var JP=j.createContext(!1),BR=j.createContext({isTransitioning:!1});BR.displayName="ViewTransition";var eB=j.createContext(new Map);eB.displayName="Fetchers";var tB=j.createContext(null);tB.displayName="Await";var Pa=j.createContext(null);Pa.displayName="Navigation";var Td=j.createContext(null);Td.displayName="Location";var Wa=j.createContext({outlet:null,matches:[],isDataRoute:!1});Wa.displayName="Route";var j1=j.createContext(null);j1.displayName="RouteError";var zR="REACT_ROUTER_ERROR",nB="REDIRECT",rB="ROUTE_ERROR_RESPONSE";function aB(e){if(e.startsWith(`${zR}:${nB}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function iB(e){if(e.startsWith(`${zR}:${rB}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new XP(t.status,t.statusText,t.data)}catch{}}function sB(e,{relative:t}={}){mn(jd(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=j.useContext(Pa),{hash:a,pathname:i,search:l}=Ad(e,{relative:t}),o=i;return n!=="/"&&(o=i==="/"?n:pi([n,i])),r.createHref({pathname:o,search:l,hash:a})}function jd(){return j.useContext(Td)!=null}function Ba(){return mn(jd(),"useLocation() may be used only in the context of a <Router> component."),j.useContext(Td).location}var IR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function FR(e){j.useContext(Pa).static||j.useLayoutEffect(e)}function Za(){let{isDataRoute:e}=j.useContext(Wa);return e?SB():lB()}function lB(){mn(jd(),"useNavigate() may be used only in the context of a <Router> component.");let e=j.useContext(pc),{basename:t,navigator:n}=j.useContext(Pa),{matches:r}=j.useContext(Wa),{pathname:a}=Ba(),i=JSON.stringify(_R(r)),l=j.useRef(!1);return FR(()=>{l.current=!0}),j.useCallback((f,c={})=>{if(xi(l.current,IR),!l.current)return;if(typeof f=="number"){n.go(f);return}let h=T1(f,JSON.parse(i),a,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:pi([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,i,a,e])}var oB=j.createContext(null);function uB(e){let t=j.useContext(Wa).outlet;return j.useMemo(()=>t&&j.createElement(oB.Provider,{value:e},t),[t,e])}function cB(){let{matches:e}=j.useContext(Wa),t=e[e.length-1];return t?t.params:{}}function Ad(e,{relative:t}={}){let{matches:n}=j.useContext(Wa),{pathname:r}=Ba(),a=JSON.stringify(_R(n));return j.useMemo(()=>T1(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function fB(e,t){return UR(e,t)}function UR(e,t,n){var w;mn(jd(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=j.useContext(Pa),{matches:a}=j.useContext(Wa),i=a[a.length-1],l=i?i.params:{},o=i?i.pathname:"/",f=i?i.pathnameBase:"/",c=i&&i.route;{let S=c&&c.path||"";VR(o,!c||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
-
|
|
60
|
-
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let h=Ba(),p;if(t){let S=typeof t=="string"?vc(t):t;mn(f==="/"||((w=S.pathname)==null?void 0:w.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),p=S}else p=h;let m=p.pathname||"/",y=m;if(f!=="/"){let S=f.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=RR(e,{pathname:y});xi(c||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),xi(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=mB(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:pi([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:pi([f,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),a,n);return t&&b?j.createElement(Td.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},b):b}function dB(){let e=wB(),t=QP(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:i},"ErrorBoundary")," or"," ",j.createElement("code",{style:i},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:a},n):null,l)}var hB=j.createElement(dB,null),qR=class extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=iB(e.digest);n&&(e=n)}let t=e!==void 0?j.createElement(Wa.Provider,{value:this.props.routeContext},j.createElement(j1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?j.createElement(vB,{error:e},t):t}};qR.contextType=JP;var Wy=new WeakMap;function vB({children:e,error:t}){let{basename:n}=j.useContext(Pa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=aB(t.digest);if(r){let a=Wy.get(t);if(a)throw a;let i=LR(r.location,n);if(OR&&!Wy.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Wy.set(t,l),l}return j.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function pB({routeContext:e,match:t,children:n}){let r=j.useContext(pc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(Wa.Provider,{value:e},n)}function mB(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let h=a.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);mn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let l=!1,o=-1;if(n&&r){l=r.renderFallback;for(let h=0;h<a.length;h++){let p=a[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(o=h),p.route.id){let{loaderData:m,errors:y}=r,x=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||x){n.isStatic&&(l=!0),o>=0?a=a.slice(0,o+1):a=[a[0]];break}}}}let f=n==null?void 0:n.onError,c=r&&f?(h,p)=>{var m,y;f(h,{location:r.location,params:((y=(m=r.matches)==null?void 0:m[0])==null?void 0:y.params)??{},unstable_pattern:WP(r.matches),errorInfo:p})}:void 0;return a.reduceRight((h,p,m)=>{let y,x=!1,b=null,w=null;r&&(y=i&&p.route.id?i[p.route.id]:void 0,b=p.route.errorElement||hB,l&&(o<0&&m===0?(VR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,w=null):o===m&&(x=!0,w=p.route.hydrateFallbackElement||null)));let S=t.concat(a.slice(0,m+1)),N=()=>{let C;return y?C=b:x?C=w:p.route.Component?C=j.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=h,j.createElement(pB,{match:p,routeContext:{outlet:h,matches:S,isDataRoute:r!=null},children:C})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?j.createElement(qR,{location:r.location,revalidation:r.revalidation,component:b,error:y,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:c}):N()},null)}function A1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gB(e){let t=j.useContext(pc);return mn(t,A1(e)),t}function yB(e){let t=j.useContext(Up);return mn(t,A1(e)),t}function xB(e){let t=j.useContext(Wa);return mn(t,A1(e)),t}function R1(e){let t=xB(e),n=t.matches[t.matches.length-1];return mn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function bB(){return R1("useRouteId")}function wB(){var r;let e=j.useContext(j1),t=yB("useRouteError"),n=R1("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function SB(){let{router:e}=gB("useNavigate"),t=R1("useNavigate"),n=j.useRef(!1);return FR(()=>{n.current=!0}),j.useCallback(async(a,i={})=>{xi(n.current,IR),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var gN={};function VR(e,t,n){!t&&!gN[e]&&(gN[e]=!0,xi(!1,n))}j.memo(EB);function EB({routes:e,future:t,state:n,isStatic:r,onError:a}){return UR(e,void 0,{state:n,isStatic:r,onError:a})}function CB(e){return uB(e.context)}function ka(e){mn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function NB({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,unstable_useTransitions:l}){mn(!jd(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),f=j.useMemo(()=>({basename:o,navigator:a,static:i,unstable_useTransitions:l,future:{}}),[o,a,i,l]);typeof n=="string"&&(n=vc(n));let{pathname:c="/",search:h="",hash:p="",state:m=null,key:y="default",unstable_mask:x}=n,b=j.useMemo(()=>{let w=is(c,o);return w==null?null:{location:{pathname:w,search:h,hash:p,state:m,key:y,unstable_mask:x},navigationType:r}},[o,c,h,p,m,y,r,x]);return xi(b!=null,`<Router basename="${o}"> is not able to match the URL "${c}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:j.createElement(Pa.Provider,{value:f},j.createElement(Td.Provider,{children:t,value:b}))}function kB({children:e,location:t}){return fB(Nb(e),t)}function Nb(e,t=[]){let n=[];return j.Children.forEach(e,(r,a)=>{if(!j.isValidElement(r))return;let i=[...t,a];if(r.type===j.Fragment){n.push.apply(n,Nb(r.props.children,i));return}mn(r.type===ka,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),mn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=Nb(r.props.children,i)),n.push(l)}),n}var Gv="get",$v="application/x-www-form-urlencoded";function qp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function TB(e){return qp(e)&&e.tagName.toLowerCase()==="button"}function jB(e){return qp(e)&&e.tagName.toLowerCase()==="form"}function AB(e){return qp(e)&&e.tagName.toLowerCase()==="input"}function RB(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function DB(e,t){return e.button===0&&(!t||t==="_self")&&!RB(e)}var mv=null;function MB(){if(mv===null)try{new FormData(document.createElement("form"),0),mv=!1}catch{mv=!0}return mv}var _B=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zy(e){return e!=null&&!_B.has(e)?(xi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$v}"`),null):e}function OB(e,t){let n,r,a,i,l;if(jB(e)){let o=e.getAttribute("action");r=o?is(o,t):null,n=e.getAttribute("method")||Gv,a=Zy(e.getAttribute("enctype"))||$v,i=new FormData(e)}else if(TB(e)||AB(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||o.getAttribute("action");if(r=f?is(f,t):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||Gv,a=Zy(e.getAttribute("formenctype"))||Zy(o.getAttribute("enctype"))||$v,i=new FormData(o,e),!MB()){let{name:c,type:h,value:p}=e;if(h==="image"){let m=c?`${c}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else c&&i.append(c,p)}}else{if(qp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Gv,r=null,a=$v,l=e}return i&&a==="text/plain"&&(l=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function D1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function LB(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&is(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function PB(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function BB(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function zB(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let l=await PB(i,n);return l.links?l.links():[]}return[]}));return qB(r.flat(1).filter(BB).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function yN(e,t,n,r,a,i){let l=(f,c)=>n[c]?f.route.id!==n[c].route.id:!0,o=(f,c)=>{var h;return n[c].pathname!==f.pathname||((h=n[c].route.path)==null?void 0:h.endsWith("*"))&&n[c].params["*"]!==f.params["*"]};return i==="assets"?t.filter((f,c)=>l(f,c)||o(f,c)):i==="data"?t.filter((f,c)=>{var p;let h=r.routes[f.route.id];if(!h||!h.hasLoader)return!1;if(l(f,c)||o(f,c))return!0;if(f.route.shouldRevalidate){let m=f.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function IB(e,t,{includeHydrateFallback:n}={}){return FB(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function FB(e){return[...new Set(e)]}function UB(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function qB(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(UB(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function HR(){let e=j.useContext(pc);return D1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function VB(){let e=j.useContext(Up);return D1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var M1=j.createContext(void 0);M1.displayName="FrameworkContext";function GR(){let e=j.useContext(M1);return D1(e,"You must render this element inside a <HydratedRouter> element"),e}function HB(e,t){let n=j.useContext(M1),[r,a]=j.useState(!1),[i,l]=j.useState(!1),{onFocus:o,onBlur:f,onMouseEnter:c,onMouseLeave:h,onTouchStart:p}=t,m=j.useRef(null);j.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let b=S=>{S.forEach(N=>{l(N.isIntersecting)})},w=new IntersectionObserver(b,{threshold:.5});return m.current&&w.observe(m.current),()=>{w.disconnect()}}},[e]),j.useEffect(()=>{if(r){let b=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(b)}}},[r]);let y=()=>{a(!0)},x=()=>{a(!1),l(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:jf(o,y),onBlur:jf(f,x),onMouseEnter:jf(c,y),onMouseLeave:jf(h,x),onTouchStart:jf(p,y)}]:[!1,m,{}]}function jf(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function GB({page:e,...t}){let{router:n}=HR(),r=j.useMemo(()=>RR(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?j.createElement(KB,{page:e,matches:r,...t}):null}function $B(e){let{manifest:t,routeModules:n}=GR(),[r,a]=j.useState([]);return j.useEffect(()=>{let i=!1;return zB(e,t,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,t,n]),r}function KB({page:e,matches:t,...n}){let r=Ba(),{future:a,manifest:i,routeModules:l}=GR(),{basename:o}=HR(),{loaderData:f,matches:c}=VB(),h=j.useMemo(()=>yN(e,t,c,i,r,"data"),[e,t,c,i,r]),p=j.useMemo(()=>yN(e,t,c,i,r,"assets"),[e,t,c,i,r]),m=j.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,w=!1;if(t.forEach(N=>{var T;let C=i.routes[N.route.id];!C||!C.hasLoader||(!h.some(R=>R.route.id===N.route.id)&&N.route.id in f&&((T=l[N.route.id])!=null&&T.shouldRevalidate)||C.hasClientLoader?w=!0:b.add(N.route.id))}),b.size===0)return[];let S=LB(e,o,a.unstable_trailingSlashAwareDataRequests,"data");return w&&b.size>0&&S.searchParams.set("_routes",t.filter(N=>b.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[o,a.unstable_trailingSlashAwareDataRequests,f,r,i,h,t,e,l]),y=j.useMemo(()=>IB(p,i),[p,i]),x=$B(p);return j.createElement(j.Fragment,null,m.map(b=>j.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),y.map(b=>j.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),x.map(({key:b,link:w})=>j.createElement("link",{key:b,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function YB(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var XB=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{XB&&(window.__reactRouterVersion="7.13.1")}catch{}function QB({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=j.useRef();a.current==null&&(a.current=kP({window:r,v5Compat:!0}));let i=a.current,[l,o]=j.useState({action:i.action,location:i.location}),f=j.useCallback(c=>{n===!1?o(c):j.startTransition(()=>o(c))},[n]);return j.useLayoutEffect(()=>i.listen(f),[i,f]),j.createElement(NB,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,unstable_useTransitions:n})}var $R=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_a=j.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:l,unstable_mask:o,state:f,target:c,to:h,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:y,...x},b){let{basename:w,navigator:S,unstable_useTransitions:N}=j.useContext(Pa),C=typeof h=="string"&&$R.test(h),T=LR(h,w);h=T.to;let R=sB(h,{relative:a}),A=Ba(),D=null;if(o){let G=T1(o,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);w!=="/"&&(G.pathname=G.pathname==="/"?w:pi([w,G.pathname])),D=S.createHref(G)}let[O,L,M]=HB(r,x),B=JB(h,{replace:l,unstable_mask:o,state:f,target:c,preventScrollReset:p,relative:a,viewTransition:m,unstable_defaultShouldRevalidate:y,unstable_useTransitions:N});function P(G){t&&t(G),G.defaultPrevented||B(G)}let q=!(T.isExternal||i),H=j.createElement("a",{...x,...M,href:(q?D:void 0)||T.absoluteURL||R,onClick:q?P:t,ref:YB(b,L),target:c,"data-discover":!C&&n==="render"?"true":void 0});return O&&!C?j.createElement(j.Fragment,null,H,j.createElement(GB,{page:R})):H});_a.displayName="Link";var _1=j.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:l,viewTransition:o,children:f,...c},h){let p=Ad(l,{relative:c.relative}),m=Ba(),y=j.useContext(Up),{navigator:x,basename:b}=j.useContext(Pa),w=y!=null&&az(p)&&o===!0,S=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,N=m.pathname,C=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(N=N.toLowerCase(),C=C?C.toLowerCase():null,S=S.toLowerCase()),C&&b&&(C=is(C,b)||C);const T=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let R=N===S||!a&&N.startsWith(S)&&N.charAt(T)==="/",A=C!=null&&(C===S||!a&&C.startsWith(S)&&C.charAt(S.length)==="/"),D={isActive:R,isPending:A,isTransitioning:w},O=R?t:void 0,L;typeof r=="function"?L=r(D):L=[r,R?"active":null,A?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let M=typeof i=="function"?i(D):i;return j.createElement(_a,{...c,"aria-current":O,className:L,ref:h,style:M,to:l,viewTransition:o},typeof f=="function"?f(D):f)});_1.displayName="NavLink";var WB=j.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:l=Gv,action:o,onSubmit:f,relative:c,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m,...y},x)=>{let{unstable_useTransitions:b}=j.useContext(Pa),w=nz(),S=rz(o,{relative:c}),N=l.toLowerCase()==="get"?"get":"post",C=typeof o=="string"&&$R.test(o),T=R=>{if(f&&f(R),R.defaultPrevented)return;R.preventDefault();let A=R.nativeEvent.submitter,D=(A==null?void 0:A.getAttribute("formmethod"))||l,O=()=>w(A||R.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:a,state:i,relative:c,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m});b&&n!==!1?j.startTransition(()=>O()):O()};return j.createElement("form",{ref:x,method:N,action:S,onSubmit:r?f:T,...y,"data-discover":!C&&e==="render"?"true":void 0})});WB.displayName="Form";function ZB(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KR(e){let t=j.useContext(pc);return mn(t,ZB(e)),t}function JB(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:o,unstable_defaultShouldRevalidate:f,unstable_useTransitions:c}={}){let h=Za(),p=Ba(),m=Ad(e,{relative:l});return j.useCallback(y=>{if(DB(y,t)){y.preventDefault();let x=n!==void 0?n:sd(p)===sd(m),b=()=>h(e,{replace:x,unstable_mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:o,unstable_defaultShouldRevalidate:f});c?j.startTransition(()=>b()):b()}},[p,h,m,n,r,a,t,e,i,l,o,f,c])}var ez=0,tz=()=>`__${String(++ez)}__`;function nz(){let{router:e}=KR("useSubmit"),{basename:t}=j.useContext(Pa),n=bB(),r=e.fetch,a=e.navigate;return j.useCallback(async(i,l={})=>{let{action:o,method:f,encType:c,formData:h,body:p}=OB(i,t);if(l.navigate===!1){let m=l.fetcherKey||tz();await r(m,n,l.action||o,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:h,body:p,formMethod:l.method||f,formEncType:l.encType||c,flushSync:l.flushSync})}else await a(l.action||o,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:h,body:p,formMethod:l.method||f,formEncType:l.encType||c,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,a,t,n])}function rz(e,{relative:t}={}){let{basename:n}=j.useContext(Pa),r=j.useContext(Wa);mn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...Ad(e||".",{relative:t})},l=Ba();if(e==null){i.search=l.search;let o=new URLSearchParams(i.search),f=o.getAll("index");if(f.some(h=>h==="")){o.delete("index"),f.filter(p=>p).forEach(p=>o.append("index",p));let h=o.toString();i.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:pi([n,i.pathname])),sd(i)}function az(e,{relative:t}={}){let n=j.useContext(BR);mn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=KR("useViewTransitionState"),a=Ad(e,{relative:t});if(!n.isTransitioning)return!1;let i=is(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=is(n.nextLocation.pathname,r)||n.nextLocation.pathname;return cp(a.pathname,l)!=null||cp(a.pathname,i)!=null}var Rd=gR();const iz=kd(Rd),xN=6e4,sz=3e5,lz=200,bN={active:1,idle:2,deep_sleep:5,hidden:10},wN=["mousemove","mousedown","keydown","scroll","touchstart"],YR=j.createContext(void 0);function oz({children:e}){const[t,n]=j.useState("active"),r=j.useRef(null),a=j.useRef(null),i=j.useRef(Date.now()),l=j.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),a.current&&(clearTimeout(a.current),a.current=null)},[]),o=j.useCallback(()=>{l(),r.current=setTimeout(()=>{n("idle"),a.current=setTimeout(()=>{n("deep_sleep")},sz-xN)},xN)},[l]),f=j.useCallback(()=>{const h=Date.now();h-i.current<lz||(i.current=h,n("active"),o())},[o]),c=j.useCallback(()=>{document.hidden?(l(),n("hidden")):(n("active"),i.current=Date.now(),o())},[l,o]);return j.useEffect(()=>{o();for(const h of wN)document.addEventListener(h,f,{passive:!0});return document.addEventListener("visibilitychange",c),()=>{l();for(const h of wN)document.removeEventListener(h,f);document.removeEventListener("visibilitychange",c)}},[f,c,o,l]),d.jsx(YR.Provider,{value:{powerState:t},children:e})}function uz(){const e=j.useContext(YR);if(!e)throw new Error("usePowerState must be used within a PowerProvider");return e.powerState}const cz="/api";async function lt(e,t){var l;const n=(l=t==null?void 0:t.method)==null?void 0:l.toUpperCase(),a=n==="POST"||n==="PUT"?{"Content-Type":"application/json",...t==null?void 0:t.headers}:t==null?void 0:t.headers,i=await fetch(`${cz}${e}`,{...t,headers:a});if(!i.ok){const o=await i.json().catch(()=>({}));throw new XR(i.status,o)}return i.json()}async function nn(e,t){return lt(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async function mc(e,t){return lt(e,{method:"PUT",body:JSON.stringify(t)})}async function O1(e){return lt(e,{method:"DELETE"})}function fz(e){return lt("/config/merged",{signal:e})}function dz(e){return lt("/config/local",{signal:e})}function Jy(e,t,n){const r={scope:e,patch:t};return n&&n.length>0&&(r.clear=n),mc("/config/scoped",r)}function SN(e){return mc("/config/scoped",{scope:"local",patch:{},clear:e})}class XR extends Error{constructor(t,n){const r=typeof n=="object"&&n!==null&&"error"in n?String(n.error):null;super(r?`${r} (API ${t})`:`API error ${t}`),this.status=t,this.body=n}}function fp(e,t){const n=t.split(".");let r=e;for(const a of n){if(r==null||typeof r!="object")return;r=r[a]}return r}function ex(e,t,n){const r=t.split("."),a=r[r.length-1];if(a===void 0)return;let i=e;for(let l=0;l<r.length-1;l+=1){const o=r[l];if(o===void 0)return;const f=i[o];(f==null||typeof f!="object"||Array.isArray(f))&&(i[o]={}),i=i[o]}i[a]=n}const tx=["config","merged"],EN=["config","local"],hz=["notifications"];function hs(){const e=Sn(),t=qt({queryKey:tx,queryFn:({signal:x})=>fz(x)}),n=qt({queryKey:EN,queryFn:({signal:x})=>dz(x)}),r=j.useRef(t.data);r.current=t.data;const a=j.useRef(n.data);a.current=n.data;const i=j.useCallback(()=>{e.invalidateQueries({queryKey:hz})},[e]),l=j.useCallback(()=>{e.invalidateQueries({queryKey:EN}),e.invalidateQueries({queryKey:tx}),i()},[i,e]),o=j.useCallback(()=>{e.invalidateQueries({queryKey:tx}),i()},[i,e]),f=j.useCallback(x=>x==="local"?l():o(),[l,o]),c=j.useCallback(async(x,b,w)=>{const S={};ex(S,x,b),await Jy(w,S),f(w)},[f]),h=j.useCallback(async(x,b,w)=>{const S={};for(const{path:N,value:C}of x)ex(S,N,C);await Jy(b,S,w),f(b)},[f]),p=j.useCallback(async x=>{await SN([x]),l()},[l]),m=j.useCallback(async x=>{const b=fp(r.current??{},x),w={};ex(w,x,b),await Jy("project",w),await SN([x]),l()},[l]),y=j.useCallback(x=>fp(a.current??{},x)!==void 0,[]);return{effective:t.data,local:n.data??{},isLoading:t.isLoading||n.isLoading,isLocalOverride:y,setField:c,setFields:h,resetField:p,promoteField:m}}const QR=j.createContext(null),vz={compact:.85,normal:1,comfy:1.15},pz={default:{heading:"'Newsreader', Georgia, serif",ui:"'Inter', system-ui, sans-serif",data:"'JetBrains Mono', 'Fira Code', monospace"},"geist-mono":{heading:"'Geist Mono', 'SF Mono', 'Fira Code', monospace",ui:"'Geist Mono', 'SF Mono', 'Fira Code', monospace",data:"'Geist Mono', 'SF Mono', 'Fira Code', monospace"},system:{heading:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",ui:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",data:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"},"sf-mono":{heading:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace",ui:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace",data:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace"},"fira-code":{heading:"'Fira Code', 'Fira Mono', ui-monospace, monospace",ui:"'Fira Code', 'Fira Mono', ui-monospace, monospace",data:"'Fira Code', 'Fira Mono', ui-monospace, monospace"},"jetbrains-mono":{heading:"'JetBrains Mono', ui-monospace, monospace",ui:"'JetBrains Mono', ui-monospace, monospace",data:"'JetBrains Mono', ui-monospace, monospace"}},mz={theme:"sage",mode:"dark",font:"default",density:"normal"},WR="(prefers-color-scheme: light)";function CN(e){const t=document.documentElement;t.setAttribute("data-theme",e.theme);const n=e.mode==="system"?window.matchMedia(WR).matches?"light":"dark":e.mode;t.classList.toggle("light",n==="light");const r=pz[e.font];t.style.setProperty("--font-heading",r.heading),t.style.setProperty("--font-ui",r.ui),t.style.setProperty("--font-data",r.data);const a=vz[e.density];t.style.setProperty("--density",String(a)),t.style.fontSize=`calc(14px * ${a})`;const i=document.querySelector('link[rel="icon"]');if(i){const l=`/favicon-${e.theme}.svg`;i.href.endsWith(l)||(i.href=l)}}function gz({children:e}){const{effective:t,local:n,setField:r,resetField:a,promoteField:i}=hs(),l=j.useMemo(()=>(t==null?void 0:t.appearance)??mz,[t==null?void 0:t.appearance]),o=j.useMemo(()=>n.appearance??{},[n.appearance]);j.useEffect(()=>{CN(l)},[l]),j.useEffect(()=>{if(l.mode!=="system")return;const y=window.matchMedia(WR),x=()=>CN(l);return y.addEventListener("change",x),()=>y.removeEventListener("change",x)},[l]);const f=j.useCallback((y,x,b)=>r(`appearance.${y}`,x,b),[r]),c=j.useCallback(y=>a(`appearance.${y}`),[a]),h=j.useCallback(()=>i("appearance"),[i]),p=j.useCallback(()=>a("appearance"),[a]),m=j.useMemo(()=>({effective:l,local:o,set:f,resetKey:c,saveAllAsProject:h,resetAll:p}),[l,o,f,c,h,p]);return d.jsx(QR.Provider,{value:m,children:e})}function yz(){const e=j.useContext(QR);if(!e)throw new Error("useAppearance must be used inside AppearanceProvider");return e}const xz="configSection",bz="configField",wz="config-field-",Ni={appearance:"config-section-appearance",settingsAgent:"config-section-settings-agent",settingsEmbedding:"config-section-settings-embedding",settingsContextInjection:"config-section-settings-context-injection",settingsNotifications:"config-section-settings-notifications",settingsPlanCapture:"config-section-settings-plan-capture",settingsProject:"config-section-settings-project",agentOperations:"config-section-agent-operations",operationsMaintenance:"config-section-operations-maintenance",operationsBackup:"config-section-operations-backup"};function Vp(e){return`${wz}${e.replace(/[^a-zA-Z0-9]+/g,"-")}`}/**
|
|
61
|
-
* @license lucide-react v0.460.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const Sz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ZR=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
66
|
-
* @license lucide-react v0.460.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/var Ez={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
71
|
-
* @license lucide-react v0.460.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const Cz=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:l,...o},f)=>j.createElement("svg",{ref:f,...Ez,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ZR("lucide",a),...o},[...l.map(([c,h])=>j.createElement(c,h)),...Array.isArray(i)?i:[i]]));/**
|
|
76
|
-
* @license lucide-react v0.460.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const Ue=(e,t)=>{const n=j.forwardRef(({className:r,...a},i)=>j.createElement(Cz,{ref:i,iconNode:t,className:ZR(`lucide-${Sz(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
|
|
81
|
-
* @license lucide-react v0.460.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const kb=Ue("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
86
|
-
* @license lucide-react v0.460.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const JR=Ue("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
|
|
91
|
-
* @license lucide-react v0.460.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const mi=Ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
96
|
-
* @license lucide-react v0.460.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const Tb=Ue("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
101
|
-
* @license lucide-react v0.460.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const dp=Ue("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
|
106
|
-
* @license lucide-react v0.460.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const Nz=Ue("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
111
|
-
* @license lucide-react v0.460.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const Dd=Ue("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
116
|
-
* @license lucide-react v0.460.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const gc=Ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
121
|
-
* @license lucide-react v0.460.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const La=Ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
126
|
-
* @license lucide-react v0.460.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const L1=Ue("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
131
|
-
* @license lucide-react v0.460.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const ha=Ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
136
|
-
* @license lucide-react v0.460.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const kz=Ue("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
141
|
-
* @license lucide-react v0.460.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const Cr=Ue("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
146
|
-
* @license lucide-react v0.460.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const jb=Ue("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
|
|
151
|
-
* @license lucide-react v0.460.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const eD=Ue("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
156
|
-
* @license lucide-react v0.460.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const yc=Ue("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
161
|
-
* @license lucide-react v0.460.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const Tz=Ue("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
166
|
-
* @license lucide-react v0.460.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const lc=Ue("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
171
|
-
* @license lucide-react v0.460.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const jz=Ue("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
176
|
-
* @license lucide-react v0.460.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const tD=Ue("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
181
|
-
* @license lucide-react v0.460.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const Az=Ue("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
186
|
-
* @license lucide-react v0.460.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const P1=Ue("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
191
|
-
* @license lucide-react v0.460.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const nD=Ue("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
|
|
196
|
-
* @license lucide-react v0.460.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const Rz=Ue("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
|
201
|
-
* @license lucide-react v0.460.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const Dz=Ue("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
206
|
-
* @license lucide-react v0.460.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const Mz=Ue("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
211
|
-
* @license lucide-react v0.460.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const Hp=Ue("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
216
|
-
* @license lucide-react v0.460.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const _z=Ue("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
221
|
-
* @license lucide-react v0.460.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const Oz=Ue("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
226
|
-
* @license lucide-react v0.460.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const Lz=Ue("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
231
|
-
* @license lucide-react v0.460.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const Pz=Ue("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
|
|
236
|
-
* @license lucide-react v0.460.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const Bz=Ue("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
241
|
-
* @license lucide-react v0.460.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const zz=Ue("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
|
|
246
|
-
* @license lucide-react v0.460.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const B1=Ue("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
251
|
-
* @license lucide-react v0.460.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const Iz=Ue("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
256
|
-
* @license lucide-react v0.460.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const Fz=Ue("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
|
261
|
-
* @license lucide-react v0.460.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const Uz=Ue("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
266
|
-
* @license lucide-react v0.460.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const Gn=Ue("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
271
|
-
* @license lucide-react v0.460.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const qz=Ue("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/**
|
|
276
|
-
* @license lucide-react v0.460.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const Vz=Ue("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
281
|
-
* @license lucide-react v0.460.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const Gp=Ue("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
286
|
-
* @license lucide-react v0.460.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const Hz=Ue("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
291
|
-
* @license lucide-react v0.460.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const Gz=Ue("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
296
|
-
* @license lucide-react v0.460.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const rD=Ue("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
|
|
301
|
-
* @license lucide-react v0.460.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const z1=Ue("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
306
|
-
* @license lucide-react v0.460.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const ss=Ue("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
311
|
-
* @license lucide-react v0.460.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const aD=Ue("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
|
|
316
|
-
* @license lucide-react v0.460.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const ls=Ue("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
321
|
-
* @license lucide-react v0.460.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const $p=Ue("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
326
|
-
* @license lucide-react v0.460.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const iD=Ue("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
|
|
331
|
-
* @license lucide-react v0.460.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const xc=Ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
336
|
-
* @license lucide-react v0.460.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const $z=Ue("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
|
341
|
-
* @license lucide-react v0.460.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const Kz=Ue("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
346
|
-
* @license lucide-react v0.460.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const Yz=Ue("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
351
|
-
* @license lucide-react v0.460.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const Xz=Ue("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
356
|
-
* @license lucide-react v0.460.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const I1=Ue("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
361
|
-
* @license lucide-react v0.460.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const Qz=Ue("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/**
|
|
366
|
-
* @license lucide-react v0.460.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const Wz=Ue("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
371
|
-
* @license lucide-react v0.460.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const Zz=Ue("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
376
|
-
* @license lucide-react v0.460.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const Jz=Ue("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
|
|
381
|
-
* @license lucide-react v0.460.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const os=Ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
386
|
-
* @license lucide-react v0.460.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const sD=Ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
391
|
-
* @license lucide-react v0.460.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const eI=Ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
396
|
-
* @license lucide-react v0.460.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const tI=Ue("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
401
|
-
* @license lucide-react v0.460.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const nI=Ue("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
406
|
-
* @license lucide-react v0.460.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const lD=Ue("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
411
|
-
* @license lucide-react v0.460.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const jl=Ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
416
|
-
* @license lucide-react v0.460.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const rI=Ue("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),aI=6e4,iI=3e4;function sI(e,t,n){if(t==="heartbeat"){const r=e*bN[n];return n==="hidden"?Math.min(r,aI):n==="deep_sleep"?Math.min(r,iI):r}return n==="deep_sleep"||n==="hidden"?!1:e*bN[n]}function Or(e){const t=uz(),{pollCategory:n,refetchInterval:r,...a}=e,i=r===!1?!1:sI(r,n,t);return qt({...a,refetchInterval:i})}const Kn={HEALTH:5e3,STATS:1e4,LOGS:3e3,PROGRESS:1e3,UPDATE:3e5},lI=1e4,oI=3e4,uI=["debug","info","warn","error"],hp={debug:0,info:1,warn:2,error:3},cI="built-in",F1="user",fI=["stable","beta"],Qr=50,dI=5,hI=5e3,vI=3;function oD(e){switch(e){case"info":return"default";case"warn":return"warning";case"error":return"destructive";default:return"secondary"}}function U1(e){switch(e){case"info":return"bg-primary";case"debug":return"bg-outline";case"warn":return"bg-secondary";case"error":return"bg-tertiary";default:return"bg-outline"}}const q1=["update-status"];function uD(){return Or({queryKey:[...q1],queryFn:({signal:e})=>lt("/update/status",{signal:e}),refetchInterval:Kn.UPDATE,pollCategory:"standard"})}function pI(){const e=Sn();return Er({mutationFn:()=>nn("/update/check"),onSuccess:()=>{e.invalidateQueries({queryKey:[...q1]})}})}function mI(){return Er({mutationFn:()=>nn("/update/apply")})}function gI(){const e=Sn();return Er({mutationFn:t=>mc("/update/channel",{channel:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[...q1]})}})}function Md(){return Or({queryKey:["daemon-stats"],queryFn:({signal:e})=>lt("/stats",{signal:e}),refetchInterval:Kn.STATS,pollCategory:"standard"})}const nx=500,yI=3e4;function cD(){const[e,t]=j.useState(!1),n=j.useRef(null);return{restart:j.useCallback(async(a=!1)=>{t(!0);try{const i=await nn("/restart",{force:a});if(i.status==="busy")return t(!1),i;const l=Date.now()+yI;n.current=new AbortController,await new Promise((o,f)=>{const c=async()=>{if(Date.now()>l){f(new Error("Restart timeout"));return}try{if((await fetch("/health",{signal:n.current.signal})).ok){o();return}setTimeout(c,nx)}catch{setTimeout(c,nx)}};setTimeout(c,nx)}),window.location.reload()}catch(i){throw t(!1),i}},[]),isRestarting:e}}function fD(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=fD(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dD(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=fD(e))&&(r&&(r+=" "),r+=t);return r}const NN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,kN=dD,Kp=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return kN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,l=Object.keys(a).map(c=>{const h=n==null?void 0:n[c],p=i==null?void 0:i[c];if(h===null)return null;const m=NN(h)||NN(p);return a[c][m]}),o=n&&Object.entries(n).reduce((c,h)=>{let[p,m]=h;return m===void 0||(c[p]=m),c},{}),f=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,h)=>{let{class:p,className:m,...y}=h;return Object.entries(y).every(x=>{let[b,w]=x;return Array.isArray(w)?w.includes({...i,...o}[b]):{...i,...o}[b]===w})?[...c,p,m]:c},[]);return kN(e,l,f,n==null?void 0:n.class,n==null?void 0:n.className)},V1="-",xI=e=>{const t=wI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const o=l.split(V1);return o[0]===""&&o.length!==1&&o.shift(),hD(o,t)||bI(l)},getConflictingClassGroupIds:(l,o)=>{const f=n[l]||[];return o&&r[l]?[...f,...r[l]]:f}}},hD=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?hD(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(V1);return(l=t.validators.find(({validator:o})=>o(i)))==null?void 0:l.classGroupId},TN=/^\[(.+)\]$/,bI=e=>{if(TN.test(e)){const t=TN.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},wI=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return EI(Object.entries(e.classGroups),n).forEach(([i,l])=>{Ab(l,r,i,t)}),r},Ab=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:jN(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(SI(a)){Ab(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,l])=>{Ab(l,jN(t,i),n,r)})})},jN=(e,t)=>{let n=e;return t.split(V1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},SI=e=>e.isThemeGetter,EI=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,o])=>[t+l,o])):i);return[n,a]}):e,CI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return a(i,l),l},set(i,l){n.has(i)?n.set(i,l):a(i,l)}}},vD="!",NI=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,l=o=>{const f=[];let c=0,h=0,p;for(let w=0;w<o.length;w++){let S=o[w];if(c===0){if(S===a&&(r||o.slice(w,w+i)===t)){f.push(o.slice(h,w)),h=w+i;continue}if(S==="/"){p=w;continue}}S==="["?c++:S==="]"&&c--}const m=f.length===0?o:o.substring(h),y=m.startsWith(vD),x=y?m.substring(1):m,b=p&&p>h?p-h:void 0;return{modifiers:f,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:b}};return n?o=>n({className:o,parseClassName:l}):l},kI=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},TI=e=>({cache:CI(e.cacheSize),parseClassName:NI(e),...xI(e)}),jI=/\s+/,AI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],l=e.trim().split(jI);let o="";for(let f=l.length-1;f>=0;f-=1){const c=l[f],{modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,b=r(x?m.substring(0,y):m);if(!b){if(!x){o=c+(o.length>0?" "+o:o);continue}if(b=r(m),!b){o=c+(o.length>0?" "+o:o);continue}x=!1}const w=kI(h).join(":"),S=p?w+vD:w,N=S+b;if(i.includes(N))continue;i.push(N);const C=a(b,x);for(let T=0;T<C.length;++T){const R=C[T];i.push(S+R)}o=c+(o.length>0?" "+o:o)}return o};function RI(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=pD(t))&&(r&&(r+=" "),r+=n);return r}const pD=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=pD(e[r]))&&(n&&(n+=" "),n+=t);return n};function DI(e,...t){let n,r,a,i=l;function l(f){const c=t.reduce((h,p)=>p(h),e());return n=TI(c),r=n.cache.get,a=n.cache.set,i=o,o(f)}function o(f){const c=r(f);if(c)return c;const h=AI(f,n);return a(f,h),h}return function(){return i(RI.apply(null,arguments))}}const ln=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},mD=/^\[(?:([a-z-]+):)?(.+)\]$/i,MI=/^\d+\/\d+$/,_I=new Set(["px","full","screen"]),OI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,PI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,BI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ki=e=>Fu(e)||_I.has(e)||MI.test(e),$s=e=>bc(e,"length",$I),Fu=e=>!!e&&!Number.isNaN(Number(e)),rx=e=>bc(e,"number",Fu),Af=e=>!!e&&Number.isInteger(Number(e)),II=e=>e.endsWith("%")&&Fu(e.slice(0,-1)),gt=e=>mD.test(e),Ks=e=>OI.test(e),FI=new Set(["length","size","percentage"]),UI=e=>bc(e,FI,gD),qI=e=>bc(e,"position",gD),VI=new Set(["image","url"]),HI=e=>bc(e,VI,YI),GI=e=>bc(e,"",KI),Rf=()=>!0,bc=(e,t,n)=>{const r=mD.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},$I=e=>LI.test(e)&&!PI.test(e),gD=()=>!1,KI=e=>BI.test(e),YI=e=>zI.test(e),XI=()=>{const e=ln("colors"),t=ln("spacing"),n=ln("blur"),r=ln("brightness"),a=ln("borderColor"),i=ln("borderRadius"),l=ln("borderSpacing"),o=ln("borderWidth"),f=ln("contrast"),c=ln("grayscale"),h=ln("hueRotate"),p=ln("invert"),m=ln("gap"),y=ln("gradientColorStops"),x=ln("gradientColorStopPositions"),b=ln("inset"),w=ln("margin"),S=ln("opacity"),N=ln("padding"),C=ln("saturate"),T=ln("scale"),R=ln("sepia"),A=ln("skew"),D=ln("space"),O=ln("translate"),L=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",gt,t],P=()=>[gt,t],q=()=>["",Ki,$s],H=()=>["auto",Fu,gt],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",gt],I=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Fu,gt];return{cacheSize:500,separator:":",theme:{colors:[Rf],spacing:[Ki,$s],blur:["none","",Ks,gt],brightness:U(),borderColor:[e],borderRadius:["none","","full",Ks,gt],borderSpacing:P(),borderWidth:q(),contrast:U(),grayscale:Q(),hueRotate:U(),invert:Q(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[II,$s],inset:B(),margin:B(),opacity:U(),padding:P(),saturate:U(),scale:U(),sepia:Q(),skew:U(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[Ks]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),gt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Af,gt]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",Af,gt]}],"grid-cols":[{"grid-cols":[Rf]}],"col-start-end":[{col:["auto",{span:["full",Af,gt]},gt]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[Rf]}],"row-start-end":[{row:["auto",{span:[Af,gt]},gt]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",gt,t]}],"min-w":[{"min-w":[gt,t,"min","max","fit"]}],"max-w":[{"max-w":[gt,t,"none","full","min","max","fit","prose",{screen:[Ks]},Ks]}],h:[{h:[gt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ks,$s]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rx]}],"font-family":[{font:[Rf]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",gt]}],"line-clamp":[{"line-clamp":["none",Fu,rx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ki,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ki,$s]}],"underline-offset":[{"underline-offset":["auto",Ki,gt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),qI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},HI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:F()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Ki,gt]}],"outline-w":[{outline:[Ki,$s]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[Ki,$s]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ks,GI]}],"shadow-color":[{shadow:[Rf]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Ks,gt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",gt]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Af,gt]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",gt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ki,$s,rx]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},QI=DI(XI);function ke(...e){return QI(dD(e))}const WI=Kp("inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-sm hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]",destructive:"bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-sm hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]",outline:"border border-[var(--ghost-border)] bg-transparent shadow-sm hover:bg-surface-container-high hover:text-on-surface",secondary:"border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface",ghost:"hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Ae=j.forwardRef(({className:e,variant:t,size:n,...r},a)=>d.jsx("button",{className:ke(WI({variant:t,size:n,className:e})),ref:a,...r}));Ae.displayName="Button";function tn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function AN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yD(...e){return t=>{let n=!1;const r=e.map(a=>{const i=AN(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():AN(e[a],null)}}}}function jn(...e){return j.useCallback(yD(...e),e)}function ZI(e,t){const n=j.createContext(t),r=i=>{const{children:l,...o}=i,f=j.useMemo(()=>o,Object.values(o));return d.jsx(n.Provider,{value:f,children:l})};r.displayName=e+"Provider";function a(i){const l=j.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function Yp(e,t=[]){let n=[];function r(i,l){const o=j.createContext(l),f=n.length;n=[...n,l];const c=p=>{var S;const{scope:m,children:y,...x}=p,b=((S=m==null?void 0:m[e])==null?void 0:S[f])||o,w=j.useMemo(()=>x,Object.values(x));return d.jsx(b.Provider,{value:w,children:y})};c.displayName=i+"Provider";function h(p,m){var b;const y=((b=m==null?void 0:m[e])==null?void 0:b[f])||o,x=j.useContext(y);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,h]}const a=()=>{const i=n.map(l=>j.createContext(l));return function(o){const f=(o==null?void 0:o[e])||i;return j.useMemo(()=>({[`__scope${e}`]:{...o,[e]:f}}),[o,f])}};return a.scopeName=e,[r,JI(a,...t)]}function JI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const l=r.reduce((o,{useScope:f,scopeName:c})=>{const p=f(i)[`__scope${c}`];return{...o,...p}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var br=globalThis!=null&&globalThis.document?j.useLayoutEffect:()=>{},eF=mR[" useId ".trim().toString()]||(()=>{}),tF=0;function Uu(e){const[t,n]=j.useState(eF());return br(()=>{n(r=>r??String(tF++))},[e]),t?`radix-${t}`:""}var nF=mR[" useInsertionEffect ".trim().toString()]||br;function vp({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,l]=rF({defaultProp:t,onChange:n}),o=e!==void 0,f=o?e:a;{const h=j.useRef(e!==void 0);j.useEffect(()=>{const p=h.current;p!==o&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=o},[o,r])}const c=j.useCallback(h=>{var p;if(o){const m=aF(h)?h(e):h;m!==e&&((p=l.current)==null||p.call(l,m))}else i(h)},[o,e,i,l]);return[f,c]}function rF({defaultProp:e,onChange:t}){const[n,r]=j.useState(e),a=j.useRef(n),i=j.useRef(t);return nF(()=>{i.current=t},[t]),j.useEffect(()=>{var l;a.current!==n&&((l=i.current)==null||l.call(i,n),a.current=n)},[n,a]),[n,r,i]}function aF(e){return typeof e=="function"}function ld(e){const t=iF(e),n=j.forwardRef((r,a)=>{const{children:i,...l}=r,o=j.Children.toArray(i),f=o.find(lF);if(f){const c=f.props.children,h=o.map(p=>p===f?j.Children.count(c)>1?j.Children.only(null):j.isValidElement(c)?c.props.children:null:p);return d.jsx(t,{...l,ref:a,children:j.isValidElement(c)?j.cloneElement(c,void 0,h):null})}return d.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function iF(e){const t=j.forwardRef((n,r)=>{const{children:a,...i}=n;if(j.isValidElement(a)){const l=uF(a),o=oF(i,a.props);return a.type!==j.Fragment&&(o.ref=r?yD(r,l):l),j.cloneElement(a,o)}return j.Children.count(a)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sF=Symbol("radix.slottable");function lF(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sF}function oF(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...o)=>{const f=i(...o);return a(...o),f}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function uF(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Zt=cF.reduce((e,t)=>{const n=ld(`Primitive.${t}`),r=j.forwardRef((a,i)=>{const{asChild:l,...o}=a,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(f,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function fF(e,t){e&&Rd.flushSync(()=>e.dispatchEvent(t))}function Co(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function dF(e,t=globalThis==null?void 0:globalThis.document){const n=Co(e);j.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var hF="DismissableLayer",Rb="dismissableLayer.update",vF="dismissableLayer.pointerDownOutside",pF="dismissableLayer.focusOutside",RN,xD=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),H1=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:l,onDismiss:o,...f}=e,c=j.useContext(xD),[h,p]=j.useState(null),m=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=j.useState({}),x=jn(t,D=>p(D)),b=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),S=b.indexOf(w),N=h?b.indexOf(h):-1,C=c.layersWithOutsidePointerEventsDisabled.size>0,T=N>=S,R=yF(D=>{const O=D.target,L=[...c.branches].some(M=>M.contains(O));!T||L||(a==null||a(D),l==null||l(D),D.defaultPrevented||o==null||o())},m),A=xF(D=>{const O=D.target;[...c.branches].some(M=>M.contains(O))||(i==null||i(D),l==null||l(D),D.defaultPrevented||o==null||o())},m);return dF(D=>{N===c.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&o&&(D.preventDefault(),o()))},m),j.useEffect(()=>{if(h)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(RN=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),DN(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=RN)}},[h,m,n,c]),j.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),DN())},[h,c]),j.useEffect(()=>{const D=()=>y({});return document.addEventListener(Rb,D),()=>document.removeEventListener(Rb,D)},[]),d.jsx(Zt.div,{...f,ref:x,style:{pointerEvents:C?T?"auto":"none":void 0,...e.style},onFocusCapture:tn(e.onFocusCapture,A.onFocusCapture),onBlurCapture:tn(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:tn(e.onPointerDownCapture,R.onPointerDownCapture)})});H1.displayName=hF;var mF="DismissableLayerBranch",gF=j.forwardRef((e,t)=>{const n=j.useContext(xD),r=j.useRef(null),a=jn(t,r);return j.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.jsx(Zt.div,{...e,ref:a})});gF.displayName=mF;function yF(e,t=globalThis==null?void 0:globalThis.document){const n=Co(e),r=j.useRef(!1),a=j.useRef(()=>{});return j.useEffect(()=>{const i=o=>{if(o.target&&!r.current){let f=function(){bD(vF,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=f,t.addEventListener("click",a.current,{once:!0})):f()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xF(e,t=globalThis==null?void 0:globalThis.document){const n=Co(e),r=j.useRef(!1);return j.useEffect(()=>{const a=i=>{i.target&&!r.current&&bD(pF,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function DN(){const e=new CustomEvent(Rb);document.dispatchEvent(e)}function bD(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?fF(a,i):a.dispatchEvent(i)}var ax="focusScope.autoFocusOnMount",ix="focusScope.autoFocusOnUnmount",MN={bubbles:!1,cancelable:!0},bF="FocusScope",G1=j.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...l}=e,[o,f]=j.useState(null),c=Co(a),h=Co(i),p=j.useRef(null),m=jn(t,b=>f(b)),y=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let b=function(C){if(y.paused||!o)return;const T=C.target;o.contains(T)?p.current=T:el(p.current,{select:!0})},w=function(C){if(y.paused||!o)return;const T=C.relatedTarget;T!==null&&(o.contains(T)||el(p.current,{select:!0}))},S=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&el(o)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const N=new MutationObserver(S);return o&&N.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),N.disconnect()}}},[r,o,y.paused]),j.useEffect(()=>{if(o){ON.add(y);const b=document.activeElement;if(!o.contains(b)){const S=new CustomEvent(ax,MN);o.addEventListener(ax,c),o.dispatchEvent(S),S.defaultPrevented||(wF(kF(wD(o)),{select:!0}),document.activeElement===b&&el(o))}return()=>{o.removeEventListener(ax,c),setTimeout(()=>{const S=new CustomEvent(ix,MN);o.addEventListener(ix,h),o.dispatchEvent(S),S.defaultPrevented||el(b??document.body,{select:!0}),o.removeEventListener(ix,h),ON.remove(y)},0)}}},[o,c,h,y]);const x=j.useCallback(b=>{if(!n&&!r||y.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,S=document.activeElement;if(w&&S){const N=b.currentTarget,[C,T]=SF(N);C&&T?!b.shiftKey&&S===T?(b.preventDefault(),n&&el(C,{select:!0})):b.shiftKey&&S===C&&(b.preventDefault(),n&&el(T,{select:!0})):S===N&&b.preventDefault()}},[n,r,y.paused]);return d.jsx(Zt.div,{tabIndex:-1,...l,ref:m,onKeyDown:x})});G1.displayName=bF;function wF(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(el(r,{select:t}),document.activeElement!==n)return}function SF(e){const t=wD(e),n=_N(t,e),r=_N(t.reverse(),e);return[n,r]}function wD(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _N(e,t){for(const n of e)if(!EF(n,{upTo:t}))return n}function EF(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function CF(e){return e instanceof HTMLInputElement&&"select"in e}function el(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&CF(e)&&t&&e.select()}}var ON=NF();function NF(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=LN(e,t),e.unshift(t)},remove(t){var n;e=LN(e,t),(n=e[0])==null||n.resume()}}}function LN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function kF(e){return e.filter(t=>t.tagName!=="A")}var TF="Portal",$1=j.forwardRef((e,t)=>{var o;const{container:n,...r}=e,[a,i]=j.useState(!1);br(()=>i(!0),[]);const l=n||a&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return l?iz.createPortal(d.jsx(Zt.div,{...r,ref:t}),l):null});$1.displayName=TF;function jF(e,t){return j.useReducer((n,r)=>t[n][r]??n,e)}var Xp=e=>{const{present:t,children:n}=e,r=AF(t),a=typeof n=="function"?n({present:r.isPresent}):j.Children.only(n),i=jn(r.ref,RF(a));return typeof n=="function"||r.isPresent?j.cloneElement(a,{ref:i}):null};Xp.displayName="Presence";function AF(e){const[t,n]=j.useState(),r=j.useRef(null),a=j.useRef(e),i=j.useRef("none"),l=e?"mounted":"unmounted",[o,f]=jF(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const c=gv(r.current);i.current=o==="mounted"?c:"none"},[o]),br(()=>{const c=r.current,h=a.current;if(h!==e){const m=i.current,y=gv(c);e?f("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?f("UNMOUNT"):f(h&&m!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,f]),br(()=>{if(t){let c;const h=t.ownerDocument.defaultView??window,p=y=>{const b=gv(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&b&&(f("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=y=>{y.target===t&&(i.current=gv(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:j.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function gv(e){return(e==null?void 0:e.animationName)||"none"}function RF(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sx=0;function SD(){j.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??PN()),document.body.insertAdjacentElement("beforeend",e[1]??PN()),sx++,()=>{sx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),sx--}},[])}function PN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var di=function(){return di=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},di.apply(this,arguments)};function ED(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function DF(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Kv="right-scroll-bar-position",Yv="width-before-scroll-bar",MF="with-scroll-bars-hidden",_F="--removed-body-scroll-bar-size";function lx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function OF(e,t){var n=j.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var LF=typeof window<"u"?j.useLayoutEffect:j.useEffect,BN=new WeakMap;function PF(e,t){var n=OF(null,function(r){return e.forEach(function(a){return lx(a,r)})});return LF(function(){var r=BN.get(n);if(r){var a=new Set(r),i=new Set(e),l=n.current;a.forEach(function(o){i.has(o)||lx(o,null)}),i.forEach(function(o){a.has(o)||lx(o,l)})}BN.set(n,e)},[e]),n}function BF(e){return e}function zF(e,t){t===void 0&&(t=BF);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(o){return o!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var o=n;n=[],o.forEach(i),l=n}var f=function(){var h=l;l=[],h.forEach(i)},c=function(){return Promise.resolve().then(f)};c(),n={push:function(h){l.push(h),c()},filter:function(h){return l=l.filter(h),n}}}};return a}function IF(e){e===void 0&&(e={});var t=zF(null);return t.options=di({async:!0,ssr:!1},e),t}var CD=function(e){var t=e.sideCar,n=ED(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return j.createElement(r,di({},n))};CD.isSideCarExport=!0;function FF(e,t){return e.useMedium(t),CD}var ND=IF(),ox=function(){},Qp=j.forwardRef(function(e,t){var n=j.useRef(null),r=j.useState({onScrollCapture:ox,onWheelCapture:ox,onTouchMoveCapture:ox}),a=r[0],i=r[1],l=e.forwardProps,o=e.children,f=e.className,c=e.removeScrollBar,h=e.enabled,p=e.shards,m=e.sideCar,y=e.noRelative,x=e.noIsolation,b=e.inert,w=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,C=e.gapMode,T=ED(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=m,A=PF([n,t]),D=di(di({},T),a);return j.createElement(j.Fragment,null,h&&j.createElement(R,{sideCar:ND,removeScrollBar:c,shards:p,noRelative:y,noIsolation:x,inert:b,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:C}),l?j.cloneElement(j.Children.only(o),di(di({},D),{ref:A})):j.createElement(N,di({},D,{className:f,ref:A}),o))});Qp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qp.classNames={fullWidth:Yv,zeroRight:Kv};var UF=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qF(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UF();return t&&e.setAttribute("nonce",t),e}function VF(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function HF(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var GF=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qF())&&(VF(t,n),HF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$F=function(){var e=GF();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kD=function(){var e=$F(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},KF={left:0,top:0,right:0,gap:0},ux=function(e){return parseInt(e||"",10)||0},YF=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[ux(n),ux(r),ux(a)]},XF=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return KF;var t=YF(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},QF=kD(),qu="data-scroll-locked",WF=function(e,t,n,r){var a=e.left,i=e.top,l=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
421
|
-
.`.concat(MF,` {
|
|
422
|
-
overflow: hidden `).concat(r,`;
|
|
423
|
-
padding-right: `).concat(o,"px ").concat(r,`;
|
|
424
|
-
}
|
|
425
|
-
body[`).concat(qu,`] {
|
|
426
|
-
overflow: hidden `).concat(r,`;
|
|
427
|
-
overscroll-behavior: contain;
|
|
428
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
429
|
-
padding-left: `.concat(a,`px;
|
|
430
|
-
padding-top: `).concat(i,`px;
|
|
431
|
-
padding-right: `).concat(l,`px;
|
|
432
|
-
margin-left:0;
|
|
433
|
-
margin-top:0;
|
|
434
|
-
margin-right: `).concat(o,"px ").concat(r,`;
|
|
435
|
-
`),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.`).concat(Kv,` {
|
|
439
|
-
right: `).concat(o,"px ").concat(r,`;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.`).concat(Yv,` {
|
|
443
|
-
margin-right: `).concat(o,"px ").concat(r,`;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.`).concat(Kv," .").concat(Kv,` {
|
|
447
|
-
right: 0 `).concat(r,`;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
.`).concat(Yv," .").concat(Yv,` {
|
|
451
|
-
margin-right: 0 `).concat(r,`;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
body[`).concat(qu,`] {
|
|
455
|
-
`).concat(_F,": ").concat(o,`px;
|
|
456
|
-
}
|
|
457
|
-
`)},zN=function(){var e=parseInt(document.body.getAttribute(qu)||"0",10);return isFinite(e)?e:0},ZF=function(){j.useEffect(function(){return document.body.setAttribute(qu,(zN()+1).toString()),function(){var e=zN()-1;e<=0?document.body.removeAttribute(qu):document.body.setAttribute(qu,e.toString())}},[])},JF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;ZF();var i=j.useMemo(function(){return XF(a)},[a]);return j.createElement(QF,{styles:WF(i,!t,a,n?"":"!important")})},Db=!1;if(typeof window<"u")try{var yv=Object.defineProperty({},"passive",{get:function(){return Db=!0,!0}});window.addEventListener("test",yv,yv),window.removeEventListener("test",yv,yv)}catch{Db=!1}var bu=Db?{passive:!1}:!1,e6=function(e){return e.tagName==="TEXTAREA"},TD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!e6(e)&&n[t]==="visible")},t6=function(e){return TD(e,"overflowY")},n6=function(e){return TD(e,"overflowX")},IN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=jD(e,r);if(a){var i=AD(e,r),l=i[1],o=i[2];if(l>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},r6=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},a6=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},jD=function(e,t){return e==="v"?t6(t):n6(t)},AD=function(e,t){return e==="v"?r6(t):a6(t)},i6=function(e,t){return e==="h"&&t==="rtl"?-1:1},s6=function(e,t,n,r,a){var i=i6(e,window.getComputedStyle(t).direction),l=i*r,o=n.target,f=t.contains(o),c=!1,h=l>0,p=0,m=0;do{if(!o)break;var y=AD(e,o),x=y[0],b=y[1],w=y[2],S=b-w-i*x;(x||S)&&jD(e,o)&&(p+=S,m+=x);var N=o.parentNode;o=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!f&&o!==document.body||f&&(t.contains(o)||t===o));return(h&&Math.abs(p)<1||!h&&Math.abs(m)<1)&&(c=!0),c},xv=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},FN=function(e){return[e.deltaX,e.deltaY]},UN=function(e){return e&&"current"in e?e.current:e},l6=function(e,t){return e[0]===t[0]&&e[1]===t[1]},o6=function(e){return`
|
|
458
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
459
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
460
|
-
`)},u6=0,wu=[];function c6(e){var t=j.useRef([]),n=j.useRef([0,0]),r=j.useRef(),a=j.useState(u6++)[0],i=j.useState(kD)[0],l=j.useRef(e);j.useEffect(function(){l.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=DF([e.lockRef.current],(e.shards||[]).map(UN),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=j.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var S=xv(b),N=n.current,C="deltaX"in b?b.deltaX:N[0]-S[0],T="deltaY"in b?b.deltaY:N[1]-S[1],R,A=b.target,D=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in b&&D==="h"&&A.type==="range")return!1;var O=window.getSelection(),L=O&&O.anchorNode,M=L?L===A||L.contains(A):!1;if(M)return!1;var B=IN(D,A);if(!B)return!0;if(B?R=D:(R=D==="v"?"h":"v",B=IN(D,A)),!B)return!1;if(!r.current&&"changedTouches"in b&&(C||T)&&(r.current=R),!R)return!0;var P=r.current||R;return s6(P,w,b,P==="h"?C:T)},[]),f=j.useCallback(function(b){var w=b;if(!(!wu.length||wu[wu.length-1]!==i)){var S="deltaY"in w?FN(w):xv(w),N=t.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&l6(R.delta,S)})[0];if(N&&N.should){w.cancelable&&w.preventDefault();return}if(!N){var C=(l.current.shards||[]).map(UN).filter(Boolean).filter(function(R){return R.contains(w.target)}),T=C.length>0?o(w,C[0]):!l.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),c=j.useCallback(function(b,w,S,N){var C={name:b,delta:w,target:S,should:N,shadowParent:f6(S)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(T){return T!==C})},1)},[]),h=j.useCallback(function(b){n.current=xv(b),r.current=void 0},[]),p=j.useCallback(function(b){c(b.type,FN(b),b.target,o(b,e.lockRef.current))},[]),m=j.useCallback(function(b){c(b.type,xv(b),b.target,o(b,e.lockRef.current))},[]);j.useEffect(function(){return wu.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",f,bu),document.addEventListener("touchmove",f,bu),document.addEventListener("touchstart",h,bu),function(){wu=wu.filter(function(b){return b!==i}),document.removeEventListener("wheel",f,bu),document.removeEventListener("touchmove",f,bu),document.removeEventListener("touchstart",h,bu)}},[]);var y=e.removeScrollBar,x=e.inert;return j.createElement(j.Fragment,null,x?j.createElement(i,{styles:o6(a)}):null,y?j.createElement(JF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function f6(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const d6=FF(ND,c6);var K1=j.forwardRef(function(e,t){return j.createElement(Qp,di({},e,{ref:t,sideCar:d6}))});K1.classNames=Qp.classNames;var h6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Su=new WeakMap,bv=new WeakMap,wv={},cx=0,RD=function(e){return e&&(e.host||RD(e.parentNode))},v6=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=RD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},p6=function(e,t,n,r){var a=v6(t,Array.isArray(e)?e:[e]);wv[n]||(wv[n]=new WeakMap);var i=wv[n],l=[],o=new Set,f=new Set(a),c=function(p){!p||o.has(p)||(o.add(p),c(p.parentNode))};a.forEach(c);var h=function(p){!p||f.has(p)||Array.prototype.forEach.call(p.children,function(m){if(o.has(m))h(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",b=(Su.get(m)||0)+1,w=(i.get(m)||0)+1;Su.set(m,b),i.set(m,w),l.push(m),b===1&&x&&bv.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",m,S)}})};return h(t),o.clear(),cx++,function(){l.forEach(function(p){var m=Su.get(p)-1,y=i.get(p)-1;Su.set(p,m),i.set(p,y),m||(bv.has(p)||p.removeAttribute(r),bv.delete(p)),y||p.removeAttribute(n)}),cx--,cx||(Su=new WeakMap,Su=new WeakMap,bv=new WeakMap,wv={})}},DD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=h6(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),p6(r,a,n,"aria-hidden")):function(){return null}},Wp="Dialog",[MD]=Yp(Wp),[m6,Ja]=MD(Wp),_D=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!0}=e,o=j.useRef(null),f=j.useRef(null),[c,h]=vp({prop:r,defaultProp:a??!1,onChange:i,caller:Wp});return d.jsx(m6,{scope:t,triggerRef:o,contentRef:f,contentId:Uu(),titleId:Uu(),descriptionId:Uu(),open:c,onOpenChange:h,onOpenToggle:j.useCallback(()=>h(p=>!p),[h]),modal:l,children:n})};_D.displayName=Wp;var OD="DialogTrigger",LD=j.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ja(OD,n),i=jn(t,a.triggerRef);return d.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Q1(a.open),...r,ref:i,onClick:tn(e.onClick,a.onOpenToggle)})});LD.displayName=OD;var Y1="DialogPortal",[g6,PD]=MD(Y1,{forceMount:void 0}),BD=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=Ja(Y1,t);return d.jsx(g6,{scope:t,forceMount:n,children:j.Children.map(r,l=>d.jsx(Xp,{present:n||i.open,children:d.jsx($1,{asChild:!0,container:a,children:l})}))})};BD.displayName=Y1;var pp="DialogOverlay",zD=j.forwardRef((e,t)=>{const n=PD(pp,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Ja(pp,e.__scopeDialog);return i.modal?d.jsx(Xp,{present:r||i.open,children:d.jsx(x6,{...a,ref:t})}):null});zD.displayName=pp;var y6=ld("DialogOverlay.RemoveScroll"),x6=j.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ja(pp,n);return d.jsx(K1,{as:y6,allowPinchZoom:!0,shards:[a.contentRef],children:d.jsx(Zt.div,{"data-state":Q1(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),No="DialogContent",ID=j.forwardRef((e,t)=>{const n=PD(No,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Ja(No,e.__scopeDialog);return d.jsx(Xp,{present:r||i.open,children:i.modal?d.jsx(b6,{...a,ref:t}):d.jsx(w6,{...a,ref:t})})});ID.displayName=No;var b6=j.forwardRef((e,t)=>{const n=Ja(No,e.__scopeDialog),r=j.useRef(null),a=jn(t,n.contentRef,r);return j.useEffect(()=>{const i=r.current;if(i)return DD(i)},[]),d.jsx(FD,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tn(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:tn(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,o=l.button===0&&l.ctrlKey===!0;(l.button===2||o)&&i.preventDefault()}),onFocusOutside:tn(e.onFocusOutside,i=>i.preventDefault())})}),w6=j.forwardRef((e,t)=>{const n=Ja(No,e.__scopeDialog),r=j.useRef(!1),a=j.useRef(!1);return d.jsx(FD,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,o;(l=e.onCloseAutoFocus)==null||l.call(e,i),i.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var f,c;(f=e.onInteractOutside)==null||f.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),FD=j.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...l}=e,o=Ja(No,n),f=j.useRef(null),c=jn(t,f);return SD(),d.jsxs(d.Fragment,{children:[d.jsx(G1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:d.jsx(H1,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":Q1(o.open),...l,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(S6,{titleId:o.titleId}),d.jsx(C6,{contentRef:f,descriptionId:o.descriptionId})]})]})}),X1="DialogTitle",UD=j.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ja(X1,n);return d.jsx(Zt.h2,{id:a.titleId,...r,ref:t})});UD.displayName=X1;var qD="DialogDescription",VD=j.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ja(qD,n);return d.jsx(Zt.p,{id:a.descriptionId,...r,ref:t})});VD.displayName=qD;var HD="DialogClose",GD=j.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ja(HD,n);return d.jsx(Zt.button,{type:"button",...r,ref:t,onClick:tn(e.onClick,()=>a.onOpenChange(!1))})});GD.displayName=HD;function Q1(e){return e?"open":"closed"}var $D="DialogTitleWarning",[Die,KD]=ZI($D,{contentName:No,titleName:X1,docsSlug:"dialog"}),S6=({titleId:e})=>{const t=KD($D),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
461
|
-
|
|
462
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
463
|
-
|
|
464
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},E6="DialogDescriptionWarning",C6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${KD(E6).contentName}}.`;return j.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},N6=_D,k6=LD,T6=BD,YD=zD,XD=ID,QD=UD,WD=VD,j6=GD;const _d=N6,A6=k6,R6=T6,ZD=j.forwardRef(({className:e,...t},n)=>d.jsx(YD,{ref:n,className:ke("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));ZD.displayName=YD.displayName;const wc=j.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(R6,{children:[d.jsx(ZD,{}),d.jsxs(XD,{ref:r,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg",e),...n,children:[t,d.jsxs(j6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[d.jsx(jl,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wc.displayName=XD.displayName;function Od({className:e,...t}){return d.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}Od.displayName="DialogHeader";function Zp({className:e,...t}){return d.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}Zp.displayName="DialogFooter";const Sc=j.forwardRef(({className:e,...t},n)=>d.jsx(QD,{ref:n,className:ke("text-lg font-serif font-semibold leading-none tracking-tight",e),...t}));Sc.displayName=QD.displayName;const Jp=j.forwardRef(({className:e,...t},n)=>d.jsx(WD,{ref:n,className:ke("text-sm text-on-surface-variant",e),...t}));Jp.displayName=WD.displayName;const fn=j.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:ke("flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface","placeholder:text-on-surface-variant/50","focus-visible:outline-none focus-visible:border-primary/40","disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));fn.displayName="Input";var JD="Toggle",eM=j.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=e,[l,o]=vp({prop:n,onChange:a,defaultProp:r??!1,caller:JD});return d.jsx(Zt.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:tn(e.onClick,()=>{e.disabled||o(!l)})})});eM.displayName=JD;var tM=eM;const D6=Kp("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary",{variants:{variant:{default:"bg-surface-container-high text-on-surface-variant",outline:"border border-input bg-surface-container-high text-on-surface-variant shadow-sm hover:bg-surface-container-high/80 hover:text-on-surface-variant"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Mb=j.forwardRef(({className:e,variant:t,size:n,...r},a)=>d.jsx(tM,{ref:a,className:ke(D6({variant:t,size:n,className:e})),...r}));Mb.displayName=tM.displayName;const M6=Kp("inline-flex items-center rounded-sm px-2 py-0.5 font-sans text-xs font-medium transition-colors",{variants:{variant:{default:"bg-primary/15 text-primary",secondary:"bg-surface-container-high text-on-surface-variant",destructive:"bg-tertiary/15 text-tertiary",warning:"bg-secondary/15 text-secondary",outline:"border border-[var(--ghost-border)] text-on-surface-variant"}},defaultVariants:{variant:"default"}});function xt({className:e,variant:t,...n}){return d.jsx("div",{className:ke(M6({variant:t}),e),...n})}const _6=120,O6={session:{label:"Sessions",icon:Gp},spore:{label:"Spores",icon:I1},plan:{label:"Plans",icon:jz},prompt_batch:{label:"Prompt Batches",icon:kb},activity:{label:"Activities",icon:kb}};function nM(e){return O6[e]??{label:e,icon:Lz}}function L6(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function P6({score:e}){const t=Math.round(e*100);return d.jsxs(xt,{variant:"outline",className:"shrink-0 text-xs tabular-nums text-on-surface-variant",children:[t,"%"]})}function B6({result:e,onSelect:t,isHighlighted:n}){const{icon:r}=nM(e.type);return d.jsxs("button",{type:"button",onClick:()=>t(e),className:["w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors",n?"bg-surface-container-high text-on-surface":"hover:bg-surface-container-high hover:text-on-surface"].join(" "),children:[d.jsx(r,{className:"h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("span",{className:"text-sm font-medium truncate",children:e.title})}),e.preview&&d.jsx("p",{className:"text-xs text-on-surface-variant mt-0.5 line-clamp-2",children:L6(e.preview,_6)})]}),d.jsx(P6,{score:e.score})]})}function z6({results:e,onSelect:t,highlightedIndex:n}){const r=e.reduce((i,l)=>{const o=l.type??"unknown";return(i[o]??(i[o]=[])).push(l),i},{});let a=0;return d.jsx("div",{className:"py-2 space-y-1",children:Object.entries(r).map(([i,l])=>{const{label:o}=nM(i),f=a;return a+=l.length,d.jsxs("div",{children:[d.jsx("div",{className:"px-3 py-1",children:d.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-on-surface-variant",children:o})}),l.map((c,h)=>d.jsx(B6,{result:c,onSelect:t,isHighlighted:n===f+h},c.id))]},i)})})}const I6=2,F6=3e4;function U6(e,t="semantic"){return qt({queryKey:["search",e,t],queryFn:({signal:n})=>lt(`/search?q=${encodeURIComponent(e)}&mode=${t}`,{signal:n}),enabled:e.length>I6,staleTime:F6})}const q6=300,V6=20;function H6(e){switch(e.type){case"session":return`/sessions/${e.id}`;case"spore":return`/mycelium?tab=spores&spore=${encodeURIComponent(e.id)}`;case"plan":return e.session_id?`/sessions/${e.session_id}?tab=plans&plan=${encodeURIComponent(e.id)}`:"/sessions";case"prompt_batch":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"activity":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"skill":return`/skills?skill=${encodeURIComponent(e.id)}`;default:return"/"}}function G6({open:e,onOpenChange:t}){const n=Za(),[r,a]=j.useState(""),[i,l]=j.useState(""),[o,f]=j.useState("semantic"),[c,h]=j.useState(0),p=j.useRef(null);j.useEffect(()=>{const C=setTimeout(()=>{l(r.trim())},q6);return()=>clearTimeout(C)},[r]),j.useEffect(()=>{e&&(a(""),l(""),h(0),setTimeout(()=>{var C;return(C=p.current)==null?void 0:C.focus()},50))},[e]);const{data:m,isLoading:y}=U6(i,o),x=((m==null?void 0:m.results)??[]).slice(0,V6);j.useEffect(()=>{h(0)},[x.length,i]);const b=j.useCallback(C=>{const T=H6(C);t(!1),n(T)},[n,t]),w=j.useCallback(C=>{if(x.length!==0){if(C.key==="ArrowDown")C.preventDefault(),h(T=>Math.min(T+1,x.length-1));else if(C.key==="ArrowUp")C.preventDefault(),h(T=>Math.max(T-1,0));else if(C.key==="Enter"){C.preventDefault();const T=x[c];T&&b(T)}}},[x,c,b]),S=i.length>2&&!y&&x.length===0,N=i.length<=2&&!y;return d.jsx(_d,{open:e,onOpenChange:t,children:d.jsxs(wc,{className:"max-w-2xl p-0 gap-0 overflow-hidden",onKeyDown:w,children:[d.jsx(Sc,{className:"sr-only",children:"Search vault"}),d.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3",children:[d.jsx(xc,{className:"h-4 w-4 shrink-0 text-on-surface-variant"}),d.jsx(fn,{ref:p,value:r,onChange:C=>a(C.target.value),placeholder:"Search sessions, spores, plans…",className:"border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono"}),d.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[d.jsx(Mb,{size:"sm",pressed:o==="semantic",onPressedChange:()=>f("semantic"),"aria-label":"Semantic search",title:"Semantic (embedded knowledge)",children:"Semantic"}),d.jsx(Mb,{size:"sm",pressed:o==="fts",onPressedChange:()=>f("fts"),"aria-label":"Full-text search",title:"Full text (raw data)",children:"Full Text"})]})]}),d.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[y&&i.length>2&&d.jsx("div",{className:"px-4 py-8 text-center",children:d.jsxs("div",{className:"flex flex-col items-center gap-2 text-on-surface-variant",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),d.jsx("div",{className:"h-3 w-24 rounded bg-muted animate-pulse"}),d.jsx("div",{className:"h-3 w-28 rounded bg-muted animate-pulse"})]})}),N&&d.jsx("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:"Type to search your vault…"}),S&&d.jsxs("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:["No results for ",d.jsxs("span",{className:"font-medium text-on-surface",children:['"',i,'"']})]}),x.length>0&&!y&&d.jsx(z6,{results:x,onSelect:b,highlightedIndex:c})]}),d.jsxs("div",{className:"border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant",children:[d.jsxs("span",{children:[d.jsx("kbd",{className:"font-mono",children:"↑↓"})," navigate"]}),d.jsxs("span",{children:[d.jsx("kbd",{className:"font-mono",children:"↵"})," open"]}),d.jsxs("span",{children:[d.jsx("kbd",{className:"font-mono",children:"Esc"})," close"]}),d.jsx("span",{className:"ml-auto",children:(m==null?void 0:m.mode)&&x.length>0&&`${x.length} result${x.length!==1?"s":""} · ${m.mode}`})]})]})})}const $6=Kn.LOGS;function K6(){return Or({queryKey:["notifications","unread-count"],queryFn:({signal:e})=>lt("/notifications/unread-count",{signal:e}),refetchInterval:$6,pollCategory:"standard"})}function W1(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.domain&&t.set("domain",e.domain),e!=null&&e.mode&&t.set("mode",e.mode),e!=null&&e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=n?`/notifications?${n}`:"/notifications";return Or({queryKey:["notifications","list",e],queryFn:({signal:a})=>lt(r,{signal:a}),enabled:e==null?void 0:e.enabled,pollCategory:(e==null?void 0:e.pollCategory)??"standard",refetchInterval:(e==null?void 0:e.refetchInterval)??!1})}function Y6(){return qt({queryKey:["notifications","registry"],queryFn:({signal:e})=>lt("/notifications/registry",{signal:e}),staleTime:6e4})}function rM(){const e=Sn();return Er({mutationFn:({id:t,status:n})=>lt(`/notifications/${t}`,{method:"PATCH",body:JSON.stringify({status:n}),headers:{"Content-Type":"application/json"}}),onSuccess:()=>{e.invalidateQueries({queryKey:["notifications"]})}})}function X6(){const e=Sn();return Er({mutationFn:t=>nn("/notifications/dismiss-all",t?{domain:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["notifications"]})}})}function Q6(){const e=Sn();return Er({mutationFn:t=>nn("/notifications/mark-all-read",t?{domain:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["notifications"]})}})}const W6=3,Z6=5e3,J6=12,eU=400,tU="notification-banner",nU={info:"bg-primary/10 border-primary/20 text-primary",success:"bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400",warning:"bg-secondary/10 border-secondary/20 text-secondary",error:"bg-tertiary/10 border-tertiary/20 text-tertiary"},rU={info:B1,success:yc,warning:sD,error:Cr};function aU({panelOpen:e=!1}){const{data:t}=W1({status:"unread",mode:"banner",limit:W6,pollCategory:"realtime",refetchInterval:Kn.LOGS}),n=rM(),r=Za(),[a,i]=j.useState(new Set),l=((t==null?void 0:t.items)??[]).filter(c=>!a.has(c.id));if(j.useEffect(()=>{const c=[];for(const h of l)c.push(setTimeout(()=>{i(p=>new Set(p).add(h.id)),n.mutate({id:h.id,status:"read"})},Z6));return()=>c.forEach(clearTimeout)},[l.map(c=>c.id).join(",")]),l.length===0)return null;const o=c=>{n.mutate({id:c.id,status:"read"}),i(h=>new Set(h).add(c.id)),c.link&&r(c.link,{state:{source:tU,triggeredAt:Date.now()}})},f=(c,h)=>{c.stopPropagation(),i(p=>new Set(p).add(h.id)),n.mutate({id:h.id,status:"read"})};return d.jsx("div",{className:"fixed top-3 z-[60] flex w-80 flex-col gap-2",style:{right:e?eU:J6},children:l.map(c=>{const h=rU[c.level];return d.jsxs("div",{onClick:()=>o(c),className:ke("flex items-start gap-2 rounded-md border px-3 py-2.5 text-sm shadow-lg cursor-pointer transition-all animate-in slide-in-from-right-5 fade-in duration-200",nU[c.level]),children:[d.jsx(h,{className:"h-4 w-4 mt-0.5 shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"font-medium truncate",children:c.title}),c.message&&d.jsx("div",{className:"text-xs mt-0.5 opacity-80 line-clamp-2",children:c.message})]}),d.jsx("button",{onClick:p=>f(p,c),className:"shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 transition-opacity","aria-label":"Dismiss",children:d.jsx(jl,{className:"h-3.5 w-3.5"})})]},c.id)})})}function iU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sU=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lU=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oU={};function qN(e,t){return(oU.jsx?lU:sU).test(e)}const uU=/[ \t\n\f\r]/g;function cU(e){return typeof e=="object"?e.type==="text"?VN(e.value):!1:VN(e)}function VN(e){return e.replace(uU,"")===""}class Ld{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ld.prototype.normal={};Ld.prototype.property={};Ld.prototype.space=void 0;function aM(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Ld(n,r,t)}function _b(e){return e.toLowerCase()}class Zr{constructor(t,n){this.attribute=n,this.property=t}}Zr.prototype.attribute="";Zr.prototype.booleanish=!1;Zr.prototype.boolean=!1;Zr.prototype.commaOrSpaceSeparated=!1;Zr.prototype.commaSeparated=!1;Zr.prototype.defined=!1;Zr.prototype.mustUseProperty=!1;Zr.prototype.number=!1;Zr.prototype.overloadedBoolean=!1;Zr.prototype.property="";Zr.prototype.spaceSeparated=!1;Zr.prototype.space=void 0;let fU=0;const yt=Po(),On=Po(),Ob=Po(),je=Po(),en=Po(),Vu=Po(),la=Po();function Po(){return 2**++fU}const Lb=Object.freeze(Object.defineProperty({__proto__:null,boolean:yt,booleanish:On,commaOrSpaceSeparated:la,commaSeparated:Vu,number:je,overloadedBoolean:Ob,spaceSeparated:en},Symbol.toStringTag,{value:"Module"})),fx=Object.keys(Lb);class Z1 extends Zr{constructor(t,n,r,a){let i=-1;if(super(t,n),HN(this,"space",a),typeof r=="number")for(;++i<fx.length;){const l=fx[i];HN(this,fx[i],(r&Lb[l])===Lb[l])}}}Z1.prototype.defined=!0;function HN(e,t,n){n&&(e[t]=n)}function Ec(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Z1(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[_b(r)]=r,n[_b(i.attribute)]=r}return new Ld(t,n,e.space)}const iM=Ec({properties:{ariaActiveDescendant:null,ariaAtomic:On,ariaAutoComplete:null,ariaBusy:On,ariaChecked:On,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:en,ariaCurrent:null,ariaDescribedBy:en,ariaDetails:null,ariaDisabled:On,ariaDropEffect:en,ariaErrorMessage:null,ariaExpanded:On,ariaFlowTo:en,ariaGrabbed:On,ariaHasPopup:null,ariaHidden:On,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:en,ariaLevel:je,ariaLive:null,ariaModal:On,ariaMultiLine:On,ariaMultiSelectable:On,ariaOrientation:null,ariaOwns:en,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:On,ariaReadOnly:On,ariaRelevant:null,ariaRequired:On,ariaRoleDescription:en,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:On,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sM(e,t){return t in e?e[t]:t}function lM(e,t){return sM(e,t.toLowerCase())}const dU=Ec({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vu,acceptCharset:en,accessKey:en,action:null,allow:null,allowFullScreen:yt,allowPaymentRequest:yt,allowUserMedia:yt,alt:null,as:null,async:yt,autoCapitalize:null,autoComplete:en,autoFocus:yt,autoPlay:yt,blocking:en,capture:null,charSet:null,checked:yt,cite:null,className:en,cols:je,colSpan:null,content:null,contentEditable:On,controls:yt,controlsList:en,coords:je|Vu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:yt,defer:yt,dir:null,dirName:null,disabled:yt,download:Ob,draggable:On,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:yt,formTarget:null,headers:en,height:je,hidden:Ob,high:je,href:null,hrefLang:null,htmlFor:en,httpEquiv:en,id:null,imageSizes:null,imageSrcSet:null,inert:yt,inputMode:null,integrity:null,is:null,isMap:yt,itemId:null,itemProp:en,itemRef:en,itemScope:yt,itemType:en,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:yt,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:yt,muted:yt,name:null,nonce:null,noModule:yt,noValidate:yt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:yt,optimum:je,pattern:null,ping:en,placeholder:null,playsInline:yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:yt,referrerPolicy:null,rel:en,required:yt,reversed:yt,rows:je,rowSpan:je,sandbox:en,scope:null,scoped:yt,seamless:yt,selected:yt,shadowRootClonable:yt,shadowRootDelegatesFocus:yt,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:On,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:yt,useMap:null,value:On,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:en,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:yt,declare:yt,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:yt,noHref:yt,noShade:yt,noWrap:yt,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:On,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:yt,disableRemotePlayback:yt,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:lM}),hU=Ec({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:la,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:en,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vu,g2:Vu,glyphName:Vu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:la,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:je,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:en,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:la,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:la,rev:la,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:la,requiredFeatures:la,requiredFonts:la,requiredFormats:la,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:la,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:la,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:la,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sM}),oM=Ec({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),uM=Ec({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lM}),cM=Ec({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vU={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},pU=/[A-Z]/g,GN=/-[a-z]/g,mU=/^data[-\w.:]+$/i;function gU(e,t){const n=_b(t);let r=t,a=Zr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mU.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(GN,xU);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!GN.test(i)){let l=i.replace(pU,yU);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=Z1}return new a(r,t)}function yU(e){return"-"+e.toLowerCase()}function xU(e){return e.charAt(1).toUpperCase()}const bU=aM([iM,dU,oM,uM,cM],"html"),J1=aM([iM,hU,oM,uM,cM],"svg");function wU(e){return e.join(" ").trim()}var Eu={},dx,$N;function SU(){if($N)return dx;$N=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
|
|
465
|
-
`,c="/",h="*",p="",m="comment",y="declaration";function x(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var N=1,C=1;function T(H){var G=H.match(t);G&&(N+=G.length);var F=H.lastIndexOf(f);C=~F?H.length-F:C+H.length}function R(){var H={line:N,column:C};return function(G){return G.position=new A(H),L(),G}}function A(H){this.start=H,this.end={line:N,column:C},this.source=S.source}A.prototype.content=w;function D(H){var G=new Error(S.source+":"+N+":"+C+": "+H);if(G.reason=H,G.filename=S.source,G.line=N,G.column=C,G.source=w,!S.silent)throw G}function O(H){var G=H.exec(w);if(G){var F=G[0];return T(F),w=w.slice(F.length),G}}function L(){O(n)}function M(H){var G;for(H=H||[];G=B();)G!==!1&&H.push(G);return H}function B(){var H=R();if(!(c!=w.charAt(0)||h!=w.charAt(1))){for(var G=2;p!=w.charAt(G)&&(h!=w.charAt(G)||c!=w.charAt(G+1));)++G;if(G+=2,p===w.charAt(G-1))return D("End of comment missing");var F=w.slice(2,G-2);return C+=2,T(F),w=w.slice(G),C+=2,H({type:m,comment:F})}}function P(){var H=R(),G=O(r);if(G){if(B(),!O(a))return D("property missing ':'");var F=O(i),V=H({type:y,property:b(G[0].replace(e,p)),value:F?b(F[0].replace(e,p)):p});return O(l),V}}function q(){var H=[];M(H);for(var G;G=P();)G!==!1&&(H.push(G),M(H));return H}return L(),q()}function b(w){return w?w.replace(o,p):p}return dx=x,dx}var KN;function EU(){if(KN)return Eu;KN=1;var e=Eu&&Eu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.default=n;const t=e(SU());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const l=(0,t.default)(r),o=typeof a=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:c,value:h}=f;o?a(c,h,f):h&&(i=i||{},i[c]=h)}),i}return Eu}var Df={},YN;function CU(){if(YN)return Df;YN=1,Object.defineProperty(Df,"__esModule",{value:!0}),Df.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},l=function(c,h){return h.toUpperCase()},o=function(c,h){return"".concat(h,"-")},f=function(c,h){return h===void 0&&(h={}),i(c)?c:(c=c.toLowerCase(),h.reactCompat?c=c.replace(a,o):c=c.replace(r,o),c.replace(t,l))};return Df.camelCase=f,Df}var Mf,XN;function NU(){if(XN)return Mf;XN=1;var e=Mf&&Mf.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(EU()),n=CU();function r(a,i){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(o,f){o&&f&&(l[(0,n.camelCase)(o,i)]=f)}),l}return r.default=r,Mf=r,Mf}var kU=NU();const TU=kd(kU),fM=dM("end"),ew=dM("start");function dM(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function jU(e){const t=ew(e),n=fM(e);if(t&&n)return{start:t,end:n}}function Wf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?QN(e.position):"start"in e||"end"in e?QN(e):"line"in e||"column"in e?Pb(e):""}function Pb(e){return WN(e&&e.line)+":"+WN(e&&e.column)}function QN(e){return Pb(e&&e.start)+"-"+Pb(e&&e.end)}function WN(e){return e&&typeof e=="number"?e:1}class Nr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(l=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?i.ruleId=r:(i.source=r.slice(0,f),i.ruleId=r.slice(f+1))}if(!i.place&&i.ancestors&&i.ancestors){const f=i.ancestors[i.ancestors.length-1];f&&(i.place=f.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Wf(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nr.prototype.file="";Nr.prototype.name="";Nr.prototype.reason="";Nr.prototype.message="";Nr.prototype.stack="";Nr.prototype.column=void 0;Nr.prototype.line=void 0;Nr.prototype.ancestors=void 0;Nr.prototype.cause=void 0;Nr.prototype.fatal=void 0;Nr.prototype.place=void 0;Nr.prototype.ruleId=void 0;Nr.prototype.source=void 0;const tw={}.hasOwnProperty,AU=new Map,RU=/[A-Z]/g,DU=new Set(["table","tbody","thead","tfoot","tr"]),MU=new Set(["td","th"]),hM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _U(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=UU(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=FU(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?J1:bU,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=vM(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function vM(e,t,n){if(t.type==="element")return OU(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BU(e,t,n);if(t.type==="mdxjsEsm")return PU(e,t);if(t.type==="root")return zU(e,t,n);if(t.type==="text")return IU(e,t)}function OU(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=J1,e.schema=a),e.ancestors.push(t);const i=mM(e,t.tagName,!1),l=qU(e,t);let o=rw(e,t);return DU.has(t.tagName)&&(o=o.filter(function(f){return typeof f=="string"?!cU(f):!0})),pM(e,l,i,t),nw(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function LU(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}od(e,t.position)}function PU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);od(e,t.position)}function BU(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=J1,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:mM(e,t.name,!0),l=VU(e,t),o=rw(e,t);return pM(e,l,i,t),nw(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function zU(e,t,n){const r={};return nw(r,rw(e,t)),e.create(t,e.Fragment,r,n)}function IU(e,t){return t.value}function pM(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function FU(e,t,n){return r;function r(a,i,l,o){const c=Array.isArray(l.children)?n:t;return o?c(i,l,o):c(i,l)}}function UU(e,t){return n;function n(r,a,i,l){const o=Array.isArray(i.children),f=ew(r);return t(a,i,l,o,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function qU(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&tw.call(t.properties,a)){const i=HU(e,a,t.properties[a]);if(i){const[l,o]=i;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&MU.has(t.tagName)?r=o:n[l]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function VU(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else od(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else od(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function rw(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:AU;for(;++r<t.children.length;){const i=t.children[r];let l;if(e.passKeys){const f=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(f){const c=a.get(f)||0;l=f+"-"+c,a.set(f,c+1)}}const o=vM(e,i,l);o!==void 0&&n.push(o)}return n}function HU(e,t,n){const r=gU(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?iU(n):wU(n)),r.property==="style"){let a=typeof n=="object"?n:GU(e,String(n));return e.stylePropertyNameCase==="css"&&(a=$U(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?vU[r.property]||r.property:r.attribute,n]}}function GU(e,t){try{return TU(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Nr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=hM+"#cannot-parse-style-attribute",a}}function mM(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,l;for(;++i<a.length;){const o=qN(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=l}else r=qN(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return tw.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);od(e)}function od(e,t){const n=new Nr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=hM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function $U(e){const t={};let n;for(n in e)tw.call(e,n)&&(t[KU(n)]=e[n]);return t}function KU(e){let t=e.replace(RU,YU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YU(e){return"-"+e.toLowerCase()}const hx={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},XU={};function aw(e,t){const n=XU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gM(e,r,a)}function gM(e,t,n){if(QU(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ZN(e.children,t,n)}return Array.isArray(e)?ZN(e,t,n):""}function ZN(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=gM(e[a],t,n);return r.join("")}function QU(e){return!!(e&&typeof e=="object")}const JN=document.createElement("i");function iw(e){const t="&"+e+";";JN.innerHTML=t;const n=JN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ca(e,t,n,r){const a=e.length;let i=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);i<r.length;)l=r.slice(i,i+1e4),l.unshift(t,0),e.splice(...l),i+=1e4,t+=1e4}function Da(e,t){return e.length>0?(ca(e,e.length,0,t),e):t}const ek={}.hasOwnProperty;function yM(e){const t={};let n=-1;for(;++n<e.length;)WU(t,e[n]);return t}function WU(e,t){let n;for(n in t){const a=(ek.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let l;if(i)for(l in i){ek.call(a,l)||(a[l]=[]);const o=i[l];ZU(a[l],Array.isArray(o)?o:o?[o]:[])}}}function ZU(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ca(e,0,0,r)}function xM(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ha(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dr=Al(/[A-Za-z]/),xr=Al(/[\dA-Za-z]/),JU=Al(/[#-'*+\--9=?A-Z^-~]/);function mp(e){return e!==null&&(e<32||e===127)}const Bb=Al(/\d/),eq=Al(/[\dA-Fa-f]/),tq=Al(/[!-/:-@[-`{-~]/);function rt(e){return e!==null&&e<-2}function Wt(e){return e!==null&&(e<0||e===32)}function Nt(e){return e===-2||e===-1||e===32}const em=Al(new RegExp("\\p{P}|\\p{S}","u")),ko=Al(/\s/);function Al(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Cc(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let l="";if(i===37&&xr(e.charCodeAt(n+1))&&xr(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(l=String.fromCharCode(i,o),a=1):l="�"}else l=String.fromCharCode(i);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Rt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(f){return Nt(f)?(e.enter(n),o(f)):t(f)}function o(f){return Nt(f)&&i++<a?(e.consume(f),o):(e.exit(n),t(f))}}const nq={tokenize:rq};function rq(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Rt(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return rt(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),l)}}const aq={tokenize:iq},tk={tokenize:sq};function iq(e){const t=this,n=[];let r=0,a,i,l;return o;function o(C){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,f,c)(C)}return c(C)}function f(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&N();const T=t.events.length;let R=T,A;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){A=t.events[R][1].end;break}S(r);let D=T;for(;D<t.events.length;)t.events[D][1].end={...A},D++;return ca(t.events,R+1,0,t.events.slice(T)),t.events.length=D,c(C)}return o(C)}function c(C){if(r===n.length){if(!a)return m(C);if(a.currentConstruct&&a.currentConstruct.concrete)return x(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(tk,h,p)(C)}function h(C){return a&&N(),S(r),m(C)}function p(C){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(C)}function m(C){return t.containerState={},e.attempt(tk,y,x)(C)}function y(C){return r++,n.push([t.currentConstruct,t.containerState]),m(C)}function x(C){if(C===null){a&&N(),S(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),b(C)}function b(C){if(C===null){w(e.exit("chunkFlow"),!0),S(0),e.consume(C);return}return rt(C)?(e.consume(C),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(C),b)}function w(C,T){const R=t.sliceStream(C);if(T&&R.push(null),C.previous=i,i&&(i.next=C),i=C,a.defineSkip(C.start),a.write(R),t.parser.lazy[C.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<l&&(!a.events[A][1].end||a.events[A][1].end.offset>l))return;const D=t.events.length;let O=D,L,M;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(L){M=t.events[O][1].end;break}L=!0}for(S(r),A=D;A<t.events.length;)t.events[A][1].end={...M},A++;ca(t.events,O+1,0,t.events.slice(D)),t.events.length=A}}function S(C){let T=n.length;for(;T-- >C;){const R=n[T];t.containerState=R[1],R[0].exit.call(t,e)}n.length=C}function N(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function sq(e,t,n){return Rt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oc(e){if(e===null||Wt(e)||ko(e))return 1;if(em(e))return 2}function tm(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const zb={name:"attention",resolveAll:lq,tokenize:oq};function lq(e,t){let n=-1,r,a,i,l,o,f,c,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[n][1].start};nk(p,-f),nk(m,f),l={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},o={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Da(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Da(c,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",i,t]]),c=Da(c,tm(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Da(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,c=Da(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,ca(e,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oq(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=oc(r);let i;return l;function l(f){return i=f,e.enter("attentionSequence"),o(f)}function o(f){if(f===i)return e.consume(f),o;const c=e.exit("attentionSequence"),h=oc(f),p=!h||h===2&&a||n.includes(f),m=!a||a===2&&h||n.includes(r);return c._open=!!(i===42?p:p&&(a||!m)),c._close=!!(i===42?m:m&&(h||!p)),t(f)}}function nk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uq={name:"autolink",tokenize:cq};function cq(e,t,n){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Dr(y)?(e.consume(y),l):y===64?n(y):c(y)}function l(y){return y===43||y===45||y===46||xr(y)?(r=1,o(y)):c(y)}function o(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||xr(y))&&r++<32?(e.consume(y),o):(r=0,c(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||mp(y)?n(y):(e.consume(y),f)}function c(y){return y===64?(e.consume(y),h):JU(y)?(e.consume(y),c):n(y)}function h(y){return xr(y)?p(y):n(y)}function p(y){return y===46?(e.consume(y),r=0,h):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):m(y)}function m(y){if((y===45||xr(y))&&r++<63){const x=y===45?m:p;return e.consume(y),x}return n(y)}}const Pd={partial:!0,tokenize:fq};function fq(e,t,n){return r;function r(i){return Nt(i)?Rt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||rt(i)?t(i):n(i)}}const bM={continuation:{tokenize:hq},exit:vq,name:"blockQuote",tokenize:dq};function dq(e,t,n){const r=this;return a;function a(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),i}return n(l)}function i(l){return Nt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function hq(e,t,n){const r=this;return a;function a(l){return Nt(l)?Rt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return e.attempt(bM,t,n)(l)}}function vq(e){e.exit("blockQuote")}const wM={name:"characterEscape",tokenize:pq};function pq(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return tq(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const SM={name:"characterReference",tokenize:mq};function mq(e,t,n){const r=this;let a=0,i,l;return o;function o(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),f}function f(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,l=xr,h(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,l=eq,h):(e.enter("characterReferenceValue"),i=7,l=Bb,h(p))}function h(p){if(p===59&&a){const m=e.exit("characterReferenceValue");return l===xr&&!iw(r.sliceSerialize(m))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&a++<i?(e.consume(p),h):n(p)}}const rk={partial:!0,tokenize:yq},ak={concrete:!0,name:"codeFenced",tokenize:gq};function gq(e,t,n){const r=this,a={partial:!0,tokenize:R};let i=0,l=0,o;return f;function f(A){return c(A)}function c(A){const D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,o=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(A)}function h(A){return A===o?(l++,e.consume(A),h):l<3?n(A):(e.exit("codeFencedFenceSequence"),Nt(A)?Rt(e,p,"whitespace")(A):p(A))}function p(A){return A===null||rt(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(rk,b,T)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||rt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(A)):Nt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Rt(e,y,"whitespace")(A)):A===96&&A===o?n(A):(e.consume(A),m)}function y(A){return A===null||rt(A)?p(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(A))}function x(A){return A===null||rt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(A)):A===96&&A===o?n(A):(e.consume(A),x)}function b(A){return e.attempt(a,T,w)(A)}function w(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),S}function S(A){return i>0&&Nt(A)?Rt(e,N,"linePrefix",i+1)(A):N(A)}function N(A){return A===null||rt(A)?e.check(rk,b,T)(A):(e.enter("codeFlowValue"),C(A))}function C(A){return A===null||rt(A)?(e.exit("codeFlowValue"),N(A)):(e.consume(A),C)}function T(A){return e.exit("codeFenced"),t(A)}function R(A,D,O){let L=0;return M;function M(G){return A.enter("lineEnding"),A.consume(G),A.exit("lineEnding"),B}function B(G){return A.enter("codeFencedFence"),Nt(G)?Rt(A,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):P(G)}function P(G){return G===o?(A.enter("codeFencedFenceSequence"),q(G)):O(G)}function q(G){return G===o?(L++,A.consume(G),q):L>=l?(A.exit("codeFencedFenceSequence"),Nt(G)?Rt(A,H,"whitespace")(G):H(G)):O(G)}function H(G){return G===null||rt(G)?(A.exit("codeFencedFence"),D(G)):O(G)}}}function yq(e,t,n){const r=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const vx={name:"codeIndented",tokenize:bq},xq={partial:!0,tokenize:wq};function bq(e,t,n){const r=this;return a;function a(c){return e.enter("codeIndented"),Rt(e,i,"linePrefix",5)(c)}function i(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(c):n(c)}function l(c){return c===null?f(c):rt(c)?e.attempt(xq,l,f)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||rt(c)?(e.exit("codeFlowValue"),l(c)):(e.consume(c),o)}function f(c){return e.exit("codeIndented"),t(c)}}function wq(e,t,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):rt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):Rt(e,i,"linePrefix",5)(l)}function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):rt(l)?a(l):n(l)}}const Sq={name:"codeText",previous:Cq,resolve:Eq,tokenize:Nq};function Eq(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Cq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Nq(e,t,n){let r=0,a,i;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),o(p)}function o(p){return p===96?(e.consume(p),r++,o):(e.exit("codeTextSequence"),f(p))}function f(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),f):p===96?(i=e.enter("codeTextSequence"),a=0,h(p)):rt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||rt(p)?(e.exit("codeTextData"),f(p)):(e.consume(p),c)}function h(p){return p===96?(e.consume(p),a++,h):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(i.type="codeTextData",c(p))}}class kq{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&_f(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_f(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_f(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);_f(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_f(this.left,n.reverse())}}}function _f(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function EM(e){const t={};let n=-1,r,a,i,l,o,f,c;const h=new kq(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,i=0,i<f.length&&f[i][1].type==="lineEndingBlank"&&(i+=2),i<f.length&&f[i][1].type==="content"))for(;++i<f.length&&f[i][1].type!=="content";)f[i][1].type==="chunkText"&&(f[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Tq(h,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(l=h.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(r[1].end={...h.get(a)[1].start},o=h.slice(a,n),o.unshift(r),h.splice(a,n-a+1,o))}}return ca(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Tq(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,f=[],c={};let h,p,m=-1,y=n,x=0,b=0;const w=[b];for(;y;){for(;e.get(++a)[1]!==y;);i.push(a),y._tokenizer||(h=r.sliceStream(y),y.next||h.push(null),p&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(b=m+1,w.push(b),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):w.pop(),m=w.length;m--;){const S=o.slice(w[m],w[m+1]),N=i.pop();f.push([N,N+S.length-1]),e.splice(N,2,S)}for(f.reverse(),m=-1;++m<f.length;)c[x+f[m][0]]=x+f[m][1],x+=f[m][1]-f[m][0]-1;return c}const jq={resolve:Rq,tokenize:Dq},Aq={partial:!0,tokenize:Mq};function Rq(e){return EM(e),e}function Dq(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):rt(o)?e.check(Aq,l,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function Mq(e,t,n){const r=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Rt(e,i,"linePrefix")}function i(l){if(l===null||rt(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function CM(e,t,n,r,a,i,l,o,f){const c=f||Number.POSITIVE_INFINITY;let h=0;return p;function p(S){return S===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(S),e.exit(i),m):S===null||S===32||S===41||mp(S)?n(S):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),b(S))}function m(S){return S===62?(e.enter(i),e.consume(S),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===62?(e.exit("chunkString"),e.exit(o),m(S)):S===null||S===60||rt(S)?n(S):(e.consume(S),S===92?x:y)}function x(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function b(S){return!h&&(S===null||S===41||Wt(S))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(S)):h<c&&S===40?(e.consume(S),h++,b):S===41?(e.consume(S),h--,b):S===null||S===32||S===40||mp(S)?n(S):(e.consume(S),S===92?w:b)}function w(S){return S===40||S===41||S===92?(e.consume(S),b):b(S)}}function NM(e,t,n,r,a,i){const l=this;let o=0,f;return c;function c(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(i),h}function h(y){return o>999||y===null||y===91||y===93&&!f||y===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(i),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):rt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||rt(y)||o++>999?(e.exit("chunkString"),h(y)):(e.consume(y),f||(f=!Nt(y)),y===92?m:p)}function m(y){return y===91||y===92||y===93?(e.consume(y),o++,p):p(y)}}function kM(e,t,n,r,a,i){let l;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),l=m===40?41:m,f):n(m)}function f(m){return m===l?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),c(m))}function c(m){return m===l?(e.exit(i),f(l)):m===null?n(m):rt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Rt(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===l||m===null||rt(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?p:h)}function p(m){return m===l||m===92?(e.consume(m),h):h(m)}}function Zf(e,t){let n;return r;function r(a){return rt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Nt(a)?Rt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const _q={name:"definition",tokenize:Lq},Oq={partial:!0,tokenize:Pq};function Lq(e,t,n){const r=this;let a;return i;function i(y){return e.enter("definition"),l(y)}function l(y){return NM.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function o(y){return a=Ha(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Wt(y)?Zf(e,c)(y):c(y)}function c(y){return CM(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return e.attempt(Oq,p,p)(y)}function p(y){return Nt(y)?Rt(e,m,"whitespace")(y):m(y)}function m(y){return y===null||rt(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function Pq(e,t,n){return r;function r(o){return Wt(o)?Zf(e,a)(o):n(o)}function a(o){return kM(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Nt(o)?Rt(e,l,"whitespace")(o):l(o)}function l(o){return o===null||rt(o)?t(o):n(o)}}const Bq={name:"hardBreakEscape",tokenize:zq};function zq(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return rt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Iq={name:"headingAtx",resolve:Fq,tokenize:Uq};function Fq(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ca(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Uq(e,t,n){let r=0;return a;function a(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(e.consume(h),l):h===null||Wt(h)?(e.exit("atxHeadingSequence"),o(h)):n(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),f(h)):h===null||rt(h)?(e.exit("atxHeading"),t(h)):Nt(h)?Rt(e,o,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function f(h){return h===35?(e.consume(h),f):(e.exit("atxHeadingSequence"),o(h))}function c(h){return h===null||h===35||Wt(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),c)}}const qq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ik=["pre","script","style","textarea"],Vq={concrete:!0,name:"htmlFlow",resolveTo:$q,tokenize:Kq},Hq={partial:!0,tokenize:Xq},Gq={partial:!0,tokenize:Yq};function $q(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Kq(e,t,n){const r=this;let a,i,l,o,f;return c;function c(z){return h(z)}function h(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),p}function p(z){return z===33?(e.consume(z),m):z===47?(e.consume(z),i=!0,b):z===63?(e.consume(z),a=3,r.interrupt?t:I):Dr(z)?(e.consume(z),l=String.fromCharCode(z),w):n(z)}function m(z){return z===45?(e.consume(z),a=2,y):z===91?(e.consume(z),a=5,o=0,x):Dr(z)?(e.consume(z),a=4,r.interrupt?t:I):n(z)}function y(z){return z===45?(e.consume(z),r.interrupt?t:I):n(z)}function x(z){const Z="CDATA[";return z===Z.charCodeAt(o++)?(e.consume(z),o===Z.length?r.interrupt?t:P:x):n(z)}function b(z){return Dr(z)?(e.consume(z),l=String.fromCharCode(z),w):n(z)}function w(z){if(z===null||z===47||z===62||Wt(z)){const Z=z===47,re=l.toLowerCase();return!Z&&!i&&ik.includes(re)?(a=1,r.interrupt?t(z):P(z)):qq.includes(l.toLowerCase())?(a=6,Z?(e.consume(z),S):r.interrupt?t(z):P(z)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):i?N(z):C(z))}return z===45||xr(z)?(e.consume(z),l+=String.fromCharCode(z),w):n(z)}function S(z){return z===62?(e.consume(z),r.interrupt?t:P):n(z)}function N(z){return Nt(z)?(e.consume(z),N):M(z)}function C(z){return z===47?(e.consume(z),M):z===58||z===95||Dr(z)?(e.consume(z),T):Nt(z)?(e.consume(z),C):M(z)}function T(z){return z===45||z===46||z===58||z===95||xr(z)?(e.consume(z),T):R(z)}function R(z){return z===61?(e.consume(z),A):Nt(z)?(e.consume(z),R):C(z)}function A(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),f=z,D):Nt(z)?(e.consume(z),A):O(z)}function D(z){return z===f?(e.consume(z),f=null,L):z===null||rt(z)?n(z):(e.consume(z),D)}function O(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||Wt(z)?R(z):(e.consume(z),O)}function L(z){return z===47||z===62||Nt(z)?C(z):n(z)}function M(z){return z===62?(e.consume(z),B):n(z)}function B(z){return z===null||rt(z)?P(z):Nt(z)?(e.consume(z),B):n(z)}function P(z){return z===45&&a===2?(e.consume(z),F):z===60&&a===1?(e.consume(z),V):z===62&&a===4?(e.consume(z),U):z===63&&a===3?(e.consume(z),I):z===93&&a===5?(e.consume(z),Q):rt(z)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Hq,X,q)(z)):z===null||rt(z)?(e.exit("htmlFlowData"),q(z)):(e.consume(z),P)}function q(z){return e.check(Gq,H,X)(z)}function H(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),G}function G(z){return z===null||rt(z)?q(z):(e.enter("htmlFlowData"),P(z))}function F(z){return z===45?(e.consume(z),I):P(z)}function V(z){return z===47?(e.consume(z),l="",Y):P(z)}function Y(z){if(z===62){const Z=l.toLowerCase();return ik.includes(Z)?(e.consume(z),U):P(z)}return Dr(z)&&l.length<8?(e.consume(z),l+=String.fromCharCode(z),Y):P(z)}function Q(z){return z===93?(e.consume(z),I):P(z)}function I(z){return z===62?(e.consume(z),U):z===45&&a===2?(e.consume(z),I):P(z)}function U(z){return z===null||rt(z)?(e.exit("htmlFlowData"),X(z)):(e.consume(z),U)}function X(z){return e.exit("htmlFlow"),t(z)}}function Yq(e,t,n){const r=this;return a;function a(l){return rt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Xq(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Pd,t,n)}}const Qq={name:"htmlText",tokenize:Wq};function Wq(e,t,n){const r=this;let a,i,l;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),f}function f(I){return I===33?(e.consume(I),c):I===47?(e.consume(I),R):I===63?(e.consume(I),C):Dr(I)?(e.consume(I),O):n(I)}function c(I){return I===45?(e.consume(I),h):I===91?(e.consume(I),i=0,x):Dr(I)?(e.consume(I),N):n(I)}function h(I){return I===45?(e.consume(I),y):n(I)}function p(I){return I===null?n(I):I===45?(e.consume(I),m):rt(I)?(l=p,V(I)):(e.consume(I),p)}function m(I){return I===45?(e.consume(I),y):p(I)}function y(I){return I===62?F(I):I===45?m(I):p(I)}function x(I){const U="CDATA[";return I===U.charCodeAt(i++)?(e.consume(I),i===U.length?b:x):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),w):rt(I)?(l=b,V(I)):(e.consume(I),b)}function w(I){return I===93?(e.consume(I),S):b(I)}function S(I){return I===62?F(I):I===93?(e.consume(I),S):b(I)}function N(I){return I===null||I===62?F(I):rt(I)?(l=N,V(I)):(e.consume(I),N)}function C(I){return I===null?n(I):I===63?(e.consume(I),T):rt(I)?(l=C,V(I)):(e.consume(I),C)}function T(I){return I===62?F(I):C(I)}function R(I){return Dr(I)?(e.consume(I),A):n(I)}function A(I){return I===45||xr(I)?(e.consume(I),A):D(I)}function D(I){return rt(I)?(l=D,V(I)):Nt(I)?(e.consume(I),D):F(I)}function O(I){return I===45||xr(I)?(e.consume(I),O):I===47||I===62||Wt(I)?L(I):n(I)}function L(I){return I===47?(e.consume(I),F):I===58||I===95||Dr(I)?(e.consume(I),M):rt(I)?(l=L,V(I)):Nt(I)?(e.consume(I),L):F(I)}function M(I){return I===45||I===46||I===58||I===95||xr(I)?(e.consume(I),M):B(I)}function B(I){return I===61?(e.consume(I),P):rt(I)?(l=B,V(I)):Nt(I)?(e.consume(I),B):L(I)}function P(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),a=I,q):rt(I)?(l=P,V(I)):Nt(I)?(e.consume(I),P):(e.consume(I),H)}function q(I){return I===a?(e.consume(I),a=void 0,G):I===null?n(I):rt(I)?(l=q,V(I)):(e.consume(I),q)}function H(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Wt(I)?L(I):(e.consume(I),H)}function G(I){return I===47||I===62||Wt(I)?L(I):n(I)}function F(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function V(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),Y}function Y(I){return Nt(I)?Rt(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Q(I)}function Q(I){return e.enter("htmlTextData"),l(I)}}const sw={name:"labelEnd",resolveAll:t8,resolveTo:n8,tokenize:r8},Zq={tokenize:a8},Jq={tokenize:i8},e8={tokenize:s8};function t8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&ca(e,0,e.length,n),e}function n8(e,t){let n=e.length,r=0,a,i,l,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(l=n);const f={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},h={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",f,t],["enter",c,t]],o=Da(o,e.slice(i+1,i+r+3)),o=Da(o,[["enter",h,t]]),o=Da(o,tm(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),o=Da(o,[["exit",h,t],e[l-2],e[l-1],["exit",c,t]]),o=Da(o,e.slice(l+1)),o=Da(o,[["exit",f,t]]),ca(e,i,e.length,o),e}function r8(e,t,n){const r=this;let a=r.events.length,i,l;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?p(m):(l=r.parser.defined.includes(Ha(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),f):n(m)}function f(m){return m===40?e.attempt(Zq,h,l?h:p)(m):m===91?e.attempt(Jq,h,l?c:p)(m):l?h(m):p(m)}function c(m){return e.attempt(e8,h,p)(m)}function h(m){return t(m)}function p(m){return i._balanced=!0,n(m)}}function a8(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),a}function a(p){return Wt(p)?Zf(e,i)(p):i(p)}function i(p){return p===41?h(p):CM(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return Wt(p)?Zf(e,f)(p):h(p)}function o(p){return n(p)}function f(p){return p===34||p===39||p===40?kM(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):h(p)}function c(p){return Wt(p)?Zf(e,h)(p):h(p)}function h(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function i8(e,t,n){const r=this;return a;function a(o){return NM.call(r,e,i,l,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Ha(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function s8(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const l8={name:"labelStartImage",resolveAll:sw.resolveAll,tokenize:o8};function o8(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const u8={name:"labelStartLink",resolveAll:sw.resolveAll,tokenize:c8};function c8(e,t,n){const r=this;return a;function a(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const px={name:"lineEnding",tokenize:f8};function f8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Rt(e,t,"linePrefix")}}const Xv={name:"thematicBreak",tokenize:d8};function d8(e,t,n){let r=0,a;return i;function i(c){return e.enter("thematicBreak"),l(c)}function l(c){return a=c,o(c)}function o(c){return c===a?(e.enter("thematicBreakSequence"),f(c)):r>=3&&(c===null||rt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function f(c){return c===a?(e.consume(c),r++,f):(e.exit("thematicBreakSequence"),Nt(c)?Rt(e,o,"whitespace")(c):o(c))}}const Hr={continuation:{tokenize:m8},exit:y8,name:"list",tokenize:p8},h8={partial:!0,tokenize:x8},v8={partial:!0,tokenize:g8};function p8(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return o;function o(y){const x=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Bb(y)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Xv,n,c)(y):c(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return Bb(y)&&++l<10?(e.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),c(y)):n(y)}function c(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Pd,r.interrupt?n:h,e.attempt(h8,m,p))}function h(y){return r.containerState.initialBlankLine=!0,i++,m(y)}function p(y){return Nt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),m):n(y)}function m(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function m8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Pd,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Rt(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Nt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(v8,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Rt(e,e.attempt(Hr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function g8(e,t,n){const r=this;return Rt(e,a,"listItemIndent",r.containerState.size+1);function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(i):n(i)}}function y8(e){e.exit(this.containerState.type)}function x8(e,t,n){const r=this;return Rt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const l=r.events[r.events.length-1];return!Nt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const sk={name:"setextUnderline",resolveTo:b8,tokenize:w8};function b8(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",l,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function w8(e,t,n){const r=this;let a;return i;function i(c){let h=r.events.length,p;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){p=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),a=c,l(c)):n(c)}function l(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===a?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Nt(c)?Rt(e,f,"lineSuffix")(c):f(c))}function f(c){return c===null||rt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const S8={tokenize:E8};function E8(e){const t=this,n=e.attempt(Pd,r,e.attempt(this.parser.constructs.flowInitial,a,Rt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(jq,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const C8={resolveAll:jM()},N8=TM("string"),k8=TM("text");function TM(e){return{resolveAll:jM(e==="text"?T8:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,l,o);return l;function l(h){return c(h)?i(h):o(h)}function o(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),f}function f(h){return c(h)?(n.exit("data"),i(h)):(n.consume(h),f)}function c(h){if(h===null)return!0;const p=a[h];let m=-1;if(p)for(;++m<p.length;){const y=p[m];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function jM(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function T8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,l=-1,o=0,f;for(;i--;){const c=a[i];if(typeof c=="string"){for(l=c.length;c.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(c===-2)f=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||f||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const j8={42:Hr,43:Hr,45:Hr,48:Hr,49:Hr,50:Hr,51:Hr,52:Hr,53:Hr,54:Hr,55:Hr,56:Hr,57:Hr,62:bM},A8={91:_q},R8={[-2]:vx,[-1]:vx,32:vx},D8={35:Iq,42:Xv,45:[sk,Xv],60:Vq,61:sk,95:Xv,96:ak,126:ak},M8={38:SM,92:wM},_8={[-5]:px,[-4]:px,[-3]:px,33:l8,38:SM,42:zb,60:[uq,Qq],91:u8,92:[Bq,wM],93:sw,95:zb,96:Sq},O8={null:[zb,C8]},L8={null:[42,95]},P8={null:[]},B8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L8,contentInitial:A8,disable:P8,document:j8,flow:D8,flowInitial:R8,insideSpan:O8,string:M8,text:_8},Symbol.toStringTag,{value:"Module"}));function z8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let l=[],o=[];const f={attempt:D(R),check:D(A),consume:N,enter:C,exit:T,interrupt:D(A,{interrupt:!0})},c={code:null,containerState:{},defineSkip:b,events:[],now:x,parser:e,previous:null,sliceSerialize:m,sliceStream:y,write:p};let h=t.tokenize.call(c,f);return t.resolveAll&&i.push(t),c;function p(B){return l=Da(l,B),w(),l[l.length-1]!==null?[]:(O(t,0),c.events=tm(i,c.events,c),c.events)}function m(B,P){return F8(y(B),P)}function y(B){return I8(l,B)}function x(){const{_bufferIndex:B,_index:P,line:q,column:H,offset:G}=r;return{_bufferIndex:B,_index:P,line:q,column:H,offset:G}}function b(B){a[B.line]=B.column,M()}function w(){let B;for(;r._index<l.length;){const P=l[r._index];if(typeof P=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<P.length;)S(P.charCodeAt(r._bufferIndex));else S(P)}}function S(B){h=h(B)}function N(B){rt(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,M()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=B}function C(B,P){const q=P||{};return q.type=B,q.start=x(),c.events.push(["enter",q,c]),o.push(q),q}function T(B){const P=o.pop();return P.end=x(),c.events.push(["exit",P,c]),P}function R(B,P){O(B,P.from)}function A(B,P){P.restore()}function D(B,P){return q;function q(H,G,F){let V,Y,Q,I;return Array.isArray(H)?X(H):"tokenize"in H?X([H]):U(H);function U(ae){return se;function se(le){const ie=le!==null&&ae[le],W=le!==null&&ae.null,te=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(W)?W:W?[W]:[]];return X(te)(le)}}function X(ae){return V=ae,Y=0,ae.length===0?F:z(ae[Y])}function z(ae){return se;function se(le){return I=L(),Q=ae,ae.partial||(c.currentConstruct=ae),ae.name&&c.parser.constructs.disable.null.includes(ae.name)?re():ae.tokenize.call(P?Object.assign(Object.create(c),P):c,f,Z,re)(le)}}function Z(ae){return B(Q,I),G}function re(ae){return I.restore(),++Y<V.length?z(V[Y]):F}}}function O(B,P){B.resolveAll&&!i.includes(B)&&i.push(B),B.resolve&&ca(c.events,P,c.events.length-P,B.resolve(c.events.slice(P),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function L(){const B=x(),P=c.previous,q=c.currentConstruct,H=c.events.length,G=Array.from(o);return{from:H,restore:F};function F(){r=B,c.previous=P,c.currentConstruct=q,c.events.length=H,o=G,M()}}function M(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function I8(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(r,i)];else{if(l=e.slice(n,a),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}i>0&&l.push(e[a].slice(0,i))}return l}function F8(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
|
|
466
|
-
`;break}case-3:{l=`\r
|
|
467
|
-
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(i)}a=i===-2,r.push(l)}return r.join("")}function U8(e){const r={constructs:yM([B8,...(e||{}).extensions||[]]),content:a(nq),defined:[],document:a(aq),flow:a(S8),lazy:{},string:a(N8),text:a(k8)};return r;function a(i){return l;function l(o){return z8(r,i,o)}}}function q8(e){for(;!EM(e););return e}const lk=/[\0\t\n\r]/g;function V8(){let e=1,t="",n=!0,r;return a;function a(i,l,o){const f=[];let c,h,p,m,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),p=0,t="",n&&(i.charCodeAt(0)===65279&&p++,n=void 0);p<i.length;){if(lk.lastIndex=p,c=lk.exec(i),m=c&&c.index!==void 0?c.index:i.length,y=i.charCodeAt(m),!c){t=i.slice(p);break}if(y===10&&p===m&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),p<m&&(f.push(i.slice(p,m)),e+=m-p),y){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}p=m+1}return o&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const H8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function G8(e){return e.replace(H8,$8)}function $8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return xM(n.slice(i?2:1),i?16:10)}return iw(n)||e}const AM={}.hasOwnProperty;function K8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Y8(n)(q8(U8(n).document().write(V8()(e,t,!0))))}function Y8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ve),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(Be),blockQuote:i(W),characterEscape:L,characterReference:L,codeFenced:i(te),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(te,l),codeText:i(oe,l),codeTextData:L,data:L,codeFlowValue:L,definition:i(ye),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(Te),hardBreakEscape:i(ot),hardBreakTrailing:i(ot),htmlFlow:i(Je,l),htmlFlowData:L,htmlText:i(Je,l),htmlTextData:L,image:i(We),label:l,link:i(Ve),listItem:i(Ye),listItemValue:m,listOrdered:i(De,p),listUnordered:i(De),paragraph:i(Qe),reference:z,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(Be),strong:i(st),thematicBreak:i(dt)},exit:{atxHeading:f(),atxHeadingSequence:R,autolink:f(),autolinkEmail:ie,autolinkProtocol:le,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ae,characterReference:se,codeFenced:f(w),codeFencedFence:b,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:M,codeIndented:f(S),codeText:f(G),codeTextData:M,data:M,definition:f(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:C,emphasis:f(),hardBreakEscape:f(P),hardBreakTrailing:f(P),htmlFlow:f(q),htmlFlowData:M,htmlText:f(H),htmlTextData:M,image:f(V),label:Q,labelText:Y,lineEnding:B,link:f(F),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:Z,resourceDestinationString:I,resourceTitleString:U,resource:X,setextHeading:f(O),setextHeadingLineSequence:D,setextHeadingText:A,strong:f(),thematicBreak:f()}};RM(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ve){let Ce={type:"root",children:[]};const Me={stack:[Ce],tokenStack:[],config:t,enter:o,exit:c,buffer:l,resume:h,data:n},Ie=[];let _e=-1;for(;++_e<ve.length;)if(ve[_e][1].type==="listOrdered"||ve[_e][1].type==="listUnordered")if(ve[_e][0]==="enter")Ie.push(_e);else{const Oe=Ie.pop();_e=a(ve,Oe,_e)}for(_e=-1;++_e<ve.length;){const Oe=t[ve[_e][0]];AM.call(Oe,ve[_e][1].type)&&Oe[ve[_e][1].type].call(Object.assign({sliceSerialize:ve[_e][2].sliceSerialize},Me),ve[_e][1])}if(Me.tokenStack.length>0){const Oe=Me.tokenStack[Me.tokenStack.length-1];(Oe[1]||ok).call(Me,void 0,Oe[0])}for(Ce.position={start:Ys(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:Ys(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e<t.transforms.length;)Ce=t.transforms[_e](Ce)||Ce;return Ce}function a(ve,Ce,Me){let Ie=Ce-1,_e=-1,Oe=!1,xe,K,ce,me;for(;++Ie<=Me;){const he=ve[Ie];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?_e++:_e--,me=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(xe&&!me&&!_e&&!ce&&(ce=Ie),me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:me=void 0}if(!_e&&he[0]==="enter"&&he[1].type==="listItemPrefix"||_e===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(xe){let be=Ie;for(K=void 0;be--;){const Le=ve[be];if(Le[1].type==="lineEnding"||Le[1].type==="lineEndingBlank"){if(Le[0]==="exit")continue;K&&(ve[K][1].type="lineEndingBlank",Oe=!0),Le[1].type="lineEnding",K=be}else if(!(Le[1].type==="linePrefix"||Le[1].type==="blockQuotePrefix"||Le[1].type==="blockQuotePrefixWhitespace"||Le[1].type==="blockQuoteMarker"||Le[1].type==="listItemIndent"))break}ce&&(!K||ce<K)&&(xe._spread=!0),xe.end=Object.assign({},K?ve[K][1].start:he[1].end),ve.splice(K||Ie,0,["exit",xe,he[2]]),Ie++,Me++}if(he[1].type==="listItemPrefix"){const be={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};xe=be,ve.splice(Ie,0,["enter",be,he[2]]),Ie++,Me++,ce=void 0,me=!0}}}return ve[Ce][1]._spread=Oe,Me}function i(ve,Ce){return Me;function Me(Ie){o.call(this,ve(Ie),Ie),Ce&&Ce.call(this,Ie)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(ve,Ce,Me){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([Ce,Me||void 0]),ve.position={start:Ys(Ce.start),end:void 0}}function f(ve){return Ce;function Ce(Me){ve&&ve.call(this,Me),c.call(this,Me)}}function c(ve,Ce){const Me=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ve.type&&(Ce?Ce.call(this,ve,Ie[0]):(Ie[1]||ok).call(this,ve,Ie[0]));else throw new Error("Cannot close `"+ve.type+"` ("+Wf({start:ve.start,end:ve.end})+"): it’s not open");Me.position.end=Ys(ve.end)}function h(){return aw(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(ve){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=ve}function x(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=ve}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve.replace(/(\r?\n|\r)$/g,"")}function N(ve){const Ce=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ce,Me.identifier=Ha(this.sliceSerialize(ve)).toLowerCase()}function C(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ve}function T(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ve}function R(ve){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Me=this.sliceSerialize(ve).length;Ce.depth=Me}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function D(ve){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ve){const Me=this.stack[this.stack.length-1].children;let Ie=Me[Me.length-1];(!Ie||Ie.type!=="text")&&(Ie=ze(),Ie.position={start:Ys(ve.start),end:void 0},Me.push(Ie)),this.stack.push(Ie)}function M(ve){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(ve),Ce.position.end=Ys(ve.end)}function B(ve){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Me=Ce.children[Ce.children.length-1];Me.position.end=Ys(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ce.type)&&(L.call(this,ve),M.call(this,ve))}function P(){this.data.atHardBreak=!0}function q(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function H(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function G(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function F(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ce,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function V(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ce,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function Y(ve){const Ce=this.sliceSerialize(ve),Me=this.stack[this.stack.length-2];Me.label=G8(Ce),Me.identifier=Ha(Ce).toLowerCase()}function Q(){const ve=this.stack[this.stack.length-1],Ce=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const Ie=ve.children;Me.children=Ie}else Me.alt=Ce}function I(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ve}function U(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ve}function X(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function Z(ve){const Ce=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ce,Me.identifier=Ha(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function re(ve){this.data.characterReferenceType=ve.type}function ae(ve){const Ce=this.sliceSerialize(ve),Me=this.data.characterReferenceType;let Ie;Me?(Ie=xM(Ce,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=iw(Ce);const _e=this.stack[this.stack.length-1];_e.value+=Ie}function se(ve){const Ce=this.stack.pop();Ce.position.end=Ys(ve.end)}function le(ve){M.call(this,ve);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(ve)}function ie(ve){M.call(this,ve);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(ve)}function W(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Te(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function ot(){return{type:"break"}}function Je(){return{type:"html",value:""}}function We(){return{type:"image",title:null,url:"",alt:null}}function Ve(){return{type:"link",title:null,url:"",children:[]}}function De(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function Ye(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function ze(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function Ys(e){return{line:e.line,column:e.column,offset:e.offset}}function RM(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?RM(e,r):X8(e,r)}}function X8(e,t){let n;for(n in t)if(AM.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ok(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wf({start:t.start,end:t.end})+") is still open")}function Q8(e){const t=this;t.parser=n;function n(r){return K8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function W8(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Z8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
468
|
-
`}]}function J8(e,t){const n=t.value?t.value+`
|
|
469
|
-
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function eV(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tV(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nV(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Cc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let l,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=i+1,o+=1,e.footnoteCounts.set(r,o);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const c={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,c),e.applyData(t,c)}function rV(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aV(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function DM(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=r:a.push({type:"text",value:r}),a}function iV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return DM(e,t);const a={src:Cc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function sV(e,t){const n={src:Cc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function lV(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function oV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return DM(e,t);const a={href:Cc(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function uV(e,t){const n={href:Cc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cV(e,t,n){const r=e.all(t),a=n?fV(n):MM(t),i={},l=[];if(typeof t.checked=="boolean"){const h=r[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const h=r[o];(a||o!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
470
|
-
`}),h.type==="element"&&h.tagName==="p"&&!a?l.push(...h.children):l.push(h)}const f=r[r.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
471
|
-
`});const c={type:"element",tagName:"li",properties:i,children:l};return e.patch(t,c),e.applyData(t,c)}function fV(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=MM(n[r])}return t}function MM(e){const t=e.spread;return t??e.children.length>1}function dV(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const l=r[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function hV(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vV(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pV(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mV(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=ew(t.children[1]),f=fM(t.children[t.children.length-1]);o&&f&&(l.position={start:o,end:f}),a.push(l)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function gV(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,o=l?l.length:t.children.length;let f=-1;const c=[];for(;++f<o;){const p=t.children[f],m={},y=l?l[f]:void 0;y&&(m.align=y);let x={type:"element",tagName:i,properties:m,children:[]};p&&(x.children=e.all(p),e.patch(p,x),x=e.applyData(p,x)),c.push(x)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function yV(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const uk=9,ck=32;function xV(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(fk(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(fk(t.slice(a),a>0,!1)),i.join("")}function fk(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===uk||i===ck;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===uk||i===ck;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function bV(e,t){const n={type:"text",value:xV(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wV(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const SV={blockquote:W8,break:Z8,code:J8,delete:eV,emphasis:tV,footnoteReference:nV,heading:rV,html:aV,imageReference:iV,image:sV,inlineCode:lV,linkReference:oV,link:uV,listItem:cV,list:dV,paragraph:hV,root:vV,strong:pV,table:mV,tableCell:yV,tableRow:gV,text:bV,thematicBreak:wV,toml:Sv,yaml:Sv,definition:Sv,footnoteDefinition:Sv};function Sv(){}const _M=-1,nm=0,Jf=1,gp=2,lw=3,ow=4,uw=5,cw=6,OM=7,LM=8,dk=typeof self=="object"?self:globalThis,EV=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,l]=t[a];switch(i){case nm:case _M:return n(l,a);case Jf:{const o=n([],a);for(const f of l)o.push(r(f));return o}case gp:{const o=n({},a);for(const[f,c]of l)o[r(f)]=r(c);return o}case lw:return n(new Date(l),a);case ow:{const{source:o,flags:f}=l;return n(new RegExp(o,f),a)}case uw:{const o=n(new Map,a);for(const[f,c]of l)o.set(r(f),r(c));return o}case cw:{const o=n(new Set,a);for(const f of l)o.add(r(f));return o}case OM:{const{name:o,message:f}=l;return n(new dk[o](f),a)}case LM:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return n(new DataView(o),l)}}return n(new dk[i](l),a)};return r},hk=e=>EV(new Map,e)(0),Cu="",{toString:CV}={},{keys:NV}=Object,Of=e=>{const t=typeof e;if(t!=="object"||!e)return[nm,t];const n=CV.call(e).slice(8,-1);switch(n){case"Array":return[Jf,Cu];case"Object":return[gp,Cu];case"Date":return[lw,Cu];case"RegExp":return[ow,Cu];case"Map":return[uw,Cu];case"Set":return[cw,Cu];case"DataView":return[Jf,n]}return n.includes("Array")?[Jf,n]:n.includes("Error")?[OM,n]:[gp,n]},Ev=([e,t])=>e===nm&&(t==="function"||t==="symbol"),kV=(e,t,n,r)=>{const a=(l,o)=>{const f=r.push(l)-1;return n.set(o,f),f},i=l=>{if(n.has(l))return n.get(l);let[o,f]=Of(l);switch(o){case nm:{let h=l;switch(f){case"bigint":o=LM,h=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);h=null;break;case"undefined":return a([_M],l)}return a([o,h],l)}case Jf:{if(f){let m=l;return f==="DataView"?m=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(m=new Uint8Array(l)),a([f,[...m]],l)}const h=[],p=a([o,h],l);for(const m of l)h.push(i(m));return p}case gp:{if(f)switch(f){case"BigInt":return a([f,l.toString()],l);case"Boolean":case"Number":case"String":return a([f,l.valueOf()],l)}if(t&&"toJSON"in l)return i(l.toJSON());const h=[],p=a([o,h],l);for(const m of NV(l))(e||!Ev(Of(l[m])))&&h.push([i(m),i(l[m])]);return p}case lw:return a([o,l.toISOString()],l);case ow:{const{source:h,flags:p}=l;return a([o,{source:h,flags:p}],l)}case uw:{const h=[],p=a([o,h],l);for(const[m,y]of l)(e||!(Ev(Of(m))||Ev(Of(y))))&&h.push([i(m),i(y)]);return p}case cw:{const h=[],p=a([o,h],l);for(const m of l)(e||!Ev(Of(m)))&&h.push(i(m));return p}}const{message:c}=l;return a([o,{name:f,message:c}],l)};return i},vk=(e,{json:t,lossy:n}={})=>{const r=[];return kV(!(t||n),!!t,new Map,r)(e),r},yp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?hk(vk(e,t)):structuredClone(e):(e,t)=>hk(vk(e,t));function TV(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function jV(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AV(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||TV,r=e.options.footnoteBackLabel||jV,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let f=-1;for(;++f<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[f]);if(!c)continue;const h=e.all(c),p=String(c.identifier).toUpperCase(),m=Cc(p.toLowerCase());let y=0;const x=[],b=e.footnoteCounts.get(p);for(;b!==void 0&&++y<=b;){x.length>0&&x.push({type:"text",value:" "});let N=typeof n=="string"?n:n(f,y);typeof N=="string"&&(N={type:"text",value:N}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const N=w.children[w.children.length-1];N&&N.type==="text"?N.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...x)}else h.push(...x);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(h,!0)};e.patch(c,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...yp(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
472
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
473
|
-
`}]}}const rm=(function(e){if(e==null)return _V;if(typeof e=="function")return am(e);if(typeof e=="object")return Array.isArray(e)?RV(e):DV(e);if(typeof e=="string")return MV(e);throw new Error("Expected function, string, or object as test")});function RV(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=rm(e[n]);return am(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function DV(e){const t=e;return am(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function MV(e){return am(t);function t(n){return n&&n.type===e}}function am(e){return t;function t(n,r,a){return!!(OV(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function _V(){return!0}function OV(e){return e!==null&&typeof e=="object"&&"type"in e}const PM=[],LV=!0,Ib=!1,PV="skip";function BM(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=rm(a),l=r?-1:1;o(e,void 0,[])();function o(f,c,h){const p=f&&typeof f=="object"?f:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return m;function m(){let y=PM,x,b,w;if((!t||i(f,c,h[h.length-1]||void 0))&&(y=BV(n(f,h)),y[0]===Ib))return y;if("children"in f&&f.children){const S=f;if(S.children&&y[0]!==PV)for(b=(r?S.children.length:-1)+l,w=h.concat(S);b>-1&&b<S.children.length;){const N=S.children[b];if(x=o(N,b,w)(),x[0]===Ib)return x;b=typeof x[1]=="number"?x[1]:b+l}}return y}}}function BV(e){return Array.isArray(e)?e:typeof e=="number"?[LV,e]:e==null?PM:[e]}function fw(e,t,n,r){let a,i,l;typeof t=="function"&&typeof n!="function"?(i=void 0,l=t,a=n):(i=t,l=n,a=r),BM(e,i,o,a);function o(f,c){const h=c[c.length-1],p=h?h.children.indexOf(f):void 0;return l(f,p,h)}}const Fb={}.hasOwnProperty,zV={};function IV(e,t){const n=t||zV,r=new Map,a=new Map,i=new Map,l={...SV,...n.handlers},o={all:c,applyData:UV,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:l,one:f,options:n,patch:FV,wrap:VV};return fw(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?r:a,m=String(h.identifier).toUpperCase();p.has(m)||p.set(m,h)}}),o;function f(h,p){const m=h.type,y=o.handlers[m];if(Fb.call(o.handlers,m)&&y)return y(o,h,p);if(o.options.passThrough&&o.options.passThrough.includes(m)){if("children"in h){const{children:b,...w}=h,S=yp(w);return S.children=o.all(h),S}return yp(h)}return(o.options.unknownHandler||qV)(o,h,p)}function c(h){const p=[];if("children"in h){const m=h.children;let y=-1;for(;++y<m.length;){const x=o.one(m[y],h);if(x){if(y&&m[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=pk(x.value)),!Array.isArray(x)&&x.type==="element")){const b=x.children[0];b&&b.type==="text"&&(b.value=pk(b.value))}Array.isArray(x)?p.push(...x):p.push(x)}}}return p}}function FV(e,t){e.position&&(t.position=jU(e))}function UV(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&i&&Object.assign(n.properties,yp(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function qV(e,t){const n=t.data||{},r="value"in t&&!(Fb.call(n,"hProperties")||Fb.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function VV(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
474
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
475
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
476
|
-
`}),n}function pk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mk(e,t){const n=IV(e,t),r=n.one(e,void 0),a=AV(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
|
|
477
|
-
`},a),i}function HV(e,t){return e&&"run"in e?async function(n,r){const a=mk(n,{file:r,...t});await e.run(a,r)}:function(n,r){return mk(n,{file:r,...e||t})}}function gk(e){if(e)throw e}var mx,yk;function GV(){if(yk)return mx;yk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var h=e.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!h&&!p)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},l=function(c,h){n&&h.name==="__proto__"?n(c,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):c[h.name]=h.newValue},o=function(c,h){if(h==="__proto__")if(e.call(c,h)){if(r)return r(c,h).value}else return;return c[h]};return mx=function f(){var c,h,p,m,y,x,b=arguments[0],w=1,S=arguments.length,N=!1;for(typeof b=="boolean"&&(N=b,b=arguments[1]||{},w=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});w<S;++w)if(c=arguments[w],c!=null)for(h in c)p=o(b,h),m=o(c,h),b!==m&&(N&&m&&(i(m)||(y=a(m)))?(y?(y=!1,x=p&&a(p)?p:[]):x=p&&i(p)?p:{},l(b,{name:h,newValue:f(N,x,m)})):typeof m<"u"&&l(b,{name:h,newValue:m}));return b},mx}var $V=GV();const gx=kd($V);function Ub(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function KV(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...a);function o(f,...c){const h=e[++i];let p=-1;if(f){l(f);return}for(;++p<a.length;)(c[p]===null||c[p]===void 0)&&(c[p]=a[p]);a=c,h?YV(h,o)(...c):l(null,...c)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function YV(e,t){let n;return r;function r(...l){const o=e.length>l.length;let f;o&&l.push(a);try{f=e.apply(this,l)}catch(c){const h=c;if(o&&n)throw h;return a(h)}o||(f&&f.then&&typeof f.then=="function"?f.then(i,a):f instanceof Error?a(f):i(f))}function a(l,...o){n||(n=!0,t(l,...o))}function i(l){a(null,l)}}const oi={basename:XV,dirname:QV,extname:WV,join:ZV,sep:"/"};function XV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bd(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else l<0&&(i=!0,l=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function QV(e){if(Bd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function WV(e){Bd(e);let t=e.length,n=-1,r=0,a=-1,i=0,l;for(;t--;){const o=e.codePointAt(t);if(o===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function ZV(...e){let t=-1,n;for(;++t<e.length;)Bd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JV(n)}function JV(e){Bd(e);const t=e.codePointAt(0)===47;let n=e9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function e9(e,t){let n="",r=0,a=-1,i=0,l=-1,o,f;for(;++l<=e.length;){if(l<e.length)o=e.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(a===l-1||i===1))if(a!==l-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),a=l,i=0;continue}}else if(n.length>0){n="",r=0,a=l,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),r=l-a-1;a=l,i=0}else o===46&&i>-1?i++:i=-1}return n}function Bd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const t9={cwd:n9};function n9(){return"/"}function qb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function r9(e){if(typeof e=="string")e=new URL(e);else if(!qb(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return a9(e)}function a9(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const yx=["history","path","basename","stem","extname","dirname"];class zM{constructor(t){let n;t?qb(t)?n={path:t}:typeof t=="string"||i9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":t9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yx.length;){const i=yx[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)yx.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?oi.basename(this.path):void 0}set basename(t){bx(t,"basename"),xx(t,"basename"),this.path=oi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?oi.dirname(this.path):void 0}set dirname(t){xk(this.basename,"dirname"),this.path=oi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?oi.extname(this.path):void 0}set extname(t){if(xx(t,"extname"),xk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=oi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){qb(t)&&(t=r9(t)),bx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?oi.basename(this.path,this.extname):void 0}set stem(t){bx(t,"stem"),xx(t,"stem"),this.path=oi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Nr(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xx(e,t){if(e&&e.includes(oi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+oi.sep+"`")}function bx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function i9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s9=(function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),l9={}.hasOwnProperty;class dw extends s9{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=KV()}copy(){const t=new dw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(gx(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ex("data",this.frozen),this.namespace[t]=n,this):l9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ex("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Cv(t),r=this.parser||this.Parser;return wx("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),wx("process",this.parser||this.Parser),Sx("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,l){const o=Cv(t),f=r.parse(o);r.run(f,o,function(h,p,m){if(h||!p||!m)return c(h);const y=p,x=r.stringify(y,m);c9(x)?m.value=x:m.result=x,c(h,m)});function c(h,p){h||!p?l(h):i?i(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),wx("processSync",this.parser||this.Parser),Sx("processSync",this.compiler||this.Compiler),this.process(t,a),wk("processSync","process",n),r;function a(i,l){n=!0,gk(i),r=l}}run(t,n,r){bk(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(l,o){const f=Cv(n);a.run(t,f,c);function c(h,p,m){const y=p||t;h?o(h):l?l(y):r(void 0,y,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),wk("runSync","run",r),a;function i(l,o){gk(l),a=o,r=!0}}stringify(t,n){this.freeze();const r=Cv(n),a=this.compiler||this.Compiler;return Sx("stringify",a),bk(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ex("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")f(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...p]=c;f(h,p)}else l(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function l(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(a.settings=gx(!0,a.settings,c.settings))}function o(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const p=c[h];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function f(c,h){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===c){m=p;break}if(m===-1)r.push([c,...h]);else if(h.length>0){let[y,...x]=h;const b=r[m][1];Ub(b)&&Ub(y)&&(y=gx(!0,b,y)),r[m]=[c,y,...x]}}}}const o9=new dw().freeze();function wx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Sx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ex(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function bk(e){if(!Ub(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cv(e){return u9(e)?e:new zM(e)}function u9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function c9(e){return typeof e=="string"||f9(e)}function f9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Sk=[],Ek={allowDangerousHtml:!0},h9=/^(https?|ircs?|mailto|xmpp)$/i,v9=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function p9(e){const t=m9(e),n=g9(e);return y9(t.runSync(t.parse(n),n),e)}function m9(e){const t=e.rehypePlugins||Sk,n=e.remarkPlugins||Sk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ek}:Ek;return o9().use(Q8).use(n).use(HV,r).use(t)}function g9(e){const t=e.children||"",n=new zM;return typeof t=="string"&&(n.value=t),n}function y9(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,f=t.urlTransform||x9;for(const h of v9)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+d9+h.id,void 0);return fw(e,c),_U(e,{Fragment:d.Fragment,components:a,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(h,p,m){if(h.type==="raw"&&m&&typeof p=="number")return l?m.children.splice(p,1):m.children[p]={type:"text",value:h.value},p;if(h.type==="element"){let y;for(y in hx)if(Object.hasOwn(hx,y)&&Object.hasOwn(h.properties,y)){const x=h.properties[y],b=hx[y];(b===null||b.includes(h.tagName))&&(h.properties[y]=f(String(x||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(h,p,m)),y&&m&&typeof p=="number")return o&&h.children?m.children.splice(p,1,...h.children):m.children.splice(p,1),p}}}function x9(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||h9.test(e.slice(0,t))?e:""}function Ck(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function b9(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function w9(e,t,n){const a=rm((n||{}).ignore||[]),i=S9(t);let l=-1;for(;++l<i.length;)BM(e,"text",o);function o(c,h){let p=-1,m;for(;++p<h.length;){const y=h[p],x=m?m.children:void 0;if(a(y,x?x.indexOf(y):void 0,m))return;m=y}if(m)return f(c,h)}function f(c,h){const p=h[h.length-1],m=i[l][0],y=i[l][1];let x=0;const w=p.children.indexOf(c);let S=!1,N=[];m.lastIndex=0;let C=m.exec(c.value);for(;C;){const T=C.index,R={index:C.index,input:C.input,stack:[...h,c]};let A=y(...C,R);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?m.lastIndex=T+1:(x!==T&&N.push({type:"text",value:c.value.slice(x,T)}),Array.isArray(A)?N.push(...A):A&&N.push(A),x=T+C[0].length,S=!0),!m.global)break;C=m.exec(c.value)}return S?(x<c.value.length&&N.push({type:"text",value:c.value.slice(x)}),p.children.splice(w,1,...N)):N=[c],w+N.length}}function S9(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([E9(a[0]),C9(a[1])])}return t}function E9(e){return typeof e=="string"?new RegExp(b9(e),"g"):e}function C9(e){return typeof e=="function"?e:function(){return e}}const Cx="phrasing",Nx=["autolink","link","image","label"];function N9(){return{transforms:[M9],enter:{literalAutolink:T9,literalAutolinkEmail:kx,literalAutolinkHttp:kx,literalAutolinkWww:kx},exit:{literalAutolink:D9,literalAutolinkEmail:R9,literalAutolinkHttp:j9,literalAutolinkWww:A9}}}function k9(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Cx,notInConstruct:Nx},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Cx,notInConstruct:Nx},{character:":",before:"[ps]",after:"\\/",inConstruct:Cx,notInConstruct:Nx}]}}function T9(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function kx(e){this.config.enter.autolinkProtocol.call(this,e)}function j9(e){this.config.exit.autolinkProtocol.call(this,e)}function A9(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function R9(e){this.config.exit.autolinkEmail.call(this,e)}function D9(e){this.exit(e)}function M9(e){w9(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_9],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),O9]],{ignore:["link","linkReference"]})}function _9(e,t,n,r,a){let i="";if(!IM(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!L9(n)))return!1;const l=P9(n+r);if(!l[0])return!1;const o={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[o,{type:"text",value:l[1]}]:o}function O9(e,t,n,r){return!IM(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function L9(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function P9(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=Ck(e,"(");let i=Ck(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function IM(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ko(n)||em(n))&&(!t||n!==47)}FM.peek=G9;function B9(){this.buffer()}function z9(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function I9(){this.buffer()}function F9(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function U9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ha(this.sliceSerialize(e)).toLowerCase(),n.label=t}function q9(e){this.exit(e)}function V9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ha(this.sliceSerialize(e)).toLowerCase(),n.label=t}function H9(e){this.exit(e)}function G9(){return"["}function FM(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const l=n.enter("footnoteReference"),o=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),l(),i+=a.move("]"),i}function $9(){return{enter:{gfmFootnoteCallString:B9,gfmFootnoteCall:z9,gfmFootnoteDefinitionLabelString:I9,gfmFootnoteDefinition:F9},exit:{gfmFootnoteCallString:U9,gfmFootnoteCall:q9,gfmFootnoteDefinitionLabelString:V9,gfmFootnoteDefinition:H9}}}function K9(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:FM},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,l){const o=i.createTracker(l);let f=o.move("[^");const c=i.enter("footnoteDefinition"),h=i.enter("label");return f+=o.move(i.safe(i.associationId(r),{before:f,after:"]"})),h(),f+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),f+=o.move((t?`
|
|
478
|
-
`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?UM:Y9))),c(),f}}function Y9(e,t,n){return t===0?e:UM(e,t,n)}function UM(e,t,n){return(n?"":" ")+e}const X9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qM.peek=eH;function Q9(){return{canContainEols:["delete"],enter:{strikethrough:Z9},exit:{strikethrough:J9}}}function W9(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:X9}],handlers:{delete:qM}}}function Z9(e){this.enter({type:"delete",children:[]},e)}function J9(e){this.exit(e)}function qM(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let l=a.move("~~");return l+=n.containerPhrasing(e,{...a.current(),before:l,after:"~"}),l+=a.move("~~"),i(),l}function eH(){return"~"}function tH(e){return e.length}function nH(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||tH,i=[],l=[],o=[],f=[];let c=0,h=-1;for(;++h<e.length;){const b=[],w=[];let S=-1;for(e[h].length>c&&(c=e[h].length);++S<e[h].length;){const N=rH(e[h][S]);if(n.alignDelimiters!==!1){const C=a(N);w[S]=C,(f[S]===void 0||C>f[S])&&(f[S]=C)}b.push(N)}l[h]=b,o[h]=w}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<c;)i[p]=Nk(r[p]);else{const b=Nk(r);for(;++p<c;)i[p]=b}p=-1;const m=[],y=[];for(;++p<c;){const b=i[p];let w="",S="";b===99?(w=":",S=":"):b===108?w=":":b===114&&(S=":");let N=n.alignDelimiters===!1?1:Math.max(1,f[p]-w.length-S.length);const C=w+"-".repeat(N)+S;n.alignDelimiters!==!1&&(N=w.length+N+S.length,N>f[p]&&(f[p]=N),y[p]=N),m[p]=C}l.splice(1,0,m),o.splice(1,0,y),h=-1;const x=[];for(;++h<l.length;){const b=l[h],w=o[h];p=-1;const S=[];for(;++p<c;){const N=b[p]||"";let C="",T="";if(n.alignDelimiters!==!1){const R=f[p]-(w[p]||0),A=i[p];A===114?C=" ".repeat(R):A===99?R%2?(C=" ".repeat(R/2+.5),T=" ".repeat(R/2-.5)):(C=" ".repeat(R/2),T=C):T=" ".repeat(R)}n.delimiterStart!==!1&&!p&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||p)&&S.push(" "),n.alignDelimiters!==!1&&S.push(C),S.push(N),n.alignDelimiters!==!1&&S.push(T),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||p!==c-1)&&S.push("|")}x.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return x.join(`
|
|
479
|
-
`)}function rH(e){return e==null?"":String(e)}function Nk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function aH(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const l=n.indentLines(n.containerFlow(e,i.current()),iH);return a(),l}function iH(e,t,n){return">"+(n?"":" ")+e}function sH(e,t){return kk(e,t.inConstruct,!0)&&!kk(e,t.notInConstruct,!1)}function kk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Tk(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
480
|
-
`&&sH(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
481
|
-
`}function lH(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>l&&(l=i):i=1,a=r+t.length,r=n.indexOf(t,a);return l}function oH(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uH(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function cH(e,t,n,r){const a=uH(n),i=e.value||"",l=a==="`"?"GraveAccent":"Tilde";if(oH(e,n)){const p=n.enter("codeIndented"),m=n.indentLines(i,fH);return p(),m}const o=n.createTracker(r),f=a.repeat(Math.max(lH(i,a)+1,3)),c=n.enter("codeFenced");let h=o.move(f);if(e.lang){const p=n.enter(`codeFencedLang${l}`);h+=o.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...o.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);h+=o.move(" "),h+=o.move(n.safe(e.meta,{before:h,after:`
|
|
482
|
-
`,encode:["`"],...o.current()})),p()}return h+=o.move(`
|
|
483
|
-
`),i&&(h+=o.move(i+`
|
|
484
|
-
`)),h+=o.move(f),c(),h}function fH(e,t,n){return(n?"":" ")+e}function hw(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function dH(e,t,n,r){const a=hw(n),i=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let o=n.enter("label");const f=n.createTracker(r);let c=f.move("[");return c+=f.move(n.safe(n.associationId(e),{before:c,after:"]",...f.current()})),c+=f.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=f.move("<"),c+=f.move(n.safe(e.url,{before:c,after:">",...f.current()})),c+=f.move(">")):(o=n.enter("destinationRaw"),c+=f.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
485
|
-
`,...f.current()}))),o(),e.title&&(o=n.enter(`title${i}`),c+=f.move(" "+a),c+=f.move(n.safe(e.title,{before:c,after:a,...f.current()})),c+=f.move(a),o()),l(),c}function hH(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ud(e){return"&#x"+e.toString(16).toUpperCase()+";"}function xp(e,t,n){const r=oc(e),a=oc(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}VM.peek=vH;function VM(e,t,n,r){const a=hH(n),i=n.enter("emphasis"),l=n.createTracker(r),o=l.move(a);let f=l.move(n.containerPhrasing(e,{after:a,before:o,...l.current()}));const c=f.charCodeAt(0),h=xp(r.before.charCodeAt(r.before.length-1),c,a);h.inside&&(f=ud(c)+f.slice(1));const p=f.charCodeAt(f.length-1),m=xp(r.after.charCodeAt(0),p,a);m.inside&&(f=f.slice(0,-1)+ud(p));const y=l.move(a);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+f+y}function vH(e,t,n){return n.options.emphasis||"*"}function pH(e,t){let n=!1;return fw(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ib}),!!((!e.depth||e.depth<3)&&aw(e)&&(t.options.setext||n))}function mH(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(pH(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
|
|
486
|
-
`,after:`
|
|
487
|
-
`});return p(),h(),m+`
|
|
488
|
-
`+(a===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
489
|
-
`))+1))}const l="#".repeat(a),o=n.enter("headingAtx"),f=n.enter("phrasing");i.move(l+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
490
|
-
`,...i.current()});return/^[\t ]/.test(c)&&(c=ud(c.charCodeAt(0))+c.slice(1)),c=c?l+" "+c:l,n.options.closeAtx&&(c+=" "+l),f(),o(),c}HM.peek=gH;function HM(e){return e.value||""}function gH(){return"<"}GM.peek=yH;function GM(e,t,n,r){const a=hw(n),i=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let o=n.enter("label");const f=n.createTracker(r);let c=f.move("![");return c+=f.move(n.safe(e.alt,{before:c,after:"]",...f.current()})),c+=f.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=f.move("<"),c+=f.move(n.safe(e.url,{before:c,after:">",...f.current()})),c+=f.move(">")):(o=n.enter("destinationRaw"),c+=f.move(n.safe(e.url,{before:c,after:e.title?" ":")",...f.current()}))),o(),e.title&&(o=n.enter(`title${i}`),c+=f.move(" "+a),c+=f.move(n.safe(e.title,{before:c,after:a,...f.current()})),c+=f.move(a),o()),c+=f.move(")"),l(),c}function yH(){return"!"}$M.peek=xH;function $M(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let l=n.enter("label");const o=n.createTracker(r);let f=o.move("![");const c=n.safe(e.alt,{before:f,after:"]",...o.current()});f+=o.move(c+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...o.current()});return l(),n.stack=h,i(),a==="full"||!c||c!==p?f+=o.move(p+"]"):a==="shortcut"?f=f.slice(0,-1):f+=o.move("]"),f}function xH(){return"!"}KM.peek=bH;function KM(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const l=n.unsafe[i],o=n.compilePattern(l);let f;if(l.atBreak)for(;f=o.exec(r);){let c=f.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(f.index+1)}}return a+r+a}function bH(){return"`"}function YM(e,t){const n=aw(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}XM.peek=wH;function XM(e,t,n,r){const a=hw(n),i=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let o,f;if(YM(e,n)){const h=n.stack;n.stack=[],o=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),o(),n.stack=h,p}o=n.enter("link"),f=n.enter("label");let c=l.move("[");return c+=l.move(n.containerPhrasing(e,{before:c,after:"](",...l.current()})),c+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(f=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${i}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),f()),c+=l.move(")"),o(),c}function wH(e,t,n){return YM(e,n)?"<":"["}QM.peek=SH;function QM(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let l=n.enter("label");const o=n.createTracker(r);let f=o.move("[");const c=n.containerPhrasing(e,{before:f,after:"]",...o.current()});f+=o.move(c+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...o.current()});return l(),n.stack=h,i(),a==="full"||!c||c!==p?f+=o.move(p+"]"):a==="shortcut"?f=f.slice(0,-1):f+=o.move("]"),f}function SH(){return"["}function vw(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function EH(e){const t=vw(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function CH(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function WM(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function NH(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let l=e.ordered?CH(n):vw(n);const o=e.ordered?l==="."?")":".":EH(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),WM(n)===l&&h){let p=-1;for(;++p<e.children.length;){const m=e.children[p];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=o),n.bulletCurrent=l;const c=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=i,a(),c}function kH(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TH(e,t,n,r){const a=kH(n);let i=n.bulletCurrent||vw(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let l=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(l-i.length)),o.shift(l);const f=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),h);return f(),c;function h(p,m,y){return m?(y?"":" ".repeat(l))+p:(y?i:i+" ".repeat(l-i.length))+p}}function jH(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(e,r);return i(),a(),l}const AH=rm(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function RH(e,t,n,r){return(e.children.some(function(l){return AH(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function DH(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ZM.peek=MH;function ZM(e,t,n,r){const a=DH(n),i=n.enter("strong"),l=n.createTracker(r),o=l.move(a+a);let f=l.move(n.containerPhrasing(e,{after:a,before:o,...l.current()}));const c=f.charCodeAt(0),h=xp(r.before.charCodeAt(r.before.length-1),c,a);h.inside&&(f=ud(c)+f.slice(1));const p=f.charCodeAt(f.length-1),m=xp(r.after.charCodeAt(0),p,a);m.inside&&(f=f.slice(0,-1)+ud(p));const y=l.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+f+y}function MH(e,t,n){return n.options.strong||"*"}function _H(e,t,n,r){return n.safe(e.value,r)}function OH(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function LH(e,t,n){const r=(WM(n)+(n.options.ruleSpaces?" ":"")).repeat(OH(n));return n.options.ruleSpaces?r.slice(0,-1):r}const JM={blockquote:aH,break:Tk,code:cH,definition:dH,emphasis:VM,hardBreak:Tk,heading:mH,html:HM,image:GM,imageReference:$M,inlineCode:KM,link:XM,linkReference:QM,list:NH,listItem:TH,paragraph:jH,root:RH,strong:ZM,text:_H,thematicBreak:LH};function PH(){return{enter:{table:BH,tableData:jk,tableHeader:jk,tableRow:IH},exit:{codeText:FH,table:zH,tableData:Tx,tableHeader:Tx,tableRow:Tx}}}function BH(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function zH(e){this.exit(e),this.data.inTable=void 0}function IH(e){this.enter({type:"tableRow",children:[]},e)}function Tx(e){this.exit(e)}function jk(e){this.enter({type:"tableCell",children:[]},e)}function FH(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,UH));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function UH(e,t){return t==="|"?t:e}function qH(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
491
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:l,tableCell:f,tableRow:o}};function l(y,x,b,w){return c(h(y,b,w),y.align)}function o(y,x,b,w){const S=p(y,b,w),N=c([S]);return N.slice(0,N.indexOf(`
|
|
492
|
-
`))}function f(y,x,b,w){const S=b.enter("tableCell"),N=b.enter("phrasing"),C=b.containerPhrasing(y,{...w,before:i,after:i});return N(),S(),C}function c(y,x){return nH(y,{align:x,alignDelimiters:r,padding:n,stringLength:a})}function h(y,x,b){const w=y.children;let S=-1;const N=[],C=x.enter("table");for(;++S<w.length;)N[S]=p(w[S],x,b);return C(),N}function p(y,x,b){const w=y.children;let S=-1;const N=[],C=x.enter("tableRow");for(;++S<w.length;)N[S]=f(w[S],y,x,b);return C(),N}function m(y,x,b){let w=JM.inlineCode(y,x,b);return b.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function VH(){return{exit:{taskListCheckValueChecked:Ak,taskListCheckValueUnchecked:Ak,paragraph:GH}}}function HH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$H}}}function Ak(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,l;for(;++i<a.length;){const o=a[i];if(o.type==="paragraph"){l=o;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function $H(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);i&&o.move(l);let f=JM.listItem(e,t,n,{...r,...o.current()});return i&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),f;function c(h){return h+l}}function KH(){return[N9(),$9(),Q9(),PH(),VH()]}function YH(e){return{extensions:[k9(),K9(e),W9(),qH(e),HH()]}}const XH={tokenize:t7,partial:!0},e_={tokenize:n7,partial:!0},t_={tokenize:r7,partial:!0},n_={tokenize:a7,partial:!0},QH={tokenize:i7,partial:!0},r_={name:"wwwAutolink",tokenize:JH,previous:i_},a_={name:"protocolAutolink",tokenize:e7,previous:s_},vs={name:"emailAutolink",tokenize:ZH,previous:l_},ki={};function WH(){return{text:ki}}let eo=48;for(;eo<123;)ki[eo]=vs,eo++,eo===58?eo=65:eo===91&&(eo=97);ki[43]=vs;ki[45]=vs;ki[46]=vs;ki[95]=vs;ki[72]=[vs,a_];ki[104]=[vs,a_];ki[87]=[vs,r_];ki[119]=[vs,r_];function ZH(e,t,n){const r=this;let a,i;return l;function l(p){return!Vb(p)||!l_.call(r,r.previous)||pw(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(p))}function o(p){return Vb(p)?(e.consume(p),o):p===64?(e.consume(p),f):n(p)}function f(p){return p===46?e.check(QH,h,c)(p):p===45||p===95||xr(p)?(i=!0,e.consume(p),f):h(p)}function c(p){return e.consume(p),a=!0,f}function h(p){return i&&a&&Dr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function JH(e,t,n){const r=this;return a;function a(l){return l!==87&&l!==119||!i_.call(r,r.previous)||pw(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(XH,e.attempt(e_,e.attempt(t_,i),n),n)(l))}function i(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function e7(e,t,n){const r=this;let a="",i=!1;return l;function l(p){return(p===72||p===104)&&s_.call(r,r.previous)&&!pw(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(p),e.consume(p),o):n(p)}function o(p){if(Dr(p)&&a.length<5)return a+=String.fromCodePoint(p),e.consume(p),o;if(p===58){const m=a.toLowerCase();if(m==="http"||m==="https")return e.consume(p),f}return n(p)}function f(p){return p===47?(e.consume(p),i?c:(i=!0,f)):n(p)}function c(p){return p===null||mp(p)||Wt(p)||ko(p)||em(p)?n(p):e.attempt(e_,e.attempt(t_,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function t7(e,t,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),a):l===46&&r===3?(e.consume(l),i):n(l)}function i(l){return l===null?n(l):t(l)}}function n7(e,t,n){let r,a,i;return l;function l(c){return c===46||c===95?e.check(n_,f,o)(c):c===null||Wt(c)||ko(c)||c!==45&&em(c)?f(c):(i=!0,e.consume(c),l)}function o(c){return c===95?r=!0:(a=r,r=void 0),e.consume(c),l}function f(c){return a||r||!i?n(c):t(c)}}function r7(e,t){let n=0,r=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&r<n?i(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(n_,t,i)(l):l===null||Wt(l)||ko(l)?t(l):(e.consume(l),a)}function i(l){return l===41&&r++,e.consume(l),a}}function a7(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),i):o===93?(e.consume(o),a):o===60||o===null||Wt(o)||ko(o)?t(o):n(o)}function a(o){return o===null||o===40||o===91||Wt(o)||ko(o)?t(o):r(o)}function i(o){return Dr(o)?l(o):n(o)}function l(o){return o===59?(e.consume(o),r):Dr(o)?(e.consume(o),l):n(o)}}function i7(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return xr(i)?n(i):t(i)}}function i_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Wt(e)}function s_(e){return!Dr(e)}function l_(e){return!(e===47||Vb(e))}function Vb(e){return e===43||e===45||e===46||e===95||xr(e)}function pw(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const s7={tokenize:v7,partial:!0};function l7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f7,continuation:{tokenize:d7},exit:h7}},text:{91:{name:"gfmFootnoteCall",tokenize:c7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o7,resolveTo:u7}}}}function o7(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const f=r.events[a][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return o;function o(f){if(!l||!l._balanced)return n(f);const c=Ha(r.sliceSerialize({start:l.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function u7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function c7(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return o;function o(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),f}function f(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(p){if(i>999||p===93&&!l||p===null||p===91||Wt(p))return n(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(Ha(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Wt(p)||(l=!0),i++,e.consume(p),p===92?h:c}function h(p){return p===91||p===92||p===93?(e.consume(p),i++,c):c(p)}}function f7(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,o;return f;function f(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(x)}function h(x){if(l>999||x===93&&!o||x===null||x===91||Wt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Ha(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Wt(x)||(o=!0),l++,e.consume(x),x===92?p:h}function p(x){return x===91||x===92||x===93?(e.consume(x),l++,h):h(x)}function m(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(i)||a.push(i),Rt(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function d7(e,t,n){return e.check(Pd,t,e.attempt(s7,t,n))}function h7(e){e.exit("gfmFootnoteDefinition")}function v7(e,t,n){const r=this;return Rt(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(i):n(i)}}function p7(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,o){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let c=f;for(;c--;)if(l[c][0]==="exit"&&l[c][1].type==="strikethroughSequenceTemporary"&&l[c][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[c][1].end.offset-l[c][1].start.offset){l[f][1].type="strikethroughSequence",l[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},l[c][1].start),end:Object.assign({},l[f][1].end)},p={type:"strikethroughText",start:Object.assign({},l[c][1].end),end:Object.assign({},l[f][1].start)},m=[["enter",h,o],["enter",l[c][1],o],["exit",l[c][1],o],["enter",p,o]],y=o.parser.constructs.insideSpan.null;y&&ca(m,m.length,0,tm(y,l.slice(c+1,f),o)),ca(m,m.length,0,[["exit",p,o],["enter",l[f][1],o],["exit",l[f][1],o],["exit",h,o]]),ca(l,c-1,f-c+3,m),f=c+m.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function i(l,o,f){const c=this.previous,h=this.events;let p=0;return m;function m(x){return c===126&&h[h.length-1][1].type!=="characterEscape"?f(x):(l.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const b=oc(c);if(x===126)return p>1?f(x):(l.consume(x),p++,y);if(p<2&&!n)return f(x);const w=l.exit("strikethroughSequenceTemporary"),S=oc(x);return w._open=!S||S===2&&!!b,w._close=!b||b===2&&!!S,o(x)}}}class m7{constructor(){this.map=[]}add(t,n,r){g7(this,t,n,r)}consume(t){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function g7(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function y7(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function x7(){return{flow:{null:{name:"table",tokenize:b7,resolveAll:w7}}}}function b7(e,t,n){const r=this;let a=0,i=0,l;return o;function o(M){let B=r.events.length-1;for(;B>-1;){const H=r.events[B][1].type;if(H==="lineEnding"||H==="linePrefix")B--;else break}const P=B>-1?r.events[B][1].type:null,q=P==="tableHead"||P==="tableRow"?A:f;return q===A&&r.parser.lazy[r.now().line]?n(M):q(M)}function f(M){return e.enter("tableHead"),e.enter("tableRow"),c(M)}function c(M){return M===124||(l=!0,i+=1),h(M)}function h(M){return M===null?n(M):rt(M)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),y):n(M):Nt(M)?Rt(e,h,"whitespace")(M):(i+=1,l&&(l=!1,a+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),l=!0,h):(e.enter("data"),p(M)))}function p(M){return M===null||M===124||Wt(M)?(e.exit("data"),h(M)):(e.consume(M),M===92?m:p)}function m(M){return M===92||M===124?(e.consume(M),p):p(M)}function y(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(M):(e.enter("tableDelimiterRow"),l=!1,Nt(M)?Rt(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):x(M))}function x(M){return M===45||M===58?w(M):M===124?(l=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),b):R(M)}function b(M){return Nt(M)?Rt(e,w,"whitespace")(M):w(M)}function w(M){return M===58?(i+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),S):M===45?(i+=1,S(M)):M===null||rt(M)?T(M):R(M)}function S(M){return M===45?(e.enter("tableDelimiterFiller"),N(M)):R(M)}function N(M){return M===45?(e.consume(M),N):M===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(M))}function C(M){return Nt(M)?Rt(e,T,"whitespace")(M):T(M)}function T(M){return M===124?x(M):M===null||rt(M)?!l||a!==i?R(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):R(M)}function R(M){return n(M)}function A(M){return e.enter("tableRow"),D(M)}function D(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),D):M===null||rt(M)?(e.exit("tableRow"),t(M)):Nt(M)?Rt(e,D,"whitespace")(M):(e.enter("data"),O(M))}function O(M){return M===null||M===124||Wt(M)?(e.exit("data"),D(M)):(e.consume(M),M===92?L:O)}function L(M){return M===92||M===124?(e.consume(M),O):O(M)}}function w7(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],l=[0,0,0,0],o=!1,f=0,c,h,p;const m=new m7;for(;++n<e.length;){const y=e[n],x=y[1];y[0]==="enter"?x.type==="tableHead"?(o=!1,f!==0&&(Rk(m,t,f,c,h),h=void 0,f=0),c={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},m.add(n,0,[["enter",c,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,p=void 0,i=[0,0,0,0],l=[0,n+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},m.add(n,0,[["enter",h,t]])),a=x.type==="tableDelimiterRow"?2:h?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(i[1]!==0&&(l[0]=l[1],p=Nv(m,t,i,a,void 0,p),i=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(l[0]=l[1],p=Nv(m,t,i,a,void 0,p)),i=l,l=[i[1],n,0,0])):x.type==="tableHead"?(o=!0,f=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(f=n,i[1]!==0?(l[0]=l[1],p=Nv(m,t,i,a,n,p)):l[1]!==0&&(p=Nv(m,t,l,a,n,p)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Rk(m,t,f,c,h),m.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=y7(t.events,n))}return e}function Nv(e,t,n,r,a,i){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(i.end=Object.assign({},Lu(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const f=Lu(t.events,n[1]);if(i={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Lu(t.events,n[2]),h=Lu(t.events,n[3]),p={type:o,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const m=t.events[n[2]],y=t.events[n[3]];if(m[1].end=Object.assign({},y[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,b=n[3]-n[2]-1;e.add(x,b,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return a!==void 0&&(i.end=Object.assign({},Lu(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function Rk(e,t,n,r,a){const i=[],l=Lu(t.events,n);a&&(a.end=Object.assign({},l),i.push(["exit",a,t])),r.end=Object.assign({},l),i.push(["exit",r,t]),e.add(n+1,0,i)}function Lu(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const S7={name:"tasklistCheck",tokenize:C7};function E7(){return{text:{91:S7}}}function C7(e,t,n){const r=this;return a;function a(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),i)}function i(f){return Wt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(f)}function o(f){return rt(f)?t(f):Nt(f)?e.check({tokenize:N7},t,n)(f):n(f)}}function N7(e,t,n){return Rt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function k7(e){return yM([WH(),l7(),p7(e),x7(),E7()])}const T7={};function j7(e){const t=this,n=e||T7,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(k7(n)),i.push(KH()),l.push(YH(n))}function Mr({content:e,className:t,compact:n=!1}){return d.jsx("div",{className:ke(n?"prose-myco-compact":"prose-myco",t),children:d.jsx(p9,{remarkPlugins:[j7],children:e})})}const A7={info:"bg-primary",success:"bg-green-500",warning:"bg-secondary",error:"bg-tertiary"},R7={info:B1,success:yc,warning:sD,error:Cr},Dk={unread:"New",read:"Earlier"},D7="notification-panel";function M7(e){const t=Math.floor(Date.now()/1e3)-e;if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Mk({title:e,count:t}){return d.jsxs("div",{className:"flex items-center justify-between px-1",children:[d.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-on-surface-variant",children:e}),d.jsx("span",{className:"text-[11px] text-on-surface-variant/70",children:t})]})}function _k({notification:e,onOpen:t,onDismiss:n}){const r=R7[e.level],a=e.status==="unread";return d.jsx("div",{onClick:()=>t(e),className:ke("group cursor-pointer rounded-lg border border-transparent px-4 py-3 transition-colors hover:border-outline-variant/20 hover:bg-surface-container-high/70",a&&"border-primary/10 bg-primary/[0.04]"),children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"relative mt-0.5 shrink-0",children:[d.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high text-on-surface-variant",children:d.jsx(r,{className:"h-4 w-4"})}),a&&d.jsx("span",{className:ke("absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface-container",A7[e.level])})]}),d.jsx("div",{className:"min-w-0 flex-1 space-y-1",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:ke("text-sm font-medium",a?"text-on-surface":"text-on-surface-variant"),children:e.title}),d.jsx("span",{className:"rounded-full bg-surface-container-high px-2 py-0.5 text-[10px] uppercase tracking-wider text-on-surface-variant",children:e.domain})]}),e.message&&d.jsx(Mr,{content:e.message,compact:!0,className:"line-clamp-3 text-xs leading-5 text-on-surface-variant"})]}),d.jsxs("div",{className:"flex shrink-0 items-start gap-2",children:[d.jsx("span",{className:"pt-0.5 text-[10px] font-mono text-on-surface-variant/70",children:M7(e.created_at)}),d.jsx("button",{onClick:i=>n(i,e),className:"rounded p-0.5 text-on-surface-variant/40 opacity-0 transition hover:text-on-surface-variant group-hover:opacity-100","aria-label":"Dismiss",children:d.jsx(jl,{className:"h-3.5 w-3.5"})})]})]})})]})})}function _7({open:e,onClose:t}){const{data:n,refetch:r}=W1({limit:50,enabled:e,pollCategory:"realtime",refetchInterval:Kn.LOGS}),a=rM(),i=Q6(),l=X6(),o=Za();j.useEffect(()=>{e&&r()},[e,r]),j.useEffect(()=>{if(!e)return;const x=b=>{b.key==="Escape"&&(b.preventDefault(),t())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,t]);const f=j.useCallback(x=>{x.status==="unread"&&a.mutate({id:x.id,status:"read"}),x.link&&(o(x.link,{state:{source:D7,triggeredAt:Date.now()}}),t())},[a,o,t]),c=j.useCallback((x,b)=>{x.stopPropagation(),a.mutate({id:b.id,status:"dismissed"})},[a]),h=((n==null?void 0:n.items)??[]).filter(x=>x.status!=="dismissed"),p=(n==null?void 0:n.unread_count)??0,m=h.filter(x=>x.status==="unread"),y=h.filter(x=>x.status!=="unread");return d.jsxs(d.Fragment,{children:[e&&d.jsx("div",{className:"fixed inset-0 z-40 bg-surface-dim/40 backdrop-blur-sm transition-opacity",onClick:t,"aria-hidden":"true"}),d.jsxs("aside",{className:ke("fixed top-0 right-0 bottom-0 z-50 flex w-96 max-w-[calc(100vw-3rem)] flex-col border-l border-outline-variant/20 bg-surface-container shadow-2xl transition-transform duration-200 ease-out",e?"translate-x-0":"translate-x-full"),children:[d.jsx("div",{className:"border-b border-outline-variant/20 px-4 py-4",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(dp,{className:"h-4 w-4 text-primary"}),d.jsx("h2",{className:"text-sm font-medium text-on-surface",children:"Notifications"}),p>0&&d.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary",children:p})]}),d.jsx("p",{className:"text-xs text-on-surface-variant",children:"New items stay here until read or dismissed."})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[p>0&&d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>i.mutate(void 0),title:"Mark all as read",className:"h-7 gap-1 px-2 text-xs text-on-surface-variant",children:[d.jsx(qz,{className:"h-3.5 w-3.5"}),"Mark all read"]}),h.length>0&&d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>l.mutate(void 0),title:"Clear all notifications",className:"h-7 gap-1 px-2 text-xs text-on-surface-variant",children:[d.jsx(os,{className:"h-3.5 w-3.5"}),"Clear"]}),d.jsx(Ae,{variant:"ghost",size:"sm",onClick:t,className:"h-7 px-2",children:d.jsx(jl,{className:"h-4 w-4"})})]})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length===0?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 px-6 text-center",children:[d.jsx(dp,{className:"h-5 w-5 text-on-surface-variant/50"}),d.jsx("div",{className:"text-sm text-on-surface-variant",children:"No notifications yet"}),d.jsx("div",{className:"text-xs text-on-surface-variant/70",children:"New events will appear here whether they display as banners or summary-only items."})]}):d.jsxs("div",{className:"space-y-4 px-3 py-3",children:[m.length>0&&d.jsxs("section",{className:"space-y-2",children:[d.jsx(Mk,{title:Dk.unread,count:m.length}),d.jsx("div",{className:"space-y-2",children:m.map(x=>d.jsx(_k,{notification:x,onOpen:f,onDismiss:c},x.id))})]}),y.length>0&&d.jsxs("section",{className:"space-y-2",children:[d.jsx(Mk,{title:Dk.read,count:y.length}),d.jsx("div",{className:"space-y-2",children:y.map(x=>d.jsx(_k,{notification:x,onOpen:f,onDismiss:c},x.id))})]})]})})]})]})}function O7(){var i;const{effective:e}=hs(),t=((i=e==null?void 0:e.notifications)==null?void 0:i.system_notifications)??!1,{data:n,refetch:r}=W1({status:"unread",mode:"banner",limit:5,enabled:t,pollCategory:"heartbeat",refetchInterval:Kn.PROGRESS}),a=j.useRef(new Set);return j.useEffect(()=>{t&&"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[t]),j.useEffect(()=>{if(!t||!("Notification"in window)||Notification.permission!=="granted"||document.hasFocus())return;const l=(n==null?void 0:n.items)??[];for(const o of l)a.current.has(o.id)||(a.current.add(o.id),L7(o))},[t,n]),j.useEffect(()=>{if(!t)return;const l=()=>{(document.hidden||!document.hasFocus())&&r()};return document.addEventListener("visibilitychange",l),window.addEventListener("blur",l),()=>{document.removeEventListener("visibilitychange",l),window.removeEventListener("blur",l)}},[t,r]),null}function L7(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:"/favicon.svg"})}catch{}}const P7=["sage","moss","terracotta","dusk","plum","slate"],B7=["light","dark","system"],z7=["default","geist-mono","system","sf-mono","fira-code","jetbrains-mono"],I7=["compact","normal","comfy"],F7={personal:"Personal",project:"Project"},U7={personal:"This setting is overridden on this machine",project:"This setting is using the shared project value"},q7={personal:"border-primary/40 bg-primary/5 text-primary",project:"border-outline-variant/30 bg-surface-container-high/40 text-on-surface-variant"};function zd({scope:e}){const t=F7[e];return d.jsxs("span",{title:U7[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${q7[e]}`,children:[d.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${e==="personal"?"bg-primary":"bg-outline-variant/80"}`,"aria-hidden":!0}),t]})}function im({onPromote:e,onReset:t}){const[n,r]=j.useState(!1);return d.jsxs("span",{className:"relative inline-block",children:[d.jsx("button",{type:"button",onClick:()=>r(a=>!a),title:"This setting is overridden on this machine",className:"cursor-pointer transition-colors hover:bg-primary/10",children:d.jsx(zd,{scope:"personal"})}),n&&d.jsxs("div",{className:"absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-outline-variant/20 bg-surface-container-high p-1 text-xs shadow-lg",children:[d.jsx("button",{type:"button",onClick:()=>{e(),r(!1)},className:"block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest",children:"Save to project"}),d.jsx("button",{type:"button",onClick:()=>{t(),r(!1)},className:"block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest",children:"Reset to project"})]})]})}const V7={sage:{label:"Sage",swatch:"#abcfb8"},moss:{label:"Moss",swatch:"#9ca884"},terracotta:{label:"Terracotta",swatch:"#d28a73"},dusk:{label:"Dusk",swatch:"#8faed1"},plum:{label:"Plum",swatch:"#b59ec8"},slate:{label:"Slate",swatch:"#a6b0b8"}},H7={light:{icon:Zz,label:"Light"},dark:{icon:Gz,label:"Dark"},system:{icon:Hz,label:"System"}},G7={default:"Default","geist-mono":"Geist",system:"System","sf-mono":"SF Mono","fira-code":"Fira Code","jetbrains-mono":"JetBrains"},o_="myco-ui-appearance-expanded";function $7(){const e=typeof window<"u"?localStorage.getItem(o_):null;return e===null?!0:e==="true"}function K7({collapsed:e}){const{effective:t,local:n,set:r,resetKey:a,saveAllAsProject:i,resetAll:l}=yz(),[o,f]=j.useState(!1),[c,h]=j.useState($7);j.useEffect(()=>{localStorage.setItem(o_,String(c))},[c]);const p=x=>n[x]!==void 0,m=(x,b)=>{r(x,b,"local").catch(w=>console.error("[appearance] write failed",w))};if(e)return null;const y=(x,b,w)=>d.jsxs("div",{id:Vp(`appearance.${b}`),"data-config-field":`appearance.${b}`,className:"rounded-md transition-all duration-300",children:[d.jsxs("div",{className:"flex items-center text-xs text-on-surface-variant",children:[x,p(b)?d.jsx(im,{onPromote:()=>r(b,t[b],"project").catch(S=>console.error("[appearance] promote failed",S)),onReset:()=>a(b).catch(S=>console.error("[appearance] reset failed",S))}):d.jsx(zd,{scope:"project"})]}),w]});return d.jsxs("div",{id:Ni.appearance,className:`rounded-md border border-[var(--ghost-border)] p-3 ${c?"space-y-3":""}`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("button",{type:"button",onClick:()=>h(x=>!x),className:"-m-1 flex flex-1 items-center gap-1.5 rounded p-1 text-left hover:bg-surface-container-high","aria-expanded":c,"aria-label":c?"Collapse appearance section":"Expand appearance section",children:[d.jsx(La,{className:`h-3 w-3 text-on-surface-variant transition-transform ${c?"":"-rotate-90"}`}),d.jsx("h3",{className:"text-[10px] uppercase tracking-[0.22em] text-on-surface-variant",children:"Appearance"})]}),c&&d.jsx("button",{type:"button",onClick:()=>f(x=>!x),className:"rounded p-1 hover:bg-surface-container-high","aria-label":"Appearance menu",children:d.jsx(Mz,{className:"h-3.5 w-3.5"})})]}),c&&o&&d.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[d.jsx("button",{type:"button",onClick:()=>{i(),f(!1)},className:"rounded px-2 py-1 text-left hover:bg-surface-container-high",children:"Save current as project defaults"}),d.jsx("button",{type:"button",onClick:()=>{l(),f(!1)},className:"rounded px-2 py-1 text-left hover:bg-surface-container-high",children:"Reset all to project defaults"})]}),c&&d.jsxs(d.Fragment,{children:[y("Color theme","theme",d.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1.5",children:P7.map(x=>{const b=V7[x];return d.jsx("button",{type:"button",onClick:()=>m("theme",x),title:b.label,"aria-label":b.label,className:`relative aspect-square rounded-md border ${t.theme===x?"border-primary":"border-[var(--ghost-border)]"}`,style:{backgroundColor:b.swatch},children:t.theme===x&&d.jsx(gc,{className:"absolute inset-0 m-auto h-3 w-3 text-on-surface"})},x)})})),y("Mode","mode",d.jsx("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:B7.map(x=>{const{icon:b,label:w}=H7[x];return d.jsxs("button",{type:"button",onClick:()=>m("mode",x),className:`flex items-center justify-center gap-1 rounded-md border py-1 text-xs ${t.mode===x?"border-primary text-on-surface":"border-[var(--ghost-border)] text-on-surface-variant"}`,"aria-label":w,children:[d.jsx(b,{className:"h-3 w-3"})," ",w]},x)})})),y("Font","font",d.jsx("select",{value:t.font,onChange:x=>m("font",x.target.value),className:"mt-2 h-8 w-full rounded-md border border-[var(--ghost-border)] bg-[var(--surface-container-lowest)] px-2 text-xs",children:z7.map(x=>d.jsx("option",{value:x,children:G7[x]},x))})),y("Density","density",d.jsx("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:I7.map(x=>d.jsx("button",{type:"button",onClick:()=>m("density",x),className:`rounded-md border py-1 text-xs capitalize ${t.density===x?"border-primary text-on-surface":"border-[var(--ghost-border)] text-on-surface-variant"}`,children:x},x))}))]})]})}const Y7=[{to:"/",label:"Dashboard",icon:Fz},{to:"/sessions",label:"Sessions",icon:Gp},{to:"/mycelium",label:"Mycelium",icon:rD},{to:"/skills",label:"Skills",icon:I1},{to:"/agent",label:"Agent",icon:Dd},{to:"/settings",label:"Settings",icon:Yz},{to:"/operations",label:"Operations",icon:lD},{to:"/team",label:"Team",icon:tI},{to:"/logs",label:"Logs",icon:iD}],Ok="myco-ui-sidebar-collapsed",Lk=768,X7=80,Q7=2e3,Pk=["ring-2","ring-primary/40","bg-primary/5"];function W7(){const[e,t]=j.useState(()=>localStorage.getItem(Ok)==="true"),n=j.useCallback(()=>{t(r=>{const a=!r;return localStorage.setItem(Ok,String(a)),a})},[]);return{collapsed:e,toggle:n}}function Z7(){const[e,t]=j.useState(!1),[n,r]=j.useState(()=>typeof window<"u"&&window.innerWidth<Lk);j.useEffect(()=>{const o=window.matchMedia(`(max-width: ${Lk-1}px)`),f=c=>{r(c.matches),c.matches||t(!1)};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=Ba();j.useEffect(()=>{t(!1)},[a.pathname]),j.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]);const i=j.useCallback(()=>t(o=>!o),[]),l=j.useCallback(()=>t(!1),[]);return{open:e,isMobile:n,toggle:i,close:l}}function J7({collapsed:e=!1}){const{restart:t,isRestarting:n}=cD();return d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>t(),disabled:n,title:e?n?"Restarting...":"Restart Daemon":void 0,className:ke("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[d.jsx($p,{className:ke("h-4 w-4",n&&"animate-spin")}),!e&&d.jsx("span",{children:n?"Restarting...":"Restart Daemon"})]})}function eG({collapsed:e}){const{data:t}=uD(),n=!!(t&&!t.exempt&&t.update_available),r=n?"/operations?tab=system":"/operations";return d.jsxs(_1,{to:r,title:e?"Operations":void 0,className:({isActive:a})=>ke("flex items-center rounded-md text-sm font-medium transition-colors",e?"justify-center px-2 py-2":"gap-3 px-3 py-2",a?"bg-primary/10 text-primary":"text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface"),children:[d.jsx(lD,{className:"h-4 w-4 shrink-0"}),!e&&"Operations",n&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-secondary shrink-0 ml-auto"})]})}function Bk({collapsed:e,vaultName:t,onSearchOpen:n,onNotificationsOpen:r,unreadCount:a,onCollapseToggle:i,showCollapseToggle:l}){return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:ke("px-4 py-5",e&&"px-2 py-4 flex justify-center"),children:e?d.jsxs("div",{className:"relative flex items-center",children:[d.jsx("span",{className:"font-serif text-base text-primary",children:"m"}),d.jsx("span",{className:"ml-1 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}):d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),d.jsx("span",{className:"ml-2 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}),t&&d.jsx("span",{className:"font-mono text-xs text-outline uppercase tracking-widest mt-0.5",children:t})]})}),d.jsxs("div",{className:"px-2 pt-2 pb-1 space-y-0.5",children:[d.jsxs("button",{type:"button",onClick:n,title:e?"Search (⌘K)":void 0,className:ke("flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface",e?"justify-center px-2 py-2":"gap-3 px-3 py-2"),children:[d.jsx(xc,{className:"h-4 w-4 shrink-0"}),!e&&d.jsx("span",{className:"flex-1 text-left",children:"Search"}),!e&&d.jsxs("kbd",{className:"text-xs text-on-surface-variant/60 font-mono",children:["⌘","K"]})]}),d.jsxs("button",{type:"button",onClick:r,title:e?"Notifications":void 0,className:ke("flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface",e?"justify-center px-2 py-2":"gap-3 px-3 py-2"),children:[d.jsx(dp,{className:"h-4 w-4 shrink-0"}),!e&&d.jsx("span",{className:"flex-1 text-left",children:"Notifications"}),a>0&&d.jsx("span",{className:ke("h-2 w-2 rounded-full bg-primary shrink-0",!e&&"ml-auto")})]})]}),d.jsx("nav",{className:"flex-1 space-y-1 px-2 py-2","aria-label":"Main navigation",children:Y7.map(o=>o.to==="/operations"?d.jsx(eG,{collapsed:e},o.to):d.jsxs(_1,{to:o.to,end:o.to==="/",title:e?o.label:void 0,className:({isActive:f})=>ke("flex items-center rounded-md text-sm font-medium transition-colors",e?"justify-center px-2 py-2":"gap-3 px-3 py-2",f?"bg-primary/10 text-primary":"text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface"),children:[d.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),!e&&o.label]},o.to))}),d.jsxs("div",{className:ke("py-3 space-y-2 mt-auto",e?"px-1 flex flex-col items-center":"px-2"),children:[!e&&d.jsx(K7,{collapsed:e}),d.jsx(J7,{collapsed:e})]}),l&&i&&d.jsx("div",{className:ke("px-2 py-2",e&&"flex justify-center"),children:d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:i,className:ke("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),title:e?"Expand sidebar":"Collapse sidebar",children:[e?d.jsx(ha,{className:"h-4 w-4"}):d.jsx(L1,{className:"h-4 w-4"}),!e&&d.jsx("span",{children:"Collapse"})]})})]})}function tG(){const{collapsed:e,toggle:t}=W7(),{data:n}=Md(),r=n==null?void 0:n.vault.name,[a,i]=j.useState(!1),[l,o]=j.useState(!1),{data:f}=K6(),c=(f==null?void 0:f.count)??0,h=Z7();j.useEffect(()=>{const x=b=>{(b.metaKey||b.ctrlKey)&&b.key==="k"&&(b.preventDefault(),i(w=>!w))};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[]),j.useEffect(()=>{if(!h.open)return;const x=b=>{b.key==="Escape"&&(b.preventDefault(),h.close())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[h.open,h.close]);const p=j.useCallback(()=>i(!0),[]),m=j.useCallback(()=>o(!0),[]),y=j.useCallback(()=>o(!1),[]);return j.useEffect(()=>{const x=new URLSearchParams(location.search),b=x.get(bz)??void 0,w=x.get(xz)??void 0;if(!b&&!w)return;const S=window.setTimeout(()=>{const N=nG(b,w);N&&(N.scrollIntoView({behavior:"smooth",block:"center"}),N.classList.add(...Pk),window.setTimeout(()=>{N.classList.remove(...Pk)},Q7))},X7);return()=>window.clearTimeout(S)},[location.key,location.search]),d.jsxs("div",{className:"flex h-screen bg-background",children:[d.jsx(G6,{open:a,onOpenChange:i}),d.jsx(aU,{panelOpen:l}),d.jsx(_7,{open:l,onClose:y}),d.jsx(O7,{}),h.isMobile&&d.jsxs("div",{className:"fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3",children:[d.jsx("button",{type:"button",onClick:h.toggle,className:"rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":h.open?"Close navigation":"Open navigation",children:h.open?d.jsx(jl,{className:"h-5 w-5"}):d.jsx(Vz,{className:"h-5 w-5"})}),d.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),r&&d.jsx("span",{className:"font-mono text-[10px] text-outline uppercase tracking-widest",children:r}),d.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[d.jsxs("button",{type:"button",onClick:m,className:"relative rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":"Notifications",children:[d.jsx(dp,{className:"h-4 w-4"}),c>0&&d.jsx("span",{className:"absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary"})]}),d.jsx("button",{type:"button",onClick:p,className:"rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":"Search",children:d.jsx(xc,{className:"h-4 w-4"})})]})]}),h.isMobile&&h.open&&d.jsx("div",{className:"fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-sm transition-opacity",onClick:h.close,"aria-hidden":"true"}),h.isMobile&&d.jsx("aside",{className:ke("fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out",h.open?"translate-x-0":"-translate-x-full"),children:d.jsx(Bk,{collapsed:!1,vaultName:r,onSearchOpen:p,onNotificationsOpen:m,unreadCount:c,showCollapseToggle:!1})}),!h.isMobile&&d.jsx("aside",{className:ke("flex flex-col bg-surface-container transition-[width] duration-200",e?"w-14":"w-56"),children:d.jsx(Bk,{collapsed:e,vaultName:r,onSearchOpen:p,onNotificationsOpen:m,unreadCount:c,onCollapseToggle:t,showCollapseToggle:!0})}),d.jsx("main",{className:ke("flex-1 overflow-auto bg-surface",h.isMobile&&"pt-12"),"aria-label":"Page content",children:d.jsx(CB,{})})]})}function nG(e,t){if(e){let n=e;for(;n.length>0;){const r=document.getElementById(Vp(n));if(r instanceof HTMLElement)return r;const a=n.lastIndexOf(".");if(a===-1)break;n=n.slice(0,a)}}if(t){const n=document.getElementById(t);if(n instanceof HTMLElement)return n}return null}function mw({isLoading:e,error:t,loadingText:n="Loading...",children:r}){return e?d.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Gn,{className:"h-5 w-5 animate-spin"}),d.jsx("span",{className:"font-sans text-sm",children:n})]}):t?d.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to connect to daemon"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:t.message})]}):d.jsx(d.Fragment,{children:r})}const ml=60,uo=3600,ed=86400,Ra=1e3;function gw(e){if(e<ml)return`${Math.floor(e)}s`;if(e<uo)return`${Math.floor(e/ml)}m`;if(e<ed){const r=Math.floor(e/uo),a=Math.floor(e%uo/ml);return`${r}h ${a}m`}const t=Math.floor(e/ed),n=Math.floor(e%ed/uo);return`${t}d ${n}h`}function sm(e){const t=(Date.now()-new Date(e).getTime())/Ra;return t<ml?"just now":t<uo?`${Math.floor(t/ml)}m ago`:t<ed?`${Math.floor(t/uo)}h ago`:`${Math.floor(t/ed)}d ago`}function bi(e){return sm(new Date(e*Ra).toISOString())}function Hb(e){return new Date(e*Ra).toLocaleString()}function bp(e,t){return e?e.length>t?e.slice(0,t)+"…":e:""}const rG=8;function gl(e){return e?e.slice(0,rG):""}function aG(e){return e.split("/").pop()||e}function yw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function lm(e,t){if(e===null||t===null)return"—";const n=(t-e)*Ra;if(n<Ra)return`${n}ms`;if(n<ml*Ra)return`${(n/Ra).toFixed(1)}s`;const r=Math.floor(n/(ml*Ra)),a=Math.floor(n%(ml*Ra)/Ra);return`${r}m ${a}s`}function iG(e){return e===null?"—":e<Ra?`${e}ms`:`${(e/Ra).toFixed(1)}s`}function om(e){return e!==null?bi(e):"—"}const kv=1024,zk=["KB","MB","GB","TB"];function wo(e){if(e<kv)return`${e} B`;let t=e/kv,n=0;for(;t>=kv&&n<zk.length-1;)t/=kv,n++;const r=t>=100?0:1;return`${t.toFixed(r)} ${zk[n]}`}const Ik=100,sG=1;function lG(e){const{embedded_count:t,total_embeddable:n}=e.embedding;return n===0?Ik:Number((t/n*Ik).toFixed(sG))}function oG(e){const t=e.agent.last_run_status==="error",n=e.embedding.queue_depth>0||e.unprocessed_batches>0;return t?"Issues detected in the network":n?"Work in progress across the network":"Network Topology Active"}function uG(e){return e.embedding.queue_depth>0||e.unprocessed_batches>0}function cG({active:e}){const t=e?"animate-pulse-slow":"";return d.jsxs("svg",{className:"absolute inset-0 w-full h-full opacity-20 pointer-events-none",viewBox:"0 0 400 300",preserveAspectRatio:"xMidYMid slice",children:[d.jsx("path",{d:"M200,280 Q200,220 200,160",fill:"none",stroke:"var(--primary)",strokeWidth:"2",className:t}),d.jsx("path",{d:"M200,200 Q240,170 280,180",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),d.jsx("path",{d:"M200,170 Q160,140 120,155",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),d.jsx("path",{d:"M200,160 Q230,110 270,90",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),d.jsx("path",{d:"M200,160 Q170,110 130,80",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),d.jsx("path",{d:"M280,180 Q310,170 340,190",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),d.jsx("path",{d:"M120,155 Q90,145 60,160",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),d.jsx("circle",{cx:"280",cy:"180",r:"3",fill:"var(--primary)",opacity:"0.7"}),d.jsx("circle",{cx:"120",cy:"155",r:"3",fill:"var(--secondary)",opacity:"0.7"}),d.jsx("circle",{cx:"270",cy:"90",r:"2.5",fill:"var(--tertiary)",opacity:"0.6"}),d.jsx("circle",{cx:"130",cy:"80",r:"2.5",fill:"var(--secondary)",opacity:"0.6"}),d.jsx("circle",{cx:"340",cy:"190",r:"2",fill:"var(--tertiary)",opacity:"0.4"}),d.jsx("circle",{cx:"60",cy:"160",r:"2",fill:"var(--primary)",opacity:"0.4"}),d.jsx("circle",{cx:"200",cy:"160",r:"4",fill:"var(--primary)",className:e?"animate-pulse":""})]})}function fG({stats:e}){const t=lG(e),n=oG(e),r=uG(e),a=e.daemon.active_sessions.length,i=gw(e.daemon.uptime_seconds);return d.jsxs("section",{className:"relative flex items-center justify-center rounded-xl overflow-hidden glass-panel border border-outline-variant/10 min-h-[320px]",children:[d.jsx(cG,{active:r}),d.jsxs("div",{className:"text-center relative z-20 space-y-3 py-12",children:[d.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-on-surface-variant/80",children:n}),d.jsx("h1",{className:"font-serif text-5xl italic text-on-surface drop-shadow-sm",children:"Myco"}),d.jsxs("p",{className:"font-mono text-sm text-outline",children:["Node connectivity at ",t,"% capacity"]}),d.jsxs("div",{className:"flex items-center justify-center gap-6 pt-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"h-2 w-2 rounded-full bg-sage shadow-sage-glow animate-pulse"}),d.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[a," active ",a===1?"session":"sessions"]})]}),d.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[e.vault.spore_count," spores"]})}),d.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:["uptime ",i]})})]})]})]})}function dG({data:e,width:t=120,height:n=40,className:r}){if(e.length<2)return null;const a=Math.min(...e),l=Math.max(...e)-a||1,o=e.map((h,p)=>({x:p/(e.length-1)*t,y:n-(h-a)/l*n}));let f=`M ${o[0].x} ${o[0].y}`;for(let h=0;h<o.length-1;h++){const p=o[Math.max(0,h-1)],m=o[h],y=o[h+1],x=o[Math.min(o.length-1,h+2)],b=m.x+(y.x-p.x)/6,w=m.y+(y.y-p.y)/6,S=y.x-(x.x-m.x)/6,N=y.y-(x.y-m.y)/6;f+=` C ${b} ${w}, ${S} ${N}, ${y.x} ${y.y}`}const c=`${f} L ${t} ${n} L 0 ${n} Z`;return d.jsxs("svg",{width:t,height:n,className:r,viewBox:`0 0 ${t} ${n}`,children:[d.jsx("defs",{children:d.jsxs("linearGradient",{id:"sparkline-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[d.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:"0.2"}),d.jsx("stop",{offset:"100%",stopColor:"var(--primary)",stopOpacity:"0"})]})}),d.jsx("path",{d:c,fill:"url(#sparkline-fill)"}),d.jsx("path",{d:f,fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",strokeOpacity:"0.8"})]})}const hG={sage:"border-t-sage",ochre:"border-t-ochre",terracotta:"border-t-terracotta",outline:"border-t-outline"},vG={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta",outline:"text-on-surface"};function Yt({label:e,value:t,sublabel:n,accent:r,sparklineData:a,className:i,href:l}){const o=ke("rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80",l&&"cursor-pointer",hG[r],i),f=d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-outline mb-2",children:e}),d.jsxs("div",{className:"flex items-end justify-between gap-2",children:[d.jsx("p",{className:ke("font-serif text-2xl font-bold",vG[r]),children:t}),a&&a.length>=2&&d.jsx(dG,{data:a,width:80,height:28,className:"opacity-60"})]}),n&&d.jsx("p",{className:"font-mono text-[10px] text-outline mt-1",children:n})]});return l?d.jsx(_a,{to:l,className:ke(o,"block no-underline"),children:f}):d.jsx("div",{className:o,children:f})}function pG({stats:e}){const t=e.embedding.total_embeddable>0?Math.round(e.embedding.embedded_count/e.embedding.total_embeddable*100):0,n=e.digest.tiers_available.length>0?`${e.digest.tiers_available.length} tiers`:"None",r=e.agent.last_run_at?bi(e.agent.last_run_at):"Never";return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[d.jsx(Yt,{label:"Sessions",value:String(e.vault.session_count),sublabel:`${e.daemon.active_sessions.length} active`,accent:"sage",href:"/sessions"}),d.jsx(Yt,{label:"Spores",value:String(e.vault.spore_count),sublabel:`${e.vault.entity_count} entities`,accent:"sage",href:"/mycelium?tab=spores"}),d.jsx(Yt,{label:"Embedding",value:`${t}%`,sublabel:`${e.embedding.embedded_count}/${e.embedding.total_embeddable}`,accent:e.embedding.queue_depth>0?"ochre":"sage",href:"/operations"}),d.jsx(Yt,{label:"Agent",value:`${e.agent.total_runs}`,sublabel:`last: ${r}`,accent:e.agent.last_run_status==="error"?"terracotta":"outline",href:"/agent"}),d.jsx(Yt,{label:"Digest",value:n,sublabel:e.digest.generated_at?bi(e.digest.generated_at):void 0,accent:"outline",href:"/mycelium?tab=digest"}),d.jsx(Yt,{label:"Uptime",value:gw(e.daemon.uptime_seconds),sublabel:`v${e.daemon.version}`,accent:"outline"})]})}function u_(e=20){return Or({queryKey:["activity",e],queryFn:({signal:t})=>lt(`/activity?limit=${e}`,{signal:t}),refetchInterval:Kn.STATS,pollCategory:"standard"})}function mG(e){return e==="agent_run"?"ochre":e==="spore"?"sage":e.includes("error")||e.includes("fail")?"terracotta":"sage"}function gG(e){switch(e){case"sage":return{label:"STABLE",dotClass:"bg-sage shadow-sage-glow"};case"ochre":return{label:"ACTIVE",dotClass:"bg-ochre shadow-ochre-glow"};case"terracotta":return{label:"WARNING",dotClass:"bg-terracotta shadow-terracotta-glow"}}}const yG={sage:"border-l-sage",ochre:"border-l-ochre",terracotta:"border-l-terracotta"},xG={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},bG={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},wG={sage:"border-sage/20",ochre:"border-ochre/20",terracotta:"border-terracotta/20"};function SG(e){return`#${e.slice(-6).toUpperCase()}`}function Fk(e){return e.summary}function EG({event:e}){const t=Za(),n=mG(e.type),r=gG(n),a=bi(e.timestamp),i=e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?`/mycelium?tab=spores&spore=${e.id}`:null;return d.jsxs("div",{className:ke("p-5 rounded-lg border-l-4 bg-surface-container/60 hover:bg-surface-container-high group hover-lift transition-colors",i&&"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",yG[n]),onClick:()=>i&&t(i),onKeyDown:l=>{i&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i))},tabIndex:i?0:void 0,role:i?"link":void 0,"aria-label":`${Fk(e)} - ${r.label} - ${a}`,children:[d.jsxs("div",{className:"flex justify-between items-start mb-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:ke("font-mono text-xs font-bold",xG[n]),children:SG(e.id)}),d.jsx("h4",{className:"font-serif text-lg text-on-surface leading-tight mt-0.5 truncate",children:Fk(e)})]}),d.jsx("div",{className:ke("w-8 h-8 rounded-full border-2 flex items-center justify-center shrink-0 ml-3",wG[n]),children:d.jsx("div",{className:ke("w-3.5 h-3.5 rounded-full",r.dotClass)})})]}),d.jsxs("p",{className:"text-xs text-on-surface/60 line-clamp-2 leading-relaxed italic mb-3",children:["> ",e.type.replace(/_/g," ")," event recorded ",a]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("span",{className:ke("px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono rounded",bG[n]),children:r.label}),d.jsx("span",{className:"px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono text-outline rounded",children:a})]})]})}const Uk=6,CG=3;function NG(){return d.jsxs("div",{className:"p-5 rounded-lg border-l-4 border-l-outline-variant/30 bg-surface-container/40 animate-pulse",children:[d.jsxs("div",{className:"flex justify-between items-start mb-3",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high"}),d.jsx("div",{className:"h-5 w-40 rounded bg-surface-container-high"})]}),d.jsx("div",{className:"w-8 h-8 rounded-full bg-surface-container-high"})]}),d.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-container-high/60 mb-3"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("div",{className:"h-5 w-16 rounded bg-surface-container-high/60"}),d.jsx("div",{className:"h-5 w-12 rounded bg-surface-container-high/60"})]})]})}function kG(){const{data:e,isLoading:t}=u_(Uk*2),n=(e??[]).filter(r=>r.type!=="agent_run").slice(0,Uk);return d.jsxs("section",{className:"space-y-5",children:[d.jsx("div",{className:"flex items-end justify-between border-b border-outline-variant/10 pb-4",children:d.jsxs("div",{children:[d.jsx("h3",{className:"font-serif text-3xl text-on-surface",children:"Session Pods"}),d.jsx("p",{className:"font-mono text-[10px] uppercase text-outline mt-1",children:"Monitoring concurrent thread activity"})]})}),t?d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:Array.from({length:CG}).map((r,a)=>d.jsx(NG,{},a))}):n.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3",children:[d.jsxs("div",{className:"relative",children:[d.jsx(aD,{className:"h-10 w-10 text-outline/30"}),d.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3 w-3 rounded-full bg-surface-container border-2 border-surface"})]}),d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No recent activity"}),d.jsx("p",{className:"font-mono text-[10px] uppercase text-outline tracking-wider",children:"Pods appear as sessions and spores are captured"})]}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:n.map(r=>d.jsx(EG,{event:r},r.id))})]})}const TG=Kn.STATS,jG=Kn.HEALTH,AG=Kn.STATS,xw=new Set(["completed","failed","skipped"]),RG=Kn.STATS,bw=6e4,DG=50;function c_(e){const t=(e==null?void 0:e.limit)??DG,n=new URLSearchParams;n.set("limit",String(t)),(e==null?void 0:e.offset)!==void 0&&n.set("offset",String(e.offset)),e!=null&&e.search&&n.set("search",e.search),e!=null&&e.status&&n.set("status",e.status),e!=null&&e.task&&n.set("task",e.task);const r=n.toString();return Or({queryKey:["agent-runs",e],queryFn:({signal:a})=>lt(`/agent/runs?${r}`,{signal:a}),pollCategory:"standard",refetchInterval:TG})}function MG(e){return qt({queryKey:["agent-run",e],queryFn:({signal:n})=>lt(`/agent/runs/${e}`,{signal:n}),enabled:e!==void 0,refetchInterval:n=>{var a,i;const r=(i=(a=n.state.data)==null?void 0:a.run)==null?void 0:i.status;return r&&xw.has(r)?!1:jG}})}function _G(e,t){const n=t?xw.has(t):!1;return Or({queryKey:["agent-reports",e],queryFn:({signal:r})=>lt(`/agent/runs/${e}/reports`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:AG})}function OG(e,t){const n=t?xw.has(t):!1;return Or({queryKey:["agent-turns",e],queryFn:({signal:r})=>lt(`/agent/runs/${e}/turns`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:RG})}function Nc(){return qt({queryKey:["agent-tasks"],queryFn:({signal:e})=>lt("/agent/tasks",{signal:e}),staleTime:bw})}function LG(e){return qt({queryKey:["agent-task",e],queryFn:({signal:t})=>lt(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:bw})}function PG(){const e=Sn();return Er({mutationFn:({taskId:t,name:n})=>nn(`/agent/tasks/${t}/copy`,n?{name:n}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function BG(){const e=Sn();return Er({mutationFn:t=>O1(`/agent/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function zG(e){return qt({queryKey:["agent-task-yaml",e],queryFn:({signal:t})=>lt(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:bw})}function IG(){const e=Sn();return Er({mutationFn:({taskId:t,yaml:n})=>mc(`/agent/tasks/${t}`,{yaml:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]}),e.invalidateQueries({queryKey:["agent-task"]}),e.invalidateQueries({queryKey:["agent-task-yaml"]})}})}function ww(){const e=Sn();return Er({mutationFn:t=>nn("/agent/run",t),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-runs"]})}})}function Sw(e){return e===null?"—":`$${e.toFixed(4)}`}function Ew(e){return e===null?"—":e.toLocaleString()}function f_(e){switch(e){case"completed":return"default";case"running":return"warning";case"failed":return"destructive";default:return"secondary"}}function d_(e){return e===F1?"warning":"secondary"}const h_="Default task";function v_(e,t){if(!e)return h_;const n=t.find(r=>r.name===e);return(n==null?void 0:n.displayName)??e}const FG=5,qk={running:"bg-sage animate-pulse",completed:"bg-sage",failed:"bg-terracotta",skipped:"bg-outline/40",pending:"bg-outline/40"};function UG({run:e,taskName:t,onClick:n}){const r=qk[e.status]??qk.pending;return d.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-outline-variant/5 last:border-0 cursor-pointer hover:bg-surface-container-high/50 -mx-2 px-2 rounded transition-colors",onClick:n,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n())},role:"link",tabIndex:0,"aria-label":`View run: ${t}`,children:[d.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[d.jsx("span",{className:ke("h-2 w-2 shrink-0 rounded-full",r)}),d.jsx("span",{className:"text-sm text-on-surface truncate",children:t})]}),d.jsxs("div",{className:"flex items-center gap-3 shrink-0 font-mono text-[11px] text-outline",children:[d.jsx("span",{children:e.started_at!==null?bi(e.started_at):"—"}),d.jsx("span",{children:lm(e.started_at,e.completed_at)})]})]})}function qG(){const{data:e,isLoading:t}=c_({limit:FG}),{data:n}=Nc(),r=Za(),a=(n==null?void 0:n.tasks)??[],i=(e==null?void 0:e.runs)??[];return d.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10",children:[d.jsxs("div",{className:"flex justify-between items-center mb-6",children:[d.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"Agent Runs"}),d.jsx(Dd,{className:"h-5 w-5 text-outline"})]}),t?d.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"Loading runs..."}):i.length===0?d.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"No agent runs yet"}):d.jsx("div",{children:i.map(l=>d.jsx(UG,{run:l,taskName:v_(l.task,a),onClick:()=>r("/agent")},l.id))})]})}const VG=12,HG=8;function GG(e){return e.includes("error")||e.includes("fail")?"error":e==="agent_run"?"warn":"ok"}const $G={ok:"[OK]",warn:"[WRN]",error:"[ERR]"},KG={ok:"text-sage",warn:"text-ochre",error:"text-terracotta"};function YG(e){return new Date(e*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function XG(e){return e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?`/mycelium?tab=spores&spore=${e.id}`:null}function QG({event:e,onClick:t}){const n=GG(e.type);return d.jsxs("div",{className:ke("flex gap-4 items-start border-b border-outline-variant/5 pb-2 font-mono text-[11px] transition-all duration-150",t&&"cursor-pointer hover:bg-surface-container-high/50 hover:translate-x-1 -mx-2 px-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"),onClick:t,onKeyDown:t?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())}:void 0,tabIndex:t?0:void 0,role:t?"link":void 0,"aria-label":t?`${e.type.replace(/_/g," ")}: ${e.summary}`:void 0,children:[d.jsx("span",{className:"text-outline shrink-0 tabular-nums",children:YG(e.timestamp)}),d.jsx("span",{className:ke("shrink-0 font-bold",KG[n]),children:$G[n]}),d.jsx("span",{className:"text-on-surface/70 truncate",children:e.summary})]})}function WG(){const{data:e,isLoading:t}=u_(VG),n=Za(),r=(e==null?void 0:e.slice(0,HG))??[];return d.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10 transition-[border-color] duration-200 hover:border-outline-variant/25",children:[d.jsxs("div",{className:"flex justify-between items-center mb-6",children:[d.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"System Integrity Logs"}),d.jsx("span",{className:"text-[10px] font-mono text-sage px-2 py-1 bg-sage-muted rounded",children:"LIVE"})]}),t?d.jsx("div",{className:"space-y-3",children:[1,2,3].map(a=>d.jsxs("div",{className:"flex gap-4 items-start pb-2 animate-pulse",children:[d.jsx("div",{className:"h-3 w-14 rounded bg-surface-container-high/50"}),d.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high/50"}),d.jsx("div",{className:"h-3 flex-1 rounded bg-surface-container-high/40"})]},a))}):r.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[d.jsx(iD,{className:"h-8 w-8 text-outline/20"}),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"No log entries yet"})]}):d.jsx("div",{className:"space-y-3",children:r.map(a=>{const i=XG(a);return d.jsx(QG,{event:a,onClick:i?()=>n(i):void 0},a.id)})})]})}function ZG(e){const{embedded_count:t,total_embeddable:n}=e.embedding;if(n===0)return"Initializing";const r=t/n;return r>=.95?"Optimal":r>=.7?"Good":"Degraded"}function JG({stats:e}){const t=ZG(e);return d.jsxs("div",{className:"flex items-center justify-between px-2 py-3 border-t border-outline-variant/10",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"font-mono text-[10px] uppercase text-sage",children:["System Connectivity: ",t]}),d.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sage animate-pulse"})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:e.vault.name}),d.jsxs("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:["v",e.daemon.version]})]})]})}function e$(){const{data:e,isLoading:t,isError:n,error:r}=Md();return d.jsx(mw,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Connecting to daemon...",children:e&&d.jsxs("div",{className:"relative min-h-full",children:[d.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.04]",children:d.jsxs("svg",{height:"100%",width:"100%",viewBox:"0 0 800 800",preserveAspectRatio:"none",children:[d.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 300 500 200 400C100 300 0 400 0 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),d.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 500 500 600 400C700 300 800 400 800 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),d.jsx("path",{className:"mycelial-connector",d:"M400 800C400 500 450 300 400 100",fill:"none",stroke:"#abcfb8",strokeWidth:"1"})]})}),d.jsxs("div",{className:"relative z-10 p-6 lg:p-8 max-w-7xl mx-auto space-y-10",children:[d.jsx(fG,{stats:e}),d.jsx(pG,{stats:e}),d.jsx(kG,{}),d.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[d.jsx(qG,{}),d.jsx(WG,{})]}),d.jsx(JG,{stats:e})]})]})})}const t$=Kp("rounded-md transition-colors",{variants:{level:{lowest:"bg-surface-container-lowest",low:"bg-surface-container-low",default:"bg-surface-container",high:"bg-surface-container-high",highest:"bg-surface-container-highest",bright:"bg-surface-bright"},interactive:{true:"cursor-pointer hover-lift hover:brightness-[1.08]",false:""},ghostBorder:{true:"border border-[var(--ghost-border)]",false:""},glass:{true:"backdrop-blur-xl bg-surface-variant/60",false:""},glow:{true:"shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]",false:""}},defaultVariants:{level:"low",interactive:!1,ghostBorder:!1,glass:!1,glow:!1}}),$e=j.forwardRef(({className:e,level:t,interactive:n,ghostBorder:r,glass:a,glow:i,...l},o)=>d.jsx("div",{ref:o,className:ke(t$({level:t,interactive:n,ghostBorder:r,glass:a,glow:i}),e),...l}));$e.displayName="Surface";function n$({tabs:e,activeTab:t,onTabChange:n,className:r}){return d.jsx("div",{className:ke("flex items-center gap-6",r),children:e.map(a=>d.jsx("button",{onClick:()=>n(a.id),className:ke("pb-2 font-sans text-sm font-medium transition-colors border-b-2",t===a.id?"text-primary border-primary":"text-on-surface-variant border-transparent hover:text-on-surface"),children:a.label},a.id))})}function wi({title:e,subtitle:t,tabs:n,activeTab:r,onTabChange:a,actions:i,className:l}){return d.jsxs("div",{className:ke("pb-6",l),children:[d.jsxs("div",{className:"flex items-start justify-between",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:e}),t&&d.jsx("p",{className:"mt-1 font-sans text-sm text-on-surface-variant",children:t})]}),i&&d.jsx("div",{className:"flex items-center gap-2",children:i})]}),n&&r&&a&&d.jsx(n$,{tabs:n,activeTab:r,onTabChange:a,className:"mt-4"})]})}function um({open:e,onOpenChange:t,title:n,description:r,icon:a,meta:i,impact:l,confirmLabel:o="Confirm",variant:f="destructive",onConfirm:c,isPending:h=!1}){var p,m;return d.jsx(_d,{open:e,onOpenChange:t,children:d.jsxs(wc,{className:"sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden",children:[d.jsxs(Od,{children:[d.jsxs("div",{className:"flex items-center gap-3",children:[a&&d.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15",children:a}),d.jsx(Sc,{children:n})]}),d.jsx(Jp,{children:r})]}),i&&i.length>0&&d.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3",children:[d.jsx("span",{className:"font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0",children:(p=i[0])==null?void 0:p.value}),i.length>1&&d.jsx("span",{className:"text-sm font-medium text-on-surface truncate",children:(m=i[1])==null?void 0:m.value})]}),l&&l.length>0&&d.jsx("div",{className:"grid grid-cols-2 gap-2",children:l.map(y=>d.jsxs("div",{className:"rounded-md border border-outline-variant/20 px-3 py-2",children:[d.jsx("div",{className:"font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant",children:y.label}),d.jsx("div",{className:"font-sans text-base font-medium text-on-surface",children:y.value})]},y.label))}),d.jsxs(Zp,{children:[d.jsx(Ae,{variant:"secondary",size:"sm",onClick:()=>t(!1),disabled:h,children:"Cancel"}),d.jsxs(Ae,{variant:f,size:"sm",onClick:c,disabled:h,className:"gap-2",children:[h&&d.jsx(Gn,{className:"h-4 w-4 animate-spin"}),o]})]})]})})}function Vk(e,[t,n]){return Math.min(n,Math.max(t,e))}function r$(e){const t=e+"CollectionProvider",[n,r]=Yp(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:w,children:S}=b,N=Wi.useRef(null),C=Wi.useRef(new Map).current;return d.jsx(a,{scope:w,itemMap:C,collectionRef:N,children:S})};l.displayName=t;const o=e+"CollectionSlot",f=ld(o),c=Wi.forwardRef((b,w)=>{const{scope:S,children:N}=b,C=i(o,S),T=jn(w,C.collectionRef);return d.jsx(f,{ref:T,children:N})});c.displayName=o;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=ld(h),y=Wi.forwardRef((b,w)=>{const{scope:S,children:N,...C}=b,T=Wi.useRef(null),R=jn(w,T),A=i(h,S);return Wi.useEffect(()=>(A.itemMap.set(T,{ref:T,...C}),()=>void A.itemMap.delete(T))),d.jsx(m,{[p]:"",ref:R,children:N})});y.displayName=h;function x(b){const w=i(e+"CollectionConsumer",b);return Wi.useCallback(()=>{const N=w.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((A,D)=>C.indexOf(A.ref.current)-C.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:l,Slot:c,ItemSlot:y},x,r]}var a$=j.createContext(void 0);function i$(e){const t=j.useContext(a$);return e||t||"ltr"}const s$=["top","right","bottom","left"],bl=Math.min,ua=Math.max,wp=Math.round,Tv=Math.floor,gi=e=>({x:e,y:e}),l$={left:"right",right:"left",bottom:"top",top:"bottom"};function Gb(e,t,n){return ua(e,bl(t,n))}function us(e,t){return typeof e=="function"?e(t):e}function cs(e){return e.split("-")[0]}function kc(e){return e.split("-")[1]}function Cw(e){return e==="x"?"y":"x"}function Nw(e){return e==="y"?"height":"width"}function hi(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kw(e){return Cw(hi(e))}function o$(e,t,n){n===void 0&&(n=!1);const r=kc(e),a=kw(e),i=Nw(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Sp(l)),[l,Sp(l)]}function u$(e){const t=Sp(e);return[$b(e),t,$b(t)]}function $b(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hk=["left","right"],Gk=["right","left"],c$=["top","bottom"],f$=["bottom","top"];function d$(e,t,n){switch(e){case"top":case"bottom":return n?t?Gk:Hk:t?Hk:Gk;case"left":case"right":return t?c$:f$;default:return[]}}function h$(e,t,n,r){const a=kc(e);let i=d$(cs(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map($b)))),i}function Sp(e){const t=cs(e);return l$[t]+e.slice(t.length)}function v$(e){return{top:0,right:0,bottom:0,left:0,...e}}function p_(e){return typeof e!="number"?v$(e):{top:e,right:e,bottom:e,left:e}}function Ep(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function $k(e,t,n){let{reference:r,floating:a}=e;const i=hi(t),l=kw(t),o=Nw(l),f=cs(t),c=i==="y",h=r.x+r.width/2-a.width/2,p=r.y+r.height/2-a.height/2,m=r[o]/2-a[o]/2;let y;switch(f){case"top":y={x:h,y:r.y-a.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-a.width,y:p};break;default:y={x:r.x,y:r.y}}switch(kc(t)){case"start":y[l]-=m*(n&&c?-1:1);break;case"end":y[l]+=m*(n&&c?-1:1);break}return y}async function p$(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:l,elements:o,strategy:f}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:m=!1,padding:y=0}=us(t,e),x=p_(y),w=o[m?p==="floating"?"reference":"floating":p],S=Ep(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:h,strategy:f})),N=p==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),T=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},R=Ep(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:N,offsetParent:C,strategy:f}):N);return{top:(S.top-R.top+x.top)/T.y,bottom:(R.bottom-S.bottom+x.bottom)/T.y,left:(S.left-R.left+x.left)/T.x,right:(R.right-S.right+x.right)/T.x}}const m$=50,g$=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,o=l.detectOverflow?l:{...l,detectOverflow:p$},f=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:p}=$k(c,r,f),m=r,y=0;const x={};for(let b=0;b<i.length;b++){const w=i[b];if(!w)continue;const{name:S,fn:N}=w,{x:C,y:T,data:R,reset:A}=await N({x:h,y:p,initialPlacement:r,placement:m,strategy:a,middlewareData:x,rects:c,platform:o,elements:{reference:e,floating:t}});h=C??h,p=T??p,x[S]={...x[S],...R},A&&y<m$&&(y++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(c=A.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):A.rects),{x:h,y:p}=$k(c,m,f)),b=-1)}return{x:h,y:p,placement:m,strategy:a,middlewareData:x}},y$=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:o,middlewareData:f}=t,{element:c,padding:h=0}=us(e,t)||{};if(c==null)return{};const p=p_(h),m={x:n,y:r},y=kw(a),x=Nw(y),b=await l.getDimensions(c),w=y==="y",S=w?"top":"left",N=w?"bottom":"right",C=w?"clientHeight":"clientWidth",T=i.reference[x]+i.reference[y]-m[y]-i.floating[x],R=m[y]-i.reference[y],A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let D=A?A[C]:0;(!D||!await(l.isElement==null?void 0:l.isElement(A)))&&(D=o.floating[C]||i.floating[x]);const O=T/2-R/2,L=D/2-b[x]/2-1,M=bl(p[S],L),B=bl(p[N],L),P=M,q=D-b[x]-B,H=D/2-b[x]/2+O,G=Gb(P,H,q),F=!f.arrow&&kc(a)!=null&&H!==G&&i.reference[x]/2-(H<P?M:B)-b[x]/2<0,V=F?H<P?H-P:H-q:0;return{[y]:m[y]+V,data:{[y]:G,centerOffset:H-G-V,...F&&{alignmentOffset:V}},reset:F}}}),x$=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:l,initialPlacement:o,platform:f,elements:c}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...w}=us(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=cs(a),N=hi(o),C=cs(o)===o,T=await(f.isRTL==null?void 0:f.isRTL(c.floating)),R=m||(C||!b?[Sp(o)]:u$(o)),A=x!=="none";!m&&A&&R.push(...h$(o,b,x,T));const D=[o,...R],O=await f.detectOverflow(t,w),L=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&L.push(O[S]),p){const H=o$(a,l,T);L.push(O[H[0]],O[H[1]])}if(M=[...M,{placement:a,overflows:L}],!L.every(H=>H<=0)){var B,P;const H=(((B=i.flip)==null?void 0:B.index)||0)+1,G=D[H];if(G&&(!(p==="alignment"?N!==hi(G):!1)||M.every(Y=>hi(Y.placement)===N?Y.overflows[0]>0:!0)))return{data:{index:H,overflows:M},reset:{placement:G}};let F=(P=M.filter(V=>V.overflows[0]<=0).sort((V,Y)=>V.overflows[1]-Y.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(y){case"bestFit":{var q;const V=(q=M.filter(Y=>{if(A){const Q=hi(Y.placement);return Q===N||Q==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(Q=>Q>0).reduce((Q,I)=>Q+I,0)]).sort((Y,Q)=>Y[1]-Q[1])[0])==null?void 0:q[0];V&&(F=V);break}case"initialPlacement":F=o;break}if(a!==F)return{reset:{placement:F}}}return{}}}};function Kk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yk(e){return s$.some(t=>e[t]>=0)}const b$=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=us(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),o=Kk(l,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Yk(o)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),o=Kk(l,n.floating);return{data:{escapedOffsets:o,escaped:Yk(o)}}}default:return{}}}}},m_=new Set(["left","top"]);async function w$(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=cs(n),o=kc(n),f=hi(n)==="y",c=m_.has(l)?-1:1,h=i&&f?-1:1,p=us(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return o&&typeof x=="number"&&(y=o==="end"?x*-1:x),f?{x:y*h,y:m*c}:{x:m*c,y:y*h}}const S$=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:o}=t,f=await w$(t,e);return l===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:l}}}}},E$=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:i}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:f={fn:S=>{let{x:N,y:C}=S;return{x:N,y:C}}},...c}=us(e,t),h={x:n,y:r},p=await i.detectOverflow(t,c),m=hi(cs(a)),y=Cw(m);let x=h[y],b=h[m];if(l){const S=y==="y"?"top":"left",N=y==="y"?"bottom":"right",C=x+p[S],T=x-p[N];x=Gb(C,x,T)}if(o){const S=m==="y"?"top":"left",N=m==="y"?"bottom":"right",C=b+p[S],T=b-p[N];b=Gb(C,b,T)}const w=f.fn({...t,[y]:x,[m]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:l,[m]:o}}}}}},C$=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:o=0,mainAxis:f=!0,crossAxis:c=!0}=us(e,t),h={x:n,y:r},p=hi(a),m=Cw(p);let y=h[m],x=h[p];const b=us(o,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(f){const C=m==="y"?"height":"width",T=i.reference[m]-i.floating[C]+w.mainAxis,R=i.reference[m]+i.reference[C]-w.mainAxis;y<T?y=T:y>R&&(y=R)}if(c){var S,N;const C=m==="y"?"width":"height",T=m_.has(cs(a)),R=i.reference[p]-i.floating[C]+(T&&((S=l.offset)==null?void 0:S[p])||0)+(T?0:w.crossAxis),A=i.reference[p]+i.reference[C]+(T?0:((N=l.offset)==null?void 0:N[p])||0)-(T?w.crossAxis:0);x<R?x=R:x>A&&(x=A)}return{[m]:y,[p]:x}}}},N$=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:o}=t,{apply:f=()=>{},...c}=us(e,t),h=await l.detectOverflow(t,c),p=cs(a),m=kc(a),y=hi(a)==="y",{width:x,height:b}=i.floating;let w,S;p==="top"||p==="bottom"?(w=p,S=m===(await(l.isRTL==null?void 0:l.isRTL(o.floating))?"start":"end")?"left":"right"):(S=p,w=m==="end"?"top":"bottom");const N=b-h.top-h.bottom,C=x-h.left-h.right,T=bl(b-h[w],N),R=bl(x-h[S],C),A=!t.middlewareData.shift;let D=T,O=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=N),A&&!m){const M=ua(h.left,0),B=ua(h.right,0),P=ua(h.top,0),q=ua(h.bottom,0);y?O=x-2*(M!==0||B!==0?M+B:ua(h.left,h.right)):D=b-2*(P!==0||q!==0?P+q:ua(h.top,h.bottom))}await f({...t,availableWidth:O,availableHeight:D});const L=await l.getDimensions(o.floating);return x!==L.width||b!==L.height?{reset:{rects:!0}}:{}}}};function cm(){return typeof window<"u"}function Tc(e){return g_(e)?(e.nodeName||"").toLowerCase():"#document"}function fa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ti(e){var t;return(t=(g_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function g_(e){return cm()?e instanceof Node||e instanceof fa(e).Node:!1}function $a(e){return cm()?e instanceof Element||e instanceof fa(e).Element:!1}function ps(e){return cm()?e instanceof HTMLElement||e instanceof fa(e).HTMLElement:!1}function Xk(e){return!cm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof fa(e).ShadowRoot}function Id(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ka(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function k$(e){return/^(table|td|th)$/.test(Tc(e))}function fm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const T$=/transform|translate|scale|rotate|perspective|filter/,j$=/paint|layout|strict|content/,to=e=>!!e&&e!=="none";let jx;function Tw(e){const t=$a(e)?Ka(e):e;return to(t.transform)||to(t.translate)||to(t.scale)||to(t.rotate)||to(t.perspective)||!jw()&&(to(t.backdropFilter)||to(t.filter))||T$.test(t.willChange||"")||j$.test(t.contain||"")}function A$(e){let t=wl(e);for(;ps(t)&&!uc(t);){if(Tw(t))return t;if(fm(t))return null;t=wl(t)}return null}function jw(){return jx==null&&(jx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jx}function uc(e){return/^(html|body|#document)$/.test(Tc(e))}function Ka(e){return fa(e).getComputedStyle(e)}function dm(e){return $a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wl(e){if(Tc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xk(e)&&e.host||Ti(e);return Xk(t)?t.host:t}function y_(e){const t=wl(e);return uc(t)?e.ownerDocument?e.ownerDocument.body:e.body:ps(t)&&Id(t)?t:y_(t)}function cd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=y_(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=fa(a);if(i){const o=Kb(l);return t.concat(l,l.visualViewport||[],Id(a)?a:[],o&&n?cd(o):[])}else return t.concat(a,cd(a,[],n))}function Kb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function x_(e){const t=Ka(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=ps(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,o=wp(n)!==i||wp(r)!==l;return o&&(n=i,r=l),{width:n,height:r,$:o}}function Aw(e){return $a(e)?e:e.contextElement}function Hu(e){const t=Aw(e);if(!ps(t))return gi(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=x_(t);let l=(i?wp(n.width):n.width)/r,o=(i?wp(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!o||!Number.isFinite(o))&&(o=1),{x:l,y:o}}const R$=gi(0);function b_(e){const t=fa(e);return!jw()||!t.visualViewport?R$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function D$(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==fa(e)?!1:t}function To(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Aw(e);let l=gi(1);t&&(r?$a(r)&&(l=Hu(r)):l=Hu(e));const o=D$(i,n,r)?b_(i):gi(0);let f=(a.left+o.x)/l.x,c=(a.top+o.y)/l.y,h=a.width/l.x,p=a.height/l.y;if(i){const m=fa(i),y=r&&$a(r)?fa(r):r;let x=m,b=Kb(x);for(;b&&r&&y!==x;){const w=Hu(b),S=b.getBoundingClientRect(),N=Ka(b),C=S.left+(b.clientLeft+parseFloat(N.paddingLeft))*w.x,T=S.top+(b.clientTop+parseFloat(N.paddingTop))*w.y;f*=w.x,c*=w.y,h*=w.x,p*=w.y,f+=C,c+=T,x=fa(b),b=Kb(x)}}return Ep({width:h,height:p,x:f,y:c})}function hm(e,t){const n=dm(e).scrollLeft;return t?t.left+n:To(Ti(e)).left+n}function w_(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hm(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function M$(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=Ti(r),o=t?fm(t.floating):!1;if(r===l||o&&i)return n;let f={scrollLeft:0,scrollTop:0},c=gi(1);const h=gi(0),p=ps(r);if((p||!p&&!i)&&((Tc(r)!=="body"||Id(l))&&(f=dm(r)),p)){const y=To(r);c=Hu(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const m=l&&!p&&!i?w_(l,f):gi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-f.scrollLeft*c.x+h.x+m.x,y:n.y*c.y-f.scrollTop*c.y+h.y+m.y}}function _$(e){return Array.from(e.getClientRects())}function O$(e){const t=Ti(e),n=dm(e),r=e.ownerDocument.body,a=ua(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ua(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+hm(e);const o=-n.scrollTop;return Ka(r).direction==="rtl"&&(l+=ua(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:o}}const Qk=25;function L$(e,t){const n=fa(e),r=Ti(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,o=0,f=0;if(a){i=a.width,l=a.height;const h=jw();(!h||h&&t==="fixed")&&(o=a.offsetLeft,f=a.offsetTop)}const c=hm(r);if(c<=0){const h=r.ownerDocument,p=h.body,m=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-y);x<=Qk&&(i-=x)}else c<=Qk&&(i+=c);return{width:i,height:l,x:o,y:f}}function P$(e,t){const n=To(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=ps(e)?Hu(e):gi(1),l=e.clientWidth*i.x,o=e.clientHeight*i.y,f=a*i.x,c=r*i.y;return{width:l,height:o,x:f,y:c}}function Wk(e,t,n){let r;if(t==="viewport")r=L$(e,n);else if(t==="document")r=O$(Ti(e));else if($a(t))r=P$(t,n);else{const a=b_(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ep(r)}function S_(e,t){const n=wl(e);return n===t||!$a(n)||uc(n)?!1:Ka(n).position==="fixed"||S_(n,t)}function B$(e,t){const n=t.get(e);if(n)return n;let r=cd(e,[],!1).filter(o=>$a(o)&&Tc(o)!=="body"),a=null;const i=Ka(e).position==="fixed";let l=i?wl(e):e;for(;$a(l)&&!uc(l);){const o=Ka(l),f=Tw(l);!f&&o.position==="fixed"&&(a=null),(i?!f&&!a:!f&&o.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Id(l)&&!f&&S_(e,l))?r=r.filter(h=>h!==l):a=o,l=wl(l)}return t.set(e,r),r}function z$(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?fm(t)?[]:B$(t,this._c):[].concat(n),r],o=Wk(t,l[0],a);let f=o.top,c=o.right,h=o.bottom,p=o.left;for(let m=1;m<l.length;m++){const y=Wk(t,l[m],a);f=ua(y.top,f),c=bl(y.right,c),h=bl(y.bottom,h),p=ua(y.left,p)}return{width:c-p,height:h-f,x:p,y:f}}function I$(e){const{width:t,height:n}=x_(e);return{width:t,height:n}}function F$(e,t,n){const r=ps(t),a=Ti(t),i=n==="fixed",l=To(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const f=gi(0);function c(){f.x=hm(a)}if(r||!r&&!i)if((Tc(t)!=="body"||Id(a))&&(o=dm(t)),r){const y=To(t,!0,i,t);f.x=y.x+t.clientLeft,f.y=y.y+t.clientTop}else a&&c();i&&!r&&a&&c();const h=a&&!r&&!i?w_(a,o):gi(0),p=l.left+o.scrollLeft-f.x-h.x,m=l.top+o.scrollTop-f.y-h.y;return{x:p,y:m,width:l.width,height:l.height}}function Ax(e){return Ka(e).position==="static"}function Zk(e,t){if(!ps(e)||Ka(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ti(e)===n&&(n=n.ownerDocument.body),n}function E_(e,t){const n=fa(e);if(fm(e))return n;if(!ps(e)){let a=wl(e);for(;a&&!uc(a);){if($a(a)&&!Ax(a))return a;a=wl(a)}return n}let r=Zk(e,t);for(;r&&k$(r)&&Ax(r);)r=Zk(r,t);return r&&uc(r)&&Ax(r)&&!Tw(r)?n:r||A$(e)||n}const U$=async function(e){const t=this.getOffsetParent||E_,n=this.getDimensions,r=await n(e.floating);return{reference:F$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function q$(e){return Ka(e).direction==="rtl"}const V$={convertOffsetParentRelativeRectToViewportRelativeRect:M$,getDocumentElement:Ti,getClippingRect:z$,getOffsetParent:E_,getElementRects:U$,getClientRects:_$,getDimensions:I$,getScale:Hu,isElement:$a,isRTL:q$};function C_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function H$(e,t){let n=null,r;const a=Ti(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function l(o,f){o===void 0&&(o=!1),f===void 0&&(f=1),i();const c=e.getBoundingClientRect(),{left:h,top:p,width:m,height:y}=c;if(o||t(),!m||!y)return;const x=Tv(p),b=Tv(a.clientWidth-(h+m)),w=Tv(a.clientHeight-(p+y)),S=Tv(h),C={rootMargin:-x+"px "+-b+"px "+-w+"px "+-S+"px",threshold:ua(0,bl(1,f))||1};let T=!0;function R(A){const D=A[0].intersectionRatio;if(D!==f){if(!T)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!C_(c,e.getBoundingClientRect())&&l(),T=!1}try{n=new IntersectionObserver(R,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,C)}n.observe(e)}return l(!0),i}function G$(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,c=Aw(e),h=a||i?[...c?cd(c):[],...t?cd(t):[]]:[];h.forEach(S=>{a&&S.addEventListener("scroll",n,{passive:!0}),i&&S.addEventListener("resize",n)});const p=c&&o?H$(c,n):null;let m=-1,y=null;l&&(y=new ResizeObserver(S=>{let[N]=S;N&&N.target===c&&y&&t&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(t)})),n()}),c&&!f&&y.observe(c),t&&y.observe(t));let x,b=f?To(e):null;f&&w();function w(){const S=To(e);b&&!C_(b,S)&&n(),b=S,x=requestAnimationFrame(w)}return n(),()=>{var S;h.forEach(N=>{a&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),p==null||p(),(S=y)==null||S.disconnect(),y=null,f&&cancelAnimationFrame(x)}}const $$=S$,K$=E$,Y$=x$,X$=N$,Q$=b$,Jk=y$,W$=C$,Z$=(e,t,n)=>{const r=new Map,a={platform:V$,...n},i={...a.platform,_c:r};return g$(e,t,{...a,platform:i})};var J$=typeof document<"u",eK=function(){},Qv=J$?j.useLayoutEffect:eK;function Cp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Cp(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Cp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function N_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eT(e,t){const n=N_(e);return Math.round(t*n)/n}function Rx(e){const t=j.useRef(e);return Qv(()=>{t.current=e}),t}function tK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:o=!0,whileElementsMounted:f,open:c}=e,[h,p]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=j.useState(r);Cp(m,r)||y(r);const[x,b]=j.useState(null),[w,S]=j.useState(null),N=j.useCallback(Y=>{Y!==A.current&&(A.current=Y,b(Y))},[]),C=j.useCallback(Y=>{Y!==D.current&&(D.current=Y,S(Y))},[]),T=i||x,R=l||w,A=j.useRef(null),D=j.useRef(null),O=j.useRef(h),L=f!=null,M=Rx(f),B=Rx(a),P=Rx(c),q=j.useCallback(()=>{if(!A.current||!D.current)return;const Y={placement:t,strategy:n,middleware:m};B.current&&(Y.platform=B.current),Z$(A.current,D.current,Y).then(Q=>{const I={...Q,isPositioned:P.current!==!1};H.current&&!Cp(O.current,I)&&(O.current=I,Rd.flushSync(()=>{p(I)}))})},[m,t,n,B,P]);Qv(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(Y=>({...Y,isPositioned:!1})))},[c]);const H=j.useRef(!1);Qv(()=>(H.current=!0,()=>{H.current=!1}),[]),Qv(()=>{if(T&&(A.current=T),R&&(D.current=R),T&&R){if(M.current)return M.current(T,R,q);q()}},[T,R,q,M,L]);const G=j.useMemo(()=>({reference:A,floating:D,setReference:N,setFloating:C}),[N,C]),F=j.useMemo(()=>({reference:T,floating:R}),[T,R]),V=j.useMemo(()=>{const Y={position:n,left:0,top:0};if(!F.floating)return Y;const Q=eT(F.floating,h.x),I=eT(F.floating,h.y);return o?{...Y,transform:"translate("+Q+"px, "+I+"px)",...N_(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:I}},[n,o,F.floating,h.x,h.y]);return j.useMemo(()=>({...h,update:q,refs:G,elements:F,floatingStyles:V}),[h,q,G,F,V])}const nK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Jk({element:r.current,padding:a}).fn(n):{}:r?Jk({element:r,padding:a}).fn(n):{}}}},rK=(e,t)=>{const n=$$(e);return{name:n.name,fn:n.fn,options:[e,t]}},aK=(e,t)=>{const n=K$(e);return{name:n.name,fn:n.fn,options:[e,t]}},iK=(e,t)=>({fn:W$(e).fn,options:[e,t]}),sK=(e,t)=>{const n=Y$(e);return{name:n.name,fn:n.fn,options:[e,t]}},lK=(e,t)=>{const n=X$(e);return{name:n.name,fn:n.fn,options:[e,t]}},oK=(e,t)=>{const n=Q$(e);return{name:n.name,fn:n.fn,options:[e,t]}},uK=(e,t)=>{const n=nK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var cK="Arrow",k_=j.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return d.jsx(Zt.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});k_.displayName=cK;var fK=k_;function dK(e){const[t,n]=j.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,o;if("borderBoxSize"in i){const f=i.borderBoxSize,c=Array.isArray(f)?f[0]:f;l=c.inlineSize,o=c.blockSize}else l=e.offsetWidth,o=e.offsetHeight;n({width:l,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Rw="Popper",[T_,j_]=Yp(Rw),[hK,A_]=T_(Rw),R_=e=>{const{__scopePopper:t,children:n}=e,[r,a]=j.useState(null);return d.jsx(hK,{scope:t,anchor:r,onAnchorChange:a,children:n})};R_.displayName=Rw;var D_="PopperAnchor",M_=j.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=A_(D_,n),l=j.useRef(null),o=jn(t,l),f=j.useRef(null);return j.useEffect(()=>{const c=f.current;f.current=(r==null?void 0:r.current)||l.current,c!==f.current&&i.onAnchorChange(f.current)}),r?null:d.jsx(Zt.div,{...a,ref:o})});M_.displayName=D_;var Dw="PopperContent",[vK,pK]=T_(Dw),__=j.forwardRef((e,t)=>{var se,le,ie,W,te,oe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:o=0,avoidCollisions:f=!0,collisionBoundary:c=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...b}=e,w=A_(Dw,n),[S,N]=j.useState(null),C=jn(t,ye=>N(ye)),[T,R]=j.useState(null),A=dK(T),D=(A==null?void 0:A.width)??0,O=(A==null?void 0:A.height)??0,L=r+(i!=="center"?"-"+i:""),M=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},B=Array.isArray(c)?c:[c],P=B.length>0,q={padding:M,boundary:B.filter(gK),altBoundary:P},{refs:H,floatingStyles:G,placement:F,isPositioned:V,middlewareData:Y}=tK({strategy:"fixed",placement:L,whileElementsMounted:(...ye)=>G$(...ye,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[rK({mainAxis:a+O,alignmentAxis:l}),f&&aK({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?iK():void 0,...q}),f&&sK({...q}),lK({...q,apply:({elements:ye,rects:Te,availableWidth:Be,availableHeight:ot})=>{const{width:Je,height:We}=Te.reference,Ve=ye.floating.style;Ve.setProperty("--radix-popper-available-width",`${Be}px`),Ve.setProperty("--radix-popper-available-height",`${ot}px`),Ve.setProperty("--radix-popper-anchor-width",`${Je}px`),Ve.setProperty("--radix-popper-anchor-height",`${We}px`)}}),T&&uK({element:T,padding:o}),yK({arrowWidth:D,arrowHeight:O}),m&&oK({strategy:"referenceHidden",...q})]}),[Q,I]=P_(F),U=Co(x);br(()=>{V&&(U==null||U())},[V,U]);const X=(se=Y.arrow)==null?void 0:se.x,z=(le=Y.arrow)==null?void 0:le.y,Z=((ie=Y.arrow)==null?void 0:ie.centerOffset)!==0,[re,ae]=j.useState();return br(()=>{S&&ae(window.getComputedStyle(S).zIndex)},[S]),d.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:V?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(W=Y.transformOrigin)==null?void 0:W.x,(te=Y.transformOrigin)==null?void 0:te.y].join(" "),...((oe=Y.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(vK,{scope:n,placedSide:Q,onArrowChange:R,arrowX:X,arrowY:z,shouldHideArrow:Z,children:d.jsx(Zt.div,{"data-side":Q,"data-align":I,...b,ref:C,style:{...b.style,animation:V?void 0:"none"}})})})});__.displayName=Dw;var O_="PopperArrow",mK={top:"bottom",right:"left",bottom:"top",left:"right"},L_=j.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=pK(O_,r),l=mK[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(fK,{...a,ref:n,style:{...a.style,display:"block"}})})});L_.displayName=O_;function gK(e){return e!==null}var yK=e=>({name:"transformOrigin",options:e,fn(t){var w,S,N;const{placement:n,rects:r,middlewareData:a}=t,l=((w=a.arrow)==null?void 0:w.centerOffset)!==0,o=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[c,h]=P_(n),p={start:"0%",center:"50%",end:"100%"}[h],m=(((S=a.arrow)==null?void 0:S.x)??0)+o/2,y=(((N=a.arrow)==null?void 0:N.y)??0)+f/2;let x="",b="";return c==="bottom"?(x=l?p:`${m}px`,b=`${-f}px`):c==="top"?(x=l?p:`${m}px`,b=`${r.floating.height+f}px`):c==="right"?(x=`${-f}px`,b=l?p:`${y}px`):c==="left"&&(x=`${r.floating.width+f}px`,b=l?p:`${y}px`),{data:{x,y:b}}}});function P_(e){const[t,n="center"]=e.split("-");return[t,n]}var xK=R_,bK=M_,wK=__,SK=L_;function EK(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var B_=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),CK="VisuallyHidden",NK=j.forwardRef((e,t)=>d.jsx(Zt.span,{...e,ref:t,style:{...B_,...e.style}}));NK.displayName=CK;var kK=[" ","Enter","ArrowUp","ArrowDown"],TK=[" ","Enter"],jo="Select",[vm,pm,jK]=r$(jo),[jc]=Yp(jo,[jK,j_]),mm=j_(),[AK,Rl]=jc(jo),[RK,DK]=jc(jo),z_=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:o,onValueChange:f,dir:c,name:h,autoComplete:p,disabled:m,required:y,form:x}=e,b=mm(t),[w,S]=j.useState(null),[N,C]=j.useState(null),[T,R]=j.useState(!1),A=i$(c),[D,O]=vp({prop:r,defaultProp:a??!1,onChange:i,caller:jo}),[L,M]=vp({prop:l,defaultProp:o,onChange:f,caller:jo}),B=j.useRef(null),P=w?x||!!w.closest("form"):!0,[q,H]=j.useState(new Set),G=Array.from(q).map(F=>F.props.value).join(";");return d.jsx(xK,{...b,children:d.jsxs(AK,{required:y,scope:t,trigger:w,onTriggerChange:S,valueNode:N,onValueNodeChange:C,valueNodeHasChildren:T,onValueNodeHasChildrenChange:R,contentId:Uu(),value:L,onValueChange:M,open:D,onOpenChange:O,dir:A,triggerPointerDownPosRef:B,disabled:m,children:[d.jsx(vm.Provider,{scope:t,children:d.jsx(RK,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(F=>{H(V=>new Set(V).add(F))},[]),onNativeOptionRemove:j.useCallback(F=>{H(V=>{const Y=new Set(V);return Y.delete(F),Y})},[]),children:n})}),P?d.jsxs(aO,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:p,value:L,onChange:F=>M(F.target.value),disabled:m,form:x,children:[L===void 0?d.jsx("option",{value:""}):null,Array.from(q)]},G):null]})})};z_.displayName=jo;var I_="SelectTrigger",F_=j.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=mm(n),l=Rl(I_,n),o=l.disabled||r,f=jn(t,l.onTriggerChange),c=pm(n),h=j.useRef("touch"),[p,m,y]=sO(b=>{const w=c().filter(C=>!C.disabled),S=w.find(C=>C.value===l.value),N=lO(w,b,S);N!==void 0&&l.onValueChange(N.value)}),x=b=>{o||(l.onOpenChange(!0),y()),b&&(l.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return d.jsx(bK,{asChild:!0,...i,children:d.jsx(Zt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":iO(l.value)?"":void 0,...a,ref:f,onClick:tn(a.onClick,b=>{b.currentTarget.focus(),h.current!=="mouse"&&x(b)}),onPointerDown:tn(a.onPointerDown,b=>{h.current=b.pointerType;const w=b.target;w.hasPointerCapture(b.pointerId)&&w.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(x(b),b.preventDefault())}),onKeyDown:tn(a.onKeyDown,b=>{const w=p.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(w&&b.key===" ")&&kK.includes(b.key)&&(x(),b.preventDefault())})})})});F_.displayName=I_;var U_="SelectValue",q_=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:l="",...o}=e,f=Rl(U_,n),{onValueNodeHasChildrenChange:c}=f,h=i!==void 0,p=jn(t,f.onValueNodeChange);return br(()=>{c(h)},[c,h]),d.jsx(Zt.span,{...o,ref:p,style:{pointerEvents:"none"},children:iO(f.value)?d.jsx(d.Fragment,{children:l}):i})});q_.displayName=U_;var MK="SelectIcon",V_=j.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return d.jsx(Zt.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});V_.displayName=MK;var _K="SelectPortal",H_=e=>d.jsx($1,{asChild:!0,...e});H_.displayName=_K;var Ao="SelectContent",G_=j.forwardRef((e,t)=>{const n=Rl(Ao,e.__scopeSelect),[r,a]=j.useState();if(br(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?Rd.createPortal(d.jsx($_,{scope:e.__scopeSelect,children:d.jsx(vm.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),i):null}return d.jsx(K_,{...e,ref:t})});G_.displayName=Ao;var Ua=10,[$_,Dl]=jc(Ao),OK="SelectContentImpl",LK=ld("SelectContent.RemoveScroll"),K_=j.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:l,side:o,sideOffset:f,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:b,avoidCollisions:w,...S}=e,N=Rl(Ao,n),[C,T]=j.useState(null),[R,A]=j.useState(null),D=jn(t,se=>T(se)),[O,L]=j.useState(null),[M,B]=j.useState(null),P=pm(n),[q,H]=j.useState(!1),G=j.useRef(!1);j.useEffect(()=>{if(C)return DD(C)},[C]),SD();const F=j.useCallback(se=>{const[le,...ie]=P().map(oe=>oe.ref.current),[W]=ie.slice(-1),te=document.activeElement;for(const oe of se)if(oe===te||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===le&&R&&(R.scrollTop=0),oe===W&&R&&(R.scrollTop=R.scrollHeight),oe==null||oe.focus(),document.activeElement!==te))return},[P,R]),V=j.useCallback(()=>F([O,C]),[F,O,C]);j.useEffect(()=>{q&&V()},[q,V]);const{onOpenChange:Y,triggerPointerDownPosRef:Q}=N;j.useEffect(()=>{if(C){let se={x:0,y:0};const le=W=>{var te,oe;se={x:Math.abs(Math.round(W.pageX)-(((te=Q.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(W.pageY)-(((oe=Q.current)==null?void 0:oe.y)??0))}},ie=W=>{se.x<=10&&se.y<=10?W.preventDefault():C.contains(W.target)||Y(!1),document.removeEventListener("pointermove",le),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",ie,{capture:!0})}}},[C,Y,Q]),j.useEffect(()=>{const se=()=>Y(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[Y]);const[I,U]=sO(se=>{const le=P().filter(te=>!te.disabled),ie=le.find(te=>te.ref.current===document.activeElement),W=lO(le,se,ie);W&&setTimeout(()=>W.ref.current.focus())}),X=j.useCallback((se,le,ie)=>{const W=!G.current&&!ie;(N.value!==void 0&&N.value===le||W)&&(L(se),W&&(G.current=!0))},[N.value]),z=j.useCallback(()=>C==null?void 0:C.focus(),[C]),Z=j.useCallback((se,le,ie)=>{const W=!G.current&&!ie;(N.value!==void 0&&N.value===le||W)&&B(se)},[N.value]),re=r==="popper"?Yb:Y_,ae=re===Yb?{side:o,sideOffset:f,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:b,avoidCollisions:w}:{};return d.jsx($_,{scope:n,content:C,viewport:R,onViewportChange:A,itemRefCallback:X,selectedItem:O,onItemLeave:z,itemTextRefCallback:Z,focusSelectedItem:V,selectedItemText:M,position:r,isPositioned:q,searchRef:I,children:d.jsx(K1,{as:LK,allowPinchZoom:!0,children:d.jsx(G1,{asChild:!0,trapped:N.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:tn(a,se=>{var le;(le=N.trigger)==null||le.focus({preventScroll:!0}),se.preventDefault()}),children:d.jsx(H1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:d.jsx(re,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:se=>se.preventDefault(),...S,...ae,onPlaced:()=>H(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:tn(S.onKeyDown,se=>{const le=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!le&&se.key.length===1&&U(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let W=P().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(se.key)&&(W=W.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const te=se.target,oe=W.indexOf(te);W=W.slice(oe+1)}setTimeout(()=>F(W)),se.preventDefault()}})})})})})})});K_.displayName=OK;var PK="SelectItemAlignedPosition",Y_=j.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=Rl(Ao,n),l=Dl(Ao,n),[o,f]=j.useState(null),[c,h]=j.useState(null),p=jn(t,D=>h(D)),m=pm(n),y=j.useRef(!1),x=j.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:S,focusSelectedItem:N}=l,C=j.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&c&&b&&w&&S){const D=i.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),M=S.getBoundingClientRect();if(i.dir!=="rtl"){const te=M.left-O.left,oe=L.left-te,ye=D.left-oe,Te=D.width+ye,Be=Math.max(Te,O.width),ot=window.innerWidth-Ua,Je=Vk(oe,[Ua,Math.max(Ua,ot-Be)]);o.style.minWidth=Te+"px",o.style.left=Je+"px"}else{const te=O.right-M.right,oe=window.innerWidth-L.right-te,ye=window.innerWidth-D.right-oe,Te=D.width+ye,Be=Math.max(Te,O.width),ot=window.innerWidth-Ua,Je=Vk(oe,[Ua,Math.max(Ua,ot-Be)]);o.style.minWidth=Te+"px",o.style.right=Je+"px"}const B=m(),P=window.innerHeight-Ua*2,q=b.scrollHeight,H=window.getComputedStyle(c),G=parseInt(H.borderTopWidth,10),F=parseInt(H.paddingTop,10),V=parseInt(H.borderBottomWidth,10),Y=parseInt(H.paddingBottom,10),Q=G+F+q+Y+V,I=Math.min(w.offsetHeight*5,Q),U=window.getComputedStyle(b),X=parseInt(U.paddingTop,10),z=parseInt(U.paddingBottom,10),Z=D.top+D.height/2-Ua,re=P-Z,ae=w.offsetHeight/2,se=w.offsetTop+ae,le=G+F+se,ie=Q-le;if(le<=Z){const te=B.length>0&&w===B[B.length-1].ref.current;o.style.bottom="0px";const oe=c.clientHeight-b.offsetTop-b.offsetHeight,ye=Math.max(re,ae+(te?z:0)+oe+V),Te=le+ye;o.style.height=Te+"px"}else{const te=B.length>0&&w===B[0].ref.current;o.style.top="0px";const ye=Math.max(Z,G+b.offsetTop+(te?X:0)+ae)+ie;o.style.height=ye+"px",b.scrollTop=le-Z+b.offsetTop}o.style.margin=`${Ua}px 0`,o.style.minHeight=I+"px",o.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[m,i.trigger,i.valueNode,o,c,b,w,S,i.dir,r]);br(()=>C(),[C]);const[T,R]=j.useState();br(()=>{c&&R(window.getComputedStyle(c).zIndex)},[c]);const A=j.useCallback(D=>{D&&x.current===!0&&(C(),N==null||N(),x.current=!1)},[C,N]);return d.jsx(zK,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:y,onScrollButtonChange:A,children:d.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:d.jsx(Zt.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Y_.displayName=PK;var BK="SelectPopperPosition",Yb=j.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Ua,...i}=e,l=mm(n);return d.jsx(wK,{...l,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Yb.displayName=BK;var[zK,Mw]=jc(Ao,{}),Xb="SelectViewport",X_=j.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=Dl(Xb,n),l=Mw(Xb,n),o=jn(t,i.onViewportChange),f=j.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(vm.Slot,{scope:n,children:d.jsx(Zt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:tn(a.onScroll,c=>{const h=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=l;if(m!=null&&m.current&&p){const y=Math.abs(f.current-h.scrollTop);if(y>0){const x=window.innerHeight-Ua*2,b=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),S=Math.max(b,w);if(S<x){const N=S+y,C=Math.min(x,N),T=N-C;p.style.height=C+"px",p.style.bottom==="0px"&&(h.scrollTop=T>0?T:0,p.style.justifyContent="flex-end")}}}f.current=h.scrollTop})})})]})});X_.displayName=Xb;var Q_="SelectGroup",[IK,FK]=jc(Q_),UK=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Uu();return d.jsx(IK,{scope:n,id:a,children:d.jsx(Zt.div,{role:"group","aria-labelledby":a,...r,ref:t})})});UK.displayName=Q_;var W_="SelectLabel",qK=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=FK(W_,n);return d.jsx(Zt.div,{id:a.id,...r,ref:t})});qK.displayName=W_;var Np="SelectItem",[VK,Z_]=jc(Np),J_=j.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...l}=e,o=Rl(Np,n),f=Dl(Np,n),c=o.value===r,[h,p]=j.useState(i??""),[m,y]=j.useState(!1),x=jn(t,N=>{var C;return(C=f.itemRefCallback)==null?void 0:C.call(f,N,r,a)}),b=Uu(),w=j.useRef("touch"),S=()=>{a||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(VK,{scope:n,value:r,disabled:a,textId:b,isSelected:c,onItemTextChange:j.useCallback(N=>{p(C=>C||((N==null?void 0:N.textContent)??"").trim())},[]),children:d.jsx(vm.ItemSlot,{scope:n,value:r,disabled:a,textValue:h,children:d.jsx(Zt.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:x,onFocus:tn(l.onFocus,()=>y(!0)),onBlur:tn(l.onBlur,()=>y(!1)),onClick:tn(l.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:tn(l.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:tn(l.onPointerDown,N=>{w.current=N.pointerType}),onPointerMove:tn(l.onPointerMove,N=>{var C;w.current=N.pointerType,a?(C=f.onItemLeave)==null||C.call(f):w.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tn(l.onPointerLeave,N=>{var C;N.currentTarget===document.activeElement&&((C=f.onItemLeave)==null||C.call(f))}),onKeyDown:tn(l.onKeyDown,N=>{var T;((T=f.searchRef)==null?void 0:T.current)!==""&&N.key===" "||(TK.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});J_.displayName=Np;var Kf="SelectItemText",eO=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,l=Rl(Kf,n),o=Dl(Kf,n),f=Z_(Kf,n),c=DK(Kf,n),[h,p]=j.useState(null),m=jn(t,S=>p(S),f.onItemTextChange,S=>{var N;return(N=o.itemTextRefCallback)==null?void 0:N.call(o,S,f.value,f.disabled)}),y=h==null?void 0:h.textContent,x=j.useMemo(()=>d.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=c;return br(()=>(b(x),()=>w(x)),[b,w,x]),d.jsxs(d.Fragment,{children:[d.jsx(Zt.span,{id:f.textId,...i,ref:m}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Rd.createPortal(i.children,l.valueNode):null]})});eO.displayName=Kf;var tO="SelectItemIndicator",nO=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Z_(tO,n).isSelected?d.jsx(Zt.span,{"aria-hidden":!0,...r,ref:t}):null});nO.displayName=tO;var Qb="SelectScrollUpButton",HK=j.forwardRef((e,t)=>{const n=Dl(Qb,e.__scopeSelect),r=Mw(Qb,e.__scopeSelect),[a,i]=j.useState(!1),l=jn(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollTop>0;i(c)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?d.jsx(rO,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop-f.offsetHeight)}}):null});HK.displayName=Qb;var Wb="SelectScrollDownButton",GK=j.forwardRef((e,t)=>{const n=Dl(Wb,e.__scopeSelect),r=Mw(Wb,e.__scopeSelect),[a,i]=j.useState(!1),l=jn(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollHeight-f.clientHeight,h=Math.ceil(f.scrollTop)<c;i(h)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?d.jsx(rO,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop+f.offsetHeight)}}):null});GK.displayName=Wb;var rO=j.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=Dl("SelectScrollButton",n),l=j.useRef(null),o=pm(n),f=j.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return j.useEffect(()=>()=>f(),[f]),br(()=>{var h;const c=o().find(p=>p.ref.current===document.activeElement);(h=c==null?void 0:c.ref.current)==null||h.scrollIntoView({block:"nearest"})},[o]),d.jsx(Zt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:tn(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:tn(a.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:tn(a.onPointerLeave,()=>{f()})})}),$K="SelectSeparator",KK=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d.jsx(Zt.div,{"aria-hidden":!0,...r,ref:t})});KK.displayName=$K;var Zb="SelectArrow",YK=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=mm(n),i=Rl(Zb,n),l=Dl(Zb,n);return i.open&&l.position==="popper"?d.jsx(SK,{...a,...r,ref:t}):null});YK.displayName=Zb;var XK="SelectBubbleInput",aO=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=j.useRef(null),i=jn(r,a),l=EK(t);return j.useEffect(()=>{const o=a.current;if(!o)return;const f=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==t&&h){const p=new Event("change",{bubbles:!0});h.call(o,t),o.dispatchEvent(p)}},[l,t]),d.jsx(Zt.select,{...n,style:{...B_,...n.style},ref:i,defaultValue:t})});aO.displayName=XK;function iO(e){return e===""||e===void 0}function sO(e){const t=Co(e),n=j.useRef(""),r=j.useRef(0),a=j.useCallback(l=>{const o=n.current+l;t(o),(function f(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>f(""),1e3))})(o)},[t]),i=j.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function lO(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=QK(e,Math.max(i,0));a.length===1&&(l=l.filter(c=>c!==n));const f=l.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}function QK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var WK=z_,oO=F_,ZK=q_,JK=V_,eY=H_,uO=G_,tY=X_,cO=J_,nY=eO,rY=nO;const Si=WK,Ei=ZK,Ya=j.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(oO,{ref:r,className:ke("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,d.jsx(JK,{asChild:!0,children:d.jsx(La,{className:"h-4 w-4 opacity-50"})})]}));Ya.displayName=oO.displayName;const Xa=j.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>d.jsx(eY,{children:d.jsx(uO,{ref:a,className:ke("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:d.jsx(tY,{className:ke("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));Xa.displayName=uO.displayName;const Xr=j.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(cO,{ref:r,className:ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[d.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(rY,{children:d.jsx(gc,{className:"h-4 w-4"})})}),d.jsx(nY,{children:t})]}));Xr.displayName=cO.displayName;function Fd({searchPlaceholder:e="Search...",searchValue:t,onSearchChange:n,filters:r=[],filterValues:a={},onFilterChange:i}){return d.jsxs($e,{level:"bright",className:"flex items-center gap-3 px-4 py-2 rounded-md",children:[d.jsx(xc,{className:"h-3.5 w-3.5 text-on-surface-variant shrink-0"}),d.jsx(fn,{placeholder:e,value:t,onChange:l=>n(l.target.value),className:"bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1","aria-label":e}),r.map(l=>d.jsx("div",{className:"w-40 shrink-0",children:d.jsxs(Si,{value:a[l.key]??"all",onValueChange:o=>i==null?void 0:i(l.key,o),children:[d.jsx(Ya,{children:d.jsx(Ei,{placeholder:l.label})}),d.jsx(Xa,{children:l.options.map(o=>d.jsx(Xr,{value:o.value,children:o.label},o.value))})]})},l.key))]})}function Ac({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;const i=t>0,l=t+n<e,o=t+1,f=Math.min(t+n,e);return d.jsxs("div",{className:"flex items-center justify-center gap-3 pt-1",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:"gap-1 text-on-surface-variant",children:[d.jsx(L1,{className:"h-4 w-4"}),"Prev"]}),d.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:[o,"–",f," of ",e]}),d.jsxs(Ae,{variant:"ghost",size:"sm",disabled:!l,onClick:()=>r(t+n),className:"gap-1 text-on-surface-variant",children:["Next",d.jsx(ha,{className:"h-4 w-4"})]})]})}const aY=Kn.STATS,iY=Kn.STATS,sY=Kn.STATS,lY=3e4,oY=6e4,uY=1e4,cY=6e4;function fY(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.agent&&t.set("agent",e.agent),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/sessions?${n}`:"/sessions";return Or({queryKey:["sessions",e],queryFn:({signal:a})=>lt(r,{signal:a}),pollCategory:"standard",refetchInterval:aY})}function dY(e){return Or({queryKey:["session",e],queryFn:({signal:t})=>lt(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:iY})}function hY(e){return Or({queryKey:["session-batches",e],queryFn:({signal:t})=>lt(`/sessions/${e}/batches`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:sY})}function vY(e){return qt({queryKey:["batch-activities",e],queryFn:({signal:t})=>lt(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:lY})}function pY(e){return qt({queryKey:["session-attachments",e],queryFn:({signal:t})=>lt(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:oY})}function fO(){const e=Sn();return Er({mutationFn:t=>O1(`/sessions/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]})}})}function mY(){const e=Sn();return Er({mutationFn:t=>nn(`/sessions/${t}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["session",n]}),e.invalidateQueries({queryKey:["sessions"]})}})}function dO(e){return qt({queryKey:["session-impact",e],queryFn:({signal:t})=>lt(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:uY})}function hO(e){return qt({queryKey:["session-plans",e],queryFn:({signal:t})=>lt(`/sessions/${e}/plans`,{signal:t}),enabled:!!e,staleTime:cY})}const gY=3e5;function vO(){return qt({queryKey:["symbionts"],queryFn:({signal:e})=>lt("/symbionts",{signal:e}),staleTime:gY})}function yY(e,t,n){const r=e.find(a=>a.name===t);return r!=null&&r.resumeCommand?r.resumeCommand.replace("{sessionId}",n):null}const xY=300;function bY(e,t=xY){const[n,r]=j.useState(e);return j.useEffect(()=>{const a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}const rr="all";function Ud({initialFilters:e}){const[t,n]=j.useState(""),r=bY(t),[a,i]=j.useState(e),[l,o]=j.useState(0),f=j.useCallback((p,m)=>{i(y=>({...y,[p]:m})),o(0)},[]),c=j.useCallback(p=>{n(p),o(0)},[]),h=j.useCallback(p=>{const m=a[p];return m&&m!==rr?m:void 0},[a]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:a,offset:l,setOffset:o,handleSearchChange:c,handleFilterChange:f,activeFilter:h}}function pO(e){return e==="active"?"active":e==="completed"?"completed":"error"}const wY={active:"bg-primary",completed:"bg-secondary",error:"bg-tertiary"},SY={active:"bg-primary/15 text-primary",completed:"bg-surface-container-high text-on-surface-variant",error:"bg-tertiary/15 text-tertiary"};function EY({status:e}){const t=pO(e);return d.jsx("span",{className:ke("inline-block h-2 w-2 rounded-full shrink-0",wY[t])})}function mO({status:e}){const t=pO(e),n=e.charAt(0).toUpperCase()+e.slice(1);return d.jsxs("span",{className:ke("inline-flex items-center gap-1.5 rounded-sm px-2 py-0.5 font-sans text-xs font-medium",SY[t]),children:[d.jsx(EY,{status:e}),n]})}const CY=5,NY=12,kY={key:"status",label:"Status",options:[{value:rr,label:"All statuses"},{value:"active",label:"Active"},{value:"completed",label:"Completed"}]};function TY({session:e,symbiontDisplayName:t,onClick:n,onDelete:r}){const a=e.title||gl(e.id);return d.jsxs("tr",{className:"border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:n,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},tabIndex:0,role:"row","aria-label":`Session: ${a}`,children:[d.jsx("td",{className:"px-4 py-3",children:d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.id.slice(0,NY)})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate block max-w-xs",children:a})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(xt,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:t})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(mO,{status:e.status})}),d.jsx("td",{className:"px-4 py-3 text-center",children:d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.prompt_count})}),d.jsx("td",{className:"px-4 py-3",children:d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.date}),d.jsx("button",{onClick:i=>{i.stopPropagation(),r()},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&i.stopPropagation()},className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-tertiary/10 hover:text-tertiary transition-all shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tertiary/40","aria-label":`Delete session ${a}`,title:"Delete session",children:d.jsx(os,{className:"h-3.5 w-3.5"})})]})})]})}function jY(){return d.jsxs("tr",{className:"border-b border-[var(--ghost-border)]",children:[d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-40 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high animate-pulse mx-auto"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})})]})}function Nu({children:e,className:t}){return d.jsx("th",{className:ke("px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function AY(){const e=Za(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=Ud({initialFilters:{status:rr,agent:rr}}),[c,h]=j.useState(null),p=fO(),{data:m}=dO((c==null?void 0:c.id)??null),{data:y}=vO(),x=j.useMemo(()=>{const B=((y==null?void 0:y.symbionts)??[]).filter(q=>q.enabled),P={key:"agent",label:"Symbiont",options:[{value:rr,label:"All symbionts"},...B.map(q=>({value:q.name,label:q.displayName}))]};return[kY,P]},[y]),b=j.useMemo(()=>{const B=new Map;for(const P of(y==null?void 0:y.symbionts)??[])B.set(P.name,P.displayName);return P=>P?B.get(P)??P:"unknown"},[y]),w=f("status"),S=f("agent"),{data:N,isLoading:C,isError:T,error:R}=fY({limit:Qr,offset:a,status:w,agent:S,search:n});function A(){c&&p.mutate(c.id,{onSuccess:()=>h(null)})}const D=(N==null?void 0:N.sessions)??[],O=(N==null?void 0:N.total)??0,L=d.jsx(Fd,{searchPlaceholder:"Search sessions...",searchValue:t,onSearchChange:l,filters:x,filterValues:r,onFilterChange:o}),M=d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-[var(--ghost-border)] bg-surface-container/50",children:[d.jsx(Nu,{children:"Session ID"}),d.jsx(Nu,{children:"Title"}),d.jsx(Nu,{children:"Symbiont"}),d.jsx(Nu,{children:"Status"}),d.jsx(Nu,{className:"text-center",children:"Turns"}),d.jsx(Nu,{children:"Date"})]})});return T?d.jsxs("div",{children:[d.jsx(wi,{title:"Session Archive"}),L,d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load sessions"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:R instanceof Error?R.message:"Unknown error"})]})]}):d.jsxs("div",{children:[d.jsx(wi,{title:"Session Archive",subtitle:C?"Loading...":`${O} session${O!==1?"s":""} captured`}),L,C?d.jsx($e,{level:"low",className:"rounded-md overflow-hidden mt-4",children:d.jsxs("table",{className:"w-full",children:[M,d.jsx("tbody",{children:Array.from({length:CY}).map((B,P)=>d.jsx(jY,{},P))})]})}):D.length===0?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4",children:[d.jsx(Gp,{className:"h-8 w-8 opacity-30"}),d.jsx("span",{className:"font-sans text-sm",children:O===0&&!n&&!w&&!S?"No sessions yet":"No matching sessions"}),O===0&&!n&&!w&&!S&&d.jsx("span",{className:"font-sans text-xs",children:"Sessions appear here as you work with your agent"})]}):d.jsx($e,{level:"low",className:"rounded-md overflow-hidden mt-4",children:d.jsxs("table",{className:"w-full","aria-label":"Session archive",children:[M,d.jsx("tbody",{children:D.map(B=>d.jsx(TY,{session:B,symbiontDisplayName:b(B.agent),onClick:()=>e(`/sessions/${B.id}`),onDelete:()=>h(B)},B.id))})]})}),d.jsx(Ac,{total:O,offset:a,limit:Qr,onPageChange:i}),d.jsx(um,{open:c!==null,onOpenChange:B=>{B||h(null)},title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:d.jsx(os,{className:"h-4 w-4 text-tertiary"}),meta:c?[{label:"ID",value:gl(c.id)},{label:"Title",value:c.title||gl(c.id)}]:[],impact:m?[{label:"Prompts",value:m.promptCount},{label:"Spores",value:m.sporeCount},{label:"Attachments",value:m.attachmentCount},{label:"Graph Edges",value:m.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:A,isPending:p.isPending})]})}function St({children:e,className:t}){return d.jsx("div",{className:ke("font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function RY({images:e,index:t,onClose:n,onNavigate:r}){const a=e[t],i=t>0,l=t<e.length-1;j.useEffect(()=>{const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=f}},[]);const o=j.useCallback(f=>{f.key==="Escape"&&n(),f.key==="ArrowLeft"&&i&&r(t-1),f.key==="ArrowRight"&&l&&r(t+1)},[n,r,t,i,l]);return j.useEffect(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),a?d.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-sm",onClick:n,children:[d.jsx("button",{onClick:n,className:"absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:d.jsx(jl,{className:"h-5 w-5"})}),e.length>1&&d.jsxs("span",{className:"absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10",children:[t+1," / ",e.length]}),i&&d.jsx("button",{onClick:f=>{f.stopPropagation(),r(t-1)},className:"absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:d.jsx(L1,{className:"h-6 w-6"})}),l&&d.jsx("button",{onClick:f=>{f.stopPropagation(),r(t+1)},className:"absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:d.jsx(ha,{className:"h-6 w-6"})}),d.jsx("img",{src:a.src,alt:a.alt,className:"max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain",onClick:f=>f.stopPropagation()})]}):null}const DY=3;function MY({activity:e}){const[t,n]=j.useState(!1),r=e.success===1,a=!!(e.tool_input||e.tool_output_summary||e.error_message);return d.jsxs("div",{className:ke("border-l-2 transition-colors",t?"border-l-primary/30":"border-transparent hover:border-l-primary/20"),children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all",onClick:()=>n(i=>!i),"aria-expanded":t,children:[t?d.jsx(La,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}):d.jsx(ha,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),d.jsx("span",{className:"font-mono text-xs font-medium text-on-surface",children:e.tool_name}),e.file_path&&d.jsx("span",{className:"truncate font-sans text-xs text-on-surface-variant flex-1",children:e.file_path}),d.jsx("span",{className:"shrink-0 ml-auto"}),d.jsx("span",{className:"shrink-0 font-mono text-xs text-on-surface-variant",children:iG(e.duration_ms)}),r?d.jsx(yc,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):d.jsx(lc,{className:"h-3.5 w-3.5 shrink-0 text-tertiary"})]}),d.jsx("div",{className:"grid transition-[grid-template-rows] duration-150 ease-out",style:{gridTemplateRows:t?"1fr":"0fr"},children:d.jsx("div",{className:"overflow-hidden",children:d.jsxs("div",{className:"px-8 pb-3 space-y-2",children:[!a&&d.jsx("p",{className:"font-sans text-xs text-on-surface-variant/60 italic py-1",children:"No input/output details captured"}),e.tool_input&&d.jsxs("div",{children:[d.jsx("div",{className:"font-sans text-xs font-medium text-on-surface-variant mb-1",children:"Input"}),d.jsx("pre",{className:"font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface",children:e.tool_input})]}),e.tool_output_summary&&d.jsxs("div",{children:[d.jsx("div",{className:"font-sans text-xs font-medium text-on-surface-variant mb-1",children:"Output"}),d.jsx("pre",{className:"font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface",children:e.tool_output_summary})]}),e.error_message&&d.jsxs("div",{children:[d.jsx("div",{className:"font-sans text-xs font-medium text-tertiary mb-1",children:"Error"}),d.jsx("pre",{className:"font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all",children:e.error_message})]})]})})})]})}function _Y({batchId:e,activityCount:t}){const[n,r]=j.useState(!1),{data:a,isLoading:i}=vY(n?e:void 0);if(t===0)return null;const l=a??[];return d.jsxs("div",{className:"border-t border-[var(--ghost-border)]",children:[d.jsxs("button",{type:"button",className:ke("w-full flex items-center gap-2 px-4 py-2 text-left transition-colors","hover:bg-surface-container/30"),onClick:()=>r(o=>!o),children:[n?d.jsx(La,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}):d.jsx(ha,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),d.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",children:"Tool Calls"}),d.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant/60",children:t})]}),d.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:n?"1fr":"0fr"},children:d.jsxs("div",{className:"overflow-hidden",children:[i&&d.jsx("div",{className:"px-3 py-2 space-y-1",children:Array.from({length:Math.min(t,DY)}).map((o,f)=>d.jsx("div",{className:"h-3 animate-pulse rounded bg-surface-container-high w-full"},f))}),!i&&l.length>0&&d.jsx("div",{className:"space-y-0",children:l.map(o=>d.jsx(MY,{activity:o},o.id))})]})})]})}const Jb=120,OY="h-7 w-7",LY=3;function PY(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function BY(e){return e?e.length>Jb?e.slice(0,Jb)+"…":e:"(no prompt)"}function zY({batch:e,batchAttachments:t,defaultOpen:n=!1,promptIndex:r,isLast:a}){const[i,l]=j.useState(n),[o,f]=j.useState(null);return d.jsxs("div",{className:"relative flex gap-4",children:[d.jsxs("div",{className:"relative flex flex-col items-center shrink-0",style:{width:"28px"},children:[r>0&&d.jsx("div",{className:"absolute top-0 w-px bg-outline-variant/40",style:{height:"14px"}}),d.jsx("div",{className:ke(OY,"rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10",i?"bg-primary text-on-primary":"bg-surface-container-high text-on-surface-variant border border-outline-variant/40"),children:r+1}),!a&&d.jsx("div",{className:"flex-1 w-px bg-outline-variant/40"})]}),d.jsxs($e,{level:"low",className:"flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2",children:[d.jsxs("button",{type:"button",className:ke("flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden","hover:bg-surface-container/40",i&&"bg-surface-container/20"),onClick:()=>l(c=>!c),"aria-expanded":i,children:[i?d.jsx(La,{className:"mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform"}):d.jsx(ha,{className:"mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform"}),d.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[d.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-0.5",children:[d.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0",children:"Prompt"}),e.activity_count>0&&d.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/70 shrink-0",children:[e.activity_count," tool call",e.activity_count!==1?"s":""]}),e.started_at&&d.jsx("span",{className:"shrink-0 font-mono text-xs text-on-surface-variant",children:PY(e.started_at)})]}),d.jsx("p",{className:"font-sans text-sm text-on-surface truncate",children:i?e.user_prompt??"(no prompt)":BY(e.user_prompt)})]})]}),d.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:i?"1fr":"0fr"},children:d.jsxs("div",{className:"overflow-hidden",children:[d.jsxs("div",{className:"px-4 pt-0 pb-3 overflow-hidden",children:[e.user_prompt&&e.user_prompt.length>Jb&&d.jsx(Mr,{content:e.user_prompt}),t.length>0&&d.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:t.map((c,h)=>d.jsx("button",{type:"button",className:"rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all",onClick:()=>f(h),children:d.jsx("img",{src:`/api/attachments/${c.file_path}`,alt:c.description??c.file_path??"",className:"max-w-[200px] max-h-[140px] object-cover rounded-md",loading:"lazy"})},c.id))}),o!==null&&d.jsx(RY,{images:t.map(c=>({src:`/api/attachments/${c.file_path}`,alt:c.description??c.file_path??""})),index:o,onNavigate:f,onClose:()=>f(null)})]}),e.activity_count>0&&d.jsx(_Y,{batchId:e.id,activityCount:e.activity_count}),e.response_summary&&d.jsx("div",{className:"border-t border-[var(--ghost-border)] overflow-hidden",children:d.jsxs("div",{className:"flex gap-3 px-4 py-3",children:[d.jsx("div",{className:"w-0.5 shrink-0 rounded-full bg-primary/30"}),d.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[d.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[d.jsx(Dd,{className:"h-3 w-3 text-primary/60"}),d.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",children:"Response"})]}),d.jsx(Mr,{content:e.response_summary})]})]})})]})})]})]})}function IY({sessionId:e}){const{data:t,isLoading:n}=hY(e),{data:r}=pY(e),a=r??[],{byBatchId:i,byTurnNumber:l}=j.useMemo(()=>{var h;const f=new Map,c=new Map;for(const p of a){if(p.prompt_batch_id!=null){const y=f.get(p.prompt_batch_id)??[];y.push(p),f.set(p.prompt_batch_id,y)}const m=(h=p.file_path)==null?void 0:h.match(/-t(\d+)-/);if(m!=null&&m[1]){const y=parseInt(m[1]),x=c.get(y)??[];x.push(p),c.set(y,x)}}return{byBatchId:f,byTurnNumber:c}},[a]);if(n)return d.jsx("div",{className:"space-y-3 pl-11",children:Array.from({length:LY}).map((f,c)=>d.jsx("div",{className:"h-16 animate-pulse rounded-md bg-surface-container-low"},c))});const o=[...t??[]].sort((f,c)=>(f.started_at??0)-(c.started_at??0));return o.length===0?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Gp,{className:"h-8 w-8 opacity-30"}),d.jsx("span",{className:"font-sans text-sm",children:"No prompts recorded"})]}):d.jsx("div",{children:o.map((f,c)=>{const h=i.get(f.id)??(f.prompt_number!==null?l.get(f.prompt_number)??[]:[]);return d.jsx(zY,{batch:f,batchAttachments:h,defaultOpen:c===o.length-1,promptIndex:c,isLast:c===o.length-1},f.id)})})}const FY="▲",UY="▼";function qY(e){const t=(e.match(/- \[x\]/gi)??[]).length,n=(e.match(/- \[ \]/g)??[]).length;return{total:t+n,checked:t}}const VY={active:"bg-green-500/10 text-green-500",completed:"bg-blue-500/10 text-blue-500"},HY="bg-muted text-muted-foreground";function GY({status:e}){const t=ke("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide",VY[e]??HY);return d.jsx("span",{className:t,children:e})}function $Y({plan:e,initialExpanded:t=!1}){const[n,r]=j.useState(t),a=j.useMemo(()=>e.content?qY(e.content):null,[e.content]),i=a!==null&&a.total>0,l=i?Math.round(a.checked/a.total*100):0;return d.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 overflow-hidden",children:[d.jsxs("div",{className:"flex items-start gap-3 p-4",children:[d.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx(GY,{status:e.status}),e.title&&d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate",children:e.title})]}),e.source_path&&d.jsx("p",{className:"font-mono text-xs text-muted-foreground truncate",title:e.source_path,children:e.source_path}),d.jsxs("div",{className:"flex gap-3 font-sans text-xs text-muted-foreground",children:[d.jsxs("span",{children:["Created ",bi(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&d.jsxs("span",{title:Hb(e.updated_at),children:["Updated ",bi(e.updated_at)]})]}),i&&d.jsxs("div",{className:"space-y-1 pt-0.5",children:[d.jsxs("div",{className:"flex items-center justify-between font-sans text-xs text-muted-foreground",children:[d.jsxs("span",{children:[a.checked,"/",a.total," items"]}),d.jsxs("span",{children:[l,"%"]})]}),d.jsx("div",{className:"h-1.5 rounded-full bg-border overflow-hidden",children:d.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${l}%`}})})]})]}),e.content&&d.jsx("button",{onClick:()=>r(o=>!o),className:"shrink-0 mt-0.5 text-xs text-muted-foreground hover:text-on-surface transition-colors cursor-pointer","aria-label":n?"Collapse plan":"Expand plan",children:n?FY:UY})]}),n&&e.content&&d.jsx("div",{className:"border-t border-border px-4 py-3",children:d.jsx(Mr,{content:e.content,className:"text-sm"})})]})}function KY({sessionId:e,expandedPlanId:t}){const{data:n,isLoading:r,isError:a}=hO(e);return r?d.jsx("div",{className:"flex h-32 items-center justify-center",children:d.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"Loading plans..."})}):a?d.jsx("div",{className:"flex h-32 items-center justify-center",children:d.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"Failed to load plans."})}):!n||n.length===0?d.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30",children:d.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"No plans captured for this session"})}):d.jsx("div",{className:"space-y-3",children:n.map(i=>d.jsx($Y,{plan:i,initialExpanded:String(i.id)===t},i.id))})}function YY(e){return e===null?"—":sm(new Date(e*1e3).toISOString())}const XY=1500;function Lf({label:e,value:t,mono:n=!0,copyable:r=!1,code:a=!1}){const[i,l]=j.useState(!1),o=j.useCallback(()=>{navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),XY)},[t]),f=a?d.jsx("code",{className:"text-xs font-mono text-primary bg-surface-container-lowest rounded px-1.5 py-0.5",children:t}):d.jsx("span",{className:ke("text-xs text-on-surface",n&&"font-mono"),children:t});return d.jsxs("div",{className:"flex items-baseline gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0",children:[d.jsx("span",{className:"shrink-0 w-20 font-sans text-xs font-medium text-on-surface-variant",children:e}),r?d.jsxs("button",{onClick:o,title:"Click to copy",className:"flex items-center gap-1.5 min-w-0 hover:text-primary transition-colors cursor-pointer",children:[f,i&&d.jsx(gc,{className:"h-3 w-3 text-primary shrink-0"})]}):d.jsx("span",{className:"min-w-0",children:f})]})}function tT({label:e,value:t,activeTab:n,onClick:r}){return d.jsx("button",{onClick:()=>r(t),className:ke("px-4 py-2 font-sans text-sm font-medium transition-colors cursor-pointer",n===t?"border-b-2 border-primary text-on-surface":"text-muted-foreground hover:text-on-surface"),children:e})}function QY({id:e}){const t=Za(),{data:n,isLoading:r,isError:a,error:i}=dY(e),{data:l}=vO(),o=ww(),f=mY(),[c,h]=j.useState("idle"),[p,m]=j.useState(!1),[y,x]=j.useState(()=>new URLSearchParams(window.location.search).get("tab")==="plans"?"plans":"conversation"),[b]=j.useState(()=>new URLSearchParams(window.location.search).get("plan")),w=fO(),{data:S}=dO(p?e:null),{data:N}=hO(e);if(r)return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),d.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),d.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Gn,{className:"h-5 w-5 animate-spin"}),d.jsx("span",{className:"font-sans text-sm",children:"Loading session..."})]})]});if(a||!n)return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),d.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Session not found"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:i instanceof Error?i.message:"Unknown error"})]})]});const C=l?yY(l.symbionts,n.agent,e):null;return d.jsxs("div",{className:"p-6 space-y-6 overflow-hidden",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),d.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[d.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:n.title??gl(n.id)}),d.jsx(mO,{status:n.status}),n.agent&&d.jsx(xt,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:n.agent}),d.jsxs(Ae,{variant:"secondary",size:"sm",className:"ml-auto gap-2",disabled:c==="running",onClick:async()=>{h("running");try{await o.mutateAsync({task:"title-summary",instruction:`Process session ${e} only`}),h("done")}catch{h("error")}},children:[c==="running"?d.jsx(Gn,{className:"h-4 w-4 animate-spin"}):d.jsx(I1,{className:"h-4 w-4"}),c==="done"?"Summary Requested":"Generate Summary"]}),(()=>{const T=n.status!=="active",R=f.isSuccess?"Session Completed":T?"Already Completed":"Complete Session";return d.jsxs(Ae,{variant:"secondary",size:"sm",className:"gap-2",disabled:f.isPending||T,title:T?"Session is already completed":"Mark this session completed and regenerate its summary",onClick:()=>f.mutate(e),children:[f.isPending?d.jsx(Gn,{className:"h-4 w-4 animate-spin"}):d.jsx(yc,{className:"h-4 w-4"}),R]})})(),d.jsxs(Ae,{variant:"ghost",size:"sm",className:"gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10",onClick:()=>m(!0),children:[d.jsx(os,{className:"h-4 w-4"}),"Delete"]})]}),d.jsxs("div",{className:"flex flex-wrap gap-4 font-sans text-sm text-on-surface-variant",children:[n.user&&d.jsxs("span",{children:["User: ",d.jsx("span",{className:"text-on-surface",children:n.user})]}),n.branch&&d.jsxs("span",{children:["Branch: ",d.jsx("span",{className:"font-mono text-on-surface",children:n.branch})]}),d.jsxs("span",{children:["Started ",YY(n.started_at)]}),n.ended_at&&d.jsxs("span",{children:["Duration: ",lm(n.started_at,n.ended_at)]})]})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Yt,{label:"Prompts",value:String(n.prompt_count),accent:"sage"}),d.jsx(Yt,{label:"Tool Calls",value:String(n.tool_count),accent:"sage"}),d.jsx(Yt,{label:"Plans",value:String((N==null?void 0:N.length)??0),accent:"outline"})]}),d.jsxs($e,{level:"low",className:"p-4 overflow-hidden",children:[d.jsx(St,{className:"mb-3",children:"Metadata"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6",children:[d.jsx(Lf,{label:"Session ID",value:e,copyable:!0}),C&&d.jsx(Lf,{label:"Resume",value:C,copyable:!0,code:!0}),n.parent_session_id&&d.jsx(Lf,{label:"Parent",value:n.parent_session_id}),n.parent_session_reason&&d.jsx(Lf,{label:"Reason",value:n.parent_session_reason,mono:!1}),n.project_root&&d.jsx(Lf,{label:"Project",value:n.project_root})]})]}),n.summary&&d.jsxs($e,{level:"low",className:"p-4 overflow-hidden",children:[d.jsx(St,{className:"mb-2",children:"Summary"}),d.jsx("p",{className:"font-sans text-sm text-on-surface-variant whitespace-pre-wrap break-words",children:n.summary})]}),d.jsxs("div",{className:"min-w-0 overflow-hidden",children:[d.jsxs("div",{className:"flex gap-0 border-b border-border mb-4",children:[d.jsx(tT,{label:"Conversation",value:"conversation",activeTab:y,onClick:x}),d.jsx(tT,{label:"Plans",value:"plans",activeTab:y,onClick:x})]}),y==="conversation"&&d.jsx(IY,{sessionId:e}),y==="plans"&&d.jsx(KY,{sessionId:e,expandedPlanId:b})]}),d.jsx(um,{open:p,onOpenChange:m,title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:d.jsx(os,{className:"h-4 w-4 text-tertiary"}),meta:n?[{label:"ID",value:gl(n.id)},{label:"Title",value:n.title||gl(n.id)}]:[],impact:S?[{label:"Prompts",value:S.promptCount},{label:"Spores",value:S.sporeCount},{label:"Attachments",value:S.attachmentCount},{label:"Graph Edges",value:S.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:()=>{w.mutate(n.id,{onSuccess:()=>{m(!1),t("/sessions")}})},isPending:w.isPending})]})}function nT(){const{id:e}=cB();return e?d.jsx(QY,{id:e}):d.jsx("div",{className:"p-6",children:d.jsx(AY,{})})}function e1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function WY(e){if(Array.isArray(e))return e}function ZY(e){if(Array.isArray(e))return e1(e)}function Ml(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JY(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,yO(r.key),r)}}function _l(e,t,n){return t&&JY(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_w(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(f){throw f},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
493
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,l=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var f=n.next();return l=f.done,f},e:function(f){o=!0,i=f},f:function(){try{l||n.return==null||n.return()}finally{if(o)throw i}}}}function gO(e,t,n){return(t=yO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eX(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tX(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,l,o=[],f=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);f=!0);}catch(h){c=!0,a=h}finally{try{if(!f&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function nX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
494
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
495
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pn(e,t){return WY(e)||tX(e,t)||_w(e,t)||nX()}function kp(e){return ZY(e)||eX(e)||_w(e)||rX()}function aX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function yO(e){var t=aX(e,"string");return typeof t=="symbol"?t:t+""}function $n(e){"@babel/helpers - typeof";return $n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$n(e)}function _w(e,t){if(e){if(typeof e=="string")return e1(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e1(e,t):void 0}}var qn=typeof window>"u"?null:window,rT=qn?qn.navigator:null;qn&&qn.document;var iX=$n(""),xO=$n({}),sX=$n(function(){}),lX=typeof HTMLElement>"u"?"undefined":$n(HTMLElement),qd=function(t){return t&&t.instanceString&&gn(t.instanceString)?t.instanceString():null},tt=function(t){return t!=null&&$n(t)==iX},gn=function(t){return t!=null&&$n(t)===sX},Qt=function(t){return!da(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},Mt=function(t){return t!=null&&$n(t)===xO&&!Qt(t)&&t.constructor===Object},oX=function(t){return t!=null&&$n(t)===xO},Re=function(t){return t!=null&&$n(t)===$n(1)&&!isNaN(t)},uX=function(t){return Re(t)&&Math.floor(t)===t},Tp=function(t){if(lX!=="undefined")return t!=null&&t instanceof HTMLElement},da=function(t){return Vd(t)||bO(t)},Vd=function(t){return qd(t)==="collection"&&t._private.single},bO=function(t){return qd(t)==="collection"&&!t._private.single},Ow=function(t){return qd(t)==="core"},wO=function(t){return qd(t)==="stylesheet"},cX=function(t){return qd(t)==="event"},Sl=function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},fX=function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},dX=function(t){return Mt(t)&&Re(t.x1)&&Re(t.x2)&&Re(t.y1)&&Re(t.y2)},hX=function(t){return oX(t)&&gn(t.then)},vX=function(){return rT&&rT.userAgent.match(/msie|trident|edge/i)},cc=function(t,n){n||(n=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],l=0;l<arguments.length;l++)i.push(arguments[l]);return i.join("$")});var r=function(){var i=this,l=arguments,o,f=n.apply(i,l),c=r.cache;return(o=c[f])||(o=c[f]=t.apply(i,l)),o};return r.cache={},r},Lw=cc(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),gm=cc(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),SO=cc(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),aT=function(t){return Sl(t)?t:t.charAt(0).toUpperCase()+t.substring(1)},dl=function(t,n){return t.slice(-1*n.length)===n},Hn="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",pX="rgb[a]?\\(("+Hn+"[%]?)\\s*,\\s*("+Hn+"[%]?)\\s*,\\s*("+Hn+"[%]?)(?:\\s*,\\s*("+Hn+"))?\\)",mX="rgb[a]?\\((?:"+Hn+"[%]?)\\s*,\\s*(?:"+Hn+"[%]?)\\s*,\\s*(?:"+Hn+"[%]?)(?:\\s*,\\s*(?:"+Hn+"))?\\)",gX="hsl[a]?\\(("+Hn+")\\s*,\\s*("+Hn+"[%])\\s*,\\s*("+Hn+"[%])(?:\\s*,\\s*("+Hn+"))?\\)",yX="hsl[a]?\\((?:"+Hn+")\\s*,\\s*(?:"+Hn+"[%])\\s*,\\s*(?:"+Hn+"[%])(?:\\s*,\\s*(?:"+Hn+"))?\\)",xX="\\#[0-9a-fA-F]{3}",bX="\\#[0-9a-fA-F]{6}",EO=function(t,n){return t<n?-1:t>n?1:0},wX=function(t,n){return-1*EO(t,n)},at=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var a=Object.keys(r),i=0;i<a.length;i++){var l=a[i];e[l]=r[l]}}return e},SX=function(t){if(!(!(t.length===4||t.length===7)||t[0]!=="#")){var n=t.length===4,r,a,i,l=16;return n?(r=parseInt(t[1]+t[1],l),a=parseInt(t[2]+t[2],l),i=parseInt(t[3]+t[3],l)):(r=parseInt(t[1]+t[2],l),a=parseInt(t[3]+t[4],l),i=parseInt(t[5]+t[6],l)),[r,a,i]}},EX=function(t){var n,r,a,i,l,o,f,c;function h(x,b,w){return w<0&&(w+=1),w>1&&(w-=1),w<1/6?x+(b-x)*6*w:w<1/2?b:w<2/3?x+(b-x)*(2/3-w)*6:x}var p=new RegExp("^"+gX+"$").exec(t);if(p){if(r=parseInt(p[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,a=parseFloat(p[2]),a<0||a>100||(a=a/100,i=parseFloat(p[3]),i<0||i>100)||(i=i/100,l=p[4],l!==void 0&&(l=parseFloat(l),l<0||l>1)))return;if(a===0)o=f=c=Math.round(i*255);else{var m=i<.5?i*(1+a):i+a-i*a,y=2*i-m;o=Math.round(255*h(y,m,r+1/3)),f=Math.round(255*h(y,m,r)),c=Math.round(255*h(y,m,r-1/3))}n=[o,f,c,l]}return n},CX=function(t){var n,r=new RegExp("^"+pX+"$").exec(t);if(r){n=[];for(var a=[],i=1;i<=3;i++){var l=r[i];if(l[l.length-1]==="%"&&(a[i]=!0),l=parseFloat(l),a[i]&&(l=l/100*255),l<0||l>255)return;n.push(Math.floor(l))}var o=a[1]||a[2]||a[3],f=a[1]&&a[2]&&a[3];if(o&&!f)return;var c=r[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;n.push(c)}}return n},NX=function(t){return kX[t.toLowerCase()]},CO=function(t){return(Qt(t)?t:null)||NX(t)||SX(t)||CX(t)||EX(t)},kX={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},NO=function(t){for(var n=t.map,r=t.keys,a=r.length,i=0;i<a;i++){var l=r[i];if(Mt(l))throw Error("Tried to set map with object key");i<r.length-1?(n[l]==null&&(n[l]={}),n=n[l]):n[l]=t.value}},kO=function(t){for(var n=t.map,r=t.keys,a=r.length,i=0;i<a;i++){var l=r[i];if(Mt(l))throw Error("Tried to get map with object key");if(n=n[l],n==null)return n}return n},jv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dx,iT;function Gd(){if(iT)return Dx;iT=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Dx=e,Dx}var Mx,sT;function TX(){if(sT)return Mx;sT=1;var e=typeof jv=="object"&&jv&&jv.Object===Object&&jv;return Mx=e,Mx}var _x,lT;function ym(){if(lT)return _x;lT=1;var e=TX(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return _x=n,_x}var Ox,oT;function jX(){if(oT)return Ox;oT=1;var e=ym(),t=function(){return e.Date.now()};return Ox=t,Ox}var Lx,uT;function AX(){if(uT)return Lx;uT=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Lx=t,Lx}var Px,cT;function RX(){if(cT)return Px;cT=1;var e=AX(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Px=n,Px}var Bx,fT;function Pw(){if(fT)return Bx;fT=1;var e=ym(),t=e.Symbol;return Bx=t,Bx}var zx,dT;function DX(){if(dT)return zx;dT=1;var e=Pw(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(l){var o=n.call(l,a),f=l[a];try{l[a]=void 0;var c=!0}catch{}var h=r.call(l);return c&&(o?l[a]=f:delete l[a]),h}return zx=i,zx}var Ix,hT;function MX(){if(hT)return Ix;hT=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Ix=n,Ix}var Fx,vT;function TO(){if(vT)return Fx;vT=1;var e=Pw(),t=DX(),n=MX(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(o){return o==null?o===void 0?a:r:i&&i in Object(o)?t(o):n(o)}return Fx=l,Fx}var Ux,pT;function _X(){if(pT)return Ux;pT=1;function e(t){return t!=null&&typeof t=="object"}return Ux=e,Ux}var qx,mT;function $d(){if(mT)return qx;mT=1;var e=TO(),t=_X(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return qx=r,qx}var Vx,gT;function OX(){if(gT)return Vx;gT=1;var e=RX(),t=Gd(),n=$d(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,o=parseInt;function f(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=t(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e(c);var p=i.test(c);return p||l.test(c)?o(c.slice(2),p?2:8):a.test(c)?r:+c}return Vx=f,Vx}var Hx,yT;function LX(){if(yT)return Hx;yT=1;var e=Gd(),t=jX(),n=OX(),r="Expected a function",a=Math.max,i=Math.min;function l(o,f,c){var h,p,m,y,x,b,w=0,S=!1,N=!1,C=!0;if(typeof o!="function")throw new TypeError(r);f=n(f)||0,e(c)&&(S=!!c.leading,N="maxWait"in c,m=N?a(n(c.maxWait)||0,f):m,C="trailing"in c?!!c.trailing:C);function T(q){var H=h,G=p;return h=p=void 0,w=q,y=o.apply(G,H),y}function R(q){return w=q,x=setTimeout(O,f),S?T(q):y}function A(q){var H=q-b,G=q-w,F=f-H;return N?i(F,m-G):F}function D(q){var H=q-b,G=q-w;return b===void 0||H>=f||H<0||N&&G>=m}function O(){var q=t();if(D(q))return L(q);x=setTimeout(O,A(q))}function L(q){return x=void 0,C&&h?T(q):(h=p=void 0,y)}function M(){x!==void 0&&clearTimeout(x),w=0,h=b=p=x=void 0}function B(){return x===void 0?y:L(t())}function P(){var q=t(),H=D(q);if(h=arguments,p=this,b=q,H){if(x===void 0)return R(b);if(N)return clearTimeout(x),x=setTimeout(O,f),T(b)}return x===void 0&&(x=setTimeout(O,f)),y}return P.cancel=M,P.flush=B,P}return Hx=l,Hx}var PX=LX(),Kd=Hd(PX),Gx=qn?qn.performance:null,jO=Gx&&Gx.now?function(){return Gx.now()}:function(){return Date.now()},BX=(function(){if(qn){if(qn.requestAnimationFrame)return function(e){qn.requestAnimationFrame(e)};if(qn.mozRequestAnimationFrame)return function(e){qn.mozRequestAnimationFrame(e)};if(qn.webkitRequestAnimationFrame)return function(e){qn.webkitRequestAnimationFrame(e)};if(qn.msRequestAnimationFrame)return function(e){qn.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(jO())},1e3/60)}})(),jp=function(t){return BX(t)},fs=jO,so=9261,AO=65599,Pu=5381,RO=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:so,r=n,a;a=t.next(),!a.done;)r=r*AO+a.value|0;return r},fd=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:so;return n*AO+t|0},dd=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pu;return(n<<5)+n+t|0},zX=function(t,n){return t*2097152+n},Xs=function(t){return t[0]*2097152+t[1]},Av=function(t,n){return[fd(t[0],n[0]),dd(t[1],n[1])]},xT=function(t,n){var r={value:0,done:!1},a=0,i=t.length,l={next:function(){return a<i?r.value=t[a++]:r.done=!0,r}};return RO(l,n)},Ro=function(t,n){var r={value:0,done:!1},a=0,i=t.length,l={next:function(){return a<i?r.value=t.charCodeAt(a++):r.done=!0,r}};return RO(l,n)},DO=function(){return IX(arguments)},IX=function(t){for(var n,r=0;r<t.length;r++){var a=t[r];r===0?n=Ro(a):n=Ro(a,n)}return n};function FX(e,t,n,r,a){var i=a*Math.PI/180,l=Math.cos(i)*(e-n)-Math.sin(i)*(t-r)+n,o=Math.sin(i)*(e-n)+Math.cos(i)*(t-r)+r;return{x:l,y:o}}var UX=function(t,n,r,a,i,l){return{x:(t-r)*i+r,y:(n-a)*l+a}};function qX(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,a=(t.y1+t.y2)/2,i=t.w/t.h,l=1/i,o=FX(e.x,e.y,r,a,n),f=UX(o.x,o.y,r,a,i,l);return{x:f.x,y:f.y}}var bT=!0,VX=console.warn!=null,HX=console.trace!=null,Bw=Number.MAX_SAFE_INTEGER||9007199254740991,MO=function(){return!0},Ap=function(){return!1},wT=function(){return 0},zw=function(){},dn=function(t){throw new Error(t)},_O=function(t){if(t!==void 0)bT=!!t;else return bT},zt=function(t){_O()&&(VX?console.warn(t):(console.log(t),HX&&console.trace()))},GX=function(t){return at({},t)},vi=function(t){return t==null?t:Qt(t)?t.slice():Mt(t)?GX(t):t},$X=function(t){return t.slice()},OO=function(t,n){for(n=t="";t++<36;n+=t*51&52?(t^15?8^Math.random()*(t^20?16:4):4).toString(16):"-");return n},KX={},LO=function(){return KX},hr=function(t){var n=Object.keys(t);return function(r){for(var a={},i=0;i<n.length;i++){var l=n[i],o=r==null?void 0:r[l];a[l]=o===void 0?t[l]:o}return a}},El=function(t,n,r){for(var a=t.length-1;a>=0;a--)t[a]===n&&t.splice(a,1)},Iw=function(t){t.splice(0,t.length)},YX=function(t,n){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}},Kr=function(t,n,r){return r&&(n=SO(r,n)),t[n]},Zi=function(t,n,r,a){r&&(n=SO(r,n)),t[n]=a},XX=(function(){function e(){Ml(this,e),this._obj={}}return _l(e,[{key:"set",value:function(n,r){return this._obj[n]=r,this}},{key:"delete",value:function(n){return this._obj[n]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(n){return this._obj[n]!==void 0}},{key:"get",value:function(n){return this._obj[n]}}])})(),rs=typeof Map<"u"?Map:XX,QX="undefined",WX=(function(){function e(t){if(Ml(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return _l(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(n){var r=this._obj;r[n]!==1&&(r[n]=1,this.size++)}},{key:"delete",value:function(n){var r=this._obj;r[n]===1&&(r[n]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(n){return this._obj[n]===1}},{key:"toArray",value:function(){var n=this;return Object.keys(this._obj).filter(function(r){return n.has(r)})}},{key:"forEach",value:function(n,r){return this.toArray().forEach(n,r)}}])})(),Rc=(typeof Set>"u"?"undefined":$n(Set))!==QX?Set:WX,xm=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||n===void 0||!Ow(t)){dn("An element must have a core reference and parameters set");return}var a=n.group;if(a==null&&(n.data&&n.data.source!=null&&n.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){dn("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1,this[0]=this;var i=this._private={cy:t,single:!0,data:n.data||{},position:n.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!n.selected,selectable:n.selectable===void 0?!0:!!n.selectable,locked:!!n.locked,grabbed:!1,grabbable:n.grabbable===void 0?!0:!!n.grabbable,pannable:n.pannable===void 0?a==="edges":!!n.pannable,active:!1,classes:new Rc,animation:{current:[],queue:[]},rscratch:{},scratch:n.scratch||{},edges:[],children:[],parent:n.parent&&n.parent.isNode()?n.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),n.renderedPosition){var l=n.renderedPosition,o=t.pan(),f=t.zoom();i.position={x:(l.x-o.x)/f,y:(l.y-o.y)/f}}var c=[];Qt(n.classes)?c=n.classes:tt(n.classes)&&(c=n.classes.split(/\s+/));for(var h=0,p=c.length;h<p;h++){var m=c[h];!m||m===""||i.classes.add(m)}this.createEmitter(),(r===void 0||r)&&this.restore();var y=n.style||n.css;y&&(zt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(y))},ST=function(t){return t={bfs:t.bfs||!t.dfs,dfs:t.dfs||!t.bfs},function(r,a,i){var l;Mt(r)&&!da(r)&&(l=r,r=l.roots||l.root,a=l.visit,i=l.directed),i=arguments.length===2&&!gn(a)?a:i,a=gn(a)?a:function(){};for(var o=this._private.cy,f=r=tt(r)?this.filter(r):r,c=[],h=[],p={},m={},y={},x=0,b,w=this.byGroup(),S=w.nodes,N=w.edges,C=0;C<f.length;C++){var T=f[C],R=T.id();T.isNode()&&(c.unshift(T),t.bfs&&(y[R]=!0,h.push(T)),m[R]=0)}for(var A=function(){var q=t.bfs?c.shift():c.pop(),H=q.id();if(t.dfs){if(y[H])return 0;y[H]=!0,h.push(q)}var G=m[H],F=p[H],V=F!=null?F.source():null,Y=F!=null?F.target():null,Q=F==null?void 0:q.same(V)?Y[0]:V[0],I;if(I=a(q,F,Q,x++,G),I===!0)return b=q,1;if(I===!1)return 1;for(var U=q.connectedEdges().filter(function(ae){return(!i||ae.source().same(q))&&N.has(ae)}),X=0;X<U.length;X++){var z=U[X],Z=z.connectedNodes().filter(function(ae){return!ae.same(q)&&S.has(ae)}),re=Z.id();Z.length!==0&&!y[re]&&(Z=Z[0],c.push(Z),t.bfs&&(y[re]=!0,h.push(Z)),p[re]=z,m[re]=m[H]+1)}},D;c.length!==0&&(D=A(),!(D!==0&&D===1)););for(var O=o.collection(),L=0;L<h.length;L++){var M=h[L],B=p[M.id()];B!=null&&O.push(B),O.push(M)}return{path:o.collection(O),found:o.collection(b)}}},hd={breadthFirstSearch:ST({bfs:!0}),depthFirstSearch:ST({dfs:!0})};hd.bfs=hd.breadthFirstSearch;hd.dfs=hd.depthFirstSearch;var Wv={exports:{}},ZX=Wv.exports,ET;function JX(){return ET||(ET=1,(function(e,t){(function(){var n,r,a,i,l,o,f,c,h,p,m,y,x,b,w;a=Math.floor,p=Math.min,r=function(S,N){return S<N?-1:S>N?1:0},h=function(S,N,C,T,R){var A;if(C==null&&(C=0),R==null&&(R=r),C<0)throw new Error("lo must be non-negative");for(T==null&&(T=S.length);C<T;)A=a((C+T)/2),R(N,S[A])<0?T=A:C=A+1;return[].splice.apply(S,[C,C-C].concat(N)),N},o=function(S,N,C){return C==null&&(C=r),S.push(N),b(S,0,S.length-1,C)},l=function(S,N){var C,T;return N==null&&(N=r),C=S.pop(),S.length?(T=S[0],S[0]=C,w(S,0,N)):T=C,T},c=function(S,N,C){var T;return C==null&&(C=r),T=S[0],S[0]=N,w(S,0,C),T},f=function(S,N,C){var T;return C==null&&(C=r),S.length&&C(S[0],N)<0&&(T=[S[0],N],N=T[0],S[0]=T[1],w(S,0,C)),N},i=function(S,N){var C,T,R,A,D,O;for(N==null&&(N=r),A=(function(){O=[];for(var L=0,M=a(S.length/2);0<=M?L<M:L>M;0<=M?L++:L--)O.push(L);return O}).apply(this).reverse(),D=[],T=0,R=A.length;T<R;T++)C=A[T],D.push(w(S,C,N));return D},x=function(S,N,C){var T;if(C==null&&(C=r),T=S.indexOf(N),T!==-1)return b(S,0,T,C),w(S,T,C)},m=function(S,N,C){var T,R,A,D,O;if(C==null&&(C=r),R=S.slice(0,N),!R.length)return R;for(i(R,C),O=S.slice(N),A=0,D=O.length;A<D;A++)T=O[A],f(R,T,C);return R.sort(C).reverse()},y=function(S,N,C){var T,R,A,D,O,L,M,B,P;if(C==null&&(C=r),N*10<=S.length){if(A=S.slice(0,N).sort(C),!A.length)return A;for(R=A[A.length-1],M=S.slice(N),D=0,L=M.length;D<L;D++)T=M[D],C(T,R)<0&&(h(A,T,0,null,C),A.pop(),R=A[A.length-1]);return A}for(i(S,C),P=[],O=0,B=p(N,S.length);0<=B?O<B:O>B;0<=B?++O:--O)P.push(l(S,C));return P},b=function(S,N,C,T){var R,A,D;for(T==null&&(T=r),R=S[C];C>N;){if(D=C-1>>1,A=S[D],T(R,A)<0){S[C]=A,C=D;continue}break}return S[C]=R},w=function(S,N,C){var T,R,A,D,O;for(C==null&&(C=r),R=S.length,O=N,A=S[N],T=2*N+1;T<R;)D=T+1,D<R&&!(C(S[T],S[D])<0)&&(T=D),S[N]=S[T],N=T,T=2*N+1;return S[N]=A,b(S,O,N,C)},n=(function(){S.push=o,S.pop=l,S.replace=c,S.pushpop=f,S.heapify=i,S.updateItem=x,S.nlargest=m,S.nsmallest=y;function S(N){this.cmp=N??r,this.nodes=[]}return S.prototype.push=function(N){return o(this.nodes,N,this.cmp)},S.prototype.pop=function(){return l(this.nodes,this.cmp)},S.prototype.peek=function(){return this.nodes[0]},S.prototype.contains=function(N){return this.nodes.indexOf(N)!==-1},S.prototype.replace=function(N){return c(this.nodes,N,this.cmp)},S.prototype.pushpop=function(N){return f(this.nodes,N,this.cmp)},S.prototype.heapify=function(){return i(this.nodes,this.cmp)},S.prototype.updateItem=function(N){return x(this.nodes,N,this.cmp)},S.prototype.clear=function(){return this.nodes=[]},S.prototype.empty=function(){return this.nodes.length===0},S.prototype.size=function(){return this.nodes.length},S.prototype.clone=function(){var N;return N=new S,N.nodes=this.nodes.slice(0),N},S.prototype.toArray=function(){return this.nodes.slice(0)},S.prototype.insert=S.prototype.push,S.prototype.top=S.prototype.peek,S.prototype.front=S.prototype.peek,S.prototype.has=S.prototype.contains,S.prototype.copy=S.prototype.clone,S})(),(function(S,N){return e.exports=N()})(this,function(){return n})}).call(ZX)})(Wv)),Wv.exports}var $x,CT;function eQ(){return CT||(CT=1,$x=JX()),$x}var tQ=eQ(),Yd=Hd(tQ),nQ=hr({root:null,weight:function(t){return 1},directed:!1}),rQ={dijkstra:function(t){if(!Mt(t)){var n=arguments;t={root:n[0],weight:n[1],directed:n[2]}}var r=nQ(t),a=r.root,i=r.weight,l=r.directed,o=this,f=i,c=tt(a)?this.filter(a)[0]:a[0],h={},p={},m={},y=this.byGroup(),x=y.nodes,b=y.edges;b.unmergeBy(function(G){return G.isLoop()});for(var w=function(F){return h[F.id()]},S=function(F,V){h[F.id()]=V,N.updateItem(F)},N=new Yd(function(G,F){return w(G)-w(F)}),C=0;C<x.length;C++){var T=x[C];h[T.id()]=T.same(c)?0:1/0,N.push(T)}for(var R=function(F,V){for(var Y=(l?F.edgesTo(V):F.edgesWith(V)).intersect(b),Q=1/0,I,U=0;U<Y.length;U++){var X=Y[U],z=f(X);(z<Q||!I)&&(Q=z,I=X)}return{edge:I,dist:Q}};N.size()>0;){var A=N.pop(),D=w(A),O=A.id();if(m[O]=D,D!==1/0)for(var L=A.neighborhood().intersect(x),M=0;M<L.length;M++){var B=L[M],P=B.id(),q=R(A,B),H=D+q.dist;H<w(B)&&(S(B,H),p[P]={node:A,edge:q.edge})}}return{distanceTo:function(F){var V=tt(F)?x.filter(F)[0]:F[0];return m[V.id()]},pathTo:function(F){var V=tt(F)?x.filter(F)[0]:F[0],Y=[],Q=V,I=Q.id();if(V.length>0)for(Y.unshift(V);p[I];){var U=p[I];Y.unshift(U.edge),Y.unshift(U.node),Q=U.node,I=Q.id()}return o.spawn(Y)}}}},aQ={kruskal:function(t){t=t||function(C){return 1};for(var n=this.byGroup(),r=n.nodes,a=n.edges,i=r.length,l=new Array(i),o=r,f=function(T){for(var R=0;R<l.length;R++){var A=l[R];if(A.has(T))return R}},c=0;c<i;c++)l[c]=this.spawn(r[c]);for(var h=a.sort(function(C,T){return t(C)-t(T)}),p=0;p<h.length;p++){var m=h[p],y=m.source()[0],x=m.target()[0],b=f(y),w=f(x),S=l[b],N=l[w];b!==w&&(o.merge(m),S.merge(N),l.splice(w,1))}return o}},iQ=hr({root:null,goal:null,weight:function(t){return 1},heuristic:function(t){return 0},directed:!1}),sQ={aStar:function(t){var n=this.cy(),r=iQ(t),a=r.root,i=r.goal,l=r.heuristic,o=r.directed,f=r.weight;a=n.collection(a)[0],i=n.collection(i)[0];var c=a.id(),h=i.id(),p={},m={},y={},x=new Yd(function(I,U){return m[I.id()]-m[U.id()]}),b=new Rc,w={},S={},N=function(U,X){x.push(U),b.add(X)},C,T,R=function(){C=x.pop(),T=C.id(),b.delete(T)},A=function(U){return b.has(U)};N(a,c),p[c]=0,m[c]=l(a);for(var D=0;x.size()>0;){if(R(),D++,T===h){for(var O=[],L=i,M=h,B=S[M];O.unshift(L),B!=null&&O.unshift(B),L=w[M],L!=null;)M=L.id(),B=S[M];return{found:!0,distance:p[T],path:this.spawn(O),steps:D}}y[T]=!0;for(var P=C._private.edges,q=0;q<P.length;q++){var H=P[q];if(this.hasElementWithId(H.id())&&!(o&&H.data("source")!==T)){var G=H.source(),F=H.target(),V=G.id()!==T?G:F,Y=V.id();if(this.hasElementWithId(Y)&&!y[Y]){var Q=p[T]+f(H);if(!A(Y)){p[Y]=Q,m[Y]=Q+l(V),N(V,Y),w[Y]=C,S[Y]=H;continue}Q<p[Y]&&(p[Y]=Q,m[Y]=Q+l(V),w[Y]=C,S[Y]=H)}}}}return{found:!1,distance:void 0,path:void 0,steps:D}}},lQ=hr({weight:function(t){return 1},directed:!1}),oQ={floydWarshall:function(t){for(var n=this.cy(),r=lQ(t),a=r.weight,i=r.directed,l=a,o=this.byGroup(),f=o.nodes,c=o.edges,h=f.length,p=h*h,m=function(z){return f.indexOf(z)},y=function(z){return f[z]},x=new Array(p),b=0;b<p;b++){var w=b%h,S=(b-w)/h;S===w?x[b]=0:x[b]=1/0}for(var N=new Array(p),C=new Array(p),T=0;T<c.length;T++){var R=c[T],A=R.source()[0],D=R.target()[0];if(A!==D){var O=m(A),L=m(D),M=O*h+L,B=l(R);if(x[M]>B&&(x[M]=B,N[M]=L,C[M]=R),!i){var P=L*h+O;!i&&x[P]>B&&(x[P]=B,N[P]=O,C[P]=R)}}}for(var q=0;q<h;q++)for(var H=0;H<h;H++)for(var G=H*h+q,F=0;F<h;F++){var V=H*h+F,Y=q*h+F;x[G]+x[Y]<x[V]&&(x[V]=x[G]+x[Y],N[V]=N[G])}var Q=function(z){return(tt(z)?n.filter(z):z)[0]},I=function(z){return m(Q(z))},U={distance:function(z,Z){var re=I(z),ae=I(Z);return x[re*h+ae]},path:function(z,Z){var re=I(z),ae=I(Z),se=y(re);if(re===ae)return se.collection();if(N[re*h+ae]==null)return n.collection();var le=n.collection(),ie=re,W;for(le.merge(se);re!==ae;)ie=re,re=N[re*h+ae],W=C[ie*h+re],le.merge(W),le.merge(y(re));return le}};return U}},uQ=hr({weight:function(t){return 1},directed:!1,root:null}),cQ={bellmanFord:function(t){var n=this,r=uQ(t),a=r.weight,i=r.directed,l=r.root,o=a,f=this,c=this.cy(),h=this.byGroup(),p=h.edges,m=h.nodes,y=m.length,x=new rs,b=!1,w=[];l=c.collection(l)[0],p.unmergeBy(function(Je){return Je.isLoop()});for(var S=p.length,N=function(We){var Ve=x.get(We.id());return Ve||(Ve={},x.set(We.id(),Ve)),Ve},C=function(We){return(tt(We)?c.$(We):We)[0]},T=function(We){return N(C(We)).dist},R=function(We){for(var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,De=C(We),Ye=[],Qe=De;;){if(Qe==null)return n.spawn();var st=N(Qe),ze=st.edge,dt=st.pred;if(Ye.unshift(Qe[0]),Qe.same(Ve)&&Ye.length>0)break;ze!=null&&Ye.unshift(ze),Qe=dt}return f.spawn(Ye)},A=0;A<y;A++){var D=m[A],O=N(D);D.same(l)?O.dist=0:O.dist=1/0,O.pred=null,O.edge=null}for(var L=!1,M=function(We,Ve,De,Ye,Qe,st){var ze=Ye.dist+st;ze<Qe.dist&&!De.same(Ye.edge)&&(Qe.dist=ze,Qe.pred=We,Qe.edge=De,L=!0)},B=1;B<y;B++){L=!1;for(var P=0;P<S;P++){var q=p[P],H=q.source(),G=q.target(),F=o(q),V=N(H),Y=N(G);M(H,G,q,V,Y,F),i||M(G,H,q,Y,V,F)}if(!L)break}if(L)for(var Q=[],I=0;I<S;I++){var U=p[I],X=U.source(),z=U.target(),Z=o(U),re=N(X).dist,ae=N(z).dist;if(re+Z<ae||!i&&ae+Z<re)if(b||(zt("Graph contains a negative weight cycle for Bellman-Ford"),b=!0),t.findNegativeWeightCycles!==!1){var se=[];re+Z<ae&&se.push(X),!i&&ae+Z<re&&se.push(z);for(var le=se.length,ie=0;ie<le;ie++){var W=se[ie],te=[W];te.push(N(W).edge);for(var oe=N(W).pred;te.indexOf(oe)===-1;)te.push(oe),te.push(N(oe).edge),oe=N(oe).pred;te=te.slice(te.indexOf(oe));for(var ye=te[0].id(),Te=0,Be=2;Be<te.length;Be+=2)te[Be].id()<ye&&(ye=te[Be].id(),Te=Be);te=te.slice(Te).concat(te.slice(0,Te)),te.push(te[0]);var ot=te.map(function(Je){return Je.id()}).join(",");Q.indexOf(ot)===-1&&(w.push(f.spawn(te)),Q.push(ot))}}else break}return{distanceTo:T,pathTo:R,hasNegativeWeightCycle:b,negativeWeightCycles:w}}},fQ=Math.sqrt(2),dQ=function(t,n,r){r.length===0&&dn("Karger-Stein must be run on a connected (sub)graph");for(var a=r[t],i=a[1],l=a[2],o=n[i],f=n[l],c=r,h=c.length-1;h>=0;h--){var p=c[h],m=p[1],y=p[2];(n[m]===o&&n[y]===f||n[m]===f&&n[y]===o)&&c.splice(h,1)}for(var x=0;x<c.length;x++){var b=c[x];b[1]===f?(c[x]=b.slice(),c[x][1]=o):b[2]===f&&(c[x]=b.slice(),c[x][2]=o)}for(var w=0;w<n.length;w++)n[w]===f&&(n[w]=o);return c},Kx=function(t,n,r,a){for(;r>a;){var i=Math.floor(Math.random()*n.length);n=dQ(i,t,n),r--}return n},hQ={kargerStein:function(){var t=this,n=this.byGroup(),r=n.nodes,a=n.edges;a.unmergeBy(function(Y){return Y.isLoop()});var i=r.length,l=a.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),f=Math.floor(i/fQ);if(i<2){dn("At least 2 nodes are required for Karger-Stein algorithm");return}for(var c=[],h=0;h<l;h++){var p=a[h];c.push([h,r.indexOf(p.source()),r.indexOf(p.target())])}for(var m=1/0,y=[],x=new Array(i),b=new Array(i),w=new Array(i),S=function(Q,I){for(var U=0;U<i;U++)I[U]=Q[U]},N=0;N<=o;N++){for(var C=0;C<i;C++)b[C]=C;var T=Kx(b,c.slice(),i,f),R=T.slice();S(b,w);var A=Kx(b,T,f,2),D=Kx(w,R,f,2);A.length<=D.length&&A.length<m?(m=A.length,y=A,S(b,x)):D.length<=A.length&&D.length<m&&(m=D.length,y=D,S(w,x))}for(var O=this.spawn(y.map(function(Y){return a[Y[0]]})),L=this.spawn(),M=this.spawn(),B=x[0],P=0;P<x.length;P++){var q=x[P],H=r[P];q===B?L.merge(H):M.merge(H)}var G=function(Q){var I=t.spawn();return Q.forEach(function(U){I.merge(U),U.connectedEdges().forEach(function(X){t.contains(X)&&!O.contains(X)&&I.merge(X)})}),I},F=[G(L),G(M)],V={cut:O,components:F,partition1:L,partition2:M};return V}},Yx,vQ=function(t){return{x:t.x,y:t.y}},bm=function(t,n,r){return{x:t.x*n+r.x,y:t.y*n+r.y}},PO=function(t,n,r){return{x:(t.x-r.x)/n,y:(t.y-r.y)/n}},Bu=function(t){return{x:t[0],y:t[1]}},pQ=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=1/0,i=n;i<r;i++){var l=t[i];isFinite(l)&&(a=Math.min(l,a))}return a},mQ=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=-1/0,i=n;i<r;i++){var l=t[i];isFinite(l)&&(a=Math.max(l,a))}return a},gQ=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=0,i=0,l=n;l<r;l++){var o=t[l];isFinite(o)&&(a+=o,i++)}return a/i},yQ=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;a?t=t.slice(n,r):(r<t.length&&t.splice(r,t.length-r),n>0&&t.splice(0,n));for(var o=0,f=t.length-1;f>=0;f--){var c=t[f];l?isFinite(c)||(t[f]=-1/0,o++):t.splice(f,1)}i&&t.sort(function(m,y){return m-y});var h=t.length,p=Math.floor(h/2);return h%2!==0?t[p+1+o]:(t[p-1+o]+t[p+o])/2},xQ=function(t){return Math.PI*t/180},Rv=function(t,n){return Math.atan2(n,t)-Math.PI/2},Fw=Math.log2||function(e){return Math.log(e)/Math.log(2)},Uw=function(t){return t>0?1:t<0?-1:0},Do=function(t,n){return Math.sqrt(ao(t,n))},ao=function(t,n){var r=n.x-t.x,a=n.y-t.y;return r*r+a*a},bQ=function(t){for(var n=t.length,r=0,a=0;a<n;a++)r+=t[a];for(var i=0;i<n;i++)t[i]=t[i]/r;return t},nr=function(t,n,r,a){return(1-a)*(1-a)*t+2*(1-a)*a*n+a*a*r},Gu=function(t,n,r,a){return{x:nr(t.x,n.x,r.x,a),y:nr(t.y,n.y,r.y,a)}},wQ=function(t,n,r,a){var i={x:n.x-t.x,y:n.y-t.y},l=Do(t,n),o={x:i.x/l,y:i.y/l};return r=r??0,a=a??r*l,{x:t.x+o.x*a,y:t.y+o.y*a}},vd=function(t,n,r){return Math.max(t,Math.min(r,n))},_r=function(t){if(t==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(t.x1!=null&&t.y1!=null){if(t.x2!=null&&t.y2!=null&&t.x2>=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},SQ=function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},EQ=function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},CQ=function(t,n){t.x1=Math.min(t.x1,n.x1),t.x2=Math.max(t.x2,n.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,n.y1),t.y2=Math.max(t.y2,n.y2),t.h=t.y2-t.y1},BO=function(t,n,r){t.x1=Math.min(t.x1,n),t.x2=Math.max(t.x2,n),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r),t.y2=Math.max(t.y2,r),t.h=t.y2-t.y1},Zv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=n,t.x2+=n,t.y1-=n,t.y2+=n,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},Jv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,a,i,l;if(n.length===1)r=a=i=l=n[0];else if(n.length===2)r=i=n[0],l=a=n[1];else if(n.length===4){var o=Pn(n,4);r=o[0],a=o[1],i=o[2],l=o[3]}return t.x1-=l,t.x2+=a,t.y1-=r,t.y2+=i,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},NT=function(t,n){t.x1=n.x1,t.y1=n.y1,t.x2=n.x2,t.y2=n.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},qw=function(t,n){return!(t.x1>n.x2||n.x1>t.x2||t.x2<n.x1||n.x2<t.x1||t.y2<n.y1||n.y2<t.y1||t.y1>n.y2||n.y1>t.y2)},hl=function(t,n,r){return t.x1<=n&&n<=t.x2&&t.y1<=r&&r<=t.y2},kT=function(t,n){return hl(t,n.x,n.y)},zO=function(t,n){return hl(t,n.x1,n.y1)&&hl(t,n.x2,n.y2)},NQ=(Yx=Math.hypot)!==null&&Yx!==void 0?Yx:function(e,t){return Math.sqrt(e*e+t*t)};function kQ(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");var n=function(O,L){return{x:O.x+L.x,y:O.y+L.y}},r=function(O,L){return{x:O.x-L.x,y:O.y-L.y}},a=function(O,L){return{x:O.x*L,y:O.y*L}},i=function(O,L){return O.x*L.y-O.y*L.x},l=function(O){var L=NQ(O.x,O.y);return L===0?{x:0,y:0}:{x:O.x/L,y:O.y/L}},o=function(O){for(var L=0,M=0;M<O.length;M++){var B=O[M],P=O[(M+1)%O.length];L+=B.x*P.y-P.x*B.y}return L/2},f=function(O,L,M,B){var P=r(L,O),q=r(B,M),H=i(P,q);if(Math.abs(H)<1e-9)return n(O,a(P,.5));var G=i(r(M,O),q)/H;return n(O,a(P,G))},c=e.map(function(D){return{x:D.x,y:D.y}});o(c)<0&&c.reverse();for(var h=c.length,p=[],m=0;m<h;m++){var y=c[m],x=c[(m+1)%h],b=r(x,y),w=l({x:b.y,y:-b.x});p.push(w)}for(var S=p.map(function(D,O){var L=n(c[O],a(D,t)),M=n(c[(O+1)%h],a(D,t));return{p1:L,p2:M}}),N=[],C=0;C<h;C++){var T=S[(C-1+h)%h],R=S[C],A=f(T.p1,T.p2,R.p1,R.p2);N.push(A)}return N}function TQ(e,t,n,r,a,i){var l=PQ(e,t,n,r,a),o=kQ(l,i),f=_r();return o.forEach(function(c){return BO(f,c.x,c.y)}),f}var IO=function(t,n,r,a,i,l,o){var f=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=f==="auto"?Cl(i,l):f,h=i/2,p=l/2;c=Math.min(c,h,p);var m=c!==h,y=c!==p,x;if(m){var b=r-h+c-o,w=a-p-o,S=r+h-c+o,N=w;if(x=vl(t,n,r,a,b,w,S,N,!1),x.length>0)return x}if(y){var C=r+h+o,T=a-p+c-o,R=C,A=a+p-c+o;if(x=vl(t,n,r,a,C,T,R,A,!1),x.length>0)return x}if(m){var D=r-h+c-o,O=a+p+o,L=r+h-c+o,M=O;if(x=vl(t,n,r,a,D,O,L,M,!1),x.length>0)return x}if(y){var B=r-h-o,P=a-p+c-o,q=B,H=a+p-c+o;if(x=vl(t,n,r,a,B,P,q,H,!1),x.length>0)return x}var G;{var F=r-h+c,V=a-p+c;if(G=Yf(t,n,r,a,F,V,c+o),G.length>0&&G[0]<=F&&G[1]<=V)return[G[0],G[1]]}{var Y=r+h-c,Q=a-p+c;if(G=Yf(t,n,r,a,Y,Q,c+o),G.length>0&&G[0]>=Y&&G[1]<=Q)return[G[0],G[1]]}{var I=r+h-c,U=a+p-c;if(G=Yf(t,n,r,a,I,U,c+o),G.length>0&&G[0]>=I&&G[1]>=U)return[G[0],G[1]]}{var X=r-h+c,z=a+p-c;if(G=Yf(t,n,r,a,X,z,c+o),G.length>0&&G[0]<=X&&G[1]>=z)return[G[0],G[1]]}return[]},jQ=function(t,n,r,a,i,l,o){var f=o,c=Math.min(r,i),h=Math.max(r,i),p=Math.min(a,l),m=Math.max(a,l);return c-f<=t&&t<=h+f&&p-f<=n&&n<=m+f},AQ=function(t,n,r,a,i,l,o,f,c){var h={x1:Math.min(r,o,i)-c,x2:Math.max(r,o,i)+c,y1:Math.min(a,f,l)-c,y2:Math.max(a,f,l)+c};return!(t<h.x1||t>h.x2||n<h.y1||n>h.y2)},RQ=function(t,n,r,a){r-=a;var i=n*n-4*t*r;if(i<0)return[];var l=Math.sqrt(i),o=2*t,f=(-n+l)/o,c=(-n-l)/o;return[f,c]},DQ=function(t,n,r,a,i){var l=1e-5;t===0&&(t=l),n/=t,r/=t,a/=t;var o,f,c,h,p,m,y,x;if(f=(3*r-n*n)/9,c=-(27*a)+n*(9*r-2*(n*n)),c/=54,o=f*f*f+c*c,i[1]=0,y=n/3,o>0){p=c+Math.sqrt(o),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),m=c-Math.sqrt(o),m=m<0?-Math.pow(-m,1/3):Math.pow(m,1/3),i[0]=-y+p+m,y+=(p+m)/2,i[4]=i[2]=-y,y=Math.sqrt(3)*(-m+p)/2,i[3]=y,i[5]=-y;return}if(i[5]=i[3]=0,o===0){x=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-y+2*x,i[4]=i[2]=-(x+y);return}f=-f,h=f*f*f,h=Math.acos(c/Math.sqrt(h)),x=2*Math.sqrt(f),i[0]=-y+x*Math.cos(h/3),i[2]=-y+x*Math.cos((h+2*Math.PI)/3),i[4]=-y+x*Math.cos((h+4*Math.PI)/3)},MQ=function(t,n,r,a,i,l,o,f){var c=1*r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+a*a-4*a*l+2*a*f+4*l*l-4*l*f+f*f,h=9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*a*l-3*a*a-3*a*f-6*l*l+3*l*f,p=3*r*r-6*r*i+r*o-r*t+2*i*i+2*i*t-o*t+3*a*a-6*a*l+a*f-a*n+2*l*l+2*l*n-f*n,m=1*r*i-r*r+r*t-i*t+a*l-a*a+a*n-l*n,y=[];DQ(c,h,p,m,y);for(var x=1e-7,b=[],w=0;w<6;w+=2)Math.abs(y[w+1])<x&&y[w]>=0&&y[w]<=1&&b.push(y[w]);b.push(1),b.push(0);for(var S=-1,N,C,T,R=0;R<b.length;R++)N=Math.pow(1-b[R],2)*r+2*(1-b[R])*b[R]*i+b[R]*b[R]*o,C=Math.pow(1-b[R],2)*a+2*(1-b[R])*b[R]*l+b[R]*b[R]*f,T=Math.pow(N-t,2)+Math.pow(C-n,2),S>=0?T<S&&(S=T):S=T;return S},_Q=function(t,n,r,a,i,l){var o=[t-r,n-a],f=[i-r,l-a],c=f[0]*f[0]+f[1]*f[1],h=o[0]*o[0]+o[1]*o[1],p=o[0]*f[0]+o[1]*f[1],m=p*p/c;return p<0?h:m>c?(t-i)*(t-i)+(n-l)*(n-l):h-m},Yr=function(t,n,r){for(var a,i,l,o,f,c=0,h=0;h<r.length/2;h++)if(a=r[h*2],i=r[h*2+1],h+1<r.length/2?(l=r[(h+1)*2],o=r[(h+1)*2+1]):(l=r[(h+1-r.length/2)*2],o=r[(h+1-r.length/2)*2+1]),!(a==t&&l==t))if(a>=t&&t>=l||a<=t&&t<=l)f=(t-a)/(l-a)*(o-i)+i,f>n&&c++;else continue;return c%2!==0},ds=function(t,n,r,a,i,l,o,f,c){var h=new Array(r.length),p;f[0]!=null?(p=Math.atan(f[1]/f[0]),f[0]<0?p=p+Math.PI/2:p=-p-Math.PI/2):p=f;for(var m=Math.cos(-p),y=Math.sin(-p),x=0;x<h.length/2;x++)h[x*2]=l/2*(r[x*2]*m-r[x*2+1]*y),h[x*2+1]=o/2*(r[x*2+1]*m+r[x*2]*y),h[x*2]+=a,h[x*2+1]+=i;var b;if(c>0){var w=Dp(h,-c);b=Rp(w)}else b=h;return Yr(t,n,b)},OQ=function(t,n,r,a,i,l,o,f){for(var c=new Array(r.length*2),h=0;h<f.length;h++){var p=f[h];c[h*4+0]=p.startX,c[h*4+1]=p.startY,c[h*4+2]=p.stopX,c[h*4+3]=p.stopY;var m=Math.pow(p.cx-t,2)+Math.pow(p.cy-n,2);if(m<=Math.pow(p.radius,2))return!0}return Yr(t,n,c)},Rp=function(t){for(var n=new Array(t.length/2),r,a,i,l,o,f,c,h,p=0;p<t.length/4;p++){r=t[p*4],a=t[p*4+1],i=t[p*4+2],l=t[p*4+3],p<t.length/4-1?(o=t[(p+1)*4],f=t[(p+1)*4+1],c=t[(p+1)*4+2],h=t[(p+1)*4+3]):(o=t[0],f=t[1],c=t[2],h=t[3]);var m=vl(r,a,i,l,o,f,c,h,!0);n[p*2]=m[0],n[p*2+1]=m[1]}return n},Dp=function(t,n){for(var r=new Array(t.length*2),a,i,l,o,f=0;f<t.length/2;f++){a=t[f*2],i=t[f*2+1],f<t.length/2-1?(l=t[(f+1)*2],o=t[(f+1)*2+1]):(l=t[0],o=t[1]);var c=o-i,h=-(l-a),p=Math.sqrt(c*c+h*h),m=c/p,y=h/p;r[f*4]=a+m*n,r[f*4+1]=i+y*n,r[f*4+2]=l+m*n,r[f*4+3]=o+y*n}return r},LQ=function(t,n,r,a,i,l){var o=r-t,f=a-n;o/=i,f/=l;var c=Math.sqrt(o*o+f*f),h=c-1;if(h<0)return[];var p=h/c;return[(r-t)*p+t,(a-n)*p+n]},co=function(t,n,r,a,i,l,o){return t-=i,n-=l,t/=r/2+o,n/=a/2+o,t*t+n*n<=1},Yf=function(t,n,r,a,i,l,o){var f=[r-t,a-n],c=[t-i,n-l],h=f[0]*f[0]+f[1]*f[1],p=2*(c[0]*f[0]+c[1]*f[1]),m=c[0]*c[0]+c[1]*c[1]-o*o,y=p*p-4*h*m;if(y<0)return[];var x=(-p+Math.sqrt(y))/(2*h),b=(-p-Math.sqrt(y))/(2*h),w=Math.min(x,b),S=Math.max(x,b),N=[];if(w>=0&&w<=1&&N.push(w),S>=0&&S<=1&&N.push(S),N.length===0)return[];var C=N[0]*f[0]+t,T=N[0]*f[1]+n;if(N.length>1){if(N[0]==N[1])return[C,T];var R=N[1]*f[0]+t,A=N[1]*f[1]+n;return[C,T,R,A]}else return[C,T]},Xx=function(t,n,r){return n<=t&&t<=r||r<=t&&t<=n?t:t<=n&&n<=r||r<=n&&n<=t?n:r},vl=function(t,n,r,a,i,l,o,f,c){var h=t-i,p=r-t,m=o-i,y=n-l,x=a-n,b=f-l,w=m*y-b*h,S=p*y-x*h,N=b*p-m*x;if(N!==0){var C=w/N,T=S/N,R=.001,A=0-R,D=1+R;return A<=C&&C<=D&&A<=T&&T<=D?[t+C*p,n+C*x]:c?[t+C*p,n+C*x]:[]}else return w===0||S===0?Xx(t,r,o)===o?[o,f]:Xx(t,r,i)===i?[i,l]:Xx(i,o,r)===r?[r,a]:[]:[]},PQ=function(t,n,r,a,i){var l=[],o=a/2,f=i/2,c=n,h=r;l.push({x:c+o*t[0],y:h+f*t[1]});for(var p=1;p<t.length/2;p++)l.push({x:c+o*t[p*2],y:h+f*t[p*2+1]});return l},pd=function(t,n,r,a,i,l,o,f){var c=[],h,p=new Array(r.length),m=!0;l==null&&(m=!1);var y;if(m){for(var x=0;x<p.length/2;x++)p[x*2]=r[x*2]*l+a,p[x*2+1]=r[x*2+1]*o+i;if(f>0){var b=Dp(p,-f);y=Rp(b)}else y=p}else y=r;for(var w,S,N,C,T=0;T<y.length/2;T++)w=y[T*2],S=y[T*2+1],T<y.length/2-1?(N=y[(T+1)*2],C=y[(T+1)*2+1]):(N=y[0],C=y[1]),h=vl(t,n,a,i,w,S,N,C),h.length!==0&&c.push(h[0],h[1]);return c},BQ=function(t,n,r,a,i,l,o,f,c){var h=[],p,m=new Array(r.length*2);c.forEach(function(N,C){C===0?(m[m.length-2]=N.startX,m[m.length-1]=N.startY):(m[C*4-2]=N.startX,m[C*4-1]=N.startY),m[C*4]=N.stopX,m[C*4+1]=N.stopY,p=Yf(t,n,a,i,N.cx,N.cy,N.radius),p.length!==0&&h.push(p[0],p[1])});for(var y=0;y<m.length/4;y++)p=vl(t,n,a,i,m[y*4],m[y*4+1],m[y*4+2],m[y*4+3],!1),p.length!==0&&h.push(p[0],p[1]);if(h.length>2){for(var x=[h[0],h[1]],b=Math.pow(x[0]-t,2)+Math.pow(x[1]-n,2),w=1;w<h.length/2;w++){var S=Math.pow(h[w*2]-t,2)+Math.pow(h[w*2+1]-n,2);S<=b&&(x[0]=h[w*2],x[1]=h[w*2+1],b=S)}return x}return h},Dv=function(t,n,r){var a=[t[0]-n[0],t[1]-n[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),l=(i-r)/i;return l<0&&(l=1e-5),[n[0]+l*a[0],n[1]+l*a[1]]},Ar=function(t,n){var r=t1(t,n);return r=FO(r),r},FO=function(t){for(var n,r,a=t.length/2,i=1/0,l=1/0,o=-1/0,f=-1/0,c=0;c<a;c++)n=t[2*c],r=t[2*c+1],i=Math.min(i,n),o=Math.max(o,n),l=Math.min(l,r),f=Math.max(f,r);for(var h=2/(o-i),p=2/(f-l),m=0;m<a;m++)n=t[2*m]=t[2*m]*h,r=t[2*m+1]=t[2*m+1]*p,i=Math.min(i,n),o=Math.max(o,n),l=Math.min(l,r),f=Math.max(f,r);if(l<-1)for(var y=0;y<a;y++)r=t[2*y+1]=t[2*y+1]+(-1-l);return t},t1=function(t,n){var r=1/t*2*Math.PI,a=t%2===0?Math.PI/2+r/2:Math.PI/2;a+=n;for(var i=new Array(t*2),l,o=0;o<t;o++)l=o*r+a,i[2*o]=Math.cos(l),i[2*o+1]=Math.sin(-l);return i},Cl=function(t,n){return Math.min(t/4,n/4,8)},UO=function(t,n){return Math.min(t/10,n/10,8)},Vw=function(){return 8},zQ=function(t,n,r){return[t-2*n+r,2*(n-t),t]},n1=function(t,n){return{heightOffset:Math.min(15,.05*n),widthOffset:Math.min(100,.25*t),ctrlPtOffsetPct:.05}};function Qx(e,t){function n(p){for(var m=[],y=0;y<p.length;y++){var x=p[y],b=p[(y+1)%p.length],w={x:b.x-x.x,y:b.y-x.y},S={x:-w.y,y:w.x},N=Math.sqrt(S.x*S.x+S.y*S.y);m.push({x:S.x/N,y:S.y/N})}return m}function r(p,m){var y=1/0,x=-1/0,b=Wr(p),w;try{for(b.s();!(w=b.n()).done;){var S=w.value,N=S.x*m.x+S.y*m.y;y=Math.min(y,N),x=Math.max(x,N)}}catch(C){b.e(C)}finally{b.f()}return{min:y,max:x}}function a(p,m){return!(p.max<m.min||m.max<p.min)}var i=[].concat(kp(n(e)),kp(n(t))),l=Wr(i),o;try{for(l.s();!(o=l.n()).done;){var f=o.value,c=r(e,f),h=r(t,f);if(!a(c,h))return!1}}catch(p){l.e(p)}finally{l.f()}return!0}var IQ=hr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(t){return 1}}),FQ={pageRank:function(t){for(var n=IQ(t),r=n.dampingFactor,a=n.precision,i=n.iterations,l=n.weight,o=this._private.cy,f=this.byGroup(),c=f.nodes,h=f.edges,p=c.length,m=p*p,y=h.length,x=new Array(m),b=new Array(p),w=(1-r)/p,S=0;S<p;S++){for(var N=0;N<p;N++){var C=S*p+N;x[C]=0}b[S]=0}for(var T=0;T<y;T++){var R=h[T],A=R.data("source"),D=R.data("target");if(A!==D){var O=c.indexOfId(A),L=c.indexOfId(D),M=l(R),B=L*p+O;x[B]+=M,b[O]+=M}}for(var P=1/p+w,q=0;q<p;q++)if(b[q]===0)for(var H=0;H<p;H++){var G=H*p+q;x[G]=P}else for(var F=0;F<p;F++){var V=F*p+q;x[V]=x[V]/b[q]+w}for(var Y=new Array(p),Q=new Array(p),I,U=0;U<p;U++)Y[U]=1;for(var X=0;X<i;X++){for(var z=0;z<p;z++)Q[z]=0;for(var Z=0;Z<p;Z++)for(var re=0;re<p;re++){var ae=Z*p+re;Q[Z]+=x[ae]*Y[re]}bQ(Q),I=Y,Y=Q,Q=I;for(var se=0,le=0;le<p;le++){var ie=I[le]-Y[le];se+=ie*ie}if(se<a)break}var W={rank:function(oe){return oe=o.collection(oe)[0],Y[c.indexOf(oe)]}};return W}},TT=hr({root:null,weight:function(t){return 1},directed:!1,alpha:0}),$u={degreeCentralityNormalized:function(t){t=TT(t);var n=this.cy(),r=this.nodes(),a=r.length;if(t.directed){for(var h={},p={},m=0,y=0,x=0;x<a;x++){var b=r[x],w=b.id();t.root=b;var S=this.degreeCentrality(t);m<S.indegree&&(m=S.indegree),y<S.outdegree&&(y=S.outdegree),h[w]=S.indegree,p[w]=S.outdegree}return{indegree:function(C){return m==0?0:(tt(C)&&(C=n.filter(C)),h[C.id()]/m)},outdegree:function(C){return y===0?0:(tt(C)&&(C=n.filter(C)),p[C.id()]/y)}}}else{for(var i={},l=0,o=0;o<a;o++){var f=r[o];t.root=f;var c=this.degreeCentrality(t);l<c.degree&&(l=c.degree),i[f.id()]=c.degree}return{degree:function(C){return l===0?0:(tt(C)&&(C=n.filter(C)),i[C.id()]/l)}}}},degreeCentrality:function(t){t=TT(t);var n=this.cy(),r=this,a=t,i=a.root,l=a.weight,o=a.directed,f=a.alpha;if(i=n.collection(i)[0],o){for(var y=i.connectedEdges(),x=y.filter(function(A){return A.target().same(i)&&r.has(A)}),b=y.filter(function(A){return A.source().same(i)&&r.has(A)}),w=x.length,S=b.length,N=0,C=0,T=0;T<x.length;T++)N+=l(x[T]);for(var R=0;R<b.length;R++)C+=l(b[R]);return{indegree:Math.pow(w,1-f)*Math.pow(N,f),outdegree:Math.pow(S,1-f)*Math.pow(C,f)}}else{for(var c=i.connectedEdges().intersection(r),h=c.length,p=0,m=0;m<c.length;m++)p+=l(c[m]);return{degree:Math.pow(h,1-f)*Math.pow(p,f)}}}};$u.dc=$u.degreeCentrality;$u.dcn=$u.degreeCentralityNormalised=$u.degreeCentralityNormalized;var jT=hr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Ku={closenessCentralityNormalized:function(t){for(var n=jT(t),r=n.harmonic,a=n.weight,i=n.directed,l=this.cy(),o={},f=0,c=this.nodes(),h=this.floydWarshall({weight:a,directed:i}),p=0;p<c.length;p++){for(var m=0,y=c[p],x=0;x<c.length;x++)if(p!==x){var b=h.distance(y,c[x]);r?m+=1/b:m+=b}r||(m=1/m),f<m&&(f=m),o[y.id()]=m}return{closeness:function(S){return f==0?0:(tt(S)?S=l.filter(S)[0].id():S=S.id(),o[S]/f)}}},closenessCentrality:function(t){var n=jT(t),r=n.root,a=n.weight,i=n.directed,l=n.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:a,directed:i}),f=0,c=this.nodes(),h=0;h<c.length;h++){var p=c[h];if(!p.same(r)){var m=o.distanceTo(p);l?f+=1/m:f+=m}}return l?f:1/f}};Ku.cc=Ku.closenessCentrality;Ku.ccn=Ku.closenessCentralityNormalised=Ku.closenessCentralityNormalized;var UQ=hr({weight:null,directed:!1}),r1={betweennessCentrality:function(t){for(var n=UQ(t),r=n.directed,a=n.weight,i=a!=null,l=this.cy(),o=this.nodes(),f={},c={},h=0,p={set:function(C,T){c[C]=T,T>h&&(h=T)},get:function(C){return c[C]}},m=0;m<o.length;m++){var y=o[m],x=y.id();r?f[x]=y.outgoers().nodes():f[x]=y.openNeighborhood().nodes(),p.set(x,0)}for(var b=function(){for(var C=o[w].id(),T=[],R={},A={},D={},O=new Yd(function(Z,re){return D[Z]-D[re]}),L=0;L<o.length;L++){var M=o[L].id();R[M]=[],A[M]=0,D[M]=1/0}for(A[C]=1,D[C]=0,O.push(C);!O.empty();){var B=O.pop();if(T.push(B),i)for(var P=0;P<f[B].length;P++){var q=f[B][P],H=l.getElementById(B),G=void 0;H.edgesTo(q).length>0?G=H.edgesTo(q)[0]:G=q.edgesTo(H)[0];var F=a(G);q=q.id(),D[q]>D[B]+F&&(D[q]=D[B]+F,O.nodes.indexOf(q)<0?O.push(q):O.updateItem(q),A[q]=0,R[q]=[]),D[q]==D[B]+F&&(A[q]=A[q]+A[B],R[q].push(B))}else for(var V=0;V<f[B].length;V++){var Y=f[B][V].id();D[Y]==1/0&&(O.push(Y),D[Y]=D[B]+1),D[Y]==D[B]+1&&(A[Y]=A[Y]+A[B],R[Y].push(B))}}for(var Q={},I=0;I<o.length;I++)Q[o[I].id()]=0;for(;T.length>0;){for(var U=T.pop(),X=0;X<R[U].length;X++){var z=R[U][X];Q[z]=Q[z]+A[z]/A[U]*(1+Q[U])}U!=o[w].id()&&p.set(U,p.get(U)+Q[U])}},w=0;w<o.length;w++)b();var S={betweenness:function(C){var T=l.collection(C).id();return p.get(T)},betweennessNormalized:function(C){if(h==0)return 0;var T=l.collection(C).id();return p.get(T)/h}};return S.betweennessNormalised=S.betweennessNormalized,S}};r1.bc=r1.betweennessCentrality;var qQ=hr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),VQ=function(t){return qQ(t)},HQ=function(t,n){for(var r=0,a=0;a<n.length;a++)r+=n[a](t);return r},GQ=function(t,n,r){for(var a=0;a<n;a++)t[a*n+a]=r},qO=function(t,n){for(var r,a=0;a<n;a++){r=0;for(var i=0;i<n;i++)r+=t[i*n+a];for(var l=0;l<n;l++)t[l*n+a]=t[l*n+a]/r}},$Q=function(t,n,r){for(var a=new Array(r*r),i=0;i<r;i++){for(var l=0;l<r;l++)a[i*r+l]=0;for(var o=0;o<r;o++)for(var f=0;f<r;f++)a[i*r+f]+=t[i*r+o]*n[o*r+f]}return a},KQ=function(t,n,r){for(var a=t.slice(0),i=1;i<r;i++)t=$Q(t,a,n);return t},YQ=function(t,n,r){for(var a=new Array(n*n),i=0;i<n*n;i++)a[i]=Math.pow(t[i],r);return qO(a,n),a},XQ=function(t,n,r,a){for(var i=0;i<r;i++){var l=Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a),o=Math.round(n[i]*Math.pow(10,a))/Math.pow(10,a);if(l!==o)return!1}return!0},QQ=function(t,n,r,a){for(var i=[],l=0;l<n;l++){for(var o=[],f=0;f<n;f++)Math.round(t[l*n+f]*1e3)/1e3>0&&o.push(r[f]);o.length!==0&&i.push(a.collection(o))}return i},WQ=function(t,n){for(var r=0;r<t.length;r++)if(!n[r]||t[r].id()!==n[r].id())return!1;return!0},ZQ=function(t){for(var n=0;n<t.length;n++)for(var r=0;r<t.length;r++)n!=r&&WQ(t[n],t[r])&&t.splice(r,1);return t},AT=function(t){for(var n=this.nodes(),r=this.edges(),a=this.cy(),i=VQ(t),l={},o=0;o<n.length;o++)l[n[o].id()]=o;for(var f=n.length,c=f*f,h=new Array(c),p,m=0;m<c;m++)h[m]=0;for(var y=0;y<r.length;y++){var x=r[y],b=l[x.source().id()],w=l[x.target().id()],S=HQ(x,i.attributes);h[b*f+w]+=S,h[w*f+b]+=S}GQ(h,f,i.multFactor),qO(h,f);for(var N=!0,C=0;N&&C<i.maxIterations;)N=!1,p=KQ(h,f,i.expandFactor),h=YQ(p,f,i.inflateFactor),XQ(h,p,c,4)||(N=!0),C++;var T=QQ(h,f,n,a);return T=ZQ(T),T},JQ={markovClustering:AT,mcl:AT},eW=function(t){return t},VO=function(t,n){return Math.abs(n-t)},RT=function(t,n,r){return t+VO(n,r)},DT=function(t,n,r){return t+Math.pow(r-n,2)},tW=function(t){return Math.sqrt(t)},nW=function(t,n,r){return Math.max(t,VO(n,r))},Pf=function(t,n,r,a,i){for(var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:eW,o=a,f,c,h=0;h<t;h++)f=n(h),c=r(h),o=i(o,f,c);return l(o)},fc={euclidean:function(t,n,r){return t>=2?Pf(t,n,r,0,DT,tW):Pf(t,n,r,0,RT)},squaredEuclidean:function(t,n,r){return Pf(t,n,r,0,DT)},manhattan:function(t,n,r){return Pf(t,n,r,0,RT)},max:function(t,n,r){return Pf(t,n,r,-1/0,nW)}};fc["squared-euclidean"]=fc.squaredEuclidean;fc.squaredeuclidean=fc.squaredEuclidean;function wm(e,t,n,r,a,i){var l;return gn(e)?l=e:l=fc[e]||fc.euclidean,t===0&&gn(e)?l(a,i):l(t,n,r,a,i)}var rW=hr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Hw=function(t){return rW(t)},Mp=function(t,n,r,a,i){var l=i!=="kMedoids",o=l?function(p){return r[p]}:function(p){return a[p](r)},f=function(m){return a[m](n)},c=r,h=n;return wm(t,a.length,o,f,c,h)},Wx=function(t,n,r){for(var a=r.length,i=new Array(a),l=new Array(a),o=new Array(n),f=null,c=0;c<a;c++)i[c]=t.min(r[c]).value,l[c]=t.max(r[c]).value;for(var h=0;h<n;h++){f=[];for(var p=0;p<a;p++)f[p]=Math.random()*(l[p]-i[p])+i[p];o[h]=f}return o},HO=function(t,n,r,a,i){for(var l=1/0,o=0,f=0;f<n.length;f++){var c=Mp(r,t,n[f],a,i);c<l&&(l=c,o=f)}return o},GO=function(t,n,r){for(var a=[],i=null,l=0;l<n.length;l++)i=n[l],r[i.id()]===t&&a.push(i);return a},aW=function(t,n,r){return Math.abs(n-t)<=r},iW=function(t,n,r){for(var a=0;a<t.length;a++)for(var i=0;i<t[a].length;i++){var l=Math.abs(t[a][i]-n[a][i]);if(l>r)return!1}return!0},sW=function(t,n,r){for(var a=0;a<r;a++)if(t===n[a])return!0;return!1},MT=function(t,n){var r=new Array(n);if(t.length<50)for(var a=0;a<n;a++){for(var i=t[Math.floor(Math.random()*t.length)];sW(i,r,a);)i=t[Math.floor(Math.random()*t.length)];r[a]=i}else for(var l=0;l<n;l++)r[l]=t[Math.floor(Math.random()*t.length)];return r},_T=function(t,n,r){for(var a=0,i=0;i<n.length;i++)a+=Mp("manhattan",n[i],t,r,"kMedoids");return a},lW=function(t){var n=this.cy(),r=this.nodes(),a=null,i=Hw(t),l=new Array(i.k),o={},f;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,f=Wx(r,i.k,i.attributes)):$n(i.testCentroids)==="object"?f=i.testCentroids:f=Wx(r,i.k,i.attributes):f=Wx(r,i.k,i.attributes);for(var c=!0,h=0;c&&h<i.maxIterations;){for(var p=0;p<r.length;p++)a=r[p],o[a.id()]=HO(a,f,i.distance,i.attributes,"kMeans");c=!1;for(var m=0;m<i.k;m++){var y=GO(m,r,o);if(y.length!==0){for(var x=i.attributes.length,b=f[m],w=new Array(x),S=new Array(x),N=0;N<x;N++){S[N]=0;for(var C=0;C<y.length;C++)a=y[C],S[N]+=i.attributes[N](a);w[N]=S[N]/y.length,aW(w[N],b[N],i.sensitivityThreshold)||(c=!0)}f[m]=w,l[m]=n.collection(y)}}h++}return l},oW=function(t){var n=this.cy(),r=this.nodes(),a=null,i=Hw(t),l=new Array(i.k),o,f={},c,h=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||($n(i.testCentroids)==="object"?o=i.testCentroids:o=MT(r,i.k)):o=MT(r,i.k);for(var p=!0,m=0;p&&m<i.maxIterations;){for(var y=0;y<r.length;y++)a=r[y],f[a.id()]=HO(a,o,i.distance,i.attributes,"kMedoids");p=!1;for(var x=0;x<o.length;x++){var b=GO(x,r,f);if(b.length!==0){h[x]=_T(o[x],b,i.attributes);for(var w=0;w<b.length;w++)c=_T(b[w],b,i.attributes),c<h[x]&&(h[x]=c,o[x]=b[w],p=!0);l[x]=n.collection(b)}}m++}return l},uW=function(t,n,r,a,i){for(var l,o,f=0;f<n.length;f++)for(var c=0;c<t.length;c++)a[f][c]=Math.pow(r[f][c],i.m);for(var h=0;h<t.length;h++)for(var p=0;p<i.attributes.length;p++){l=0,o=0;for(var m=0;m<n.length;m++)l+=a[m][h]*i.attributes[p](n[m]),o+=a[m][h];t[h][p]=l/o}},cW=function(t,n,r,a,i){for(var l=0;l<t.length;l++)n[l]=t[l].slice();for(var o,f,c,h=2/(i.m-1),p=0;p<r.length;p++)for(var m=0;m<a.length;m++){o=0;for(var y=0;y<r.length;y++)f=Mp(i.distance,a[m],r[p],i.attributes,"cmeans"),c=Mp(i.distance,a[m],r[y],i.attributes,"cmeans"),o+=Math.pow(f/c,h);t[m][p]=1/o}},fW=function(t,n,r,a){for(var i=new Array(r.k),l=0;l<i.length;l++)i[l]=[];for(var o,f,c=0;c<n.length;c++){o=-1/0,f=-1;for(var h=0;h<n[0].length;h++)n[c][h]>o&&(o=n[c][h],f=h);i[f].push(t[c])}for(var p=0;p<i.length;p++)i[p]=a.collection(i[p]);return i},OT=function(t){var n=this.cy(),r=this.nodes(),a=Hw(t),i,l,o,f,c;f=new Array(r.length);for(var h=0;h<r.length;h++)f[h]=new Array(a.k);o=new Array(r.length);for(var p=0;p<r.length;p++)o[p]=new Array(a.k);for(var m=0;m<r.length;m++){for(var y=0,x=0;x<a.k;x++)o[m][x]=Math.random(),y+=o[m][x];for(var b=0;b<a.k;b++)o[m][b]=o[m][b]/y}l=new Array(a.k);for(var w=0;w<a.k;w++)l[w]=new Array(a.attributes.length);c=new Array(r.length);for(var S=0;S<r.length;S++)c[S]=new Array(a.k);for(var N=!0,C=0;N&&C<a.maxIterations;)N=!1,uW(l,r,o,c,a),cW(o,f,l,r,a),iW(o,f,a.sensitivityThreshold)||(N=!0),C++;return i=fW(r,o,a,n),{clusters:i,degreeOfMembership:o}},dW={kMeans:lW,kMedoids:oW,fuzzyCMeans:OT,fcm:OT},hW=hr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),vW={single:"min",complete:"max"},pW=function(t){var n=hW(t),r=vW[n.linkage];return r!=null&&(n.linkage=r),n},LT=function(t,n,r,a,i){for(var l=0,o=1/0,f,c=i.attributes,h=function(L,M){return wm(i.distance,c.length,function(B){return c[B](L)},function(B){return c[B](M)},L,M)},p=0;p<t.length;p++){var m=t[p].key,y=r[m][a[m]];y<o&&(l=m,o=y)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&t.length===1)return!1;var x=n[l],b=n[a[l]],w;i.mode==="dendrogram"?w={left:x,right:b,key:x.key}:w={value:x.value.concat(b.value),key:x.key},t[x.index]=w,t.splice(b.index,1),n[x.key]=w;for(var S=0;S<t.length;S++){var N=t[S];x.key===N.key?f=1/0:i.linkage==="min"?(f=r[x.key][N.key],r[x.key][N.key]>r[b.key][N.key]&&(f=r[b.key][N.key])):i.linkage==="max"?(f=r[x.key][N.key],r[x.key][N.key]<r[b.key][N.key]&&(f=r[b.key][N.key])):i.linkage==="mean"?f=(r[x.key][N.key]*x.size+r[b.key][N.key]*b.size)/(x.size+b.size):i.mode==="dendrogram"?f=h(N.value,x.value):f=h(N.value[0],x.value[0]),r[x.key][N.key]=r[N.key][x.key]=f}for(var C=0;C<t.length;C++){var T=t[C].key;if(a[T]===x.key||a[T]===b.key){for(var R=T,A=0;A<t.length;A++){var D=t[A].key;r[T][D]<r[T][R]&&(R=D)}a[T]=R}t[C].index=C}return x.key=b.key=x.index=b.index=null,!0},zu=function(t,n,r){t&&(t.value?n.push(t.value):(t.left&&zu(t.left,n),t.right&&zu(t.right,n)))},a1=function(t,n){if(!t)return"";if(t.left&&t.right){var r=a1(t.left,n),a=a1(t.right,n),i=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:i.id()}}),n.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(t.value)return t.value.id()},i1=function(t,n,r){if(!t)return[];var a=[],i=[],l=[];return n===0?(t.left&&zu(t.left,a),t.right&&zu(t.right,i),l=a.concat(i),[r.collection(l)]):n===1?t.value?[r.collection(t.value)]:(t.left&&zu(t.left,a),t.right&&zu(t.right,i),[r.collection(a),r.collection(i)]):t.value?[r.collection(t.value)]:(t.left&&(a=i1(t.left,n-1,r)),t.right&&(i=i1(t.right,n-1,r)),a.concat(i))},PT=function(t){for(var n=this.cy(),r=this.nodes(),a=pW(t),i=a.attributes,l=function(C,T){return wm(a.distance,i.length,function(R){return i[R](C)},function(R){return i[R](T)},C,T)},o=[],f=[],c=[],h=[],p=0;p<r.length;p++){var m={value:a.mode==="dendrogram"?r[p]:[r[p]],key:p,index:p};o[p]=m,h[p]=m,f[p]=[],c[p]=0}for(var y=0;y<o.length;y++)for(var x=0;x<=y;x++){var b=void 0;a.mode==="dendrogram"?b=y===x?1/0:l(o[y].value,o[x].value):b=y===x?1/0:l(o[y].value[0],o[x].value[0]),f[y][x]=b,f[x][y]=b,b<f[y][c[y]]&&(c[y]=x)}for(var w=LT(o,h,f,c,a);w;)w=LT(o,h,f,c,a);var S;return a.mode==="dendrogram"?(S=i1(o[0],a.dendrogramDepth,n),a.addDendrogram&&a1(o[0],n)):(S=new Array(o.length),o.forEach(function(N,C){N.key=N.index=null,S[C]=n.collection(N.value)})),S},mW={hierarchicalClustering:PT,hca:PT},gW=hr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),yW=function(t){var n=t.damping,r=t.preference;.5<=n&&n<1||dn("Damping must range on [0.5, 1). Got: ".concat(n));var a=["median","mean","min","max"];return a.some(function(i){return i===r})||Re(r)||dn("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(r)),gW(t)},xW=function(t,n,r,a){var i=function(o,f){return a[f](o)};return-wm(t,a.length,function(l){return i(n,l)},function(l){return i(r,l)},n,r)},bW=function(t,n){var r=null;return n==="median"?r=yQ(t):n==="mean"?r=gQ(t):n==="min"?r=pQ(t):n==="max"?r=mQ(t):r=n,r},wW=function(t,n,r){for(var a=[],i=0;i<t;i++)n[i*t+i]+r[i*t+i]>0&&a.push(i);return a},BT=function(t,n,r){for(var a=[],i=0;i<t;i++){for(var l=-1,o=-1/0,f=0;f<r.length;f++){var c=r[f];n[i*t+c]>o&&(l=c,o=n[i*t+c])}l>0&&a.push(l)}for(var h=0;h<r.length;h++)a[r[h]]=r[h];return a},SW=function(t,n,r){for(var a=BT(t,n,r),i=0;i<r.length;i++){for(var l=[],o=0;o<a.length;o++)a[o]===r[i]&&l.push(o);for(var f=-1,c=-1/0,h=0;h<l.length;h++){for(var p=0,m=0;m<l.length;m++)p+=n[l[m]*t+l[h]];p>c&&(f=h,c=p)}r[i]=l[f]}return a=BT(t,n,r),a},zT=function(t){for(var n=this.cy(),r=this.nodes(),a=yW(t),i={},l=0;l<r.length;l++)i[r[l].id()]=l;var o,f,c,h,p,m;o=r.length,f=o*o,c=new Array(f);for(var y=0;y<f;y++)c[y]=-1/0;for(var x=0;x<o;x++)for(var b=0;b<o;b++)x!==b&&(c[x*o+b]=xW(a.distance,r[x],r[b],a.attributes));h=bW(c,a.preference);for(var w=0;w<o;w++)c[w*o+w]=h;p=new Array(f);for(var S=0;S<f;S++)p[S]=0;m=new Array(f);for(var N=0;N<f;N++)m[N]=0;for(var C=new Array(o),T=new Array(o),R=new Array(o),A=0;A<o;A++)C[A]=0,T[A]=0,R[A]=0;for(var D=new Array(o*a.minIterations),O=0;O<D.length;O++)D[O]=0;var L;for(L=0;L<a.maxIterations;L++){for(var M=0;M<o;M++){for(var B=-1/0,P=-1/0,q=-1,H=0,G=0;G<o;G++)C[G]=p[M*o+G],H=m[M*o+G]+c[M*o+G],H>=B?(P=B,B=H,q=G):H>P&&(P=H);for(var F=0;F<o;F++)p[M*o+F]=(1-a.damping)*(c[M*o+F]-B)+a.damping*C[F];p[M*o+q]=(1-a.damping)*(c[M*o+q]-P)+a.damping*C[q]}for(var V=0;V<o;V++){for(var Y=0,Q=0;Q<o;Q++)C[Q]=m[Q*o+V],T[Q]=Math.max(0,p[Q*o+V]),Y+=T[Q];Y-=T[V],T[V]=p[V*o+V],Y+=T[V];for(var I=0;I<o;I++)m[I*o+V]=(1-a.damping)*Math.min(0,Y-T[I])+a.damping*C[I];m[V*o+V]=(1-a.damping)*(Y-T[V])+a.damping*C[V]}for(var U=0,X=0;X<o;X++){var z=m[X*o+X]+p[X*o+X]>0?1:0;D[L%a.minIterations*o+X]=z,U+=z}if(U>0&&(L>=a.minIterations-1||L==a.maxIterations-1)){for(var Z=0,re=0;re<o;re++){R[re]=0;for(var ae=0;ae<a.minIterations;ae++)R[re]+=D[ae*o+re];(R[re]===0||R[re]===a.minIterations)&&Z++}if(Z===o)break}}for(var se=wW(o,p,m),le=SW(o,c,se),ie={},W=0;W<se.length;W++)ie[se[W]]=[];for(var te=0;te<r.length;te++){var oe=i[r[te].id()],ye=le[oe];ye!=null&&ie[ye].push(r[te])}for(var Te=new Array(se.length),Be=0;Be<se.length;Be++)Te[Be]=n.collection(ie[se[Be]]);return Te},EW={affinityPropagation:zT,ap:zT},CW=hr({root:void 0,directed:!1}),NW={hierholzer:function(t){if(!Mt(t)){var n=arguments;t={root:n[0],directed:n[1]}}var r=CW(t),a=r.root,i=r.directed,l=this,o=!1,f,c,h;a&&(h=tt(a)?this.filter(a)[0].id():a[0].id());var p={},m={};i?l.forEach(function(N){var C=N.id();if(N.isNode()){var T=N.indegree(!0),R=N.outdegree(!0),A=T-R,D=R-T;A==1?f?o=!0:f=C:D==1?c?o=!0:c=C:(D>1||A>1)&&(o=!0),p[C]=[],N.outgoers().forEach(function(O){O.isEdge()&&p[C].push(O.id())})}else m[C]=[void 0,N.target().id()]}):l.forEach(function(N){var C=N.id();if(N.isNode()){var T=N.degree(!0);T%2&&(f?c?o=!0:c=C:f=C),p[C]=[],N.connectedEdges().forEach(function(R){return p[C].push(R.id())})}else m[C]=[N.source().id(),N.target().id()]});var y={found:!1,trail:void 0};if(o)return y;if(c&&f)if(i){if(h&&c!=h)return y;h=c}else{if(h&&c!=h&&f!=h)return y;h||(h=c)}else h||(h=l[0].id());var x=function(C){for(var T=C,R=[C],A,D,O;p[T].length;)A=p[T].shift(),D=m[A][0],O=m[A][1],T!=O?(p[O]=p[O].filter(function(L){return L!=A}),T=O):!i&&T!=D&&(p[D]=p[D].filter(function(L){return L!=A}),T=D),R.unshift(A),R.unshift(T);return R},b=[],w=[];for(w=x(h);w.length!=1;)p[w[0]].length==0?(b.unshift(l.getElementById(w.shift())),b.unshift(l.getElementById(w.shift()))):w=x(w.shift()).concat(w);b.unshift(l.getElementById(w.shift()));for(var S in p)if(p[S].length)return y;return y.found=!0,y.trail=this.spawn(b,!0),y}},Mv=function(){var t=this,n={},r=0,a=0,i=[],l=[],o={},f=function(m,y){for(var x=l.length-1,b=[],w=t.spawn();l[x].x!=m||l[x].y!=y;)b.push(l.pop().edge),x--;b.push(l.pop().edge),b.forEach(function(S){var N=S.connectedNodes().intersection(t);w.merge(S),N.forEach(function(C){var T=C.id(),R=C.connectedEdges().intersection(t);w.merge(C),n[T].cutVertex?w.merge(R.filter(function(A){return A.isLoop()})):w.merge(R)})}),i.push(w)},c=function(m,y,x){m===x&&(a+=1),n[y]={id:r,low:r++,cutVertex:!1};var b=t.getElementById(y).connectedEdges().intersection(t);if(b.size()===0)i.push(t.spawn(t.getElementById(y)));else{var w,S,N,C;b.forEach(function(T){w=T.source().id(),S=T.target().id(),N=w===y?S:w,N!==x&&(C=T.id(),o[C]||(o[C]=!0,l.push({x:y,y:N,edge:T})),N in n?n[y].low=Math.min(n[y].low,n[N].id):(c(m,N,y),n[y].low=Math.min(n[y].low,n[N].low),n[y].id<=n[N].low&&(n[y].cutVertex=!0,f(y,N))))})}};t.forEach(function(p){if(p.isNode()){var m=p.id();m in n||(a=0,c(m,m),n[m].cutVertex=a>1)}});var h=Object.keys(n).filter(function(p){return n[p].cutVertex}).map(function(p){return t.getElementById(p)});return{cut:t.spawn(h),components:i}},kW={hopcroftTarjanBiconnected:Mv,htbc:Mv,htb:Mv,hopcroftTarjanBiconnectedComponents:Mv},_v=function(){var t=this,n={},r=0,a=[],i=[],l=t.spawn(t),o=function(c){i.push(c),n[c]={index:r,low:r++,explored:!1};var h=t.getElementById(c).connectedEdges().intersection(t);if(h.forEach(function(b){var w=b.target().id();w!==c&&(w in n||o(w),n[w].explored||(n[c].low=Math.min(n[c].low,n[w].low)))}),n[c].index===n[c].low){for(var p=t.spawn();;){var m=i.pop();if(p.merge(t.getElementById(m)),n[m].low=n[c].index,n[m].explored=!0,m===c)break}var y=p.edgesWith(p),x=p.merge(y);a.push(x),l=l.difference(x)}};return t.forEach(function(f){if(f.isNode()){var c=f.id();c in n||o(c)}}),{cut:l,components:a}},TW={tarjanStronglyConnected:_v,tsc:_v,tscc:_v,tarjanStronglyConnectedComponents:_v},$O={};[hd,rQ,aQ,sQ,oQ,cQ,hQ,FQ,$u,Ku,r1,JQ,dW,mW,EW,NW,kW,TW].forEach(function(e){at($O,e)});/*!
|
|
496
|
-
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
497
|
-
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
498
|
-
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
499
|
-
*/var KO=0,YO=1,XO=2,Qa=function(t){if(!(this instanceof Qa))return new Qa(t);this.id="Thenable/1.0.7",this.state=KO,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Qa.prototype={fulfill:function(t){return IT(this,YO,"fulfillValue",t)},reject:function(t){return IT(this,XO,"rejectReason",t)},then:function(t,n){var r=this,a=new Qa;return r.onFulfilled.push(UT(t,a,"fulfill")),r.onRejected.push(UT(n,a,"reject")),QO(r),a.proxy}};var IT=function(t,n,r,a){return t.state===KO&&(t.state=n,t[r]=a,QO(t)),t},QO=function(t){t.state===YO?FT(t,"onFulfilled",t.fulfillValue):t.state===XO&&FT(t,"onRejected",t.rejectReason)},FT=function(t,n,r){if(t[n].length!==0){var a=t[n];t[n]=[];var i=function(){for(var o=0;o<a.length;o++)a[o](r)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},UT=function(t,n,r){return function(a){if(typeof t!="function")n[r].call(n,a);else{var i;try{i=t(a)}catch(l){n.reject(l);return}WO(n,i)}}},WO=function(t,n){if(t===n||t.proxy===n){t.reject(new TypeError("cannot resolve promise with itself"));return}var r;if($n(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(i){t.reject(i);return}if(typeof r=="function"){var a=!1;try{r.call(n,function(i){a||(a=!0,i===n?t.reject(new TypeError("circular thenable chain")):WO(t,i))},function(i){a||(a=!0,t.reject(i))})}catch(i){a||t.reject(i)}return}t.fulfill(n)};Qa.all=function(e){return new Qa(function(t,n){for(var r=new Array(e.length),a=0,i=function(f,c){r[f]=c,a++,a===e.length&&t(r)},l=0;l<e.length;l++)(function(o){var f=e[o],c=f!=null&&f.then!=null;if(c)f.then(function(p){i(o,p)},function(p){n(p)});else{var h=f;i(o,h)}})(l)})};Qa.resolve=function(e){return new Qa(function(t,n){t(e)})};Qa.reject=function(e){return new Qa(function(t,n){n(e)})};var Dc=typeof Promise<"u"?Promise:Qa,s1=function(t,n,r){var a=Ow(t),i=!a,l=this._private=at({duration:1e3},n,r);if(l.target=t,l.style=l.style||l.css,l.started=!1,l.playing=!1,l.hooked=!1,l.applying=!1,l.progress=0,l.completes=[],l.frames=[],l.complete&&gn(l.complete)&&l.completes.push(l.complete),i){var o=t.position();l.startPosition=l.startPosition||{x:o.x,y:o.y},l.startStyle=l.startStyle||t.cy().style().getAnimationStartStyle(t,l.style)}if(a){var f=t.pan();l.startPan={x:f.x,y:f.y},l.startZoom=t.zoom()}this.length=1,this[0]=this},Mo=s1.prototype;at(Mo,{instanceString:function(){return"animation"},hook:function(){var t=this._private;if(!t.hooked){var n,r=t.target._private.animation;t.queue?n=r.queue:n=r.current,n.push(this),da(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0}return this},play:function(){var t=this._private;return t.progress===1&&(t.progress=0),t.playing=!0,t.started=!1,t.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var t=this._private;return t.applying=!0,t.started=!1,t.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var t=this._private;return t.playing=!1,t.started=!1,this},stop:function(){var t=this._private;return t.playing=!1,t.started=!1,t.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var n=this._private;return t===void 0?n.progress*n.duration:this.progress(t/n.duration)},progress:function(t){var n=this._private,r=n.playing;return t===void 0?n.progress:(r&&this.pause(),n.progress=t,n.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var t=this._private,n=t.playing;n&&this.pause(),t.progress=1-t.progress,t.started=!1;var r=function(c,h){var p=t[c];p!=null&&(t[c]=t[h],t[h]=p)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),t.style)for(var a=0;a<t.style.length;a++){var i=t.style[a],l=i.name,o=t.startStyle[l];t.startStyle[l]=i,t.style[a]=o}return n&&this.play(),this},promise:function(t){var n=this._private,r;switch(t){case"frame":r=n.frames;break;default:case"complete":case"completed":r=n.completes}return new Dc(function(a,i){r.push(function(){a()})})}});Mo.complete=Mo.completed;Mo.run=Mo.play;Mo.running=Mo.playing;var jW={animated:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return!1;var l=a[0];if(l)return l._private.animation.current.length>0}},clearQueue:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var l=0;l<a.length;l++){var o=a[l];o._private.animation.queue=[]}return this}},delay:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:n,duration:n,complete:r}):this}},delayAnimation:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:n,duration:n,complete:r}):this}},animation:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this,f=!i,c=!f;if(!o.styleEnabled())return this;var h=o.style();n=at({},n,r);var p=Object.keys(n).length===0;if(p)return new s1(l[0],n);switch(n.duration===void 0&&(n.duration=400),n.duration){case"slow":n.duration=600;break;case"fast":n.duration=200;break}if(c&&(n.style=h.getPropsList(n.style||n.css),n.css=void 0),c&&n.renderedPosition!=null){var m=n.renderedPosition,y=o.pan(),x=o.zoom();n.position=PO(m,x,y)}if(f&&n.panBy!=null){var b=n.panBy,w=o.pan();n.pan={x:w.x+b.x,y:w.y+b.y}}var S=n.center||n.centre;if(f&&S!=null){var N=o.getCenterPan(S.eles,n.zoom);N!=null&&(n.pan=N)}if(f&&n.fit!=null){var C=n.fit,T=o.getFitViewport(C.eles||C.boundingBox,C.padding);T!=null&&(n.pan=T.pan,n.zoom=T.zoom)}if(f&&Mt(n.zoom)){var R=o.getZoomedViewport(n.zoom);R!=null?(R.zoomed&&(n.zoom=R.zoom),R.panned&&(n.pan=R.pan)):n.zoom=null}return new s1(l[0],n)}},animate:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;r&&(n=at({},n,r));for(var f=0;f<l.length;f++){var c=l[f],h=c.animated()&&(n.queue===void 0||n.queue),p=c.animation(n,h?{queue:!0}:void 0);p.play()}return this}},stop:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var f=0;f<l.length;f++){for(var c=l[f],h=c._private,p=h.animation.current,m=0;m<p.length;m++){var y=p[m],x=y._private;r&&(x.duration=0)}n&&(h.animation.queue=[]),r||(h.animation.current=[])}return o.notify("draw"),this}}},Zx,qT;function Sm(){if(qT)return Zx;qT=1;var e=Array.isArray;return Zx=e,Zx}var Jx,VT;function AW(){if(VT)return Jx;VT=1;var e=Sm(),t=$d(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,l){if(e(i))return!1;var o=typeof i;return o=="number"||o=="symbol"||o=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Jx=a,Jx}var e0,HT;function RW(){if(HT)return e0;HT=1;var e=TO(),t=Gd(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(o){if(!t(o))return!1;var f=e(o);return f==r||f==a||f==n||f==i}return e0=l,e0}var t0,GT;function DW(){if(GT)return t0;GT=1;var e=ym(),t=e["__core-js_shared__"];return t0=t,t0}var n0,$T;function MW(){if($T)return n0;$T=1;var e=DW(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return n0=n,n0}var r0,KT;function _W(){if(KT)return r0;KT=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return r0=n,r0}var a0,YT;function OW(){if(YT)return a0;YT=1;var e=RW(),t=MW(),n=Gd(),r=_W(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,o=Object.prototype,f=l.toString,c=o.hasOwnProperty,h=RegExp("^"+f.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!n(m)||t(m))return!1;var y=e(m)?h:i;return y.test(r(m))}return a0=p,a0}var i0,XT;function LW(){if(XT)return i0;XT=1;function e(t,n){return t==null?void 0:t[n]}return i0=e,i0}var s0,QT;function Gw(){if(QT)return s0;QT=1;var e=OW(),t=LW();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return s0=n,s0}var l0,WT;function Em(){if(WT)return l0;WT=1;var e=Gw(),t=e(Object,"create");return l0=t,l0}var o0,ZT;function PW(){if(ZT)return o0;ZT=1;var e=Em();function t(){this.__data__=e?e(null):{},this.size=0}return o0=t,o0}var u0,JT;function BW(){if(JT)return u0;JT=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return u0=e,u0}var c0,ej;function zW(){if(ej)return c0;ej=1;var e=Em(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var o=l[i];return o===t?void 0:o}return r.call(l,i)?l[i]:void 0}return c0=a,c0}var f0,tj;function IW(){if(tj)return f0;tj=1;var e=Em(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return f0=r,f0}var d0,nj;function FW(){if(nj)return d0;nj=1;var e=Em(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return d0=n,d0}var h0,rj;function UW(){if(rj)return h0;rj=1;var e=PW(),t=BW(),n=zW(),r=IW(),a=FW();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,h0=i,h0}var v0,aj;function qW(){if(aj)return v0;aj=1;function e(){this.__data__=[],this.size=0}return v0=e,v0}var p0,ij;function ZO(){if(ij)return p0;ij=1;function e(t,n){return t===n||t!==t&&n!==n}return p0=e,p0}var m0,sj;function Cm(){if(sj)return m0;sj=1;var e=ZO();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return m0=t,m0}var g0,lj;function VW(){if(lj)return g0;lj=1;var e=Cm(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var o=i.length-1;return l==o?i.pop():n.call(i,l,1),--this.size,!0}return g0=r,g0}var y0,oj;function HW(){if(oj)return y0;oj=1;var e=Cm();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return y0=t,y0}var x0,uj;function GW(){if(uj)return x0;uj=1;var e=Cm();function t(n){return e(this.__data__,n)>-1}return x0=t,x0}var b0,cj;function $W(){if(cj)return b0;cj=1;var e=Cm();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return b0=t,b0}var w0,fj;function KW(){if(fj)return w0;fj=1;var e=qW(),t=VW(),n=HW(),r=GW(),a=$W();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,w0=i,w0}var S0,dj;function YW(){if(dj)return S0;dj=1;var e=Gw(),t=ym(),n=e(t,"Map");return S0=n,S0}var E0,hj;function XW(){if(hj)return E0;hj=1;var e=UW(),t=KW(),n=YW();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return E0=r,E0}var C0,vj;function QW(){if(vj)return C0;vj=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return C0=e,C0}var N0,pj;function Nm(){if(pj)return N0;pj=1;var e=QW();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return N0=t,N0}var k0,mj;function WW(){if(mj)return k0;mj=1;var e=Nm();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return k0=t,k0}var T0,gj;function ZW(){if(gj)return T0;gj=1;var e=Nm();function t(n){return e(this,n).get(n)}return T0=t,T0}var j0,yj;function JW(){if(yj)return j0;yj=1;var e=Nm();function t(n){return e(this,n).has(n)}return j0=t,j0}var A0,xj;function eZ(){if(xj)return A0;xj=1;var e=Nm();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return A0=t,A0}var R0,bj;function tZ(){if(bj)return R0;bj=1;var e=XW(),t=WW(),n=ZW(),r=JW(),a=eZ();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,R0=i,R0}var D0,wj;function nZ(){if(wj)return D0;wj=1;var e=tZ(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,o=a?a.apply(this,l):l[0],f=i.cache;if(f.has(o))return f.get(o);var c=r.apply(this,l);return i.cache=f.set(o,c)||f,c};return i.cache=new(n.Cache||e),i}return n.Cache=e,D0=n,D0}var M0,Sj;function rZ(){if(Sj)return M0;Sj=1;var e=nZ(),t=500;function n(r){var a=e(r,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return M0=n,M0}var _0,Ej;function JO(){if(Ej)return _0;Ej=1;var e=rZ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,o,f,c){i.push(f?c.replace(n,"$1"):o||l)}),i});return _0=r,_0}var O0,Cj;function eL(){if(Cj)return O0;Cj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return O0=e,O0}var L0,Nj;function aZ(){if(Nj)return L0;Nj=1;var e=Pw(),t=eL(),n=Sm(),r=$d(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(o){if(typeof o=="string")return o;if(n(o))return t(o,l)+"";if(r(o))return i?i.call(o):"";var f=o+"";return f=="0"&&1/o==-1/0?"-0":f}return L0=l,L0}var P0,kj;function tL(){if(kj)return P0;kj=1;var e=aZ();function t(n){return n==null?"":e(n)}return P0=t,P0}var B0,Tj;function nL(){if(Tj)return B0;Tj=1;var e=Sm(),t=AW(),n=JO(),r=tL();function a(i,l){return e(i)?i:t(i,l)?[i]:n(r(i))}return B0=a,B0}var z0,jj;function $w(){if(jj)return z0;jj=1;var e=$d();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return z0=t,z0}var I0,Aj;function iZ(){if(Aj)return I0;Aj=1;var e=nL(),t=$w();function n(r,a){a=e(a,r);for(var i=0,l=a.length;r!=null&&i<l;)r=r[t(a[i++])];return i&&i==l?r:void 0}return I0=n,I0}var F0,Rj;function sZ(){if(Rj)return F0;Rj=1;var e=iZ();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return F0=t,F0}var lZ=sZ(),oZ=Hd(lZ),U0,Dj;function uZ(){if(Dj)return U0;Dj=1;var e=Gw(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return U0=t,U0}var q0,Mj;function cZ(){if(Mj)return q0;Mj=1;var e=uZ();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return q0=t,q0}var V0,_j;function fZ(){if(_j)return V0;_j=1;var e=cZ(),t=ZO(),n=Object.prototype,r=n.hasOwnProperty;function a(i,l,o){var f=i[l];(!(r.call(i,l)&&t(f,o))||o===void 0&&!(l in i))&&e(i,l,o)}return V0=a,V0}var H0,Oj;function dZ(){if(Oj)return H0;Oj=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return H0=n,H0}var G0,Lj;function hZ(){if(Lj)return G0;Lj=1;var e=fZ(),t=nL(),n=dZ(),r=Gd(),a=$w();function i(l,o,f,c){if(!r(l))return l;o=t(o,l);for(var h=-1,p=o.length,m=p-1,y=l;y!=null&&++h<p;){var x=a(o[h]),b=f;if(x==="__proto__"||x==="constructor"||x==="prototype")return l;if(h!=m){var w=y[x];b=c?c(w,x,y):void 0,b===void 0&&(b=r(w)?w:n(o[h+1])?[]:{})}e(y,x,b),y=y[x]}return l}return G0=i,G0}var $0,Pj;function vZ(){if(Pj)return $0;Pj=1;var e=hZ();function t(n,r,a){return n==null?n:e(n,r,a)}return $0=t,$0}var pZ=vZ(),mZ=Hd(pZ),K0,Bj;function gZ(){if(Bj)return K0;Bj=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return K0=e,K0}var Y0,zj;function yZ(){if(zj)return Y0;zj=1;var e=eL(),t=gZ(),n=Sm(),r=$d(),a=JO(),i=$w(),l=tL();function o(f){return n(f)?e(f,i):r(f)?[f]:t(a(l(f)))}return Y0=o,Y0}var xZ=yZ(),bZ=Hd(xZ),wZ={data:function(t){var n={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return t=at({},n,t),function(a,i){var l=t,o=this,f=o.length!==void 0,c=f?o:[o],h=f?o[0]:o;if(tt(a)){var p=a.indexOf(".")!==-1,m=p&&bZ(a);if(l.allowGetting&&i===void 0){var y;return h&&(l.beforeGet(h),m&&h._private[l.field][a]===void 0?y=oZ(h._private[l.field],m):y=h._private[l.field][a]),y}else if(l.allowSetting&&i!==void 0){var x=!l.immutableKeys[a];if(x){var b=gO({},a,i);l.beforeSet(o,b);for(var w=0,S=c.length;w<S;w++){var N=c[w];l.canSet(N)&&(m&&h._private[l.field][a]===void 0?mZ(N._private[l.field],m,i):N._private[l.field][a]=i)}l.updateStyle&&o.updateStyle(),l.onSet(o),l.settingTriggersEvent&&o[l.triggerFnName](l.settingEvent)}}}else if(l.allowSetting&&Mt(a)){var C=a,T,R,A=Object.keys(C);l.beforeSet(o,C);for(var D=0;D<A.length;D++){T=A[D],R=C[T];var O=!l.immutableKeys[T];if(O)for(var L=0;L<c.length;L++){var M=c[L];l.canSet(M)&&(M._private[l.field][T]=R)}}l.updateStyle&&o.updateStyle(),l.onSet(o),l.settingTriggersEvent&&o[l.triggerFnName](l.settingEvent)}else if(l.allowBinding&&gn(a)){var B=a;o.on(l.bindingEvent,B)}else if(l.allowGetting&&a===void 0){var P;return h&&(l.beforeGet(h),P=h._private[l.field]),P}return o}},removeData:function(t){var n={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return t=at({},n,t),function(a){var i=t,l=this,o=l.length!==void 0,f=o?l:[l];if(tt(a)){for(var c=a.split(/\s+/),h=c.length,p=0;p<h;p++){var m=c[p];if(!Sl(m)){var y=!i.immutableKeys[m];if(y)for(var x=0,b=f.length;x<b;x++)f[x]._private[i.field][m]=void 0}}i.triggerEvent&&l[i.triggerFnName](i.event)}else if(a===void 0){for(var w=0,S=f.length;w<S;w++)for(var N=f[w]._private[i.field],C=Object.keys(N),T=0;T<C.length;T++){var R=C[T],A=!i.immutableKeys[R];A&&(N[R]=void 0)}i.triggerEvent&&l[i.triggerFnName](i.event)}return l}}},SZ={eventAliasesOn:function(t){var n=t;n.addListener=n.listen=n.bind=n.on,n.unlisten=n.unbind=n.off=n.removeListener,n.trigger=n.emit,n.pon=n.promiseOn=function(r,a){var i=this,l=Array.prototype.slice.call(arguments,0);return new Dc(function(o,f){var c=function(y){i.off.apply(i,p),o(y)},h=l.concat([c]),p=h.concat([]);i.on.apply(i,h)})}}},Bt={};[jW,wZ,SZ].forEach(function(e){at(Bt,e)});var EZ={animate:Bt.animate(),animation:Bt.animation(),animated:Bt.animated(),clearQueue:Bt.clearQueue(),delay:Bt.delay(),delayAnimation:Bt.delayAnimation(),stop:Bt.stop()},ep={classes:function(t){var n=this;if(t===void 0){var r=[];return n[0]._private.classes.forEach(function(x){return r.push(x)}),r}else Qt(t)||(t=(t||"").match(/\S+/g)||[]);for(var a=[],i=new Rc(t),l=0;l<n.length;l++){for(var o=n[l],f=o._private,c=f.classes,h=!1,p=0;p<t.length;p++){var m=t[p],y=c.has(m);if(!y){h=!0;break}}h||(h=c.size!==t.length),h&&(f.classes=i,a.push(o))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},addClass:function(t){return this.toggleClass(t,!0)},hasClass:function(t){var n=this[0];return n!=null&&n._private.classes.has(t)},toggleClass:function(t,n){Qt(t)||(t=t.match(/\S+/g)||[]);for(var r=this,a=n===void 0,i=[],l=0,o=r.length;l<o;l++)for(var f=r[l],c=f._private.classes,h=!1,p=0;p<t.length;p++){var m=t[p],y=c.has(m),x=!1;n||a&&!y?(c.add(m),x=!0):(!n||a&&y)&&(c.delete(m),x=!0),!h&&x&&(i.push(f),h=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},removeClass:function(t){return this.toggleClass(t,!1)},flashClass:function(t,n){var r=this;if(n==null)n=250;else if(n===0)return r;return r.addClass(t),setTimeout(function(){r.removeClass(t)},n),r}};ep.className=ep.classNames=ep.classes;var Dt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Hn,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Dt.variable="(?:[\\w-.]|(?:\\\\"+Dt.metaChar+"))+";Dt.className="(?:[\\w-]|(?:\\\\"+Dt.metaChar+"))+";Dt.value=Dt.string+"|"+Dt.number;Dt.id=Dt.variable;(function(){var e,t,n;for(e=Dt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Dt.comparatorOp+="|@"+t;for(e=Dt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(Dt.comparatorOp+="|\\!"+t)})();var Kt=function(){return{checks:[]}},qe={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},l1=[{selector:":selected",matches:function(t){return t.selected()}},{selector:":unselected",matches:function(t){return!t.selected()}},{selector:":selectable",matches:function(t){return t.selectable()}},{selector:":unselectable",matches:function(t){return!t.selectable()}},{selector:":locked",matches:function(t){return t.locked()}},{selector:":unlocked",matches:function(t){return!t.locked()}},{selector:":visible",matches:function(t){return t.visible()}},{selector:":hidden",matches:function(t){return!t.visible()}},{selector:":transparent",matches:function(t){return t.transparent()}},{selector:":grabbed",matches:function(t){return t.grabbed()}},{selector:":free",matches:function(t){return!t.grabbed()}},{selector:":removed",matches:function(t){return t.removed()}},{selector:":inside",matches:function(t){return!t.removed()}},{selector:":grabbable",matches:function(t){return t.grabbable()}},{selector:":ungrabbable",matches:function(t){return!t.grabbable()}},{selector:":animated",matches:function(t){return t.animated()}},{selector:":unanimated",matches:function(t){return!t.animated()}},{selector:":parent",matches:function(t){return t.isParent()}},{selector:":childless",matches:function(t){return t.isChildless()}},{selector:":child",matches:function(t){return t.isChild()}},{selector:":orphan",matches:function(t){return t.isOrphan()}},{selector:":nonorphan",matches:function(t){return t.isChild()}},{selector:":compound",matches:function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()}},{selector:":loop",matches:function(t){return t.isLoop()}},{selector:":simple",matches:function(t){return t.isSimple()}},{selector:":active",matches:function(t){return t.active()}},{selector:":inactive",matches:function(t){return!t.active()}},{selector:":backgrounding",matches:function(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function(t){return!t.backgrounding()}}].sort(function(e,t){return wX(e.selector,t.selector)}),CZ=(function(){for(var e={},t,n=0;n<l1.length;n++)t=l1[n],e[t.selector]=t.matches;return e})(),NZ=function(t,n){return CZ[t](n)},kZ="("+l1.map(function(e){return e.selector}).join("|")+")",ku=function(t){return t.replace(new RegExp("\\\\("+Dt.metaChar+")","g"),function(n,r){return r})},Qs=function(t,n,r){t[t.length-1]=r},o1=[{name:"group",query:!0,regex:"("+Dt.group+")",populate:function(t,n,r){var a=Pn(r,1),i=a[0];n.checks.push({type:qe.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:kZ,populate:function(t,n,r){var a=Pn(r,1),i=a[0];n.checks.push({type:qe.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Dt.id+")",populate:function(t,n,r){var a=Pn(r,1),i=a[0];n.checks.push({type:qe.ID,value:ku(i)})}},{name:"className",query:!0,regex:"\\.("+Dt.className+")",populate:function(t,n,r){var a=Pn(r,1),i=a[0];n.checks.push({type:qe.CLASS,value:ku(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Dt.variable+")\\s*\\]",populate:function(t,n,r){var a=Pn(r,1),i=a[0];n.checks.push({type:qe.DATA_EXIST,field:ku(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Dt.variable+")\\s*("+Dt.comparatorOp+")\\s*("+Dt.value+")\\s*\\]",populate:function(t,n,r){var a=Pn(r,3),i=a[0],l=a[1],o=a[2],f=new RegExp("^"+Dt.string+"$").exec(o)!=null;f?o=o.substring(1,o.length-1):o=parseFloat(o),n.checks.push({type:qe.DATA_COMPARE,field:ku(i),operator:l,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Dt.boolOp+")\\s*("+Dt.variable+")\\s*\\]",populate:function(t,n,r){var a=Pn(r,2),i=a[0],l=a[1];n.checks.push({type:qe.DATA_BOOL,field:ku(l),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Dt.meta+")\\s*("+Dt.comparatorOp+")\\s*("+Dt.number+")\\s*\\]\\]",populate:function(t,n,r){var a=Pn(r,3),i=a[0],l=a[1],o=a[2];n.checks.push({type:qe.META_COMPARE,field:ku(i),operator:l,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Dt.separator,populate:function(t,n){var r=t.currentSubject,a=t.edgeCount,i=t.compoundCount,l=t[t.length-1];r!=null&&(l.subject=r,t.currentSubject=null),l.edgeCount=a,l.compoundCount=i,t.edgeCount=0,t.compoundCount=0;var o=t[t.length++]=Kt();return o}},{name:"directedEdge",separator:!0,regex:Dt.directedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Kt(),a=n,i=Kt();return r.checks.push({type:qe.DIRECTED_EDGE,source:a,target:i}),Qs(t,n,r),t.edgeCount++,i}else{var l=Kt(),o=n,f=Kt();return l.checks.push({type:qe.NODE_SOURCE,source:o,target:f}),Qs(t,n,l),t.edgeCount++,f}}},{name:"undirectedEdge",separator:!0,regex:Dt.undirectedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Kt(),a=n,i=Kt();return r.checks.push({type:qe.UNDIRECTED_EDGE,nodes:[a,i]}),Qs(t,n,r),t.edgeCount++,i}else{var l=Kt(),o=n,f=Kt();return l.checks.push({type:qe.NODE_NEIGHBOR,node:o,neighbor:f}),Qs(t,n,l),f}}},{name:"child",separator:!0,regex:Dt.child,populate:function(t,n){if(t.currentSubject==null){var r=Kt(),a=Kt(),i=t[t.length-1];return r.checks.push({type:qe.CHILD,parent:i,child:a}),Qs(t,n,r),t.compoundCount++,a}else if(t.currentSubject===n){var l=Kt(),o=t[t.length-1],f=Kt(),c=Kt(),h=Kt(),p=Kt();return l.checks.push({type:qe.COMPOUND_SPLIT,left:o,right:f,subject:c}),c.checks=n.checks,n.checks=[{type:qe.TRUE}],p.checks.push({type:qe.TRUE}),f.checks.push({type:qe.PARENT,parent:p,child:h}),Qs(t,o,l),t.currentSubject=c,t.compoundCount++,h}else{var m=Kt(),y=Kt(),x=[{type:qe.PARENT,parent:m,child:y}];return m.checks=n.checks,n.checks=x,t.compoundCount++,y}}},{name:"descendant",separator:!0,regex:Dt.descendant,populate:function(t,n){if(t.currentSubject==null){var r=Kt(),a=Kt(),i=t[t.length-1];return r.checks.push({type:qe.DESCENDANT,ancestor:i,descendant:a}),Qs(t,n,r),t.compoundCount++,a}else if(t.currentSubject===n){var l=Kt(),o=t[t.length-1],f=Kt(),c=Kt(),h=Kt(),p=Kt();return l.checks.push({type:qe.COMPOUND_SPLIT,left:o,right:f,subject:c}),c.checks=n.checks,n.checks=[{type:qe.TRUE}],p.checks.push({type:qe.TRUE}),f.checks.push({type:qe.ANCESTOR,ancestor:p,descendant:h}),Qs(t,o,l),t.currentSubject=c,t.compoundCount++,h}else{var m=Kt(),y=Kt(),x=[{type:qe.ANCESTOR,ancestor:m,descendant:y}];return m.checks=n.checks,n.checks=x,t.compoundCount++,y}}},{name:"subject",modifier:!0,regex:Dt.subject,populate:function(t,n){if(t.currentSubject!=null&&t.currentSubject!==n)return zt("Redefinition of subject in selector `"+t.toString()+"`"),!1;t.currentSubject=n;var r=t[t.length-1],a=r.checks[0],i=a==null?null:a.type;i===qe.DIRECTED_EDGE?a.type=qe.NODE_TARGET:i===qe.UNDIRECTED_EDGE&&(a.type=qe.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];o1.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var TZ=function(t){for(var n,r,a,i=0;i<o1.length;i++){var l=o1[i],o=l.name,f=t.match(l.regexObj);if(f!=null){r=f,n=l,a=o;var c=f[0];t=t.substring(c.length);break}}return{expr:n,match:r,name:a,remaining:t}},jZ=function(t){var n=t.match(/^\s+/);if(n){var r=n[0];t=t.substring(r.length)}return t},AZ=function(t){var n=this,r=n.inputText=t,a=n[0]=Kt();for(n.length=1,r=jZ(r);;){var i=TZ(r);if(i.expr==null)return zt("The selector `"+t+"`is invalid"),!1;var l=i.match.slice(1),o=i.expr.populate(n,a,l);if(o===!1)return!1;if(o!=null&&(a=o),r=i.remaining,r.match(/^\s*$/))break}var f=n[n.length-1];n.currentSubject!=null&&(f.subject=n.currentSubject),f.edgeCount=n.edgeCount,f.compoundCount=n.compoundCount;for(var c=0;c<n.length;c++){var h=n[c];if(h.compoundCount>0&&h.edgeCount>0)return zt("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return zt("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&zt("The selector `"+t+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},RZ=function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=function(h){return h??""},n=function(h){return tt(h)?'"'+h+'"':t(h)},r=function(h){return" "+h+" "},a=function(h,p){var m=h.type,y=h.value;switch(m){case qe.GROUP:{var x=t(y);return x.substring(0,x.length-1)}case qe.DATA_COMPARE:{var b=h.field,w=h.operator;return"["+b+r(t(w))+n(y)+"]"}case qe.DATA_BOOL:{var S=h.operator,N=h.field;return"["+t(S)+N+"]"}case qe.DATA_EXIST:{var C=h.field;return"["+C+"]"}case qe.META_COMPARE:{var T=h.operator,R=h.field;return"[["+R+r(t(T))+n(y)+"]]"}case qe.STATE:return y;case qe.ID:return"#"+y;case qe.CLASS:return"."+y;case qe.PARENT:case qe.CHILD:return i(h.parent,p)+r(">")+i(h.child,p);case qe.ANCESTOR:case qe.DESCENDANT:return i(h.ancestor,p)+" "+i(h.descendant,p);case qe.COMPOUND_SPLIT:{var A=i(h.left,p),D=i(h.subject,p),O=i(h.right,p);return A+(A.length>0?" ":"")+D+O}case qe.TRUE:return""}},i=function(h,p){return h.checks.reduce(function(m,y,x){return m+(p===h&&x===0?"$":"")+a(y,p)},"")},l="",o=0;o<this.length;o++){var f=this[o];l+=i(f,f.subject),this.length>1&&o<this.length-1&&(l+=", ")}return this.toStringCache=l,l},DZ={parse:AZ,toString:RZ},rL=function(t,n,r){var a,i=tt(t),l=Re(t),o=tt(r),f,c,h=!1,p=!1,m=!1;switch(n.indexOf("!")>=0&&(n=n.replace("!",""),p=!0),n.indexOf("@")>=0&&(n=n.replace("@",""),h=!0),(i||o||h)&&(f=!i&&!l?"":""+t,c=""+r),h&&(t=f=f.toLowerCase(),r=c=c.toLowerCase()),n){case"*=":a=f.indexOf(c)>=0;break;case"$=":a=f.indexOf(c,f.length-c.length)>=0;break;case"^=":a=f.indexOf(c)===0;break;case"=":a=t===r;break;case">":m=!0,a=t>r;break;case">=":m=!0,a=t>=r;break;case"<":m=!0,a=t<r;break;case"<=":m=!0,a=t<=r;break;default:a=!1;break}return p&&(t!=null||!m)&&(a=!a),a},MZ=function(t,n){switch(n){case"?":return!!t;case"!":return!t;case"^":return t===void 0}},_Z=function(t){return t!==void 0},Kw=function(t,n){return t.data(n)},OZ=function(t,n){return t[n]()},En=[],on=function(t,n){return t.checks.every(function(r){return En[r.type](r,n)})};En[qe.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()};En[qe.STATE]=function(e,t){var n=e.value;return NZ(n,t)};En[qe.ID]=function(e,t){var n=e.value;return t.id()===n};En[qe.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)};En[qe.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return rL(OZ(t,n),r,a)};En[qe.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return rL(Kw(t,n),r,a)};En[qe.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return MZ(Kw(t,n),r)};En[qe.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,_Z(Kw(t,n))};En[qe.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return on(n,a)&&on(r,i)||on(r,a)&&on(n,i)};En[qe.NODE_NEIGHBOR]=function(e,t){return on(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&on(e.neighbor,n)})};En[qe.DIRECTED_EDGE]=function(e,t){return on(e.source,t.source())&&on(e.target,t.target())};En[qe.NODE_SOURCE]=function(e,t){return on(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&on(e.target,n)})};En[qe.NODE_TARGET]=function(e,t){return on(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&on(e.source,n)})};En[qe.CHILD]=function(e,t){return on(e.child,t)&&on(e.parent,t.parent())};En[qe.PARENT]=function(e,t){return on(e.parent,t)&&t.children().some(function(n){return on(e.child,n)})};En[qe.DESCENDANT]=function(e,t){return on(e.descendant,t)&&t.ancestors().some(function(n){return on(e.ancestor,n)})};En[qe.ANCESTOR]=function(e,t){return on(e.ancestor,t)&&t.descendants().some(function(n){return on(e.descendant,n)})};En[qe.COMPOUND_SPLIT]=function(e,t){return on(e.subject,t)&&on(e.left,t)&&on(e.right,t)};En[qe.TRUE]=function(){return!0};En[qe.COLLECTION]=function(e,t){var n=e.value;return n.has(t)};En[qe.FILTER]=function(e,t){var n=e.value;return n(t)};var LZ=function(t){var n=this;if(n.length===1&&n[0].checks.length===1&&n[0].checks[0].type===qe.ID)return t.getElementById(n[0].checks[0].value).collection();var r=function(i){for(var l=0;l<n.length;l++){var o=n[l];if(on(o,i))return!0}return!1};return n.text()==null&&(r=function(){return!0}),t.filter(r)},PZ=function(t){for(var n=this,r=0;r<n.length;r++){var a=n[r];if(on(a,t))return!0}return!1},BZ={matches:PZ,filter:LZ},Nl=function(t){this.inputText=t,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,t==null||tt(t)&&t.match(/^\s*$/)||(da(t)?this.addQuery({checks:[{type:qe.COLLECTION,value:t.collection()}]}):gn(t)?this.addQuery({checks:[{type:qe.FILTER,value:t}]}):tt(t)?this.parse(t)||(this.invalid=!0):dn("A selector must be created from a string; found "))},kl=Nl.prototype;[DZ,BZ].forEach(function(e){return at(kl,e)});kl.text=function(){return this.inputText};kl.size=function(){return this.length};kl.eq=function(e){return this[e]};kl.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()};kl.addQuery=function(e){this[this.length++]=e};kl.selector=kl.toString;var yl={allAre:function(t){var n=new Nl(t);return this.every(function(r){return n.matches(r)})},is:function(t){var n=new Nl(t);return this.some(function(r){return n.matches(r)})},some:function(t,n){for(var r=0;r<this.length;r++){var a=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(a)return!0}return!1},every:function(t,n){for(var r=0;r<this.length;r++){var a=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(!a)return!1}return!0},same:function(t){if(this===t)return!0;t=this.cy().collection(t);var n=this.length,r=t.length;return n!==r?!1:n===1?this[0]===t[0]:this.every(function(a){return t.hasElementWithId(a.id())})},anySame:function(t){return t=this.cy().collection(t),this.some(function(n){return t.hasElementWithId(n.id())})},allAreNeighbors:function(t){t=this.cy().collection(t);var n=this.neighborhood();return t.every(function(r){return n.hasElementWithId(r.id())})},contains:function(t){t=this.cy().collection(t);var n=this;return t.every(function(r){return n.hasElementWithId(r.id())})}};yl.allAreNeighbours=yl.allAreNeighbors;yl.has=yl.contains;yl.equal=yl.equals=yl.same;var Oa=function(t,n){return function(a,i,l,o){var f=a,c=this,h;if(f==null?h="":da(f)&&f.length===1&&(h=f.id()),c.length===1&&h){var p=c[0]._private,m=p.traversalCache=p.traversalCache||{},y=m[n]=m[n]||[],x=Ro(h),b=y[x];return b||(y[x]=t.call(c,a,i,l,o))}else return t.call(c,a,i,l,o)}},dc={parent:function(t){var n=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var a=0;a<this.length;a++){var i=this[a],l=i._private.parent;l&&n.push(l)}return this.spawn(n,!0).filter(t)},parents:function(t){for(var n=[],r=this.parent();r.nonempty();){for(var a=0;a<r.length;a++){var i=r[a];n.push(i)}r=r.parent()}return this.spawn(n,!0).filter(t)},commonAncestors:function(t){for(var n,r=0;r<this.length;r++){var a=this[r],i=a.parents();n=n||i,n=n.intersect(i)}return n.filter(t)},orphans:function(t){return this.stdFilter(function(n){return n.isOrphan()}).filter(t)},nonorphans:function(t){return this.stdFilter(function(n){return n.isChild()}).filter(t)},children:Oa(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],a=r._private.children,i=0;i<a.length;i++)t.push(a[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(t){return this.parent().children().not(this).filter(t)},isParent:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length!==0},isChildless:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length===0},isChild:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent!=null},isOrphan:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent==null},descendants:function(t){var n=[];function r(a){for(var i=0;i<a.length;i++){var l=a[i];n.push(l),l.children().nonempty()&&r(l.children())}}return r(this.children()),this.spawn(n,!0).filter(t)}};function Yw(e,t,n,r){for(var a=[],i=new Rc,l=e.cy(),o=l.hasCompoundNodes(),f=0;f<e.length;f++){var c=e[f];n?a.push(c):o&&r(a,i,c)}for(;a.length>0;){var h=a.shift();t(h),i.add(h.id()),o&&r(a,i,h)}return e}function aL(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}dc.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Yw(this,e,t,aL)};function iL(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}dc.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Yw(this,e,t,iL)};function zZ(e,t,n){iL(e,t,n),aL(e,t,n)}dc.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Yw(this,e,t,zZ)};dc.ancestors=dc.parents;var md,sL;md=sL={data:Bt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Bt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Bt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Bt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Bt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Bt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var t=this[0];if(t)return t._private.data.id}};md.attr=md.data;md.removeAttr=md.removeData;var IZ=sL,km={};function X0(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,l=0;l<i.length;l++){var o=i[l];!t&&o.isLoop()||(r+=e(a,o))}return r}else return}}at(km,{degree:X0(function(e,t){return t.source().same(t.target())?2:1}),indegree:X0(function(e,t){return t.target().same(e)?1:0}),outdegree:X0(function(e,t){return t.source().same(e)?1:0})});function Tu(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var l=a[i],o=l[e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}at(km,{minDegree:Tu("degree",function(e,t){return e<t}),maxDegree:Tu("degree",function(e,t){return e>t}),minIndegree:Tu("indegree",function(e,t){return e<t}),maxIndegree:Tu("indegree",function(e,t){return e>t}),minOutdegree:Tu("outdegree",function(e,t){return e<t}),maxOutdegree:Tu("outdegree",function(e,t){return e>t})});at(km,{totalDegree:function(t){for(var n=0,r=this.nodes(),a=0;a<r.length;a++)n+=r[a].degree(t);return n}});var Ga,lL,oL=function(t,n,r){for(var a=0;a<t.length;a++){var i=t[a];if(!i.locked()){var l=i._private.position,o={x:n.x!=null?n.x-l.x:0,y:n.y!=null?n.y-l.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},Ij={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(t){t.updateCompoundBounds()},beforeSet:function(t,n){oL(t,n,!1)},onSet:function(t){t.dirtyCompoundBoundsCache()},canSet:function(t){return!t.locked()}};Ga=lL={position:Bt.data(Ij),silentPosition:Bt.data(at({},Ij,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(t,n){oL(t,n,!0)},onSet:function(t){t.dirtyCompoundBoundsCache()}})),positions:function(t,n){if(Mt(t))n?this.silentPosition(t):this.position(t);else if(gn(t)){var r=t,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var l=this[i],o=void 0;(o=r(l,i))&&(n?l.silentPosition(o):l.position(o))}a.endBatch()}return this},silentPositions:function(t){return this.positions(t,!0)},shift:function(t,n,r){var a;if(Mt(t)?(a={x:Re(t.x)?t.x:0,y:Re(t.y)?t.y:0},r=n):tt(t)&&Re(n)&&(a={x:0,y:0},a[t]=n),a!=null){var i=this.cy();i.startBatch();for(var l=0;l<this.length;l++){var o=this[l];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var f=o.position(),c={x:f.x+a.x,y:f.y+a.y};r?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(t,n){return Mt(t)?this.shift(t,!0):tt(t)&&Re(n)&&this.shift(t,n,!0),this},renderedPosition:function(t,n){var r=this[0],a=this.cy(),i=a.zoom(),l=a.pan(),o=Mt(t)?t:void 0,f=o!==void 0||n!==void 0&&tt(t);if(r&&r.isNode())if(f)for(var c=0;c<this.length;c++){var h=this[c];n!==void 0?h.position(t,(n-l[t])/i):o!==void 0&&h.position(PO(o,i,l))}else{var p=r.position();return o=bm(p,i,l),t===void 0?o:o[t]}else if(!f)return;return this},relativePosition:function(t,n){var r=this[0],a=this.cy(),i=Mt(t)?t:void 0,l=i!==void 0||n!==void 0&&tt(t),o=a.hasCompoundNodes();if(r&&r.isNode())if(l)for(var f=0;f<this.length;f++){var c=this[f],h=o?c.parent():null,p=h&&h.length>0,m=p;p&&(h=h[0]);var y=m?h.position():{x:0,y:0};n!==void 0?c.position(t,n+y[t]):i!==void 0&&c.position({x:i.x+y.x,y:i.y+y.y})}else{var x=r.position(),b=o?r.parent():null,w=b&&b.length>0,S=w;w&&(b=b[0]);var N=S?b.position():{x:0,y:0};return i={x:x.x-N.x,y:x.y-N.y},t===void 0?i:i[t]}else if(!l)return;return this}};Ga.modelPosition=Ga.point=Ga.position;Ga.modelPositions=Ga.points=Ga.positions;Ga.renderedPoint=Ga.renderedPosition;Ga.relativePoint=Ga.relativePosition;var FZ=lL,Yu,Ol;Yu=Ol={};Ol.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,l=t.x2*r+a.x,o=t.y1*r+a.y,f=t.y2*r+a.y;return{x1:i,x2:l,y1:o,y2:f,w:l-i,h:f-o}};Ol.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)};Ol.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(l){if(!l.isParent())return;var o=l._private,f=l.children(),c=l.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:l.pstyle("min-width").pfValue,left:l.pstyle("min-width-bias-left"),right:l.pstyle("min-width-bias-right")},height:{val:l.pstyle("min-height").pfValue,top:l.pstyle("min-height-bias-top"),bottom:l.pstyle("min-height-bias-bottom")}},p=f.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),m=o.position;(p.w===0||p.h===0)&&(p={w:l.pstyle("width").pfValue,h:l.pstyle("height").pfValue},p.x1=m.x-p.w/2,p.x2=m.x+p.w/2,p.y1=m.y-p.h/2,p.y2=m.y+p.h/2);function y(L,M,B){var P=0,q=0,H=M+B;return L>0&&H>0&&(P=M/H*L,q=B/H*L),{biasDiff:P,biasComplementDiff:q}}function x(L,M,B,P){if(B.units==="%")switch(P){case"width":return L>0?B.pfValue*L:0;case"height":return M>0?B.pfValue*M:0;case"average":return L>0&&M>0?B.pfValue*(L+M)/2:0;case"min":return L>0&&M>0?L>M?B.pfValue*M:B.pfValue*L:0;case"max":return L>0&&M>0?L>M?B.pfValue*L:B.pfValue*M:0;default:return 0}else return B.units==="px"?B.pfValue:0}var b=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(b=b*100/h.width.val);var w=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(w=w*100/h.width.val);var S=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(S=S*100/h.height.val);var N=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(N=N*100/h.height.val);var C=y(h.width.val-p.w,b,w),T=C.biasDiff,R=C.biasComplementDiff,A=y(h.height.val-p.h,S,N),D=A.biasDiff,O=A.biasComplementDiff;o.autoPadding=x(p.w,p.h,l.pstyle("padding"),l.pstyle("padding-relative-to").value),o.autoWidth=Math.max(p.w,h.width.val),m.x=(-T+p.x1+p.x2+R)/2,o.autoHeight=Math.max(p.h,h.height.val),m.y=(-D+p.y1+p.y2+O)/2}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;(!i.compoundBoundsClean||e)&&(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var Ma=function(t){return t===1/0||t===-1/0?0:t},Va=function(t,n,r,a,i){a-n===0||i-r===0||n==null||r==null||a==null||i==null||(t.x1=n<t.x1?n:t.x1,t.x2=a>t.x2?a:t.x2,t.y1=r<t.y1?r:t.y1,t.y2=i>t.y2?i:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},tl=function(t,n){return n==null?t:Va(t,n.x1,n.y1,n.x2,n.y2)},Bf=function(t,n,r){return Kr(t,n,r)},Ov=function(t,n,r){if(!n.cy().headless()){var a=n._private,i=a.rstyle,l=i.arrowWidth/2,o=n.pstyle(r+"-arrow-shape").value,f,c;if(o!=="none"){r==="source"?(f=i.srcX,c=i.srcY):r==="target"?(f=i.tgtX,c=i.tgtY):(f=i.midX,c=i.midY);var h=a.arrowBounds=a.arrowBounds||{},p=h[r]=h[r]||{};p.x1=f-l,p.y1=c-l,p.x2=f+l,p.y2=c+l,p.w=p.x2-p.x1,p.h=p.y2-p.y1,Zv(p,1),Va(t,p.x1,p.y1,p.x2,p.y2)}}},Q0=function(t,n,r){if(!n.cy().headless()){var a;r?a=r+"-":a="";var i=n._private,l=i.rstyle,o=n.pstyle(a+"label").strValue;if(o){var f=n.pstyle("text-halign"),c=n.pstyle("text-valign"),h=Bf(l,"labelWidth",r),p=Bf(l,"labelHeight",r),m=Bf(l,"labelX",r),y=Bf(l,"labelY",r),x=n.pstyle(a+"text-margin-x").pfValue,b=n.pstyle(a+"text-margin-y").pfValue,w=n.isEdge(),S=n.pstyle(a+"text-rotation"),N=n.pstyle("text-outline-width").pfValue,C=n.pstyle("text-border-width").pfValue,T=C/2,R=n.pstyle("text-background-padding").pfValue,A=2,D=p,O=h,L=O/2,M=D/2,B,P,q,H;if(w)B=m-L,P=m+L,q=y-M,H=y+M;else{switch(f.value){case"left":B=m-O,P=m;break;case"center":B=m-L,P=m+L;break;case"right":B=m,P=m+O;break}switch(c.value){case"top":q=y-D,H=y;break;case"center":q=y-M,H=y+M;break;case"bottom":q=y,H=y+D;break}}var G=x-Math.max(N,T)-R-A,F=x+Math.max(N,T)+R+A,V=b-Math.max(N,T)-R-A,Y=b+Math.max(N,T)+R+A;B+=G,P+=F,q+=V,H+=Y;var Q=r||"main",I=i.labelBounds,U=I[Q]=I[Q]||{};U.x1=B,U.y1=q,U.x2=P,U.y2=H,U.w=P-B,U.h=H-q,U.leftPad=G,U.rightPad=F,U.topPad=V,U.botPad=Y;var X=w&&S.strValue==="autorotate",z=S.pfValue!=null&&S.pfValue!==0;if(X||z){var Z=X?Bf(i.rstyle,"labelAngle",r):S.pfValue,re=Math.cos(Z),ae=Math.sin(Z),se=(B+P)/2,le=(q+H)/2;if(!w){switch(f.value){case"left":se=P;break;case"right":se=B;break}switch(c.value){case"top":le=H;break;case"bottom":le=q;break}}var ie=function(Je,We){return Je=Je-se,We=We-le,{x:Je*re-We*ae+se,y:Je*ae+We*re+le}},W=ie(B,q),te=ie(B,H),oe=ie(P,q),ye=ie(P,H);B=Math.min(W.x,te.x,oe.x,ye.x),P=Math.max(W.x,te.x,oe.x,ye.x),q=Math.min(W.y,te.y,oe.y,ye.y),H=Math.max(W.y,te.y,oe.y,ye.y)}var Te=Q+"Rot",Be=I[Te]=I[Te]||{};Be.x1=B,Be.y1=q,Be.x2=P,Be.y2=H,Be.w=P-B,Be.h=H-q,Va(t,B,q,P,H),Va(i.labelBounds.all,B,q,P,H)}return t}},Fj=function(t,n){if(!n.cy().headless()){var r=n.pstyle("outline-opacity").value,a=n.pstyle("outline-width").value,i=n.pstyle("outline-offset").value,l=a+i;uL(t,n,r,l,"outside",l/2)}},uL=function(t,n,r,a,i,l){if(!(r===0||a<=0||i==="inside")){var o=n.cy(),f=n.pstyle("shape").value,c=o.renderer().nodeShapes[f],h=n.position(),p=h.x,m=h.y,y=n.width(),x=n.height();if(c.hasMiterBounds){i==="center"&&(a/=2);var b=c.miterBounds(p,m,y,x,a);tl(t,b)}else l!=null&&l>0&&Jv(t,[l,l,l,l])}},UZ=function(t,n){if(!n.cy().headless()){var r=n.pstyle("border-opacity").value,a=n.pstyle("border-width").pfValue,i=n.pstyle("border-position").value;uL(t,n,r,a,i)}},qZ=function(t,n){var r=t._private.cy,a=r.styleEnabled(),i=r.headless(),l=_r(),o=t._private,f=t.isNode(),c=t.isEdge(),h,p,m,y,x,b,w=o.rstyle,S=f&&a?t.pstyle("bounds-expansion").pfValue:[0],N=function(ot){return ot.pstyle("display").value!=="none"},C=!a||N(t)&&(!c||N(t.source())&&N(t.target()));if(C){var T=0,R=0;a&&n.includeOverlays&&(T=t.pstyle("overlay-opacity").value,T!==0&&(R=t.pstyle("overlay-padding").value));var A=0,D=0;a&&n.includeUnderlays&&(A=t.pstyle("underlay-opacity").value,A!==0&&(D=t.pstyle("underlay-padding").value));var O=Math.max(R,D),L=0,M=0;if(a&&(L=t.pstyle("width").pfValue,M=L/2),f&&n.includeNodes){var B=t.position();x=B.x,b=B.y;var P=t.outerWidth(),q=P/2,H=t.outerHeight(),G=H/2;h=x-q,p=x+q,m=b-G,y=b+G,Va(l,h,m,p,y),a&&Fj(l,t),a&&n.includeOutlines&&!i&&Fj(l,t),a&&UZ(l,t)}else if(c&&n.includeEdges)if(a&&!i){var F=t.pstyle("curve-style").strValue;if(h=Math.min(w.srcX,w.midX,w.tgtX),p=Math.max(w.srcX,w.midX,w.tgtX),m=Math.min(w.srcY,w.midY,w.tgtY),y=Math.max(w.srcY,w.midY,w.tgtY),h-=M,p+=M,m-=M,y+=M,Va(l,h,m,p,y),F==="haystack"){var V=w.haystackPts;if(V&&V.length===2){if(h=V[0].x,m=V[0].y,p=V[1].x,y=V[1].y,h>p){var Y=h;h=p,p=Y}if(m>y){var Q=m;m=y,y=Q}Va(l,h-M,m-M,p+M,y+M)}}else if(F==="bezier"||F==="unbundled-bezier"||dl(F,"segments")||dl(F,"taxi")){var I;switch(F){case"bezier":case"unbundled-bezier":I=w.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":I=w.linePts;break}if(I!=null)for(var U=0;U<I.length;U++){var X=I[U];h=X.x-M,p=X.x+M,m=X.y-M,y=X.y+M,Va(l,h,m,p,y)}}}else{var z=t.source(),Z=z.position(),re=t.target(),ae=re.position();if(h=Z.x,p=ae.x,m=Z.y,y=ae.y,h>p){var se=h;h=p,p=se}if(m>y){var le=m;m=y,y=le}h-=M,p+=M,m-=M,y+=M,Va(l,h,m,p,y)}if(a&&n.includeEdges&&c&&(Ov(l,t,"mid-source"),Ov(l,t,"mid-target"),Ov(l,t,"source"),Ov(l,t,"target")),a){var ie=t.pstyle("ghost").value==="yes";if(ie){var W=t.pstyle("ghost-offset-x").pfValue,te=t.pstyle("ghost-offset-y").pfValue;Va(l,l.x1+W,l.y1+te,l.x2+W,l.y2+te)}}var oe=o.bodyBounds=o.bodyBounds||{};NT(oe,l),Jv(oe,S),Zv(oe,1),a&&(h=l.x1,p=l.x2,m=l.y1,y=l.y2,Va(l,h-O,m-O,p+O,y+O));var ye=o.overlayBounds=o.overlayBounds||{};NT(ye,l),Jv(ye,S),Zv(ye,1);var Te=o.labelBounds=o.labelBounds||{};Te.all!=null?EQ(Te.all):Te.all=_r(),a&&n.includeLabels&&(n.includeMainLabels&&Q0(l,t,null),c&&(n.includeSourceLabels&&Q0(l,t,"source"),n.includeTargetLabels&&Q0(l,t,"target")))}return l.x1=Ma(l.x1),l.y1=Ma(l.y1),l.x2=Ma(l.x2),l.y2=Ma(l.y2),l.w=Ma(l.x2-l.x1),l.h=Ma(l.y2-l.y1),l.w>0&&l.h>0&&C&&(Jv(l,S),Zv(l,1)),l},cL=function(t){var n=0,r=function(l){return(l?1:0)<<n++},a=0;return a+=r(t.incudeNodes),a+=r(t.includeEdges),a+=r(t.includeLabels),a+=r(t.includeMainLabels),a+=r(t.includeSourceLabels),a+=r(t.includeTargetLabels),a+=r(t.includeOverlays),a+=r(t.includeOutlines),a},fL=function(t){var n=function(o){return Math.round(o)};if(t.isEdge()){var r=t.source().position(),a=t.target().position();return xT([n(r.x),n(r.y),n(a.x),n(a.y)])}else{var i=t.position();return xT([n(i.x),n(i.y)])}},Uj=function(t,n){var r=t._private,a,i=t.isEdge(),l=n==null?qj:cL(n),o=l===qj;if(r.bbCache==null?(a=qZ(t,gd),r.bbCache=a,r.bbCachePosKey=fL(t)):a=r.bbCache,!o){var f=t.isNode();a=_r(),(n.includeNodes&&f||n.includeEdges&&!f)&&(n.includeOverlays?tl(a,r.overlayBounds):tl(a,r.bodyBounds)),n.includeLabels&&(n.includeMainLabels&&(!i||n.includeSourceLabels&&n.includeTargetLabels)?tl(a,r.labelBounds.all):(n.includeMainLabels&&tl(a,r.labelBounds.mainRot),n.includeSourceLabels&&tl(a,r.labelBounds.sourceRot),n.includeTargetLabels&&tl(a,r.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},gd={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},qj=cL(gd),Vj=hr(gd);Ol.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=cc(function(h){var p=h._private;return p.bbCache==null||p.styleDirty||p.bbCachePosKey!==fL(h)},function(h){return h.id()});if(n&&this.length===1&&!r(this[0]))e===void 0?e=gd:e=Vj(e),t=Uj(this[0],e);else{t=_r(),e=e||gd;var a=Vj(e),i=this,l=i.cy(),o=l.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var f=0;f<i.length;f++){var c=i[f];r(c)&&c.dirtyBoundingBoxCache(),tl(t,Uj(c,a))}}return t.x1=Ma(t.x1),t.y1=Ma(t.y1),t.x2=Ma(t.x2),t.y2=Ma(t.y2),t.w=Ma(t.x2-t.x1),t.h=Ma(t.y2-t.y1),t};Ol.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};Ol.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter(function(c){return c.isParent()}),t=t.not(a)),Mt(e)){var i=e;e=function(){return i}}var l=function(h,p){return h._private.bbAtOldPos=e(h,p)},o=function(h){return h._private.bbAtOldPos};n.startBatch(),t.forEach(l).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var f=SQ(this.boundingBox({useCache:!1}));return t.silentPositions(o),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),f};Yu.boundingbox=Yu.bb=Yu.boundingBox;Yu.renderedBoundingbox=Yu.renderedBoundingBox;var VZ=Ol,Xf,Xd;Xf=Xd={};var dL=function(t){t.uppercaseName=aT(t.name),t.autoName="auto"+t.uppercaseName,t.labelName="label"+t.uppercaseName,t.outerName="outer"+t.uppercaseName,t.uppercaseOuterName=aT(t.outerName),Xf[t.name]=function(){var r=this[0],a=r._private,i=a.cy,l=i._private.styleEnabled;if(r)if(l){if(r.isParent())return r.updateCompoundBounds(),a[t.autoName]||0;var o=r.pstyle(t.name);switch(o.strValue){case"label":return r.recalculateRenderedStyle(),a.rstyle[t.labelName]||0;default:return o.pfValue}}else return 1},Xf["outer"+t.uppercaseName]=function(){var r=this[0],a=r._private,i=a.cy,l=i._private.styleEnabled;if(r)if(l){var o=r[t.name](),f=r.pstyle("border-position").value,c;f==="center"?c=r.pstyle("border-width").pfValue:f==="outside"?c=2*r.pstyle("border-width").pfValue:c=0;var h=2*r.padding();return o+c+h}else return 1},Xf["rendered"+t.uppercaseName]=function(){var r=this[0];if(r){var a=r[t.name]();return a*this.cy().zoom()}},Xf["rendered"+t.uppercaseOuterName]=function(){var r=this[0];if(r){var a=r[t.outerName]();return a*this.cy().zoom()}}};dL({name:"width"});dL({name:"height"});Xd.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue};Xd.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()};Xd.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var HZ=Xd,GZ=function(t,n){if(t.isEdge()&&t.takesUpSpace())return n(t)},$Z=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy();return bm(n(t),r.zoom(),r.pan())}},KZ=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy(),a=r.pan(),i=r.zoom();return n(t).map(function(l){return bm(l,i,a)})}},YZ=function(t){return t.renderer().getControlPoints(t)},XZ=function(t){return t.renderer().getSegmentPoints(t)},QZ=function(t){return t.renderer().getSourceEndpoint(t)},WZ=function(t){return t.renderer().getTargetEndpoint(t)},ZZ=function(t){return t.renderer().getEdgeMidpoint(t)},Hj={controlPoints:{get:YZ,mult:!0},segmentPoints:{get:XZ,mult:!0},sourceEndpoint:{get:QZ},targetEndpoint:{get:WZ},midpoint:{get:ZZ}},JZ=function(t){return"rendered"+t[0].toUpperCase()+t.substr(1)},eJ=Object.keys(Hj).reduce(function(e,t){var n=Hj[t],r=JZ(t);return e[t]=function(){return GZ(this,n.get)},n.mult?e[r]=function(){return KZ(this,n.get)}:e[r]=function(){return $Z(this,n.get)},e},{}),tJ=at({},FZ,VZ,HZ,eJ);/*!
|
|
500
|
-
Event object based on jQuery events, MIT license
|
|
501
|
-
|
|
502
|
-
https://jquery.org/license/
|
|
503
|
-
https://tldrlegal.com/license/mit-license
|
|
504
|
-
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
505
|
-
*/var hL=function(t,n){this.recycle(t,n)};function zf(){return!1}function Lv(){return!0}hL.prototype={instanceString:function(){return"event"},recycle:function(t,n){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=zf,t!=null&&t.preventDefault?(this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?Lv:zf):t!=null&&t.type?n=t:this.type=t,n!=null&&(this.originalEvent=n.originalEvent,this.type=n.type!=null?n.type:this.type,this.cy=n.cy,this.target=n.target,this.position=n.position,this.renderedPosition=n.renderedPosition,this.namespace=n.namespace,this.layout=n.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*a+i.x,y:r.y*a+i.y}}this.timeStamp=t&&t.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Lv;var t=this.originalEvent;t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Lv;var t=this.originalEvent;t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Lv,this.stopPropagation()},isDefaultPrevented:zf,isPropagationStopped:zf,isImmediatePropagationStopped:zf};var vL=/^([^.]+)(\.(?:[^.]+))?$/,nJ=".*",pL={qualifierCompare:function(t,n){return t===n},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(t){return t},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Gj=Object.keys(pL),rJ={};function Tm(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rJ,t=arguments.length>1?arguments[1]:void 0,n=0;n<Gj.length;n++){var r=Gj[n];this[r]=e[r]||pL[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Tl=Tm.prototype,mL=function(t,n,r,a,i,l,o){gn(a)&&(i=a,a=null),o&&(l==null?l=o:l=at({},l,o));for(var f=Qt(r)?r:r.split(/\s+/),c=0;c<f.length;c++){var h=f[c];if(!Sl(h)){var p=h.match(vL);if(p){var m=p[1],y=p[2]?p[2]:null,x=n(t,h,m,y,a,i,l);if(x===!1)break}}}},$j=function(t,n){return t.addEventFields(t.context,n),new hL(n.type,n)},aJ=function(t,n,r){if(cX(r)){n(t,r);return}else if(Mt(r)){n(t,$j(t,r));return}for(var a=Qt(r)?r:r.split(/\s+/),i=0;i<a.length;i++){var l=a[i];if(!Sl(l)){var o=l.match(vL);if(o){var f=o[1],c=o[2]?o[2]:null,h=$j(t,{type:f,namespace:c,target:t.context});n(t,h)}}}};Tl.on=Tl.addListener=function(e,t,n,r,a){return mL(this,function(i,l,o,f,c,h,p){gn(h)&&i.listeners.push({event:l,callback:h,type:o,namespace:f,qualifier:c,conf:p})},e,t,n,r,a),this};Tl.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})};Tl.removeListener=Tl.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=$X(this.listeners));for(var i=this.listeners,l=function(c){var h=i[c];mL(a,function(p,m,y,x,b,w){if((h.type===y||e==="*")&&(!x&&h.namespace!==".*"||h.namespace===x)&&(!b||p.qualifierCompare(h.qualifier,b))&&(!w||h.callback===w))return i.splice(c,1),!1},e,t,n,r)},o=i.length-1;o>=0;o--)l(o);return this};Tl.removeAllListeners=function(){return this.removeListener("*")};Tl.emit=Tl.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Qt(t)||(t=[t]),aJ(this,function(i,l){n!=null&&(r=[{event:l.event,type:l.type,namespace:l.namespace,callback:n}],a=r.length);for(var o=function(){var h=r[f];if(h.type===l.type&&(!h.namespace||h.namespace===l.namespace||h.namespace===nJ)&&i.eventMatches(i.context,h,l)){var p=[l];t!=null&&YX(p,t),i.beforeEmit(i.context,h,l),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(x){return x!==h}));var m=i.callbackContext(i.context,h,l),y=h.callback.apply(m,p);i.afterEmit(i.context,h,l),y===!1&&(l.stopPropagation(),l.preventDefault())}},f=0;f<a;f++)o();i.bubble(i.context)&&!l.isPropagationStopped()&&i.parent(i.context).emit(l,t)},e),this.emitting--,this};var iJ={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var a=n.qualifier;return a!=null?t!==r.target&&Vd(r.target)&&a.matches(r.target):!0},addEventFields:function(t,n){n.cy=t.cy(),n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t},beforeEmit:function(t,n){n.conf&&n.conf.once&&n.conf.onceCollection.removeListener(n.event,n.qualifier,n.callback)},bubble:function(){return!0},parent:function(t){return t.isChild()?t.parent():t.cy()}},Pv=function(t){return tt(t)?new Nl(t):t},gL={createEmitter:function(){for(var t=0;t<this.length;t++){var n=this[t],r=n._private;r.emitter||(r.emitter=new Tm(iJ,n))}return this},emitter:function(){return this._private.emitter},on:function(t,n,r){for(var a=Pv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().on(t,a,r)}return this},removeListener:function(t,n,r){for(var a=Pv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().removeListener(t,a,r)}return this},removeAllListeners:function(){for(var t=0;t<this.length;t++){var n=this[t];n.emitter().removeAllListeners()}return this},one:function(t,n,r){for(var a=Pv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().one(t,a,r)}return this},once:function(t,n,r){for(var a=Pv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().on(t,a,r,{once:!0,onceCollection:this})}},emit:function(t,n){for(var r=0;r<this.length;r++){var a=this[r];a.emitter().emit(t,n)}return this},emitAndNotify:function(t,n){if(this.length!==0)return this.cy().notify(t,this),this.emit(t,n),this}};Bt.eventAliasesOn(gL);var yL={nodes:function(t){return this.filter(function(n){return n.isNode()}).filter(t)},edges:function(t){return this.filter(function(n){return n.isEdge()}).filter(t)},byGroup:function(){for(var t=this.spawn(),n=this.spawn(),r=0;r<this.length;r++){var a=this[r];a.isNode()?t.push(a):n.push(a)}return{nodes:t,edges:n}},filter:function(t,n){if(t===void 0)return this;if(tt(t)||da(t))return new Nl(t).filter(this);if(gn(t)){for(var r=this.spawn(),a=this,i=0;i<a.length;i++){var l=a[i],o=n?t.apply(n,[l,i,a]):t(l,i,a);o&&r.push(l)}return r}return this.spawn()},not:function(t){if(t){tt(t)&&(t=this.filter(t));for(var n=this.spawn(),r=0;r<this.length;r++){var a=this[r],i=t.has(a);i||n.push(a)}return n}else return this},absoluteComplement:function(){var t=this.cy();return t.mutableElements().not(this)},intersect:function(t){if(tt(t)){var n=t;return this.filter(n)}for(var r=this.spawn(),a=this,i=t,l=this.length<t.length,o=l?a:i,f=l?i:a,c=0;c<o.length;c++){var h=o[c];f.has(h)&&r.push(h)}return r},xor:function(t){var n=this._private.cy;tt(t)&&(t=n.$(t));var r=this.spawn(),a=this,i=t,l=function(f,c){for(var h=0;h<f.length;h++){var p=f[h],m=p._private.data.id,y=c.hasElementWithId(m);y||r.push(p)}};return l(a,i),l(i,a),r},diff:function(t){var n=this._private.cy;tt(t)&&(t=n.$(t));var r=this.spawn(),a=this.spawn(),i=this.spawn(),l=this,o=t,f=function(h,p,m){for(var y=0;y<h.length;y++){var x=h[y],b=x._private.data.id,w=p.hasElementWithId(b);w?i.merge(x):m.push(x)}};return f(l,o,r),f(o,l,a),{left:r,right:a,both:i}},add:function(t){var n=this._private.cy;if(!t)return this;if(tt(t)){var r=t;t=n.mutableElements().filter(r)}for(var a=this.spawnSelf(),i=0;i<t.length;i++){var l=t[i],o=!this.has(l);o&&a.push(l)}return a},merge:function(t){var n=this._private,r=n.cy;if(!t)return this;if(t&&tt(t)){var a=t;t=r.mutableElements().filter(a)}for(var i=n.map,l=0;l<t.length;l++){var o=t[l],f=o._private.data.id,c=!i.has(f);if(c){var h=this.length++;this[h]=o,i.set(f,{ele:o,index:h})}}return this},unmergeAt:function(t){var n=this[t],r=n.id(),a=this._private,i=a.map;this[t]=void 0,i.delete(r);var l=t===this.length-1;if(this.length>1&&!l){var o=this.length-1,f=this[o],c=f._private.data.id;this[o]=void 0,this[t]=f,i.set(c,{ele:f,index:t})}return this.length--,this},unmergeOne:function(t){t=t[0];var n=this._private,r=t._private.data.id,a=n.map,i=a.get(r);if(!i)return this;var l=i.index;return this.unmergeAt(l),this},unmerge:function(t){var n=this._private.cy;if(!t)return this;if(t&&tt(t)){var r=t;t=n.mutableElements().filter(r)}for(var a=0;a<t.length;a++)this.unmergeOne(t[a]);return this},unmergeBy:function(t){for(var n=this.length-1;n>=0;n--){var r=this[n];t(r)&&this.unmergeAt(n)}return this},map:function(t,n){for(var r=[],a=this,i=0;i<a.length;i++){var l=a[i],o=n?t.apply(n,[l,i,a]):t(l,i,a);r.push(o)}return r},reduce:function(t,n){for(var r=n,a=this,i=0;i<a.length;i++)r=t(r,a[i],i,a);return r},max:function(t,n){for(var r=-1/0,a,i=this,l=0;l<i.length;l++){var o=i[l],f=n?t.apply(n,[o,l,i]):t(o,l,i);f>r&&(r=f,a=o)}return{value:r,ele:a}},min:function(t,n){for(var r=1/0,a,i=this,l=0;l<i.length;l++){var o=i[l],f=n?t.apply(n,[o,l,i]):t(o,l,i);f<r&&(r=f,a=o)}return{value:r,ele:a}}},Lt=yL;Lt.u=Lt["|"]=Lt["+"]=Lt.union=Lt.or=Lt.add;Lt["\\"]=Lt["!"]=Lt["-"]=Lt.difference=Lt.relativeComplement=Lt.subtract=Lt.not;Lt.n=Lt["&"]=Lt["."]=Lt.and=Lt.intersection=Lt.intersect;Lt["^"]=Lt["(+)"]=Lt["(-)"]=Lt.symmetricDifference=Lt.symdiff=Lt.xor;Lt.fnFilter=Lt.filterFn=Lt.stdFilter=Lt.filter;Lt.complement=Lt.abscomp=Lt.absoluteComplement;var sJ={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var t=this[0];if(t)return t._private.group}},xL=function(t,n){var r=t.cy(),a=r.hasCompoundNodes();function i(h){var p=h.pstyle("z-compound-depth");return p.value==="auto"?a?h.zDepth():0:p.value==="bottom"?-1:p.value==="top"?Bw:0}var l=i(t)-i(n);if(l!==0)return l;function o(h){var p=h.pstyle("z-index-compare");return p.value==="auto"&&h.isNode()?1:0}var f=o(t)-o(n);if(f!==0)return f;var c=t.pstyle("z-index").value-n.pstyle("z-index").value;return c!==0?c:t.poolIndex()-n.poolIndex()},_p={forEach:function(t,n){if(gn(t))for(var r=this.length,a=0;a<r;a++){var i=this[a],l=n?t.apply(n,[i,a,this]):t(i,a,this);if(l===!1)break}return this},toArray:function(){for(var t=[],n=0;n<this.length;n++)t.push(this[n]);return t},slice:function(t,n){var r=[],a=this.length;n==null&&(n=a),t==null&&(t=0),t<0&&(t=a+t),n<0&&(n=a+n);for(var i=t;i>=0&&i<n&&i<a;i++)r.push(this[i]);return this.spawn(r)},size:function(){return this.length},eq:function(t){return this[t]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(t){if(!gn(t))return this;var n=this.toArray().sort(t);return this.spawn(n)},sortByZIndex:function(){return this.sort(xL)},zDepth:function(){var t=this[0];if(t){var n=t._private,r=n.group;if(r==="nodes"){var a=n.data.parent?t.parents().size():0;return t.isParent()?a:Bw-1}else{var i=n.source,l=n.target,o=i.zDepth(),f=l.zDepth();return Math.max(o,f,0)}}}};_p.each=_p.forEach;var lJ=function(){var t="undefined",n=(typeof Symbol>"u"?"undefined":$n(Symbol))!=t&&$n(Symbol.iterator)!=t;n&&(_p[Symbol.iterator]=function(){var r=this,a={value:void 0,done:!1},i=0,l=this.length;return gO({next:function(){return i<l?a.value=r[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};lJ();var oJ=hr({nodeDimensionsIncludeLabels:!1}),tp={layoutDimensions:function(t){t=oJ(t);var n;if(!this.takesUpSpace())n={w:0,h:0};else if(t.nodeDimensionsIncludeLabels){var r=this.boundingBox();n={w:r.w,h:r.h}}else n={w:this.outerWidth(),h:this.outerHeight()};return(n.w===0||n.h===0)&&(n.w=n.h=1),n},layoutPositions:function(t,n,r){var a=this.nodes().filter(function(R){return!R.isParent()}),i=this.cy(),l=n.eles,o=function(A){return A.id()},f=cc(r,o);t.emit({type:"layoutstart",layout:t}),t.animations=[];var c=function(A,D,O){var L={x:D.x1+D.w/2,y:D.y1+D.h/2},M={x:(O.x-L.x)*A,y:(O.y-L.y)*A};return{x:L.x+M.x,y:L.y+M.y}},h=n.spacingFactor&&n.spacingFactor!==1,p=function(){if(!h)return null;for(var A=_r(),D=0;D<a.length;D++){var O=a[D],L=f(O,D);BO(A,L.x,L.y)}return A},m=p(),y=cc(function(R,A){var D=f(R,A);if(h){var O=Math.abs(n.spacingFactor);D=c(O,m,D)}return n.transform!=null&&(D=n.transform(R,D)),D},o);if(n.animate){for(var x=0;x<a.length;x++){var b=a[x],w=y(b,x),S=n.animateFilter==null||n.animateFilter(b,x);if(S){var N=b.animation({position:w,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(N)}else b.position(w)}if(n.fit){var C=i.animation({fit:{boundingBox:l.boundingBoxAt(y),padding:n.padding},duration:n.animationDuration,easing:n.animationEasing});t.animations.push(C)}else if(n.zoom!==void 0&&n.pan!==void 0){var T=i.animation({zoom:n.zoom,pan:n.pan,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(T)}t.animations.forEach(function(R){return R.play()}),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),Dc.all(t.animations.map(function(R){return R.promise()})).then(function(){t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t})})}else a.positions(y),n.fit&&i.fit(n.eles,n.padding),n.zoom!=null&&i.zoom(n.zoom),n.pan&&i.pan(n.pan),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t});return this},layout:function(t){var n=this.cy();return n.makeLayout(at({},t,{eles:this}))}};tp.createLayout=tp.makeLayout=tp.layout;function bL(e,t,n){var r=n._private,a=r.styleCache=r.styleCache||[],i;return(i=a[e])!=null||(i=a[e]=t(n)),i}function jm(e,t){return e=Ro(e),function(r){return bL(e,t,r)}}function Am(e,t){e=Ro(e);var n=function(a){return t.call(a)};return function(){var a=this[0];if(a)return bL(e,n,a)}}var fr={recalculateRenderedStyle:function(t){var n=this.cy(),r=n.renderer(),a=n.styleEnabled();return r&&a&&r.recalculateRenderedStyle(this,t),this},dirtyStyleCache:function(){var t=this.cy(),n=function(i){return i._private.styleCache=null};if(t.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(n)}else this.forEach(function(a){n(a),a.connectedEdges().forEach(n)});return this},updateStyle:function(t){var n=this._private.cy;if(!n.styleEnabled())return this;if(n.batching()){var r=n._private.batchStyleEles;return r.merge(this),this}var a=n.hasCompoundNodes(),i=this;t=!!(t||t===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var l=i;return t?l.emitAndNotify("style"):l.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var t=this.cy();if(t.styleEnabled())for(var n=0;n<this.length;n++){var r=this[n];r._private.styleDirty&&(r._private.styleDirty=!1,t.style().apply(r))}},parsedStyle:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],a=r.cy();if(a.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,a.style().apply(r));var i=r._private.style[t];return i??(n?a.style().getDefaultProperty(t):null)}},numericStyle:function(t){var n=this[0];if(n.cy().styleEnabled()&&n){var r=n.pstyle(t);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(t){var n=this[0];if(n.cy().styleEnabled()&&n)return n.pstyle(t).units},renderedStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=this[0];if(r)return n.style().getRenderedStyle(r,t)},style:function(t,n){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style();if(Mt(t)){var l=t;i.applyBypass(this,l,a),this.emitAndNotify("style")}else if(tt(t))if(n===void 0){var o=this[0];return o?i.getStylePropertyValue(o,t):void 0}else i.applyBypass(this,t,n,a),this.emitAndNotify("style");else if(t===void 0){var f=this[0];return f?i.getRawStyle(f):void 0}return this},removeStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style(),i=this;if(t===void 0)for(var l=0;l<i.length;l++){var o=i[l];a.removeAllBypasses(o,r)}else{t=t.split(/\s+/);for(var f=0;f<i.length;f++){var c=i[f];a.removeBypasses(c,t,r)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var t=this.cy();if(!t.styleEnabled())return 1;var n=t.hasCompoundNodes(),r=this[0];if(r){var a=r._private,i=r.pstyle("opacity").value;if(!n)return i;var l=a.data.parent?r.parents():null;if(l)for(var o=0;o<l.length;o++){var f=l[o],c=f.pstyle("opacity").value;i=c*i}return i}},transparent:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0],r=n.cy().hasCompoundNodes();if(n)return r?n.effectiveOpacity()===0:n.pstyle("opacity").value===0},backgrounding:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0];return!!n._private.backgrounding}};function W0(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var a=0;a<r.length;a++){var i=r[a];if(!t(i))return!1}return!0}function Xw(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],l=a.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!l||W0(i,r);var f=o.source,c=o.target;return n(f)&&(!l||W0(f,n))&&(f===c||n(c)&&(!l||W0(c,n)))}}}var Mc=jm("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});fr.takesUpSpace=Am("takesUpSpace",Xw({ok:Mc}));var uJ=jm("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&Mc(e)}),cJ=jm("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&Mc(e)});fr.interactive=Am("interactive",Xw({ok:uJ,parentOk:cJ,edgeOkViaNode:Mc}));fr.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var fJ=jm("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&Mc(e)}),dJ=Mc;fr.visible=Am("visible",Xw({ok:fJ,edgeOkViaNode:dJ}));fr.hidden=function(){var e=this[0];if(e)return!e.visible()};fr.isBundledBezier=Am("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});fr.bypass=fr.css=fr.style;fr.renderedCss=fr.renderedStyle;fr.removeBypass=fr.removeCss=fr.removeStyle;fr.pstyle=fr.parsedStyle;var xl={};function Kj(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&gn(t[0])){var i=t[0];this.on(e.event,i)}else if(t.length===0||t.length===1&&Qt(t[0])){for(var l=t.length===1?t[0]:null,o=0;o<this.length;o++){var f=this[o],c=!e.ableField||f._private[e.ableField],h=f._private[e.field]!=e.value;if(e.overrideAble){var p=e.overrideAble(f);if(p!==void 0&&(c=p,!p))return this}c&&(f._private[e.field]=e.value,h&&n.push(f))}var m=this.spawn(n);m.updateStyle(),m.emit(e.event),l&&m.emit(l)}return this}}function _c(e){xl[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},xl[e.on]=Kj({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),xl[e.off]=Kj({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}_c({field:"locked",overrideField:function(t){return t.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});_c({field:"grabbable",overrideField:function(t){return t.cy().autoungrabify()||t.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});_c({field:"selected",ableField:"selectable",overrideAble:function(t){return t.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});_c({field:"selectable",overrideField:function(t){return t.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});xl.deselect=xl.unselect;xl.grabbed=function(){var e=this[0];if(e)return e._private.grabbed};_c({field:"active",on:"activate",off:"unactivate"});_c({field:"pannable",on:"panify",off:"unpanify"});xl.inactive=function(){var e=this[0];if(e)return!e._private.active};var wr={},Yj=function(t){return function(r){for(var a=this,i=[],l=0;l<a.length;l++){var o=a[l];if(o.isNode()){for(var f=!1,c=o.connectedEdges(),h=0;h<c.length;h++){var p=c[h],m=p.source(),y=p.target();if(t.noIncomingEdges&&y===o&&m!==o||t.noOutgoingEdges&&m===o&&y!==o){f=!0;break}}f||i.push(o)}}return this.spawn(i,!0).filter(r)}},Xj=function(t){return function(n){for(var r=this,a=[],i=0;i<r.length;i++){var l=r[i];if(l.isNode())for(var o=l.connectedEdges(),f=0;f<o.length;f++){var c=o[f],h=c.source(),p=c.target();t.outgoing&&h===l?(a.push(c),a.push(p)):t.incoming&&p===l&&(a.push(c),a.push(h))}}return this.spawn(a,!0).filter(n)}},Qj=function(t){return function(n){for(var r=this,a=[],i={};;){var l=t.outgoing?r.outgoers():r.incomers();if(l.length===0)break;for(var o=!1,f=0;f<l.length;f++){var c=l[f],h=c.id();i[h]||(i[h]=!0,a.push(c),o=!0)}if(!o)break;r=l}return this.spawn(a,!0).filter(n)}};wr.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null};at(wr,{roots:Yj({noIncomingEdges:!0}),leaves:Yj({noOutgoingEdges:!0}),outgoers:Oa(Xj({outgoing:!0}),"outgoers"),successors:Qj({outgoing:!0}),incomers:Oa(Xj({incoming:!0}),"incomers"),predecessors:Qj({})});at(wr,{neighborhood:Oa(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),l=0;l<i.length;l++){var o=i[l],f=o.source(),c=o.target(),h=a===f?c:f;h.length>0&&t.push(h[0]),t.push(o[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function(t){return this.neighborhood(t)}});wr.neighbourhood=wr.neighborhood;wr.closedNeighbourhood=wr.closedNeighborhood;wr.openNeighbourhood=wr.openNeighborhood;at(wr,{source:Oa(function(t){var n=this[0],r;return n&&(r=n._private.source||n.cy().collection()),r&&t?r.filter(t):r},"source"),target:Oa(function(t){var n=this[0],r;return n&&(r=n._private.target||n.cy().collection()),r&&t?r.filter(t):r},"target"),sources:Wj({attr:"source"}),targets:Wj({attr:"target"})});function Wj(e){return function(n){for(var r=[],a=0;a<this.length;a++){var i=this[a],l=i._private[e.attr];l&&r.push(l)}return this.spawn(r,!0).filter(n)}}at(wr,{edgesWith:Oa(Zj(),"edgesWith"),edgesTo:Oa(Zj({thisIsSrc:!0}),"edgesTo")});function Zj(e){return function(n){var r=[],a=this._private.cy,i=e||{};tt(n)&&(n=a.$(n));for(var l=0;l<n.length;l++)for(var o=n[l]._private.edges,f=0;f<o.length;f++){var c=o[f],h=c._private.data,p=this.hasElementWithId(h.source)&&n.hasElementWithId(h.target),m=n.hasElementWithId(h.source)&&this.hasElementWithId(h.target),y=p||m;y&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!p||i.thisIsTgt&&!m)||r.push(c))}return this.spawn(r,!0)}}at(wr,{connectedEdges:Oa(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,l=0;l<i.length;l++){var o=i[l];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:Oa(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:Oa(Jj(),"parallelEdges"),codirectedEdges:Oa(Jj({codirected:!0}),"codirectedEdges")});function Jj(e){var t={codirected:!1};return e=at({},t,e),function(r){for(var a=[],i=this.edges(),l=e,o=0;o<i.length;o++)for(var f=i[o],c=f._private,h=c.source,p=h._private.data.id,m=c.data.target,y=h._private.edges,x=0;x<y.length;x++){var b=y[x],w=b._private.data,S=w.target,N=w.source,C=S===m&&N===p,T=p===S&&m===N;(l.codirected&&C||!l.codirected&&(C||T))&&a.push(b)}return this.spawn(a,!0).filter(r)}}at(wr,{components:function(t){var n=this,r=n.cy(),a=r.collection(),i=t==null?n.nodes():t.nodes(),l=[];t!=null&&i.empty()&&(i=t.sources());var o=function(h,p){a.merge(h),i.unmerge(h),p.merge(h)};if(i.empty())return n.spawn();var f=function(){var h=r.collection();l.push(h);var p=i[0];o(p,h),n.bfs({directed:!1,roots:p,visit:function(y){return o(y,h)}}),h.forEach(function(m){m.connectedEdges().forEach(function(y){n.has(y)&&h.has(y.source())&&h.has(y.target())&&h.merge(y)})})};do f();while(i.length>0);return l},component:function(){var t=this[0];return t.cy().mutableElements().components(t)[0]}});wr.componentsOf=wr.components;var dr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){dn("A collection must have a reference to the core");return}var i=new rs,l=!1;if(!n)n=[];else if(n.length>0&&Mt(n[0])&&!Vd(n[0])){l=!0;for(var o=[],f=new Rc,c=0,h=n.length;c<h;c++){var p=n[c];p.data==null&&(p.data={});var m=p.data;if(m.id==null)m.id=OO();else if(t.hasElementWithId(m.id)||f.has(m.id))continue;var y=new xm(t,p,!1);o.push(y),f.add(m.id)}n=o}this.length=0;for(var x=0,b=n.length;x<b;x++){var w=n[x][0];if(w!=null){var S=w._private.data.id;(!r||!i.has(S))&&(r&&i.set(S,{index:this.length,ele:w}),this[this.length]=w,this.length++)}}this._private={eles:this,cy:t,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(N){this.lazyMap=N},rebuildMap:function(){for(var C=this.lazyMap=new rs,T=this.eles,R=0;R<T.length;R++){var A=T[R];C.set(A.id(),{index:R,ele:A})}}},r&&(this._private.map=i),l&&!a&&this.restore()},rn=xm.prototype=dr.prototype=Object.create(Array.prototype);rn.instanceString=function(){return"collection"};rn.spawn=function(e,t){return new dr(this.cy(),e,t)};rn.spawnSelf=function(){return this.spawn(this)};rn.cy=function(){return this._private.cy};rn.renderer=function(){return this._private.cy.renderer()};rn.element=function(){return this[0]};rn.collection=function(){return bO(this)?this:new dr(this._private.cy,[this])};rn.unique=function(){return new dr(this._private.cy,this,!0)};rn.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)};rn.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new dr(t)};rn.$id=rn.getElementById;rn.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index};rn.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index};rn.indexOfId=function(e){return e=""+e,this._private.map.get(e).index};rn.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(Mt(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,l={},o=e.data.source,f=e.data.target;o!=null&&o!=a.source&&(l.source=""+o,i=!0),f!=null&&f!=a.target&&(l.target=""+f,i=!0),i&&(t=t.move(l))}else{var c="parent"in e.data,h=e.data.parent;c&&(h!=null||a.parent!=null)&&h!=a.parent&&(h===void 0&&(h=null),h!=null&&(h=""+h),t=t.move({parent:h}))}}e.position&&t.position(e.position);var p=function(b,w,S){var N=e[b];N!=null&&N!==r[b]&&(N?t[w]():t[S]())};return p("removed","remove","restore"),p("selected","select","unselect"),p("selectable","selectify","unselectify"),p("locked","lock","unlock"),p("grabbable","grabify","ungrabify"),p("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var m={data:vi(r.data),position:vi(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};m.classes="";var y=0;return r.classes.forEach(function(x){return m.classes+=y++===0?x:" "+x}),m}}};rn.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e};rn.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),i=new xm(e,a,!1);t.push(i)}return new dr(e,t)};rn.copy=rn.clone;rn.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,i=[],l=[],o,f=0,c=n.length;f<c;f++){var h=n[f];t&&!h.removed()||(h.isNode()?i.push(h):l.push(h))}o=i.concat(l);var p,m=function(){o.splice(p,1),p--};for(p=0;p<o.length;p++){var y=o[p],x=y._private,b=x.data;if(y.clearTraversalCache(),!(!t&&!x.removed)){if(b.id===void 0)b.id=OO();else if(Re(b.id))b.id=""+b.id;else if(Sl(b.id)||!tt(b.id)){dn("Can not create element with invalid string ID `"+b.id+"`"),m();continue}else if(r.hasElementWithId(b.id)){dn("Can not create second element with ID `"+b.id+"`"),m();continue}}var w=b.id;if(y.isNode()){var S=x.position;S.x==null&&(S.x=0),S.y==null&&(S.y=0)}if(y.isEdge()){for(var N=y,C=["source","target"],T=C.length,R=!1,A=0;A<T;A++){var D=C[A],O=b[D];Re(O)&&(O=b[D]=""+b[D]),O==null||O===""?(dn("Can not create edge `"+w+"` with unspecified "+D),R=!0):r.hasElementWithId(O)||(dn("Can not create edge `"+w+"` with nonexistant "+D+" `"+O+"`"),R=!0)}if(R){m();continue}var L=r.getElementById(b.source),M=r.getElementById(b.target);L.same(M)?L._private.edges.push(N):(L._private.edges.push(N),M._private.edges.push(N)),N._private.source=L,N._private.target=M}x.map=new rs,x.map.set(w,{ele:y,index:0}),x.removed=!1,t&&r.addToPool(y)}for(var B=0;B<i.length;B++){var P=i[B],q=P._private.data;Re(q.parent)&&(q.parent=""+q.parent);var H=q.parent,G=H!=null;if(G||P._private.parent){var F=P._private.parent?r.collection().merge(P._private.parent):r.getElementById(H);if(F.empty())q.parent=void 0;else if(F[0].removed())zt("Node added with missing parent, reference to parent removed"),q.parent=void 0,P._private.parent=null;else{for(var V=!1,Y=F;!Y.empty();){if(P.same(Y)){V=!0,q.parent=void 0;break}Y=Y.parent()}V||(F[0]._private.children.push(P),P._private.parent=F[0],a.hasCompoundNodes=!0)}}}if(o.length>0){for(var Q=o.length===n.length?n:new dr(r,o),I=0;I<Q.length;I++){var U=Q[I];U.isNode()||(U.parallelEdges().clearTraversalCache(),U.source().clearTraversalCache(),U.target().clearTraversalCache())}var X;a.hasCompoundNodes?X=r.collection().merge(Q).merge(Q.connectedNodes()).merge(Q.parent()):X=Q,X.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?Q.emitAndNotify("add"):t&&Q.emit("add")}return n};rn.removed=function(){var e=this[0];return e&&e._private.removed};rn.inside=function(){var e=this[0];return e&&!e._private.removed};rn.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},i=n._private.cy;function l(H){for(var G=H._private.edges,F=0;F<G.length;F++)f(G[F])}function o(H){for(var G=H._private.children,F=0;F<G.length;F++)f(G[F])}function f(H){var G=a[H.id()];t&&H.removed()||G||(a[H.id()]=!0,H.isNode()?(r.push(H),l(H),o(H)):r.unshift(H))}for(var c=0,h=n.length;c<h;c++){var p=n[c];f(p)}function m(H,G){var F=H._private.edges;El(F,G),H.clearTraversalCache()}function y(H){H.clearTraversalCache()}var x=[];x.ids={};function b(H,G){G=G[0],H=H[0];var F=H._private.children,V=H.id();El(F,G),G._private.parent=null,x.ids[V]||(x.ids[V]=!0,x.push(H))}n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var w=0;w<r.length;w++){var S=r[w];if(S.isEdge()){var N=S.source()[0],C=S.target()[0];m(N,S),m(C,S);for(var T=S.parallelEdges(),R=0;R<T.length;R++){var A=T[R];y(A),A.isBundledBezier()&&A.dirtyBoundingBoxCache()}}else{var D=S.parent();D.length!==0&&b(D,S)}t&&(S._private.removed=!0)}var O=i._private.elements;i._private.hasCompoundNodes=!1;for(var L=0;L<O.length;L++){var M=O[L];if(M.isParent()){i._private.hasCompoundNodes=!0;break}}var B=new dr(this.cy(),r);B.size()>0&&(e?B.emitAndNotify("remove"):t&&B.emit("remove"));for(var P=0;P<x.length;P++){var q=x[P];(!t||!q.removed())&&q.updateStyle()}return B};rn.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(x){return x==null?x:""+x};if(e.source!==void 0||e.target!==void 0){var l=i(e.source),o=i(e.target),f=l!=null&&t.hasElementWithId(l),c=o!=null&&t.hasElementWithId(o);(f||c)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var y=0;y<n.length;y++){var x=n[y],b=x._private.data;x.isEdge()&&(f&&(b.source=l),c&&(b.target=o))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var h=i(e.parent),p=h===null||t.hasElementWithId(h);if(p){var m=h===null?void 0:h;t.batch(function(){var y=n.remove(r,a);y.emitAndNotify("moveout");for(var x=0;x<n.length;x++){var b=n[x],w=b._private.data;b.isNode()&&(w.parent=m)}y.restore(r,a)}),n.emitAndNotify("move")}}return this};[$O,EZ,ep,yl,dc,IZ,km,tJ,gL,yL,sJ,_p,tp,fr,xl,wr].forEach(function(e){at(rn,e)});var hJ={add:function(t){var n,r=this;if(da(t)){var a=t;if(a._private.cy===r)n=a.restore();else{for(var i=[],l=0;l<a.length;l++){var o=a[l];i.push(o.json())}n=new dr(r,i)}}else if(Qt(t)){var f=t;n=new dr(r,f)}else if(Mt(t)&&(Qt(t.nodes)||Qt(t.edges))){for(var c=t,h=[],p=["nodes","edges"],m=0,y=p.length;m<y;m++){var x=p[m],b=c[x];if(Qt(b))for(var w=0,S=b.length;w<S;w++){var N=at({group:x},b[w]);h.push(N)}}n=new dr(r,h)}else{var C=t;n=new xm(r,C).collection()}return n},remove:function(t){if(!da(t)){if(tt(t)){var n=t;t=this.$(n)}}return t.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function vJ(e,t,n,r){var a=4,i=.001,l=1e-7,o=10,f=11,c=1/(f-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var p=0;p<4;++p)if(typeof arguments[p]!="number"||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var m=h?new Float32Array(f):new Array(f);function y(M,B){return 1-3*B+3*M}function x(M,B){return 3*B-6*M}function b(M){return 3*M}function w(M,B,P){return((y(B,P)*M+x(B,P))*M+b(B))*M}function S(M,B,P){return 3*y(B,P)*M*M+2*x(B,P)*M+b(B)}function N(M,B){for(var P=0;P<a;++P){var q=S(B,e,n);if(q===0)return B;var H=w(B,e,n)-M;B-=H/q}return B}function C(){for(var M=0;M<f;++M)m[M]=w(M*c,e,n)}function T(M,B,P){var q,H,G=0;do H=B+(P-B)/2,q=w(H,e,n)-M,q>0?P=H:B=H;while(Math.abs(q)>l&&++G<o);return H}function R(M){for(var B=0,P=1,q=f-1;P!==q&&m[P]<=M;++P)B+=c;--P;var H=(M-m[P])/(m[P+1]-m[P]),G=B+H*c,F=S(G,e,n);return F>=i?N(M,G):F===0?G:T(M,B,B+c)}var A=!1;function D(){A=!0,(e!==t||n!==r)&&C()}var O=function(B){return A||D(),e===t&&n===r?B:B===0?0:B===1?1:w(R(B),t,r)};O.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var L="generateBezier("+[e,t,n,r]+")";return O.toString=function(){return L},O}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var pJ=(function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,i){var l={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:l.v,dv:e(l)}}function n(r,a){var i={dx:r.v,dv:e(r)},l=t(r,a*.5,i),o=t(r,a*.5,l),f=t(r,a,o),c=1/6*(i.dx+2*(l.dx+o.dx)+f.dx),h=1/6*(i.dv+2*(l.dv+o.dv)+f.dv);return r.x=r.x+c*a,r.v=r.v+h*a,r}return function r(a,i,l){var o={x:-1,v:0,tension:null,friction:null},f=[0],c=0,h=1/1e4,p=16/1e3,m,y,x;for(a=parseFloat(a)||500,i=parseFloat(i)||20,l=l||null,o.tension=a,o.friction=i,m=l!==null,m?(c=r(a,i),y=c/l*p):y=p;x=n(x||o,y),f.push(1+x.x),c+=16,Math.abs(x.x)>h&&Math.abs(x.v)>h;);return m?function(b){return f[b*(f.length-1)|0]}:c}})(),Jt=function(t,n,r,a){var i=vJ(t,n,r,a);return function(l,o,f){return l+(o-l)*i(f)}},np={linear:function(t,n,r){return t+(n-t)*r},ease:Jt(.25,.1,.25,1),"ease-in":Jt(.42,0,1,1),"ease-out":Jt(0,0,.58,1),"ease-in-out":Jt(.42,0,.58,1),"ease-in-sine":Jt(.47,0,.745,.715),"ease-out-sine":Jt(.39,.575,.565,1),"ease-in-out-sine":Jt(.445,.05,.55,.95),"ease-in-quad":Jt(.55,.085,.68,.53),"ease-out-quad":Jt(.25,.46,.45,.94),"ease-in-out-quad":Jt(.455,.03,.515,.955),"ease-in-cubic":Jt(.55,.055,.675,.19),"ease-out-cubic":Jt(.215,.61,.355,1),"ease-in-out-cubic":Jt(.645,.045,.355,1),"ease-in-quart":Jt(.895,.03,.685,.22),"ease-out-quart":Jt(.165,.84,.44,1),"ease-in-out-quart":Jt(.77,0,.175,1),"ease-in-quint":Jt(.755,.05,.855,.06),"ease-out-quint":Jt(.23,1,.32,1),"ease-in-out-quint":Jt(.86,0,.07,1),"ease-in-expo":Jt(.95,.05,.795,.035),"ease-out-expo":Jt(.19,1,.22,1),"ease-in-out-expo":Jt(1,0,0,1),"ease-in-circ":Jt(.6,.04,.98,.335),"ease-out-circ":Jt(.075,.82,.165,1),"ease-in-out-circ":Jt(.785,.135,.15,.86),spring:function(t,n,r){if(r===0)return np.linear;var a=pJ(t,n,r);return function(i,l,o){return i+(l-i)*a(o)}},"cubic-bezier":Jt};function eA(e,t,n,r,a){if(r===1||t===n)return n;var i=a(t,n,r);return e==null||((e.roundValue||e.color)&&(i=Math.round(i)),e.min!==void 0&&(i=Math.max(i,e.min)),e.max!==void 0&&(i=Math.min(i,e.max))),i}function tA(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function ju(e,t,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var l=tA(e,a),o=tA(t,a);if(Re(l)&&Re(o))return eA(i,l,o,n,r);if(Qt(l)&&Qt(o)){for(var f=[],c=0;c<o.length;c++){var h=l[c],p=o[c];if(h!=null&&p!=null){var m=eA(i,h,p,n,r);f.push(m)}else f.push(p)}return f}}function mJ(e,t,n,r){var a=!r,i=e._private,l=t._private,o=l.easing,f=l.startTime,c=r?e:e.cy(),h=c.style();if(!l.easingImpl)if(o==null)l.easingImpl=np.linear;else{var p;if(tt(o)){var m=h.parse("transition-timing-function",o);p=m.value}else p=o;var y,x;tt(p)?(y=p,x=[]):(y=p[1],x=p.slice(2).map(function(Q){return+Q})),x.length>0?(y==="spring"&&x.push(l.duration),l.easingImpl=np[y].apply(null,x)):l.easingImpl=np[y]}var b=l.easingImpl,w;if(l.duration===0?w=1:w=(n-f)/l.duration,l.applying&&(w=l.progress),w<0?w=0:w>1&&(w=1),l.delay==null){var S=l.startPosition,N=l.position;if(N&&a&&!e.locked()){var C={};If(S.x,N.x)&&(C.x=ju(S.x,N.x,w,b)),If(S.y,N.y)&&(C.y=ju(S.y,N.y,w,b)),e.position(C)}var T=l.startPan,R=l.pan,A=i.pan,D=R!=null&&r;D&&(If(T.x,R.x)&&(A.x=ju(T.x,R.x,w,b)),If(T.y,R.y)&&(A.y=ju(T.y,R.y,w,b)),e.emit("pan"));var O=l.startZoom,L=l.zoom,M=L!=null&&r;M&&(If(O,L)&&(i.zoom=vd(i.minZoom,ju(O,L,w,b),i.maxZoom)),e.emit("zoom")),(D||M)&&e.emit("viewport");var B=l.style;if(B&&B.length>0&&a){for(var P=0;P<B.length;P++){var q=B[P],H=q.name,G=q,F=l.startStyle[H],V=h.properties[F.name],Y=ju(F,G,w,b,V);h.overrideBypass(e,H,Y)}e.emit("style")}}return l.progress=w,w}function If(e,t){return e==null||t==null?!1:Re(e)&&Re(t)?!0:!!(e&&t)}function gJ(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function nA(e,t){var n=t._private.aniEles,r=[];function a(h,p){var m=h._private,y=m.animation.current,x=m.animation.queue,b=!1;if(y.length===0){var w=x.shift();w&&y.push(w)}for(var S=function(A){for(var D=A.length-1;D>=0;D--){var O=A[D];O()}A.splice(0,A.length)},N=y.length-1;N>=0;N--){var C=y[N],T=C._private;if(T.stopped){y.splice(N,1),T.hooked=!1,T.playing=!1,T.started=!1,S(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||gJ(h,C,e),mJ(h,C,e,p),T.applying&&(T.applying=!1),S(T.frames),T.step!=null&&T.step(e),C.completed()&&(y.splice(N,1),T.hooked=!1,T.playing=!1,T.started=!1,S(T.completes)),b=!0)}return!p&&y.length===0&&x.length===0&&r.push(h),b}for(var i=!1,l=0;l<n.length;l++){var o=n[l],f=a(o);i=i||f}var c=a(t,!0);(i||c)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var yJ={animate:Bt.animate(),animation:Bt.animation(),animated:Bt.animated(),clearQueue:Bt.clearQueue(),delay:Bt.delay(),delayAnimation:Bt.delayAnimation(),stop:Bt.stop(),addToAnimationPool:function(t){var n=this;n.styleEnabled()&&n._private.aniEles.merge(t)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function n(){t._private.animationsRunning&&jp(function(i){nA(i,t),n()})}var r=t.renderer();r&&r.beforeRender?r.beforeRender(function(i,l){nA(l,t)},r.beforeRenderPriorities.animations):n()}},xJ={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var a=n.qualifier;return a!=null?t!==r.target&&Vd(r.target)&&a.matches(r.target):!0},addEventFields:function(t,n){n.cy=t,n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t}},Bv=function(t){return tt(t)?new Nl(t):t},wL={createEmitter:function(){var t=this._private;return t.emitter||(t.emitter=new Tm(xJ,this)),this},emitter:function(){return this._private.emitter},on:function(t,n,r){return this.emitter().on(t,Bv(n),r),this},removeListener:function(t,n,r){return this.emitter().removeListener(t,Bv(n),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(t,n,r){return this.emitter().one(t,Bv(n),r),this},once:function(t,n,r){return this.emitter().one(t,Bv(n),r),this},emit:function(t,n){return this.emitter().emit(t,n),this},emitAndNotify:function(t,n){return this.emit(t),this.notify(t,n),this}};Bt.eventAliasesOn(wL);var u1={png:function(t){var n=this._private.renderer;return t=t||{},n.png(t)},jpg:function(t){var n=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",n.jpg(t)}};u1.jpeg=u1.jpg;var rp={layout:function(t){var n=this;if(t==null){dn("Layout options must be specified to make a layout");return}if(t.name==null){dn("A `name` must be specified to make a layout");return}var r=t.name,a=n.extension("layout",r);if(a==null){dn("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;tt(t.eles)?i=n.$(t.eles):i=t.eles!=null?t.eles:n.$();var l=new a(at({},t,{cy:n,eles:i}));return l}};rp.createLayout=rp.makeLayout=rp.layout;var bJ={notify:function(t,n){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var a=r.batchNotifications[t]=r.batchNotifications[t]||this.collection();n!=null&&a.merge(n);return}if(r.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(t,n)}},notifications:function(t){var n=this._private;return t===void 0?n.notificationsEnabled:(n.notificationsEnabled=!!t,this)},noNotifications:function(t){this.notifications(!1),t(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},endBatch:function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var n=this.renderer();Object.keys(t.batchNotifications).forEach(function(r){var a=t.batchNotifications[r];a.empty()?n.notify(r):n.notify(r,a)})}return this},batch:function(t){return this.startBatch(),t(),this.endBatch(),this},batchData:function(t){var n=this;return this.batch(function(){for(var r=Object.keys(t),a=0;a<r.length;a++){var i=r[a],l=t[i],o=n.getElementById(i);o.data(l)}})}},wJ=hr({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),c1={renderTo:function(t,n,r,a){var i=this._private.renderer;return i.renderTo(t,n,r,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(t){var n=this,r=n.extension("renderer",t.name);if(r==null){dn("Can not initialise: No such renderer `".concat(t.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}t.wheelSensitivity!==void 0&&zt("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var a=wJ(t);a.cy=n,n._private.renderer=new r(a),this.notify("init")},destroyRenderer:function(){var t=this;t.notify("destroy");var n=t.container();if(n)for(n._cyreg=null;n.childNodes.length>0;)n.removeChild(n.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(r){var a=r._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(t){return this.on("render",t)},offRender:function(t){return this.off("render",t)}};c1.invalidateDimensions=c1.resize;var ap={collection:function(t,n){return tt(t)?this.$(t):da(t)?t.collection():Qt(t)?(n||(n={}),new dr(this,t,n.unique,n.removed)):new dr(this)},nodes:function(t){var n=this.$(function(r){return r.isNode()});return t?n.filter(t):n},edges:function(t){var n=this.$(function(r){return r.isEdge()});return t?n.filter(t):n},$:function(t){var n=this._private.elements;return t?n.filter(t):n.spawnSelf()},mutableElements:function(){return this._private.elements}};ap.elements=ap.filter=ap.$;var ir={},td="t",SJ="f";ir.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),i=0;i<e.length;i++){var l=e[i],o=t.getContextMeta(l);if(!o.empty){var f=t.getContextStyle(o),c=t.applyContextStyle(o,f,l);l._private.appliedInitStyle?t.updateTransitions(l,c.diffProps):l._private.appliedInitStyle=!0;var h=t.updateStyleHints(l);h&&a.push(l)}}return a};ir.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var l=[],o={},f=0;f<n.length;f++){var c=n[f],h=e[f]===td,p=t[f]===td,m=h!==p,y=c.mappedProperties.length>0;if(m||p&&y){var x=void 0;m&&y||m?x=c.properties:y&&(x=c.mappedProperties);for(var b=0;b<x.length;b++){for(var w=x[b],S=w.name,N=!1,C=f+1;C<n.length;C++){var T=n[C],R=t[C]===td;if(R&&(N=T.properties[w.name]!=null,N))break}!o[S]&&!N&&(o[S]=!0,l.push(S))}}}return r[a]=l,l};ir.getContextMeta=function(e){for(var t=this,n="",r,a=e._private.styleCxtKey||"",i=0;i<t.length;i++){var l=t[i],o=l.selector&&l.selector.matches(e);o?n+=td:n+=SJ}return r=t.getPropertiesDiff(a,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}};ir.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},i=0;i<n.length;i++){var l=n[i],o=t[i]===td;if(o)for(var f=0;f<l.properties.length;f++){var c=l.properties[f];a[c.name]=c}}return r[t]=a,a};ir.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,i={},l=r.types,o=0;o<a.length;o++){var f=a[o],c=t[f],h=n.pstyle(f);if(!c)if(h)h.bypass?c={name:f,deleteBypassed:!0}:c={name:f,delete:!0};else continue;if(h!==c){if(c.mapped===l.fn&&h!=null&&h.mapping!=null&&h.mapping.value===c.value){var p=h.mapping,m=p.fnValue=c.value(n);if(m===p.prevFnValue)continue}var y=i[f]={prev:h};r.applyParsedProperty(n,c),y.next=n.pstyle(f),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:i}};ir.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(oe,ye,Te){return n.getPropertiesHash(oe,ye,Te)},l=t.styleKey;if(e.removed())return!1;var o=t.group==="nodes",f=e._private.style;r=Object.keys(f);for(var c=0;c<a.length;c++){var h=a[c];t.styleKeys[h]=[so,Pu]}for(var p=function(oe,ye){return t.styleKeys[ye][0]=fd(oe,t.styleKeys[ye][0])},m=function(oe,ye){return t.styleKeys[ye][1]=dd(oe,t.styleKeys[ye][1])},y=function(oe,ye){p(oe,ye),m(oe,ye)},x=function(oe,ye){for(var Te=0;Te<oe.length;Te++){var Be=oe.charCodeAt(Te);p(Be,ye),m(Be,ye)}},b=2e9,w=function(oe){return-128<oe&&oe<128&&Math.floor(oe)!==oe?b-(oe*1024|0):oe},S=0;S<r.length;S++){var N=r[S],C=f[N];if(C!=null){var T=this.properties[N],R=T.type,A=T.groupKey,D=void 0;T.hashOverride!=null?D=T.hashOverride(e,C):C.pfValue!=null&&(D=C.pfValue);var O=T.enums==null?C.value:null,L=D!=null,M=O!=null,B=L||M,P=C.units;if(R.number&&B&&!R.multiple){var q=L?D:O;y(w(q),A),!L&&P!=null&&x(P,A)}else x(C.strValue,A)}}for(var H=[so,Pu],G=0;G<a.length;G++){var F=a[G],V=t.styleKeys[F];H[0]=fd(V[0],H[0]),H[1]=dd(V[1],H[1])}t.styleKey=zX(H[0],H[1]);var Y=t.styleKeys;t.labelDimsKey=Xs(Y.labelDimensions);var Q=i(e,["label"],Y.labelDimensions);if(t.labelKey=Xs(Q),t.labelStyleKey=Xs(Av(Y.commonLabel,Q)),!o){var I=i(e,["source-label"],Y.labelDimensions);t.sourceLabelKey=Xs(I),t.sourceLabelStyleKey=Xs(Av(Y.commonLabel,I));var U=i(e,["target-label"],Y.labelDimensions);t.targetLabelKey=Xs(U),t.targetLabelStyleKey=Xs(Av(Y.commonLabel,U))}if(o){var X=t.styleKeys,z=X.nodeBody,Z=X.nodeBorder,re=X.nodeOutline,ae=X.backgroundImage,se=X.compound,le=X.pie,ie=X.stripe,W=[z,Z,re,ae,se,le,ie].filter(function(te){return te!=null}).reduce(Av,[so,Pu]);t.nodeKey=Xs(W),t.hasPie=le!=null&&le[0]!==so&&le[1]!==Pu,t.hasStripe=ie!=null&&ie[0]!==so&&ie[1]!==Pu}return l!==t.styleKey};ir.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null};ir.applyParsedProperty=function(e,t){var n=this,r=t,a=e._private.style,i,l=n.types,o=n.properties[r.name].type,f=r.bypass,c=a[r.name],h=c&&c.bypass,p=e._private,m="mapping",y=function(z){return z==null?null:z.pfValue!=null?z.pfValue:z.value},x=function(){var z=y(c),Z=y(r);n.checkTriggers(e,r.name,z,Z)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",f)),r.delete)return a[r.name]=void 0,x(),!0;if(r.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,x(),!0):!1:(x(),!0);if(r.deleteBypass)return c?c.bypass?(a[r.name]=c.bypassed,x(),!0):!1:(x(),!0);var b=function(){zt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case l.mapData:{for(var w=r.field.split("."),S=p.data,N=0;N<w.length&&S;N++){var C=w[N];S=S[C]}if(S==null)return b(),!1;var T;if(Re(S)){var R=r.fieldMax-r.fieldMin;R===0?T=0:T=(S-r.fieldMin)/R}else return zt("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+S+"` for `"+e.id()+"` is non-numeric)"),!1;if(T<0?T=0:T>1&&(T=1),o.color){var A=r.valueMin[0],D=r.valueMax[0],O=r.valueMin[1],L=r.valueMax[1],M=r.valueMin[2],B=r.valueMax[2],P=r.valueMin[3]==null?1:r.valueMin[3],q=r.valueMax[3]==null?1:r.valueMax[3],H=[Math.round(A+(D-A)*T),Math.round(O+(L-O)*T),Math.round(M+(B-M)*T),Math.round(P+(q-P)*T)];i={bypass:r.bypass,name:r.name,value:H,strValue:"rgb("+H[0]+", "+H[1]+", "+H[2]+")"}}else if(o.number){var G=r.valueMin+(r.valueMax-r.valueMin)*T;i=this.parse(r.name,G,r.bypass,m)}else return!1;if(!i)return b(),!1;i.mapping=r,r=i;break}case l.data:{for(var F=r.field.split("."),V=p.data,Y=0;Y<F.length&&V;Y++){var Q=F[Y];V=V[Q]}if(V!=null&&(i=this.parse(r.name,V,r.bypass,m)),!i)return b(),!1;i.mapping=r,r=i;break}case l.fn:{var I=r.value,U=r.fnValue!=null?r.fnValue:I(e);if(r.prevFnValue=U,U==null)return zt("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(i=this.parse(r.name,U,r.bypass,m),!i)return zt("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;i.mapping=vi(r),r=i;break}case void 0:break;default:return!1}return f?(h?r.bypassed=c.bypassed:r.bypassed=c,a[r.name]=r):h?c.bypassed=r:a[r.name]=r,x(),!0};ir.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var a=r._private.style,i=Object.keys(a),l=0;l<i.length;l++){var o=i[l],f=a[o];f!=null&&(f.bypass?f.bypassed=null:a[o]=null)}}};ir.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()};ir.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,l=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var o={},f=!1,c=0;c<a.length;c++){var h=a[c],p=e.pstyle(h),m=t[h];if(m){var y=m.prev,x=y,b=m.next!=null?m.next:p,w=!1,S=void 0,N=1e-6;x&&(Re(x.pfValue)&&Re(b.pfValue)?(w=b.pfValue-x.pfValue,S=x.pfValue+N*w):Re(x.value)&&Re(b.value)?(w=b.value-x.value,S=x.value+N*w):Qt(x.value)&&Qt(b.value)&&(w=x.value[0]!==b.value[0]||x.value[1]!==b.value[1]||x.value[2]!==b.value[2],S=x.strValue),w&&(o[h]=b.strValue,this.applyBypass(e,h,S),f=!0))}}if(!f)return;r.transitioning=!0,new Dc(function(C){l>0?e.delayAnimation(l).play().promise().then(C):C()}).then(function(){return e.animation({style:o,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)};ir.checkTrigger=function(e,t,n,r,a,i){var l=this.properties[t],o=a(l);e.removed()||o!=null&&o(n,r,e)&&i(l)};ir.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",e)})};ir.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};ir.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfConnectedEdges},function(a){e.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ir.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfParallelEdges},function(a){e.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ir.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Qd={};Qd.applyBypass=function(e,t,n,r){var a=this,i=[],l=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var o=0;o<a.properties.length;o++){var f=a.properties[o],c=f.name,h=this.parse(c,n,!0);h&&i.push(h)}}else if(tt(t)){var p=this.parse(t,n,!0);p&&i.push(p)}else if(Mt(t)){var m=t;r=n;for(var y=Object.keys(m),x=0;x<y.length;x++){var b=y[x],w=m[b];if(w===void 0&&(w=m[gm(b)]),w!==void 0){var S=this.parse(b,w,!0);S&&i.push(S)}}}else return!1;if(i.length===0)return!1;for(var N=!1,C=0;C<e.length;C++){for(var T=e[C],R={},A=void 0,D=0;D<i.length;D++){var O=i[D];if(r){var L=T.pstyle(O.name);A=R[O.name]={prev:L}}N=this.applyParsedProperty(T,vi(O))||N,r&&(A.next=T.pstyle(O.name))}N&&this.updateStyleHints(T),r&&this.updateTransitions(T,R,l)}return N};Qd.overrideBypass=function(e,t,n){t=Lw(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],l=this.properties[t].type,o=l.color,f=l.mutiple,c=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,t,n):(i.value=n,i.pfValue!=null&&(i.pfValue=n),o?i.strValue="rgb("+n.join(",")+")":f?i.strValue=n.join(" "):i.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,t,c,n)}};Qd.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)};Qd.removeBypasses=function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var i=e[a],l={},o=0;o<t.length;o++){var f=t[o],c=this.properties[f],h=i.pstyle(c.name);if(!(!h||!h.bypass)){var p="",m=this.parse(f,p,!0),y=l[c.name]={prev:h};this.applyParsedProperty(i,m),y.next=i.pstyle(c.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,l,r)}};var Qw={};Qw.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1};Qw.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var Ci={};Ci.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)};Ci.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],l=n.getStylePropertyValue(e,i.name,t);l!=null&&(r[i.name]=l,r[gm(i.name)]=l)}return r}};Ci.getIndexedStyle=function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]};Ci.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var a=r.properties[t];a.alias&&(a=a.pointsTo);var i=a.type,l=e.pstyle(a.name);if(l){var o=l.value,f=l.units,c=l.strValue;if(n&&i.number&&o!=null&&Re(o)){var h=e.cy().zoom(),p=function(w){return w*h},m=function(w,S){return p(w)+S},y=Qt(o),x=y?f.every(function(b){return b!=null}):f!=null;return x?y?o.map(function(b,w){return m(b,f[w])}).join(" "):m(o,f):y?o.map(function(b){return tt(b)?b:""+p(b)}).join(" "):""+p(o)}else if(c!=null)return c}return null}};Ci.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r],i=a.name,l=e.pstyle(i);l!==void 0&&(Mt(l)?l=this.parse(i,l.strValue):l=this.parse(i,l)),l&&(n[i]=l)}return n};Ci.getPropsList=function(e){var t=this,n=[],r=e,a=t.properties;if(r)for(var i=Object.keys(r),l=0;l<i.length;l++){var o=i[l],f=r[o],c=a[o]||a[Lw(o)],h=this.parse(c.name,f);h&&n.push(h)}return n};Ci.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),a,i,l,o,f,c;for(f=0;f<t.length;f++)if(a=t[f],i=e.pstyle(a,!1),i!=null)if(i.pfValue!=null)r[0]=fd(o,r[0]),r[1]=dd(o,r[1]);else for(l=i.strValue,c=0;c<l.length;c++)o=l.charCodeAt(c),r[0]=fd(o,r[0]),r[1]=dd(o,r[1]);return r};Ci.getPropertiesHash=Ci.getNonDefaultPropertiesHash;var Rm={};Rm.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,l=Object.keys(i);t.selector(a);for(var o=0;o<l.length;o++){var f=l[o],c=i[f];t.css(f,c)}}return t};Rm.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t};Rm.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},l=0;l<a.length;l++){var o=a[l];i[o.name]=o.strValue}e.push({selector:r?r.toString():"core",style:i})}return e};var Ww={};Ww.appendFromString=function(e){var t=this,n=this,r=""+e,a,i,l;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){r.length>a.length?r=r.substr(a.length):r=""}function f(){i.length>l.length?i=i.substr(l.length):i=""}for(;;){var c=r.match(/^\s*$/);if(c)break;var h=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){zt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=h[0];var p=h[1];if(p!=="core"){var m=new Nl(p);if(m.invalid){zt("Skipping parsing of block: Invalid selector found in string stylesheet: "+p),o();continue}}var y=h[2],x=!1;i=y;for(var b=[];;){var w=i.match(/^\s*$/);if(w)break;var S=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!S){zt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),x=!0;break}l=S[0];var N=S[1],C=S[2],T=t.properties[N];if(!T){zt("Skipping property: Invalid property name in: "+l),f();continue}var R=n.parse(N,C);if(!R){zt("Skipping property: Invalid property definition in: "+l),f();continue}b.push({name:N,val:C}),f()}if(x){o();break}n.selector(p);for(var A=0;A<b.length;A++){var D=b[A];n.css(D.name,D.val)}o()}return n};Ww.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var Ln={};(function(){var e=Hn,t=mX,n=yX,r=xX,a=bX,i=function(te){return"^"+te+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},l=function(te){var oe=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+te+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+oe+")\\s*\\,\\s*("+oe+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ln.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:l("mapData")},mapLayoutData:{mapping:!0,regex:l("mapLayoutData")},mapScratch:{mapping:!0,regex:l("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(te,oe){switch(te.length){case 2:return oe[0]!=="deg"&&oe[0]!=="rad"&&oe[1]!=="deg"&&oe[1]!=="rad";case 1:return tt(te[0])||oe[0]==="deg"||oe[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(te){var oe=te.length;return oe===1||oe===2||oe===4}}};var f={zeroNonZero:function(te,oe){return(te==null||oe==null)&&te!==oe||te==0&&oe!=0?!0:te!=0&&oe==0},any:function(te,oe){return te!=oe},emptyNonEmpty:function(te,oe){var ye=Sl(te),Te=Sl(oe);return ye&&!Te||!ye&&Te}},c=Ln.types,h=[{name:"label",type:c.text,triggersBounds:f.any,triggersZOrder:f.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any}],p=[{name:"source-label",type:c.text,triggersBounds:f.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"source-text-offset",type:c.size,triggersBounds:f.any}],m=[{name:"target-label",type:c.text,triggersBounds:f.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"target-text-offset",type:c.size,triggersBounds:f.any}],y=[{name:"font-family",type:c.fontFamily,triggersBounds:f.any},{name:"font-style",type:c.fontStyle,triggersBounds:f.any},{name:"font-weight",type:c.fontWeight,triggersBounds:f.any},{name:"font-size",type:c.size,triggersBounds:f.any},{name:"text-transform",type:c.textTransform,triggersBounds:f.any},{name:"text-wrap",type:c.textWrap,triggersBounds:f.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:f.any},{name:"text-max-width",type:c.size,triggersBounds:f.any},{name:"text-outline-width",type:c.size,triggersBounds:f.any},{name:"line-height",type:c.positiveNumber,triggersBounds:f.any}],x=[{name:"text-valign",type:c.valign,triggersBounds:f.any},{name:"text-halign",type:c.halign,triggersBounds:f.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:f.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:f.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:f.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:f.any},{name:"text-justification",type:c.justification},{name:"box-select-labels",type:c.bool,triggersBounds:f.any}],b=[{name:"events",type:c.bool,triggersZOrder:f.any},{name:"text-events",type:c.bool,triggersZOrder:f.any},{name:"box-selection",type:c.boxSelection,triggersZOrder:f.any}],w=[{name:"display",type:c.display,triggersZOrder:f.any,triggersBounds:f.any,triggersBoundsOfConnectedEdges:f.any,triggersBoundsOfParallelEdges:function(te,oe,ye){return te===oe?!1:ye.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:c.visibility,triggersZOrder:f.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:f.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:f.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:f.any},{name:"z-index",type:c.number,triggersZOrder:f.any}],S=[{name:"overlay-padding",type:c.size,triggersBounds:f.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:f.any},{name:"overlay-corner-radius",type:c.cornerRadius}],N=[{name:"underlay-padding",type:c.size,triggersBounds:f.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:f.any},{name:"underlay-corner-radius",type:c.cornerRadius}],C=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],T=function(te,oe){return oe.value==="label"?-te.poolIndex():oe.pfValue},R=[{name:"height",type:c.nodeSize,triggersBounds:f.any,hashOverride:T},{name:"width",type:c.nodeSize,triggersBounds:f.any,hashOverride:T},{name:"shape",type:c.nodeShape,triggersBounds:f.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:f.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:f.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:f.any}],A=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:f.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],D=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:f.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:f.any}],O=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],L=[{name:"position",type:c.position,triggersBounds:f.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:f.any},{name:"min-width",type:c.size,triggersBounds:f.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-height",type:c.size,triggersBounds:f.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:f.any}],M=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:f.any,triggersBoundsOfParallelEdges:function(te,oe){return te===oe?!1:te==="bezier"||oe==="bezier"}},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:f.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:f.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:f.any},{name:"control-point-step-size",type:c.size,triggersBounds:f.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:f.any},{name:"control-point-weights",type:c.numbers,triggersBounds:f.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:f.any},{name:"segment-weights",type:c.numbers,triggersBounds:f.any},{name:"segment-radii",type:c.numbers,triggersBounds:f.any},{name:"radius-type",type:c.radiusType,triggersBounds:f.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:f.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:f.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:f.any},{name:"taxi-radius",type:c.number,triggersBounds:f.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:f.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:f.any},{name:"loop-direction",type:c.angle,triggersBounds:f.any},{name:"loop-sweep",type:c.angle,triggersBounds:f.any},{name:"source-distance-from-node",type:c.size,triggersBounds:f.any},{name:"target-distance-from-node",type:c.size,triggersBounds:f.any}],B=[{name:"ghost",type:c.bool,triggersBounds:f.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"ghost-opacity",type:c.zeroOneNumber}],P=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],q=[];Ln.pieBackgroundN=16,q.push({name:"pie-size",type:c.sizeMaybePercent}),q.push({name:"pie-hole",type:c.sizeMaybePercent}),q.push({name:"pie-start-angle",type:c.angle});for(var H=1;H<=Ln.pieBackgroundN;H++)q.push({name:"pie-"+H+"-background-color",type:c.color}),q.push({name:"pie-"+H+"-background-size",type:c.percent}),q.push({name:"pie-"+H+"-background-opacity",type:c.zeroOneNumber});var G=[];Ln.stripeBackgroundN=16,G.push({name:"stripe-size",type:c.sizeMaybePercent}),G.push({name:"stripe-direction",type:c.axisDirectionPrimary});for(var F=1;F<=Ln.stripeBackgroundN;F++)G.push({name:"stripe-"+F+"-background-color",type:c.color}),G.push({name:"stripe-"+F+"-background-size",type:c.percent}),G.push({name:"stripe-"+F+"-background-opacity",type:c.zeroOneNumber});var V=[],Y=Ln.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:f.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(W){Y.forEach(function(te){var oe=te+"-"+W.name,ye=W.type,Te=W.triggersBounds;V.push({name:oe,type:ye,triggersBounds:Te})})},{});var Q=Ln.properties=[].concat(b,C,w,S,N,B,x,y,h,p,m,R,A,D,O,q,G,L,M,V,P),I=Ln.propertyGroups={behavior:b,transition:C,visibility:w,overlay:S,underlay:N,ghost:B,commonLabel:x,labelDimensions:y,mainLabel:h,sourceLabel:p,targetLabel:m,nodeBody:R,nodeBorder:A,nodeOutline:D,backgroundImage:O,pie:q,stripe:G,compound:L,edgeLine:M,edgeArrow:V,core:P},U=Ln.propertyGroupNames={},X=Ln.propertyGroupKeys=Object.keys(I);X.forEach(function(W){U[W]=I[W].map(function(te){return te.name}),I[W].forEach(function(te){return te.groupKey=W})});var z=Ln.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Ln.propertyNames=Q.map(function(W){return W.name});for(var Z=0;Z<Q.length;Z++){var re=Q[Z];Q[re.name]=re}for(var ae=0;ae<z.length;ae++){var se=z[ae],le=Q[se.pointsTo],ie={name:se.name,alias:!0,pointsTo:le};Q.push(ie),Q[se.name]=ie}})();Ln.getDefaultProperty=function(e){return this.getDefaultProperties()[e]};Ln.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=at({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(f,c){for(var h=1;h<=Ln.pieBackgroundN;h++){var p=c.name.replace("{{i}}",h),m=c.value;f[p]=m}return f},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(f,c){for(var h=1;h<=Ln.stripeBackgroundN;h++){var p=c.name.replace("{{i}}",h),m=c.value;f[p]=m}return f},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(f,c){return Ln.arrowPrefixes.forEach(function(h){var p=h+"-"+c.name,m=c.value;f[p]=m}),f},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,l=t[i],o=this.parse(i,l);n[i]=o}}return e.defaultProperties=n,e.defaultProperties};Ln.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Dm={};Dm.parse=function(e,t,n,r){var a=this;if(gn(t))return a.parseImplWarn(e,t,n,r);var i=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,l=n?"t":"f",o=""+t,f=DO(e,o,l,i),c=a.propCache=a.propCache||[],h;return(h=c[f])||(h=c[f]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(h=vi(h),h&&(h.value=vi(h.value))),h};Dm.parseImplWarn=function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return!a&&t!=null&&zt("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&t==="label"&&zt("The style value of `label` is deprecated for `"+a.name+"`"),a};Dm.parseImpl=function(e,t,n,r){var a=this;e=Lw(e);var i=a.properties[e],l=t,o=a.types;if(!i||t===void 0)return null;i.alias&&(i=i.pointsTo,e=i.name);var f=tt(t);f&&(t=t.trim());var c=i.type;if(!c)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(gn(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};var h,p;if(!(!f||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(h=new RegExp(o.data.regex).exec(t))){if(n)return!1;var m=o.data;return{name:e,value:h,strValue:""+t,mapped:m,field:h[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(p=new RegExp(o.mapData.regex).exec(t))){if(n||c.multiple)return!1;var y=o.mapData;if(!(c.color||c.number))return!1;var x=this.parse(e,p[4]);if(!x||x.mapped)return!1;var b=this.parse(e,p[5]);if(!b||b.mapped)return!1;if(x.pfValue===b.pfValue||x.strValue===b.strValue)return zt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+x.strValue+"`"),this.parse(e,x.strValue);if(c.color){var w=x.value,S=b.value,N=w[0]===S[0]&&w[1]===S[1]&&w[2]===S[2]&&(w[3]===S[3]||(w[3]==null||w[3]===1)&&(S[3]==null||S[3]===1));if(N)return!1}return{name:e,value:p,strValue:""+t,mapped:y,field:p[1],fieldMin:parseFloat(p[2]),fieldMax:parseFloat(p[3]),valueMin:x.value,valueMax:b.value,bypass:n}}}if(c.multiple&&r!=="multiple"){var C;if(f?C=t.split(/\s+/):Qt(t)?C=t:C=[t],c.evenMultiple&&C.length%2!==0)return null;for(var T=[],R=[],A=[],D="",O=!1,L=0;L<C.length;L++){var M=a.parse(e,C[L],n,"multiple");O=O||tt(M.value),T.push(M.value),A.push(M.pfValue!=null?M.pfValue:M.value),R.push(M.units),D+=(L>0?" ":"")+M.strValue}return c.validate&&!c.validate(T,R)?null:c.singleEnum&&O?T.length===1&&tt(T[0])?{name:e,value:T[0],strValue:T[0],bypass:n}:null:{name:e,value:T,pfValue:A,strValue:D,bypass:n,units:R}}var B=function(){for(var ie=0;ie<c.enums.length;ie++){var W=c.enums[ie];if(W===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var P,q="px";if(c.units&&(P=c.units),c.implicitUnits&&(q=c.implicitUnits),!c.unitless)if(f){var H="px|em"+(c.allowPercent?"|\\%":"");P&&(H=P);var G=t.match("^("+Hn+")("+H+")?$");G&&(t=G[1],P=G[2]||q)}else(!P||c.implicitUnits)&&(P=q);if(t=parseFloat(t),isNaN(t)&&c.enums===void 0)return null;if(isNaN(t)&&c.enums!==void 0)return t=l,B();if(c.integer&&!uX(t)||c.min!==void 0&&(t<c.min||c.strictMin&&t===c.min)||c.max!==void 0&&(t>c.max||c.strictMax&&t===c.max))return null;var F={name:e,value:t,strValue:""+t+(P||""),units:P,bypass:n};return c.unitless||P!=="px"&&P!=="em"?F.pfValue=t:F.pfValue=P==="px"||!P?t:this.getEmSizeInPixels()*t,(P==="ms"||P==="s")&&(F.pfValue=P==="ms"?t:1e3*t),(P==="deg"||P==="rad")&&(F.pfValue=P==="rad"?t:xQ(t)),P==="%"&&(F.pfValue=t/100),F}else if(c.propList){var V=[],Y=""+t;if(Y!=="none"){for(var Q=Y.split(/\s*,\s*|\s+/),I=0;I<Q.length;I++){var U=Q[I].trim();a.properties[U]?V.push(U):zt("`"+U+"` is not a valid property name")}if(V.length===0)return null}return{name:e,value:V,strValue:V.length===0?"none":V.join(" "),bypass:n}}else if(c.color){var X=CO(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}else if(c.regex||c.regexes){if(c.enums){var z=B();if(z)return z}for(var Z=c.regexes?c.regexes:[c.regex],re=0;re<Z.length;re++){var ae=new RegExp(Z[re]),se=ae.exec(t);if(se)return{name:e,value:c.singleRegexMatchValue?se[1]:se,strValue:""+t,bypass:n}}return null}else return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?B():null};var ar=function(t){if(!(this instanceof ar))return new ar(t);if(!Ow(t)){dn("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},Sr=ar.prototype;Sr.instanceString=function(){return"style"};Sr.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};Sr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Sr.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)};Sr.selector=function(e){var t=e==="core"?null:new Nl(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this};Sr.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],i=n[a.name];i===void 0&&(i=n[gm(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else t.length===2&&this.cssRule(t[0],t[1]);return this};Sr.style=Sr.css;Sr.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this};Sr.append=function(e){return wO(e)?e.appendToStyle(this):Qt(e)?this.appendFromJson(e):tt(e)&&this.appendFromString(e),this};ar.fromJson=function(e,t){var n=new ar(e);return n.fromJson(t),n};ar.fromString=function(e,t){return new ar(e).fromString(t)};[ir,Qd,Qw,Ci,Rm,Ww,Ln,Dm].forEach(function(e){at(Sr,e)});ar.types=Sr.types;ar.properties=Sr.properties;ar.propertyGroups=Sr.propertyGroups;ar.propertyGroupNames=Sr.propertyGroupNames;ar.propertyGroupKeys=Sr.propertyGroupKeys;var EJ={style:function(t){if(t){var n=this.setStyle(t);n.update()}return this._private.style},setStyle:function(t){var n=this._private;return wO(t)?n.style=t.generateStyle(this):Qt(t)?n.style=ar.fromJson(this,t):tt(t)?n.style=ar.fromString(this,t):n.style=ar(this),n.style},updateStyle:function(){this.mutableElements().updateStyle()}},CJ="single",_o={autolock:function(t){if(t!==void 0)this._private.autolock=!!t;else return this._private.autolock;return this},autoungrabify:function(t){if(t!==void 0)this._private.autoungrabify=!!t;else return this._private.autoungrabify;return this},autounselectify:function(t){if(t!==void 0)this._private.autounselectify=!!t;else return this._private.autounselectify;return this},selectionType:function(t){var n=this._private;if(n.selectionType==null&&(n.selectionType=CJ),t!==void 0)(t==="additive"||t==="single")&&(n.selectionType=t);else return n.selectionType;return this},panningEnabled:function(t){if(t!==void 0)this._private.panningEnabled=!!t;else return this._private.panningEnabled;return this},userPanningEnabled:function(t){if(t!==void 0)this._private.userPanningEnabled=!!t;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(t){if(t!==void 0)this._private.zoomingEnabled=!!t;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(t){if(t!==void 0)this._private.userZoomingEnabled=!!t;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(t){if(t!==void 0)this._private.boxSelectionEnabled=!!t;else return this._private.boxSelectionEnabled;return this},pan:function(){var t=arguments,n=this._private.pan,r,a,i,l,o;switch(t.length){case 0:return n;case 1:if(tt(t[0]))return r=t[0],n[r];if(Mt(t[0])){if(!this._private.panningEnabled)return this;i=t[0],l=i.x,o=i.y,Re(l)&&(n.x=l),Re(o)&&(n.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=t[0],a=t[1],(r==="x"||r==="y")&&Re(a)&&(n[r]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(t,n){var r=arguments,a=this._private.pan,i,l,o,f,c;if(!this._private.panningEnabled)return this;switch(r.length){case 1:Mt(t)&&(o=r[0],f=o.x,c=o.y,Re(f)&&(a.x+=f),Re(c)&&(a.y+=c),this.emit("pan viewport"));break;case 2:i=t,l=n,(i==="x"||i==="y")&&Re(l)&&(a[i]+=l),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(t,n){var r=this.getFitViewport(t,n);if(r){var a=this._private;a.zoom=r.zoom,a.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(t,n){if(Re(t)&&n===void 0&&(n=t,t=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(tt(t)){var a=t;t=this.$(a)}else if(dX(t)){var i=t;r={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else da(t)||(t=this.mutableElements());if(!(da(t)&&t.empty())){r=r||t.boundingBox();var l=this.width(),o=this.height(),f;if(n=Re(n)?n:0,!isNaN(l)&&!isNaN(o)&&l>0&&o>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){f=Math.min((l-2*n)/r.w,(o-2*n)/r.h),f=f>this._private.maxZoom?this._private.maxZoom:f,f=f<this._private.minZoom?this._private.minZoom:f;var c={x:(l-f*(r.x1+r.x2))/2,y:(o-f*(r.y1+r.y2))/2};return{zoom:f,pan:c}}}}},zoomRange:function(t,n){var r=this._private;if(n==null){var a=t;t=a.min,n=a.max}return Re(t)&&Re(n)&&t<=n?(r.minZoom=t,r.maxZoom=n):Re(t)&&n===void 0&&t<=r.maxZoom?r.minZoom=t:Re(n)&&t===void 0&&n>=r.minZoom&&(r.maxZoom=n),this},minZoom:function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},maxZoom:function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},getZoomedViewport:function(t){var n=this._private,r=n.pan,a=n.zoom,i,l,o=!1;if(n.zoomingEnabled||(o=!0),Re(t)?l=t:Mt(t)&&(l=t.level,t.position!=null?i=bm(t.position,a,r):t.renderedPosition!=null&&(i=t.renderedPosition),i!=null&&!n.panningEnabled&&(o=!0)),l=l>n.maxZoom?n.maxZoom:l,l=l<n.minZoom?n.minZoom:l,o||!Re(l)||l===a||i!=null&&(!Re(i.x)||!Re(i.y)))return null;if(i!=null){var f=r,c=a,h=l,p={x:-h/c*(i.x-f.x)+i.x,y:-h/c*(i.y-f.y)+i.y};return{zoomed:!0,panned:!0,zoom:h,pan:p}}else return{zoomed:!0,panned:!1,zoom:l,pan:r}},zoom:function(t){if(t===void 0)return this._private.zoom;var n=this.getZoomedViewport(t),r=this._private;return n==null||!n.zoomed?this:(r.zoom=n.zoom,n.panned&&(r.pan.x=n.pan.x,r.pan.y=n.pan.y),this.emit("zoom"+(n.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(t){var n=this._private,r=!0,a=!0,i=[],l=!1,o=!1;if(!t)return this;if(Re(t.zoom)||(r=!1),Mt(t.pan)||(a=!1),!r&&!a)return this;if(r){var f=t.zoom;f<n.minZoom||f>n.maxZoom||!n.zoomingEnabled?l=!0:(n.zoom=f,i.push("zoom"))}if(a&&(!l||!t.cancelOnFailedZoom)&&n.panningEnabled){var c=t.pan;Re(c.x)&&(n.pan.x=c.x,o=!1),Re(c.y)&&(n.pan.y=c.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(t){var n=this.getCenterPan(t);return n&&(this._private.pan=n,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(t,n){if(this._private.panningEnabled){if(tt(t)){var r=t;t=this.mutableElements().filter(r)}else da(t)||(t=this.mutableElements());if(t.length!==0){var a=t.boundingBox(),i=this.width(),l=this.height();n=n===void 0?this._private.zoom:n;var o={x:(i-n*(a.x1+a.x2))/2,y:(l-n*(a.y1+a.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var t=this._private,n=t.container,r=this;return t.sizeCache=t.sizeCache||(n?(function(){var a=r.window().getComputedStyle(n),i=function(o){return parseFloat(a.getPropertyValue(o))};return{width:n.clientWidth-i("padding-left")-i("padding-right"),height:n.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var t=this._private.pan,n=this._private.zoom,r=this.renderedExtent(),a={x1:(r.x1-t.x)/n,x2:(r.x2-t.x)/n,y1:(r.y1-t.y)/n,y2:(r.y2-t.y)/n};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var t=this.width(),n=this.height();return{x1:0,y1:0,x2:t,y2:n,w:t,h:n}},multiClickDebounceTime:function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};_o.centre=_o.center;_o.autolockNodes=_o.autolock;_o.autoungrabifyNodes=_o.autoungrabify;var yd={data:Bt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Bt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Bt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Bt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};yd.attr=yd.data;yd.removeAttr=yd.removeData;var xd=function(t){var n=this;t=at({},t);var r=t.container;r&&!Tp(r)&&Tp(r[0])&&(r=r[0]);var a=r?r._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];r&&(r._cyreg=a),a.cy=n;var l=qn!==void 0&&r!==void 0&&!t.headless,o=t;o.layout=at({name:l?"grid":"null"},o.layout),o.renderer=at({name:l?"canvas":"null"},o.renderer);var f=function(x,b,w){return b!==void 0?b:w!==void 0?w:x},c=this._private={container:r,ready:!1,options:o,elements:new dr(this),listeners:[],aniEles:new dr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:f(!0,o.zoomingEnabled),userZoomingEnabled:f(!0,o.userZoomingEnabled),panningEnabled:f(!0,o.panningEnabled),userPanningEnabled:f(!0,o.userPanningEnabled),boxSelectionEnabled:f(!0,o.boxSelectionEnabled),autolock:f(!1,o.autolock,o.autolockNodes),autoungrabify:f(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:f(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?l:o.styleEnabled,zoom:Re(o.zoom)?o.zoom:1,pan:{x:Mt(o.pan)&&Re(o.pan.x)?o.pan.x:0,y:Mt(o.pan)&&Re(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:f(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var h=function(x,b){var w=x.some(hX);if(w)return Dc.all(x).then(b);b(x)};c.styleEnabled&&n.setStyle([]);var p=at({},o,o.renderer);n.initRenderer(p);var m=function(x,b,w){n.notifications(!1);var S=n.mutableElements();S.length>0&&S.remove(),x!=null&&(Mt(x)||Qt(x))&&n.add(x),n.one("layoutready",function(C){n.notifications(!0),n.emit(C),n.one("load",b),n.emitAndNotify("load")}).one("layoutstop",function(){n.one("done",w),n.emit("done")});var N=at({},n._private.options.layout);N.eles=n.elements(),n.layout(N).run()};h([o.style,o.elements],function(y){var x=y[0],b=y[1];c.styleEnabled&&n.style().append(x),m(b,function(){n.startAnimationLoop(),c.ready=!0,gn(o.ready)&&n.on("ready",o.ready);for(var w=0;w<i.length;w++){var S=i[w];n.on("ready",S)}a&&(a.readies=[]),n.emit("ready")},o.done)})},Op=xd.prototype;at(Op,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(t){return this.isReady()?this.emitter().emit("ready",[],t):this.on("ready",t),this},destroy:function(){var t=this;if(!t.destroyed())return t.stopAnimationLoop(),t.destroyRenderer(),this.emit("destroy"),t._private.destroyed=!0,t},hasElementWithId:function(t){return this._private.elements.hasElementWithId(t)},getElementById:function(t){return this._private.elements.getElementById(t)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(t){return this._private.elements.merge(t),this},removeFromPool:function(t){return this._private.elements.unmerge(t),this},container:function(){return this._private.container||null},window:function(){var t=this._private.container;if(t==null)return qn;var n=this._private.container.ownerDocument;return n===void 0||n==null?qn:n.defaultView||qn},mount:function(t){if(t!=null){var n=this,r=n._private,a=r.options;return!Tp(t)&&Tp(t[0])&&(t=t[0]),n.stopAnimationLoop(),n.destroyRenderer(),r.container=t,r.styleEnabled=!0,n.invalidateSize(),n.initRenderer(at({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),n.startAnimationLoop(),n.style(a.style),n.emit("mount"),n}},unmount:function(){var t=this;return t.stopAnimationLoop(),t.destroyRenderer(),t.initRenderer({name:"null"}),t.emit("unmount"),t},options:function(){return vi(this._private.options)},json:function(t){var n=this,r=n._private,a=n.mutableElements(),i=function(T){return n.getElementById(T.id())};if(Mt(t)){if(n.startBatch(),t.elements){var l={},o=function(T,R){for(var A=[],D=[],O=0;O<T.length;O++){var L=T[O];if(!L.data.id){zt("cy.json() cannot handle elements without an ID attribute");continue}var M=""+L.data.id,B=n.getElementById(M);l[M]=!0,B.length!==0?D.push({ele:B,json:L}):(R&&(L.group=R),A.push(L))}n.add(A);for(var P=0;P<D.length;P++){var q=D[P],H=q.ele,G=q.json;H.json(G)}};if(Qt(t.elements))o(t.elements);else for(var f=["nodes","edges"],c=0;c<f.length;c++){var h=f[c],p=t.elements[h];Qt(p)&&o(p,h)}var m=n.collection();a.filter(function(C){return!l[C.id()]}).forEach(function(C){C.isParent()?m.merge(C):C.remove()}),m.forEach(function(C){return C.children().move({parent:null})}),m.forEach(function(C){return i(C).remove()})}t.style&&n.style(t.style),t.zoom!=null&&t.zoom!==r.zoom&&n.zoom(t.zoom),t.pan&&(t.pan.x!==r.pan.x||t.pan.y!==r.pan.y)&&n.pan(t.pan),t.data&&n.data(t.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<y.length;x++){var b=y[x];t[b]!=null&&n[b](t[b])}return n.endBatch(),this}else{var w=!!t,S={};w?S.elements=this.elements().map(function(C){return C.json()}):(S.elements={},a.forEach(function(C){var T=C.group();S.elements[T]||(S.elements[T]=[]),S.elements[T].push(C.json())})),this._private.styleEnabled&&(S.style=n.style().json()),S.data=vi(n.data());var N=r.options;return S.zoomingEnabled=r.zoomingEnabled,S.userZoomingEnabled=r.userZoomingEnabled,S.zoom=r.zoom,S.minZoom=r.minZoom,S.maxZoom=r.maxZoom,S.panningEnabled=r.panningEnabled,S.userPanningEnabled=r.userPanningEnabled,S.pan=vi(r.pan),S.boxSelectionEnabled=r.boxSelectionEnabled,S.renderer=vi(N.renderer),S.hideEdgesOnViewport=N.hideEdgesOnViewport,S.textureOnViewport=N.textureOnViewport,S.wheelSensitivity=N.wheelSensitivity,S.motionBlur=N.motionBlur,S.multiClickDebounceTime=N.multiClickDebounceTime,S}}});Op.$id=Op.getElementById;[hJ,yJ,wL,u1,rp,bJ,c1,ap,EJ,_o,yd].forEach(function(e){at(Op,e)});var NJ={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}},kJ={maximal:!1,acyclic:!1},Au=function(t){return t.scratch("breadthfirst")},rA=function(t,n){return t.scratch("breadthfirst",n)};function SL(e){this.options=at({},NJ,kJ,e)}SL.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(Ve){return Ve.isChildless()}),a=n,i=e.directed,l=e.acyclic||e.maximal||e.maximalAdjustments>0,o=!!e.boundingBox,f=_r(o?e.boundingBox:structuredClone(t.extent())),c;if(da(e.roots))c=e.roots;else if(Qt(e.roots)){for(var h=[],p=0;p<e.roots.length;p++){var m=e.roots[p],y=t.getElementById(m);h.push(y)}c=t.collection(h)}else if(tt(e.roots))c=t.$(e.roots);else if(i)c=r.roots();else{var x=n.components();c=t.collection();for(var b=function(){var De=x[w],Ye=De.maxDegree(!1),Qe=De.filter(function(st){return st.degree(!1)===Ye});c=c.add(Qe)},w=0;w<x.length;w++)b()}var S=[],N={},C=function(De,Ye){S[Ye]==null&&(S[Ye]=[]);var Qe=S[Ye].length;S[Ye].push(De),rA(De,{index:Qe,depth:Ye})},T=function(De,Ye){var Qe=Au(De),st=Qe.depth,ze=Qe.index;S[st][ze]=null,De.isChildless()&&C(De,Ye)};a.bfs({roots:c,directed:e.directed,visit:function(De,Ye,Qe,st,ze){var dt=De[0],ve=dt.id();dt.isChildless()&&C(dt,ze),N[ve]=!0}});for(var R=[],A=0;A<r.length;A++){var D=r[A];N[D.id()]||R.push(D)}var O=function(De){for(var Ye=S[De],Qe=0;Qe<Ye.length;Qe++){var st=Ye[Qe];if(st==null){Ye.splice(Qe,1),Qe--;continue}rA(st,{depth:De,index:Qe})}},L=function(De,Ye){for(var Qe=Au(De),st=De.incomers().filter(function(_e){return _e.isNode()&&n.has(_e)}),ze=-1,dt=De.id(),ve=0;ve<st.length;ve++){var Ce=st[ve],Me=Au(Ce);ze=Math.max(ze,Me.depth)}if(Qe.depth<=ze){if(!e.acyclic&&Ye[dt])return null;var Ie=ze+1;return T(De,Ie),Ye[dt]=Ie,!0}return!1};if(i&&l){var M=[],B={},P=function(De){return M.push(De)},q=function(){return M.shift()};for(r.forEach(function(Ve){return M.push(Ve)});M.length>0;){var H=q(),G=L(H,B);if(G)H.outgoers().filter(function(Ve){return Ve.isNode()&&n.has(Ve)}).forEach(P);else if(G===null){zt("Detected double maximal shift for node `"+H.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var F=0;if(e.avoidOverlap)for(var V=0;V<r.length;V++){var Y=r[V],Q=Y.layoutDimensions(e),I=Q.w,U=Q.h;F=Math.max(F,I,U)}var X={},z=function(De){if(X[De.id()])return X[De.id()];for(var Ye=Au(De).depth,Qe=De.neighborhood(),st=0,ze=0,dt=0;dt<Qe.length;dt++){var ve=Qe[dt];if(!(ve.isEdge()||ve.isParent()||!r.has(ve))){var Ce=Au(ve);if(Ce!=null){var Me=Ce.index,Ie=Ce.depth;if(!(Me==null||Ie==null)){var _e=S[Ie].length;Ie<Ye&&(st+=Me/_e,ze++)}}}}return ze=Math.max(1,ze),st=st/ze,ze===0&&(st=0),X[De.id()]=st,st},Z=function(De,Ye){var Qe=z(De),st=z(Ye),ze=Qe-st;return ze===0?EO(De.id(),Ye.id()):ze};e.depthSort!==void 0&&(Z=e.depthSort);for(var re=S.length,ae=0;ae<re;ae++)S[ae].sort(Z),O(ae);for(var se=[],le=0;le<R.length;le++)se.push(R[le]);var ie=function(){for(var De=0;De<re;De++)O(De)};se.length&&(S.unshift(se),re=S.length,ie());for(var W=0,te=0;te<re;te++)W=Math.max(S[te].length,W);var oe={x:f.x1+f.w/2,y:f.y1+f.h/2},ye=r.reduce(function(Ve,De){return(function(Ye){return{w:Ve.w===-1?Ye.w:(Ve.w+Ye.w)/2,h:Ve.h===-1?Ye.h:(Ve.h+Ye.h)/2}})(De.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Te=Math.max(re===1?0:o?(f.h-e.padding*2-ye.h)/(re-1):(f.h-e.padding*2-ye.h)/(re+1),F),Be=S.reduce(function(Ve,De){return Math.max(Ve,De.length)},0),ot=function(De){var Ye=Au(De),Qe=Ye.depth,st=Ye.index;if(e.circle){var ze=Math.min(f.w/2/re,f.h/2/re);ze=Math.max(ze,F);var dt=ze*Qe+ze-(re>0&&S[0].length<=3?ze/2:0),ve=2*Math.PI/S[Qe].length*st;return Qe===0&&S[0].length===1&&(dt=1),{x:oe.x+dt*Math.cos(ve),y:oe.y+dt*Math.sin(ve)}}else{var Ce=S[Qe].length,Me=Math.max(Ce===1?0:o?(f.w-e.padding*2-ye.w)/((e.grid?Be:Ce)-1):(f.w-e.padding*2-ye.w)/((e.grid?Be:Ce)+1),F),Ie={x:oe.x+(st+1-(Ce+1)/2)*Me,y:oe.y+(Qe+1-(re+1)/2)*Te};return Ie}},Je={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Je).indexOf(e.direction)===-1&&dn("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Je).join(", ")));var We=function(De){return qX(ot(De),f,Je[e.direction])};return n.nodes().layoutPositions(this,e,We),this};var TJ={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function EL(e){this.options=at({},TJ,e)}EL.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var l=_r(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:l.x1+l.w/2,y:l.y1+l.h/2},f=t.sweep===void 0?2*Math.PI-2*Math.PI/i.length:t.sweep,c=f/Math.max(1,i.length-1),h,p=0,m=0;m<i.length;m++){var y=i[m],x=y.layoutDimensions(t),b=x.w,w=x.h;p=Math.max(p,b,w)}if(Re(t.radius)?h=t.radius:i.length<=1?h=0:h=Math.min(l.h,l.w)/2-p,i.length>1&&t.avoidOverlap){p*=1.75;var S=Math.cos(c)-Math.cos(0),N=Math.sin(c)-Math.sin(0),C=Math.sqrt(p*p/(S*S+N*N));h=Math.max(C,h)}var T=function(A,D){var O=t.startAngle+D*c*(a?1:-1),L=h*Math.cos(O),M=h*Math.sin(O),B={x:o.x+L,y:o.y+M};return B};return r.nodes().layoutPositions(this,t,T),this};var jJ={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(t){return t.degree()},levelWidth:function(t){return t.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function CL(e){this.options=at({},jJ,e)}CL.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),l=_r(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:l.x1+l.w/2,y:l.y1+l.h/2},f=[],c=0,h=0;h<i.length;h++){var p=i[h],m=void 0;m=t.concentric(p),f.push({value:m,node:p}),p._private.scratch.concentric=m}i.updateStyle();for(var y=0;y<i.length;y++){var x=i[y],b=x.layoutDimensions(t);c=Math.max(c,b.w,b.h)}f.sort(function(Te,Be){return Be.value-Te.value});for(var w=t.levelWidth(i),S=[[]],N=S[0],C=0;C<f.length;C++){var T=f[C];if(N.length>0){var R=Math.abs(N[0].value-T.value);R>=w&&(N=[],S.push(N))}N.push(T)}var A=c+t.minNodeSpacing;if(!t.avoidOverlap){var D=S.length>0&&S[0].length>1,O=Math.min(l.w,l.h)/2-A,L=O/(S.length+D?1:0);A=Math.min(A,L)}for(var M=0,B=0;B<S.length;B++){var P=S[B],q=t.sweep===void 0?2*Math.PI-2*Math.PI/P.length:t.sweep,H=P.dTheta=q/Math.max(1,P.length-1);if(P.length>1&&t.avoidOverlap){var G=Math.cos(H)-Math.cos(0),F=Math.sin(H)-Math.sin(0),V=Math.sqrt(A*A/(G*G+F*F));M=Math.max(V,M)}P.r=M,M+=A}if(t.equidistant){for(var Y=0,Q=0,I=0;I<S.length;I++){var U=S[I],X=U.r-Q;Y=Math.max(Y,X)}Q=0;for(var z=0;z<S.length;z++){var Z=S[z];z===0&&(Q=Z.r),Z.r=Q,Q+=Y}}for(var re={},ae=0;ae<S.length;ae++)for(var se=S[ae],le=se.dTheta,ie=se.r,W=0;W<se.length;W++){var te=se[W],oe=t.startAngle+(n?1:-1)*le*W,ye={x:o.x+ie*Math.cos(oe),y:o.y+ie*Math.sin(oe)};re[te.node.id()]=ye}return a.nodes().layoutPositions(this,t,function(Te){var Be=Te.id();return re[Be]}),this};var Z0,AJ={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(t,n){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(t){return 2048},nodeOverlap:4,idealEdgeLength:function(t){return 32},edgeElasticity:function(t){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Mm(e){this.options=at({},AJ,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var i=a.source().data("id"),l=a.target().data("id"),o=t.some(function(c){return c.data("id")===i}),f=t.some(function(c){return c.data("id")===l});return!o||!f});this.options.eles=this.options.eles.not(r)}Mm.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?Z0=!0:Z0=!1;var r=RJ(t,n,e);Z0&&MJ(r),e.randomize&&_J(r);var a=fs(),i=function(){OJ(r,t,e),e.fit===!0&&t.fit(e.padding)},l=function(m){return!(n.stopped||m>=e.numIter||(LJ(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},o=function(){if(e.animate===!0||e.animate===!1)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var m=e.eles.nodes(),y=kL(r,e,m);m.layoutPositions(n,e,y)}},f=0,c=!0;if(e.animate===!0){var h=function(){for(var m=0;c&&m<e.refresh;)c=l(f),f++,m++;if(!c)iA(r,e),o();else{var y=fs();y-a>=e.animationThreshold&&i(),jp(h)}};h()}else{for(;c;)c=l(f),f++;iA(r,e),o()}return this};Mm.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Mm.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var RJ=function(t,n,r){for(var a=r.eles.edges(),i=r.eles.nodes(),l=_r(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:r.initialTemp,clientWidth:l.w,clientHeight:l.h,boundingBox:l},f=r.eles.components(),c={},h=0;h<f.length;h++)for(var p=f[h],m=0;m<p.length;m++){var y=p[m];c[y.id()]=h}for(var h=0;h<o.nodeSize;h++){var x=i[h],b=x.layoutDimensions(r),w={};w.isLocked=x.locked(),w.id=x.data("id"),w.parentId=x.data("parent"),w.cmptId=c[x.id()],w.children=[],w.positionX=x.position("x"),w.positionY=x.position("y"),w.offsetX=0,w.offsetY=0,w.height=b.w,w.width=b.h,w.maxX=w.positionX+w.width/2,w.minX=w.positionX-w.width/2,w.maxY=w.positionY+w.height/2,w.minY=w.positionY-w.height/2,w.padLeft=parseFloat(x.style("padding")),w.padRight=parseFloat(x.style("padding")),w.padTop=parseFloat(x.style("padding")),w.padBottom=parseFloat(x.style("padding")),w.nodeRepulsion=gn(r.nodeRepulsion)?r.nodeRepulsion(x):r.nodeRepulsion,o.layoutNodes.push(w),o.idToIndex[w.id]=h}for(var S=[],N=0,C=-1,T=[],h=0;h<o.nodeSize;h++){var x=o.layoutNodes[h],R=x.parentId;R!=null?o.layoutNodes[o.idToIndex[R]].children.push(x.id):(S[++C]=x.id,T.push(x.id))}for(o.graphSet.push(T);N<=C;){var A=S[N++],D=o.idToIndex[A],y=o.layoutNodes[D],O=y.children;if(O.length>0){o.graphSet.push(O);for(var h=0;h<O.length;h++)S[++C]=O[h]}}for(var h=0;h<o.graphSet.length;h++)for(var L=o.graphSet[h],m=0;m<L.length;m++){var M=o.idToIndex[L[m]];o.indexToGraph[M]=h}for(var h=0;h<o.edgeSize;h++){var B=a[h],P={};P.id=B.data("id"),P.sourceId=B.data("source"),P.targetId=B.data("target");var q=gn(r.idealEdgeLength)?r.idealEdgeLength(B):r.idealEdgeLength,H=gn(r.edgeElasticity)?r.edgeElasticity(B):r.edgeElasticity,G=o.idToIndex[P.sourceId],F=o.idToIndex[P.targetId],V=o.indexToGraph[G],Y=o.indexToGraph[F];if(V!=Y){for(var Q=DJ(P.sourceId,P.targetId,o),I=o.graphSet[Q],U=0,w=o.layoutNodes[G];I.indexOf(w.id)===-1;)w=o.layoutNodes[o.idToIndex[w.parentId]],U++;for(w=o.layoutNodes[F];I.indexOf(w.id)===-1;)w=o.layoutNodes[o.idToIndex[w.parentId]],U++;q*=U*r.nestingFactor}P.idealLength=q,P.elasticity=H,o.layoutEdges.push(P)}return o},DJ=function(t,n,r){var a=NL(t,n,0,r);return 2>a.count?0:a.graph},NL=function(t,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(t)&&-1<i.indexOf(n))return{count:2,graph:r};for(var l=0,o=0;o<i.length;o++){var f=i[o],c=a.idToIndex[f],h=a.layoutNodes[c].children;if(h.length!==0){var p=a.indexToGraph[a.idToIndex[h[0]]],m=NL(t,n,p,a);if(m.count!==0)if(m.count===1){if(l++,l===2)break}else return m}}return{count:l,graph:r}},MJ,_J=function(t,n){for(var r=t.clientWidth,a=t.clientHeight,i=0;i<t.nodeSize;i++){var l=t.layoutNodes[i];l.children.length===0&&!l.isLocked&&(l.positionX=Math.random()*r,l.positionY=Math.random()*a)}},kL=function(t,n,r){var a=t.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return n.boundingBox&&(r.forEach(function(l){var o=t.layoutNodes[t.idToIndex[l.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(l,o){var f=t.layoutNodes[t.idToIndex[l.data("id")]];if(n.boundingBox){var c=i.w===0?.5:(f.positionX-i.x1)/i.w,h=i.h===0?.5:(f.positionY-i.y1)/i.h;return{x:a.x1+c*a.w,y:a.y1+h*a.h}}else return{x:f.positionX,y:f.positionY}}},OJ=function(t,n,r){var a=r.layout,i=r.eles.nodes(),l=kL(t,r,i);i.positions(l),t.ready!==!0&&(t.ready=!0,a.one("layoutready",r.ready),a.emit({type:"layoutready",layout:this}))},LJ=function(t,n,r){PJ(t,n),IJ(t),FJ(t,n),UJ(t),qJ(t)},PJ=function(t,n){for(var r=0;r<t.graphSet.length;r++)for(var a=t.graphSet[r],i=a.length,l=0;l<i;l++)for(var o=t.layoutNodes[t.idToIndex[a[l]]],f=l+1;f<i;f++){var c=t.layoutNodes[t.idToIndex[a[f]]];BJ(o,c,t,n)}},aA=function(t){return-1+2*t*Math.random()},BJ=function(t,n,r,a){var i=t.cmptId,l=n.cmptId;if(!(i!==l&&!r.isCompound)){var o=n.positionX-t.positionX,f=n.positionY-t.positionY,c=1;o===0&&f===0&&(o=aA(c),f=aA(c));var h=zJ(t,n,o,f);if(h>0)var p=a.nodeOverlap*h,m=Math.sqrt(o*o+f*f),y=p*o/m,x=p*f/m;else var b=Lp(t,o,f),w=Lp(n,-1*o,-1*f),S=w.x-b.x,N=w.y-b.y,C=S*S+N*N,m=Math.sqrt(C),p=(t.nodeRepulsion+n.nodeRepulsion)/C,y=p*S/m,x=p*N/m;t.isLocked||(t.offsetX-=y,t.offsetY-=x),n.isLocked||(n.offsetX+=y,n.offsetY+=x)}},zJ=function(t,n,r,a){if(r>0)var i=t.maxX-n.minX;else var i=n.maxX-t.minX;if(a>0)var l=t.maxY-n.minY;else var l=n.maxY-t.minY;return i>=0&&l>=0?Math.sqrt(i*i+l*l):0},Lp=function(t,n,r){var a=t.positionX,i=t.positionY,l=t.height||1,o=t.width||1,f=r/n,c=l/o,h={};return n===0&&0<r||n===0&&0>r?(h.x=a,h.y=i+l/2,h):0<n&&-1*c<=f&&f<=c?(h.x=a+o/2,h.y=i+o*r/2/n,h):0>n&&-1*c<=f&&f<=c?(h.x=a-o/2,h.y=i-o*r/2/n,h):0<r&&(f<=-1*c||f>=c)?(h.x=a+l*n/2/r,h.y=i+l/2,h):(0>r&&(f<=-1*c||f>=c)&&(h.x=a-l*n/2/r,h.y=i-l/2),h)},IJ=function(t,n){for(var r=0;r<t.edgeSize;r++){var a=t.layoutEdges[r],i=t.idToIndex[a.sourceId],l=t.layoutNodes[i],o=t.idToIndex[a.targetId],f=t.layoutNodes[o],c=f.positionX-l.positionX,h=f.positionY-l.positionY;if(!(c===0&&h===0)){var p=Lp(l,c,h),m=Lp(f,-1*c,-1*h),y=m.x-p.x,x=m.y-p.y,b=Math.sqrt(y*y+x*x),w=Math.pow(a.idealLength-b,2)/a.elasticity;if(b!==0)var S=w*y/b,N=w*x/b;else var S=0,N=0;l.isLocked||(l.offsetX+=S,l.offsetY+=N),f.isLocked||(f.offsetX-=S,f.offsetY-=N)}}},FJ=function(t,n){if(n.gravity!==0)for(var r=1,a=0;a<t.graphSet.length;a++){var i=t.graphSet[a],l=i.length;if(a===0)var o=t.clientHeight/2,f=t.clientWidth/2;else var c=t.layoutNodes[t.idToIndex[i[0]]],h=t.layoutNodes[t.idToIndex[c.parentId]],o=h.positionX,f=h.positionY;for(var p=0;p<l;p++){var m=t.layoutNodes[t.idToIndex[i[p]]];if(!m.isLocked){var y=o-m.positionX,x=f-m.positionY,b=Math.sqrt(y*y+x*x);if(b>r){var w=n.gravity*y/b,S=n.gravity*x/b;m.offsetX+=w,m.offsetY+=S}}}}},UJ=function(t,n){var r=[],a=0,i=-1;for(r.push.apply(r,t.graphSet[0]),i+=t.graphSet[0].length;a<=i;){var l=r[a++],o=t.idToIndex[l],f=t.layoutNodes[o],c=f.children;if(0<c.length&&!f.isLocked){for(var h=f.offsetX,p=f.offsetY,m=0;m<c.length;m++){var y=t.layoutNodes[t.idToIndex[c[m]]];y.offsetX+=h,y.offsetY+=p,r[++i]=c[m]}f.offsetX=0,f.offsetY=0}}},qJ=function(t,n){for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];if(!(0<a.children.length||a.isLocked)){var i=VJ(a.offsetX,a.offsetY,t.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,TL(a,t)}}for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},VJ=function(t,n,r){var a=Math.sqrt(t*t+n*n);if(a>r)var i={x:r*t/a,y:r*n/a};else var i={x:t,y:n};return i},TL=function(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],i=!1;if((a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(a.minX==null||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,i=!0),(a.maxY==null||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(a.minY==null||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,i=!0),i)return TL(a,n)}},iA=function(t,n){for(var r=t.layoutNodes,a=[],i=0;i<r.length;i++){var l=r[i],o=l.cmptId,f=a[o]=a[o]||[];f.push(l)}for(var c=0,i=0;i<a.length;i++){var h=a[i];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var p=0;p<h.length;p++){var m=h[p];h.x1=Math.min(h.x1,m.positionX-m.width/2),h.x2=Math.max(h.x2,m.positionX+m.width/2),h.y1=Math.min(h.y1,m.positionY-m.height/2),h.y2=Math.max(h.y2,m.positionY+m.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,c+=h.w*h.h}}a.sort(function(N,C){return C.w*C.h-N.w*N.h});for(var y=0,x=0,b=0,w=0,S=Math.sqrt(c)*t.clientWidth/t.clientHeight,i=0;i<a.length;i++){var h=a[i];if(h){for(var p=0;p<h.length;p++){var m=h[p];m.isLocked||(m.positionX+=y-h.x1,m.positionY+=x-h.y1)}y+=h.w+n.componentSpacing,b+=h.w+n.componentSpacing,w=Math.max(w,h.h),b>S&&(x+=w+n.componentSpacing,y=0,b=0,w=0)}}},HJ={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(t){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function jL(e){this.options=at({},HJ,e)}jL.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=_r(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,t,function(z){return{x:i.x1,y:i.y1}});else{var l=a.size(),o=Math.sqrt(l*i.h/i.w),f=Math.round(o),c=Math.round(i.w/i.h*o),h=function(Z){if(Z==null)return Math.min(f,c);var re=Math.min(f,c);re==f?f=Z:c=Z},p=function(Z){if(Z==null)return Math.max(f,c);var re=Math.max(f,c);re==f?f=Z:c=Z},m=t.rows,y=t.cols!=null?t.cols:t.columns;if(m!=null&&y!=null)f=m,c=y;else if(m!=null&&y==null)f=m,c=Math.ceil(l/f);else if(m==null&&y!=null)c=y,f=Math.ceil(l/c);else if(c*f>l){var x=h(),b=p();(x-1)*b>=l?h(x-1):(b-1)*x>=l&&p(b-1)}else for(;c*f<l;){var w=h(),S=p();(S+1)*w>=l?p(S+1):h(w+1)}var N=i.w/c,C=i.h/f;if(t.condense&&(N=0,C=0),t.avoidOverlap)for(var T=0;T<a.length;T++){var R=a[T],A=R._private.position;(A.x==null||A.y==null)&&(A.x=0,A.y=0);var D=R.layoutDimensions(t),O=t.avoidOverlapPadding,L=D.w+O,M=D.h+O;N=Math.max(N,L),C=Math.max(C,M)}for(var B={},P=function(Z,re){return!!B["c-"+Z+"-"+re]},q=function(Z,re){B["c-"+Z+"-"+re]=!0},H=0,G=0,F=function(){G++,G>=c&&(G=0,H++)},V={},Y=0;Y<a.length;Y++){var Q=a[Y],I=t.position(Q);if(I&&(I.row!==void 0||I.col!==void 0)){var U={row:I.row,col:I.col};if(U.col===void 0)for(U.col=0;P(U.row,U.col);)U.col++;else if(U.row===void 0)for(U.row=0;P(U.row,U.col);)U.row++;V[Q.id()]=U,q(U.row,U.col)}}var X=function(Z,re){var ae,se;if(Z.locked()||Z.isParent())return!1;var le=V[Z.id()];if(le)ae=le.col*N+N/2+i.x1,se=le.row*C+C/2+i.y1;else{for(;P(H,G);)F();ae=G*N+N/2+i.x1,se=H*C+C/2+i.y1,q(H,G),F()}return{x:ae,y:se}};a.layoutPositions(this,t,X)}return this};var GJ={ready:function(){},stop:function(){}};function Zw(e){this.options=at({},GJ,e)}Zw.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this};Zw.prototype.stop=function(){return this};var $J={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function AL(e){this.options=at({},$J,e)}AL.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=gn(e.positions);function a(i){if(e.positions==null)return vQ(i.position());if(r)return e.positions(i);var l=e.positions[i._private.data.id];return l??null}return n.layoutPositions(this,e,function(i,l){var o=a(i);return i.locked()||o==null?!1:o}),this};var KJ={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function RL(e){this.options=at({},KJ,e)}RL.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=_r(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(l,o){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var YJ=[{name:"breadthfirst",impl:SL},{name:"circle",impl:EL},{name:"concentric",impl:CL},{name:"cose",impl:Mm},{name:"grid",impl:jL},{name:"null",impl:Zw},{name:"preset",impl:AL},{name:"random",impl:RL}];function DL(e){this.options=e,this.notifications=0}var sA=function(){},lA=function(){throw new Error("A headless instance can not render images")};DL.prototype={recalculateRenderedStyle:sA,notify:function(){this.notifications++},init:sA,isHeadless:function(){return!0},png:lA,jpg:lA};var Jw={};Jw.arrowShapeWidth=.3;Jw.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(c,h,p,m,y,x,b){var w=y.x-p/2-b,S=y.x+p/2+b,N=y.y-p/2-b,C=y.y+p/2+b,T=w<=c&&c<=S&&N<=h&&h<=C;return T},r=function(c,h,p,m,y){var x=c*Math.cos(m)-h*Math.sin(m),b=c*Math.sin(m)+h*Math.cos(m),w=x*p,S=b*p,N=w+y.x,C=S+y.y;return{x:N,y:C}},a=function(c,h,p,m){for(var y=[],x=0;x<c.length;x+=2){var b=c[x],w=c[x+1];y.push(r(b,w,h,p,m))}return y},i=function(c){for(var h=[],p=0;p<c.length;p++){var m=c[p];h.push(m.x,m.y)}return h},l=function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").pfValue*2},o=function(c,h){tt(h)&&(h=e[h]),e[c]=at({name:c,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(m,y,x,b,w,S){var N=i(a(this.points,x+2*S,b,w)),C=Yr(m,y,N);return C},roughCollide:n,draw:function(m,y,x,b){var w=a(this.points,y,x,b);t.arrowShapeImpl("polygon")(m,w)},spacing:function(m){return 0},gap:l},h)};o("none",{collide:Ap,roughCollide:Ap,draw:zw,spacing:wT,gap:wT}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(c,h,p,m,y){var x=a(this.points,h,p,m),b=this.controlPoint,w=r(b[0],b[1],h,p,m);t.arrowShapeImpl(this.name)(c,x,w)},gap:function(c){return l(c)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(c,h,p,m,y,x,b){var w=i(a(this.points,p+2*b,m,y)),S=i(a(this.pointsTee,p+2*b,m,y)),N=Yr(c,h,w)||Yr(c,h,S);return N},draw:function(c,h,p,m,y){var x=a(this.points,h,p,m),b=a(this.pointsTee,h,p,m);t.arrowShapeImpl(this.name)(c,x,b)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(c,h,p,m,y,x,b){var w=y,S=Math.pow(w.x-c,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*b)*this.radius,2),N=i(a(this.points,p+2*b,m,y));return Yr(c,h,N)||S},draw:function(c,h,p,m,y){var x=a(this.pointsTr,h,p,m);t.arrowShapeImpl(this.name)(c,x,m.x,m.y,this.radius*h)},spacing:function(c){return t.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(c,h){var p=this.baseCrossLinePts.slice(),m=h/c,y=3,x=5;return p[y]=p[y]-m,p[x]=p[x]-m,p},collide:function(c,h,p,m,y,x,b){var w=i(a(this.points,p+2*b,m,y)),S=i(a(this.crossLinePts(p,x),p+2*b,m,y)),N=Yr(c,h,w)||Yr(c,h,S);return N},draw:function(c,h,p,m,y){var x=a(this.points,h,p,m),b=a(this.crossLinePts(h,y),h,p,m);t.arrowShapeImpl(this.name)(c,x,b)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(c){return l(c)*.525}}),o("circle",{radius:.15,collide:function(c,h,p,m,y,x,b){var w=y,S=Math.pow(w.x-c,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*b)*this.radius,2);return S},draw:function(c,h,p,m,y){t.arrowShapeImpl(this.name)(c,m.x,m.y,this.radius*h)},spacing:function(c){return t.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(c){return 1},gap:function(c){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(c){return .95*c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}})};var Bo={};Bo.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],l=r[4],o=n.pan(),f=n.zoom(),c=((e-a)/l-o.x)/f,h=((t-i)/l-o.y)/f;return[c,h]};Bo.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(S){return parseFloat(n.getPropertyValue(S))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},l=e.clientWidth,o=e.clientHeight,f=a.left+a.right,c=a.top+a.bottom,h=i.left+i.right,p=t.width/(l+h),m=l-f,y=o-c,x=t.left+a.left+i.left,b=t.top+a.top+i.top;return this.containerBB=[x,b,m,y,p]};Bo.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Bo.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]};Bo.findNearestElements=function(e,t,n,r){var a=this,i=this,l=i.getCachedZSortedEles(),o=[],f=i.cy.zoom(),c=i.cy.hasCompoundNodes(),h=(r?24:8)/f,p=(r?8:2)/f,m=(r?8:2)/f,y=1/0,x,b;n&&(l=l.interactive);function w(D,O){if(D.isNode()){if(b)return;b=D,o.push(D)}if(D.isEdge()&&(O==null||O<y))if(x){if(x.pstyle("z-compound-depth").value===D.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===D.pstyle("z-compound-depth").value){for(var L=0;L<o.length;L++)if(o[L].isEdge()){o[L]=D,x=D,y=O??y;break}}}else o.push(D),x=D,y=O??y}function S(D){var O=D.outerWidth()+2*p,L=D.outerHeight()+2*p,M=O/2,B=L/2,P=D.position(),q=D.pstyle("corner-radius").value==="auto"?"auto":D.pstyle("corner-radius").pfValue,H=D._private.rscratch;if(P.x-M<=e&&e<=P.x+M&&P.y-B<=t&&t<=P.y+B){var G=i.nodeShapes[a.getNodeShape(D)];if(G.checkPoint(e,t,0,O,L,P.x,P.y,q,H))return w(D,0),!0}}function N(D){var O=D._private,L=O.rscratch,M=D.pstyle("width").pfValue,B=D.pstyle("arrow-scale").value,P=M/2+h,q=P*P,H=P*2,Y=O.source,Q=O.target,G;if(L.edgeType==="segments"||L.edgeType==="straight"||L.edgeType==="haystack"){for(var F=L.allpts,V=0;V+3<F.length;V+=2)if(jQ(e,t,F[V],F[V+1],F[V+2],F[V+3],H)&&q>(G=_Q(e,t,F[V],F[V+1],F[V+2],F[V+3])))return w(D,G),!0}else if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"){for(var F=L.allpts,V=0;V+5<L.allpts.length;V+=4)if(AQ(e,t,F[V],F[V+1],F[V+2],F[V+3],F[V+4],F[V+5],H)&&q>(G=MQ(e,t,F[V],F[V+1],F[V+2],F[V+3],F[V+4],F[V+5])))return w(D,G),!0}for(var Y=Y||O.source,Q=Q||O.target,I=a.getArrowWidth(M,B),U=[{name:"source",x:L.arrowStartX,y:L.arrowStartY,angle:L.srcArrowAngle},{name:"target",x:L.arrowEndX,y:L.arrowEndY,angle:L.tgtArrowAngle},{name:"mid-source",x:L.midX,y:L.midY,angle:L.midsrcArrowAngle},{name:"mid-target",x:L.midX,y:L.midY,angle:L.midtgtArrowAngle}],V=0;V<U.length;V++){var X=U[V],z=i.arrowShapes[D.pstyle(X.name+"-arrow-shape").value],Z=D.pstyle("width").pfValue;if(z.roughCollide(e,t,I,X.angle,{x:X.x,y:X.y},Z,h)&&z.collide(e,t,I,X.angle,{x:X.x,y:X.y},Z,h))return w(D),!0}c&&o.length>0&&(S(Y),S(Q))}function C(D,O,L){return Kr(D,O,L)}function T(D,O){var L=D._private,M=m,B;O?B=O+"-":B="",D.boundingBox();var P=L.labelBounds[O||"main"],q=D.pstyle(B+"label").value,H=D.pstyle("text-events").strValue==="yes";if(!(!H||!q)){var G=C(L.rscratch,"labelX",O),F=C(L.rscratch,"labelY",O),V=C(L.rscratch,"labelAngle",O),Y=D.pstyle(B+"text-margin-x").pfValue,Q=D.pstyle(B+"text-margin-y").pfValue,I=P.x1-M-Y,U=P.x2+M-Y,X=P.y1-M-Q,z=P.y2+M-Q;if(V){var Z=Math.cos(V),re=Math.sin(V),ae=function(ye,Te){return ye=ye-G,Te=Te-F,{x:ye*Z-Te*re+G,y:ye*re+Te*Z+F}},se=ae(I,X),le=ae(I,z),ie=ae(U,X),W=ae(U,z),te=[se.x+Y,se.y+Q,ie.x+Y,ie.y+Q,W.x+Y,W.y+Q,le.x+Y,le.y+Q];if(Yr(e,t,te))return w(D),!0}else if(hl(P,e,t))return w(D),!0}}for(var R=l.length-1;R>=0;R--){var A=l[R];A.isNode()?S(A)||T(A):N(A)||T(A)||T(A,"source")||T(A,"target")}return o};Bo.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),l=2/i,o=[],f=Math.min(e,n),c=Math.max(e,n),h=Math.min(t,r),p=Math.max(t,r);e=f,n=c,t=h,r=p;var m=_r({x1:e,y1:t,x2:n,y2:r}),y=[{x:m.x1,y:m.y1},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2},{x:m.x1,y:m.y2}],x=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function b(ye,Te,Be){return Kr(ye,Te,Be)}function w(ye,Te){var Be=ye._private,ot=l,Je="";ye.boundingBox();var We=Be.labelBounds.main;if(!We)return null;var Ve=b(Be.rscratch,"labelX",Te),De=b(Be.rscratch,"labelY",Te),Ye=b(Be.rscratch,"labelAngle",Te),Qe=ye.pstyle(Je+"text-margin-x").pfValue,st=ye.pstyle(Je+"text-margin-y").pfValue,ze=We.x1-ot-Qe,dt=We.x2+ot-Qe,ve=We.y1-ot-st,Ce=We.y2+ot-st;if(Ye){var Me=Math.cos(Ye),Ie=Math.sin(Ye),_e=function(xe,K){return xe=xe-Ve,K=K-De,{x:xe*Me-K*Ie+Ve,y:xe*Ie+K*Me+De}};return[_e(ze,ve),_e(dt,ve),_e(dt,Ce),_e(ze,Ce)]}else return[{x:ze,y:ve},{x:dt,y:ve},{x:dt,y:Ce},{x:ze,y:Ce}]}function S(ye,Te,Be,ot){function Je(We,Ve,De){return(De.y-We.y)*(Ve.x-We.x)>(Ve.y-We.y)*(De.x-We.x)}return Je(ye,Be,ot)!==Je(Te,Be,ot)&&Je(ye,Te,Be)!==Je(ye,Te,ot)}for(var N=0;N<a.length;N++){var C=a[N];if(C.isNode()){var T=C,R=T.pstyle("text-events").strValue==="yes",A=T.pstyle("box-selection").strValue,D=T.pstyle("box-select-labels").strValue==="yes";if(A==="none")continue;var O=(A==="overlap"||D)&&R,L=T.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:O});if(A==="contain"){var M=!1;if(D&&R){var B=w(T);B&&Qx(B,y)&&(o.push(T),M=!0)}!M&&zO(m,L)&&o.push(T)}else if(A==="overlap"&&qw(m,L)){var P=T.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),q=[{x:P.x1,y:P.y1},{x:P.x2,y:P.y1},{x:P.x2,y:P.y2},{x:P.x1,y:P.y2}];if(Qx(q,y))o.push(T);else{var H=w(T);H&&Qx(H,y)&&o.push(T)}}}else{var G=C,F=G._private,V=F.rscratch,Y=G.pstyle("box-selection").strValue;if(Y==="none")continue;if(Y==="contain"){if(V.startX!=null&&V.startY!=null&&!hl(m,V.startX,V.startY)||V.endX!=null&&V.endY!=null&&!hl(m,V.endX,V.endY))continue;if(V.edgeType==="bezier"||V.edgeType==="multibezier"||V.edgeType==="self"||V.edgeType==="compound"||V.edgeType==="segments"||V.edgeType==="haystack"){for(var Q=F.rstyle.bezierPts||F.rstyle.linePts||F.rstyle.haystackPts,I=!0,U=0;U<Q.length;U++)if(!kT(m,Q[U])){I=!1;break}I&&o.push(G)}else V.edgeType==="straight"&&o.push(G)}else if(Y==="overlap"){var X=!1;if(V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(hl(m,V.startX,V.startY)||hl(m,V.endX,V.endY)))o.push(G),X=!0;else if(!X&&V.edgeType==="haystack"){for(var z=F.rstyle.haystackPts,Z=0;Z<z.length;Z++)if(kT(m,z[Z])){o.push(G),X=!0;break}}if(!X){var re=F.rstyle.bezierPts||F.rstyle.linePts||F.rstyle.haystackPts;if((!re||re.length<2)&&V.edgeType==="straight"&&V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(re=[{x:V.startX,y:V.startY},{x:V.endX,y:V.endY}]),!re||re.length<2)continue;for(var ae=0;ae<re.length-1;ae++){for(var se=re[ae],le=re[ae+1],ie=0;ie<x.length;ie++){var W=Pn(x[ie],2),te=W[0],oe=W[1];if(S(se,le,te,oe)){o.push(G),X=!0;break}}if(X)break}}}}}return o};var Pp={};Pp.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",a=t.edgeType==="multibezier",i=t.edgeType==="segments",l=t.edgeType==="compound",o=t.edgeType==="self",f,c,h,p,m,y,S,N;if(n?(h=t.haystackPts[0],p=t.haystackPts[1],m=t.haystackPts[2],y=t.haystackPts[3]):(h=t.arrowStartX,p=t.arrowStartY,m=t.arrowEndX,y=t.arrowEndY),S=t.midX,N=t.midY,i)f=h-t.segpts[0],c=p-t.segpts[1];else if(a||l||o||r){var x=t.allpts,b=nr(x[0],x[2],x[4],.1),w=nr(x[1],x[3],x[5],.1);f=h-b,c=p-w}else f=h-S,c=p-N;t.srcArrowAngle=Rv(f,c);var S=t.midX,N=t.midY;if(n&&(S=(h+m)/2,N=(p+y)/2),f=m-h,c=y-p,i){var x=t.allpts;if(x.length/2%2===0){var C=x.length/2,T=C-2;f=x[C]-x[T],c=x[C+1]-x[T+1]}else if(t.isRound)f=t.midVector[1],c=-t.midVector[0];else{var C=x.length/2-1,T=C-2;f=x[C]-x[T],c=x[C+1]-x[T+1]}}else if(a||l||o){var x=t.allpts,R=t.ctrlpts,A,D,O,L;if(R.length/2%2===0){var M=x.length/2-1,B=M+2,P=B+2;A=nr(x[M],x[B],x[P],0),D=nr(x[M+1],x[B+1],x[P+1],0),O=nr(x[M],x[B],x[P],1e-4),L=nr(x[M+1],x[B+1],x[P+1],1e-4)}else{var B=x.length/2-1,M=B-2,P=B+2;A=nr(x[M],x[B],x[P],.4999),D=nr(x[M+1],x[B+1],x[P+1],.4999),O=nr(x[M],x[B],x[P],.5),L=nr(x[M+1],x[B+1],x[P+1],.5)}f=O-A,c=L-D}if(t.midtgtArrowAngle=Rv(f,c),t.midDispX=f,t.midDispY=c,f*=-1,c*=-1,i){var x=t.allpts;if(x.length/2%2!==0){if(!t.isRound){var C=x.length/2-1,q=C+2;f=-(x[q]-x[C]),c=-(x[q+1]-x[C+1])}}}if(t.midsrcArrowAngle=Rv(f,c),i)f=m-t.segpts[t.segpts.length-2],c=y-t.segpts[t.segpts.length-1];else if(a||l||o||r){var x=t.allpts,H=x.length,b=nr(x[H-6],x[H-4],x[H-2],.9),w=nr(x[H-5],x[H-3],x[H-1],.9);f=m-b,c=y-w}else f=m-S,c=y-N;t.tgtArrowAngle=Rv(f,c)};Pp.getArrowWidth=Pp.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var f1,d1,li={},Ta={},oA,uA,lo,ip,Yi,no,io,ii,Ru,zv,ML,_L,h1,v1,cA,fA=function(t,n,r){r.x=n.x-t.x,r.y=n.y-t.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},XJ=function(t,n){n.x=t.x*-1,n.y=t.y*-1,n.nx=t.nx*-1,n.ny=t.ny*-1,n.ang=t.ang>0?-(Math.PI-t.ang):Math.PI+t.ang},QJ=function(t,n,r,a,i){if(t!==cA?fA(n,t,li):XJ(Ta,li),fA(n,r,Ta),oA=li.nx*Ta.ny-li.ny*Ta.nx,uA=li.nx*Ta.nx-li.ny*-Ta.ny,Yi=Math.asin(Math.max(-1,Math.min(1,oA))),Math.abs(Yi)<1e-6){f1=n.x,d1=n.y,io=Ru=0;return}lo=1,ip=!1,uA<0?Yi<0?Yi=Math.PI+Yi:(Yi=Math.PI-Yi,lo=-1,ip=!0):Yi>0&&(lo=-1,ip=!0),n.radius!==void 0?Ru=n.radius:Ru=a,no=Yi/2,zv=Math.min(li.len/2,Ta.len/2),i?(ii=Math.abs(Math.cos(no)*Ru/Math.sin(no)),ii>zv?(ii=zv,io=Math.abs(ii*Math.sin(no)/Math.cos(no))):io=Ru):(ii=Math.min(zv,Ru),io=Math.abs(ii*Math.sin(no)/Math.cos(no))),h1=n.x+Ta.nx*ii,v1=n.y+Ta.ny*ii,f1=h1-Ta.ny*io*lo,d1=v1+Ta.nx*io*lo,ML=n.x+li.nx*ii,_L=n.y+li.ny*ii,cA=n};function OL(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function eS(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(QJ(e,t,n,r,a),{cx:f1,cy:d1,radius:io,startX:ML,startY:_L,stopX:h1,stopY:v1,startAngle:li.ang+Math.PI/2*lo,endAngle:Ta.ang-Math.PI/2*lo,counterClockwise:ip})}var bd=.01,WJ=Math.sqrt(2*bd),kr={};kr.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,i,l=e.pstyle("source-endpoint"),o=e.pstyle("target-endpoint"),f=l.units!=null&&o.units!=null,c=function(R,A,D,O){var L=O-A,M=D-R,B=Math.sqrt(M*M+L*L);return{x:-L/B,y:M/B}},h=e.pstyle("edge-distances").value;switch(h){case"node-position":i=n;break;case"intersection":i=r;break;case"endpoints":{if(f){var p=this.manualEndptToPx(e.source()[0],l),m=Pn(p,2),y=m[0],x=m[1],b=this.manualEndptToPx(e.target()[0],o),w=Pn(b,2),S=w[0],N=w[1],C={x1:y,y1:x,x2:S,y2:N};a=c(y,x,S,N),i=C}else zt("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=r;break}}return{midptPts:i,vectorNormInverse:a}};kr.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var l=r.source,o=r.target,f=l.position(),c=o.position(),h=l.width(),p=o.width(),m=l.height(),y=o.height(),x=n.pstyle("haystack-radius").value,b=x/2;a.haystackPts=a.allpts=[a.source.x*h*b+f.x,a.source.y*m*b+f.y,a.target.x*p*b+c.x,a.target.y*y*b+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}};kr.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),l=e.pstyle("radius-type"),o=Math.min(r.pfValue.length,a.pfValue.length),f=i.pfValue[i.pfValue.length-1],c=l.pfValue[l.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var h=0;h<o;h++){var p=r.pfValue[h],m=a.pfValue[h],y=1-p,x=p,b=this.findMidptPtsEtc(e,t),w=b.midptPts,S=b.vectorNormInverse,N={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};n.segpts.push(N.x+S.x*m,N.y+S.y*m),n.radii.push(i.pfValue[h]!==void 0?i.pfValue[h]:f),n.isArcRadius.push((l.pfValue[h]!==void 0?l.pfValue[h]:c)==="arc-radius")}};kr.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,l=t.srcPos,o=e.pstyle("control-point-distances"),f=o?o.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,h=e.pstyle("loop-sweep").pfValue,p=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var m=n,y=p;r&&(m=0,y=f);var x=c-Math.PI/2,b=x-h/2,w=x+h/2,S=c+"_"+h;m=i[S]===void 0?i[S]=0:++i[S],a.ctrlpts=[l.x+Math.cos(b)*1.4*y*(m/3+1),l.y+Math.sin(b)*1.4*y*(m/3+1),l.x+Math.cos(w)*1.4*y*(m/3+1),l.y+Math.sin(w)*1.4*y*(m/3+1)]};kr.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,l=t.tgtPos,o=t.srcW,f=t.srcH,c=t.tgtW,h=t.tgtH,p=e.pstyle("control-point-step-size").pfValue,m=e.pstyle("control-point-distances"),y=m?m.pfValue[0]:void 0,x=n,b=p;r&&(x=0,b=y);var w=50,S={x:i.x-o/2,y:i.y-f/2},N={x:l.x-c/2,y:l.y-h/2},C={x:Math.min(S.x,N.x),y:Math.min(S.y,N.y)},T=.5,R=Math.max(T,Math.log(o*bd)),A=Math.max(T,Math.log(c*bd));a.ctrlpts=[C.x,C.y-(1+Math.pow(w,1.12)/100)*b*(x/3+1)*R,C.x-(1+Math.pow(w,1.12)/100)*b*(x/3+1)*A,C.y]};kr.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"};kr.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,l=e.pstyle("control-point-step-size").pfValue,o=e.pstyle("control-point-distances"),f=e.pstyle("control-point-weights"),c=o&&f?Math.min(o.value.length,f.value.length):1,h=o?o.pfValue[0]:void 0,p=f.value[0],m=r;i.edgeType=m?"multibezier":"bezier",i.ctrlpts=[];for(var y=0;y<c;y++){var x=(.5-t.eles.length/2+n)*l*(a?-1:1),b=void 0,w=Uw(x);m&&(h=o?o.pfValue[y]:l,p=f.value[y]),r?b=h:b=h!==void 0?w*h:void 0;var S=b!==void 0?b:x,N=1-p,C=p,T=this.findMidptPtsEtc(e,t),R=T.midptPts,A=T.vectorNormInverse,D={x:R.x1*N+R.x2*C,y:R.y1*N+R.y2*C};i.ctrlpts.push(D.x+A.x*S,D.y+A.y*S)}};kr.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",l="rightward",o="downward",f="upward",c="auto",h=t.posPts,p=t.srcW,m=t.srcH,y=t.tgtW,x=t.tgtH,b=e.pstyle("edge-distances").value,w=b!=="node-position",S=e.pstyle("taxi-direction").value,N=S,C=e.pstyle("taxi-turn"),T=C.units==="%",R=C.pfValue,A=R<0,D=e.pstyle("taxi-turn-min-distance").pfValue,O=w?(p+y)/2:0,L=w?(m+x)/2:0,M=h.x2-h.x1,B=h.y2-h.y1,P=function(K,ce){return K>0?Math.max(K-ce,0):Math.min(K+ce,0)},q=P(M,O),H=P(B,L),G=!1;N===c?S=Math.abs(q)>Math.abs(H)?a:r:N===f||N===o?(S=r,G=!0):(N===i||N===l)&&(S=a,G=!0);var F=S===r,V=F?H:q,Y=F?B:M,Q=Uw(Y),I=!1;!(G&&(T||A))&&(N===o&&Y<0||N===f&&Y>0||N===i&&Y>0||N===l&&Y<0)&&(Q*=-1,V=Q*Math.abs(V),I=!0);var U;if(T){var X=R<0?1+R:R;U=X*V}else{var z=R<0?V:0;U=z+R*Q}var Z=function(K){return Math.abs(K)<D||Math.abs(K)>=Math.abs(V)},re=Z(U),ae=Z(Math.abs(V)-Math.abs(U)),se=re||ae;if(se&&!I)if(F){var le=Math.abs(Y)<=m/2,ie=Math.abs(M)<=y/2;if(le){var W=(h.x1+h.x2)/2,te=h.y1,oe=h.y2;n.segpts=[W,te,W,oe]}else if(ie){var ye=(h.y1+h.y2)/2,Te=h.x1,Be=h.x2;n.segpts=[Te,ye,Be,ye]}else n.segpts=[h.x1,h.y2]}else{var ot=Math.abs(Y)<=p/2,Je=Math.abs(B)<=x/2;if(ot){var We=(h.y1+h.y2)/2,Ve=h.x1,De=h.x2;n.segpts=[Ve,We,De,We]}else if(Je){var Ye=(h.x1+h.x2)/2,Qe=h.y1,st=h.y2;n.segpts=[Ye,Qe,Ye,st]}else n.segpts=[h.x2,h.y1]}else if(F){var ze=h.y1+U+(w?m/2*Q:0),dt=h.x1,ve=h.x2;n.segpts=[dt,ze,ve,ze]}else{var Ce=h.x1+U+(w?p/2*Q:0),Me=h.y1,Ie=h.y2;n.segpts=[Ce,Me,Ce,Ie]}if(n.isRound){var _e=e.pstyle("taxi-radius").value,Oe=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(_e),n.isArcRadius=new Array(n.segpts.length/2).fill(Oe)}};kr.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,i=t.srcW,l=t.srcH,o=t.tgtW,f=t.tgtH,c=t.srcShape,h=t.tgtShape,p=t.srcCornerRadius,m=t.tgtCornerRadius,y=t.srcRs,x=t.tgtRs,b=!Re(n.startX)||!Re(n.startY),w=!Re(n.arrowStartX)||!Re(n.arrowStartY),S=!Re(n.endX)||!Re(n.endY),N=!Re(n.arrowEndX)||!Re(n.arrowEndY),C=3,T=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,R=C*T,A=Do({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),D=A<R,O=Do({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),L=O<R,M=!1;if(b||w||D){M=!0;var B={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},P=Math.sqrt(B.x*B.x+B.y*B.y),q={x:B.x/P,y:B.y/P},H=Math.max(i,l),G={x:n.ctrlpts[0]+q.x*2*H,y:n.ctrlpts[1]+q.y*2*H},F=c.intersectLine(r.x,r.y,i,l,G.x,G.y,0,p,y);D?(n.ctrlpts[0]=n.ctrlpts[0]+q.x*(R-A),n.ctrlpts[1]=n.ctrlpts[1]+q.y*(R-A)):(n.ctrlpts[0]=F[0]+q.x*R,n.ctrlpts[1]=F[1]+q.y*R)}if(S||N||L){M=!0;var V={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},Y=Math.sqrt(V.x*V.x+V.y*V.y),Q={x:V.x/Y,y:V.y/Y},I=Math.max(i,l),U={x:n.ctrlpts[0]+Q.x*2*I,y:n.ctrlpts[1]+Q.y*2*I},X=h.intersectLine(a.x,a.y,o,f,U.x,U.y,0,m,x);L?(n.ctrlpts[0]=n.ctrlpts[0]+Q.x*(R-O),n.ctrlpts[1]=n.ctrlpts[1]+Q.y*(R-O)):(n.ctrlpts[0]=X[0]+Q.x*R,n.ctrlpts[1]=X[1]+Q.y*R)}M&&this.findEndpoints(e)}};kr.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,a;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,a=.5,t.midX=nr(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=nr(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var i=2;i+3<t.allpts.length;i+=2){var l=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(eS({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:l},{x:t.allpts[i+2],y:t.allpts[i+3]},l,o))}}if(t.segpts.length%4===0){var f=t.segpts.length/2,c=f-2;t.midX=(t.segpts[c]+t.segpts[f])/2,t.midY=(t.segpts[c+1]+t.segpts[f+1])/2}else{var h=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[h],t.midY=t.segpts[h+1];else{var p={x:t.segpts[h],y:t.segpts[h+1]},m=t.roundCorners[h/2];if(m.radius===0){var y={x:t.segpts[h+2],y:t.segpts[h+3]};t.midX=p.x,t.midY=p.y,t.midVector=[p.y-y.y,y.x-p.x]}else{var x=[p.x-m.cx,p.y-m.cy],b=m.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(w){return w*b}),t.midX=m.cx+x[0],t.midY=m.cy+x[1],t.midVector=x}}}}};kr.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||Re(t.startX)&&Re(t.startY)&&Re(t.endX)&&Re(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,zt("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};kr.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),i=new rs,l=function(L,M){return[].concat(kp(L),[M?1:0]).join("-")},o=[],f=[],c=0;c<e.length;c++){var h=e[c],p=h._private,m=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(m==="haystack"){f.push(h);continue}var y=m==="unbundled-bezier"||dl(m,"segments")||m==="straight"||m==="straight-triangle"||dl(m,"taxi"),x=m==="unbundled-bezier"||m==="bezier",b=p.source,w=p.target,S=b.poolIndex(),N=w.poolIndex(),C=[S,N].sort(),T=l(C,y),R=i.get(T);R==null&&(R={eles:[]},o.push({pairId:C,edgeIsUnbundled:y}),i.set(T,R)),R.eles.push(h),y&&(R.hasUnbundled=!0),x&&(R.hasBezier=!0)}}for(var A=function(){var L=o[D],M=L.pairId,B=L.edgeIsUnbundled,P=l(M,B),q=i.get(P),H;if(!q.hasUnbundled){var G=q.eles[0].parallelEdges().filter(function(Oe){return Oe.isBundledBezier()});Iw(q.eles),G.forEach(function(Oe){return q.eles.push(Oe)}),q.eles.sort(function(Oe,xe){return Oe.poolIndex()-xe.poolIndex()})}var F=q.eles[0],V=F.source(),Y=F.target();if(V.poolIndex()>Y.poolIndex()){var Q=V;V=Y,Y=Q}var I=q.srcPos=V.position(),U=q.tgtPos=Y.position(),X=q.srcW=V.outerWidth(),z=q.srcH=V.outerHeight(),Z=q.tgtW=Y.outerWidth(),re=q.tgtH=Y.outerHeight(),ae=q.srcShape=n.nodeShapes[t.getNodeShape(V)],se=q.tgtShape=n.nodeShapes[t.getNodeShape(Y)],le=q.srcCornerRadius=V.pstyle("corner-radius").value==="auto"?"auto":V.pstyle("corner-radius").pfValue,ie=q.tgtCornerRadius=Y.pstyle("corner-radius").value==="auto"?"auto":Y.pstyle("corner-radius").pfValue,W=q.tgtRs=Y._private.rscratch,te=q.srcRs=V._private.rscratch;q.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe<q.eles.length;oe++){var ye=q.eles[oe],Te=ye[0]._private.rscratch,Be=ye.pstyle("curve-style").value,ot=Be==="unbundled-bezier"||dl(Be,"segments")||dl(Be,"taxi"),Je=!V.same(ye.source());if(!q.calculatedIntersection&&V!==Y&&(q.hasBezier||q.hasUnbundled)){q.calculatedIntersection=!0;var We=ae.intersectLine(I.x,I.y,X,z,U.x,U.y,0,le,te),Ve=q.srcIntn=We,De=se.intersectLine(U.x,U.y,Z,re,I.x,I.y,0,ie,W),Ye=q.tgtIntn=De,Qe=q.intersectionPts={x1:We[0],x2:De[0],y1:We[1],y2:De[1]},st=q.posPts={x1:I.x,x2:U.x,y1:I.y,y2:U.y},ze=De[1]-We[1],dt=De[0]-We[0],ve=Math.sqrt(dt*dt+ze*ze);Re(ve)&&ve>=WJ||(ve=Math.sqrt(Math.max(dt*dt,bd)+Math.max(ze*ze,bd)));var Ce=q.vector={x:dt,y:ze},Me=q.vectorNorm={x:Ce.x/ve,y:Ce.y/ve},Ie={x:-Me.y,y:Me.x};q.nodesOverlap=!Re(ve)||se.checkPoint(We[0],We[1],0,Z,re,U.x,U.y,ie,W)||ae.checkPoint(De[0],De[1],0,X,z,I.x,I.y,le,te),q.vectorNormInverse=Ie,H={nodesOverlap:q.nodesOverlap,dirCounts:q.dirCounts,calculatedIntersection:!0,hasBezier:q.hasBezier,hasUnbundled:q.hasUnbundled,eles:q.eles,srcPos:U,srcRs:W,tgtPos:I,tgtRs:te,srcW:Z,srcH:re,tgtW:X,tgtH:z,srcIntn:Ye,tgtIntn:Ve,srcShape:se,tgtShape:ae,posPts:{x1:st.x2,y1:st.y2,x2:st.x1,y2:st.y1},intersectionPts:{x1:Qe.x2,y1:Qe.y2,x2:Qe.x1,y2:Qe.y1},vector:{x:-Ce.x,y:-Ce.y},vectorNorm:{x:-Me.x,y:-Me.y},vectorNormInverse:{x:-Ie.x,y:-Ie.y}}}var _e=Je?H:q;Te.nodesOverlap=_e.nodesOverlap,Te.srcIntn=_e.srcIntn,Te.tgtIntn=_e.tgtIntn,Te.isRound=Be.startsWith("round"),a&&(V.isParent()||V.isChild()||Y.isParent()||Y.isChild())&&(V.parents().anySame(Y)||Y.parents().anySame(V)||V.same(Y)&&V.isParent())?t.findCompoundLoopPoints(ye,_e,oe,ot):V===Y?t.findLoopPoints(ye,_e,oe,ot):Be.endsWith("segments")?t.findSegmentsPoints(ye,_e):Be.endsWith("taxi")?t.findTaxiPoints(ye,_e):Be==="straight"||!ot&&q.eles.length%2===1&&oe===Math.floor(q.eles.length/2)?t.findStraightEdgePoints(ye):t.findBezierPoints(ye,_e,oe,ot,Je),t.findEndpoints(ye),t.tryToCorrectInvalidPoints(ye,_e),t.checkForInvalidEdgeWarning(ye),t.storeAllpts(ye),t.storeEdgeProjections(ye),t.calculateArrowAngles(ye),t.recalculateEdgeLabelProjections(ye),t.calculateLabelAngles(ye)}},D=0;D<o.length;D++)A();this.findHaystackPoints(f)}};function LL(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}kr.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="segments")return LL(t.segpts)};kr.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return LL(t.ctrlpts)};kr.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Wd={};Wd.manualEndptToPx=function(e,t){var n=this,r=e.position(),a=e.outerWidth(),i=e.outerHeight(),l=e._private.rscratch;if(t.value.length===2){var o=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(o[0]=o[0]*a),t.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=r.x,o[1]+=r.y,o}else{var f=t.pfValue[0];f=-Math.PI/2+f;var c=2*Math.max(a,i),h=[r.x+Math.cos(f)*c,r.y+Math.sin(f)*c];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,i,h[0],h[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,l)}};Wd.findEndpoints=function(e){var t,n,r,a,i=this,l,o=e.source()[0],f=e.target()[0],c=o.position(),h=f.position(),p=e.pstyle("target-arrow-shape").value,m=e.pstyle("source-arrow-shape").value,y=e.pstyle("target-distance-from-node").pfValue,x=e.pstyle("source-distance-from-node").pfValue,b=o._private.rscratch,w=f._private.rscratch,S=e.pstyle("curve-style").value,N=e._private.rscratch,C=N.edgeType,T=dl(S,"taxi"),R=C==="self"||C==="compound",A=C==="bezier"||C==="multibezier"||R,D=C!=="bezier",O=C==="straight"||C==="segments",L=C==="segments",M=A||D||O,B=R||T,P=e.pstyle("source-endpoint"),q=B?"outside-to-node":P.value,H=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue,G=e.pstyle("target-endpoint"),F=B?"outside-to-node":G.value,V=f.pstyle("corner-radius").value==="auto"?"auto":f.pstyle("corner-radius").pfValue;N.srcManEndpt=P,N.tgtManEndpt=G;var Y,Q,I,U,X=(t=(G==null||(n=G.pfValue)===null||n===void 0?void 0:n.length)===2?G.pfValue:null)!==null&&t!==void 0?t:[0,0],z=(r=(P==null||(a=P.pfValue)===null||a===void 0?void 0:a.length)===2?P.pfValue:null)!==null&&r!==void 0?r:[0,0];if(A){var Z=[N.ctrlpts[0],N.ctrlpts[1]],re=D?[N.ctrlpts[N.ctrlpts.length-2],N.ctrlpts[N.ctrlpts.length-1]]:Z;Y=re,Q=Z}else if(O){var ae=L?N.segpts.slice(0,2):[h.x+X[0],h.y+X[1]],se=L?N.segpts.slice(N.segpts.length-2):[c.x+z[0],c.y+z[1]];Y=se,Q=ae}if(F==="inside-to-node")l=[h.x,h.y];else if(G.units)l=this.manualEndptToPx(f,G);else if(F==="outside-to-line")l=N.tgtIntn;else if(F==="outside-to-node"||F==="outside-to-node-or-label"?I=Y:(F==="outside-to-line"||F==="outside-to-line-or-label")&&(I=[c.x,c.y]),l=i.nodeShapes[this.getNodeShape(f)].intersectLine(h.x,h.y,f.outerWidth(),f.outerHeight(),I[0],I[1],0,V,w),F==="outside-to-node-or-label"||F==="outside-to-line-or-label"){var le=f._private.rscratch,ie=le.labelWidth,W=le.labelHeight,te=le.labelX,oe=le.labelY,ye=ie/2,Te=W/2,Be=f.pstyle("text-valign").value;Be==="top"?oe-=Te:Be==="bottom"&&(oe+=Te);var ot=f.pstyle("text-halign").value;ot==="left"?te-=ye:ot==="right"&&(te+=ye);var Je=pd(I[0],I[1],[te-ye,oe-Te,te+ye,oe-Te,te+ye,oe+Te,te-ye,oe+Te],h.x,h.y);if(Je.length>0){var We=c,Ve=ao(We,Bu(l)),De=ao(We,Bu(Je)),Ye=Ve;if(De<Ve&&(l=Je,Ye=De),Je.length>2){var Qe=ao(We,{x:Je[2],y:Je[3]});Qe<Ye&&(l=[Je[2],Je[3]])}}}var st=Dv(l,Y,i.arrowShapes[p].spacing(e)+y),ze=Dv(l,Y,i.arrowShapes[p].gap(e)+y);if(N.endX=ze[0],N.endY=ze[1],N.arrowEndX=st[0],N.arrowEndY=st[1],q==="inside-to-node")l=[c.x,c.y];else if(P.units)l=this.manualEndptToPx(o,P);else if(q==="outside-to-line")l=N.srcIntn;else if(q==="outside-to-node"||q==="outside-to-node-or-label"?U=Q:(q==="outside-to-line"||q==="outside-to-line-or-label")&&(U=[h.x,h.y]),l=i.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),U[0],U[1],0,H,b),q==="outside-to-node-or-label"||q==="outside-to-line-or-label"){var dt=o._private.rscratch,ve=dt.labelWidth,Ce=dt.labelHeight,Me=dt.labelX,Ie=dt.labelY,_e=ve/2,Oe=Ce/2,xe=o.pstyle("text-valign").value;xe==="top"?Ie-=Oe:xe==="bottom"&&(Ie+=Oe);var K=o.pstyle("text-halign").value;K==="left"?Me-=_e:K==="right"&&(Me+=_e);var ce=pd(U[0],U[1],[Me-_e,Ie-Oe,Me+_e,Ie-Oe,Me+_e,Ie+Oe,Me-_e,Ie+Oe],c.x,c.y);if(ce.length>0){var me=h,he=ao(me,Bu(l)),be=ao(me,Bu(ce)),Le=he;if(be<he&&(l=[ce[0],ce[1]],Le=be),ce.length>2){var Ne=ao(me,{x:ce[2],y:ce[3]});Ne<Le&&(l=[ce[2],ce[3]])}}}var Ke=Dv(l,Q,i.arrowShapes[m].spacing(e)+x),Fe=Dv(l,Q,i.arrowShapes[m].gap(e)+x);N.startX=Fe[0],N.startY=Fe[1],N.arrowStartX=Ke[0],N.arrowStartY=Ke[1],M&&(!Re(N.startX)||!Re(N.startY)||!Re(N.endX)||!Re(N.endY)?N.badLine=!0:N.badLine=!1)};Wd.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}};Wd.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var tS={};function ZJ(e,t,n){for(var r=function(c,h,p,m){return nr(c,h,p,m)},a=t._private,i=a.rstyle.bezierPts,l=0;l<e.bezierProjPcts.length;l++){var o=e.bezierProjPcts[l];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}tS.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)ZJ(this,e,n.allpts.slice(a,a+6))}else if(r==="segments")for(var i=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var l=n.haystackPts;t.rstyle.haystackPts=[{x:l[0],y:l[1]},{x:l[2],y:l[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth};tS.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var ji={};ji.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!Sl(t)){var n,r,a=e._private,i=e.width(),l=e.height(),o=e.padding(),f=e.position(),c=e.pstyle("text-halign").strValue,h=e.pstyle("text-valign").strValue,p=a.rscratch,m=a.rstyle;switch(c){case"left":n=f.x-i/2-o;break;case"right":n=f.x+i/2+o;break;default:n=f.x}switch(h){case"top":r=f.y-l/2-o;break;case"bottom":r=f.y+l/2+o;break;default:r=f.y}p.labelX=n,p.labelY=r,m.labelX=n,m.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var PL=function(t,n){var r=Math.atan(n/t);return t===0&&r<0&&(r=r*-1),r},BL=function(t,n){var r=n.x-t.x,a=n.y-t.y;return PL(r,a)},JJ=function(t,n,r,a){var i=vd(0,a-.001,1),l=vd(0,a+.001,1),o=Gu(t,n,r,i),f=Gu(t,n,r,l);return BL(o,f)};ji.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var l=function(p,m,y){Zi(n.rscratch,p,m,y),Zi(n.rstyle,p,m,y)};l("labelX",null,t.x),l("labelY",null,t.y);var o=PL(r.midDispX,r.midDispY);l("labelAutoAngle",null,o);var f=function(){if(f.cache)return f.cache;for(var p=[],m=0;m+5<r.allpts.length;m+=4){var y={x:r.allpts[m],y:r.allpts[m+1]},x={x:r.allpts[m+2],y:r.allpts[m+3]},b={x:r.allpts[m+4],y:r.allpts[m+5]};p.push({p0:y,p1:x,p2:b,startDist:0,length:0,segments:[]})}var w=n.rstyle.bezierPts,S=a.bezierProjPcts.length;function N(D,O,L,M,B){var P=Do(O,L),q=D.segments[D.segments.length-1],H={p0:O,p1:L,t0:M,t1:B,startDist:q?q.startDist+q.length:0,length:P};D.segments.push(H),D.length+=P}for(var C=0;C<p.length;C++){var T=p[C],R=p[C-1];R&&(T.startDist=R.startDist+R.length),N(T,T.p0,w[C*S],0,a.bezierProjPcts[0]);for(var A=0;A<S-1;A++)N(T,w[C*S+A],w[C*S+A+1],a.bezierProjPcts[A],a.bezierProjPcts[A+1]);N(T,w[C*S+S-1],T.p2,a.bezierProjPcts[S-1],1)}return f.cache=p},c=function(p){var m,y=p==="source";if(i[p]){var x=e.pstyle(p+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var b=f(),w,S=0,N=0,C=0;C<b.length;C++){for(var T=b[y?C:b.length-1-C],R=0;R<T.segments.length;R++){var A=T.segments[y?R:T.segments.length-1-R],D=C===b.length-1&&R===T.segments.length-1;if(S=N,N+=A.length,N>=x||D){w={cp:T,segment:A};break}}if(w)break}var O=w.cp,L=w.segment,M=(x-S)/L.length,B=L.t1-L.t0,P=y?L.t0+B*M:L.t1-B*M;P=vd(0,P,1),t=Gu(O.p0,O.p1,O.p2,P),m=JJ(O.p0,O.p1,O.p2,P);break}case"straight":case"segments":case"haystack":{for(var q=0,H,G,F,V,Y=r.allpts.length,Q=0;Q+3<Y&&(y?(F={x:r.allpts[Q],y:r.allpts[Q+1]},V={x:r.allpts[Q+2],y:r.allpts[Q+3]}):(F={x:r.allpts[Y-2-Q],y:r.allpts[Y-1-Q]},V={x:r.allpts[Y-4-Q],y:r.allpts[Y-3-Q]}),H=Do(F,V),G=q,q+=H,!(q>=x));Q+=2);var I=x-G,U=I/H;U=vd(0,U,1),t=wQ(F,V,U),m=BL(F,V);break}}l("labelX",p,t.x),l("labelY",p,t.y),l("labelAutoAngle",p,m)}};c("source"),c("target"),this.applyLabelDimensions(e)}};ji.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};ji.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=Ro(r,e._private.labelDimsKey);if(Kr(n.rscratch,"prefixedLabelDimsKey",t)!==a){Zi(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),l=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,f=Kr(n.rscratch,"labelWrapCachedLines",t)||[],c=o!=="wrap"?1:Math.max(f.length,1),h=i.height/c,p=h*l,m=i.width,y=i.height+(c-1)*(l-1)*h;Zi(n.rstyle,"labelWidth",t,m),Zi(n.rscratch,"labelWidth",t,m),Zi(n.rstyle,"labelHeight",t,y),Zi(n.rscratch,"labelHeight",t,y),Zi(n.rscratch,"labelLineHeight",t,p)}};ji.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,l=function(z,Z){return Z?(Zi(n.rscratch,z,t,Z),Z):Kr(n.rscratch,z,t)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var o=e.pstyle("text-wrap").value;if(o==="wrap"){var f=l("labelKey");if(f!=null&&l("labelWrapKey")===f)return l("labelWrapCachedText");for(var c="",h=a.split(`
|
|
506
|
-
`),p=e.pstyle("text-max-width").pfValue,m=e.pstyle("text-overflow-wrap").value,y=m==="anywhere",x=[],b=/[\s\u200b]+|$/g,w=0;w<h.length;w++){var S=h[w],N=this.calculateLabelDimensions(e,S),C=N.width;if(y){var T=S.split("").join(c);S=T}if(C>p){var R=S.matchAll(b),A="",D=0,O=Wr(R),L;try{for(O.s();!(L=O.n()).done;){var M=L.value,B=M[0],P=S.substring(D,M.index);D=M.index+B.length;var q=A.length===0?P:A+P+B,H=this.calculateLabelDimensions(e,q),G=H.width;G<=p?A+=P+B:(A&&x.push(A),A=P+B)}}catch(X){O.e(X)}finally{O.f()}A.match(/^[\s\u200b]+$/)||x.push(A)}else x.push(S)}l("labelWrapCachedLines",x),a=l("labelWrapCachedText",x.join(`
|
|
507
|
-
`)),l("labelWrapKey",f)}else if(o==="ellipsis"){var F=e.pstyle("text-max-width").pfValue,V="",Y="…",Q=!1;if(this.calculateLabelDimensions(e,a).width<F)return a;for(var I=0;I<a.length;I++){var U=this.calculateLabelDimensions(e,V+a[I]+Y).width;if(U>F)break;V+=a[I],I===a.length-1&&(Q=!0)}return Q||(V+=Y),V}return a};ji.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t};ji.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,i=0,l=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,f=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,h=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=a.createElement("canvas"),p=this.labelCalcCanvasContext=h.getContext("2d");var m=h.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}p.font="".concat(l," ").concat(c," ").concat(o,"px ").concat(f);for(var y=0,x=0,b=t.split(`
|
|
508
|
-
`),w=0;w<b.length;w++){var S=b[w],N=p.measureText(S),C=Math.ceil(N.width),T=o;y=Math.max(C,y),x+=T}return y+=i,x+=i,{width:y,height:x}};ji.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),i=t?t+"-":"",l=e.pstyle(i+"text-rotation"),o=l.strValue;return o==="none"?0:a&&o==="autorotate"?r.labelAutoAngle:o==="autorotate"?0:l.pfValue};ji.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var zL={},dA=28,hA=!1;zL.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<dA||e.height()<dA))return hA||(zt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),hA=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var _m={};_m.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(l){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(l),o)for(var f=0;f<l.length;f++){var c=l[f],h=c._private,p=h.rstyle;p.clean=!1,p.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(l){var o=l.target;r(o)}).on("style.* background.*",function(l){var o=l.target;r(o,!1)});var a=function(l){if(l){var o=n.onUpdateEleCalcsFns;t.cleanStyle();for(var f=0;f<t.length;f++){var c=t[f],h=c._private.rstyle;c.isNode()&&!h.cleanConnected&&(r(c.connectedEdges()),h.cleanConnected=!0)}if(o)for(var p=0;p<o.length;p++){var m=o[p];m(l,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)};_m.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)};_m.recalculateRenderedStyle=function(e,t){var n=function(T){return T._private.rstyle.cleanConnected};if(e.length!==0){var r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var l=e[i],o=l._private,f=o.rstyle;l.isEdge()&&(!n(l.source())||!n(l.target()))&&(f.clean=!1),l.isEdge()&&l.isBundledBezier()&&l.parallelEdges().some(function(C){return!C._private.rstyle.clean&&C.isBundledBezier()})&&(f.clean=!1),!(t&&f.clean||l.removed())&&l.pstyle("display").value!=="none"&&(o.group==="nodes"?a.push(l):r.push(l),f.clean=!0)}for(var c=0;c<a.length;c++){var h=a[c],p=h._private,m=p.rstyle,y=h.position();this.recalculateNodeLabelProjection(h),m.nodeX=y.x,m.nodeY=y.y,m.nodeW=h.pstyle("width").pfValue,m.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var x=0;x<r.length;x++){var b=r[x],w=b._private,S=w.rstyle,N=w.rscratch;S.srcX=N.arrowStartX,S.srcY=N.arrowStartY,S.tgtX=N.arrowEndX,S.tgtY=N.arrowEndY,S.midX=N.midX,S.midY=N.midY,S.labelAngle=N.labelAngle,S.sourceLabelAngle=N.sourceLabelAngle,S.targetLabelAngle=N.targetLabelAngle}}}};var Om={};Om.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}};Om.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Om.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(xL),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var IL={};[Bo,Pp,kr,Wd,tS,ji,zL,_m,Om].forEach(function(e){at(IL,e)});var FL={};FL.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[e]=a[e]||{};var l=i.image=new Image;l.addEventListener("load",n),l.addEventListener("error",function(){l.error=!0});var o="data:",f=e.substring(0,o.length).toLowerCase()===o;return f||(t=t==="null"?null:t,l.crossOrigin=t),l.src=e,l};var Oc={};Oc.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],l=0;l<e.length;l++){var o=e[l];if(o!==void 0){var f=this.binder(o);i.push(f.on.apply(f,a))}}return i}var f=this.binder(e);return f.on.apply(f,a)};Oc.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||fX(e);if(t.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}t.supportsPassiveEvents=a}var l=function(f,c,h){var p=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(p[2]={capture:h??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:p}),(e.addEventListener||e.on).apply(e,p),this};return{on:l,addEventListener:l,addListener:l,bind:l}};Oc.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()};Oc.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()};Oc.load=function(){var e=this,t=e.cy.window(),n=function(K){return K.selected()},r=function(K){var ce=K.getRootNode();if(ce&&ce.nodeType===11&&ce.host!==void 0)return ce},a=function(K,ce,me,he){K==null&&(K=e.cy);for(var be=0;be<ce.length;be++){var Le=ce[be];K.emit({originalEvent:me,type:Le,position:he})}},i=function(K){return K.shiftKey||K.metaKey||K.ctrlKey},l=function(K,ce){var me=!0;if(e.cy.hasCompoundNodes()&&K&&K.pannable())for(var he=0;ce&&he<ce.length;he++){var K=ce[he];if(K.isNode()&&K.isParent()&&!K.pannable()){me=!1;break}}else me=!0;return me},o=function(K){K[0]._private.grabbed=!0},f=function(K){K[0]._private.grabbed=!1},c=function(K){K[0]._private.rscratch.inDragLayer=!0},h=function(K){K[0]._private.rscratch.inDragLayer=!1},p=function(K){K[0]._private.rscratch.isGrabTarget=!0},m=function(K){K[0]._private.rscratch.isGrabTarget=!1},y=function(K,ce){var me=ce.addToList,he=me.has(K);!he&&K.grabbable()&&!K.locked()&&(me.merge(K),o(K))},x=function(K,ce){if(K.cy().hasCompoundNodes()&&!(ce.inDragLayer==null&&ce.addToList==null)){var me=K.descendants();ce.inDragLayer&&(me.forEach(c),me.connectedEdges().forEach(c)),ce.addToList&&y(me,ce)}},b=function(K,ce){ce=ce||{};var me=K.cy().hasCompoundNodes();ce.inDragLayer&&(K.forEach(c),K.neighborhood().stdFilter(function(he){return!me||he.isEdge()}).forEach(c)),ce.addToList&&K.forEach(function(he){y(he,ce)}),x(K,ce),N(K,{inDragLayer:ce.inDragLayer}),e.updateCachedGrabbedEles()},w=b,S=function(K){K&&(e.getCachedZSortedEles().forEach(function(ce){f(ce),h(ce),m(ce)}),e.updateCachedGrabbedEles())},N=function(K,ce){if(!(ce.inDragLayer==null&&ce.addToList==null)&&K.cy().hasCompoundNodes()){var me=K.ancestors().orphans();if(!me.same(K)){var he=me.descendants().spawnSelf().merge(me).unmerge(K).unmerge(K.descendants()),be=he.connectedEdges();ce.inDragLayer&&(be.forEach(c),he.forEach(c)),ce.addToList&&he.forEach(function(Le){y(Le,ce)})}}},C=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},T=typeof MutationObserver<"u",R=typeof ResizeObserver<"u";T?(e.removeObserver=new MutationObserver(function(xe){for(var K=0;K<xe.length;K++){var ce=xe[K],me=ce.removedNodes;if(me)for(var he=0;he<me.length;he++){var be=me[he];if(be===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(xe){e.destroy()});var A=Kd(function(){e.cy.resize()},100);T&&(e.styleObserver=new MutationObserver(A),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",A),R&&(e.resizeObserver=new ResizeObserver(A),e.resizeObserver.observe(e.container));var D=function(K,ce){for(;K!=null;)ce(K),K=K.parentNode},O=function(){e.invalidateContainerClientCoordsCache()};D(e.container,function(xe){e.registerBinding(xe,"transitionend",O),e.registerBinding(xe,"animationend",O),e.registerBinding(xe,"scroll",O)}),e.registerBinding(e.container,"contextmenu",function(xe){xe.preventDefault()});var L=function(){return e.selection[4]!==0},M=function(K){for(var ce=e.findContainerClientCoords(),me=ce[0],he=ce[1],be=ce[2],Le=ce[3],Ne=K.touches?K.touches:[K],Ke=!1,Fe=0;Fe<Ne.length;Fe++){var Ze=Ne[Fe];if(me<=Ze.clientX&&Ze.clientX<=me+be&&he<=Ze.clientY&&Ze.clientY<=he+Le){Ke=!0;break}}if(!Ke)return!1;for(var ut=e.container,ct=K.target,He=ct.parentNode,bt=!1;He;){if(He===ut){bt=!0;break}He=He.parentNode}return!!bt};e.registerBinding(e.container,"mousedown",function(K){if(M(K)&&!(e.hoverData.which===1&&K.which!==1)){K.preventDefault(),C(),e.hoverData.capture=!0,e.hoverData.which=K.which;var ce=e.cy,me=[K.clientX,K.clientY],he=e.projectIntoViewport(me[0],me[1]),be=e.selection,Le=e.findNearestElements(he[0],he[1],!0,!1),Ne=Le[0],Ke=e.dragData.possibleDragElements;e.hoverData.mdownPos=he,e.hoverData.mdownGPos=me;var Fe=function(vt){return{originalEvent:K,type:vt,position:{x:he[0],y:he[1]}}},Ze=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var vt=e.hoverData.down;vt?vt.emit(Fe("taphold")):ce.emit(Fe("taphold"))}},e.tapholdDuration)};if(K.which==3){e.hoverData.cxtStarted=!0;var ut={originalEvent:K,type:"cxttapstart",position:{x:he[0],y:he[1]}};Ne?(Ne.activate(),Ne.emit(ut),e.hoverData.down=Ne):ce.emit(ut),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(K.which==1){Ne&&Ne.activate();{if(Ne!=null&&e.nodeIsGrabbable(Ne)){var ct=function(vt){vt.emit(Fe("grab"))};if(p(Ne),!Ne.selected())Ke=e.dragData.possibleDragElements=ce.collection(),w(Ne,{addToList:Ke}),Ne.emit(Fe("grabon")).emit(Fe("grab"));else{Ke=e.dragData.possibleDragElements=ce.collection();var He=ce.$(function(bt){return bt.isNode()&&bt.selected()&&e.nodeIsGrabbable(bt)});b(He,{addToList:Ke}),Ne.emit(Fe("grabon")),He.forEach(ct)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=Ne,e.hoverData.downs=Le,e.hoverData.downTime=new Date().getTime()}a(Ne,["mousedown","tapstart","vmousedown"],K,{x:he[0],y:he[1]}),Ne==null?(be[4]=1,e.data.bgActivePosistion={x:he[0],y:he[1]},e.redrawHint("select",!0),e.redraw()):Ne.pannable()&&(be[4]=1),Ze()}be[0]=be[2]=he[0],be[1]=be[3]=he[1]}},!1);var B=r(e.container);e.registerBinding([t,B],"mousemove",function(K){var ce=e.hoverData.capture;if(!(!ce&&!M(K))){var me=!1,he=e.cy,be=he.zoom(),Le=[K.clientX,K.clientY],Ne=e.projectIntoViewport(Le[0],Le[1]),Ke=e.hoverData.mdownPos,Fe=e.hoverData.mdownGPos,Ze=e.selection,ut=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(ut=e.findNearestElement(Ne[0],Ne[1],!0,!1));var ct=e.hoverData.last,He=e.hoverData.down,bt=[Ne[0]-Ze[2],Ne[1]-Ze[3]],vt=e.dragData.possibleDragElements,hn;if(Fe){var Vt=Le[0]-Fe[0],sr=Vt*Vt,vn=Le[1]-Fe[1],Cn=vn*vn,yn=sr+Cn;e.hoverData.isOverThresholdDrag=hn=yn>=e.desktopTapThreshold2}var Nn=i(K);hn&&(e.hoverData.tapholdCancelled=!0);var va=function(){var Zn=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Zn.length===0?(Zn.push(bt[0]),Zn.push(bt[1])):(Zn[0]+=bt[0],Zn[1]+=bt[1])};me=!0,a(ut,["mousemove","vmousemove","tapdrag"],K,{x:Ne[0],y:Ne[1]});var pn=function(Zn){return{originalEvent:K,type:Zn,position:{x:Ne[0],y:Ne[1]}}},pa=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||he.emit(pn("boxstart")),Ze[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(hn){var Xn=pn("cxtdrag");He?He.emit(Xn):he.emit(Xn),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||ut!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(pn("cxtdragout")),e.hoverData.cxtOver=ut,ut&&ut.emit(pn("cxtdragover")))}}else if(e.hoverData.dragging){if(me=!0,he.panningEnabled()&&he.userPanningEnabled()){var un;if(e.hoverData.justStartedPan){var In=e.hoverData.mdownPos;un={x:(Ne[0]-In[0])*be,y:(Ne[1]-In[1])*be},e.hoverData.justStartedPan=!1}else un={x:bt[0]*be,y:bt[1]*be};he.panBy(un),he.emit(pn("dragpan")),e.hoverData.dragged=!0}Ne=e.projectIntoViewport(K.clientX,K.clientY)}else if(Ze[4]==1&&(He==null||He.pannable())){if(hn){if(!e.hoverData.dragging&&he.boxSelectionEnabled()&&(Nn||!he.panningEnabled()||!he.userPanningEnabled()))pa();else if(!e.hoverData.selecting&&he.panningEnabled()&&he.userPanningEnabled()){var Pr=l(He,e.hoverData.downs);Pr&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ze[4]=0,e.data.bgActivePosistion=Bu(Ke),e.redrawHint("select",!0),e.redraw())}He&&He.pannable()&&He.active()&&He.unactivate()}}else{if(He&&He.pannable()&&He.active()&&He.unactivate(),(!He||!He.grabbed())&&ut!=ct&&(ct&&a(ct,["mouseout","tapdragout"],K,{x:Ne[0],y:Ne[1]}),ut&&a(ut,["mouseover","tapdragover"],K,{x:Ne[0],y:Ne[1]}),e.hoverData.last=ut),He)if(hn){if(he.boxSelectionEnabled()&&Nn)He&&He.grabbed()&&(S(vt),He.emit(pn("freeon")),vt.emit(pn("free")),e.dragData.didDrag&&(He.emit(pn("dragfreeon")),vt.emit(pn("dragfree")))),pa();else if(He&&He.grabbed()&&e.nodeIsDraggable(He)){var Qn=!e.dragData.didDrag;Qn&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||b(vt,{inDragLayer:!0});var Wn={x:0,y:0};if(Re(bt[0])&&Re(bt[1])&&(Wn.x+=bt[0],Wn.y+=bt[1],Qn)){var pr=e.hoverData.dragDelta;pr&&Re(pr[0])&&Re(pr[1])&&(Wn.x+=pr[0],Wn.y+=pr[1])}e.hoverData.draggingEles=!0,vt.silentShift(Wn).emit(pn("position")).emit(pn("drag")),e.redrawHint("drag",!0),e.redraw()}}else va();me=!0}if(Ze[2]=Ne[0],Ze[3]=Ne[1],me)return K.stopPropagation&&K.stopPropagation(),K.preventDefault&&K.preventDefault(),!1}},!1);var P,q,H;e.registerBinding(t,"mouseup",function(K){if(!(e.hoverData.which===1&&K.which!==1&&e.hoverData.capture)){var ce=e.hoverData.capture;if(ce){e.hoverData.capture=!1;var me=e.cy,he=e.projectIntoViewport(K.clientX,K.clientY),be=e.selection,Le=e.findNearestElement(he[0],he[1],!0,!1),Ne=e.dragData.possibleDragElements,Ke=e.hoverData.down,Fe=i(K);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,Ke&&Ke.unactivate();var Ze=function(Vt){return{originalEvent:K,type:Vt,position:{x:he[0],y:he[1]}}};if(e.hoverData.which===3){var ut=Ze("cxttapend");if(Ke?Ke.emit(ut):me.emit(ut),!e.hoverData.cxtDragged){var ct=Ze("cxttap");Ke?Ke.emit(ct):me.emit(ct)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(a(Le,["mouseup","tapend","vmouseup"],K,{x:he[0],y:he[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(a(Ke,["click","tap","vclick"],K,{x:he[0],y:he[1]}),q=!1,K.timeStamp-H<=me.multiClickDebounceTime()?(P&&clearTimeout(P),q=!0,H=null,a(Ke,["dblclick","dbltap","vdblclick"],K,{x:he[0],y:he[1]})):(P=setTimeout(function(){q||a(Ke,["oneclick","onetap","voneclick"],K,{x:he[0],y:he[1]})},me.multiClickDebounceTime()),H=K.timeStamp)),Ke==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!i(K)&&(me.$(n).unselect(["tapunselect"]),Ne.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Ne=me.collection()),Le==Ke&&!e.dragData.didDrag&&!e.hoverData.selecting&&Le!=null&&Le._private.selectable&&(e.hoverData.dragging||(me.selectionType()==="additive"||Fe?Le.selected()?Le.unselect(["tapunselect"]):Le.select(["tapselect"]):Fe||(me.$(n).unmerge(Le).unselect(["tapunselect"]),Le.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var He=me.collection(e.getAllInBox(be[0],be[1],be[2],be[3]));e.redrawHint("select",!0),He.length>0&&e.redrawHint("eles",!0),me.emit(Ze("boxend"));var bt=function(Vt){return Vt.selectable()&&!Vt.selected()};me.selectionType()==="additive"||Fe||me.$(n).unmerge(He).unselect(),He.emit(Ze("box")).stdFilter(bt).select().emit(Ze("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!be[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var vt=Ke&&Ke.grabbed();S(Ne),vt&&(Ke.emit(Ze("freeon")),Ne.emit(Ze("free")),e.dragData.didDrag&&(Ke.emit(Ze("dragfreeon")),Ne.emit(Ze("dragfree"))))}}be[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var G=[],F=4,V,Y=1e5,Q=function(K,ce){for(var me=0;me<K.length;me++)if(K[me]%ce!==0)return!1;return!0},I=function(K){for(var ce=Math.abs(K[0]),me=1;me<K.length;me++)if(Math.abs(K[me])!==ce)return!1;return!0},U=function(K){var ce=!1,me=K.deltaY;if(me==null&&(K.wheelDeltaY!=null?me=K.wheelDeltaY/4:K.wheelDelta!=null&&(me=K.wheelDelta/4)),me!==0){if(V==null)if(G.length>=F){var he=G;if(V=Q(he,5),!V){var be=Math.abs(he[0]);V=I(he)&&be>5}if(V)for(var Le=0;Le<he.length;Le++)Y=Math.min(Math.abs(he[Le]),Y)}else G.push(me),ce=!0;else V&&(Y=Math.min(Math.abs(me),Y));if(!e.scrollingPage){var Ne=e.cy,Ke=Ne.zoom(),Fe=Ne.pan(),Ze=e.projectIntoViewport(K.clientX,K.clientY),ut=[Ze[0]*Ke+Fe.x,Ze[1]*Ke+Fe.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||L()){K.preventDefault();return}if(Ne.panningEnabled()&&Ne.userPanningEnabled()&&Ne.zoomingEnabled()&&Ne.userZoomingEnabled()){K.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var ct;ce&&Math.abs(me)>5&&(me=Uw(me)*5),ct=me/-250,V&&(ct/=Y,ct*=3),ct=ct*e.wheelSensitivity;var He=K.deltaMode===1;He&&(ct*=33);var bt=Ne.zoom()*Math.pow(10,ct);K.type==="gesturechange"&&(bt=e.gestureStartZoom*K.scale),Ne.zoom({level:bt,renderedPosition:{x:ut[0],y:ut[1]}}),Ne.emit({type:K.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:K,position:{x:Ze[0],y:Ze[1]}})}}}};e.registerBinding(e.container,"wheel",U,!0),e.registerBinding(t,"scroll",function(K){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(K){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||K.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(xe){e.hasTouchStarted||U(xe)},!0),e.registerBinding(e.container,"mouseout",function(K){var ce=e.projectIntoViewport(K.clientX,K.clientY);e.cy.emit({originalEvent:K,type:"mouseout",position:{x:ce[0],y:ce[1]}})},!1),e.registerBinding(e.container,"mouseover",function(K){var ce=e.projectIntoViewport(K.clientX,K.clientY);e.cy.emit({originalEvent:K,type:"mouseover",position:{x:ce[0],y:ce[1]}})},!1);var X,z,Z,re,ae,se,le,ie,W,te,oe,ye,Te,Be=function(K,ce,me,he){return Math.sqrt((me-K)*(me-K)+(he-ce)*(he-ce))},ot=function(K,ce,me,he){return(me-K)*(me-K)+(he-ce)*(he-ce)},Je;e.registerBinding(e.container,"touchstart",Je=function(K){if(e.hasTouchStarted=!0,!!M(K)){C(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var ce=e.cy,me=e.touchData.now,he=e.touchData.earlier;if(K.touches[0]){var be=e.projectIntoViewport(K.touches[0].clientX,K.touches[0].clientY);me[0]=be[0],me[1]=be[1]}if(K.touches[1]){var be=e.projectIntoViewport(K.touches[1].clientX,K.touches[1].clientY);me[2]=be[0],me[3]=be[1]}if(K.touches[2]){var be=e.projectIntoViewport(K.touches[2].clientX,K.touches[2].clientY);me[4]=be[0],me[5]=be[1]}var Le=function(Nn){return{originalEvent:K,type:Nn,position:{x:me[0],y:me[1]}}};if(K.touches[1]){e.touchData.singleTouchMoved=!0,S(e.dragData.touchDragEles);var Ne=e.findContainerClientCoords();W=Ne[0],te=Ne[1],oe=Ne[2],ye=Ne[3],X=K.touches[0].clientX-W,z=K.touches[0].clientY-te,Z=K.touches[1].clientX-W,re=K.touches[1].clientY-te,Te=0<=X&&X<=oe&&0<=Z&&Z<=oe&&0<=z&&z<=ye&&0<=re&&re<=ye;var Ke=ce.pan(),Fe=ce.zoom();ae=Be(X,z,Z,re),se=ot(X,z,Z,re),le=[(X+Z)/2,(z+re)/2],ie=[(le[0]-Ke.x)/Fe,(le[1]-Ke.y)/Fe];var Ze=200,ut=Ze*Ze;if(se<ut&&!K.touches[2]){var ct=e.findNearestElement(me[0],me[1],!0,!0),He=e.findNearestElement(me[2],me[3],!0,!0);ct&&ct.isNode()?(ct.activate().emit(Le("cxttapstart")),e.touchData.start=ct):He&&He.isNode()?(He.activate().emit(Le("cxttapstart")),e.touchData.start=He):ce.emit(Le("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(K.touches[2])ce.boxSelectionEnabled()&&K.preventDefault();else if(!K.touches[1]){if(K.touches[0]){var bt=e.findNearestElements(me[0],me[1],!0,!0),vt=bt[0];if(vt!=null&&(vt.activate(),e.touchData.start=vt,e.touchData.starts=bt,e.nodeIsGrabbable(vt))){var hn=e.dragData.touchDragEles=ce.collection(),Vt=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),vt.selected()?(Vt=ce.$(function(yn){return yn.selected()&&e.nodeIsGrabbable(yn)}),b(Vt,{addToList:hn})):w(vt,{addToList:hn}),p(vt),vt.emit(Le("grabon")),Vt?Vt.forEach(function(yn){yn.emit(Le("grab"))}):vt.emit(Le("grab"))}a(vt,["touchstart","tapstart","vmousedown"],K,{x:me[0],y:me[1]}),vt==null&&(e.data.bgActivePosistion={x:be[0],y:be[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&a(e.touchData.start,["taphold"],K,{x:me[0],y:me[1]})},e.tapholdDuration)}}if(K.touches.length>=1){for(var sr=e.touchData.startPosition=[null,null,null,null,null,null],vn=0;vn<me.length;vn++)sr[vn]=he[vn]=me[vn];var Cn=K.touches[0];e.touchData.startGPosition=[Cn.clientX,Cn.clientY]}}},!1);var We;e.registerBinding(t,"touchmove",We=function(K){var ce=e.touchData.capture;if(!(!ce&&!M(K))){var me=e.selection,he=e.cy,be=e.touchData.now,Le=e.touchData.earlier,Ne=he.zoom();if(K.touches[0]){var Ke=e.projectIntoViewport(K.touches[0].clientX,K.touches[0].clientY);be[0]=Ke[0],be[1]=Ke[1]}if(K.touches[1]){var Ke=e.projectIntoViewport(K.touches[1].clientX,K.touches[1].clientY);be[2]=Ke[0],be[3]=Ke[1]}if(K.touches[2]){var Ke=e.projectIntoViewport(K.touches[2].clientX,K.touches[2].clientY);be[4]=Ke[0],be[5]=Ke[1]}var Fe=function(rh){return{originalEvent:K,type:rh,position:{x:be[0],y:be[1]}}},Ze=e.touchData.startGPosition,ut;if(ce&&K.touches[0]&&Ze){for(var ct=[],He=0;He<be.length;He++)ct[He]=be[He]-Le[He];var bt=K.touches[0].clientX-Ze[0],vt=bt*bt,hn=K.touches[0].clientY-Ze[1],Vt=hn*hn,sr=vt+Vt;ut=sr>=e.touchTapThreshold2}if(ce&&e.touchData.cxt){K.preventDefault();var vn=K.touches[0].clientX-W,Cn=K.touches[0].clientY-te,yn=K.touches[1].clientX-W,Nn=K.touches[1].clientY-te,va=ot(vn,Cn,yn,Nn),pn=va/se,pa=150,Xn=pa*pa,un=1.5,In=un*un;if(pn>=In||va>=Xn){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Pr=Fe("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(Pr),e.touchData.start=null):he.emit(Pr)}}if(ce&&e.touchData.cxt){var Pr=Fe("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(Pr):he.emit(Pr),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Qn=e.findNearestElement(be[0],be[1],!0,!0);(!e.touchData.cxtOver||Qn!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(Fe("cxtdragout")),e.touchData.cxtOver=Qn,Qn&&Qn.emit(Fe("cxtdragover")))}else if(ce&&K.touches[2]&&he.boxSelectionEnabled())K.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||he.emit(Fe("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,me[4]=1,!me||me.length===0||me[0]===void 0?(me[0]=(be[0]+be[2]+be[4])/3,me[1]=(be[1]+be[3]+be[5])/3,me[2]=(be[0]+be[2]+be[4])/3+1,me[3]=(be[1]+be[3]+be[5])/3+1):(me[2]=(be[0]+be[2]+be[4])/3,me[3]=(be[1]+be[3]+be[5])/3),e.redrawHint("select",!0),e.redraw();else if(ce&&K.touches[1]&&!e.touchData.didSelect&&he.zoomingEnabled()&&he.panningEnabled()&&he.userZoomingEnabled()&&he.userPanningEnabled()){K.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Wn=e.dragData.touchDragEles;if(Wn){e.redrawHint("drag",!0);for(var pr=0;pr<Wn.length;pr++){var ys=Wn[pr]._private;ys.grabbed=!1,ys.rscratch.inDragLayer=!1}}var Zn=e.touchData.start,vn=K.touches[0].clientX-W,Cn=K.touches[0].clientY-te,yn=K.touches[1].clientX-W,Nn=K.touches[1].clientY-te,Io=Be(vn,Cn,yn,Nn),xs=Io/ae;if(Te){var bs=vn-X,Bl=Cn-z,ws=yn-Z,An=Nn-re,eh=(bs+ws)/2,th=(Bl+An)/2,Jr=he.zoom(),ei=Jr*xs,Fo=he.pan(),Pc=ie[0]*Jr+Fo.x,Bc=ie[1]*Jr+Fo.y,Lm={x:-ei/Jr*(Pc-Fo.x-eh)+Pc,y:-ei/Jr*(Bc-Fo.y-th)+Bc};if(Zn&&Zn.active()){var Wn=e.dragData.touchDragEles;S(Wn),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Zn.unactivate().emit(Fe("freeon")),Wn.emit(Fe("free")),e.dragData.didDrag&&(Zn.emit(Fe("dragfreeon")),Wn.emit(Fe("dragfree")))}he.viewport({zoom:ei,pan:Lm,cancelOnFailedZoom:!0}),he.emit(Fe("pinchzoom")),ae=Io,X=vn,z=Cn,Z=yn,re=Nn,e.pinching=!0}if(K.touches[0]){var Ke=e.projectIntoViewport(K.touches[0].clientX,K.touches[0].clientY);be[0]=Ke[0],be[1]=Ke[1]}if(K.touches[1]){var Ke=e.projectIntoViewport(K.touches[1].clientX,K.touches[1].clientY);be[2]=Ke[0],be[3]=Ke[1]}if(K.touches[2]){var Ke=e.projectIntoViewport(K.touches[2].clientX,K.touches[2].clientY);be[4]=Ke[0],be[5]=Ke[1]}}else if(K.touches[0]&&!e.touchData.didSelect){var mr=e.touchData.start,Ss=e.touchData.last,Qn;if(!e.hoverData.draggingEles&&!e.swipePanning&&(Qn=e.findNearestElement(be[0],be[1],!0,!0)),ce&&mr!=null&&K.preventDefault(),ce&&mr!=null&&e.nodeIsDraggable(mr))if(ut){var Wn=e.dragData.touchDragEles,ma=!e.dragData.didDrag;ma&&b(Wn,{inDragLayer:!0}),e.dragData.didDrag=!0;var Jn={x:0,y:0};if(Re(ct[0])&&Re(ct[1])&&(Jn.x+=ct[0],Jn.y+=ct[1],ma)){e.redrawHint("eles",!0);var Br=e.touchData.dragDelta;Br&&Re(Br[0])&&Re(Br[1])&&(Jn.x+=Br[0],Jn.y+=Br[1])}e.hoverData.draggingEles=!0,Wn.silentShift(Jn).emit(Fe("position")).emit(Fe("drag")),e.redrawHint("drag",!0),e.touchData.startPosition[0]==Le[0]&&e.touchData.startPosition[1]==Le[1]&&e.redrawHint("eles",!0),e.redraw()}else{var Br=e.touchData.dragDelta=e.touchData.dragDelta||[];Br.length===0?(Br.push(ct[0]),Br.push(ct[1])):(Br[0]+=ct[0],Br[1]+=ct[1])}if(a(mr||Qn,["touchmove","tapdrag","vmousemove"],K,{x:be[0],y:be[1]}),(!mr||!mr.grabbed())&&Qn!=Ss&&(Ss&&Ss.emit(Fe("tapdragout")),Qn&&Qn.emit(Fe("tapdragover"))),e.touchData.last=Qn,ce)for(var pr=0;pr<be.length;pr++)be[pr]&&e.touchData.startPosition[pr]&&ut&&(e.touchData.singleTouchMoved=!0);if(ce&&(mr==null||mr.pannable())&&he.panningEnabled()&&he.userPanningEnabled()){var Pm=l(mr,e.touchData.starts);Pm&&(K.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Bu(e.touchData.startPosition)),e.swipePanning?(he.panBy({x:ct[0]*Ne,y:ct[1]*Ne}),he.emit(Fe("dragpan"))):ut&&(e.swipePanning=!0,he.panBy({x:bt*Ne,y:hn*Ne}),he.emit(Fe("dragpan")),mr&&(mr.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var Ke=e.projectIntoViewport(K.touches[0].clientX,K.touches[0].clientY);be[0]=Ke[0],be[1]=Ke[1]}}for(var He=0;He<be.length;He++)Le[He]=be[He];ce&&K.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var Ve;e.registerBinding(t,"touchcancel",Ve=function(K){var ce=e.touchData.start;e.touchData.capture=!1,ce&&ce.unactivate()});var De,Ye,Qe,st;if(e.registerBinding(t,"touchend",De=function(K){var ce=e.touchData.start,me=e.touchData.capture;if(me)K.touches.length===0&&(e.touchData.capture=!1),K.preventDefault();else return;var he=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var be=e.cy,Le=be.zoom(),Ne=e.touchData.now,Ke=e.touchData.earlier;if(K.touches[0]){var Fe=e.projectIntoViewport(K.touches[0].clientX,K.touches[0].clientY);Ne[0]=Fe[0],Ne[1]=Fe[1]}if(K.touches[1]){var Fe=e.projectIntoViewport(K.touches[1].clientX,K.touches[1].clientY);Ne[2]=Fe[0],Ne[3]=Fe[1]}if(K.touches[2]){var Fe=e.projectIntoViewport(K.touches[2].clientX,K.touches[2].clientY);Ne[4]=Fe[0],Ne[5]=Fe[1]}var Ze=function(Xn){return{originalEvent:K,type:Xn,position:{x:Ne[0],y:Ne[1]}}};ce&&ce.unactivate();var ut;if(e.touchData.cxt){if(ut=Ze("cxttapend"),ce?ce.emit(ut):be.emit(ut),!e.touchData.cxtDragged){var ct=Ze("cxttap");ce?ce.emit(ct):be.emit(ct)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!K.touches[2]&&be.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var He=be.collection(e.getAllInBox(he[0],he[1],he[2],he[3]));he[0]=void 0,he[1]=void 0,he[2]=void 0,he[3]=void 0,he[4]=0,e.redrawHint("select",!0),be.emit(Ze("boxend"));var bt=function(Xn){return Xn.selectable()&&!Xn.selected()};He.emit(Ze("box")).stdFilter(bt).select().emit(Ze("boxselect")),He.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(ce!=null&&ce.unactivate(),K.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!K.touches[1]){if(!K.touches[0]){if(!K.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var vt=e.dragData.touchDragEles;if(ce!=null){var hn=ce._private.grabbed;S(vt),e.redrawHint("drag",!0),e.redrawHint("eles",!0),hn&&(ce.emit(Ze("freeon")),vt.emit(Ze("free")),e.dragData.didDrag&&(ce.emit(Ze("dragfreeon")),vt.emit(Ze("dragfree")))),a(ce,["touchend","tapend","vmouseup","tapdragout"],K,{x:Ne[0],y:Ne[1]}),ce.unactivate(),e.touchData.start=null}else{var Vt=e.findNearestElement(Ne[0],Ne[1],!0,!0);a(Vt,["touchend","tapend","vmouseup","tapdragout"],K,{x:Ne[0],y:Ne[1]})}var sr=e.touchData.startPosition[0]-Ne[0],vn=sr*sr,Cn=e.touchData.startPosition[1]-Ne[1],yn=Cn*Cn,Nn=vn+yn,va=Nn*Le*Le;e.touchData.singleTouchMoved||(ce||be.$(":selected").unselect(["tapunselect"]),a(ce,["tap","vclick"],K,{x:Ne[0],y:Ne[1]}),Ye=!1,K.timeStamp-st<=be.multiClickDebounceTime()?(Qe&&clearTimeout(Qe),Ye=!0,st=null,a(ce,["dbltap","vdblclick"],K,{x:Ne[0],y:Ne[1]})):(Qe=setTimeout(function(){Ye||a(ce,["onetap","voneclick"],K,{x:Ne[0],y:Ne[1]})},be.multiClickDebounceTime()),st=K.timeStamp)),ce!=null&&!e.dragData.didDrag&&ce._private.selectable&&va<e.touchTapThreshold2&&!e.pinching&&(be.selectionType()==="single"?(be.$(n).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"])):ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}}}for(var pn=0;pn<Ne.length;pn++)Ke[pn]=Ne[pn];e.dragData.didDrag=!1,K.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),K.touches.length<2&&(K.touches.length===1&&(e.touchData.startGPosition=[K.touches[0].clientX,K.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var ze=[],dt=function(K){return{clientX:K.clientX,clientY:K.clientY,force:1,identifier:K.pointerId,pageX:K.pageX,pageY:K.pageY,radiusX:K.width/2,radiusY:K.height/2,screenX:K.screenX,screenY:K.screenY,target:K.target}},ve=function(K){return{event:K,touch:dt(K)}},Ce=function(K){ze.push(ve(K))},Me=function(K){for(var ce=0;ce<ze.length;ce++){var me=ze[ce];if(me.event.pointerId===K.pointerId){ze.splice(ce,1);return}}},Ie=function(K){var ce=ze.filter(function(me){return me.event.pointerId===K.pointerId})[0];ce.event=K,ce.touch=dt(K)},_e=function(K){K.touches=ze.map(function(ce){return ce.touch})},Oe=function(K){return K.pointerType==="mouse"||K.pointerType===4};e.registerBinding(e.container,"pointerdown",function(xe){Oe(xe)||(xe.preventDefault(),Ce(xe),_e(xe),Je(xe))}),e.registerBinding(e.container,"pointerup",function(xe){Oe(xe)||(Me(xe),_e(xe),De(xe))}),e.registerBinding(e.container,"pointercancel",function(xe){Oe(xe)||(Me(xe),_e(xe),Ve(xe))}),e.registerBinding(e.container,"pointermove",function(xe){Oe(xe)||(xe.preventDefault(),Ie(xe),_e(xe),We(xe))})}};var ms={};ms.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(r,a,i,l,o,f){this.renderer.nodeShapeImpl("polygon",r,a,i,l,o,this.points)},intersectLine:function(r,a,i,l,o,f,c,h){return pd(o,f,this.points,r,a,i/2,l/2,c)},checkPoint:function(r,a,i,l,o,f,c,h){return ds(r,a,this.points,f,c,l,o,[0,-1],i)},hasMiterBounds:e!=="rectangle",miterBounds:function(r,a,i,l,o,f){return TQ(this.points,r,a,i,l,o)}}};ms.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i)},intersectLine:function(t,n,r,a,i,l,o,f){return LQ(i,l,t,n,r/2+o,a/2+o)},checkPoint:function(t,n,r,a,i,l,o,f){return co(t,n,a,i,l,o,r)}}};ms.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(r,a,i,l,o,f,c){if(f[c]!==void 0&&f[c+"-cx"]===r&&f[c+"-cy"]===a)return f[c];f[c]=new Array(t.length/2),f[c+"-cx"]=r,f[c+"-cy"]=a;var h=i/2,p=l/2;o=o==="auto"?UO(i,l):o;for(var m=new Array(t.length/2),y=0;y<t.length/2;y++)m[y]={x:r+h*t[y*2],y:a+p*t[y*2+1]};var x,b,w,S,N=m.length;for(b=m[N-1],x=0;x<N;x++)w=m[x%N],S=m[(x+1)%N],f[c][x]=eS(b,w,S,o),b=w,w=S;return f[c]},draw:function(r,a,i,l,o,f,c){this.renderer.nodeShapeImpl("round-polygon",r,a,i,l,o,this.points,this.getOrCreateCorners(a,i,l,o,f,c,"drawCorners"))},intersectLine:function(r,a,i,l,o,f,c,h,p){return BQ(o,f,this.points,r,a,i,l,c,this.getOrCreateCorners(r,a,i,l,h,p,"corners"))},checkPoint:function(r,a,i,l,o,f,c,h,p){return OQ(r,a,this.points,f,c,l,o,this.getOrCreateCorners(f,c,l,o,h,p,"corners"))}}};ms.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Ar(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,this.points,l)},intersectLine:function(t,n,r,a,i,l,o,f){return IO(i,l,t,n,r,a,o,f)},checkPoint:function(t,n,r,a,i,l,o,f){var c=a/2,h=i/2;f=f==="auto"?Cl(a,i):f,f=Math.min(c,h,f);var p=f*2;return!!(ds(t,n,this.points,l,o,a,i-p,[0,-1],r)||ds(t,n,this.points,l,o,a-p,i,[0,-1],r)||co(t,n,p,p,l-c+f,o-h+f,r)||co(t,n,p,p,l+c-f,o-h+f,r)||co(t,n,p,p,l+c-f,o+h-f,r)||co(t,n,p,p,l-c+f,o+h-f,r))}}};ms.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Vw(),points:Ar(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,null,l)},generateCutTrianglePts:function(t,n,r,a,i){var l=i==="auto"?this.cornerLength:i,o=n/2,f=t/2,c=r-f,h=r+f,p=a-o,m=a+o;return{topLeft:[c,p+l,c+l,p,c+l,p+l],topRight:[h-l,p,h,p+l,h-l,p+l],bottomRight:[h,m-l,h-l,m,h-l,m-l],bottomLeft:[c+l,m,c,m-l,c+l,m-l]}},intersectLine:function(t,n,r,a,i,l,o,f){var c=this.generateCutTrianglePts(r+2*o,a+2*o,t,n,f),h=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return pd(i,l,h,t,n)},checkPoint:function(t,n,r,a,i,l,o,f){var c=f==="auto"?this.cornerLength:f;if(ds(t,n,this.points,l,o,a,i-2*c,[0,-1],r)||ds(t,n,this.points,l,o,a-2*c,i,[0,-1],r))return!0;var h=this.generateCutTrianglePts(a,i,l,o);return Yr(t,n,h.topLeft)||Yr(t,n,h.topRight)||Yr(t,n,h.bottomRight)||Yr(t,n,h.bottomLeft)}}};ms.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Ar(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i)},intersectLine:function(t,n,r,a,i,l,o,f){var c=.15,h=.5,p=.85,m=this.generateBarrelBezierPts(r+2*o,a+2*o,t,n),y=function(w){var S=Gu({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},c),N=Gu({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},h),C=Gu({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},p);return[w[0],w[1],S.x,S.y,N.x,N.y,C.x,C.y,w[4],w[5]]},x=[].concat(y(m.topLeft),y(m.topRight),y(m.bottomRight),y(m.bottomLeft));return pd(i,l,x,t,n)},generateBarrelBezierPts:function(t,n,r,a){var i=n/2,l=t/2,o=r-l,f=r+l,c=a-i,h=a+i,p=n1(t,n),m=p.heightOffset,y=p.widthOffset,x=p.ctrlPtOffsetPct*t,b={topLeft:[o,c+m,o+x,c,o+y,c],topRight:[f-y,c,f-x,c,f,c+m],bottomRight:[f,h-m,f-x,h,f-y,h],bottomLeft:[o+y,h,o+x,h,o,h-m]};return b.topLeft.isTop=!0,b.topRight.isTop=!0,b.bottomLeft.isBottom=!0,b.bottomRight.isBottom=!0,b},checkPoint:function(t,n,r,a,i,l,o,f){var c=n1(a,i),h=c.heightOffset,p=c.widthOffset;if(ds(t,n,this.points,l,o,a,i-2*h,[0,-1],r)||ds(t,n,this.points,l,o,a-2*p,i,[0,-1],r))return!0;for(var m=this.generateBarrelBezierPts(a,i,l,o),y=function(O,L,M){var B=M[4],P=M[2],q=M[0],H=M[5],G=M[1],F=Math.min(B,q),V=Math.max(B,q),Y=Math.min(H,G),Q=Math.max(H,G);if(F<=O&&O<=V&&Y<=L&&L<=Q){var I=zQ(B,P,q),U=RQ(I[0],I[1],I[2],O),X=U.filter(function(z){return 0<=z&&z<=1});if(X.length>0)return X[0]}return null},x=Object.keys(m),b=0;b<x.length;b++){var w=x[b],S=m[w],N=y(t,n,S);if(N!=null){var C=S[5],T=S[3],R=S[1],A=nr(C,T,R,N);if(S.isTop&&A<=n||S.isBottom&&n<=A)return!0}}return!1}}};ms.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Ar(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,this.points,l)},intersectLine:function(t,n,r,a,i,l,o,f){var c=t-(r/2+o),h=n-(a/2+o),p=h,m=t+(r/2+o),y=vl(i,l,t,n,c,h,m,p,!1);return y.length>0?y:IO(i,l,t,n,r,a,o,f)},checkPoint:function(t,n,r,a,i,l,o,f){f=f==="auto"?Cl(a,i):f;var c=2*f;if(ds(t,n,this.points,l,o,a,i-c,[0,-1],r)||ds(t,n,this.points,l,o,a-c,i,[0,-1],r))return!0;var h=a/2+2*r,p=i/2+2*r,m=[l-h,o-p,l-h,o,l+h,o,l+h,o-p];return!!(Yr(t,n,m)||co(t,n,c,c,l+a/2-f,o+i/2-f,r)||co(t,n,c,c,l-a/2+f,o+i/2-f,r))}}};ms.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Ar(3,0)),this.generateRoundPolygon("round-triangle",Ar(3,0)),this.generatePolygon("rectangle",Ar(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",Ar(5,0)),this.generateRoundPolygon("round-pentagon",Ar(5,0)),this.generatePolygon("hexagon",Ar(6,0)),this.generateRoundPolygon("round-hexagon",Ar(6,0)),this.generatePolygon("heptagon",Ar(7,0)),this.generateRoundPolygon("round-heptagon",Ar(7,0)),this.generatePolygon("octagon",Ar(8,0)),this.generateRoundPolygon("round-octagon",Ar(8,0));var r=new Array(20);{var a=t1(5,0),i=t1(5,Math.PI/5),l=.5*(3-Math.sqrt(5));l*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=l,i[o*2+1]*=l;for(var o=0;o<20/4;o++)r[o*4]=a[o*2],r[o*4+1]=a[o*2+1],r[o*4+2]=i[o*2],r[o*4+3]=i[o*2+1]}r=FO(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var f=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",f),this.generateRoundPolygon("round-tag",f)}e.makePolygon=function(c){var h=c.join("$"),p="polygon-"+h,m;return(m=this[p])?m:t.generatePolygon(p,c)}};var Zd={};Zd.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Zd.redraw=function(e){e=e||LO();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e};Zd.beforeRender=function(e,t){if(!this.destroyed){t==null&&dn("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var vA=function(t,n,r){for(var a=t.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(n,r)};Zd.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(a){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){vA(e,!0,a);var i=fs();e.render(e.renderOptions);var l=e.lastDrawTime=fs();e.averageRedrawTime===void 0&&(e.averageRedrawTime=l-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=l-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else vA(e,!1,a);e.skipFrame=!1,jp(n)}};jp(n)}};var eee=function(t){this.init(t)},UL=eee,Lc=UL.prototype;Lc.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Lc.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,l="__________cytoscape_stylesheet",o="__________cytoscape_container",f=a.getElementById(l)!=null;if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!f){var c=a.createElement("style");c.id=l,c.textContent="."+o+" { position: relative; }",i.insertBefore(c,i.children[0])}var h=r.getComputedStyle(n),p=h.getPropertyValue("position");p==="static"&&zt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=Re(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()};Lc.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),e==="gc"&&n.redrawHint("gc",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Lc.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}};Lc.isHeadless=function(){return!1};[Jw,IL,FL,Oc,ms,Zd].forEach(function(e){at(Lc,e)});var J0=1e3/60,qL={setupDequeueing:function(t){return function(){var r=this,a=this.renderer;if(!r.dequeueingSetup){r.dequeueingSetup=!0;var i=Kd(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},t.deqRedrawThreshold),l=function(c,h){var p=fs(),m=a.averageRedrawTime,y=a.lastRedrawTime,x=[],b=a.cy.extent(),w=a.getPixelRatio();for(c||a.flushRenderedStyleQueue();;){var S=fs(),N=S-p,C=S-h;if(y<J0){var T=J0-(c?m:0);if(C>=t.deqFastCost*T)break}else if(c){if(N>=t.deqCost*y||N>=t.deqAvgCost*m)break}else if(C>=t.deqNoDrawCost*J0)break;var R=t.deq(r,w,b);if(R.length>0)for(var A=0;A<R.length;A++)x.push(R[A]);else break}x.length>0&&(t.onDeqd(r,x),!c&&t.shouldRedraw(r,x,w,b)&&i())},o=t.priority||zw;a.beforeRender(l,o(r))}}}},tee=(function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ap;Ml(this,e),this.idsByKey=new rs,this.keyForId=new rs,this.cachesByLvl=new rs,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return _l(e,[{key:"getIdsFor",value:function(n){n==null&&dn("Can not get id list for null key");var r=this.idsByKey,a=this.idsByKey.get(n);return a||(a=new Rc,r.set(n,a)),a}},{key:"addIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).add(r)}},{key:"deleteIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).delete(r)}},{key:"getNumberOfIdsForKey",value:function(n){return n==null?0:this.getIdsFor(n).size}},{key:"updateKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);this.deleteIdForKey(a,r),this.addIdForKey(i,r),this.keyForId.set(r,i)}},{key:"deleteKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteIdForKey(a,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);return a!==i}},{key:"isInvalid",value:function(n){return this.keyHasChangedFor(n)||this.doesEleInvalidateKey(n)}},{key:"getCachesAt",value:function(n){var r=this.cachesByLvl,a=this.lvls,i=r.get(n);return i||(i=new rs,r.set(n,i),a.push(n)),i}},{key:"getCache",value:function(n,r){return this.getCachesAt(r).get(n)}},{key:"get",value:function(n,r){var a=this.getKey(n),i=this.getCache(a,r);return i!=null&&this.updateKeyMappingFor(n),i}},{key:"getForCachedKey",value:function(n,r){var a=this.keyForId.get(n.id()),i=this.getCache(a,r);return i}},{key:"hasCache",value:function(n,r){return this.getCachesAt(r).has(n)}},{key:"has",value:function(n,r){var a=this.getKey(n);return this.hasCache(a,r)}},{key:"setCache",value:function(n,r,a){a.key=n,this.getCachesAt(r).set(n,a)}},{key:"set",value:function(n,r,a){var i=this.getKey(n);this.setCache(i,r,a),this.updateKeyMappingFor(n)}},{key:"deleteCache",value:function(n,r){this.getCachesAt(r).delete(n)}},{key:"delete",value:function(n,r){var a=this.getKey(n);this.deleteCache(a,r)}},{key:"invalidateKey",value:function(n){var r=this;this.lvls.forEach(function(a){return r.deleteCache(n,a)})}},{key:"invalidate",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteKeyMappingFor(n);var i=this.doesEleInvalidateKey(n);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])})(),pA=25,Iv=50,sp=-4,p1=3,VL=7.99,nee=8,ree=1024,aee=1024,iee=1024,see=.2,lee=.8,oee=10,uee=.15,cee=.1,fee=.9,dee=.9,hee=100,vee=1,Iu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},pee=hr({getKey:null,doesEleInvalidateKey:Ap,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:MO,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Qf=function(t,n){var r=this;r.renderer=t,r.onDequeues=[];var a=pee(n);at(r,a),r.lookup=new tee(a.getKey,a.doesEleInvalidateKey),r.setupDequeueing()},Yn=Qf.prototype;Yn.reasons=Iu;Yn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};Yn.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r};Yn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Yd(function(n,r){return r.reqs-n.reqs});return t};Yn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};Yn.getElement=function(e,t,n,r,a){var i=this,l=this.renderer,o=l.cy.zoom(),f=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(Fw(o*n))),r<sp)r=sp;else if(o>=VL||r>p1)return null;var c=Math.pow(2,r),h=t.h*c,p=t.w*c,m=l.eleTextBiggerThanMin(e,c);if(!this.isVisible(e,m))return null;var y=f.get(e,r);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var x;if(h<=pA?x=pA:h<=Iv?x=Iv:x=Math.ceil(h/Iv)*Iv,h>iee||p>aee)return null;var b=i.getTextureQueue(x),w=b[b.length-2],S=function(){return i.recycleTexture(x,p)||i.addTexture(x,p)};w||(w=b[b.length-1]),w||(w=S()),w.width-w.usedWidth<p&&(w=S());for(var N=function(F){return F&&F.scaledLabelShown===m},C=a&&a===Iu.dequeue,T=a&&a===Iu.highQuality,R=a&&a===Iu.downscale,A,D=r+1;D<=p1;D++){var O=f.get(e,D);if(O){A=O;break}}var L=A&&A.level===r+1?A:null,M=function(){w.context.drawImage(L.texture.canvas,L.x,0,L.width,L.height,w.usedWidth,0,p,h)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,p,x),N(L))M();else if(N(A))if(T){for(var B=A.level;B>r;B--)L=i.getElement(e,t,n,B,Iu.downscale);M()}else return i.queueElement(e,A.level-1),A;else{var P;if(!C&&!T&&!R)for(var q=r-1;q>=sp;q--){var H=f.get(e,q);if(H){P=H;break}}if(N(P))return i.queueElement(e,r),P;w.context.translate(w.usedWidth,0),w.context.scale(c,c),this.drawElement(w.context,e,t,m,!1),w.context.scale(1/c,1/c),w.context.translate(-w.usedWidth,0)}return y={x:w.usedWidth,texture:w,level:r,scale:c,width:p,height:h,scaledLabelShown:m},w.usedWidth+=Math.ceil(p+nee),w.eleCaches.push(y),f.set(e,r,y),i.checkTextureFullness(w),y};Yn.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])};Yn.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var i=sp;i<=p1;i++){var l=n.getForCachedKey(e,i);l&&r.push(l)}var o=n.invalidate(e);if(o)for(var f=0;f<r.length;f++){var c=r[f],h=c.texture;h.invalidatedWidth+=c.width,c.invalidated=!0,t.checkTextureUtility(h)}t.removeFromQueue(e)}};Yn.checkTextureUtility=function(e){e.invalidatedWidth>=see*e.width&&this.retireTexture(e)};Yn.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>lee&&e.fullnessChecks>=oee?El(n,e):e.fullnessChecks++};Yn.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;El(r,e),e.retired=!0;for(var i=e.eleCaches,l=0;l<i.length;l++){var o=i[l];a.deleteCache(o.key,o.level)}Iw(i);var f=t.getRetiredTextureQueue(n);f.push(e)};Yn.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(ree,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};Yn.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var l=a[i];if(l.width>=t)return l.retired=!1,l.usedWidth=0,l.invalidatedWidth=0,l.fullnessChecks=0,Iw(l.eleCaches),l.context.setTransform(1,0,0,1,0,0),l.context.clearRect(0,0,l.width,l.height),El(a,l),r.push(l),l}};Yn.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),l=a[i];if(l)l.level=Math.max(l.level,t),l.eles.merge(e),l.reqs++,r.updateItem(l);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(o),a[i]=o}};Yn.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,l=0;l<vee&&n.size()>0;l++){var o=n.pop(),f=o.key,c=o.eles[0],h=i.hasCache(c,o.level);if(r[f]=null,h)continue;a.push(o);var p=t.getBoundingBox(c);t.getElement(c,p,e,o.level,Iu.dequeue)}return a};Yn.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=Bw,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))};Yn.onDequeue=function(e){this.onDequeues.push(e)};Yn.offDequeue=function(e){El(this.onDequeues,e)};Yn.setupDequeueing=qL.setupDequeueing({deqRedrawThreshold:hee,deqCost:uee,deqAvgCost:cee,deqNoDrawCost:fee,deqFastCost:dee,deq:function(t,n,r){return t.dequeue(n,r)},onDeqd:function(t,n){for(var r=0;r<t.onDequeues.length;r++){var a=t.onDequeues[r];a(n)}},shouldRedraw:function(t,n,r,a){for(var i=0;i<n.length;i++)for(var l=n[i].eles,o=0;o<l.length;o++){var f=l[o].boundingBox();if(qw(f,a))return!0}return!1},priority:function(t){return t.renderer.beforeRenderPriorities.eleTxrDeq}});var mee=1,nd=-4,Bp=2,gee=3.99,yee=50,xee=50,bee=.15,wee=.1,See=.9,Eee=.9,Cee=1,mA=250,Nee=4e3*4e3,gA=32767,kee=!0,HL=function(t){var n=this,r=n.renderer=t,a=r.cy;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=fs()-2*mA,n.skipping=!1,n.eleTxrDeqs=a.collection(),n.scheduleElementRefinement=Kd(function(){n.refineElementTextures(n.eleTxrDeqs),n.eleTxrDeqs.unmerge(n.eleTxrDeqs)},xee),r.beforeRender(function(l,o){o-n.lastInvalidationTime<=mA?n.skipping=!0:n.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var i=function(o,f){return f.reqs-o.reqs};n.layersQueue=new Yd(i),n.setupDequeueing()},vr=HL.prototype,yA=0,Tee=Math.pow(2,53)-1;vr.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),l={id:yA=++yA%Tee,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=l.context,f=-l.bb.x1,c=-l.bb.y1;return o.scale(n,n),o.translate(f,c),l};vr.getLayers=function(e,t,n){var r=this,a=r.renderer,i=a.cy,l=i.zoom(),o=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(Fw(l*t)),n<nd)n=nd;else if(l>=gee||n>Bp)return null}r.validateLayersElesOrdering(n,e);var f=r.layersByLevel,c=Math.pow(2,n),h=f[n]=f[n]||[],p,m=r.levelIsComplete(n,e),y,x=function(){var M=function(G){if(r.validateLayersElesOrdering(G,e),r.levelIsComplete(G,e))return y=f[G],!0},B=function(G){if(!y)for(var F=n+G;nd<=F&&F<=Bp&&!M(F);F+=G);};B(1),B(-1);for(var P=h.length-1;P>=0;P--){var q=h[P];q.invalid&&El(h,q)}};if(!m)x();else return h;var b=function(){if(!p){p=_r();for(var M=0;M<e.length;M++)CQ(p,e[M].boundingBox())}return p},w=function(M){M=M||{};var B=M.after;b();var P=Math.ceil(p.w*c),q=Math.ceil(p.h*c);if(P>gA||q>gA)return null;var H=P*q;if(H>Nee)return null;var G=r.makeLayer(p,n);if(B!=null){var F=h.indexOf(B)+1;h.splice(F,0,G)}else(M.insert===void 0||M.insert)&&h.unshift(G);return G};if(r.skipping&&!o)return null;for(var S=null,N=e.length/mee,C=!o,T=0;T<e.length;T++){var R=e[T],A=R._private.rscratch,D=A.imgLayerCaches=A.imgLayerCaches||{},O=D[n];if(O){S=O;continue}if((!S||S.eles.length>=N||!zO(S.bb,R.boundingBox()))&&(S=w({insert:!0,after:S}),!S))return null;y||C?r.queueLayer(S,R):r.drawEleInLayer(S,R,n,t),S.eles.push(R),D[n]=S}return y||(C?null:h)};vr.getEleLevelForLayerLevel=function(e,t){return e};vr.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,l=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(l,!1),i.drawCachedElement(l,t,null,null,n,kee),i.setImgSmoothing(l,!0))};vr.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var l=r[i];if(l.reqs>0||l.invalid)return!1;a+=l.eles.length}return a===t.length};vr.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,l=0;l<t.length;l++)if(a.eles[0]===t[l]){i=l;break}if(i<0){this.invalidateLayer(a);continue}for(var o=i,l=0;l<a.eles.length;l++)if(a.eles[l]!==t[o+l]){this.invalidateLayer(a);break}}};vr.updateElementsInLayers=function(e,t){for(var n=this,r=Vd(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],l=r?e[a]:e[a].ele,o=l._private.rscratch,f=o.imgLayerCaches=o.imgLayerCaches||{},c=nd;c<=Bp;c++){var h=f[c];h&&(i&&n.getEleLevelForLayerLevel(h.level)!==i.level||t(h,l,i))}};vr.haveLayers=function(){for(var e=this,t=!1,n=nd;n<=Bp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t};vr.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=fs(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(r,a,i){t.invalidateLayer(r)}))};vr.invalidateLayer=function(e){if(this.lastInvalidationTime=fs(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];El(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}};vr.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(r,a,i){var l=r.replacement;if(l||(l=r.replacement=t.makeLayer(r.bb,r.level),l.replaces=r,l.eles=r.eles),!l.reqs)for(var o=0;o<l.eles.length;o++)t.queueLayer(l,l.eles[o])})};vr.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()};vr.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,i=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;a.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}};vr.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<Cee&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var l=i.elesQueue.shift();l&&(t.drawEleInLayer(i,l,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}return r};vr.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var l=e.eles[i]._private,o=l.imgLayerCaches=l.imgLayerCaches||{};o&&(o[e.level]=e)}t.requestRedraw()}};vr.requestRedraw=Kd(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100);vr.setupDequeueing=qL.setupDequeueing({deqRedrawThreshold:yee,deqCost:bee,deqAvgCost:wee,deqNoDrawCost:See,deqFastCost:Eee,deq:function(t,n){return t.dequeue(n)},onDeqd:zw,shouldRedraw:MO,priority:function(t){return t.renderer.beforeRenderPriorities.lyrTxrDeq}});var GL={},xA;function jee(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Aee(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function bA(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var l=n,o=n[0];e.moveTo(o.x,o.y);for(var a=1;a<l.length;a++){var i=l[a];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function Ree(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var i=t,l=i[0];e.moveTo(l.x,l.y);for(var o=0;o<i.length;o++){var f=i[o];e.lineTo(f.x,f.y)}e.closePath&&e.closePath()}function Dee(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}GL.arrowShapeImpl=function(e){return(xA||(xA={polygon:jee,"triangle-backcurve":Aee,"triangle-tee":bA,"circle-triangle":Ree,"triangle-cross":bA,circle:Dee}))[e]};var Ai={};Ai.drawElement=function(e,t,n,r,a,i){var l=this;t.isNode()?l.drawNode(e,t,n,r,a,i):l.drawEdge(e,t,n,r,a,i)};Ai.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)};Ai.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)};Ai.drawCachedElementPortion=function(e,t,n,r,a,i,l,o){var f=this,c=n.getBoundingBox(t);if(!(c.w===0||c.h===0)){var h=n.getElement(t,c,r,a,i);if(h!=null){var p=o(f,t);if(p===0)return;var m=l(f,t),y=c.x1,x=c.y1,b=c.w,w=c.h,S,N,C,T,R;if(m!==0){var A=n.getRotationPoint(t);C=A.x,T=A.y,e.translate(C,T),e.rotate(m),R=f.getImgSmoothing(e),R||f.setImgSmoothing(e,!0);var D=n.getRotationOffset(t);S=D.x,N=D.y}else S=y,N=x;var O;p!==1&&(O=e.globalAlpha,e.globalAlpha=O*p),e.drawImage(h.texture.canvas,h.x,0,h.width,h.height,S,N,b,w),p!==1&&(e.globalAlpha=O),m!==0&&(e.rotate(-m),e.translate(-C,-T),R||f.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var Mee=function(){return 0},_ee=function(t,n){return t.getTextAngle(n,null)},Oee=function(t,n){return t.getTextAngle(n,"source")},Lee=function(t,n){return t.getTextAngle(n,"target")},Pee=function(t,n){return n.effectiveOpacity()},eb=function(t,n){return n.pstyle("text-opacity").pfValue*n.effectiveOpacity()};Ai.drawCachedElement=function(e,t,n,r,a,i){var l=this,o=l.data,f=o.eleTxrCache,c=o.lblTxrCache,h=o.slbTxrCache,p=o.tlbTxrCache,m=t.boundingBox(),y=i===!0?f.reasons.highQuality:null;if(!(m.w===0||m.h===0||!t.visible())&&(!r||qw(m,r))){var x=t.isEdge(),b=t.element()._private.rscratch.badLine;l.drawElementUnderlay(e,t),l.drawCachedElementPortion(e,t,f,n,a,y,Mee,Pee),(!x||!b)&&l.drawCachedElementPortion(e,t,c,n,a,y,_ee,eb),x&&!b&&(l.drawCachedElementPortion(e,t,h,n,a,y,Oee,eb),l.drawCachedElementPortion(e,t,p,n,a,y,Lee,eb)),l.drawElementOverlay(e,t)}};Ai.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}};Ai.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var l=t[i];a.drawCachedElement(e,l,n,r)}};Ai.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var l=t[i];l.isNode()&&a.drawCachedElement(e,l,n,r)}};Ai.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var l=0;l<i.length;l++){var o=i[l],f=o.bb;f.w===0||f.h===0||e.drawImage(o.canvas,f.x1,f.y1,f.w,f.h)}else a.drawCachedElements(e,t,n,r)};var gs={};gs.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this,o=t._private.rscratch;if(!(i&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var f;n&&(f=n,e.translate(-f.x1,-f.y1));var c=i?t.pstyle("opacity").value:1,h=i?t.pstyle("line-opacity").value:1,p=t.pstyle("curve-style").value,m=t.pstyle("line-style").value,y=t.pstyle("width").pfValue,x=t.pstyle("line-cap").value,b=t.pstyle("line-outline-width").value,w=t.pstyle("line-outline-color").value,S=c*h,N=c*h,C=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;p==="straight-triangle"?(l.eleStrokeStyle(e,t,G),l.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=y,e.lineCap=x,l.eleStrokeStyle(e,t,G),l.drawEdgePath(t,e,o.allpts,m),e.lineCap="butt")},T=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;if(e.lineWidth=y+b,e.lineCap=x,b>0)l.colorStrokeStyle(e,w[0],w[1],w[2],G);else{e.lineCap="butt";return}p==="straight-triangle"?l.drawEdgeTrianglePath(t,e,o.allpts):(l.drawEdgePath(t,e,o.allpts,m),e.lineCap="butt")},R=function(){a&&l.drawEdgeOverlay(e,t)},A=function(){a&&l.drawEdgeUnderlay(e,t)},D=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N;l.drawArrowheads(e,t,G)},O=function(){l.drawElementText(e,t,null,r)};e.lineJoin="round";var L=t.pstyle("ghost").value==="yes";if(L){var M=t.pstyle("ghost-offset-x").pfValue,B=t.pstyle("ghost-offset-y").pfValue,P=t.pstyle("ghost-opacity").value,q=S*P;e.translate(M,B),C(q),D(q),e.translate(-M,-B)}else T();A(),C(),D(),R(),O(),n&&e.translate(f.x1,f.y1)}};var $L=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r){if(r.visible()){var a=r.pstyle("".concat(t,"-opacity")).value;if(a!==0){var i=this,l=i.usePaths(),o=r._private.rscratch,f=r.pstyle("".concat(t,"-padding")).pfValue,c=2*f,h=r.pstyle("".concat(t,"-color")).value;n.lineWidth=c,o.edgeType==="self"&&!l?n.lineCap="butt":n.lineCap="round",i.colorStrokeStyle(n,h[0],h[1],h[2],a),i.drawEdgePath(r,n,o.allpts,"solid")}}}};gs.drawEdgeOverlay=$L("overlay");gs.drawEdgeUnderlay=$L("underlay");gs.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,i=t,l,o=!1,f=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,h=e.pstyle("line-dash-offset").pfValue;if(f){var p=n.join("$"),m=a.pathCacheKey&&a.pathCacheKey===p;m?(l=t=a.pathCache,o=!0):(l=t=new Path2D,a.pathCacheKey=p,a.pathCache=l)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=h;break;case"solid":i.setLineDash([]);break}if(!o&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+3<n.length;y+=4)t.quadraticCurveTo(n[y],n[y+1],n[y+2],n[y+3]);break;case"straight":case"haystack":for(var x=2;x+1<n.length;x+=2)t.lineTo(n[x],n[x+1]);break;case"segments":if(a.isRound){var b=Wr(a.roundCorners),w;try{for(b.s();!(w=b.n()).done;){var S=w.value;OL(t,S)}}catch(C){b.e(C)}finally{b.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var N=2;N+1<n.length;N+=2)t.lineTo(n[N],n[N+1]);break}t=i,f?t.stroke(l):t.stroke(),t.setLineDash&&t.setLineDash([])};gs.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/l,-i[0]/l],f=[o[0]*r/2,o[1]*r/2];t.beginPath(),t.moveTo(n[a]-f[0],n[a+1]-f[1]),t.lineTo(n[a]+f[0],n[a+1]+f[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}};gs.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)};gs.drawArrowhead=function(e,t,n,r,a,i,l){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var o=this,f=t.pstyle(n+"-arrow-shape").value;if(f!=="none"){var c=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",h=t.pstyle(n+"-arrow-fill").value,p=t.pstyle("width").pfValue,m=t.pstyle(n+"-arrow-width"),y=m.value==="match-line"?p:m.pfValue;m.units==="%"&&(y*=p);var x=t.pstyle("opacity").value;l===void 0&&(l=x);var b=e.globalCompositeOperation;(l!==1||h==="hollow")&&(e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,1),o.colorStrokeStyle(e,255,255,255,1),o.drawArrowShape(t,e,c,p,f,y,r,a,i),e.globalCompositeOperation=b);var w=t.pstyle(n+"-arrow-color").value;o.colorFillStyle(e,w[0],w[1],w[2],l),o.colorStrokeStyle(e,w[0],w[1],w[2],l),o.drawArrowShape(t,e,h,p,f,y,r,a,i)}}};gs.drawArrowShape=function(e,t,n,r,a,i,l,o,f){var c=this,h=this.usePaths()&&a!=="triangle-cross",p=!1,m,y=t,x={x:l,y:o},b=e.pstyle("arrow-scale").value,w=this.getArrowWidth(r,b),S=c.arrowShapes[a];if(h){var N=c.arrowPathCache=c.arrowPathCache||[],C=Ro(a),T=N[C];T!=null?(m=t=T,p=!0):(m=t=new Path2D,N[C]=m)}p||(t.beginPath&&t.beginPath(),h?S.draw(t,1,0,{x:0,y:0},1):S.draw(t,w,f,x,r),t.closePath&&t.closePath()),t=y,h&&(t.translate(l,o),t.rotate(f),t.scale(w,w)),(n==="filled"||n==="both")&&(h?t.fill(m):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=i/(h?w:1),t.lineJoin="miter",h?t.stroke(m):t.stroke()),h&&(t.scale(1/w,1/w),t.rotate(-f),t.translate(-l,-o))};var nS={};nS.safeDrawImage=function(e,t,n,r,a,i,l,o,f,c){if(!(a<=0||i<=0||f<=0||c<=0))try{e.drawImage(t,n,r,a,i,l,o,f,c)}catch(h){zt(h)}};nS.drawInscribedImage=function(e,t,n,r,a){var i=this,l=n.position(),o=l.x,f=l.y,c=n.cy().style(),h=c.getIndexedStyle.bind(c),p=h(n,"background-fit","value",r),m=h(n,"background-repeat","value",r),y=n.width(),x=n.height(),b=n.padding()*2,w=y+(h(n,"background-width-relative-to","value",r)==="inner"?0:b),S=x+(h(n,"background-height-relative-to","value",r)==="inner"?0:b),N=n._private.rscratch,C=h(n,"background-clip","value",r),T=C==="node",R=h(n,"background-image-opacity","value",r)*a,A=h(n,"background-image-smoothing","value",r),D=n.pstyle("corner-radius").value;D!=="auto"&&(D=n.pstyle("corner-radius").pfValue);var O=t.width||t.cachedW,L=t.height||t.cachedH;(O==null||L==null)&&(document.body.appendChild(t),O=t.cachedW=t.width||t.offsetWidth,L=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var M=O,B=L;if(h(n,"background-width","value",r)!=="auto"&&(h(n,"background-width","units",r)==="%"?M=h(n,"background-width","pfValue",r)*w:M=h(n,"background-width","pfValue",r)),h(n,"background-height","value",r)!=="auto"&&(h(n,"background-height","units",r)==="%"?B=h(n,"background-height","pfValue",r)*S:B=h(n,"background-height","pfValue",r)),!(M===0||B===0)){if(p==="contain"){var P=Math.min(w/M,S/B);M*=P,B*=P}else if(p==="cover"){var P=Math.max(w/M,S/B);M*=P,B*=P}var q=o-w/2,H=h(n,"background-position-x","units",r),G=h(n,"background-position-x","pfValue",r);H==="%"?q+=(w-M)*G:q+=G;var F=h(n,"background-offset-x","units",r),V=h(n,"background-offset-x","pfValue",r);F==="%"?q+=(w-M)*V:q+=V;var Y=f-S/2,Q=h(n,"background-position-y","units",r),I=h(n,"background-position-y","pfValue",r);Q==="%"?Y+=(S-B)*I:Y+=I;var U=h(n,"background-offset-y","units",r),X=h(n,"background-offset-y","pfValue",r);U==="%"?Y+=(S-B)*X:Y+=X,N.pathCache&&(q-=o,Y-=f,o=0,f=0);var z=e.globalAlpha;e.globalAlpha=R;var Z=i.getImgSmoothing(e),re=!1;if(A==="no"&&Z?(i.setImgSmoothing(e,!1),re=!0):A==="yes"&&!Z&&(i.setImgSmoothing(e,!0),re=!0),m==="no-repeat")T&&(e.save(),N.pathCache?e.clip(N.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,o,f,w,S,D,N),e.clip())),i.safeDrawImage(e,t,0,0,O,L,q,Y,M,B),T&&e.restore();else{var ae=e.createPattern(t,m);e.fillStyle=ae,i.nodeShapes[i.getNodeShape(n)].draw(e,o,f,w,S,D,N),e.translate(q,Y),e.fill(),e.translate(-q,-Y)}e.globalAlpha=z,re&&i.setImgSmoothing(e,Z)}};var zo={};zo.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(Fw(n*r));t=Math.pow(2,a)}var i=e.pstyle("font-size").pfValue*t,l=e.pstyle("min-zoomed-font-size").pfValue;return!(i<l)};zo.drawElementText=function(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this;if(r==null){if(i&&!l.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var f=l.getLabelJustification(t);e.textAlign=f,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,h=t.pstyle("label"),p=t.pstyle("source-label"),m=t.pstyle("target-label");if(c||(!h||!h.value)&&(!p||!p.value)&&(!m||!m.value))return;e.textAlign="center",e.textBaseline="bottom"}var y=!n,x;n&&(x=n,e.translate(-x.x1,-x.y1)),a==null?(l.drawText(e,t,null,y,i),t.isEdge()&&(l.drawText(e,t,"source",y,i),l.drawText(e,t,"target",y,i))):l.drawText(e,t,a,y,i),n&&e.translate(x.x1,x.y1)};zo.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t};zo.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,o=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,f=t.pstyle("text-outline-opacity").value*o,c=t.pstyle("color").value,h=t.pstyle("text-outline-color").value;e.font=r+" "+l+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],o),this.colorStrokeStyle(e,h[0],h[1],h[2],f)};function Bee(e,t,n,r,a){var i=Math.min(r,a),l=i/2,o=t+r/2,f=n+a/2;e.beginPath(),e.arc(o,f,l,0,Math.PI*2),e.closePath()}function wA(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,l=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+l,n),e.lineTo(t+r-l,n),e.quadraticCurveTo(t+r,n,t+r,n+l),e.lineTo(t+r,n+a-l),e.quadraticCurveTo(t+r,n+a,t+r-l,n+a),e.lineTo(t+l,n+a),e.quadraticCurveTo(t,n+a,t,n+a-l),e.lineTo(t,n+l),e.quadraticCurveTo(t,n,t+l,n),e.closePath()}zo.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,i=t?t+"-":"",l=e.pstyle(i+"text-rotation");if(l.strValue==="autorotate"){var o=Kr(a,"labelAngle",t);n=e.isEdge()?o:0}else l.strValue==="none"?n=0:n=l.pfValue;return n};zo.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=t._private,l=i.rscratch,o=a?t.effectiveOpacity():1;if(!(a&&(o===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var f=Kr(l,"labelX",n),c=Kr(l,"labelY",n),h,p,m=this.getLabelText(t,n);if(m!=null&&m!==""&&!isNaN(f)&&!isNaN(c)){this.setupTextStyle(e,t,a);var y=n?n+"-":"",x=Kr(l,"labelWidth",n),b=Kr(l,"labelHeight",n),w=t.pstyle(y+"text-margin-x").pfValue,S=t.pstyle(y+"text-margin-y").pfValue,N=t.isEdge(),C=t.pstyle("text-halign").value,T=t.pstyle("text-valign").value;N&&(C="center",T="center"),f+=w,c+=S;var R;switch(r?R=this.getTextAngle(t,n):R=0,R!==0&&(h=f,p=c,e.translate(h,p),e.rotate(R),f=0,c=0),T){case"top":break;case"center":c+=b/2;break;case"bottom":c+=b;break}var A=t.pstyle("text-background-opacity").value,D=t.pstyle("text-border-opacity").value,O=t.pstyle("text-border-width").pfValue,L=t.pstyle("text-background-padding").pfValue,M=t.pstyle("text-background-shape").strValue,B=M==="round-rectangle"||M==="roundrectangle",P=M==="circle",q=2;if(A>0||O>0&&D>0){var H=e.fillStyle,G=e.strokeStyle,F=e.lineWidth,V=t.pstyle("text-background-color").value,Y=t.pstyle("text-border-color").value,Q=t.pstyle("text-border-style").value,I=A>0,U=O>0&&D>0,X=f-L;switch(C){case"left":X-=x;break;case"center":X-=x/2;break}var z=c-b-L,Z=x+2*L,re=b+2*L;if(I&&(e.fillStyle="rgba(".concat(V[0],",").concat(V[1],",").concat(V[2],",").concat(A*o,")")),U&&(e.strokeStyle="rgba(".concat(Y[0],",").concat(Y[1],",").concat(Y[2],",").concat(D*o,")"),e.lineWidth=O,e.setLineDash))switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=O/4,e.setLineDash([]);break;case"solid":default:e.setLineDash([]);break}if(B?(e.beginPath(),wA(e,X,z,Z,re,q)):P?(e.beginPath(),Bee(e,X,z,Z,re)):(e.beginPath(),e.rect(X,z,Z,re)),I&&e.fill(),U&&e.stroke(),U&&Q==="double"){var ae=O/2;e.beginPath(),B?wA(e,X+ae,z+ae,Z-2*ae,re-2*ae,q):e.rect(X+ae,z+ae,Z-2*ae,re-2*ae),e.stroke()}e.fillStyle=H,e.strokeStyle=G,e.lineWidth=F,e.setLineDash&&e.setLineDash([])}var se=2*t.pstyle("text-outline-width").pfValue;if(se>0&&(e.lineWidth=se),t.pstyle("text-wrap").value==="wrap"){var le=Kr(l,"labelWrapCachedLines",n),ie=Kr(l,"labelLineHeight",n),W=x/2,te=this.getLabelJustification(t);switch(te==="auto"||(C==="left"?te==="left"?f+=-x:te==="center"&&(f+=-W):C==="center"?te==="left"?f+=-W:te==="right"&&(f+=W):C==="right"&&(te==="center"?f+=W:te==="right"&&(f+=x))),T){case"top":c-=(le.length-1)*ie;break;case"center":case"bottom":c-=(le.length-1)*ie;break}for(var oe=0;oe<le.length;oe++)se>0&&e.strokeText(le[oe],f,c),e.fillText(le[oe],f,c),c+=ie}else se>0&&e.strokeText(m,f,c),e.fillText(m,f,c);R!==0&&(e.rotate(-R),e.translate(-h,-p))}}};var Ll={};Ll.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this,o,f,c=t._private,h=c.rscratch,p=t.position();if(!(!Re(p.x)||!Re(p.y))&&!(i&&!t.visible())){var m=i?t.effectiveOpacity():1,y=l.usePaths(),x,b=!1,w=t.padding();o=t.width()+2*w,f=t.height()+2*w;var S;n&&(S=n,e.translate(-S.x1,-S.y1));for(var N=t.pstyle("background-image"),C=N.value,T=new Array(C.length),R=new Array(C.length),A=0,D=0;D<C.length;D++){var O=C[D],L=T[D]=O!=null&&O!=="none";if(L){var M=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",D);A++,R[D]=l.getCachedImage(O,M,function(){c.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var B=t.pstyle("background-blacken").value,P=t.pstyle("border-width").pfValue,q=t.pstyle("background-opacity").value*m,H=t.pstyle("border-color").value,G=t.pstyle("border-style").value,F=t.pstyle("border-join").value,V=t.pstyle("border-cap").value,Y=t.pstyle("border-position").value,Q=t.pstyle("border-dash-pattern").pfValue,I=t.pstyle("border-dash-offset").pfValue,U=t.pstyle("border-opacity").value*m,X=t.pstyle("outline-width").pfValue,z=t.pstyle("outline-color").value,Z=t.pstyle("outline-style").value,re=t.pstyle("outline-opacity").value*m,ae=t.pstyle("outline-offset").value,se=t.pstyle("corner-radius").value;se!=="auto"&&(se=t.pstyle("corner-radius").pfValue);var le=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;l.eleFillStyle(e,t,Oe)},ie=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U;l.colorStrokeStyle(e,H[0],H[1],H[2],Oe)},W=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:re;l.colorStrokeStyle(e,z[0],z[1],z[2],Oe)},te=function(Oe,xe,K,ce){var me=l.nodePathCache=l.nodePathCache||[],he=DO(K==="polygon"?K+","+ce.join(","):K,""+xe,""+Oe,""+se),be=me[he],Le,Ne=!1;return be!=null?(Le=be,Ne=!0,h.pathCache=Le):(Le=new Path2D,me[he]=h.pathCache=Le),{path:Le,cacheHit:Ne}},oe=t.pstyle("shape").strValue,ye=t.pstyle("shape-polygon-points").pfValue;if(y){e.translate(p.x,p.y);var Te=te(o,f,oe,ye);x=Te.path,b=Te.cacheHit}var Be=function(){if(!b){var Oe=p;y&&(Oe={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(x||e,Oe.x,Oe.y,o,f,se,h)}y?e.fill(x):e.fill()},ot=function(){for(var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,K=c.backgrounding,ce=0,me=0;me<R.length;me++){var he=t.cy().style().getIndexedStyle(t,"background-image-containment","value",me);if(xe&&he==="over"||!xe&&he==="inside"){ce++;continue}T[me]&&R[me].complete&&!R[me].error&&(ce++,l.drawInscribedImage(e,R[me],t,me,Oe))}c.backgrounding=ce!==A,K!==c.backgrounding&&t.updateStyle(!1)},Je=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;l.hasPie(t)&&(l.drawPie(e,t,xe),Oe&&(y||l.nodeShapes[l.getNodeShape(t)].draw(e,p.x,p.y,o,f,se,h)))},We=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;l.hasStripe(t)&&(e.save(),y?e.clip(h.pathCache):(l.nodeShapes[l.getNodeShape(t)].draw(e,p.x,p.y,o,f,se,h),e.clip()),l.drawStripe(e,t,xe),e.restore(),Oe&&(y||l.nodeShapes[l.getNodeShape(t)].draw(e,p.x,p.y,o,f,se,h)))},Ve=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,xe=(B>0?B:-B)*Oe,K=B>0?0:255;B!==0&&(l.colorFillStyle(e,K,K,K,xe),y?e.fill(x):e.fill())},De=function(){if(P>0){if(e.lineWidth=P,e.lineCap=V,e.lineJoin=F,e.setLineDash)switch(G){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(Q),e.lineDashOffset=I;break;case"solid":case"double":e.setLineDash([]);break}if(Y!=="center"){if(e.save(),e.lineWidth*=2,Y==="inside")y?e.clip(x):e.clip();else{var Oe=new Path2D;Oe.rect(-o/2-P,-f/2-P,o+2*P,f+2*P),Oe.addPath(x),e.clip(Oe,"evenodd")}y?e.stroke(x):e.stroke(),e.restore()}else y?e.stroke(x):e.stroke();if(G==="double"){e.lineWidth=P/3;var xe=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(x):e.stroke(),e.globalCompositeOperation=xe}e.setLineDash&&e.setLineDash([])}},Ye=function(){if(X>0){if(e.lineWidth=X,e.lineCap="butt",e.setLineDash)switch(Z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var Oe=p;y&&(Oe={x:0,y:0});var xe=l.getNodeShape(t),K=P;Y==="inside"&&(K=0),Y==="outside"&&(K*=2);var ce=(o+K+(X+ae))/o,me=(f+K+(X+ae))/f,he=o*ce,be=f*me,Le=l.nodeShapes[xe].points,Ne;if(y){var Ke=te(he,be,xe,Le);Ne=Ke.path}if(xe==="ellipse")l.drawEllipsePath(Ne||e,Oe.x,Oe.y,he,be);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(xe)){var Fe=0,Ze=0,ut=0;xe==="round-diamond"?Fe=(K+ae+X)*1.4:xe==="round-heptagon"?(Fe=(K+ae+X)*1.075,ut=-(K/2+ae+X)/35):xe==="round-hexagon"?Fe=(K+ae+X)*1.12:xe==="round-pentagon"?(Fe=(K+ae+X)*1.13,ut=-(K/2+ae+X)/15):xe==="round-tag"?(Fe=(K+ae+X)*1.12,Ze=(K/2+X+ae)*.07):xe==="round-triangle"&&(Fe=(K+ae+X)*(Math.PI/2),ut=-(K+ae/2+X)/Math.PI),Fe!==0&&(ce=(o+Fe)/o,he=o*ce,["round-hexagon","round-tag"].includes(xe)||(me=(f+Fe)/f,be=f*me)),se=se==="auto"?UO(he,be):se;for(var ct=he/2,He=be/2,bt=se+(K+X+ae)/2,vt=new Array(Le.length/2),hn=new Array(Le.length/2),Vt=0;Vt<Le.length/2;Vt++)vt[Vt]={x:Oe.x+Ze+ct*Le[Vt*2],y:Oe.y+ut+He*Le[Vt*2+1]};var sr,vn,Cn,yn,Nn=vt.length;for(vn=vt[Nn-1],sr=0;sr<Nn;sr++)Cn=vt[sr%Nn],yn=vt[(sr+1)%Nn],hn[sr]=eS(vn,Cn,yn,bt),vn=Cn,Cn=yn;l.drawRoundPolygonPath(Ne||e,Oe.x+Ze,Oe.y+ut,o*ce,f*me,Le,hn)}else if(["roundrectangle","round-rectangle"].includes(xe))se=se==="auto"?Cl(he,be):se,l.drawRoundRectanglePath(Ne||e,Oe.x,Oe.y,he,be,se+(K+X+ae)/2);else if(["cutrectangle","cut-rectangle"].includes(xe))se=se==="auto"?Vw():se,l.drawCutRectanglePath(Ne||e,Oe.x,Oe.y,he,be,null,se+(K+X+ae)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(xe))se=se==="auto"?Cl(he,be):se,l.drawBottomRoundRectanglePath(Ne||e,Oe.x,Oe.y,he,be,se+(K+X+ae)/2);else if(xe==="barrel")l.drawBarrelPath(Ne||e,Oe.x,Oe.y,he,be);else if(xe.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(xe)){var va=(K+X+ae)/o;Le=Rp(Dp(Le,va)),l.drawPolygonPath(Ne||e,Oe.x,Oe.y,o,f,Le)}else{var pn=(K+X+ae)/o;Le=Rp(Dp(Le,-pn)),l.drawPolygonPath(Ne||e,Oe.x,Oe.y,o,f,Le)}if(y?e.stroke(Ne):e.stroke(),Z==="double"){e.lineWidth=K/3;var pa=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(Ne):e.stroke(),e.globalCompositeOperation=pa}e.setLineDash&&e.setLineDash([])}},Qe=function(){a&&l.drawNodeOverlay(e,t,p,o,f)},st=function(){a&&l.drawNodeUnderlay(e,t,p,o,f)},ze=function(){l.drawElementText(e,t,null,r)},dt=t.pstyle("ghost").value==="yes";if(dt){var ve=t.pstyle("ghost-offset-x").pfValue,Ce=t.pstyle("ghost-offset-y").pfValue,Me=t.pstyle("ghost-opacity").value,Ie=Me*m;e.translate(ve,Ce),W(),Ye(),le(Me*q),Be(),ot(Ie,!0),ie(Me*U),De(),Je(B!==0||P!==0),We(B!==0||P!==0),ot(Ie,!1),Ve(Ie),e.translate(-ve,-Ce)}y&&e.translate(-p.x,-p.y),st(),y&&e.translate(p.x,p.y),W(),Ye(),le(),Be(),ot(m,!0),ie(),De(),Je(B!==0||P!==0),We(B!==0||P!==0),ot(m,!1),Ve(),y&&e.translate(-p.x,-p.y),ze(),Qe(),n&&e.translate(S.x1,S.y1)}};var KL=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r,a,i,l){var o=this;if(r.visible()){var f=r.pstyle("".concat(t,"-padding")).pfValue,c=r.pstyle("".concat(t,"-opacity")).value,h=r.pstyle("".concat(t,"-color")).value,p=r.pstyle("".concat(t,"-shape")).value,m=r.pstyle("".concat(t,"-corner-radius")).value;if(c>0){if(a=a||r.position(),i==null||l==null){var y=r.padding();i=r.width()+2*y,l=r.height()+2*y}o.colorFillStyle(n,h[0],h[1],h[2],c),o.nodeShapes[p].draw(n,a.x,a.y,i+f*2,l+f*2,m),n.fill()}}}};Ll.drawNodeOverlay=KL("overlay");Ll.drawNodeUnderlay=KL("underlay");Ll.hasPie=function(e){return e=e[0],e._private.hasPie};Ll.hasStripe=function(e){return e=e[0],e._private.hasStripe};Ll.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),l=t.pstyle("pie-hole"),o=t.pstyle("pie-start-angle").pfValue,f=r.x,c=r.y,h=t.width(),p=t.height(),m=Math.min(h,p)/2,y,x=0,b=this.usePaths();if(b&&(f=0,c=0),i.units==="%"?m=m*i.pfValue:i.pfValue!==void 0&&(m=i.pfValue/2),l.units==="%"?y=m*l.pfValue:l.pfValue!==void 0&&(y=l.pfValue/2),!(y>=m))for(var w=1;w<=a.pieBackgroundN;w++){var S=t.pstyle("pie-"+w+"-background-size").value,N=t.pstyle("pie-"+w+"-background-color").value,C=t.pstyle("pie-"+w+"-background-opacity").value*n,T=S/100;T+x>1&&(T=1-x);var R=1.5*Math.PI+2*Math.PI*x;R+=o;var A=2*Math.PI*T,D=R+A;S===0||x>=1||x+T>1||(y===0?(e.beginPath(),e.moveTo(f,c),e.arc(f,c,m,R,D),e.closePath()):(e.beginPath(),e.arc(f,c,m,R,D),e.arc(f,c,y,D,R,!0),e.closePath()),this.colorFillStyle(e,N[0],N[1],N[2],C),e.fill(),x+=T)}};Ll.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,l=r.y,o=t.width(),f=t.height(),c=0,h=this.usePaths();e.save();var p=t.pstyle("stripe-direction").value,m=t.pstyle("stripe-size");switch(p){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var y=o,x=f;m.units==="%"?(y=y*m.pfValue,x=x*m.pfValue):m.pfValue!==void 0&&(y=m.pfValue,x=m.pfValue),h&&(i=0,l=0),l-=y/2,i-=x/2;for(var b=1;b<=a.stripeBackgroundN;b++){var w=t.pstyle("stripe-"+b+"-background-size").value,S=t.pstyle("stripe-"+b+"-background-color").value,N=t.pstyle("stripe-"+b+"-background-opacity").value*n,C=w/100;C+c>1&&(C=1-c),!(w===0||c>=1||c+C>1)&&(e.beginPath(),e.rect(i,l+x*c,y,x*C),e.closePath(),this.colorFillStyle(e,S[0],S[1],S[2],N),e.fill(),c+=C)}e.restore()};var Lr={},zee=100;Lr.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n};Lr.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r};Lr.createGradientStyleFor=function(e,t,n,r,a){var i,l=this.usePaths(),o=n.pstyle(t+"-gradient-stop-colors").value,f=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var c=n.sourceEndpoint(),h=n.targetEndpoint(),p=n.midpoint(),m=Do(c,p),y=Do(h,p);i=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(m,y))}else{var x=l?{x:0,y:0}:n.position(),b=n.paddedWidth(),w=n.paddedHeight();i=e.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(b,w))}else if(n.isEdge()){var S=n.sourceEndpoint(),N=n.targetEndpoint();i=e.createLinearGradient(S.x,S.y,N.x,N.y)}else{var C=l?{x:0,y:0}:n.position(),T=n.paddedWidth(),R=n.paddedHeight(),A=T/2,D=R/2,O=n.pstyle("background-gradient-direction").value;switch(O){case"to-bottom":i=e.createLinearGradient(C.x,C.y-D,C.x,C.y+D);break;case"to-top":i=e.createLinearGradient(C.x,C.y+D,C.x,C.y-D);break;case"to-left":i=e.createLinearGradient(C.x+A,C.y,C.x-A,C.y);break;case"to-right":i=e.createLinearGradient(C.x-A,C.y,C.x+A,C.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(C.x-A,C.y-D,C.x+A,C.y+D);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(C.x-A,C.y+D,C.x+A,C.y-D);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(C.x+A,C.y-D,C.x-A,C.y+D);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(C.x+A,C.y+D,C.x-A,C.y-D);break}}if(!i)return null;for(var L=f.length===o.length,M=o.length,B=0;B<M;B++)i.addColorStop(L?f[B]:B/(M-1),"rgba("+o[B][0]+","+o[B][1]+","+o[B][2]+","+a+")");return i};Lr.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a};Lr.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"};Lr.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}};Lr.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a};Lr.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"};Lr.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}};Lr.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],l=t.getPixelRatio(),o=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(l=o);var f=a*l,c=i*l,h;if(!(f===t.canvasWidth&&c===t.canvasHeight)){t.fontCaches=null;var p=n.canvasContainer;p.style.width=a+"px",p.style.height=i+"px";for(var m=0;m<t.CANVAS_LAYERS;m++)h=n.canvases[m],h.width=f,h.height=c,h.style.width=a+"px",h.style.height=i+"px";for(var m=0;m<t.BUFFER_COUNT;m++)h=n.bufferCanvases[m],h.width=f,h.height=c,h.style.width=a+"px",h.style.height=i+"px";t.textureMult=1,l<=1&&(h=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,h.width=f*t.textureMult,h.height=c*t.textureMult),t.canvasWidth=f,t.canvasHeight=c,t.pixelRatio=l}};Lr.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})};Lr.clearCanvas=function(){var e=this,t=e.data;function n(r){r.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])};Lr.render=function(e){var t=this;e=e||LO();var n=t.cy,r=e.forcedContext,a=e.drawAllLayers,i=e.drawOnlyNodeLayer,l=e.forcedZoom,o=e.forcedPan,f=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,c=t.data,h=c.canvasNeedsRedraw,p=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),m=e.motionBlur!==void 0?e.motionBlur:t.motionBlur,y=t.motionBlurPxRatio,x=n.hasCompoundNodes(),b=t.hoverData.draggingEles,w=!!(t.hoverData.selecting||t.touchData.selecting);m=m&&!r&&t.motionBlurEnabled&&!w;var S=m;r||(t.prevPxRatio!==f&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=f),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),m&&(t.mbFrames==null&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(S=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!p&&(h[t.NODE]=!0,h[t.SELECT_BOX]=!0);var N=n.style(),C=n.zoom(),T=l!==void 0?l:C,R=n.pan(),A={x:R.x,y:R.y},D={zoom:C,pan:{x:R.x,y:R.y}},O=t.prevViewport,L=O===void 0||D.zoom!==O.zoom||D.pan.x!==O.pan.x||D.pan.y!==O.pan.y;!L&&!(b&&!x)&&(t.motionBlurPxRatio=1),o&&(A=o),T*=f,A.x*=f,A.y*=f;var M=t.getCachedZSortedEles();function B(ie,W,te,oe,ye){var Te=ie.globalCompositeOperation;ie.globalCompositeOperation="destination-out",t.colorFillStyle(ie,255,255,255,t.motionBlurTransparency),ie.fillRect(W,te,oe,ye),ie.globalCompositeOperation=Te}function P(ie,W){var te,oe,ye,Te;!t.clearingMotionBlur&&(ie===c.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||ie===c.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(te={x:R.x*y,y:R.y*y},oe=C*y,ye=t.canvasWidth*y,Te=t.canvasHeight*y):(te=A,oe=T,ye=t.canvasWidth,Te=t.canvasHeight),ie.setTransform(1,0,0,1,0,0),W==="motionBlur"?B(ie,0,0,ye,Te):!r&&(W===void 0||W)&&ie.clearRect(0,0,ye,Te),a||(ie.translate(te.x,te.y),ie.scale(oe,oe)),o&&ie.translate(o.x,o.y),l&&ie.scale(l,l)}if(p||(t.textureDrawLastFrame=!1),p){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var q=t.data.bufferContexts[t.TEXTURE_BUFFER];q.setTransform(1,0,0,1,0,0),q.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:q,drawOnlyNodeLayer:!0,forcedPxRatio:f*t.textureMult});var D=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};D.mpan={x:(0-D.pan.x)/D.zoom,y:(0-D.pan.y)/D.zoom}}h[t.DRAG]=!1,h[t.NODE]=!1;var H=c.contexts[t.NODE],G=t.textureCache.texture,D=t.textureCache.viewport;H.setTransform(1,0,0,1,0,0),m?B(H,0,0,D.width,D.height):H.clearRect(0,0,D.width,D.height);var F=N.core("outside-texture-bg-color").value,V=N.core("outside-texture-bg-opacity").value;t.colorFillStyle(H,F[0],F[1],F[2],V),H.fillRect(0,0,D.width,D.height);var C=n.zoom();P(H,!1),H.clearRect(D.mpan.x,D.mpan.y,D.width/D.zoom/f,D.height/D.zoom/f),H.drawImage(G,D.mpan.x,D.mpan.y,D.width/D.zoom/f,D.height/D.zoom/f)}else t.textureOnViewport&&!r&&(t.textureCache=null);var Y=n.extent(),Q=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),I=t.hideEdgesOnViewport&&Q,U=[];if(U[t.NODE]=!h[t.NODE]&&m&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,U[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),U[t.DRAG]=!h[t.DRAG]&&m&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,U[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),h[t.NODE]||a||i||U[t.NODE]){var X=m&&!U[t.NODE]&&y!==1,H=r||(X?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:c.contexts[t.NODE]),z=m&&!X?"motionBlur":void 0;P(H,z),I?t.drawCachedNodes(H,M.nondrag,f,Y):t.drawLayeredElements(H,M.nondrag,f,Y),t.debug&&t.drawDebugPoints(H,M.nondrag),!a&&!m&&(h[t.NODE]=!1)}if(!i&&(h[t.DRAG]||a||U[t.DRAG])){var X=m&&!U[t.DRAG]&&y!==1,H=r||(X?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:c.contexts[t.DRAG]);P(H,m&&!X?"motionBlur":void 0),I?t.drawCachedNodes(H,M.drag,f,Y):t.drawCachedElements(H,M.drag,f,Y),t.debug&&t.drawDebugPoints(H,M.drag),!a&&!m&&(h[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,P),m&&y!==1){var Z=c.contexts[t.NODE],re=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],ae=c.contexts[t.DRAG],se=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],le=function(W,te,oe){W.setTransform(1,0,0,1,0,0),oe||!S?W.clearRect(0,0,t.canvasWidth,t.canvasHeight):B(W,0,0,t.canvasWidth,t.canvasHeight);var ye=y;W.drawImage(te,0,0,t.canvasWidth*ye,t.canvasHeight*ye,0,0,t.canvasWidth,t.canvasHeight)};(h[t.NODE]||U[t.NODE])&&(le(Z,re,U[t.NODE]),h[t.NODE]=!1),(h[t.DRAG]||U[t.DRAG])&&(le(ae,se,U[t.DRAG]),h[t.DRAG]=!1)}t.prevViewport=D,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),m&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!p,t.mbFrames=0,h[t.NODE]=!0,h[t.DRAG]=!0,t.redraw()},zee)),r||n.emit("render")};var Ff;Lr.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),l=e.drawOnlyNodeLayer,o=e.drawAllLayers,f=a.canvasNeedsRedraw,c=e.forcedContext;if(n.showFps||!l&&f[n.SELECT_BOX]&&!o){var h=c||a.contexts[n.SELECT_BOX];if(t(h),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var p=n.cy.zoom(),m=i.core("selection-box-border-width").value/p;h.lineWidth=m,h.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",h.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),m>0&&(h.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",h.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){var p=n.cy.zoom(),y=a.bgActivePosistion;h.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",h.beginPath(),h.arc(y.x,y.y,i.core("active-bg-size").pfValue/p,0,2*Math.PI),h.fill()}var x=n.lastRedrawTime;if(n.showFps&&x){x=Math.round(x);var b=Math.round(1e3/x),w="1 frame = "+x+" ms = "+b+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!Ff){var S=h.measureText(w);Ff=S.actualBoundingBoxAscent}h.fillText(w,0,Ff);var N=60;h.strokeRect(0,Ff+10,250,20),h.fillRect(0,Ff+10,250*Math.min(b/N,1),20)}o||(f[n.SELECT_BOX]=!1)}};function SA(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Iee(e,t,n){var r=SA(e,e.VERTEX_SHADER,t),a=SA(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Fee(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function rS(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function Uee(e){var t=e.pixelRatio,n=e.cy.zoom();return n*t}function qee(e,t,n,r,a){var i=r*n+t.x,l=a*n+t.y;return l=Math.round(e.canvasHeight-l),[i,l]}function Vee(e){return e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function Hee(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ro(e,t,n){var r=e[0]/255,a=e[1]/255,i=e[2]/255,l=t,o=n||new Array(4);return o[0]=r*l,o[1]=a*l,o[2]=i*l,o[3]=l,o}function Du(e,t){var n=t||new Array(4);return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Gee(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function $ee(e,t){var n=e.createTexture();return n.buffer=function(r){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function YL(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function XL(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Kee(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function Yee(e,t,n,r){var a=YL(e,t),i=Pn(a,2),l=i[0],o=i[1],f=XL(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,f,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,l,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,l,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function si(e,t,n,r){var a=YL(e,n),i=Pn(a,3),l=i[0],o=i[1],f=i[2],c=XL(e,o,t*l),h=l*f,p=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,p),e.bufferData(e.ARRAY_BUFFER,t*h,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,l,o,!1,h,0):o===e.INT&&e.vertexAttribIPointer(r,l,o,h,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var m=new Array(t),y=0;y<t;y++)m[y]=Kee(e,o,c,h,l,y);return p.dataArray=c,p.stride=h,p.size=l,p.getView=function(x){return m[x]},p.setPoint=function(x,b,w){var S=m[x];S[0]=b,S[1]=w},p.bufferSubData=function(x){e.bindBuffer(e.ARRAY_BUFFER,p),x?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,x*l):e.bufferSubData(e.ARRAY_BUFFER,0,c)},p}function Xee(e,t,n){for(var r=9,a=new Float32Array(t*r),i=new Array(t),l=0;l<t;l++){var o=l*r*4;i[l]=new Float32Array(a.buffer,o,r)}var f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,a.byteLength,e.DYNAMIC_DRAW);for(var c=0;c<3;c++){var h=n+c;e.enableVertexAttribArray(h),e.vertexAttribPointer(h,3,e.FLOAT,!1,36,c*12),e.vertexAttribDivisor(h,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),f.getMatrixView=function(p){return i[p]},f.setData=function(p,m){i[m].set(p,0)},f.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferSubData(e.ARRAY_BUFFER,0,a)},f}function Qee(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(r,a){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,a,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var EA=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function tb(){var e=new EA(9);return EA!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function CA(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Wee(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],h=t[7],p=t[8],m=n[0],y=n[1],x=n[2],b=n[3],w=n[4],S=n[5],N=n[6],C=n[7],T=n[8];return e[0]=m*r+y*l+x*c,e[1]=m*a+y*o+x*h,e[2]=m*i+y*f+x*p,e[3]=b*r+w*l+S*c,e[4]=b*a+w*o+S*h,e[5]=b*i+w*f+S*p,e[6]=N*r+C*l+T*c,e[7]=N*a+C*o+T*h,e[8]=N*i+C*f+T*p,e}function lp(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],h=t[7],p=t[8],m=n[0],y=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=l,e[4]=o,e[5]=f,e[6]=m*r+y*l+c,e[7]=m*a+y*o+h,e[8]=m*i+y*f+p,e}function NA(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],h=t[7],p=t[8],m=Math.sin(n),y=Math.cos(n);return e[0]=y*r+m*l,e[1]=y*a+m*o,e[2]=y*i+m*f,e[3]=y*l-m*r,e[4]=y*o-m*a,e[5]=y*f-m*i,e[6]=c,e[7]=h,e[8]=p,e}function m1(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Zee(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var Jee=(function(){function e(t,n,r,a){Ml(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")}return _l(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(n){var r=n.w,a=n.h,i=this.texHeight,l=this.texSize,o=i/a,f=r*o,c=a*o;return f>l&&(o=l/r,f=r*o,c=a*o),{scale:o,texW:f,texH:c}}},{key:"draw",value:function(n,r,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var l=this.texSize,o=this.texRows,f=this.texHeight,c=this.getScale(r),h=c.scale,p=c.texW,m=c.texH,y=function(C,T){if(a&&T){var R=T.context,A=C.x,D=C.row,O=A,L=f*D;R.save(),R.translate(O,L),R.scale(h,h),a(R,r),R.restore()}},x=[null,null],b=function(){y(i.freePointer,i.canvas),x[0]={x:i.freePointer.x,y:i.freePointer.row*f,w:p,h:m},x[1]={x:i.freePointer.x+p,y:i.freePointer.row*f,w:0,h:m},i.freePointer.x+=p,i.freePointer.x==l&&(i.freePointer.x=0,i.freePointer.row++)},w=function(){var C=i.scratch,T=i.canvas;C.clear(),y({x:0,row:0},C);var R=l-i.freePointer.x,A=p-R,D=f;{var O=i.freePointer.x,L=i.freePointer.row*f,M=R;T.context.drawImage(C,0,0,M,D,O,L,M,D),x[0]={x:O,y:L,w:M,h:m}}{var B=R,P=(i.freePointer.row+1)*f,q=A;T&&T.context.drawImage(C,B,0,q,D,0,P,q,D),x[1]={x:0,y:P,w:q,h:m}}i.freePointer.x=A,i.freePointer.row++},S=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+p<=l)b();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===l?(S(),b()):this.enableWrapping?w():(S(),b())}return this.keyToLocation.set(n,x),this.needsBuffer=!0,x}},{key:"getOffsets",value:function(n){return this.keyToLocation.get(n)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(n){if(this.locked)return!1;var r=this.texSize,a=this.texRows,i=this.getScale(n),l=i.texW;return this.freePointer.x+l>r?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(n){this.texture||(this.texture=$ee(n,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),ete=(function(){function e(t,n,r,a){Ml(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return _l(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new Jee(n,r,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas,l=Math.floor(r/a);this.scratch=i(n,r,l,"scratch")}return this.scratch}},{key:"draw",value:function(n,r,a){var i=this.styleKeyToAtlas.get(n);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(r))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(n,r,a),this.styleKeyToAtlas.set(n,i)),i}},{key:"getAtlas",value:function(n){return this.styleKeyToAtlas.get(n)}},{key:"hasAtlas",value:function(n){return this.styleKeyToAtlas.has(n)}},{key:"markKeyForGC",value:function(n){this.markedKeys.add(n)}},{key:"gc",value:function(){var n=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,l=null,o=Wr(this.atlases),f;try{var c=function(){var p=f.value,m=p.getKeys(),y=tte(r,m);if(y.size===0)return a.push(p),m.forEach(function(R){return i.set(R,p)}),1;l||(l=n._createAtlas(),a.push(l));var x=Wr(m),b;try{for(x.s();!(b=x.n()).done;){var w=b.value;if(!y.has(w)){var S=p.getOffsets(w),N=Pn(S,2),C=N[0],T=N[1];l.canFit({w:C.w+T.w,h:C.h})||(l.lock(),l=n._createAtlas(),a.push(l)),p.canvas&&(n._copyTextureToNewAtlas(w,p,l),i.set(w,l))}}}catch(R){x.e(R)}finally{x.f()}p.dispose()};for(o.s();!(f=o.n()).done;)c()}catch(h){o.e(h)}finally{o.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(n,r,a){var i=r.getOffsets(n),l=Pn(i,2),o=l[0],f=l[1];if(f.w===0)a.draw(n,o,function(m){m.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var c=this._getScratchCanvas();c.clear(),c.context.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),c.context.drawImage(r.canvas,f.x,f.y,f.w,f.h,o.w,0,f.w,f.h);var h=o.w+f.w,p=o.h;a.draw(n,{w:h,h:p},function(m){m.drawImage(c,0,0,h,p,0,0,h,p)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function tte(e,t){return e.intersection?e.intersection(t):new Set(kp(e).filter(function(n){return t.has(n)}))}var nte=(function(){function e(t,n){Ml(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return _l(e,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(n,r){var a=this.globalOptions,i=a.webglTexSize,l=a.createTextureCanvas,o=r.texRows,f=this._cacheScratchCanvas(l),c=new ete(this.r,i,o,f);this.collections.set(n,c)}},{key:"addRenderType",value:function(n,r){var a=r.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),l=at({type:n,atlasCollection:i},r);this.renderTypes.set(n,l)}},{key:"getRenderTypeOpts",value:function(n){return this.renderTypes.get(n)}},{key:"getAtlasCollection",value:function(n){return this.collections.get(n)}},{key:"_cacheScratchCanvas",value:function(n){var r=-1,a=-1,i=null;return function(l,o,f,c){return c?((!i||o!=r||f!=a)&&(r=o,a=f,i=n(l,o,f)),i):n(l,o,f)}}},{key:"_key",value:function(n,r){return"".concat(n,"-").concat(r)}},{key:"invalidate",value:function(n){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,l=i===void 0?!1:i,o=a.filterEle,f=o===void 0?function(){return!0}:o,c=a.filterType,h=c===void 0?function(){return!0}:c,p=!1,m=!1,y=Wr(n),x;try{for(y.s();!(x=y.n()).done;){var b=x.value;if(f(b)){var w=Wr(this.renderTypes.values()),S;try{var N=function(){var T=S.value,R=T.type;if(h(R)){var A=r.collections.get(T.collection),D=T.getKey(b),O=Array.isArray(D)?D:[D];if(l)O.forEach(function(P){return A.markKeyForGC(P)}),m=!0;else{var L=T.getID?T.getID(b):b.id(),M=r._key(R,L),B=r.typeAndIdToKey.get(M);B!==void 0&&!Hee(O,B)&&(p=!0,r.typeAndIdToKey.delete(M),B.forEach(function(P){return A.markKeyForGC(P)}))}}};for(w.s();!(S=w.n()).done;)N()}catch(C){w.e(C)}finally{w.f()}}}}catch(C){y.e(C)}finally{y.f()}return m&&(this.gc(),p=!1),p}},{key:"gc",value:function(){var n=Wr(this.collections.values()),r;try{for(n.s();!(r=n.n()).done;){var a=r.value;a.gc()}}catch(i){n.e(i)}finally{n.f()}}},{key:"getOrCreateAtlas",value:function(n,r,a,i){var l=this.renderTypes.get(r),o=this.collections.get(l.collection),f=!1,c=o.draw(i,a,function(m){l.drawClipped?(m.save(),m.beginPath(),m.rect(0,0,a.w,a.h),m.clip(),l.drawElement(m,n,a,!0,!0),m.restore()):l.drawElement(m,n,a,!0,!0),f=!0});if(f){var h=l.getID?l.getID(n):n.id(),p=this._key(r,h);this.typeAndIdToKey.has(p)?this.typeAndIdToKey.get(p).push(i):this.typeAndIdToKey.set(p,[i])}return c}},{key:"getAtlasInfo",value:function(n,r){var a=this,i=this.renderTypes.get(r),l=i.getKey(n),o=Array.isArray(l)?l:[l];return o.map(function(f){var c=i.getBoundingBox(n,f),h=a.getOrCreateAtlas(n,r,c,f),p=h.getOffsets(f),m=Pn(p,2),y=m[0],x=m[1];return{atlas:h,tex:y,tex1:y,tex2:x,bb:c}})}},{key:"getDebugInfo",value:function(){var n=[],r=Wr(this.collections),a;try{for(r.s();!(a=r.n()).done;){var i=Pn(a.value,2),l=i[0],o=i[1],f=o.getCounts(),c=f.keyCount,h=f.atlasCount;n.push({type:l,keyCount:c,atlasCount:h})}}catch(p){r.e(p)}finally{r.f()}return n}}])})(),rte=(function(){function e(t){Ml(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return _l(e,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(n,r){return r})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(n){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(n):!0}},{key:"getAtlasIndexForBatch",value:function(n){var r=this.batchAtlases.indexOf(n);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(n),r=this.batchAtlases.length-1}return r}}])})(),ate=`
|
|
509
|
-
float circleSD(vec2 p, float r) {
|
|
510
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
511
|
-
}
|
|
512
|
-
`,ite=`
|
|
513
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
514
|
-
vec2 d = abs(p)-b;
|
|
515
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
516
|
-
}
|
|
517
|
-
`,ste=`
|
|
518
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
519
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
520
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
521
|
-
vec2 q = abs(p) - b + cr.x;
|
|
522
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
523
|
-
}
|
|
524
|
-
`,lte=`
|
|
525
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
526
|
-
p = abs( p ); // symmetry
|
|
527
|
-
|
|
528
|
-
// find root with Newton solver
|
|
529
|
-
vec2 q = ab*(p-ab);
|
|
530
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
531
|
-
for( int i=0; i<5; i++ ) {
|
|
532
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
533
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
534
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
535
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// compute final point and distance
|
|
539
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
540
|
-
|
|
541
|
-
// return signed distance
|
|
542
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
543
|
-
}
|
|
544
|
-
`,rd={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},zp={IGNORE:1,USE_BB:2},nb=0,kA=1,TA=2,rb=3,Mu=4,Fv=5,Uf=6,qf=7,ote=(function(){function e(t,n,r){Ml(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Fee,this.atlasManager=new nte(t,r),this.batchManager=new rte(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(rd.SCREEN),this.pickingProgram=this._createShaderProgram(rd.PICKING),this.vao=this._createVAO()}return _l(e,[{key:"addAtlasCollection",value:function(n,r){this.atlasManager.addAtlasCollection(n,r)}},{key:"addTextureAtlasRenderType",value:function(n,r){this.atlasManager.addRenderType(n,r)}},{key:"addSimpleShapeRenderType",value:function(n,r){this.simpleShapeOptions.set(n,r)}},{key:"invalidate",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.type,i=this.atlasManager;return a?i.invalidate(n,{filterType:function(o){return o===a},forceRedraw:!0}):i.invalidate(n)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(n){var r=this.gl,a=`#version 300 es
|
|
545
|
-
precision highp float;
|
|
546
|
-
|
|
547
|
-
uniform mat3 uPanZoomMatrix;
|
|
548
|
-
uniform int uAtlasSize;
|
|
549
|
-
|
|
550
|
-
// instanced
|
|
551
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
552
|
-
|
|
553
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
554
|
-
in int aVertType; // the type of thing we are rendering
|
|
555
|
-
|
|
556
|
-
// the z-index that is output when using picking mode
|
|
557
|
-
in vec4 aIndex;
|
|
558
|
-
|
|
559
|
-
// For textures
|
|
560
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
561
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
562
|
-
|
|
563
|
-
// for edges
|
|
564
|
-
in vec4 aPointAPointB;
|
|
565
|
-
in vec4 aPointCPointD;
|
|
566
|
-
in vec2 aLineWidth; // also used for node border width
|
|
567
|
-
|
|
568
|
-
// simple shapes
|
|
569
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
570
|
-
in vec4 aColor; // also used for edges
|
|
571
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
572
|
-
|
|
573
|
-
// output values passed to the fragment shader
|
|
574
|
-
out vec2 vTexCoord;
|
|
575
|
-
out vec4 vColor;
|
|
576
|
-
out vec2 vPosition;
|
|
577
|
-
// flat values are not interpolated
|
|
578
|
-
flat out int vAtlasId;
|
|
579
|
-
flat out int vVertType;
|
|
580
|
-
flat out vec2 vTopRight;
|
|
581
|
-
flat out vec2 vBotLeft;
|
|
582
|
-
flat out vec4 vCornerRadius;
|
|
583
|
-
flat out vec4 vBorderColor;
|
|
584
|
-
flat out vec2 vBorderWidth;
|
|
585
|
-
flat out vec4 vIndex;
|
|
586
|
-
|
|
587
|
-
void main(void) {
|
|
588
|
-
int vid = gl_VertexID;
|
|
589
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
590
|
-
|
|
591
|
-
if(aVertType == `.concat(nb,`) {
|
|
592
|
-
float texX = aTex.x; // texture coordinates
|
|
593
|
-
float texY = aTex.y;
|
|
594
|
-
float texW = aTex.z;
|
|
595
|
-
float texH = aTex.w;
|
|
596
|
-
|
|
597
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
598
|
-
texX += texW;
|
|
599
|
-
}
|
|
600
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
601
|
-
texY += texH;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
float d = float(uAtlasSize);
|
|
605
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
606
|
-
|
|
607
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
608
|
-
}
|
|
609
|
-
else if(aVertType == `).concat(Mu," || aVertType == ").concat(qf,`
|
|
610
|
-
|| aVertType == `).concat(Fv," || aVertType == ").concat(Uf,`) { // simple shapes
|
|
611
|
-
|
|
612
|
-
// the bounding box is needed by the fragment shader
|
|
613
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
614
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
615
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
616
|
-
|
|
617
|
-
// calculations are done in the fragment shader, just pass these along
|
|
618
|
-
vColor = aColor;
|
|
619
|
-
vCornerRadius = aCornerRadius;
|
|
620
|
-
vBorderColor = aBorderColor;
|
|
621
|
-
vBorderWidth = aLineWidth;
|
|
622
|
-
|
|
623
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
624
|
-
}
|
|
625
|
-
else if(aVertType == `).concat(kA,`) {
|
|
626
|
-
vec2 source = aPointAPointB.xy;
|
|
627
|
-
vec2 target = aPointAPointB.zw;
|
|
628
|
-
|
|
629
|
-
// adjust the geometry so that the line is centered on the edge
|
|
630
|
-
position.y = position.y - 0.5;
|
|
631
|
-
|
|
632
|
-
// stretch the unit square into a long skinny rectangle
|
|
633
|
-
vec2 xBasis = target - source;
|
|
634
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
635
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
636
|
-
|
|
637
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
638
|
-
vColor = aColor;
|
|
639
|
-
}
|
|
640
|
-
else if(aVertType == `).concat(TA,`) {
|
|
641
|
-
vec2 pointA = aPointAPointB.xy;
|
|
642
|
-
vec2 pointB = aPointAPointB.zw;
|
|
643
|
-
vec2 pointC = aPointCPointD.xy;
|
|
644
|
-
vec2 pointD = aPointCPointD.zw;
|
|
645
|
-
|
|
646
|
-
// adjust the geometry so that the line is centered on the edge
|
|
647
|
-
position.y = position.y - 0.5;
|
|
648
|
-
|
|
649
|
-
vec2 p0, p1, p2, pos;
|
|
650
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
651
|
-
p0 = pointA;
|
|
652
|
-
p1 = pointB;
|
|
653
|
-
p2 = pointC;
|
|
654
|
-
pos = position;
|
|
655
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
656
|
-
p0 = pointD;
|
|
657
|
-
p1 = pointC;
|
|
658
|
-
p2 = pointB;
|
|
659
|
-
pos = vec2(0.0, -position.y);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
vec2 p01 = p1 - p0;
|
|
663
|
-
vec2 p12 = p2 - p1;
|
|
664
|
-
vec2 p21 = p1 - p2;
|
|
665
|
-
|
|
666
|
-
// Find the normal vector.
|
|
667
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
668
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
669
|
-
|
|
670
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
671
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
672
|
-
|
|
673
|
-
// Determine the bend direction.
|
|
674
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
675
|
-
float width = aLineWidth[0];
|
|
676
|
-
|
|
677
|
-
if(sign(pos.y) == -sigma) {
|
|
678
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
679
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
680
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
681
|
-
} else {
|
|
682
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
683
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
684
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
vColor = aColor;
|
|
688
|
-
}
|
|
689
|
-
else if(aVertType == `).concat(rb,` && vid < 3) {
|
|
690
|
-
// massage the first triangle into an edge arrow
|
|
691
|
-
if(vid == 0)
|
|
692
|
-
position = vec2(-0.15, -0.3);
|
|
693
|
-
if(vid == 1)
|
|
694
|
-
position = vec2( 0.0, 0.0);
|
|
695
|
-
if(vid == 2)
|
|
696
|
-
position = vec2( 0.15, -0.3);
|
|
697
|
-
|
|
698
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
699
|
-
vColor = aColor;
|
|
700
|
-
}
|
|
701
|
-
else {
|
|
702
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
vAtlasId = aAtlasId;
|
|
706
|
-
vVertType = aVertType;
|
|
707
|
-
vIndex = aIndex;
|
|
708
|
-
}
|
|
709
|
-
`),i=this.batchManager.getIndexArray(),l=`#version 300 es
|
|
710
|
-
precision highp float;
|
|
711
|
-
|
|
712
|
-
// declare texture unit for each texture atlas in the batch
|
|
713
|
-
`.concat(i.map(function(c){return"uniform sampler2D uTexture".concat(c,";")}).join(`
|
|
714
|
-
`),`
|
|
715
|
-
|
|
716
|
-
uniform vec4 uBGColor;
|
|
717
|
-
uniform float uZoom;
|
|
718
|
-
|
|
719
|
-
in vec2 vTexCoord;
|
|
720
|
-
in vec4 vColor;
|
|
721
|
-
in vec2 vPosition; // model coordinates
|
|
722
|
-
|
|
723
|
-
flat in int vAtlasId;
|
|
724
|
-
flat in vec4 vIndex;
|
|
725
|
-
flat in int vVertType;
|
|
726
|
-
flat in vec2 vTopRight;
|
|
727
|
-
flat in vec2 vBotLeft;
|
|
728
|
-
flat in vec4 vCornerRadius;
|
|
729
|
-
flat in vec4 vBorderColor;
|
|
730
|
-
flat in vec2 vBorderWidth;
|
|
731
|
-
|
|
732
|
-
out vec4 outColor;
|
|
733
|
-
|
|
734
|
-
`).concat(ate,`
|
|
735
|
-
`).concat(ite,`
|
|
736
|
-
`).concat(ste,`
|
|
737
|
-
`).concat(lte,`
|
|
738
|
-
|
|
739
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
740
|
-
return vec4(
|
|
741
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
742
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
743
|
-
);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
747
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
748
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
749
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
void main(void) {
|
|
753
|
-
if(vVertType == `).concat(nb,`) {
|
|
754
|
-
// look up the texel from the texture unit
|
|
755
|
-
`).concat(i.map(function(c){return"if(vAtlasId == ".concat(c,") outColor = texture(uTexture").concat(c,", vTexCoord);")}).join(`
|
|
756
|
-
else `),`
|
|
757
|
-
}
|
|
758
|
-
else if(vVertType == `).concat(rb,`) {
|
|
759
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
760
|
-
outColor = blend(vColor, uBGColor);
|
|
761
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
762
|
-
}
|
|
763
|
-
else if(vVertType == `).concat(Mu,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
764
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
765
|
-
}
|
|
766
|
-
else if(vVertType == `).concat(Mu," || vVertType == ").concat(qf,`
|
|
767
|
-
|| vVertType == `).concat(Fv," || vVertType == ").concat(Uf,`) { // use SDF
|
|
768
|
-
|
|
769
|
-
float outerBorder = vBorderWidth[0];
|
|
770
|
-
float innerBorder = vBorderWidth[1];
|
|
771
|
-
float borderPadding = outerBorder * 2.0;
|
|
772
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
773
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
774
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
775
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
776
|
-
|
|
777
|
-
float d; // signed distance
|
|
778
|
-
if(vVertType == `).concat(Mu,`) {
|
|
779
|
-
d = rectangleSD(p, b);
|
|
780
|
-
} else if(vVertType == `).concat(qf,` && w == h) {
|
|
781
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
782
|
-
} else if(vVertType == `).concat(qf,`) {
|
|
783
|
-
d = ellipseSD(p, b);
|
|
784
|
-
} else {
|
|
785
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
789
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
790
|
-
if(d > 0.0) {
|
|
791
|
-
if(d > outerBorder) {
|
|
792
|
-
discard;
|
|
793
|
-
} else {
|
|
794
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
795
|
-
}
|
|
796
|
-
} else {
|
|
797
|
-
if(d > innerBorder) {
|
|
798
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
799
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
800
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
801
|
-
}
|
|
802
|
-
else {
|
|
803
|
-
vec4 outerColor;
|
|
804
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
805
|
-
outerColor = vec4(0);
|
|
806
|
-
} else if(innerBorder == 0.0) {
|
|
807
|
-
outerColor = vBorderColor;
|
|
808
|
-
} else {
|
|
809
|
-
outerColor = blend(vBorderColor, vColor);
|
|
810
|
-
}
|
|
811
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
else {
|
|
816
|
-
outColor = vColor;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
`).concat(n.picking?`if(outColor.a == 0.0) discard;
|
|
820
|
-
else outColor = vIndex;`:"",`
|
|
821
|
-
}
|
|
822
|
-
`),o=Iee(r,a,l);o.aPosition=r.getAttribLocation(o,"aPosition"),o.aIndex=r.getAttribLocation(o,"aIndex"),o.aVertType=r.getAttribLocation(o,"aVertType"),o.aTransform=r.getAttribLocation(o,"aTransform"),o.aAtlasId=r.getAttribLocation(o,"aAtlasId"),o.aTex=r.getAttribLocation(o,"aTex"),o.aPointAPointB=r.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=r.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=r.getAttribLocation(o,"aLineWidth"),o.aColor=r.getAttribLocation(o,"aColor"),o.aCornerRadius=r.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=r.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=r.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=r.getUniformLocation(o,"uAtlasSize"),o.uBGColor=r.getUniformLocation(o,"uBGColor"),o.uZoom=r.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var f=0;f<this.batchManager.getMaxAtlasesPerBatch();f++)o.uTextures.push(r.getUniformLocation(o,"uTexture".concat(f)));return o}},{key:"_createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,a=this.gl,i=this.program,l=a.createVertexArray();return a.bindVertexArray(l),Yee(a,"vec2",i.aPosition,n),this.transformBuffer=Xee(a,r,i.aTransform),this.indexBuffer=si(a,r,"vec4",i.aIndex),this.vertTypeBuffer=si(a,r,"int",i.aVertType),this.atlasIdBuffer=si(a,r,"int",i.aAtlasId),this.texBuffer=si(a,r,"vec4",i.aTex),this.pointAPointBBuffer=si(a,r,"vec4",i.aPointAPointB),this.pointCPointDBuffer=si(a,r,"vec4",i.aPointCPointD),this.lineWidthBuffer=si(a,r,"vec2",i.aLineWidth),this.colorBuffer=si(a,r,"vec4",i.aColor),this.cornerRadiusBuffer=si(a,r,"vec4",i.aCornerRadius),this.borderColorBuffer=si(a,r,"vec4",i.aBorderColor),a.bindVertexArray(null),l}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return dl(r,"Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rd.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(n,r){return n.visible()?r&&r.isVisible?r.isVisible(n):!0:!1}},{key:"drawTexture",value:function(n,r,a){var i=this.atlasManager,l=this.batchManager,o=i.getRenderTypeOpts(a);if(this._isVisible(n,o)&&!(n.isEdge()&&!this._isValidEdge(n))){if(this.renderTarget.picking&&o.getTexPickingMode){var f=o.getTexPickingMode(n);if(f===zp.IGNORE)return;if(f==zp.USE_BB){this.drawPickingRectangle(n,r,a);return}}var c=i.getAtlasInfo(n,a),h=Wr(c),p;try{for(h.s();!(p=h.n()).done;){var m=p.value,y=m.atlas,x=m.tex1,b=m.tex2;l.canAddToCurrentBatch(y)||this.endBatch();for(var w=l.getAtlasIndexForBatch(y),S=0,N=[[x,!0],[b,!1]];S<N.length;S++){var C=Pn(N[S],2),T=C[0],R=C[1];if(T.w!=0){var A=this.instanceCount;this.vertTypeBuffer.getView(A)[0]=nb;var D=this.indexBuffer.getView(A);Du(r,D);var O=this.atlasIdBuffer.getView(A);O[0]=w;var L=this.texBuffer.getView(A);L[0]=T.x,L[1]=T.y,L[2]=T.w,L[3]=T.h;var M=this.transformBuffer.getMatrixView(A);this.setTransformMatrix(n,M,o,m,R),this.instanceCount++,R||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(B){h.e(B)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(n,r,a,i){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(a.shapeProps&&a.shapeProps.padding&&(o=n.pstyle(a.shapeProps.padding).pfValue),i){var f=i.bb,c=i.tex1,h=i.tex2,p=c.w/(c.w+h.w);l||(p=1-p);var m=this._getAdjustedBB(f,o,l,p);this._applyTransformMatrix(r,m,a,n)}else{var y=a.getBoundingBox(n),x=this._getAdjustedBB(y,o,!0,1);this._applyTransformMatrix(r,x,a,n)}}},{key:"_applyTransformMatrix",value:function(n,r,a,i){var l,o;CA(n);var f=a.getRotation?a.getRotation(i):0;if(f!==0){var c=a.getRotationPoint(i),h=c.x,p=c.y;lp(n,n,[h,p]),NA(n,n,f);var m=a.getRotationOffset(i);l=m.x+(r.xOffset||0),o=m.y+(r.yOffset||0)}else l=r.x1,o=r.y1;lp(n,n,[l,o]),m1(n,n,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(n,r,a,i){var l=n.x1,o=n.y1,f=n.w,c=n.h,h=n.yOffset;r&&(l-=r,o-=r,f+=2*r,c+=2*r);var p=0,m=f*i;return a&&i<1?f=m:!a&&i<1&&(p=f-m,l+=p,f=m),{x1:l,y1:o,w:f,h:c,xOffset:p,yOffset:h}}},{key:"drawPickingRectangle",value:function(n,r,a){var i=this.atlasManager.getRenderTypeOpts(a),l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=Mu;var o=this.indexBuffer.getView(l);Du(r,o);var f=this.colorBuffer.getView(l);ro([0,0,0],1,f);var c=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(n,c,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(n,r,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(n,i)){var l=i.shapeProps,o=this._getVertTypeForShape(n,l.shape);if(o===void 0||i.isSimple&&!i.isSimple(n)){this.drawTexture(n,r,a);return}var f=this.instanceCount;if(this.vertTypeBuffer.getView(f)[0]=o,o===Fv||o===Uf){var c=i.getBoundingBox(n),h=this._getCornerRadius(n,l.radius,c),p=this.cornerRadiusBuffer.getView(f);p[0]=h,p[1]=h,p[2]=h,p[3]=h,o===Uf&&(p[0]=0,p[2]=0)}var m=this.indexBuffer.getView(f);Du(r,m);var y=n.pstyle(l.color).value,x=n.pstyle(l.opacity).value,b=this.colorBuffer.getView(f);ro(y,x,b);var w=this.lineWidthBuffer.getView(f);if(w[0]=0,w[1]=0,l.border){var S=n.pstyle("border-width").value;if(S>0){var N=n.pstyle("border-color").value,C=n.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(f);ro(N,C,T);var R=n.pstyle("border-position").value;if(R==="inside")w[0]=0,w[1]=-S;else if(R==="outside")w[0]=S,w[1]=0;else{var A=S/2;w[0]=A,w[1]=-A}}}var D=this.transformBuffer.getMatrixView(f);this.setTransformMatrix(n,D,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(n,r){var a=n.pstyle(r).value;switch(a){case"rectangle":return Mu;case"ellipse":return qf;case"roundrectangle":case"round-rectangle":return Fv;case"bottom-round-rectangle":return Uf;default:return}}},{key:"_getCornerRadius",value:function(n,r,a){var i=a.w,l=a.h;if(n.pstyle(r).value==="auto")return Cl(i,l);var o=n.pstyle(r).pfValue,f=i/2,c=l/2;return Math.min(o,c,f)}},{key:"drawEdgeArrow",value:function(n,r,a){if(n.visible()){var i=n._private.rscratch,l,o,f;if(a==="source"?(l=i.arrowStartX,o=i.arrowStartY,f=i.srcArrowAngle):(l=i.arrowEndX,o=i.arrowEndY,f=i.tgtArrowAngle),!(isNaN(l)||l==null||isNaN(o)||o==null||isNaN(f)||f==null)){var c=n.pstyle(a+"-arrow-shape").value;if(c!=="none"){var h=n.pstyle(a+"-arrow-color").value,p=n.pstyle("opacity").value,m=n.pstyle("line-opacity").value,y=p*m,x=n.pstyle("width").pfValue,b=n.pstyle("arrow-scale").value,w=this.r.getArrowWidth(x,b),S=this.instanceCount,N=this.transformBuffer.getMatrixView(S);CA(N),lp(N,N,[l,o]),m1(N,N,[w,w]),NA(N,N,f),this.vertTypeBuffer.getView(S)[0]=rb;var C=this.indexBuffer.getView(S);Du(r,C);var T=this.colorBuffer.getView(S);ro(h,y,T),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var a=this._getEdgePoints(n);if(a){var i=n.pstyle("opacity").value,l=n.pstyle("line-opacity").value,o=n.pstyle("width").pfValue,f=n.pstyle("line-color").value,c=i*l;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=kA;var p=this.indexBuffer.getView(h);Du(r,p);var m=this.colorBuffer.getView(h);ro(f,c,m);var y=this.lineWidthBuffer.getView(h);y[0]=o;var x=this.pointAPointBBuffer.getView(h);x[0]=a[0],x[1]=a[1],x[2]=a[2],x[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var b=0;b<a.length-2;b+=2){var w=this.instanceCount;this.vertTypeBuffer.getView(w)[0]=TA;var S=this.indexBuffer.getView(w);Du(r,S);var N=this.colorBuffer.getView(w);ro(f,c,N);var C=this.lineWidthBuffer.getView(w);C[0]=o;var T=a[b-2],R=a[b-1],A=a[b],D=a[b+1],O=a[b+2],L=a[b+3],M=a[b+4],B=a[b+5];b==0&&(T=2*A-O+.001,R=2*D-L+.001),b==a.length-4&&(M=2*O-A+.001,B=2*L-D+.001);var P=this.pointAPointBBuffer.getView(w);P[0]=T,P[1]=R,P[2]=A,P[3]=D;var q=this.pointCPointDBuffer.getView(w);q[0]=O,q[1]=L,q[2]=M,q[3]=B,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(n){var r=n._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(n){var r=n._private.rscratch;if(this._isValidEdge(n)){var a=r.allpts;if(a.length==4)return a;var i=this._getNumSegments(n);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var a=Array((r+1)*2),i=0;i<=r;i++)if(i==0)a[0]=n[0],a[1]=n[1];else if(i==r)a[i*2]=n[n.length-2],a[i*2+1]=n[n.length-1];else{var l=i/r;this._setCurvePoint(n,l,a,i*2)}return a}},{key:"_setCurvePoint",value:function(n,r,a,i){if(n.length<=2)a[i]=n[0],a[i+1]=n[1];else{for(var l=Array(n.length-2),o=0;o<l.length;o+=2){var f=(1-r)*n[o]+r*n[o+2],c=(1-r)*n[o+1]+r*n[o+3];l[o]=f,l[o+1]=c}return this._setCurvePoint(l,r,a,i)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var l=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(l),n.bindVertexArray(r);var o=Wr(this.buffers),f;try{for(o.s();!(f=o.n()).done;){var c=f.value;c.bufferSubData(i)}}catch(x){o.e(x)}finally{o.f()}for(var h=this.batchManager.getAtlases(),p=0;p<h.length;p++)h[p].bufferIfNeeded(n);for(var m=0;m<h.length;m++)n.activeTexture(n.TEXTURE0+m),n.bindTexture(n.TEXTURE_2D,h[m].texture),n.uniform1i(l.uTextures[m],m);n.uniform1f(l.uZoom,Uee(this.r)),n.uniformMatrix3fv(l.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(l.uAtlasSize,this.batchManager.getAtlasSize());var y=ro(this.bgColor,1);n.uniform4fv(l.uBGColor,y),n.drawArraysInstanced(n.TRIANGLES,0,a,i),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(l,o){return l+o.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(l,o){return l+o.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])})(),QL={};QL.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=ute(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=Qee(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new ote(n,r,e);var a=function(p){return function(m){return n.getTextAngle(m,p)}},i=function(p){return function(m){var y=m.pstyle(p);return y&&y.value}},l=function(p){return function(m){return m.pstyle("".concat(p,"-opacity")).value>0}},o=function(p){var m=p.pstyle("text-events").strValue==="yes";return m?zp.USE_BB:zp.IGNORE},f=function(p){var m=p.position(),y=m.x,x=m.y,b=p.outerWidth(),w=p.outerHeight();return{w:b,h:w,x1:y-b/2,y1:x-w/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:f,isSimple:Vee,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:f,isVisible:l("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:f,isVisible:l("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:ab(t.getLabelKey,null),getBoundingBox:ib(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:a(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:ab(t.getSourceLabelKey,"source"),getBoundingBox:ib(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:a("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:ab(t.getTargetLabelKey,"target"),getBoundingBox:ib(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:a("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")});var c=Kd(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(h,p){var m=!1;p&&p.length>0&&(m|=n.drawing.invalidate(p)),m&&c()}),cte(n)};function ute(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return CO(n)}function WL(e,t){var n=e._private.rscratch;return Kr(n,"labelWrapCachedLines",t)||[]}var ab=function(t,n){return function(r){var a=t(r),i=WL(r,n);return i.length>1?i.map(function(l,o){return"".concat(a,"_").concat(o)}):a}},ib=function(t,n){return function(r,a){var i=t(r);if(typeof a=="string"){var l=a.indexOf("_");if(l>0){var o=Number(a.substring(l+1)),f=WL(r,n),c=i.h/f.length,h=c*o,p=i.y1+h;return{x1:i.x1,w:i.w,y1:p,h:c,yOffset:h}}}return i}};function cte(e){{var t=e.render;e.render=function(i){i=i||{};var l=e.cy;e.webgl&&(l.zoom()>VL?(fte(e),t.call(e,i)):(dte(e),JL(e,i,rd.SCREEN)))}}{var n=e.matchCanvasSize;e.matchCanvasSize=function(i){n.call(e,i),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(i,l,o,f){return yte(e,i,l)};{var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var a=e.notify;e.notify=function(i,l){a.call(e,i,l),i==="viewport"||i==="bounds"?e.pickingFrameBuffer.needsDraw=!0:i==="background"&&e.drawing.invalidate(l,{type:"node-body"})}}}function fte(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function dte(e){var t=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.canvasWidth,e.canvasHeight),r.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function hte(e){var t=e.canvasWidth,n=e.canvasHeight,r=rS(e),a=r.pan,i=r.zoom,l=tb();lp(l,l,[a.x,a.y]),m1(l,l,[i,i]);var o=tb();Zee(o,t,n);var f=tb();return Wee(f,o,l),f}function ZL(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=rS(e),i=a.pan,l=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(l,l)}function vte(e,t){e.drawSelectionRectangle(t,function(n){return ZL(e,n)})}function pte(e){var t=e.data.contexts[e.NODE];t.save(),ZL(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function mte(e){var t=function(a,i,l){for(var o=a.atlasManager.getAtlasCollection(i),f=e.data.contexts[e.NODE],c=o.atlases,h=0;h<c.length;h++){var p=c[h],m=p.canvas;if(m){var y=m.width,x=m.height,b=y*h,w=m.height*l,S=.4;f.save(),f.scale(S,S),f.drawImage(m,b,w),f.strokeStyle="black",f.rect(b,w,y,x),f.stroke(),f.restore()}}},n=0;t(e.drawing,"node",n++),t(e.drawing,"label",n++)}function gte(e,t,n,r,a){var i,l,o,f,c=rS(e),h=c.pan,p=c.zoom;{var m=qee(e,h,p,t,n),y=Pn(m,2),x=y[0],b=y[1],w=6;i=x-w/2,l=b-w/2,o=w,f=w}if(o===0||f===0)return[];var S=e.data.contexts[e.WEBGL];S.bindFramebuffer(S.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(S.viewport(0,0,S.canvas.width,S.canvas.height),JL(e,null,rd.PICKING),e.pickingFrameBuffer.needsDraw=!1);var N=o*f,C=new Uint8Array(N*4);S.readPixels(i,l,o,f,S.RGBA,S.UNSIGNED_BYTE,C),S.bindFramebuffer(S.FRAMEBUFFER,null);for(var T=new Set,R=0;R<N;R++){var A=C.slice(R*4,R*4+4),D=Gee(A)-1;D>=0&&T.add(D)}return T}function yte(e,t,n){var r=gte(e,t,n),a=e.getCachedZSortedEles(),i,l,o=Wr(r),f;try{for(o.s();!(f=o.n()).done;){var c=f.value,h=a[c];if(!i&&h.isNode()&&(i=h),!l&&h.isEdge()&&(l=h),i&&l)break}}catch(p){o.e(p)}finally{o.f()}return[i,l].filter(Boolean)}function sb(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function JL(e,t,n){var r;e.webglDebug&&(r=performance.now());var a=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&vte(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var l=e.data.contexts[e.WEBGL];n.screen?(l.clearColor(0,0,0,0),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA)):l.disable(l.BLEND),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),l.viewport(0,0,l.canvas.width,l.canvas.height);var o=hte(e),f=e.getCachedZSortedEles();if(i=f.length,a.startFrame(o,n),n.screen){for(var c=0;c<f.nondrag.length;c++)sb(e,c,f.nondrag[c]);for(var h=0;h<f.drag.length;h++)sb(e,h,f.drag[h])}else if(n.picking)for(var p=0;p<f.length;p++)sb(e,p,f[p]);a.endFrame(),n.screen&&e.webglDebugShowAtlases&&(pte(e),mte(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var m=performance.now(),y=!1,x=Math.ceil(m-r),b=a.getDebugInfo(),w=["".concat(i," elements"),"".concat(b.totalInstances," instances"),"".concat(b.batchCount," batches"),"".concat(b.totalAtlases," atlases"),"".concat(b.wrappedCount," wrapped textures"),"".concat(b.simpleCount," simple shapes")].join(", ");if(y)console.log("WebGL (".concat(n.name,") - time ").concat(x,"ms, ").concat(w));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(w)),console.log("Texture Atlases Used:");var S=b.atlasInfo,N=Wr(S),C;try{for(N.s();!(C=N.n()).done;){var T=C.value;console.log(" ".concat(T.type,": ").concat(T.keyCount," keys, ").concat(T.atlasCount," atlases"))}}catch(R){N.e(R)}finally{N.f()}console.log("")}}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,a.gc())}var Pl={};Pl.drawPolygonPath=function(e,t,n,r,a,i){var l=r/2,o=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+l*i[0],n+o*i[1]);for(var f=1;f<i.length/2;f++)e.lineTo(t+l*i[f*2],n+o*i[f*2+1]);e.closePath()};Pl.drawRoundPolygonPath=function(e,t,n,r,a,i,l){l.forEach(function(o){return OL(e,o)}),e.closePath()};Pl.drawRoundRectanglePath=function(e,t,n,r,a,i){var l=r/2,o=a/2,f=i==="auto"?Cl(r,a):Math.min(i,o,l);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+l,n-o,t+l,n,f),e.arcTo(t+l,n+o,t,n+o,f),e.arcTo(t-l,n+o,t-l,n,f),e.arcTo(t-l,n-o,t,n-o,f),e.lineTo(t,n-o),e.closePath()};Pl.drawBottomRoundRectanglePath=function(e,t,n,r,a,i){var l=r/2,o=a/2,f=i==="auto"?Cl(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+l,n-o),e.lineTo(t+l,n),e.arcTo(t+l,n+o,t,n+o,f),e.arcTo(t-l,n+o,t-l,n,f),e.lineTo(t-l,n-o),e.lineTo(t,n-o),e.closePath()};Pl.drawCutRectanglePath=function(e,t,n,r,a,i,l){var o=r/2,f=a/2,c=l==="auto"?Vw():l;e.beginPath&&e.beginPath(),e.moveTo(t-o+c,n-f),e.lineTo(t+o-c,n-f),e.lineTo(t+o,n-f+c),e.lineTo(t+o,n+f-c),e.lineTo(t+o-c,n+f),e.lineTo(t-o+c,n+f),e.lineTo(t-o,n+f-c),e.lineTo(t-o,n-f+c),e.closePath()};Pl.drawBarrelPath=function(e,t,n,r,a){var i=r/2,l=a/2,o=t-i,f=t+i,c=n-l,h=n+l,p=n1(r,a),m=p.widthOffset,y=p.heightOffset,x=p.ctrlPtOffsetPct*m;e.beginPath&&e.beginPath(),e.moveTo(o,c+y),e.lineTo(o,h-y),e.quadraticCurveTo(o+x,h,o+m,h),e.lineTo(f-m,h),e.quadraticCurveTo(f-x,h,f,h-y),e.lineTo(f,c+y),e.quadraticCurveTo(f-x,c,f-m,c),e.lineTo(o+m,c),e.quadraticCurveTo(o+x,c,o,c+y),e.closePath()};var jA=Math.sin(0),AA=Math.cos(0),g1={},y1={},e3=Math.PI/40;for(var _u=0*Math.PI;_u<2*Math.PI;_u+=e3)g1[_u]=Math.sin(_u),y1[_u]=Math.cos(_u);Pl.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,l,o=r/2,f=a/2,c=0*Math.PI;c<2*Math.PI;c+=e3)i=t-o*g1[c]*jA+o*y1[c]*AA,l=n+f*y1[c]*jA+f*g1[c]*AA,c===0?e.moveTo(i,l):e.lineTo(i,l);e.closePath()};var Jd={};Jd.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]};Jd.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):a[2],l=e.full?Math.ceil(r.h):a[3],o=Re(e.maxWidth)||Re(e.maxHeight),f=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,l*=e.scale,c=e.scale;else if(o){var h=1/0,p=1/0;Re(e.maxWidth)&&(h=c*e.maxWidth/i),Re(e.maxHeight)&&(p=c*e.maxHeight/l),c=Math.min(h,p),i*=c,l*=c}o||(i*=f,l*=f,c*=f);var m=document.createElement("canvas");m.width=i,m.height=l,m.style.width=i+"px",m.style.height=l+"px";var y=m.getContext("2d");if(i>0&&l>0){y.clearRect(0,0,i,l),y.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(e.full)y.translate(-r.x1*c,-r.y1*c),y.scale(c,c),this.drawElements(y,x),y.scale(1/c,1/c),y.translate(r.x1*c,r.y1*c);else{var b=t.pan(),w={x:b.x*c,y:b.y*c};c*=t.zoom(),y.translate(w.x,w.y),y.scale(c,c),this.drawElements(y,x),y.scale(1/c,1/c),y.translate(-w.x,-w.y)}e.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=e.bg,y.rect(0,0,i,l),y.fill())}return m};function xte(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function RA(e){var t=e.indexOf(",");return e.substr(t+1)}function t3(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Dc(function(a,i){try{t.toBlob(function(l){l!=null?a(l):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(l){i(l)}});case"blob":return xte(RA(r()),n);case"base64":return RA(r());case"base64uri":default:return r()}}Jd.png=function(e){return t3(e,this.bufferCanvasImage(e),"image/png")};Jd.jpg=function(e){return t3(e,this.bufferCanvasImage(e),"image/jpeg")};var n3={};n3.nodeShapeImpl=function(e,t,n,r,a,i,l,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,l);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,l,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,l,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,o);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}};var bte=r3,wt=r3.prototype;wt.CANVAS_LAYERS=3;wt.SELECT_BOX=0;wt.DRAG=1;wt.NODE=2;wt.WEBGL=3;wt.CANVAS_TYPES=["2d","2d","2d","webgl2"];wt.BUFFER_COUNT=3;wt.TEXTURE_BUFFER=0;wt.MOTIONBLUR_BUFFER_NODE=1;wt.MOTIONBLUR_BUFFER_DRAG=2;function r3(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(wt.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(wt.CANVAS_LAYERS),contexts:new Array(wt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(wt.CANVAS_LAYERS),bufferCanvases:new Array(wt.BUFFER_COUNT),bufferContexts:new Array(wt.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var l=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=i,l.position="relative",l.zIndex="0",l.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[a]=i;var f={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};vX()&&(f["-ms-touch-action"]="none",f["touch-action"]="none");for(var c=0;c<wt.CANVAS_LAYERS;c++){var h=t.data.canvases[c]=r.createElement("canvas"),p=wt.CANVAS_TYPES[c];t.data.contexts[c]=h.getContext(p),t.data.contexts[c]||dn("Could not create canvas of type "+p),Object.keys(f).forEach(function(ie){h.style[ie]=f[ie]}),h.style.position="absolute",h.setAttribute("data-id","layer"+c),h.style.zIndex=String(wt.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(h),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[wt.NODE].setAttribute("data-id","layer"+wt.NODE+"-node"),t.data.canvases[wt.SELECT_BOX].setAttribute("data-id","layer"+wt.SELECT_BOX+"-selectbox"),t.data.canvases[wt.DRAG].setAttribute("data-id","layer"+wt.DRAG+"-drag"),t.data.canvases[wt.WEBGL]&&t.data.canvases[wt.WEBGL].setAttribute("data-id","layer"+wt.WEBGL+"-webgl");for(var c=0;c<wt.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=r.createElement("canvas"),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext("2d"),t.data.bufferCanvases[c].style.position="absolute",t.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility="hidden";t.pathsEnabled=!0;var m=_r(),y=function(W){return{x:(W.x1+W.x2)/2,y:(W.y1+W.y2)/2}},x=function(W){return{x:-W.w/2,y:-W.h/2}},b=function(W){var te=W[0]._private,oe=te.oldBackgroundTimestamp===te.backgroundTimestamp;return!oe},w=function(W){return W[0]._private.nodeKey},S=function(W){return W[0]._private.labelStyleKey},N=function(W){return W[0]._private.sourceLabelStyleKey},C=function(W){return W[0]._private.targetLabelStyleKey},T=function(W,te,oe,ye,Te){return t.drawElement(W,te,oe,!1,!1,Te)},R=function(W,te,oe,ye,Te){return t.drawElementText(W,te,oe,ye,"main",Te)},A=function(W,te,oe,ye,Te){return t.drawElementText(W,te,oe,ye,"source",Te)},D=function(W,te,oe,ye,Te){return t.drawElementText(W,te,oe,ye,"target",Te)},O=function(W){return W.boundingBox(),W[0]._private.bodyBounds},L=function(W){return W.boundingBox(),W[0]._private.labelBounds.main||m},M=function(W){return W.boundingBox(),W[0]._private.labelBounds.source||m},B=function(W){return W.boundingBox(),W[0]._private.labelBounds.target||m},P=function(W,te){return te},q=function(W){return y(O(W))},H=function(W,te,oe){var ye=W?W+"-":"";return{x:te.x+oe.pstyle(ye+"text-margin-x").pfValue,y:te.y+oe.pstyle(ye+"text-margin-y").pfValue}},G=function(W,te,oe){var ye=W[0]._private.rscratch;return{x:ye[te],y:ye[oe]}},F=function(W){return H("",G(W,"labelX","labelY"),W)},V=function(W){return H("source",G(W,"sourceLabelX","sourceLabelY"),W)},Y=function(W){return H("target",G(W,"targetLabelX","targetLabelY"),W)},Q=function(W){return x(O(W))},I=function(W){return x(M(W))},U=function(W){return x(B(W))},X=function(W){var te=L(W),oe=x(L(W));if(W.isNode()){switch(W.pstyle("text-halign").value){case"left":oe.x=-te.w-(te.leftPad||0);break;case"right":oe.x=-(te.rightPad||0);break}switch(W.pstyle("text-valign").value){case"top":oe.y=-te.h-(te.topPad||0);break;case"bottom":oe.y=-(te.botPad||0);break}}return oe},z=t.data.eleTxrCache=new Qf(t,{getKey:w,doesEleInvalidateKey:b,drawElement:T,getBoundingBox:O,getRotationPoint:q,getRotationOffset:Q,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Z=t.data.lblTxrCache=new Qf(t,{getKey:S,drawElement:R,getBoundingBox:L,getRotationPoint:F,getRotationOffset:X,isVisible:P}),re=t.data.slbTxrCache=new Qf(t,{getKey:N,drawElement:A,getBoundingBox:M,getRotationPoint:V,getRotationOffset:I,isVisible:P}),ae=t.data.tlbTxrCache=new Qf(t,{getKey:C,drawElement:D,getBoundingBox:B,getRotationPoint:Y,getRotationOffset:U,isVisible:P}),se=t.data.lyrTxrCache=new HL(t);t.onUpdateEleCalcs(function(W,te){z.invalidateElements(te),Z.invalidateElements(te),re.invalidateElements(te),ae.invalidateElements(te),se.invalidateElements(te);for(var oe=0;oe<te.length;oe++){var ye=te[oe]._private;ye.oldBackgroundTimestamp=ye.backgroundTimestamp}});var le=function(W){for(var te=0;te<W.length;te++)se.enqueueElementRefinement(W[te].ele)};z.onDequeue(le),Z.onDequeue(le),re.onDequeue(le),ae.onDequeue(le),e.webgl&&t.initWebgl(e,{getStyleKey:w,getLabelKey:S,getSourceLabelKey:N,getTargetLabelKey:C,drawElement:T,drawLabel:R,drawSourceLabel:A,drawTargetLabel:D,getElementBox:O,getLabelBox:L,getSourceLabelBox:M,getTargetLabelBox:B,getElementRotationPoint:q,getElementRotationOffset:Q,getLabelRotationPoint:F,getSourceLabelRotationPoint:V,getTargetLabelRotationPoint:Y,getLabelRotationOffset:X,getSourceLabelRotationOffset:I,getTargetLabelRotationOffset:U})}wt.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[wt.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[wt.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[wt.SELECT_BOX]=t;break;case"gc":n.data.gc=!0;break}};var wte=typeof Path2D<"u";wt.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};wt.usePaths=function(){return wte&&this.pathsEnabled};wt.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};wt.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};wt.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":$n(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n};[GL,Ai,gs,nS,zo,Ll,Lr,QL,Pl,Jd,n3].forEach(function(e){at(wt,e)});var Ste=[{name:"null",impl:DL},{name:"base",impl:UL},{name:"canvas",impl:bte}],Ete=[{type:"layout",extensions:YJ},{type:"renderer",extensions:Ste}],a3={},i3={};function s3(e,t,n){var r=n,a=function(O){zt("Can not register `"+t+"` for `"+e+"` since `"+O+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(xd.prototype[t])return a(t);xd.prototype[t]=n}else if(e==="collection"){if(dr.prototype[t])return a(t);dr.prototype[t]=n}else if(e==="layout"){for(var i=function(O){this.options=O,n.call(this,O),Mt(this._private)||(this._private={}),this._private.cy=O.cy,this._private.listeners=[],this.createEmitter()},l=i.prototype=Object.create(n.prototype),o=[],f=0;f<o.length;f++){var c=o[f];l[c]=l[c]||function(){return this}}l.start&&!l.run?l.run=function(){return this.start(),this}:!l.start&&l.run&&(l.start=function(){return this.run(),this});var h=n.prototype.stop;l.stop=function(){var D=this.options;if(D&&D.animate){var O=this.animations;if(O)for(var L=0;L<O.length;L++)O[L].stop()}return h?h.call(this):this.emit("layoutstop"),this},l.destroy||(l.destroy=function(){return this}),l.cy=function(){return this._private.cy};var p=function(O){return O._private.cy},m={addEventFields:function(O,L){L.layout=O,L.cy=p(O),L.target=O},bubble:function(){return!0},parent:function(O){return p(O)}};at(l,{createEmitter:function(){return this._private.emitter=new Tm(m,this),this},emitter:function(){return this._private.emitter},on:function(O,L){return this.emitter().on(O,L),this},one:function(O,L){return this.emitter().one(O,L),this},once:function(O,L){return this.emitter().one(O,L),this},removeListener:function(O,L){return this.emitter().removeListener(O,L),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(O,L){return this.emitter().emit(O,L),this}}),Bt.eventAliasesOn(l),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var y=l3("renderer","base"),x=y.prototype,b=n,w=n.prototype,S=function(){y.apply(this,arguments),b.apply(this,arguments)},N=S.prototype;for(var C in x){var T=x[C],R=w[C]!=null;if(R)return a(C);N[C]=T}for(var A in w)N[A]=w[A];x.clientFunctions.forEach(function(D){N[D]=N[D]||function(){dn("Renderer does not implement `renderer."+D+"()` on its prototype")}}),r=S}else if(e==="__proto__"||e==="constructor"||e==="prototype")return dn(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return NO({map:a3,keys:[e,t],value:r})}function l3(e,t){return kO({map:a3,keys:[e,t]})}function Cte(e,t,n,r,a){return NO({map:i3,keys:[e,t,n,r],value:a})}function Nte(e,t,n,r){return kO({map:i3,keys:[e,t,n,r]})}var x1=function(){if(arguments.length===2)return l3.apply(null,arguments);if(arguments.length===3)return s3.apply(null,arguments);if(arguments.length===4)return Nte.apply(null,arguments);if(arguments.length===5)return Cte.apply(null,arguments);dn("Invalid extension access syntax")};xd.prototype.extension=x1;Ete.forEach(function(e){e.extensions.forEach(function(t){s3(e.type,t.name,t.impl)})});var Ip=function(){if(!(this instanceof Ip))return new Ip;this.length=0},Oo=Ip.prototype;Oo.instanceString=function(){return"stylesheet"};Oo.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};Oo.css=function(e,t){var n=this.length-1;if(tt(e))this[n].properties.push({name:e,value:t});else if(Mt(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var l=a[i],o=r[l];if(o!=null){var f=ar.properties[l]||ar.properties[gm(l)];if(f!=null){var c=f.name,h=o;this[n].properties.push({name:c,value:h})}}}return this};Oo.style=Oo.css;Oo.generateStyle=function(e){var t=new ar(e);return this.appendToStyle(t)};Oo.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var l=a[i];e.css(l.name,l.value)}}return e};var kte="3.33.1",Lo=function(t){if(t===void 0&&(t={}),Mt(t))return new xd(t);if(tt(t))return x1.apply(x1,arguments)};Lo.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Lo),e.apply(null,t),this};Lo.warnings=function(e){return _O(e)};Lo.version=kte;Lo.stylesheet=Lo.Stylesheet=Ip;const Tte=/^#{1,6}\s+/,jte=/[*_`~]+/g,Ate=/\s+/g;function nl(e){return e.replace(Tte,"").replace(jte,"").replace(Ate," ").trim()}const Un={sage:"#abcfb8",ochre:"#edbf7f",terracotta:"#ffb4a1",neutral:"#8b928c",dimNeutral:"#6e7370",onSurface:"#e5e2e1",surface:"#111111"},Rte={concept:Un.sage,component:Un.ochre,bug:Un.terracotta,tool:Un.neutral,file:Un.neutral,spore:Un.sage,session:Un.ochre,other:Un.dimNeutral},Dte=Un.dimNeutral,DA=24,MA=60,Mte=12,_te=10,Ote=8,lb=1.5,Uv=.25,ob=.7,Lte=9,Pte=.7,Bte=4,zte=.6,Ite=1e4,Fte=120,_A=.2,Ute=600,qte=6e3,Vte=150,Hte=300,Vf=50,OA=20,LA={concept:"Concept",component:"Component",bug:"Bug",tool:"Tool",file:"File",spore:"Spore",session:"Session",other:"Other"};function Gte(e,t){if(t)return MA*1.2;const n=Math.min(e/Mte,1);return DA+n*(MA-DA)}function $te(e){const t=nl(e);return t.length<=OA?t:t.slice(0,OA-1)+"…"}function PA(e){return Rte[e==null?void 0:e.toLowerCase()]??Dte}function Kte({nodes:e,edges:t,onNodeSelect:n,centerId:r}){const a=j.useRef(null),i=j.useRef(null),l=j.useRef(n);l.current=n,j.useEffect(()=>{if(!a.current||e.length===0)return;const f=new Map(e.map(x=>[x.id,x])),c=new Map;for(const x of e)c.set(x.id,0);for(const x of t)c.set(x.source_id,(c.get(x.source_id)??0)+1),c.set(x.target_id,(c.get(x.target_id)??0)+1);const h=[...e.map(x=>{var S;const b=LA[(S=x.type)==null?void 0:S.toLowerCase()]??LA.other,w=x.id===r;return{data:{id:x.id,label:`${$te(x.name)}
|
|
823
|
-
${b}`,fullLabel:x.name,type:x.type,isCenter:w,degree:c.get(x.id)??0,nodeSize:Gte(c.get(x.id)??0,w)},classes:w?"center":""}}),...t.map((x,b)=>({data:{id:`edge-${b}`,source:x.source_id,target:x.target_id,label:x.label??"",weight:x.weight??1}}))],p=a.current.getBoundingClientRect();if(p.width===0||p.height===0)return;const m=Lo({container:a.current,elements:h,style:[{selector:"node",style:{label:"data(label)","background-color":x=>PA(x.data("type")),"background-opacity":.9,color:Un.onSurface,"font-size":_te,"font-family":"Inter, system-ui, sans-serif","text-valign":"bottom","text-margin-y":Ote,"text-outline-color":Un.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":"wrap","text-max-width":"120px",width:"data(nodeSize)",height:"data(nodeSize)","border-width":0,"border-color":Un.sage,"border-opacity":0,"overlay-opacity":0}},{selector:"node.center",style:{"border-width":2,"border-color":Un.onSurface,"border-opacity":.4,"text-outline-color":Un.surface,"text-outline-width":3,"font-weight":"bold"}},{selector:"node:active",style:{"overlay-opacity":.08,"overlay-color":Un.sage}},{selector:"node:selected",style:{"border-width":Bte,"border-color":x=>PA(x.data("type")),"border-opacity":zte,"background-opacity":1}},{selector:"edge",style:{width:lb,"line-color":Un.neutral,"line-opacity":Uv,"curve-style":"unbundled-bezier","control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":"triangle","target-arrow-color":Un.neutral,"arrow-scale":Pte,label:"data(label)","font-size":Lte,"font-family":"Inter, system-ui, sans-serif",color:Un.neutral,"text-opacity":0,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-color":Un.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:"edge:active",style:{"text-opacity":1,"line-opacity":ob}},{selector:"node.faded",style:{opacity:.3}},{selector:"edge.faded",style:{opacity:.1}}],layout:{name:"preset"},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3}),y=r?m.layout({name:"cose",animate:!0,animationDuration:Hte,nodeRepulsion:()=>qte,idealEdgeLength:()=>Vte,gravity:_A,nodeDimensionsIncludeLabels:!0,fit:!0,padding:Vf,randomize:!1}):m.layout({name:"cose",animate:!0,animationDuration:Ute,nodeRepulsion:()=>Ite,idealEdgeLength:()=>Fte,gravity:_A,nodeDimensionsIncludeLabels:!0,fit:!0,padding:Vf});return y.on("layoutstop",()=>{const x=i.current;if(!x)return;const b=x.nodes(),w=x.$("node.center");if(w.length>0){const S=w.closedNeighborhood();x.fit(S,Vf*1.5),x.zoom()>1.05&&(x.zoom(1.05),x.center(w))}else{const{ele:S,value:N}=b.max(C=>C.degree(!1));N>2&&b.length>20?x.animate({center:{eles:S},zoom:1.2,duration:300,easing:"ease-out"}):x.fit(void 0,Vf)}}),y.run(),m.on("tap","node",x=>{var C;const b=x.target,w=b.data();m.elements().removeClass("faded");const S=b.closedNeighborhood();m.elements().not(S).addClass("faded"),b.connectedEdges().style({"line-opacity":ob,"text-opacity":.9,width:2});const N=f.get(w.id);(C=l.current)==null||C.call(l,N??{id:w.id,name:w.fullLabel??w.label,type:w.type})}),m.on("tap",x=>{var b;x.target===m&&(m.elements().removeClass("faded"),m.edges().style({"line-opacity":Uv,"text-opacity":0,width:lb}),(b=l.current)==null||b.call(l,null))}),m.on("mouseover","edge",x=>{x.target.style("text-opacity",1),x.target.style("line-opacity",ob)}),m.on("mouseout","edge",x=>{const b=m.$("node:selected");b.length>0&&b.connectedEdges().contains(x.target)||(x.target.style("text-opacity",0),x.target.style("line-opacity",Uv))}),i.current=m,()=>{m.destroy(),i.current=null}},[e,t,r]);const o=j.useCallback(()=>{const f=i.current;f&&(f.elements().removeClass("faded"),f.edges().style({"line-opacity":Uv,"text-opacity":0,width:lb}),f.fit(void 0,Vf))},[]);return{containerRef:a,resetView:o}}function Yte({nodes:e,edges:t,onNodeSelect:n,centerId:r,isLoading:a}){const{containerRef:i,resetView:l}=Kte({nodes:e,edges:t,onNodeSelect:n,centerId:r});return d.jsxs("div",{className:"absolute inset-0",children:[d.jsx("div",{className:"absolute inset-0 rounded-md bg-surface-container-lowest",style:{backgroundImage:"radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)",backgroundSize:"40px 40px"}}),d.jsx("div",{ref:i,className:"absolute inset-0 rounded-md"}),d.jsxs("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-3",children:[e.length>0&&d.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60 mr-1",children:[d.jsxs("span",{children:[e.length," nodes"]}),d.jsxs("span",{children:[t.length," edges"]})]}),d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:l,className:"gap-1.5 h-7 text-[10px] px-2 bg-surface-container-high/40 backdrop-blur-sm",children:[d.jsx($p,{className:"h-3 w-3"}),"Reset View"]})]}),!a&&e.length===0&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No nodes to display"})})]})}const BA=400,Xte={concept:"default",component:"warning",bug:"destructive",tool:"secondary",file:"secondary",spore:"default",session:"warning"},zA={concept:"bg-primary",component:"bg-secondary",bug:"bg-tertiary",tool:"bg-outline",file:"bg-outline",spore:"bg-primary",session:"bg-secondary"};function Ws({label:e,value:t}){return d.jsxs("div",{className:"flex justify-between items-baseline py-1",children:[d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:e}),d.jsx("span",{className:"font-mono text-xs text-on-surface text-right max-w-[160px] truncate",children:t})]})}function IA(e){return e.type==="session"?`/sessions/${e.id}`:e.type==="spore"?`/mycelium?tab=spores&spore=${e.id}`:null}function Qte({node:e,edges:t,nodes:n,metadata:r,markdownPreview:a,connectedSpores:i,onClose:l,onNodeSelect:o,onNavigateToSpore:f,isConnectionsLoading:c}){const h=Za();if(!e)return null;const p=e.type.toLowerCase(),m=Xte[p]??"secondary",y=zA[p]??"bg-outline",x=new Map((n??[]).map(C=>[C.id,C])),b=[];for(const C of t??[])if(C.source_id===e.id){const T=x.get(C.target_id);T&&b.push({nodeId:T.id,nodeName:T.name,nodeType:T.type,edgeLabel:C.label??"connected",direction:"outgoing",status:T.status})}else if(C.target_id===e.id){const T=x.get(C.source_id);T&&b.push({nodeId:T.id,nodeName:T.name,nodeType:T.type,edgeLabel:C.label??"connected",direction:"incoming",status:T.status})}b.sort((C,T)=>C.nodeName.localeCompare(T.nodeName));const w=a??e.content,S=w&&w.length>BA?w.slice(0,BA)+"…":w,N=e.type==="spore"?"Observation":e.type==="session"?"Summary":"Notes";return d.jsxs($e,{glass:!0,className:"absolute top-3 right-3 bottom-3 z-20 w-[320px] overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md",children:[d.jsx("div",{className:"p-4 pb-3",children:d.jsxs("div",{className:"flex items-start justify-between gap-2",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[d.jsx("div",{className:`h-2 w-2 rounded-full ${y} shrink-0`}),d.jsx(xt,{variant:m,className:"text-[10px] uppercase",children:e.observation_type??e.type})]}),d.jsx("h2",{className:"font-serif text-lg text-on-surface leading-tight break-words",children:nl(e.name)}),d.jsx("div",{className:"flex flex-wrap items-center gap-3 mt-2",children:IA(e)&&d.jsxs("button",{onClick:()=>{e.type==="spore"&&f?f(e.id):h(IA(e))},className:"inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-primary transition-colors group cursor-pointer",children:[d.jsxs("span",{children:["View ",e.type]}),d.jsx(Hp,{className:"h-3 w-3 group-hover:translate-x-0.5 transition-transform"})]})})]}),l&&d.jsx("button",{onClick:l,className:"shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors",children:d.jsx(jl,{className:"h-4 w-4"})})]})}),d.jsx("div",{className:"h-px bg-surface-container-high/50"}),d.jsxs("div",{className:"px-4 py-3 space-y-0.5",children:[d.jsx(St,{children:"Metadata"}),d.jsxs("div",{className:"mt-1.5",children:[d.jsx(Ws,{label:"Type",value:e.observation_type??e.type}),d.jsx(Ws,{label:"ID",value:e.id.slice(0,12)+"…"}),e.status&&d.jsx(Ws,{label:"Status",value:e.status}),e.created_at!=null&&d.jsx(Ws,{label:"Created",value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&d.jsx(Ws,{label:"Mentions",value:String(e.mention_count)}),d.jsx(Ws,{label:"Connections",value:String(b.length)}),e.depth!==void 0&&d.jsx(Ws,{label:"Depth",value:String(e.depth)}),r&&Object.entries(r).map(([C,T])=>d.jsx(Ws,{label:C,value:T},C))]})]}),S&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-surface-container-high/50"}),d.jsxs("div",{className:"px-4 py-3 space-y-1.5",children:[d.jsx(St,{children:N}),d.jsx($e,{level:"lowest",className:"p-3",children:d.jsx(Mr,{content:S,className:"text-xs leading-relaxed text-on-surface-variant"})})]})]}),(b.length>0||c)&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-surface-container-high/50"}),d.jsxs("div",{className:"px-4 py-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs(St,{children:["Connections (",b.length,")"]}),c&&d.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-on-surface-variant",children:[d.jsx(Gn,{className:"h-3 w-3 animate-spin"}),"Updating"]})]}),d.jsx("div",{className:"space-y-1",children:b.map((C,T)=>{const R=C.nodeType.toLowerCase(),A=zA[R]??"bg-outline";return d.jsx("button",{className:"group w-full rounded-md border border-transparent px-2 py-2 text-left transition-colors hover:border-outline-variant/10 hover:bg-surface-container-high/50",onClick:()=>{const D=x.get(C.nodeId);o==null||o(D??{id:C.nodeId,name:C.nodeName,type:C.nodeType,status:C.status},"inspector")},children:d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("div",{className:`mt-1 h-2 w-2 rounded-full ${A} shrink-0`}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"truncate font-sans text-xs text-on-surface transition-colors group-hover:text-primary",children:nl(C.nodeName)}),d.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-[9px] uppercase tracking-wider text-on-surface-variant/60",children:[d.jsx("span",{children:C.nodeType}),d.jsx("span",{children:"•"}),d.jsx("span",{children:C.edgeLabel})]})]}),d.jsx(Tb,{className:`mt-0.5 h-3 w-3 shrink-0 text-on-surface-variant/50 ${C.direction==="incoming"?"rotate-180":""}`})]})},`${C.nodeId}-${C.edgeLabel}-${T}`)})})]})]}),i&&i.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-surface-container-high/50"}),d.jsxs("div",{className:"px-4 py-3 space-y-1.5",children:[d.jsx(St,{children:"Connected Spores"}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(C=>d.jsx(xt,{variant:"secondary",className:"cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors",children:C.name},C.id))})]})]})]})}const Wte=15e3,Zte=3e4,aS=3e4,Jte=6e4;function ene(e){const t=new URLSearchParams;e!=null&&e.type&&t.set("type",e.type),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/spores?${n}`:"/spores";return qt({queryKey:["spores",e],queryFn:({signal:a})=>lt(r,{signal:a}),staleTime:Wte})}function tne(e){return qt({queryKey:["spore",e],queryFn:({signal:t})=>lt(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:Zte})}function FA(e,t=1,n=!0){return qt({queryKey:["graph",e,t],queryFn:({signal:r})=>lt(`/graph/${e}?depth=${t}`,{signal:r}),enabled:n&&e!==void 0,staleTime:aS})}function nne(e=!0){return qt({queryKey:["full-graph"],queryFn:({signal:t})=>lt("/graph",{signal:t}),enabled:e,staleTime:aS})}function rne(){return qt({queryKey:["graph-seeds"],queryFn:({signal:e})=>lt("/graph/seeds",{signal:e}),staleTime:aS})}function ane(e){const t=e?`/digest?agent_id=${encodeURIComponent(e)}`:"/digest";return qt({queryKey:["digest",e],queryFn:({signal:n})=>lt(t,{signal:n}),staleTime:Jte})}function o3(e){switch(e){case"wisdom":return"bg-primary/15 text-primary";case"discovery":return"bg-primary/15 text-primary";case"decision":return"bg-secondary/15 text-secondary";case"trade_off":return"bg-secondary/15 text-secondary";case"gotcha":return"bg-tertiary/15 text-tertiary";case"bug_fix":return"bg-tertiary/15 text-tertiary";default:return"bg-surface-container text-on-surface-variant"}}function u3(e){switch(e){case"active":return"bg-primary/15 text-primary";case"consolidated":return"bg-surface-container-high text-on-surface-variant";case"superseded":return"bg-tertiary/10 text-tertiary/70";default:return"bg-surface-container text-on-surface-variant"}}function So(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}const ine=120,sne=1e3,lne=[rr,"gotcha","decision","discovery","trade_off","bug_fix"],one=[rr,"active","superseded","consolidated"],une=[{key:"type",label:"Type",options:lne.map(e=>({value:e,label:e===rr?"All types":So(e)}))},{key:"status",label:"Status",options:one.map(e=>({value:e,label:e===rr?"All statuses":So(e)}))}];function cne(e){return new Date(e*sne).toLocaleDateString()}function fne({spore:e,onClick:t,isSelected:n}){return d.jsx($e,{level:n?"high":"low",className:ke("p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",n&&"ring-1 ring-primary/30"),onClick:t,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())},tabIndex:0,role:"button","aria-label":`${So(e.observation_type)} spore: ${bp(e.content,ine)}`,"aria-pressed":n,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("span",{className:ke("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold",o3(e.observation_type)),children:So(e.observation_type)}),d.jsx("span",{className:ke("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold",u3(e.status)),children:So(e.status)}),e.importance!==null&&d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.importance.toFixed(1)})]}),d.jsx(Mr,{content:e.content,compact:!0,className:"text-on-surface line-clamp-2"})]}),d.jsxs("div",{className:"shrink-0 text-right space-y-1",children:[e.session_id&&d.jsx("div",{className:"font-mono text-xs text-on-surface-variant",children:gl(e.session_id)}),d.jsx("div",{className:"font-sans text-xs text-on-surface-variant",children:cne(e.created_at)})]})]})})}function dne(){return d.jsx($e,{level:"low",className:"p-4 rounded-lg",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx("div",{className:"h-5 w-16 animate-pulse rounded bg-surface-container"}),d.jsx("div",{className:"h-5 w-14 animate-pulse rounded bg-surface-container"})]}),d.jsx("div",{className:"h-4 w-3/4 animate-pulse rounded bg-surface-container"})]}),d.jsxs("div",{className:"shrink-0 space-y-1",children:[d.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-surface-container"}),d.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-surface-container"})]})]})})}function hne({onSelectSpore:e,selectedSporeId:t}){const{searchInput:n,debouncedSearch:r,filterValues:a,offset:i,setOffset:l,handleSearchChange:o,handleFilterChange:f,activeFilter:c}=Ud({initialFilters:{type:rr,status:rr}}),h=c("type"),p=c("status"),{data:m,isLoading:y,isError:x,error:b}=ene({type:h,status:p,search:r,limit:Qr,offset:i}),w=(m==null?void 0:m.spores)??[],S=(m==null?void 0:m.total)??0;return d.jsxs("div",{className:"space-y-3",children:[d.jsx(Fd,{searchPlaceholder:"Search spores...",searchValue:n,onSearchChange:o,filters:une,filterValues:a,onFilterChange:f}),x?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load spores"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:b instanceof Error?b.message:"Unknown error"})]}):d.jsx("div",{className:"space-y-2",children:y?[1,2,3,4,5].map(N=>d.jsx(dne,{},N)):w.length===0?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Qz,{className:"h-8 w-8 opacity-30"}),d.jsx("span",{className:"font-sans text-sm",children:S===0&&!r&&!h&&!p?"No spores yet":"No matching spores"}),S===0&&!r&&!h&&!p&&d.jsx("span",{className:"font-sans text-xs",children:"Spores are extracted from session activity by the agent"})]}):w.map(N=>d.jsx(fne,{spore:N,onClick:()=>e(N),isSelected:N.id===t},N.id))}),d.jsx(Ac,{total:S,offset:i,limit:Qr,onPageChange:l})]})}const vne=12,UA=8;function pne({type:e}){return d.jsx("span",{className:ke("inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold",o3(e)),children:So(e)})}function mne({status:e}){return d.jsx("span",{className:ke("inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold",u3(e)),children:So(e)})}function Hf({label:e,value:t,children:n}){return d.jsxs("div",{className:"flex items-start justify-between gap-3 py-1.5",children:[d.jsx("span",{className:"shrink-0 font-sans text-xs text-on-surface-variant",children:e}),n??d.jsx("span",{className:"font-mono text-xs text-on-surface text-right break-all",children:t})]})}function gne({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){const a=Za(),{data:i,isLoading:l,isError:o,error:f}=tne(e);if(l)return d.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Gn,{className:"h-5 w-5 animate-spin"}),d.jsx("span",{className:"font-sans",children:"Loading spore..."})]});if(o||!i)return d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Spore not found"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:f instanceof Error?f.message:"Unknown error"})]});const c=(()=>{if(!i.tags)return[];if(i.tags.startsWith("["))try{return JSON.parse(i.tags)}catch{}return i.tags.split(",").map(h=>h.trim()).filter(Boolean)})();return d.jsxs("div",{className:"space-y-6",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Spores"]}),d.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[d.jsx(pne,{type:i.observation_type}),d.jsx(mne,{status:i.status}),i.importance!==null&&d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Importance: ",d.jsx("span",{className:"text-on-surface font-medium",children:i.importance.toFixed(1)})]}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant ml-auto",children:bi(i.created_at)})]}),d.jsxs($e,{level:"low",className:"p-5",children:[d.jsx(St,{className:"mb-2",children:"Observation"}),d.jsx(Mr,{content:i.content})]}),i.context&&d.jsxs($e,{level:"low",className:"p-5",children:[d.jsx(St,{className:"mb-2",children:"Context"}),d.jsx(Mr,{content:i.context})]}),c.length>0&&d.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map(h=>d.jsx("span",{className:"inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant",children:h},h))}),(i.predecessor_id||i.successor_id)&&d.jsxs($e,{level:"low",className:"p-5 space-y-2",children:[d.jsx(St,{children:"Resolution History"}),i.predecessor_id&&d.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs text-on-surface-variant",children:[d.jsx("span",{children:"Supersedes"}),d.jsxs("button",{className:"font-mono text-primary hover:underline flex items-center gap-1",onClick:()=>n==null?void 0:n(i.predecessor_id),children:[i.predecessor_id.slice(0,UA),d.jsx(Tb,{className:"h-3 w-3"})]})]}),i.successor_id&&d.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs text-on-surface-variant",children:[d.jsx("span",{children:"Superseded by"}),d.jsxs("button",{className:"font-mono text-primary hover:underline flex items-center gap-1",onClick:()=>n==null?void 0:n(i.successor_id),children:[i.successor_id.slice(0,UA),d.jsx(Tb,{className:"h-3 w-3"})]})]})]}),d.jsxs($e,{glass:!0,className:"p-5",children:[d.jsx(St,{className:"mb-2",children:"Metadata"}),d.jsxs("div",{className:"text-sm",children:[d.jsx(Hf,{label:"ID",value:i.id}),d.jsx(Hf,{label:"Created",value:Hb(i.created_at)}),d.jsx(Hf,{label:"Updated",value:Hb(i.updated_at)}),i.session_id&&d.jsx(Hf,{label:"Session",children:d.jsxs("button",{className:"font-mono text-xs text-primary hover:underline flex items-center gap-1",onClick:()=>a(`/sessions/${i.session_id}`),children:[i.session_id.slice(0,vne),d.jsx(Hp,{className:"h-3 w-3"})]})}),i.agent_id&&d.jsx(Hf,{label:"Agent",value:i.agent_id})]})]})]})}const ub=200,yne={1500:"T1500 — Compact",5e3:"T5000 — Standard",1e4:"T10000 — Full"};function xne(e){return yne[e]??`T${e}`}function bne({tier:e}){const[t,n]=j.useState(!1),r=e.content.length>ub,a=r&&!t?e.content.slice(0,ub)+"…":e.content;return d.jsxs($e,{level:"low",className:"p-5 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[d.jsx("span",{className:"font-mono text-sm text-on-surface font-medium",children:xne(e.tier)}),d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Generated ",bi(e.generated_at)]})]}),d.jsx(Mr,{content:a}),r&&d.jsx(Ae,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs text-on-surface-variant",onClick:()=>n(!t),children:t?d.jsxs(d.Fragment,{children:[d.jsx(kz,{className:"h-3 w-3"}),"Show less"]}):d.jsxs(d.Fragment,{children:[d.jsx(La,{className:"h-3 w-3"}),"Show more (",e.content.length-ub," more chars)"]})})]})}function wne(){return d.jsxs($e,{level:"low",className:"p-5",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-surface-container"}),d.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-surface-container"})]}),d.jsxs("div",{className:"space-y-2 mt-3",children:[d.jsx("div",{className:"h-3 animate-pulse rounded bg-surface-container"}),d.jsx("div",{className:"h-3 w-4/5 animate-pulse rounded bg-surface-container"}),d.jsx("div",{className:"h-3 w-3/5 animate-pulse rounded bg-surface-container"})]})]})}function Sne({agentId:e}){const{data:t,isLoading:n,isError:r,error:a}=ane(e),i=(t==null?void 0:t.tiers)??[];return n?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(l=>d.jsx(wne,{},l))}):r?d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load digest"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:a instanceof Error?a.message:"Unknown error"})]}):i.length===0?d.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Pz,{className:"h-8 w-8 opacity-30"}),d.jsx("span",{className:"font-sans text-sm",children:"No digest generated yet"}),d.jsx("span",{className:"font-sans text-xs text-center max-w-xs",children:"Run the agent with the digest-only task to synthesize your vault knowledge into context extracts."})]}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("p",{className:"font-sans text-sm text-on-surface-variant",children:[i.length," tier",i.length!==1?"s":""," — pre-computed context extracts at different token budgets."]}),i.map(l=>d.jsx(bne,{tier:l},l.tier))]})}const qA=new Set(["concept","component","bug","tool","file","spore","session","other"]),Ene=200,VA="right-[332px]",Cne=6,Nne="h-[calc(100vh-285px)]",kne=[{id:"graph",label:"Graph"},{id:"spores",label:"Spores"},{id:"digest",label:"Digest"}],c3="tab",f3="spore",Tne=new Set(["graph","spores","digest"]);function HA(){const e=new URLSearchParams(window.location.search),t=e.get(c3),n=e.get(f3)??void 0;return{tab:n?"spores":t&&Tne.has(t)?t:"graph",sporeId:n}}function jne(e,t){const n=new URLSearchParams;e!=="graph"&&n.set(c3,e),t&&n.set(f3,t);const r=n.toString(),a=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.pushState(null,"",a)}function GA(e){if(!e)return[];const t=[];return"center"in e&&e.center&&t.push(e.center),e.nodes&&t.push(...e.nodes),t}function Ane({onNavigateToSpore:e}){var ae,se;const[t,n]=j.useState("focus"),[r,a]=j.useState(null),[i,l]=j.useState(2),[o]=j.useState(new Set(qA)),[f,c]=j.useState(""),[h,p]=j.useState(null),[m,y]=j.useState([]),{data:x,isLoading:b}=rne(),w=t==="focus"&&r!==null,S=t==="global",{data:N,isLoading:C}=nne(S||f.length>0),{data:T,isLoading:R}=FA(r??void 0,i,w),A=h!==null&&h.id!==r,{data:D,isLoading:O}=FA(h==null?void 0:h.id,1,A),L=t==="global"?N:T,M=t==="global"?C:b||w&&R,B=(((ae=N==null?void 0:N.nodes)==null?void 0:ae.length)??0)>Ene;j.useEffect(()=>{if(!r&&(x!=null&&x.recommended_id)){const le=x.seeds.find(ie=>ie.id===x.recommended_id)??x.seeds[0];le&&(a(le.id),p(le),y([le]))}},[r,x]),j.useEffect(()=>{var le;t==="focus"&&r&&((le=T==null?void 0:T.center)==null?void 0:le.id)===r&&(p(T.center),y(ie=>{if(ie.length===0)return[T.center];const W=ie[ie.length-1];return(W==null?void 0:W.id)===T.center.id?[...ie.slice(0,-1),T.center]:ie}))},[r,T,t]);const P=(h==null?void 0:h.id)===r?T:D,q=(h==null?void 0:h.id)===r?R:O,H=j.useMemo(()=>GA(P),[P]),G=(P==null?void 0:P.edges)??[],F=j.useMemo(()=>GA(L),[L]),V=j.useMemo(()=>F.filter(le=>{const ie=le.type.toLowerCase(),W=qA.has(ie)?ie:"other";return!!o.has(W)}),[F,o]),Y=j.useMemo(()=>{const le=(L==null?void 0:L.edges)??[],ie=new Set(V.map(W=>W.id));return le.filter(W=>ie.has(W.source_id)&&ie.has(W.target_id))},[L==null?void 0:L.edges,V]),Q=j.useCallback((le,ie="canvas")=>{if(p(le),!!le){if(t==="focus"){a(W=>W===le.id?W:(y(te=>[...te,le].slice(-3)),le.id));return}ie==="inspector"&&(a(le.id),n("focus"))}},[t]),I=j.useCallback(()=>{n("global")},[]),U=j.useCallback(()=>{!r&&h&&(y([h]),a(h.id)),n("focus")},[r,h]),X=j.useCallback(le=>{y(ie=>{const W=ie.findIndex(te=>te.id===le.id);return W>=0?ie.slice(0,W+1):ie}),a(le.id),p(le),n("focus")},[]),z=j.useCallback(()=>{y(le=>{if(le.length<=1)return le;const ie=le.slice(0,-1),W=ie[ie.length-1];return W&&(a(W.id),p(W),n("focus")),ie})},[]),Z=j.useMemo(()=>{const le=(N==null?void 0:N.nodes)??[];return le.length>0?le:F},[N==null?void 0:N.nodes,F]),re=f?Z.filter((le,ie,W)=>W.findIndex(te=>te.id===le.id)===ie).filter(le=>nl(le.name).toLowerCase().includes(f.toLowerCase())).slice(0,Cne):[];return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"rounded-lg border border-outline-variant/20 bg-surface-container/72 px-4 py-3 shadow-sm",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs("div",{className:"relative min-w-[260px] flex-1 max-w-[420px]",children:[d.jsx(xc,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-on-surface-variant/60"}),d.jsx(fn,{placeholder:"Find a node or idea...",value:f,onChange:le=>c(le.target.value),className:"h-9 pl-9"})]}),d.jsxs("div",{className:"flex rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-sm",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",className:ke("h-8 px-3 gap-1.5 transition-all",t==="global"?"bg-surface-container-lowest text-primary shadow-sm":"text-on-surface-variant hover:text-on-surface"),onClick:I,children:[d.jsx(rD,{className:"h-3.5 w-3.5"}),d.jsx("span",{className:"text-xs font-medium",children:"Overview"})]}),d.jsxs(Ae,{variant:"ghost",size:"sm",disabled:!r&&!h,className:ke("h-8 px-3 gap-1.5 transition-all",t==="focus"?"bg-surface-container-lowest text-primary shadow-sm":"text-on-surface-variant hover:text-on-surface",!r&&!h&&"cursor-not-allowed opacity-50"),onClick:U,children:[d.jsx(Jz,{className:"h-3.5 w-3.5"}),d.jsx("span",{className:"text-xs font-medium",children:"Focus"})]})]}),t==="focus"&&d.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-sm",children:[d.jsx("span",{className:"px-2 font-mono text-[10px] uppercase tracking-wider text-on-surface-variant",children:"Depth"}),[1,2,3].map(le=>d.jsx(Ae,{variant:"ghost",size:"sm",className:ke("h-7 min-w-7 rounded-md border px-2 font-mono text-[10px] transition-all",i===le?"border-primary/40 bg-primary/15 text-primary shadow-sm font-bold":"border-transparent text-on-surface-variant hover:border-outline-variant/20 hover:text-on-surface"),onClick:()=>l(le),children:le},le))]})]}),re.length>0&&d.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 pt-1",children:[d.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-on-surface-variant",children:"Jump To"}),re.map(le=>d.jsx("button",{type:"button",onClick:()=>Q(le,"inspector"),className:ke("max-w-[220px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors",(h==null?void 0:h.id)===le.id?"border-primary/40 bg-primary/10 text-on-surface":"border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface"),title:nl(le.name),children:nl(le.name)},le.id))]}),f&&re.length===0&&N&&d.jsxs("div",{className:"mt-3 border-t border-outline-variant/10 pt-3 text-sm text-on-surface-variant",children:['No graph nodes matched `"',f,'"`.']}),m.length>0&&d.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-outline-variant/10 pt-3",children:[d.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-on-surface-variant",children:"Trail"}),m.length>1&&d.jsx(Ae,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-[10px]",onClick:z,children:"Back"}),m.map(le=>d.jsx("button",{type:"button",onClick:()=>X(le),className:ke("max-w-[180px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors",r===le.id?"border-primary/40 bg-primary/10 text-on-surface":"border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface"),title:nl(le.name),children:nl(le.name)},le.id))]})]}),d.jsxs("div",{className:ke("relative",Nne),children:[M&&d.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center rounded-md bg-surface-container-lowest/50 backdrop-blur-[2px] transition-opacity",children:d.jsxs("div",{className:"flex flex-col items-center gap-3",children:[d.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"}),d.jsxs("span",{className:"text-xs font-mono animate-pulse text-on-surface-variant",children:["Cultivating ",t," graph..."]})]})}),d.jsx("div",{className:ke("absolute inset-y-3 left-3",h?VA:"right-3"),children:d.jsx(Yte,{nodes:V,edges:Y,onNodeSelect:Q,selectedNode:h,centerId:t==="focus"?r:null,isLoading:M})}),t==="global"&&B&&d.jsxs("div",{className:ke("absolute bottom-3 left-3 z-10 flex max-w-[280px] flex-col items-start gap-2 rounded-lg border border-warning/20 bg-warning-container/80 p-3 text-on-warning-container shadow-lg backdrop-blur-sm",h?VA:"right-3"),children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(B1,{className:"h-4 w-4 shrink-0 text-warning"}),d.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",children:"Overview Snapshot"})]}),d.jsxs("p",{className:"text-[11px] leading-relaxed text-on-warning-container/80",children:["This overview still contains ",(se=N==null?void 0:N.nodes)==null?void 0:se.length," nodes. Use Focus mode for navigation and step through connections from the drawer."]}),d.jsx(Ae,{variant:"destructive",size:"sm",className:"mt-1 h-7 w-full px-3 text-[10px]",onClick:U,children:"Return to Focus"})]}),d.jsx(Qte,{node:h,edges:G,nodes:H,onClose:()=>p(null),onNodeSelect:Q,onNavigateToSpore:e,isConnectionsLoading:q})]})]})}function Rne(){const e=Ba(),t=HA(),[n,r]=j.useState(t.tab),[a,i]=j.useState(t.sporeId?{id:t.sporeId}:null),l=j.useRef(!1),o=j.useRef(!1);j.useEffect(()=>{if(!l.current){l.current=!0;return}if(o.current){o.current=!1;return}jne(n,a==null?void 0:a.id)},[n,a==null?void 0:a.id]),j.useEffect(()=>{o.current=!0;const m=HA();r(m.tab),i(m.sporeId?{id:m.sporeId}:null)},[e.search,e.key]);function f(m){i(m)}function c(){i(null)}function h(m){i({id:m})}function p(m){r(m),m!=="spores"&&i(null)}return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsx(wi,{title:"Mycelium",subtitle:"Derived intelligence — spores, entity graph, and synthesized context.",tabs:kne,activeTab:n,onTabChange:m=>p(m)}),n==="graph"&&d.jsx(Ane,{onNavigateToSpore:m=>{r("spores"),i({id:m})}}),n==="spores"&&(a?d.jsx(gne,{id:a.id,onBack:c,onNavigateToSpore:h}):d.jsx(hne,{onSelectSpore:f})),n==="digest"&&d.jsx(Sne,{})]})}const Dne=[{value:rr,label:"All statuses"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}];function Mne({status:e}){const t=f_(e);return d.jsx("span",{className:ke("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold",t==="default"?"bg-primary-container/20 text-primary":t==="destructive"?"bg-tertiary-container/20 text-tertiary":t==="warning"?"bg-secondary-container/20 text-secondary":"bg-surface-container-high text-on-surface-variant"),children:yw(e)})}function _ne(){return d.jsx("tr",{className:"border-b border-outline-variant/20",children:[200,80,100,80,80].map((e,t)=>d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:ke("h-4 animate-pulse rounded bg-surface-container"),style:{width:e}})},t))})}function One({run:e,onClick:t,taskNameMap:n}){const r=e.task?n.get(e.task)??e.task:h_;return d.jsxs("tr",{className:"border-b border-outline-variant/20 last:border-0 hover:bg-surface-container-high/50 cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Agent run: ${r}, status ${e.status}`,children:[d.jsx("td",{className:"px-4 py-3",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Dd,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),d.jsx("span",{className:"text-sm font-medium text-on-surface truncate max-w-xs",children:r})]})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(Mne,{status:e.status})}),d.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:om(e.started_at)}),d.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:lm(e.started_at,e.completed_at)}),d.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:Ew(e.tokens_used)}),d.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:Sw(e.cost_usd)})]})}function Lne({onSelectRun:e,onTriggerRun:t}){const{searchInput:n,debouncedSearch:r,filterValues:a,offset:i,setOffset:l,handleSearchChange:o,handleFilterChange:f,activeFilter:c}=Ud({initialFilters:{status:rr,task:rr}}),{data:h}=Nc(),p=j.useMemo(()=>{const O=new Map;for(const L of(h==null?void 0:h.tasks)??[])O.set(L.name,L.displayName);return O},[h]),m=j.useMemo(()=>{const O=[{value:rr,label:"All tasks"}];for(const L of(h==null?void 0:h.tasks)??[])O.push({value:L.name,label:L.displayName});return O},[h]),y=j.useMemo(()=>[{key:"status",label:"Status",options:Dne},{key:"task",label:"Task",options:m}],[m]),x=c("status"),b=c("task"),{data:w,isLoading:S,isError:N,error:C}=c_({limit:Qr,offset:i,search:r,status:x,task:b}),T=(w==null?void 0:w.runs)??[],R=(w==null?void 0:w.total)??0,A=d.jsx(Fd,{searchPlaceholder:"Search runs...",searchValue:n,onSearchChange:o,filters:y,filterValues:a,onFilterChange:f}),D=d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-outline-variant/20 bg-surface-container/50",children:[d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Task"}),d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Status"}),d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Started"}),d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Duration"}),d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Tokens"}),d.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Cost"})]})});return N?d.jsxs("div",{className:"space-y-4",children:[A,d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load runs"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:C instanceof Error?C.message:"Unknown error"})]})]}):d.jsxs("div",{className:"space-y-4",children:[A,S?d.jsx("div",{className:"rounded-md bg-surface-container-low overflow-hidden",children:d.jsxs("table",{className:"w-full",children:[D,d.jsx("tbody",{children:[1,2,3].map(O=>d.jsx(_ne,{},O))})]})}):T.length===0?d.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-3 rounded-md bg-surface-container-low text-on-surface-variant",children:[d.jsx(Dd,{className:"h-10 w-10 opacity-30"}),d.jsxs("div",{className:"text-center font-sans",children:[d.jsx("p",{className:"text-sm",children:R===0&&!r&&!x&&!b?"No agent runs yet":"No matching runs"}),R===0&&!r&&!x&&!b&&d.jsx("p",{className:"text-xs mt-1",children:"Trigger the first run to see the agent at work"})]}),R===0&&!r&&!x&&!b&&d.jsxs(Ae,{variant:"outline",size:"sm",className:"gap-2 mt-2",onClick:t,children:[d.jsx(ss,{className:"h-3.5 w-3.5"}),"Run Now"]})]}):d.jsx("div",{className:"rounded-md bg-surface-container-low overflow-hidden",children:d.jsxs("table",{className:"w-full","aria-label":"Agent runs",children:[D,d.jsx("tbody",{children:T.map(O=>d.jsx(One,{run:O,taskNameMap:p,onClick:()=>e(O.id)},O.id))})]})}),d.jsx(Ac,{total:R,offset:i,limit:Qr,onPageChange:l})]})}function Pne({text:e}){const[t,n]=j.useState(!1),r=e.length>200||e.includes(`
|
|
824
|
-
`);return d.jsxs("div",{className:"mt-1",children:[d.jsx("div",{className:!t&&r?"line-clamp-2":void 0,children:d.jsx(Mr,{content:e,className:"text-on-surface-variant [&>*]:text-on-surface-variant"})}),r&&d.jsx("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1",onClick:()=>n(!t),children:t?d.jsxs(d.Fragment,{children:[d.jsx(La,{className:"h-3 w-3"})," Show less"]}):d.jsxs(d.Fragment,{children:[d.jsx(ha,{className:"h-3 w-3"})," Show more"]})})]})}function Bne({phases:e}){return d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"font-sans text-sm font-medium text-on-surface",children:"Phase Execution"}),e.map((t,n)=>d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high font-mono text-sm font-medium text-on-surface-variant shrink-0",children:n+1}),d.jsxs($e,{level:"default",className:"flex-1 p-3",children:[d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface",children:t.name}),d.jsx(xt,{variant:f_(t.status),children:t.status})]}),d.jsxs("div",{className:"flex gap-3 font-mono text-xs text-on-surface-variant",children:[d.jsxs("span",{children:[t.turnsUsed," turns"]}),d.jsx("span",{children:Ew(t.tokensUsed)}),d.jsx("span",{children:Sw(t.costUsd)})]})]}),t.summary&&d.jsx(Pne,{text:t.summary})]})]},t.name))]})}const $A=80,zne=1e3;function Ine(e){const t=e.toLowerCase();return t.includes("extract")||t.includes("create")||t.includes("supersed")||t.includes("update")?"default":t.includes("skip")||t.includes("no-op")?"secondary":t.includes("error")||t.includes("fail")?"destructive":"default"}function Fne(e){return e===null?"—":new Date(e*zne).toLocaleTimeString()}function Une(e,t){return e&&bp(e,t)||"—"}function qne({report:e}){const[t,n]=j.useState(!1),[r,a]=j.useState(!1),i=e.details!==null&&e.details.length>0,l=e.summary.length>200||e.summary.includes(`
|
|
825
|
-
`);let o=null;if(i)try{o=JSON.parse(e.details)}catch{o=e.details}return d.jsxs($e,{level:"low",className:"p-4 space-y-2",children:[d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(xt,{variant:Ine(e.action),children:e.action}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:!r&&l?"line-clamp-3":void 0,children:d.jsx(Mr,{content:e.summary})}),l&&d.jsx("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1",onClick:()=>a(!r),children:r?d.jsxs(d.Fragment,{children:[d.jsx(La,{className:"h-3 w-3"})," Show less"]}):d.jsxs(d.Fragment,{children:[d.jsx(ha,{className:"h-3 w-3"})," Show more"]})})]}),d.jsx("span",{className:"font-mono text-xs text-on-surface-variant shrink-0",children:Fne(e.created_at)})]}),i&&d.jsxs("div",{children:[d.jsxs("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors",onClick:()=>n(!t),children:[t?d.jsx(La,{className:"h-3.5 w-3.5"}):d.jsx(ha,{className:"h-3.5 w-3.5"}),t?"Hide details":"Show details"]}),t&&d.jsx("pre",{className:"mt-2 rounded-md bg-surface-container-lowest p-3 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]})]})}function Vne({turn:e}){const[t,n]=j.useState(!1);let r=null;if(e.tool_input)try{r=JSON.parse(e.tool_input)}catch{r=e.tool_input}const a=e.tool_input?Une(e.tool_input,$A):"—",i=e.tool_input!==null&&e.tool_input.length>$A;return d.jsx("div",{className:"px-4 py-2.5 hover:bg-surface-container-high/30 transition-colors border-b border-outline-variant/10 last:border-b-0",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx("span",{className:"font-mono text-xs text-on-surface-variant w-5 shrink-0 pt-0.5 text-right",children:e.turn_number}),d.jsx("span",{className:"font-mono text-xs font-medium text-on-surface shrink-0 pt-0.5 min-w-[140px]",children:e.tool_name}),d.jsxs("div",{className:"flex-1 min-w-0",children:[i?d.jsxs("button",{className:"flex items-start gap-1 text-left font-mono text-xs text-on-surface-variant hover:text-on-surface transition-colors w-full",onClick:()=>n(!t),children:[t?d.jsx(La,{className:"h-3 w-3 mt-0.5 shrink-0"}):d.jsx(ha,{className:"h-3 w-3 mt-0.5 shrink-0"}),d.jsx("span",{className:t?void 0:"truncate",children:a})]}):d.jsx("span",{className:"font-mono text-xs text-on-surface-variant truncate block",children:a}),t&&r!==null&&d.jsx("pre",{className:"mt-1.5 ml-4 rounded-md bg-surface-container-lowest p-2.5 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant",children:typeof r=="string"?r:JSON.stringify(r,null,2)})]})]})})}function Hne({runId:e,onBack:t}){var T;const[n,r]=j.useState(!1),{data:a,isLoading:i,isError:l}=MG(e),o=(T=a==null?void 0:a.run)==null?void 0:T.status,{data:f,isLoading:c}=_G(e,o),{data:h,isLoading:p}=OG(n?e:void 0,o),{data:m}=Nc(),y=j.useMemo(()=>(m==null?void 0:m.tasks)??[],[m]);if(i)return d.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[d.jsx(Gn,{className:"h-5 w-5 animate-spin"}),d.jsx("span",{className:"font-sans",children:"Loading run..."})]});if(l||!(a!=null&&a.run))return d.jsxs("div",{className:"space-y-4",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Runs"]}),d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Run not found"})]})]});const x=a.run,b=(f==null?void 0:f.reports)??[],w=h??[];let S=null,N,C;if(x.actions_taken)try{const R=JSON.parse(x.actions_taken);R!=null&&R.phases&&Array.isArray(R.phases)&&(S=R.phases),typeof(R==null?void 0:R.model)=="string"&&(N=R.model),typeof(R==null?void 0:R.provider)=="string"&&(C=R.provider)}catch{}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Runs"]}),d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[d.jsx(Yt,{label:"Status",value:yw(x.status),accent:"sage"}),d.jsx(Yt,{label:"Task",value:v_(x.task,y),accent:"outline"}),d.jsx(Yt,{label:"Started",value:om(x.started_at),accent:"outline"}),d.jsx(Yt,{label:"Duration",value:lm(x.started_at,x.completed_at),accent:"outline"}),d.jsx(Yt,{label:"Tokens",value:Ew(x.tokens_used),accent:"ochre"}),d.jsx(Yt,{label:"Cost",value:Sw(x.cost_usd),accent:"ochre"})]}),(N||C)&&d.jsxs("div",{className:"flex items-center gap-4 px-1",children:[C&&d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Provider: ",d.jsx("span",{className:"font-mono text-on-surface",children:C})]}),N&&d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Model: ",d.jsx("span",{className:"font-mono text-on-surface",children:N})]})]}),x.error&&d.jsx("div",{className:"rounded-md bg-tertiary/10 px-3 py-2",children:d.jsx("p",{className:"font-mono text-xs text-tertiary",children:x.error})}),S&&S.length>0&&d.jsx($e,{level:"low",className:"p-4",children:d.jsx(Bne,{phases:S})}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Decisions",b.length>0&&d.jsxs("span",{className:"ml-2 text-on-surface normal-case font-normal",children:[b.length," ",b.length===1?"action":"actions"]})]}),c?d.jsxs("div",{className:"flex items-center gap-2 text-on-surface-variant py-4",children:[d.jsx(Gn,{className:"h-4 w-4 animate-spin"}),d.jsx("span",{className:"font-sans text-sm",children:"Loading decisions..."})]}):b.length===0?d.jsx($e,{level:"low",className:"flex h-24 items-center justify-center",children:d.jsx("span",{className:"font-sans text-sm text-on-surface-variant",children:"No decisions recorded for this run"})}):d.jsx("div",{className:"space-y-2",children:b.map(R=>d.jsx(qne,{report:R},R.id))})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("button",{className:"flex items-center gap-2 font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide hover:text-on-surface transition-colors",onClick:()=>r(!n),children:[n?d.jsx(La,{className:"h-4 w-4"}):d.jsx(ha,{className:"h-4 w-4"}),"Audit Trail",d.jsx("span",{className:"normal-case font-normal text-xs",children:"(diagnostics)"})]}),n&&d.jsxs($e,{level:"low",className:ke("overflow-hidden"),children:[d.jsx("div",{className:"p-4 pb-2",children:d.jsx("h3",{className:"font-sans text-sm font-medium text-on-surface",children:"Turn-by-turn trace"})}),d.jsx("div",{className:"p-0",children:p?d.jsxs("div",{className:"flex items-center gap-2 text-on-surface-variant p-4",children:[d.jsx(Gn,{className:"h-4 w-4 animate-spin"}),d.jsx("span",{className:"font-sans text-sm",children:"Loading turns..."})]}):w.length===0?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant p-4",children:"No turns recorded."}):d.jsx("div",{children:w.map(R=>d.jsx(Vne,{turn:R},R.id))})})]})]})]})}function Gne(e){return e.displayName??e.name}function $ne({open:e,onOpenChange:t,onTriggered:n}){var w;const[r,a]=j.useState(void 0),[i,l]=j.useState(""),{data:o,isLoading:f}=Nc(),{mutate:c,isPending:h,error:p}=ww(),m=(o==null?void 0:o.tasks)??[],y=m.find(S=>S.isDefault),x=r??(y==null?void 0:y.name)??((w=m[0])==null?void 0:w.name)??"";function b(){const S={task:x||void 0,instruction:i.trim()||void 0};c(S,{onSuccess:()=>{t(!1),a(void 0),l(""),n==null||n()}})}return d.jsx(_d,{open:e,onOpenChange:t,children:d.jsxs(wc,{className:"sm:max-w-md",children:[d.jsxs(Od,{children:[d.jsx(Sc,{children:"Trigger Agent Run"}),d.jsx(Jp,{children:"Run the Myco agent now. It will process unprocessed sessions and update the vault."})]}),d.jsxs("div",{className:"space-y-4 py-2",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Task"}),f?d.jsxs("div",{className:"flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm",children:[d.jsx(Gn,{className:"h-4 w-4 animate-spin"}),"Loading tasks..."]}):d.jsxs(Si,{value:x,onValueChange:a,children:[d.jsx(Ya,{children:d.jsx(Ei,{})}),d.jsx(Xa,{children:m.map(S=>d.jsxs(Xr,{value:S.name,children:[Gne(S),S.isDefault&&d.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant",children:"(default)"})]},S.name))})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("label",{className:"font-sans text-sm font-medium text-on-surface",children:["Instruction",d.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant font-normal",children:"(optional)"})]}),d.jsx("textarea",{className:"w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-none focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-none",rows:3,placeholder:"E.g. Focus on gotchas from yesterday's sessions...",value:i,onChange:S=>l(S.target.value),disabled:h})]}),p&&d.jsx("p",{className:"font-sans text-xs text-tertiary",children:p instanceof Error?p.message:"Failed to trigger run"})]}),d.jsxs(Zp,{children:[d.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>t(!1),disabled:h,children:"Cancel"}),d.jsx(Ae,{size:"sm",className:"gap-2",onClick:b,disabled:h,children:h?d.jsxs(d.Fragment,{children:[d.jsx(Gn,{className:"h-3.5 w-3.5 animate-spin"}),"Starting..."]}):d.jsxs(d.Fragment,{children:[d.jsx(ss,{className:"h-3.5 w-3.5"}),"Run Now"]})})]})]})})}function Kne(e){return!e.phases||e.phases.length===0?"Single query":`${e.phases.length} phases`}function Yne(e){return e===F1?"User":"Built-in"}function Xne({task:e,onClick:t}){return d.jsxs($e,{level:"low",interactive:!0,className:ke("p-4 space-y-2 transition-all",e.isDefault&&"ring-1 ring-primary/20 shadow-[inset_0_0_12px_rgba(171,207,184,0.08)]"),onClick:t,children:[d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate",children:e.displayName}),e.isDefault&&d.jsx(Wz,{className:"h-3.5 w-3.5 text-primary shrink-0 fill-primary/30"})]}),e.description&&d.jsx("p",{className:"font-sans text-xs text-on-surface-variant mt-1 line-clamp-2",children:e.description})]}),d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:d.jsx(xt,{variant:d_(e.source),children:Yne(e.source)})})]}),d.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[d.jsxs("div",{className:"flex items-center gap-1.5 text-on-surface-variant",children:[d.jsx(Iz,{className:"h-3 w-3"}),d.jsx("span",{className:"font-mono text-xs",children:Kne(e)})]}),e.model&&d.jsx("span",{className:"font-mono text-xs text-on-surface-variant/70 truncate max-w-[160px]",children:e.model}),e.maxTurns!==void 0&&d.jsxs("span",{className:"font-mono text-xs text-on-surface-variant/70",children:["max ",e.maxTurns," turns"]})]})]})}function Qne({onSelect:e}){const{data:t,isLoading:n}=Nc(),r=(t==null?void 0:t.tasks)??[];return n?d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Array.from({length:3}).map((a,i)=>d.jsx("div",{className:"h-28 rounded-md animate-pulse bg-surface-container-low"},i))}):r.length===0?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No tasks found."}):d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:r.map(a=>d.jsx(Xne,{task:a,onClick:()=>e(a.name)},a.name))})}const Wne=new Set(["instruction"]),Zne={session_id:"Session ID"},Jne={session_id:"e.g. 36858a44-4ef7-4448-96e8-382e992e8ba4"};function ere(e){const t=e.matchAll(/\{\{(\w+)\}\}/g),n=new Set;for(const r of t){const a=r[1];Wne.has(a)||n.add(a)}return[...n]}function KA(e){return Zne[e]??e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function tre({task:e,onRunTriggered:t,onDeleted:n,onCustomized:r}){const a=ww(),i=PG(),l=BG(),[o,f]=j.useState(!1),[c,h]=j.useState({}),[p,m]=j.useState(""),y=j.useMemo(()=>ere(e.prompt??""),[e.prompt]),x=y.length>0;function b(){var T;const S=[];for(const R of y){const A=(T=c[R])==null?void 0:T.trim();A&&S.push(`${R}: ${A}`)}const N=p.trim();N&&S.push(N);const C=S.length>0?S.join(`
|
|
826
|
-
`):void 0;a.mutate({task:e.name,instruction:C},{onSuccess:R=>{f(!1),h({}),m(""),t==null||t(R.runId)}})}function w(S,N){h(C=>({...C,[S]:N}))}return d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Ae,{size:"sm",onClick:()=>{f(!0)},children:"Run Now"}),e.source===cI&&d.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>i.mutate({taskId:e.name},{onSuccess:S=>{var C;const N=(C=S==null?void 0:S.task)==null?void 0:C.name;N&&r&&r(N)}}),children:"Customize"}),e.source===F1&&d.jsx(Ae,{variant:"destructive",size:"sm",onClick:()=>{l.mutate(e.name,{onSuccess:()=>n==null?void 0:n()})},children:"Delete"}),d.jsx(_d,{open:o,onOpenChange:f,children:d.jsxs(wc,{className:"sm:max-w-md",children:[d.jsx(Od,{children:d.jsxs(Sc,{children:["Run ",e.displayName]})}),d.jsxs("div",{className:"space-y-4 py-2",children:[y.map(S=>d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:KA(S)}),d.jsx(fn,{value:c[S]??"",onChange:N=>w(S,N.target.value),placeholder:Jne[S]??`Enter ${KA(S).toLowerCase()}`,className:"font-mono",autoFocus:y.indexOf(S)===0})]},S)),d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"font-sans text-sm font-medium text-on-surface",children:["Instruction",d.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant font-normal",children:"(optional)"})]}),d.jsx("textarea",{className:"w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-none focus:border-primary/40 resize-none",rows:2,placeholder:"Additional instructions for this run...",value:p,onChange:S=>m(S.target.value),disabled:a.isPending})]})]}),d.jsxs(Zp,{children:[d.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>f(!1),children:"Cancel"}),d.jsxs(Ae,{size:"sm",disabled:a.isPending,onClick:b,className:"gap-2",children:[a.isPending?d.jsx(Gn,{className:"h-3.5 w-3.5 animate-spin"}):d.jsx(ss,{className:"h-3.5 w-3.5"}),"Run"]})]})]})})]})}const nre=20;function rre({taskId:e,onSaved:t}){const{data:n,isLoading:r,isError:a}=zG(e),i=IG(),[l,o]=j.useState(""),[f,c]=j.useState(!1);j.useEffect(()=>{n!=null&&n.yaml&&(o(n.yaml),c(!1))},[n==null?void 0:n.yaml]);function h(x){o(x),c(!0)}function p(){i.mutate({taskId:e,yaml:l},{onSuccess:()=>{c(!1),t==null||t()}})}function m(){n!=null&&n.yaml&&(o(n.yaml),c(!1))}if(r)return d.jsx("div",{className:"h-64 animate-pulse rounded-md bg-surface-container-low"});if(a)return d.jsx("div",{className:"rounded-md bg-tertiary-container/20 p-4 font-sans text-sm text-tertiary",children:"Failed to load task YAML."});const y=(n==null?void 0:n.source)!=="user";return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Task Definition ",y&&"(read-only)"]}),!y&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Ae,{variant:"ghost",size:"sm",onClick:m,disabled:!f,children:"Reset"}),d.jsx(Ae,{size:"sm",onClick:p,disabled:!f||i.isPending,children:i.isPending?"Saving...":"Save"})]})]}),d.jsx("textarea",{value:l,onChange:x=>h(x.target.value),readOnly:y,rows:nre,spellCheck:!1,className:`w-full rounded-md bg-surface-container-lowest p-4 font-mono text-sm text-on-surface leading-relaxed resize-y focus:outline-none focus:ring-2 focus:ring-primary/40 ${y?"opacity-75 cursor-not-allowed":""}`}),i.isError&&d.jsx("div",{className:"rounded-md bg-tertiary-container/20 p-3 font-sans text-sm text-tertiary",children:i.error.message}),i.isSuccess&&!f&&d.jsx("div",{className:"rounded-md bg-primary-container/20 p-3 font-sans text-sm text-primary",children:"Task saved successfully."})]})}function yi({checked:e,onCheckedChange:t,disabled:n}){return d.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:n,onClick:()=>t(!e),className:`relative inline-flex h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 ${n?"cursor-not-allowed opacity-50":"cursor-pointer"} ${e?"bg-primary":"bg-surface-container-high"}`,children:d.jsx("span",{className:`pointer-events-none block h-5 w-5 rounded-full bg-on-surface shadow-lg ring-0 transition-transform ${e?"translate-x-5":"translate-x-0"}`})})}const are={anthropic:"Anthropic",ollama:"Ollama",lmstudio:"LM Studio"},ire={anthropic:Az,ollama:$z,lmstudio:nD};function iS({providerType:e,model:t,baseUrl:n,contextLength:r,modelPlaceholder:a,providers:i,isLoadingProviders:l,onProviderChange:o,onModelChange:f,onBaseUrlChange:c,onContextLengthChange:h,onBaseUrlBlur:p,onContextLengthBlur:m}){const y=i.find(S=>S.type===e),x=e==="ollama"||e==="lmstudio",b=e!=="",w=(y==null?void 0:y.models)??[];return d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"grid grid-cols-3 gap-2",children:i.map(S=>{const N=ire[S.type];if(!N)return null;const C=e===S.type;return d.jsxs("button",{onClick:()=>o(S.type),className:`
|
|
827
|
-
flex flex-col items-center gap-1.5 rounded-md border px-3 py-2.5 transition-colors
|
|
828
|
-
${C?"border-primary/40 bg-primary/5 text-on-surface":"border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20"}
|
|
829
|
-
`,children:[d.jsx(N,{className:"h-4 w-4"}),d.jsx("span",{className:"font-sans text-xs font-medium",children:are[S.type]??S.type}),!l&&d.jsx(xt,{variant:S.available?"secondary":"destructive",className:"text-[10px] px-1.5 py-0",children:S.available?"online":"offline"})]},S.type)})}),x&&d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Base URL"}),d.jsx(fn,{value:n,onChange:S=>c(S.target.value),onBlur:p,placeholder:(y==null?void 0:y.baseUrl)??""})]}),x&&d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Context Length"}),d.jsx(fn,{type:"number",value:r,onChange:S=>h(S.target.value),onBlur:m,placeholder:"32768 (default)"}),d.jsx("p",{className:"font-sans text-[11px] text-on-surface-variant/70",children:"Leave blank to use the 32K default. Myco creates a Modelfile variant at this size so the model loads at the size you asked for, not its (much larger) native default."})]}),b&&d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Model"}),w.length>0?d.jsxs(Si,{value:t,onValueChange:f,children:[d.jsx(Ya,{children:d.jsx(Ei,{placeholder:a??"Select a model"})}),d.jsx(Xa,{children:w.map(S=>d.jsx(Xr,{value:S,children:d.jsx("span",{className:"font-mono text-sm",children:S})},S))})]}):d.jsx(fn,{value:t,onChange:S=>f(S.target.value),placeholder:(y==null?void 0:y.available)===!1?"Provider offline":"Enter model name",disabled:(y==null?void 0:y.available)===!1})]})]})}const d3=3e4;function h3(e,t){var r;const n=t.find(a=>a.type===e);return{type:e,model:((r=n==null?void 0:n.models)==null?void 0:r[0])??"",baseUrl:(n==null?void 0:n.baseUrl)??"",contextLength:""}}function sre(e){if(e.type==="")return;const t=e.type==="ollama"||e.type==="lmstudio";return{type:e.type,...e.model?{model:e.model}:{},...t&&e.baseUrl?{base_url:e.baseUrl}:{},...t&&e.contextLength?{context_length:Number(e.contextLength)}:{}}}function lre(e){return qt({queryKey:["task-config",e],queryFn:({signal:t})=>lt(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:d3})}function v3(){return qt({queryKey:["providers"],queryFn:({signal:e})=>lt("/providers",{signal:e}),staleTime:d3})}function p3(){return Er({mutationFn:e=>nn("/providers/test",e)})}function ore(){const e=Sn();return Er({mutationFn:({taskId:t,config:n})=>mc(`/agent/tasks/${t}/config`,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["task-config",n.taskId]})}})}function ure({phase:e,override:t,taskModel:n,providers:r,isLoadingProviders:a,onChange:i}){var c,h,p,m;const[l,o]=j.useState(!1),f=t.provider!==void 0||t.model!==void 0||t.maxTurns!==void 0;return d.jsxs("div",{className:"border border-[var(--ghost-border)] rounded-md",children:[d.jsxs("button",{onClick:()=>o(!l),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-surface-container-low/50 transition-colors rounded-md",children:[l?d.jsx(La,{className:"h-3.5 w-3.5 text-on-surface-variant"}):d.jsx(ha,{className:"h-3.5 w-3.5 text-on-surface-variant"}),d.jsx("span",{className:"font-sans text-sm text-on-surface",children:e.name}),d.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:["max ",t.maxTurns??e.maxTurns," turns"]}),f&&d.jsx(xt,{variant:"secondary",className:"text-[10px] ml-auto",children:"override"})]}),l&&d.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[var(--ghost-border)]",children:[d.jsx("div",{className:"pt-3",children:d.jsx(iS,{providerType:((c=t.provider)==null?void 0:c.type)??"anthropic",model:((h=t.provider)==null?void 0:h.model)??t.model??"",baseUrl:((p=t.provider)==null?void 0:p.base_url)??"",contextLength:((m=t.provider)==null?void 0:m.context_length)!=null?String(t.provider.context_length):"",modelPlaceholder:e.model??n,providers:r,isLoadingProviders:a,onProviderChange:y=>{var b;const x=(b=r.find(w=>w.type===y))==null?void 0:b.baseUrl;i({...t,provider:{type:y,base_url:x},model:void 0})},onModelChange:y=>i({...t,provider:t.provider?{...t.provider,model:y}:void 0,model:t.provider?void 0:y}),onBaseUrlChange:y=>i({...t,provider:t.provider?{...t.provider,base_url:y}:void 0}),onContextLengthChange:y=>i({...t,provider:t.provider?{...t.provider,context_length:y?Number(y):void 0}:void 0})})}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),d.jsx(fn,{type:"number",value:t.maxTurns??"",onChange:y=>i({...t,maxTurns:y.target.value?Number(y.target.value):void 0}),placeholder:String(e.maxTurns)})]}),f&&d.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>i(null),className:"text-xs text-on-surface-variant",children:"Clear Phase Override"})]})]})}const cre=["active","idle","sleep"],fre={active:"Active",idle:"Idle",sleep:"Sleep"};function dre({taskId:e,phases:t,defaults:n,schedule:r,params:a}){const{data:i,isPending:l}=v3(),{data:o}=lre(e),f=p3(),c=ore(),h=o==null?void 0:o.config,[p,m]=j.useState("anthropic"),[y,x]=j.useState(""),[b,w]=j.useState(""),[S,N]=j.useState(""),[C,T]=j.useState(""),[R,A]=j.useState(""),[D,O]=j.useState({}),[L,M]=j.useState({}),[B,P]=j.useState({}),[q,H]=j.useState(!1);j.useEffect(()=>{var z,Z,re,ae;h&&(m(((z=h.provider)==null?void 0:z.type)??"anthropic"),x(((Z=h.provider)==null?void 0:Z.model)??h.model??""),w(((re=h.provider)==null?void 0:re.base_url)??""),N(((ae=h.provider)==null?void 0:ae.context_length)!=null?String(h.provider.context_length):""),T(h.maxTurns!=null?String(h.maxTurns):""),A(h.timeoutSeconds!=null?String(h.timeoutSeconds):""),O(h.phases??{}),M(h.schedule??{}),P(h.params??{}),H(!1))},[h]);const G=L.enabled??(r==null?void 0:r.enabled)??!1,F=L.runIn??(r==null?void 0:r.runIn)??[],V=(i==null?void 0:i.providers)??[];function Y(z){const Z=h3(z,V);m(z),x(Z.model),w(Z.baseUrl),N(Z.contextLength),H(!0),f.reset()}function Q(z,Z){O(re=>{const ae={...re};return Z===null?delete ae[z]:ae[z]=Z,ae}),H(!0)}function I(){const z=p==="ollama"||p==="lmstudio",Z={type:p,...y?{model:y}:{},...z&&b?{base_url:b}:{},...z&&S?{context_length:Number(S)}:{}},re=r?Object.keys(L).length>0?{schedule:L}:{schedule:null}:{},ae=a&&Object.keys(B).length>0?{params:B}:{};c.mutate({taskId:e,config:{provider:Z,...C?{maxTurns:Number(C)}:{maxTurns:null},...R?{timeoutSeconds:Number(R)}:{timeoutSeconds:null},...Object.keys(D).length>0?{phases:D}:{phases:null},...re,...ae}},{onSuccess:()=>H(!1)})}function U(){c.mutate({taskId:e,config:{provider:null,model:null,maxTurns:null,timeoutSeconds:null,phases:null,schedule:null,params:null}},{onSuccess:()=>{m("anthropic"),x(""),w(""),N(""),T(""),A(""),O({}),M({}),P({}),H(!1)}})}function X(){const Z={type:p,...(p==="ollama"||p==="lmstudio")&&b?{base_url:b}:{}};f.mutate(Z)}return d.jsxs($e,{level:"low",className:"p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Task Config"}),h&&d.jsx(Ae,{variant:"ghost",size:"sm",onClick:U,className:"text-xs text-on-surface-variant",children:"Clear All Overrides"})]}),d.jsx(iS,{providerType:p,model:y,baseUrl:b,contextLength:S,modelPlaceholder:n==null?void 0:n.model,providers:V,isLoadingProviders:l,onProviderChange:Y,onModelChange:z=>{x(z),H(!0)},onBaseUrlChange:z=>{w(z),H(!0)},onContextLengthChange:z=>{N(z),H(!0)}}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),d.jsx(fn,{type:"number",value:C,onChange:z=>{T(z.target.value),H(!0)},placeholder:(n==null?void 0:n.maxTurns)!=null?String(n.maxTurns):"—"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Timeout (seconds)"}),d.jsx(fn,{type:"number",value:R,onChange:z=>{A(z.target.value),H(!0)},placeholder:(n==null?void 0:n.timeoutSeconds)!=null?String(n.timeoutSeconds):"—"})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:X,disabled:f.isPending,className:"gap-1.5 text-on-surface-variant",children:[f.isPending?d.jsx(Gn,{className:"h-3.5 w-3.5 animate-spin"}):d.jsx(rI,{className:"h-3.5 w-3.5"}),"Test"]}),f.isSuccess&&d.jsx("span",{className:"flex items-center gap-1 text-xs",children:f.data.ok?d.jsxs(d.Fragment,{children:[d.jsx(yc,{className:"h-3.5 w-3.5 text-green-500"}),d.jsxs("span",{className:"text-green-500 font-mono",children:[f.data.latency_ms,"ms"]})]}):d.jsxs(d.Fragment,{children:[d.jsx(lc,{className:"h-3.5 w-3.5 text-red-400"}),d.jsx("span",{className:"text-red-400",children:f.data.error})]})}),d.jsx("div",{className:"flex-1"}),d.jsxs(Ae,{size:"sm",onClick:I,disabled:!q||c.isPending,className:"gap-1.5",children:[c.isPending&&d.jsx(Gn,{className:"h-3.5 w-3.5 animate-spin"}),"Save"]})]}),r&&d.jsxs("div",{className:"space-y-3 pt-2 border-t border-[var(--ghost-border)]",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(tD,{className:"h-3.5 w-3.5 text-on-surface-variant"}),d.jsx("h3",{className:"font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide",children:"Scheduling"}),d.jsx(xt,{variant:G?"secondary":"outline",className:"text-[10px] px-1.5 py-0",children:G?"active":"off"})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface",children:"Auto-run"}),d.jsx("p",{className:"font-sans text-[11px] text-on-surface-variant",children:"Automatically run this task on a schedule"})]}),d.jsx(yi,{checked:G,onCheckedChange:z=>{M(Z=>({...Z,enabled:z})),H(!0)}})]}),G&&d.jsxs("div",{className:"space-y-3 pl-0.5",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Run every (seconds)"}),d.jsx(fn,{type:"number",min:10,value:L.intervalSeconds??"",onChange:z=>{const Z=z.target.value;M(re=>({...re,intervalSeconds:Z?Number(Z):void 0})),H(!0)},placeholder:r.intervalSeconds!=null?String(r.intervalSeconds):"300"})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Run in states"}),d.jsx("div",{className:"flex gap-2",children:cre.map(z=>{const Z=F.includes(z);return d.jsx("button",{onClick:()=>{const re=Z?F.filter(ae=>ae!==z):[...F,z];M(ae=>({...ae,runIn:re.length>0?re:void 0})),H(!0)},className:`
|
|
830
|
-
rounded-md border px-3 py-1.5 font-sans text-xs font-medium transition-colors
|
|
831
|
-
${Z?"border-primary/40 bg-primary/5 text-on-surface":"border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20"}
|
|
832
|
-
`,children:fre[z]},z)})})]})]})]}),a&&Object.keys(a).length>0&&d.jsxs("div",{className:"space-y-3 pt-2 border-t border-[var(--ghost-border)]",children:[d.jsx("h3",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Parameters"}),Object.entries(a).map(([z,Z])=>{const re=B[z],ae=re??Z,se=z.replace(/_/g," ").replace(/\b\w/g,le=>le.toUpperCase());return typeof Z=="boolean"?d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("label",{className:"font-sans text-sm text-on-surface",children:se}),d.jsx(yi,{checked:ae,onCheckedChange:le=>{P(ie=>({...ie,[z]:le})),H(!0)}})]},z):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-sm text-on-surface",children:se}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(fn,{type:typeof Z=="number"?"number":"text",value:re!=null?String(re):"",placeholder:String(Z),onChange:le=>{const ie=typeof Z=="number"?le.target.value===""?void 0:Number(le.target.value):le.target.value;P(ie===void 0?W=>{const te={...W};return delete te[z],te}:W=>({...W,[z]:ie})),H(!0)},className:"w-40 font-mono"}),d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["default: ",String(Z)]})]})]},z)})]}),t&&t.length>0&&d.jsxs("div",{className:"space-y-2 pt-2 border-t border-[var(--ghost-border)]",children:[d.jsx("h3",{className:"font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide",children:"Per-Phase Overrides"}),t.map(z=>d.jsx(ure,{phase:z,override:D[z.name]??{},taskModel:y||"claude-sonnet-4-6",providers:V,isLoadingProviders:l,onChange:Z=>Q(z.name,Z)},z.name))]})]})}const hre=3;function vre(e){var t,n,r;return{model:((t=e.execution)==null?void 0:t.model)??e.model,maxTurns:((n=e.execution)==null?void 0:n.maxTurns)??e.maxTurns,timeoutSeconds:((r=e.execution)==null?void 0:r.timeoutSeconds)??e.timeoutSeconds}}function pre(){return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-surface-container-high"}),d.jsxs("div",{className:"rounded-md bg-surface-container-low p-4 space-y-3",children:[d.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-container-high"}),d.jsx("div",{className:"h-4 w-64 animate-pulse rounded bg-surface-container-high"}),d.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-container-high"})]}),d.jsx("div",{className:"rounded-md bg-surface-container-low p-4 space-y-2",children:Array.from({length:hre}).map((e,t)=>d.jsx("div",{className:"h-5 animate-pulse rounded bg-surface-container-high"},t))})]})}function mre({phase:e,index:t}){return d.jsxs($e,{level:"low",className:"p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-surface-container-high font-mono text-xs font-semibold text-on-surface-variant shrink-0",children:t+1}),d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface",children:e.name}),!e.required&&d.jsx(xt,{variant:"secondary",children:"optional"})]}),d.jsxs("span",{className:"font-mono text-xs text-on-surface-variant shrink-0",children:["max ",e.maxTurns," turns"]})]}),e.tools.length>0&&d.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(n=>d.jsx("span",{className:"font-mono text-xs px-1.5 py-0.5 rounded-sm bg-surface-container-high text-on-surface-variant",children:n},n))}),d.jsx($e,{level:"lowest",className:"p-3 overflow-auto max-h-40",children:d.jsx(Mr,{content:e.prompt})})]})}function gre({taskId:e,onBack:t,onNavigate:n,onRunTriggered:r}){const{data:a,isPending:i,isError:l}=LG(e);if(i)return d.jsx(pre,{});if(l||!(a!=null&&a.task))return d.jsxs("div",{className:"space-y-4",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Tasks"]}),d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Task not found"})]})]});const o=a.task,f=o.phases??[],c=vre(o);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Tasks"]}),d.jsxs($e,{level:"low",className:"p-4 space-y-4",children:[d.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[d.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[d.jsx("h1",{className:"font-serif text-lg text-on-surface",children:o.displayName}),o.description&&d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:o.description})]}),d.jsx(xt,{variant:d_(o.source),className:"shrink-0",children:yw(o.source??"built-in")})]}),d.jsx(tre,{task:o,onDeleted:t,onCustomized:h=>n==null?void 0:n(h),onRunTriggered:r})]}),d.jsx(dre,{taskId:e,phases:f,defaults:{model:c.model,maxTurns:c.maxTurns,timeoutSeconds:c.timeoutSeconds},schedule:o.schedule,params:o.params}),(c.model!==void 0||c.maxTurns!==void 0||c.timeoutSeconds!==void 0)&&d.jsxs($e,{level:"low",className:"p-4 space-y-3",children:[d.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Execution Config"}),d.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[c.model!==void 0&&d.jsxs("div",{children:[d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Model"}),d.jsx("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:c.model})]}),c.maxTurns!==void 0&&d.jsxs("div",{children:[d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),d.jsx("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:c.maxTurns})]}),c.timeoutSeconds!==void 0&&d.jsxs("div",{children:[d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Timeout"}),d.jsxs("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:[c.timeoutSeconds,"s"]})]})]})]}),f.length>0?d.jsxs("div",{className:"space-y-3",children:[d.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Phases",d.jsxs("span",{className:"ml-2 text-on-surface normal-case font-normal",children:[f.length," ",f.length===1?"phase":"phases"]})]}),f.map((h,p)=>d.jsx(mre,{phase:h,index:p},h.name))]}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Prompt"}),d.jsx($e,{level:"lowest",className:"p-4 overflow-auto max-h-96",children:d.jsx(Mr,{content:o.prompt??""})})]}),d.jsx(rre,{taskId:e})]})}const sS=j.createContext(null);function yre({children:e}){const[t,n]=j.useState(()=>new Set),r=j.useCallback(l=>{n(o=>{if(o.has(l))return o;const f=new Set(o);return f.add(l),f})},[]),a=j.useCallback(()=>n(new Set),[]),i=j.useMemo(()=>({dirty:t,markDirty:r,clear:a}),[t,r,a]);return d.jsx(sS.Provider,{value:i,children:e})}function xre(){const e=j.useContext(sS);if(!e)throw new Error("useRestartGate must be inside RestartGateProvider");return e}function bre(){const e=j.useContext(sS);return(e==null?void 0:e.markDirty)??(()=>{})}function wre(){const{dirty:e,clear:t}=xre(),{restart:n,isRestarting:r}=cD();if(e.size===0)return null;const a=async()=>{try{await n(),t()}catch{}};return d.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4 rounded-md border border-ochre/40 bg-ochre/5 p-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"Restart required"}),d.jsxs("p",{className:"font-sans text-xs text-on-surface-variant truncate",children:["Changed: ",[...e].join(", ")]})]}),d.jsxs(Ae,{onClick:a,size:"sm",disabled:r,children:[r?d.jsx(Gn,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):d.jsx(ls,{className:"mr-1.5 h-3.5 w-3.5"}),"Restart daemon"]})]})}function zn({path:e,label:t,hint:n,defaultScope:r="local",lockScope:a,requiresRestart:i,commitOn:l="change",parse:o,children:f}){const{effective:c,local:h,setField:p,resetField:m,promoteField:y}=hs(),x=bre(),b=fp(c??{},e),w=!a&&fp(h??{},e)!==void 0,S=a??r,N=j.useRef(b);N.current=b;const[C,T]=j.useState(b),R=j.useRef(!1);j.useEffect(()=>{R.current||T(b)},[b]);const[A,D]=j.useState(null),O=j.useCallback(B=>{const P=o?o(B):B;P!==N.current&&(D(null),p(e,P,S).then(()=>{i&&x(e)}).catch(q=>{T(N.current),D(q instanceof Error?q.message:String(q)),console.error(`[scoped-field] write failed for ${e}`,q)}))},[e,S,o,i,p,x]),L=j.useCallback(B=>{R.current=!0,T(B),l==="change"&&(O(B),R.current=!1)},[O,l]),M=j.useCallback(()=>{l==="blur"&&C!==void 0&&O(C),R.current=!1},[O,l,C]);return d.jsxs("div",{id:Vp(e),"data-config-field":e,className:"space-y-1.5 rounded-md transition-all duration-300",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:t}),n&&d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant font-normal",children:["(",n,")"]}),w?d.jsx(im,{onPromote:()=>y(e).catch(B=>console.error("[scoped-field] promote failed",B)),onReset:()=>m(e).catch(B=>console.error("[scoped-field] reset failed",B))}):d.jsx(zd,{scope:a==="local"?"personal":"project"})]}),f({value:C,onChange:L,onBlur:M}),A&&d.jsxs("p",{className:"flex items-center gap-1 font-sans text-xs text-tertiary",children:[d.jsx(Cr,{className:"h-3 w-3"}),"Save failed: ",A]})]})}function YA({label:e,value:t,max:n,color:r}){const a=n>0?Math.round(t/n*100):0,i=2*Math.PI*36,l=i-a/100*i;return d.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d.jsxs("div",{className:"relative h-20 w-20",children:[d.jsxs("svg",{className:"h-20 w-20 -rotate-90",viewBox:"0 0 80 80",children:[d.jsx("circle",{cx:"40",cy:"40",r:"36",fill:"none",stroke:"currentColor",className:"text-surface-container/30",strokeWidth:"6"}),d.jsx("circle",{cx:"40",cy:"40",r:"36",fill:"none",stroke:r,strokeWidth:"6",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:l,className:"transition-all duration-700"})]}),d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsxs("span",{className:"text-sm font-semibold font-mono text-on-surface",children:[a,"%"]})})]}),d.jsx("span",{className:"text-xs text-on-surface-variant text-center font-sans",children:e})]})}function Xi({label:e,value:t}){return d.jsxs("div",{className:"flex items-center justify-between py-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant font-sans",children:e}),d.jsx("span",{className:"text-xs font-mono text-on-surface",children:t})]})}function Sre({stats:e}){const t=e.embedding.total_embeddable>0?e.embedding.embedded_count:0,n=e.embedding.total_embeddable;return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("h2",{className:"text-xs font-semibold text-on-surface-variant uppercase tracking-widest flex items-center gap-2 font-sans",children:[d.jsx(kb,{className:"h-3.5 w-3.5"}),"System Health"]}),d.jsxs("div",{className:"flex justify-center gap-8 py-2",children:[d.jsx(YA,{label:"Embedding Coverage",value:t,max:n,color:"#abcfb8"}),d.jsx(YA,{label:"Queue Health",value:Math.max(0,n-e.embedding.queue_depth),max:n,color:"#edbf7f"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-0",children:[d.jsx(Xi,{label:"Sessions",value:String(e.vault.session_count)}),d.jsx(Xi,{label:"Spores",value:String(e.vault.spore_count)}),d.jsx(Xi,{label:"Entities",value:String(e.vault.entity_count)}),d.jsx(Xi,{label:"Graph edges",value:String(e.vault.edge_count)}),d.jsx(Xi,{label:"Uptime",value:gw(e.daemon.uptime_seconds)}),d.jsx(Xi,{label:"Daemon",value:`v${e.daemon.version} :${e.daemon.port}`}),e.agent.last_run_at!==null&&d.jsxs(d.Fragment,{children:[d.jsx(Xi,{label:"Last run",value:bi(e.agent.last_run_at)}),d.jsx(Xi,{label:"Total runs",value:String(e.agent.total_runs)})]}),e.digest.freshest_tier!==null&&d.jsx(Xi,{label:"Digest tier",value:`T${e.digest.freshest_tier}`})]})]})}function Ere(){var y,x;const{effective:e,isLoading:t}=hs(),{data:n,isLoading:r}=Md(),{data:a,isLoading:i}=Nc(),l=(a==null?void 0:a.tasks)??[],[o,f]=j.useState(null),c=((y=l.find(b=>b.isDefault))==null?void 0:y.name)??"",h=o??c,p=j.useCallback(b=>{f(b)},[]),m=!!((x=e==null?void 0:e.agent)!=null&&x.provider);return t||!e?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(b=>d.jsx("div",{className:"h-32 rounded-md animate-pulse bg-surface-container-low"},b))}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs($e,{id:Ni.agentOperations,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300",children:[d.jsx(St,{children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(Kz,{className:"h-4 w-4 text-primary"}),"Agent Operations"]})}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(zn,{path:"agent.scheduled_tasks_enabled",label:"Scheduled Tasks",defaultScope:"local",hint:"runs intelligence/skill-survey/skill-evolve on a cron",children:({value:b,onChange:w})=>d.jsx(yi,{checked:b??!0,onCheckedChange:w,disabled:!m})}),d.jsx(zn,{path:"agent.event_tasks_enabled",label:"Event-Driven Tasks",defaultScope:"local",hint:"titles + summaries on session end",children:({value:b,onChange:w})=>d.jsx(yi,{checked:b??!0,onCheckedChange:w,disabled:!m})})]}),!m&&d.jsxs("p",{className:"font-sans text-xs text-on-surface-variant/70",children:["Configure an agent provider in"," ",d.jsx("a",{href:"/settings",className:"underline hover:text-on-surface transition-colors",children:"Settings"})," ","to enable agent tasks."]}),d.jsx("div",{className:"border-t border-outline-variant/20"}),d.jsx(zn,{path:"agent.summary_batch_interval",label:"Title & Summary Batch Interval",defaultScope:"project",commitOn:"blur",hint:"batches between event-driven summary triggers; 0 disables",children:({value:b,onChange:w,onBlur:S})=>d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(fn,{type:"number",min:0,placeholder:String(dI),value:b??"",onChange:N=>w(Number(N.target.value)),onBlur:S,className:"w-32 font-mono"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:"batches"})]})}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Default Task"}),i?d.jsxs("div",{className:"flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm",children:[d.jsx(Gn,{className:"h-4 w-4 animate-spin"}),"Loading tasks..."]}):d.jsxs(Si,{value:h,onValueChange:p,children:[d.jsx(Ya,{children:d.jsx(Ei,{placeholder:"Select default task"})}),d.jsx(Xa,{children:l.map(b=>d.jsx(Xr,{value:b.name,children:b.displayName},b.name))})]}),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"The task used when Run Now is clicked or no task is specified."})]})]}),r?d.jsx($e,{level:"low",className:"p-6",children:d.jsx("div",{className:"h-32 animate-pulse rounded-md bg-surface-container"})}):n?d.jsx($e,{level:"low",className:"p-6",children:d.jsx(Sre,{stats:n})}):null]})}const m3="tab",g3="run",y3="task",Cre=new Set(["runs","tasks","config"]);function XA(){const e=new URLSearchParams(window.location.search),t=e.get(m3);return{tab:t&&Cre.has(t)?t:"runs",runId:e.get(g3)??void 0,taskId:e.get(y3)??void 0}}function Nre(e,t,n){const r=new URLSearchParams;e!=="runs"&&r.set(m3,e),t&&r.set(g3,t),n&&r.set(y3,n);const a=r.toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;window.history.pushState(null,"",i)}const kre=[{id:"runs",label:"Runs"},{id:"tasks",label:"Tasks"},{id:"config",label:"Config"}];function Tre(){const e=Ba(),t=XA(),[n,r]=j.useState(t.tab),[a,i]=j.useState(t.runId),[l,o]=j.useState(t.taskId),[f,c]=j.useState(!1),h=j.useRef(!1),p=j.useRef(!1);j.useEffect(()=>{if(!h.current){h.current=!0;return}if(p.current){p.current=!1;return}Nre(n,a,l)},[n,a,l]),j.useEffect(()=>{p.current=!0;const y=XA();r(y.tab),i(y.runId),o(y.taskId)},[e.search,e.key]);const m=j.useCallback(y=>{const x=y;r(x),x!=="runs"&&i(void 0),x!=="tasks"&&o(void 0)},[]);return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsx(wi,{title:"Agent",subtitle:"Intelligence runs, task configuration, and operational settings",tabs:kre,activeTab:n,onTabChange:m,actions:n==="runs"?d.jsxs(Ae,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>c(!0),children:[d.jsx(ss,{className:"h-3.5 w-3.5"}),"Run Now"]}):void 0}),n==="runs"&&(a?d.jsx(Hne,{runId:a,onBack:()=>i(void 0)}):d.jsx(Lne,{onSelectRun:i,onTriggerRun:()=>c(!0)})),n==="tasks"&&(l?d.jsx(gre,{taskId:l,onBack:()=>o(void 0),onNavigate:o,onRunTriggered:y=>{o(void 0),r("runs"),y&&i(y)}}):d.jsx(Qne,{onSelect:o})),n==="config"&&d.jsx(Ere,{}),d.jsx($ne,{open:f,onOpenChange:c,onTriggered:()=>i(void 0)})]})}function x3(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/skill-candidates?${n}`:"/skill-candidates";return qt({queryKey:["skill-candidates",e],queryFn:({signal:a})=>lt(r,{signal:a})})}function jre(){const e=Sn();return Er({mutationFn:({id:t,...n})=>mc(`/skill-candidates/${t}`,n),onSuccess:()=>{e.invalidateQueries({queryKey:["skill-candidates"]})}})}function b3(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/skill-records?${n}`:"/skill-records";return qt({queryKey:["skill-records",e],queryFn:({signal:a})=>lt(r,{signal:a})})}function Are(e){return qt({queryKey:["skill-record",e],queryFn:({signal:t})=>lt(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function Rre(){const e=Sn();return Er({mutationFn:t=>O1(`/skill-records/${encodeURIComponent(t)}`),onSuccess:()=>{e.invalidateQueries({queryKey:["skill-records"]}),e.invalidateQueries({queryKey:["skill-record"]})}})}const Bn={IDENTIFIED:"identified",APPROVED:"approved",GENERATED:"generated",DISMISSED:"dismissed"},Dre=`${Bn.APPROVED},${Bn.GENERATED}`,Mre=[{key:"status",label:"Status",options:[{value:rr,label:"All statuses"},{value:Bn.IDENTIFIED,label:"Identified"},{value:Dre,label:"Approved & generated"},{value:Bn.APPROVED,label:"Awaiting generation"},{value:Bn.GENERATED,label:"Generated"},{value:Bn.DISMISSED,label:"Dismissed"}]}];function _re(e){const t=`${(e*100).toFixed(0)}%`;return e>=.85?{text:t,variant:"default"}:e>=.7?{text:t,variant:"secondary"}:{text:t,variant:"outline"}}function QA(e){const t=Math.floor(Date.now()/1e3)-e;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Ore(e){switch(e){case Bn.IDENTIFIED:return d.jsx(xt,{variant:"outline",children:"Identified"});case Bn.APPROVED:return d.jsx(xt,{variant:"secondary",children:"Awaiting generation"});case Bn.GENERATED:return d.jsx(xt,{variant:"default",children:"Generated"});case Bn.DISMISSED:return d.jsx(xt,{variant:"outline",className:"opacity-50",children:"Dismissed"});default:return d.jsx(xt,{variant:"outline",children:e})}}function Lre({candidate:e,onApprove:t,onDismiss:n,isApproving:r,isDismissing:a}){const i=_re(e.confidence),l=e.status===Bn.IDENTIFIED||e.status===Bn.APPROVED;return d.jsxs($e,{level:"low",className:"p-5 space-y-3",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("h3",{className:"font-serif text-lg text-on-surface leading-tight",children:e.topic}),e.approved_at!==null&&d.jsxs("p",{className:"font-sans text-xs text-on-surface-variant mt-1",children:["Approved ",QA(e.approved_at),e.status===Bn.GENERATED&&" · generated"]})]}),d.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[Ore(e.status),d.jsx(xt,{variant:i.variant,children:i.text}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:QA(e.created_at)})]})]}),d.jsx(Mr,{content:e.rationale,className:"text-sm text-on-surface-variant"}),l&&d.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.status===Bn.IDENTIFIED&&d.jsxs(d.Fragment,{children:[d.jsxs(Ae,{size:"sm",variant:"default",onClick:t,disabled:r,children:[d.jsx(gc,{className:"h-3.5 w-3.5 mr-1.5"}),r?"Approving...":"Approve"]}),d.jsxs(Ae,{size:"sm",variant:"ghost",onClick:n,disabled:a,className:"text-on-surface-variant",children:[d.jsx(lc,{className:"h-3.5 w-3.5 mr-1.5"}),a?"Dismissing...":"Dismiss"]})]}),e.status===Bn.APPROVED&&d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:"Awaiting generation"})]})]})}function Pre(){return d.jsxs($e,{level:"low",className:"p-5 space-y-3",children:[d.jsxs("div",{className:"flex items-start justify-between",children:[d.jsx("div",{className:"h-5 w-64 rounded bg-surface-container-high animate-pulse"}),d.jsx("div",{className:"h-5 w-20 rounded bg-surface-container-high animate-pulse"})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("div",{className:"h-3 w-full rounded bg-surface-container-high animate-pulse"}),d.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-container-high animate-pulse"})]}),d.jsx("div",{className:"h-8 w-32 rounded bg-surface-container-high animate-pulse"})]})}function Bre(){const e=jre(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=Ud({initialFilters:{status:Bn.IDENTIFIED}}),c=f("status"),{data:h,isLoading:p,isError:m,error:y}=x3({status:c,limit:Qr,offset:a}),x=(h==null?void 0:h.candidates)??[],b=(h==null?void 0:h.total)??0,w=j.useMemo(()=>{if(!n)return x;const T=n.toLowerCase();return x.filter(R=>R.topic.toLowerCase().includes(T)||R.rationale.toLowerCase().includes(T))},[x,n]);function S(T){e.mutate({id:T.id,status:Bn.APPROVED})}function N(T){e.mutate({id:T.id,status:Bn.DISMISSED})}const C=d.jsx(Fd,{searchPlaceholder:"Search candidates...",searchValue:t,onSearchChange:l,filters:Mre,filterValues:r,onFilterChange:o});return m?d.jsxs("div",{className:"space-y-3",children:[C,d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load candidates"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:y instanceof Error?y.message:"Unknown error"})]})]}):p?d.jsxs("div",{className:"space-y-3",children:[C,Array.from({length:3}).map((T,R)=>d.jsx(Pre,{},R))]}):d.jsxs("div",{className:"space-y-3",children:[C,w.length===0?d.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant",children:[d.jsx(Uz,{className:"h-10 w-10 opacity-20"}),b===0&&!c&&!n?d.jsxs("div",{className:"text-center space-y-2 max-w-md",children:[d.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"No skill candidates discovered yet"}),d.jsx("p",{className:"font-sans text-xs leading-relaxed",children:"Candidates are procedural patterns discovered from your vault knowledge. Review and approve them here, then Myco generates full skills from them."}),d.jsxs("div",{className:"font-sans text-xs space-y-1 pt-1",children:[d.jsxs("p",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Automatic:"})," ","The"," ",d.jsx(_a,{to:"/agent?tab=tasks&task=skill-survey",className:"text-primary hover:underline",children:"Skill Survey"})," ","task runs automatically during idle periods and discovers candidates from session history, decisions, and gotchas."]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Manual:"})," ","Run"," ",d.jsxs(_a,{to:"/agent?tab=tasks&task=skill-survey",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[d.jsx(Hp,{className:"h-3 w-3"}),"Skill Survey"]})," ","from the Agent page to discover candidates on demand."]})]})]}):d.jsx("span",{className:"font-sans text-sm",children:"No matching candidates"})]}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:n?`${w.length} of ${b} candidate${b!==1?"s":""}`:`${b} candidate${b!==1?"s":""}`}),w.map(T=>{var R,A,D,O;return d.jsx(Lre,{candidate:T,onApprove:()=>S(T),onDismiss:()=>N(T),isApproving:e.isPending&&((R=e.variables)==null?void 0:R.id)===T.id&&((A=e.variables)==null?void 0:A.status)===Bn.APPROVED,isDismissing:e.isPending&&((D=e.variables)==null?void 0:D.id)===T.id&&((O=e.variables)==null?void 0:O.status)===Bn.DISMISSED},T.id)})]}),d.jsx(Ac,{total:n?w.length:b,offset:a,limit:Qr,onPageChange:i})]})}const zre=5,Ire=[{key:"status",label:"Status",options:[{value:rr,label:"All statuses"},{value:"active",label:"Active"},{value:"stale",label:"Stale"},{value:"retired",label:"Retired"}]}];function Fre(e){return e==="active"?"default":e==="stale"?"secondary":"outline"}function Gf({children:e,className:t}){return d.jsx("th",{className:ke("px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function Ure(){return d.jsxs("tr",{className:"border-b border-[var(--ghost-border)]",children:[d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-40 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-12 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-10 rounded bg-surface-container-high animate-pulse"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})})]})}function qre({record:e,onClick:t}){return d.jsxs("tr",{className:"border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Skill: ${e.display_name}`,children:[d.jsxs("td",{className:"px-4 py-3",children:[d.jsx("span",{className:"font-sans text-sm font-medium text-on-surface block",children:e.display_name}),d.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant block mt-0.5",children:e.name})]}),d.jsx("td",{className:"px-4 py-3",children:d.jsxs(xt,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:["gen ",e.generation]})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(xt,{variant:Fre(e.status),children:e.status})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.usage_count})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:om(e.updated_at)})})]})}function Vre({onSelectSkill:e}){const{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=Ud({initialFilters:{status:rr}}),c=f("status"),{data:h,isLoading:p,isError:m,error:y}=b3({status:c,limit:Qr,offset:a}),x=(h==null?void 0:h.records)??[],b=(h==null?void 0:h.total)??0,w=n?x.filter(C=>C.display_name.toLowerCase().includes(n.toLowerCase())||C.name.toLowerCase().includes(n.toLowerCase())||C.description.toLowerCase().includes(n.toLowerCase())):x,S=d.jsx(Fd,{searchPlaceholder:"Search skills...",searchValue:t,onSearchChange:l,filters:Ire,filterValues:r,onFilterChange:o}),N=d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-[var(--ghost-border)] bg-surface-container/50",children:[d.jsx(Gf,{children:"Name"}),d.jsx(Gf,{children:"Generation"}),d.jsx(Gf,{children:"Status"}),d.jsx(Gf,{children:"Usage"}),d.jsx(Gf,{children:"Last Evolved"})]})});return m?d.jsxs("div",{children:[S,d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Failed to load skills"}),d.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:y instanceof Error?y.message:"Unknown error"})]})]}):d.jsxs("div",{children:[S,p?d.jsx($e,{level:"low",className:"rounded-md overflow-hidden mt-4",children:d.jsxs("table",{className:"w-full",children:[N,d.jsx("tbody",{children:Array.from({length:zre}).map((C,T)=>d.jsx(Ure,{},T))})]})}):w.length===0?d.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant mt-4",children:[d.jsx(Nz,{className:"h-10 w-10 opacity-20"}),b===0&&!n&&!c?d.jsxs("div",{className:"text-center space-y-2 max-w-md",children:[d.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"No skills generated yet"}),d.jsx("p",{className:"font-sans text-xs leading-relaxed",children:"Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in this codebase."}),d.jsxs("div",{className:"font-sans text-xs space-y-1 pt-1",children:[d.jsxs("p",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Automatic:"})," ","The"," ",d.jsx(_a,{to:"/agent?tab=tasks&task=skill-survey",className:"text-primary hover:underline",children:"Skill Survey"})," ","task runs automatically and discovers candidates from your vault. Approve candidates in the"," ",d.jsx(_a,{to:"/skills?tab=candidates",className:"text-primary hover:underline",children:"Candidates tab"}),", then enable the"," ",d.jsx(_a,{to:"/agent?tab=tasks&task=skill-generate",className:"text-primary hover:underline",children:"Skill Generate"})," ","task to produce skills automatically."]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Manual:"})," ","Run"," ",d.jsx(_a,{to:"/agent?tab=tasks&task=skill-generate",className:"text-primary hover:underline",children:"Skill Generate"})," ","from the Agent page to generate a skill on demand."]})]})]}):d.jsx("span",{className:"font-sans text-sm",children:"No matching skills"})]}):d.jsx($e,{level:"low",className:"rounded-md overflow-hidden mt-4",children:d.jsxs("table",{className:"w-full","aria-label":"Skills",children:[N,d.jsx("tbody",{children:w.map(C=>d.jsx(qre,{record:C,onClick:()=>e(C.name)},C.id))})]})}),d.jsx(Ac,{total:b,offset:a,limit:Qr,onPageChange:i})]})}const Hre={created:"default",updated:"secondary",split:"warning",retired:"outline"};function Gre({entry:e}){const[t,n]=j.useState(!1);return d.jsxs("div",{className:"relative pl-6",children:[d.jsx("div",{className:"absolute left-0 top-2 h-2.5 w-2.5 rounded-full border-2 border-outline-variant bg-surface-container"}),d.jsxs("button",{type:"button",className:"w-full text-left group cursor-pointer",onClick:()=>n(r=>!r),"aria-expanded":t,children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs(xt,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:["v",e.generation]}),d.jsx(xt,{variant:Hre[e.action]??"outline",children:e.action}),d.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant ml-auto shrink-0",children:om(e.created_at)}),d.jsx(ha,{className:ke("h-3.5 w-3.5 text-on-surface-variant transition-transform duration-150",t&&"rotate-90")})]}),e.rationale&&d.jsx("p",{className:"font-sans text-sm text-on-surface-variant mt-1 leading-relaxed",children:e.rationale})]}),t&&e.content_snapshot&&d.jsx($e,{level:"lowest",className:"mt-2 p-3 overflow-auto max-h-96",children:d.jsx("pre",{className:"font-mono text-xs text-on-surface whitespace-pre-wrap break-words",children:e.content_snapshot})})]})}function $re({entries:e}){return e.length===0?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant py-4",children:"No evolution history."}):d.jsxs("div",{className:"relative space-y-4",children:[d.jsx("div",{className:"absolute left-[4.5px] top-2 bottom-2 w-px bg-outline-variant/30"}),e.map(t=>d.jsx(Gre,{entry:t},t.id))]})}function Kre(e){return e==="active"?"default":e==="stale"?"secondary":"outline"}function Yre(e){if(!e)return 0;try{const t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function Xre(){return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-surface-container-high"}),d.jsxs("div",{className:"rounded-md bg-surface-container-low p-4 space-y-3",children:[d.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-container-high"}),d.jsx("div",{className:"h-4 w-64 animate-pulse rounded bg-surface-container-high"}),d.jsx("div",{className:"h-5 w-32 animate-pulse rounded bg-surface-container-high"})]}),d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:Array.from({length:3}).map((e,t)=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-container-high"},t))})]})}function Qre({skillName:e,onBack:t}){var m,y;const{data:n,isPending:r,isError:a}=Are(e),i=Rre(),[l,o]=j.useState(!1);if(r)return d.jsx(Xre,{});if(a||!n)return d.jsxs("div",{className:"space-y-4",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Skills"]}),d.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-5 w-5"}),d.jsx("span",{className:"font-sans text-sm",children:"Skill not found"})]})]});const f=Yre(n.source_ids),c=((y=(m=n.lineage)==null?void 0:m[0])==null?void 0:y.content_snapshot)??null,h=n.frontmatter??{},p=(c==null?void 0:c.replace(/^---\n[\s\S]*?\n---\n*/,""))??null;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[d.jsx(mi,{className:"h-4 w-4"}),"Skills"]}),d.jsxs(Ae,{variant:"ghost",size:"sm",className:"gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10",onClick:()=>o(!0),children:[d.jsx(os,{className:"h-4 w-4"}),"Delete"]})]}),d.jsx($e,{level:"low",className:"p-4 space-y-3",children:d.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[d.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[d.jsx("h1",{className:"font-serif text-lg text-on-surface",children:n.display_name}),n.description&&d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:n.description}),n.path&&d.jsx("p",{className:"font-mono text-[10px] text-on-surface-variant mt-1",children:n.path}),Object.keys(h).length>0&&d.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[h["user-invocable"]==="true"&&d.jsx(xt,{variant:"secondary",children:"user-invocable"}),h["allowed-tools"]&&d.jsxs(xt,{variant:"outline",children:["tools: ",h["allowed-tools"]]})]})]}),d.jsx(xt,{variant:Kre(n.status),className:"shrink-0",children:n.status})]})}),d.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[d.jsx(Yt,{label:"Generation",value:`v${n.generation}`,accent:"sage"}),d.jsx(Yt,{label:"Usage",value:`${n.usage_total??n.usage_count??0}`,sublabel:"sessions",accent:"ochre"}),d.jsx(Yt,{label:"Sources",value:`${f}`,accent:"outline"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(St,{children:"Evolution History"}),d.jsx($re,{entries:n.lineage??[]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(St,{children:"Current Content"}),p?d.jsx(Mr,{content:p}):d.jsx("p",{className:"font-sans text-sm text-on-surface-variant py-4",children:"No content snapshot available."})]}),d.jsx(um,{open:l,onOpenChange:o,title:"Delete Skill",description:"This will permanently delete the skill record, evolution history, and the SKILL.md file from disk.",icon:d.jsx(os,{className:"h-4 w-4 text-tertiary"}),meta:n?[{label:"Name",value:n.name},{label:"Title",value:n.display_name}]:[],confirmLabel:"Delete Skill",variant:"destructive",onConfirm:()=>{i.mutate(n.name,{onSuccess:()=>{o(!1),t()}})},isPending:i.isPending})]})}const w3="tab",S3="skill",Wre=new Set(["candidates","skills"]);function WA(){const e=new URLSearchParams(window.location.search),t=e.get(w3);return{tab:t&&Wre.has(t)?t:"skills",skill:e.get(S3)??void 0}}function Zre(e,t){const n=new URLSearchParams;e!=="skills"&&n.set(w3,e),t&&n.set(S3,t);const r=n.toString(),a=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",a)}const Jre=[{id:"skills",label:"Skills"},{id:"candidates",label:"Candidates"}];function eae(){return d.jsxs(_d,{children:[d.jsx(A6,{asChild:!0,children:d.jsx(Ae,{variant:"ghost",size:"sm",className:"text-on-surface-variant",children:d.jsx(Tz,{className:"h-4 w-4"})})}),d.jsxs(wc,{className:"max-w-lg",children:[d.jsxs(Od,{children:[d.jsx(Sc,{children:"How Skills Work"}),d.jsx(Jp,{children:"Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in your codebase."})]}),d.jsxs("div",{className:"space-y-4 font-sans text-sm text-on-surface-variant",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("h4",{className:"font-medium text-on-surface",children:"The Pipeline"}),d.jsxs("ol",{className:"list-decimal pl-5 space-y-1",children:[d.jsxs("li",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Survey"})," — discovers candidate skills from vault knowledge (sessions, decisions, gotchas)"]}),d.jsxs("li",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Approve"})," — you review candidates and approve the ones worth generating"]}),d.jsxs("li",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Generate"})," — produces a SKILL.md file from the approved candidate's source material"]}),d.jsxs("li",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Evolve"})," — updates existing skills when new knowledge makes them stale"]})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("h4",{className:"font-medium text-on-surface",children:"Scheduling"}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium text-on-surface",children:"Skill Survey"})," runs automatically during idle periods. Skill Generate and Skill Evolve are off by default — enable them in the"," ",d.jsxs(_a,{to:"/agent?tab=tasks",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["Agent Tasks",d.jsx(Hp,{className:"h-3 w-3"})]})," ","page for fully automatic operation, or trigger them manually with Run Now."]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("h4",{className:"font-medium text-on-surface",children:"Quick Start"}),d.jsxs("ol",{className:"list-decimal pl-5 space-y-1",children:[d.jsx("li",{children:"Wait for the survey to discover candidates (or run it manually)"}),d.jsx("li",{children:"Review candidates in the Candidates tab and approve the best ones"}),d.jsxs("li",{children:["Run"," ",d.jsx(_a,{to:"/agent?tab=tasks&task=skill-generate",className:"text-primary hover:underline",children:"Skill Generate"})," ","to produce skills from approved candidates"]})]})]})]})]})]})}function tae(){const e=Ba(),t=WA(),[n,r]=j.useState(t.tab),[a,i]=j.useState(t.skill),{data:l}=x3({status:"identified"}),{data:o}=b3({status:"active"}),f=(l==null?void 0:l.total)??0,c=(o==null?void 0:o.total)??0;j.useEffect(()=>{Zre(n,a)},[n,a]),j.useEffect(()=>{const m=WA();r(m.tab),i(m.skill)},[e.search,e.key]);const h=j.useCallback(m=>{const y=m;r(y),y!=="skills"&&i(void 0)},[]),p=j.useCallback(m=>{r("skills"),i(m)},[]);return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsx(wi,{title:"Skills",subtitle:"Discovered skill candidates and promoted skill records",tabs:Jre,activeTab:n,onTabChange:h,actions:d.jsxs("div",{className:"flex items-center gap-2",children:[f>0&&d.jsxs(xt,{variant:"secondary",children:[f," pending"]}),c>0&&d.jsxs(xt,{variant:"default",children:[c," active"]}),d.jsx(eae,{})]})}),n==="candidates"&&d.jsx(Bre,{}),n==="skills"&&!a&&d.jsx(Vre,{onSelectSkill:p}),n==="skills"&&a&&d.jsx(Qre,{skillName:a,onBack:()=>i(void 0)})]})}const nae=new Set(["openai-compatible"]);function rae(e,t,n){const r=e?nae.has(e):!1;return qt({queryKey:["models",e,t,n],queryFn:({signal:i})=>{const l=new URLSearchParams({provider:e});return t&&l.set("base_url",t),l.set("type",n),lt(`/models?${l.toString()}`,{signal:i})},enabled:!!e&&(!r||!!t),staleTime:oI})}function aae(){const[e,t]=j.useState({}),[n,r]=j.useState(""),[a,i]=j.useState(!0);j.useEffect(()=>{lt("/config/plan-dirs").then(o=>t(o.symbiont)).catch(()=>{}).finally(()=>i(!1))},[]);const l=Object.entries(e);return d.jsxs($e,{id:Ni.settingsPlanCapture,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-amber-500 transition-all duration-300",children:[d.jsx(St,{children:"Plan Capture"}),a?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"Loading..."}):d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"Agent Directories"}),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Directories monitored by connected agents. Managed by symbiont manifests."}),l.length===0?d.jsx("p",{className:"font-sans text-xs text-on-surface-variant italic",children:"No agent directories configured."}):d.jsx("div",{className:"space-y-3",children:l.map(([o,f])=>d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide",children:o}),d.jsx("div",{className:"space-y-1",children:f.map(c=>d.jsx("div",{className:"rounded bg-surface-container px-3 py-1.5 font-mono text-xs text-on-surface-variant",children:c},c))})]},o))})]}),d.jsx(zn,{path:"capture.ignore_plan_dirs_in_git",label:"Ignore Custom Plan Dirs In Git",lockScope:"project",hint:".gitignore is rewritten on every change",children:({value:o,onChange:f})=>d.jsx(yi,{checked:o??!1,onCheckedChange:f})}),d.jsx(zn,{path:"capture.plan_dirs",label:"Custom Directories",lockScope:"project",hint:"extra paths to watch for plan files",children:({value:o,onChange:f})=>{const c=o??[];return d.jsxs("div",{className:"space-y-2",children:[c.length>0&&d.jsx("div",{className:"space-y-1",children:c.map(h=>d.jsxs("div",{className:"flex items-center gap-2 rounded bg-surface-container px-3 py-1.5",children:[d.jsx("span",{className:"flex-1 font-mono text-xs text-on-surface",children:h}),d.jsx("button",{type:"button",onClick:()=>f(c.filter(p=>p!==h)),className:"font-sans text-xs text-on-surface-variant hover:text-tertiary transition-colors leading-none","aria-label":`Remove ${h}`,children:"x"})]},h))}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(fn,{placeholder:"/path/to/plans",value:n,onChange:h=>r(h.target.value),onKeyDown:h=>{if(h.key!=="Enter")return;const p=n.trim();!p||c.includes(p)||(f([...c,p]),r(""))},className:"flex-1 font-mono text-xs"}),d.jsx(Ae,{type:"button",size:"sm",onClick:()=>{const h=n.trim();!h||c.includes(h)||(f([...c,h]),r(""))},disabled:!n.trim(),children:"Add"})]})]})}})]})]})}const iae={banner:"Banner",summary:"Summary"};function qv({children:e}){return d.jsx("div",{className:"rounded-lg border border-outline-variant/20 bg-surface-container/40 p-4",children:e})}function sae(){var m,y;const{effective:e,setField:t,resetField:n,promoteField:r,isLocalOverride:a}=hs(),{data:i}=Y6(),l=(i==null?void 0:i.domains)??[],o=((m=e==null?void 0:e.notifications)==null?void 0:m.enabled)??!0,f=((y=e==null?void 0:e.notifications)==null?void 0:y.default_mode)??"summary",c=!o,h=j.useCallback(async(x,b)=>{const w=`notifications.domains.${x}.mode`;b==="default"?await n(w):await t(w,b,"local")},[n,t]),p=j.useCallback(async(x,b)=>{await t(`notifications.domains.${x}.enabled`,b,"local")},[t]);return e?d.jsxs($e,{id:Ni.settingsNotifications,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300",children:[d.jsx(St,{children:"Notifications"}),d.jsxs("div",{className:"space-y-4",children:[d.jsx(qv,{children:d.jsx(zn,{path:"notifications.enabled",label:"Notifications",hint:"master switch for this project",defaultScope:"local",children:({value:x,onChange:b})=>d.jsx(yi,{checked:x??!0,onCheckedChange:b})})}),d.jsxs("div",{className:c?"space-y-4 opacity-60":"space-y-4",children:[d.jsx(qv,{children:d.jsx(zn,{path:"notifications.default_mode",label:"Default Display",hint:"summary = panel only; banner = temporary popup",defaultScope:"local",children:({value:x,onChange:b})=>d.jsxs(Si,{value:x??"summary",onValueChange:w=>b(w),disabled:c,children:[d.jsx(Ya,{className:"w-40",children:d.jsx(Ei,{})}),d.jsxs(Xa,{children:[d.jsx(Xr,{value:"summary",children:"Summary"}),d.jsx(Xr,{value:"banner",children:"Banner"})]})]})})}),d.jsx(qv,{children:d.jsx(zn,{path:"notifications.system_notifications",label:"Browser Notifications",hint:"OS popups when tab unfocused; only for banner mode",defaultScope:"local",children:({value:x,onChange:b})=>d.jsx(yi,{checked:x??!1,onCheckedChange:b,disabled:c})})}),l.length>0&&d.jsx(qv,{children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Per-Domain Overrides"}),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Leave on `Default` unless a domain should behave differently from the project-wide setting."})]}),d.jsx("div",{className:"space-y-2",children:l.map(x=>{var R,A;const b=((A=(R=e.notifications)==null?void 0:R.domains)==null?void 0:A[x.domain])??{enabled:!0},w=b.enabled,S=b.mode??f,N=b.mode??"default",C=`notifications.domains.${x.domain}`,T=a(C);return d.jsx("div",{className:"rounded-md border border-outline-variant/20 bg-surface-container-low/40 px-3 py-3",children:d.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[d.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-sm font-medium text-on-surface",children:x.label}),d.jsx("span",{className:"rounded-full bg-surface-container-high px-2 py-0.5 text-[11px] text-on-surface-variant",children:w?iae[S]:"Off"}),T?d.jsx(im,{onPromote:()=>r(C),onReset:()=>n(C)}):d.jsx(zd,{scope:"project"})]}),d.jsx("p",{className:"text-[11px] text-on-surface-variant",children:x.types.map(D=>D.label).join(", ")})]}),d.jsxs("div",{className:"flex items-center gap-2 self-start",children:[d.jsxs(Si,{value:N,onValueChange:D=>{h(x.domain,D)},disabled:c||!w,children:[d.jsx(Ya,{className:"h-8 w-[120px] text-xs",children:d.jsx(Ei,{})}),d.jsxs(Xa,{children:[d.jsx(Xr,{value:"default",children:"Default"}),d.jsx(Xr,{value:"summary",children:"Summary"}),d.jsx(Xr,{value:"banner",children:"Banner"})]})]}),d.jsx(yi,{checked:w,onCheckedChange:D=>{p(x.domain,D)},disabled:c})]})]})},x.domain)})})]})}),c&&d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Notifications are currently disabled, so display and domain settings are inactive."})]})]})]}):null}const lae=["debug","info","warn","error"],oae=[{value:"ollama",label:"Ollama"},{value:"openai-compatible",label:"OpenAI-compatible"}],uae=[{value:"1500",label:"1.5K — Executive briefing"},{value:"5000",label:"5K — Deep onboarding"},{value:"10000",label:"10K — Full institutional"}];function cae(){const{effective:e,isLoading:t}=hs(),{data:n}=Md();if(t||!e)return d.jsxs("div",{className:"p-6",children:[d.jsx(wi,{title:"Settings"}),d.jsx("p",{className:"font-sans text-sm text-on-surface-variant mt-2",children:"Loading..."})]});const r=(n==null?void 0:n.vault.name)??e.embedding.provider;return d.jsx(yre,{children:d.jsxs("div",{className:"p-6",children:[d.jsx(wi,{title:"Settings",subtitle:"Vault configuration and daemon settings"}),d.jsx(wre,{}),d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[d.jsx(fae,{}),d.jsx(dae,{})]}),d.jsx(hae,{}),d.jsx(sae,{}),d.jsx(aae,{}),d.jsx(vae,{vaultName:r})]})]})})}function ZA(e){var t;return{type:(e==null?void 0:e.type)??"",model:(e==null?void 0:e.model)??"",baseUrl:(e==null?void 0:e.base_url)??"",contextLength:((t=e==null?void 0:e.context_length)==null?void 0:t.toString())??""}}function fae(){var D;const{effective:e,setField:t,setFields:n,isLocalOverride:r,resetField:a,promoteField:i}=hs(),{data:l,isPending:o}=v3(),f=p3(),c=(l==null?void 0:l.providers)??[],h=(D=e==null?void 0:e.agent)==null?void 0:D.provider,[p,m]=j.useState(()=>ZA(h));j.useEffect(()=>{m(ZA(h))},[h]),j.useEffect(()=>{var L,M;if(p.type===""||p.model!==""||!l)return;const O=(M=(L=c.find(B=>B.type===p.type))==null?void 0:L.models)==null?void 0:M[0];O&&(m(B=>({...B,model:O})),t("agent.provider.model",O,"local"))},[p.type,p.model,c,l,t]);const y=r("agent.provider"),x=j.useCallback((O,L)=>{const M=sre(O);L?n([{path:"agent.provider",value:M},{path:"agent.scheduled_tasks_enabled",value:!0},{path:"agent.event_tasks_enabled",value:!0}],"local"):t("agent.provider",M,"local")},[t,n]),b=j.useCallback(O=>{const L=p.type==="",M=h3(O,c);m(M),f.reset(),x(M,L)},[p.type,c,x,f]),w=j.useCallback(O=>{m(L=>({...L,model:O})),p.type!==""&&t("agent.provider.model",O,"local")},[p.type,t]),S=j.useCallback(O=>{m(L=>({...L,baseUrl:O})),f.reset()},[f]),N=j.useCallback(()=>{p.type!==""&&t("agent.provider.base_url",p.baseUrl||void 0,"local")},[p.type,p.baseUrl,t]),C=j.useCallback(O=>{m(L=>({...L,contextLength:O}))},[]),T=j.useCallback(()=>{if(p.type!==""){const O=p.contextLength===""?void 0:Number(p.contextLength);t("agent.provider.context_length",O,"local")}},[p.type,p.contextLength,t]),R=j.useCallback(async()=>{m({type:"",model:"",baseUrl:"",contextLength:""}),f.reset();try{await n([{path:"agent.scheduled_tasks_enabled",value:!1},{path:"agent.event_tasks_enabled",value:!1}],"local",["agent.provider"])}catch(O){console.error("[agent-card] clear provider failed",O)}},[n,f]),A=j.useCallback(()=>{p.type!==""&&f.mutate({type:p.type,...p.baseUrl?{base_url:p.baseUrl}:{}})},[p.type,p.baseUrl,f]);return d.jsxs($e,{id:Ni.settingsAgent,"data-config-field":"agent.provider",level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300",children:[d.jsx(St,{children:d.jsxs("span",{className:"flex items-center gap-2",children:["Myco Agent",y?d.jsx(im,{onPromote:()=>i("agent.provider"),onReset:()=>a("agent.provider")}):d.jsx(zd,{scope:"project"})]})}),p.type===""?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No provider configured -- data collection is active. Configure a provider to enable the intelligence pipeline."}):null,d.jsx(iS,{providerType:p.type,model:p.model,baseUrl:p.baseUrl,contextLength:p.contextLength,providers:c,isLoadingProviders:o,onProviderChange:b,onModelChange:w,onBaseUrlChange:S,onContextLengthChange:C,onBaseUrlBlur:N,onContextLengthBlur:T}),p.type!==""&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[d.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",onClick:A,disabled:f.isPending,children:[f.isPending?d.jsx(Gn,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Test Connection"]}),f.isSuccess&&f.data.ok&&d.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-primary",children:[d.jsx(eD,{className:"h-4 w-4"}),"Connected — ",f.data.latency_ms,"ms"]}),f.isSuccess&&!f.data.ok&&d.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-tertiary",children:[d.jsx(lc,{className:"h-4 w-4"}),f.data.error??"Connection failed."]}),f.isError&&d.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-tertiary",children:[d.jsx(lc,{className:"h-4 w-4"}),f.error.message]})]}),d.jsx(Ae,{type:"button",variant:"ghost",size:"sm",onClick:R,className:"text-xs text-on-surface-variant",children:"Clear provider"})]})]})}function dae(){const{effective:e}=hs(),t=(e==null?void 0:e.embedding.provider)??"ollama",n=(e==null?void 0:e.embedding.base_url)??"",{data:r}=rae(t,n||void 0,"embedding"),a=(r==null?void 0:r.models)??[],[i,l]=j.useState("idle"),[o,f]=j.useState(""),c=j.useCallback(async()=>{l("testing"),f("");try{const h=new URLSearchParams({provider:t,type:"embedding"});n&&h.set("base_url",n);const m=(await lt(`/models?${h.toString()}`)).models.length;l("success"),f(`Connected -- ${m} model${m!==1?"s":""} available.`)}catch(h){l("error"),f(h instanceof Error?h.message:"Connection failed.")}},[t,n]);return d.jsxs($e,{id:Ni.settingsEmbedding,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-ochre transition-all duration-300",children:[d.jsx(St,{children:"Embedding"}),d.jsxs("div",{className:"space-y-4",children:[d.jsx(zn,{path:"embedding.provider",label:"Provider",defaultScope:"local",requiresRestart:!0,children:({value:h,onChange:p})=>d.jsxs(Si,{value:h??"ollama",onValueChange:m=>{p(m),l("idle")},children:[d.jsx(Ya,{children:d.jsx(Ei,{})}),d.jsx(Xa,{children:oae.map(m=>d.jsx(Xr,{value:m.value,children:m.label},m.value))})]})}),d.jsx(zn,{path:"embedding.model",label:"Model",defaultScope:"local",requiresRestart:!0,commitOn:a.length>0?"change":"blur",children:({value:h,onChange:p,onBlur:m})=>a.length>0?d.jsxs(Si,{value:h??"",onValueChange:p,children:[d.jsx(Ya,{children:d.jsx(Ei,{placeholder:"Select a model"})}),d.jsx(Xa,{children:a.map(y=>d.jsx(Xr,{value:y,children:d.jsx("span",{className:"font-mono text-sm",children:y})},y))})]}):d.jsx(fn,{placeholder:"bge-m3",value:h??"",onChange:y=>p(y.target.value),onBlur:m})}),d.jsx(zn,{path:"embedding.base_url",label:"Base URL",hint:"optional",defaultScope:"local",requiresRestart:!0,commitOn:"blur",parse:h=>h===""?void 0:h,children:({value:h,onChange:p,onBlur:m})=>d.jsx(fn,{type:"url",placeholder:"http://localhost:11434",value:h??"",onChange:y=>{p(y.target.value),l("idle")},onBlur:m})}),d.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[d.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:i==="testing",children:[i==="testing"?d.jsx(Gn,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Test Connection"]}),i==="success"&&d.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-primary",children:[d.jsx(eD,{className:"h-4 w-4"}),o]}),i==="error"&&d.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-tertiary",children:[d.jsx(lc,{className:"h-4 w-4"}),o]})]})]})]})}function hae(){return d.jsxs($e,{id:Ni.settingsContextInjection,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-ochre transition-all duration-300",children:[d.jsx(St,{children:"Context Injection"}),d.jsxs("div",{className:"space-y-4",children:[d.jsx(zn,{path:"context.digest_tier",label:"Digest Tier",defaultScope:"project",hint:"token budget for session-start digest",children:({value:e,onChange:t})=>d.jsxs(Si,{value:String(e??hI),onValueChange:n=>t(Number(n)),children:[d.jsx(Ya,{children:d.jsx(Ei,{})}),d.jsx(Xa,{children:uae.map(n=>d.jsx(Xr,{value:n.value,children:n.label},n.value))})]})}),d.jsx(zn,{path:"context.prompt_search",label:"Prompt Search",defaultScope:"project",hint:"search vault for observations on each prompt",children:({value:e,onChange:t})=>d.jsx(yi,{checked:e??!0,onCheckedChange:t})}),d.jsx(zn,{path:"context.prompt_max_spores",label:"Max Spores per Prompt",defaultScope:"project",commitOn:"blur",hint:"0–10; lower = leaner context",children:({value:e,onChange:t,onBlur:n})=>d.jsx(fn,{type:"number",min:"0",max:"10",placeholder:String(vI),value:e??"",onChange:r=>t(Number(r.target.value)),onBlur:n})})]})]})}function vae({vaultName:e}){return d.jsxs($e,{id:Ni.settingsProject,level:"low",className:"rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300",children:[d.jsx(St,{children:"Project"}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{id:Vp("vault.name"),"data-config-field":"vault.name",className:"space-y-1.5 rounded-md transition-all duration-300",children:[d.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Vault Name"}),d.jsx(fn,{value:e,readOnly:!0,disabled:!0,className:"text-on-surface-variant bg-surface-container-lowest"})]}),d.jsx(zn,{path:"daemon.port",label:"Daemon Port",defaultScope:"local",requiresRestart:!0,commitOn:"blur",children:({value:t,onChange:n,onBlur:r})=>d.jsxs(d.Fragment,{children:[d.jsx(fn,{type:"number",placeholder:"Auto",value:t??"",onChange:a=>n(a.target.value===""?null:Number(a.target.value)),onBlur:r}),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Leave blank to use a random available port."})]})}),d.jsx(zn,{path:"daemon.log_level",label:"Log Level",defaultScope:"local",children:({value:t,onChange:n})=>d.jsxs(Si,{value:t??"info",onValueChange:r=>n(r),children:[d.jsx(Ya,{children:d.jsx(Ei,{})}),d.jsx(Xa,{children:lae.map(r=>d.jsx(Xr,{value:r,children:r},r))})]})}),d.jsx(zn,{path:"daemon.log_retention_days",label:"Log Retention (days)",defaultScope:"local",commitOn:"blur",children:({value:t,onChange:n,onBlur:r})=>d.jsx(fn,{type:"number",min:1,max:365,className:"w-24",value:t??"",onChange:a=>n(Number(a.target.value)),onBlur:r})})]})]})}function pae(){return Or({queryKey:["embedding-details"],queryFn:({signal:e})=>lt("/embedding/details",{signal:e}),refetchInterval:Kn.STATS,pollCategory:"standard"})}function mae(){return Or({queryKey:["database-details"],queryFn:({signal:e})=>lt("/database/details",{signal:e}),refetchInterval:Kn.STATS,pollCategory:"standard"})}const gae=100,JA=2e3,yae=40;function xae(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=yae}function E3(e){const[t,n]=j.useState([]),[r,a]=j.useState(void 0),[i,l]=j.useState(!0),[o,f]=j.useState(!1),c=j.useRef(null),h=j.useRef(i);h.current=i;const p=j.useRef(r);p.current=r;const{data:m}=Or({queryKey:["logs",e],queryFn:({signal:w})=>{const S=new URLSearchParams({limit:String(gae),category:e});return p.current&&S.set("since",p.current),lt(`/logs?${S.toString()}`,{signal:w})},refetchInterval:Kn.LOGS,pollCategory:"standard"});j.useEffect(()=>{m!=null&&m.entries.length&&(n(w=>{let S;if(m.cursor_reset){const N=new Set(w.map(T=>`${T.timestamp}|${T.message}`)),C=m.entries.filter(T=>!N.has(`${T.timestamp}|${T.message}`));S=C.length?[...w,...C]:w}else S=[...w,...m.entries];return S.length>JA?S.slice(-JA):S}),a(m.cursor),h.current||f(!0))},[m]),j.useEffect(()=>{!i||!c.current||(c.current.scrollTop=c.current.scrollHeight,f(!1))},[t,i]);const y=j.useCallback(()=>{const w=c.current;w&&(xae(w)?(l(!0),f(!1)):l(!1))},[]),x=j.useCallback(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight,l(!0),f(!1))},[]);return{filteredEntries:j.useMemo(()=>{const w=hp.debug;return t.filter(S=>hp[S.level]>=w)},[t]),scrollRef:c,autoScroll:i,setAutoScroll:l,hasNewEntries:o,handleScroll:y,scrollToBottom:x}}function bae(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function wae(){const[e,t]=j.useState([]),[n,r]=j.useState(!1),[a,i]=j.useState(!1),[l,o]=j.useState(null),[f,c]=j.useState(null),h=j.useCallback(async()=>{try{const x=await lt("/backups");t(x.backups),r(!0)}catch(x){o({type:"error",text:`Failed to load backups: ${x.message}`})}},[]);!n&&!a&&(i(!0),h().finally(()=>i(!1)));async function p(){o(null),c(null);try{const x=await nn("/backup");o({type:"success",text:`Backup created: ${x.machine_id} (${wo(x.size_bytes)})`}),await h()}catch(x){o({type:"error",text:`Backup failed: ${x.message}`})}}async function m(x){o(null),c(null);try{const b=await nn("/restore/preview",{machine_id:x});c(b)}catch(b){o({type:"error",text:`Preview failed: ${b.message}`})}}async function y(x){o(null),c(null);try{const b=await nn("/restore",{machine_id:x});o({type:"success",text:`Restored ${b.total_restored} records, skipped ${b.total_skipped} duplicates`})}catch(b){o({type:"error",text:`Restore failed: ${b.message}`})}}return d.jsxs($e,{id:Ni.operationsBackup,level:"low",className:"rounded-lg p-6 space-y-4 transition-all duration-300",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(zz,{className:"h-4 w-4 text-primary"}),d.jsx(St,{children:"Backup & Restore"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:h,children:[d.jsx(ls,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]}),d.jsxs(Ae,{variant:"default",size:"sm",onClick:p,children:[d.jsx(Dz,{className:"mr-1.5 h-3.5 w-3.5"}),"Backup Now"]})]})]}),d.jsx(zn,{path:"backup.dir",label:"Backup Directory",defaultScope:"local",commitOn:"blur",requiresRestart:!0,hint:"leave blank for default .myco/backups; ~ supported",parse:x=>x===""?void 0:x,children:({value:x,onChange:b,onBlur:w})=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Bz,{className:"h-3.5 w-3.5 text-on-surface-variant flex-shrink-0"}),d.jsx("input",{type:"text",value:x??"",onChange:S=>b(S.target.value),onBlur:w,placeholder:".myco/backups",className:"flex-1 bg-surface-container text-on-surface font-mono text-sm rounded px-3 py-1.5 outline-none border border-outline-variant/15 focus:border-primary/40 placeholder:text-on-surface-variant/50"})]})}),l&&d.jsx("p",{className:ke("font-sans text-sm",l.type==="success"?"text-primary":"text-tertiary"),children:l.text}),e.length>0?d.jsx("div",{className:"space-y-2",children:e.map(x=>d.jsxs("div",{className:ke("flex items-center justify-between rounded-md px-4 py-3","bg-surface-container-lowest transition-colors"),children:[d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx("span",{className:"font-mono text-sm text-on-surface truncate",children:x.machine_id}),d.jsx(xt,{variant:"secondary",children:wo(x.size_bytes)}),d.jsx("span",{className:"text-xs text-on-surface-variant",children:bae(x.modified_at)})]}),d.jsxs("div",{className:"flex gap-2 flex-shrink-0 ml-3",children:[d.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>m(x.machine_id),children:"Preview"}),d.jsxs(Ae,{variant:"secondary",size:"sm",onClick:()=>y(x.machine_id),children:[d.jsx(eI,{className:"mr-1.5 h-3.5 w-3.5"}),"Restore"]})]})]},x.machine_id))}):n?d.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:'No backups yet. Click "Backup Now" to create one.'}):null,f&&d.jsxs($e,{level:"lowest",className:"p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(St,{children:"Restore Preview"}),d.jsx(xt,{variant:"outline",children:f.machine_id})]}),d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full font-mono text-sm","aria-label":"Restore preview",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-left text-on-surface-variant",children:[d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest",scope:"col",children:"Table"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"New"}),d.jsx("th",{className:"pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Existing"})]})}),d.jsx("tbody",{children:f.tables.map((x,b)=>d.jsxs("tr",{className:ke("transition-colors hover:bg-surface-container-high/50",b%2===1?"bg-surface-container-low/30":""),children:[d.jsx("td",{className:"py-2 pr-4",children:x.table}),d.jsx("td",{className:"py-2 pr-4 text-right",children:x.new>0?d.jsx("span",{className:"text-primary",children:x.new}):0}),d.jsx("td",{className:"py-2 text-right text-on-surface-variant",children:x.existing})]},x.table))})]})}),d.jsxs("div",{className:"flex gap-4 font-sans text-sm text-on-surface-variant",children:[d.jsxs("span",{children:["New: ",d.jsx("strong",{className:"text-primary",children:f.total_new})]}),d.jsxs("span",{children:["Existing: ",d.jsx("strong",{children:f.total_existing})]})]})]})]})}const Vv=500,eR=6e4;function Sae(e){return e?new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"}function Eae(e,t){return e<=0?null:e===1&&t?t:`${e} packages`}function Cae(){var C;const{data:e}=uD(),t=pI(),n=mI(),r=gI(),[a,i]=j.useState("idle"),[l,o]=j.useState(null);j.useEffect(()=>{if(!(e!=null&&e.restarting)||a!=="idle")return;i("restarting");const T=Date.now()+eR;let R=!1;const A=async()=>{if(!(R||Date.now()>T)){try{if((await fetch("/health")).ok){window.location.reload();return}}catch{}R||setTimeout(A,Vv)}},D=setTimeout(A,Vv);return()=>{R=!0,clearTimeout(D)}},[e==null?void 0:e.restarting,a]);const f=j.useCallback(async()=>{i("applying"),o(null);try{await n.mutateAsync(),i("restarting");const T=Date.now()+eR;await new Promise((R,A)=>{const D=async()=>{if(Date.now()>T){A(new Error("timeout"));return}try{if((await fetch("/health")).ok){R();return}}catch{}setTimeout(D,Vv)};setTimeout(D,Vv)}),window.location.reload()}catch(T){i("error");const R=T.message==="timeout"?"Daemon did not restart within the expected time. Check the terminal.":T.message;o(R)}},[n]),c=j.useCallback(()=>{t.mutate()},[t]),h=j.useCallback(T=>{r.mutate(T)},[r]);if(!e)return null;const p=t.isPending,m=a==="applying"||a==="restarting",y=e.update_available===!0,x=e.channel??"stable",b=(e.packages??[]).filter(T=>T.installed),w=b.filter(T=>T.update_available),S=w.length,N=Eae(S,((C=w[0])==null?void 0:C.latest_version)??void 0);return e.exempt?d.jsxs($e,{level:"low",className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Xz,{className:"h-4 w-4 text-primary"}),d.jsx(St,{children:"Updates"})]}),d.jsxs("p",{className:"font-sans text-sm text-on-surface-variant",children:["Updates are disabled in development mode."," ",d.jsx("span",{className:"font-mono text-xs text-outline",children:e.running_version})]})]}):d.jsxs($e,{level:"low",className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(jb,{className:ke("h-4 w-4",y?"text-secondary":"text-primary")}),d.jsx(St,{children:"Updates"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-xs text-outline",children:e.running_version}),y&&N&&d.jsx(xt,{variant:"warning",children:N})]})]}),d.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[y?d.jsx(Ae,{variant:"default",size:"sm",onClick:f,disabled:m,children:m?d.jsxs(d.Fragment,{children:[d.jsx(ls,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),a==="restarting"?"Restarting…":"Updating…"]}):d.jsxs(d.Fragment,{children:[d.jsx(jb,{className:"mr-1.5 h-3.5 w-3.5"}),S>1?`Update ${S} Packages & Restart`:"Update & Restart"]})}):d.jsxs("div",{className:"flex items-center gap-1.5 text-primary",children:[d.jsx(yc,{className:"h-4 w-4"}),d.jsx("span",{className:"font-sans text-sm",children:"Up to date"})]}),d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:c,disabled:p||m,children:[d.jsx(ls,{className:ke("mr-1.5 h-3.5 w-3.5",p&&"animate-spin")}),"Check Now"]})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"flex items-center gap-1",children:fI.map(T=>d.jsx(Ae,{variant:x===T?"default":"ghost",className:"text-xs capitalize h-6 px-2",onClick:()=>h(T),disabled:r.isPending||m,children:T},T))}),d.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Checked: ",Sae(e.last_check)]})]}),b.length>0&&d.jsxs("div",{className:"space-y-2",children:[b.map(T=>d.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-outline/20 px-3 py-2",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"font-sans text-sm text-on-surface",children:T.display_name}),d.jsxs("div",{className:"font-mono text-xs text-on-surface-variant",children:[T.installed_version??"not installed",T.update_available&&T.latest_version?` → ${T.latest_version}`:""]})]}),d.jsx(xt,{variant:T.update_available?"warning":"secondary",children:T.update_available?"Update available":"Installed"})]},T.id)),d.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Installed Myco packages update together from this machine-level updater."})]}),(a==="error"||e.error)&&d.jsxs("div",{className:"flex items-start gap-2 text-tertiary",children:[d.jsx(Cr,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),d.jsx("span",{className:"font-sans text-sm",children:l??e.error})]})]})}function Nae(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),a=String(t.getSeconds()).padStart(2,"0");return n+":"+r+":"+a}function C3({entry:e}){return d.jsxs("tr",{className:"hover:bg-surface-container-high/30 transition-colors",children:[d.jsx("td",{className:"whitespace-nowrap py-1.5 pl-4 pr-3 text-on-surface-variant/60 align-top w-[68px]",children:Nae(e.timestamp)}),d.jsx("td",{className:"whitespace-nowrap py-1.5 pr-3 align-top w-[20px]",children:d.jsx("div",{className:ke("h-2 w-2 rounded-full mt-1",U1(e.level))})}),d.jsx("td",{className:"whitespace-nowrap py-1.5 pr-3 align-top w-[54px]",children:d.jsx(xt,{variant:oD(e.level),className:"px-1.5 py-0 text-[10px] uppercase",children:e.level})}),d.jsx("td",{className:"py-1.5 pr-4 text-on-surface align-top break-words",children:e.message})]})}const kae=["sessions","spores","plans","artifacts","skill_records"],Tae="embedding",jae="database",Aae=15,Rae="insufficient_disk_space",Fp=20,Dae=[{id:"embedding",label:"Embedding"},{id:"database",label:"Database"},{id:"system",label:"System"}],Mae=new Set(["embedding","database","system"]),N3="tab";function _ae(){const t=new URLSearchParams(window.location.search).get(N3);return t&&Mae.has(t)?t:"embedding"}function Oae(e){const t=new URLSearchParams;e!=="embedding"&&t.set(N3,e);const n=t.toString(),r=n?`${window.location.pathname}?${n}`:window.location.pathname;window.history.replaceState(null,"",r)}function Lae(e){return e.provider.available?Object.values(e.pending).some(n=>n>0)?"processing":"idle":"unavailable"}function Pae(e){return e.provider.available?Object.values(e.pending).some(n=>n>0)?"bg-secondary":"bg-primary":"bg-tertiary"}function Bae(e){if(e<=0)return"now";const t=Math.floor(e/1e3);if(t<60)return t+"s";const n=Math.floor(t/60);return n<60?n+"m":Math.floor(n/60)+"h"}function zae({data:e}){return d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full font-mono text-sm","aria-label":"Embedding namespace breakdown",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-left text-on-surface-variant",children:[d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest",scope:"col",children:"Namespace"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Embedded"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Pending"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Stale"}),d.jsx("th",{className:"pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Total"})]})}),d.jsx("tbody",{children:kae.map((t,n)=>{const r=e.by_namespace[t],a=(r==null?void 0:r.embedded)??0,i=(r==null?void 0:r.stale)??0,l=e.pending[t]??0,o=a+l;return d.jsxs("tr",{className:ke("transition-colors hover:bg-surface-container-high/50",n%2===1?"bg-surface-container-low/30":""),children:[d.jsx("td",{className:"py-2.5 pr-4",children:t}),d.jsx("td",{className:"py-2.5 pr-4 text-right",children:a}),d.jsx("td",{className:"py-2.5 pr-4 text-right",children:l>0?d.jsx("span",{className:"text-secondary",children:l}):l}),d.jsx("td",{className:"py-2.5 pr-4 text-right",children:i>0?d.jsx("span",{className:"text-tertiary",children:i}):i}),d.jsx("td",{className:"py-2.5 text-right",children:o})]},t)})})]})})}function Iae({tables:e}){const t=[...e].sort((n,r)=>r.rows-n.rows);return d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full font-mono text-sm","aria-label":"Database table breakdown",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-left text-on-surface-variant",children:[d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest",scope:"col",children:"Table"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Rows"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Indexes"}),d.jsx("th",{className:"pb-2 font-sans font-medium text-xs uppercase tracking-widest",scope:"col",children:"Type"})]})}),d.jsx("tbody",{children:t.map((n,r)=>d.jsxs("tr",{className:ke("transition-colors hover:bg-surface-container-high/50",r%2===1?"bg-surface-container-low/30":""),children:[d.jsx("td",{className:"py-2.5 pr-4",children:n.name}),d.jsx("td",{className:"py-2.5 pr-4 text-right",children:n.rows.toLocaleString()}),d.jsx("td",{className:"py-2.5 pr-4 text-right",children:n.index_count}),d.jsx("td",{className:"py-2.5",children:n.is_fts?d.jsx(xt,{variant:"outline",className:"px-1.5 py-0 text-[10px] uppercase",children:"FTS5"}):d.jsx("span",{className:"text-on-surface-variant/60",children:"btree"})})]},n.name))})]})})}function Fae({indexes:e}){const[t,n]=j.useState(!1),r=e.filter(i=>i.type==="btree").length,a=e.filter(i=>i.type==="auto").length;return d.jsxs($e,{id:Ni.operationsMaintenance,level:"low",className:"rounded-lg p-6 space-y-4 transition-all duration-300",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(St,{children:"Indexes"}),d.jsx("button",{type:"button",onClick:()=>n(i=>!i),className:"font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors",children:t?"Hide":"Show all "+e.length})]}),d.jsxs("p",{className:"font-sans text-sm text-on-surface-variant",children:[r," btree ",r===1?"index":"indexes",a>0&&d.jsxs(d.Fragment,{children:[" · ",a," auto-",a===1?"index":"indexes"]})]}),t&&d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full font-mono text-xs","aria-label":"All database indexes",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-left text-on-surface-variant",children:[d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-[10px] uppercase tracking-widest",scope:"col",children:"Name"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-[10px] uppercase tracking-widest",scope:"col",children:"Table"}),d.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-[10px] uppercase tracking-widest",scope:"col",children:"Type"}),d.jsx("th",{className:"pb-2 font-sans font-medium text-[10px] uppercase tracking-widest",scope:"col",children:"SQL"})]})}),d.jsx("tbody",{children:e.map((i,l)=>d.jsxs("tr",{className:ke("transition-colors hover:bg-surface-container-high/50",l%2===1?"bg-surface-container-low/30":""),children:[d.jsx("td",{className:"py-1.5 pr-4",children:i.name}),d.jsx("td",{className:"py-1.5 pr-4 text-on-surface-variant",children:i.table}),d.jsx("td",{className:"py-1.5 pr-4 text-on-surface-variant uppercase",children:i.type}),d.jsx("td",{className:"py-1.5 text-on-surface-variant/70 truncate max-w-[300px]",title:i.sql??"",children:i.sql??"—"})]},i.name))})]})})]})}function Uae({details:e,onActionResult:t}){const{effective:n}=hs(),r=Sn(),[a,i]=j.useState(!1);if(!n)return null;const l=n.maintenance.auto_optimize,o=n.maintenance.auto_optimize_interval_hours,f=e.last_optimize_at?new Date(e.last_optimize_at).getTime():null,c=f!==null?f+o*uo*1e3-Date.now():0;async function h(){i(!0);try{const p=await nn("/database/optimize"),m=p.actions_failed.length;t({type:m>0?"error":"success",text:"Optimize complete: "+p.actions_completed.length+" steps, "+m+" failed ("+p.duration_ms+"ms)"}),r.invalidateQueries({queryKey:["database-details"]})}catch(p){t({type:"error",text:"Error: "+p.message})}finally{i(!1)}}return d.jsxs($e,{level:"low",className:"p-6 space-y-4",children:[d.jsx(St,{children:"Scheduled Maintenance"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3 font-sans text-sm",children:[d.jsx(zn,{path:"maintenance.auto_optimize",label:"Auto-optimize",defaultScope:"local",children:({value:p,onChange:m})=>d.jsx(yi,{checked:p??!1,onCheckedChange:m})}),d.jsx("span",{className:"text-on-surface-variant",children:"every"}),d.jsx(zn,{path:"maintenance.auto_optimize_interval_hours",label:"",defaultScope:"local",children:({value:p,onChange:m})=>d.jsxs("select",{value:p??24,disabled:!l,onChange:y=>m(Number(y.target.value)),className:"rounded-md border border-outline bg-surface-container px-2 py-1 text-on-surface text-sm",children:[d.jsx("option",{value:6,children:"6 hours"}),d.jsx("option",{value:12,children:"12 hours"}),d.jsx("option",{value:24,children:"24 hours"}),d.jsx("option",{value:72,children:"3 days"}),d.jsx("option",{value:168,children:"7 days"}),d.jsx("option",{value:720,children:"30 days"})]})})]}),d.jsxs("p",{className:"font-sans text-sm text-on-surface-variant",children:["Last run: ",e.last_optimize_at?sm(e.last_optimize_at):"never",l&&f!==null&&d.jsxs(d.Fragment,{children:[" · Next: ",Bae(c)]})]}),d.jsxs(Ae,{variant:"secondary",size:"sm",onClick:h,disabled:a,children:[d.jsx(ss,{className:"mr-2 h-4 w-4"}),a?"Running...":"Run now"]})]})}function qae({onActionResult:e}){const t=Sn(),[n,r]=j.useState(!1);async function a(){r(!0);try{const o=await nn("/database/integrity-check");o.status==="ok"?e({type:"success",text:"Integrity check OK ("+o.duration_ms+"ms)"}):e({type:"error",text:"Integrity issues: "+o.issues.length+" problems, "+o.fk_violations+" FK violations"}),t.invalidateQueries({queryKey:["database-details"]})}catch(o){e({type:"error",text:"Error: "+o.message})}finally{r(!1)}}async function i(){if(confirm("VACUUM rebuilds the entire DB file and may take a while. Continue?")){r(!0);try{const o=await nn("/database/vacuum");e({type:"success",text:"Vacuum complete: freed "+wo(o.freed_bytes)+" in "+o.duration_ms+"ms"}),t.invalidateQueries({queryKey:["database-details"]})}catch(o){if(o instanceof XR){const f=o.body;if((f==null?void 0:f.error)===Rae){e({type:"error",text:"Insufficient disk: need "+wo(f.required_bytes??0)+", have "+wo(f.free_bytes??0)});return}}e({type:"error",text:"Error: "+o.message})}finally{r(!1)}}}async function l(){if(confirm("REINDEX rebuilds all indexes. Continue?")){r(!0);try{const o=await nn("/database/reindex");e({type:"success",text:"Reindex complete ("+o.duration_ms+"ms)"}),t.invalidateQueries({queryKey:["database-details"]})}catch(o){e({type:"error",text:"Error: "+o.message})}finally{r(!1)}}}return d.jsxs($e,{level:"low",className:"p-6 space-y-3",children:[d.jsx(St,{children:"Actions"}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:a,disabled:n,children:[d.jsx(ls,{className:"mr-2 h-4 w-4"}),"Integrity check"]}),d.jsxs(Ae,{variant:"destructive",size:"sm",onClick:i,disabled:n,children:[d.jsx(os,{className:"mr-2 h-4 w-4"}),"Vacuum"]}),d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:l,disabled:n,children:[d.jsx($p,{className:"mr-2 h-4 w-4"}),"Reindex"]})]})]})}function Vae({data:e}){const t=Sn(),[n,r]=j.useState(null),[a,i]=j.useState([]);j.useEffect(()=>{i(C=>{const T=[...C,e.total];return T.length>Fp?T.slice(-Fp):T})},[e]);const{filteredEntries:l,scrollRef:o,autoScroll:f,setAutoScroll:c,hasNewEntries:h,handleScroll:p,scrollToBottom:m}=E3(Tae);async function y(){r(null);try{const C=await nn("/embedding/reembed-stale");r({type:"success",text:`Re-embedded ${C.reembedded} stale vectors`}),t.invalidateQueries({queryKey:["embedding-details"]})}catch(C){r({type:"error",text:`Error: ${C.message}`})}}async function x(){if(confirm("This will re-embed all vectors. Continue?")){r(null);try{const C=await nn("/embedding/rebuild");r({type:"success",text:`Rebuild queued: ${C.queued} vectors to re-embed`}),t.invalidateQueries({queryKey:["embedding-details"]})}catch(C){r({type:"error",text:`Error: ${C.message}`})}}}async function b(){r(null);try{const C=await nn("/embedding/clean-orphans");r({type:"success",text:`Cleaned ${C.orphans_cleaned} orphan vectors`}),t.invalidateQueries({queryKey:["embedding-details"]})}catch(C){r({type:"error",text:`Error: ${C.message}`})}}async function w(){r(null);try{const C=await nn("/embedding/reconcile");r({type:"success",text:`Reconcile complete: ${C.embedded} embedded, ${C.orphans_cleaned} orphans cleaned (${C.duration_ms}ms)`}),t.invalidateQueries({queryKey:["embedding-details"]})}catch(C){r({type:"error",text:`Error: ${C.message}`})}}const S=Object.values(e.pending).reduce((C,T)=>C+T,0),N=Object.values(e.by_namespace).reduce((C,T)=>C+T.stale,0);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-4 font-sans text-sm",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(nD,{className:"h-4 w-4 text-primary"}),d.jsx("span",{className:"text-on-surface-variant",children:"Provider"}),d.jsx("span",{className:"font-mono text-on-surface",children:e.provider.name})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-on-surface-variant",children:"Model"}),d.jsx("span",{className:"font-mono text-xs text-on-surface truncate max-w-[200px]",title:e.provider.model,children:e.provider.model})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:ke("h-2 w-2 rounded-full",Pae(e))}),d.jsx("span",{className:"text-on-surface-variant capitalize",children:Lae(e)})]})]}),d.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[d.jsx(Yt,{label:"Total Vectors",value:String(e.total),sparklineData:a,accent:"sage"}),d.jsx(Yt,{label:"Pending",value:String(S),accent:S>0?"ochre":"outline"}),d.jsx(Yt,{label:"Stale",value:String(N),accent:N>0?"terracotta":"outline"})]}),d.jsxs($e,{level:"low",className:"p-6 space-y-4",children:[d.jsx(St,{children:"Namespace Breakdown"}),d.jsx(zae,{data:e})]}),d.jsxs($e,{level:"low",className:"p-6 space-y-3",children:[d.jsx(St,{children:"Actions"}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:y,children:[d.jsx(ls,{className:"mr-2 h-4 w-4"}),"Re-embed stale"]}),d.jsxs(Ae,{variant:"ghost",size:"sm",onClick:b,children:[d.jsx(os,{className:"mr-2 h-4 w-4"}),"Clean orphans"]}),d.jsxs(Ae,{variant:"secondary",size:"sm",onClick:w,children:[d.jsx(ss,{className:"mr-2 h-4 w-4"}),"Force reconcile"]}),d.jsxs(Ae,{variant:"destructive",size:"sm",onClick:x,children:[d.jsx($p,{className:"mr-2 h-4 w-4"}),"Rebuild all"]})]}),n&&d.jsx("p",{className:ke("font-sans text-sm",n.type==="success"?"text-primary":"text-tertiary"),children:n.text})]}),d.jsxs($e,{level:"low",className:"flex flex-col overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[d.jsx(St,{children:"Activity Log"}),d.jsxs(Ae,{size:"sm",variant:f?"default":"ghost",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>{f?c(!1):m()},title:f?"Pause auto-scroll":"Resume auto-scroll",children:[f?d.jsx(z1,{className:"h-3 w-3"}):d.jsx(ss,{className:"h-3 w-3"}),f?"Pause":"Resume"]})]}),d.jsxs("div",{className:"relative flex-1 p-0",children:[d.jsx("div",{ref:o,onScroll:p,className:"h-64 overflow-y-auto font-mono text-xs bg-surface-container-lowest",children:l.length===0?d.jsx("div",{className:"flex h-32 items-center justify-center font-sans text-on-surface-variant",children:"No embedding log entries"}):d.jsx("table",{className:"w-full border-collapse","aria-label":"Embedding activity log",children:d.jsx("tbody",{children:l.map((C,T)=>d.jsx(C3,{entry:C},`${C.timestamp}-${T}`))})})}),h&&!f&&d.jsxs("button",{type:"button",onClick:m,className:ke("absolute bottom-4 left-1/2 -translate-x-1/2","flex items-center gap-1.5 rounded-full","bg-surface-container-high px-3 py-1.5 text-xs font-medium shadow-ambient","text-on-surface-variant transition-colors hover:text-on-surface"),children:[d.jsx(JR,{className:"h-3 w-3"}),"New entries below"]})]})]})]})}function Hae(){return d.jsxs("div",{className:"space-y-6",children:[d.jsx(Cae,{}),d.jsx(wae,{})]})}function Gae(){const{data:e,isLoading:t,isError:n,error:r}=mae(),[a,i]=j.useState([]),[l,o]=j.useState(null);j.useEffect(()=>{e&&i(S=>{const N=[...S,e.file.size_bytes];return N.length>Fp?N.slice(-Fp):N})},[e]);const{filteredEntries:f,scrollRef:c,autoScroll:h,setAutoScroll:p,hasNewEntries:m,handleScroll:y,scrollToBottom:x}=E3(jae);if(t)return d.jsx("div",{className:"text-on-surface-variant",children:"Loading database details..."});if(n)return d.jsxs("div",{className:"text-tertiary",children:["Error: ",r.message]});if(!e)return null;const b=e.file.fragmentation_pct.toFixed(1)+"%",w=e.file.fragmentation_pct>Aae?"ochre":"outline";return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-4 font-sans text-sm",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Rz,{className:"h-4 w-4 text-primary"}),d.jsx("span",{className:"text-on-surface-variant",children:"Database"}),d.jsx("span",{className:"font-mono text-on-surface",children:"myco.db"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-on-surface-variant",children:"Schema"}),d.jsxs("span",{className:"font-mono text-on-surface",children:["v",e.schema.version]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-on-surface-variant",children:"Journal"}),d.jsx("span",{className:"font-mono text-on-surface uppercase",children:e.schema.journal_mode})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"h-2 w-2 rounded-full bg-primary"}),d.jsx("span",{className:"text-on-surface-variant",children:"healthy"})]})]}),d.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[d.jsx(Yt,{label:"Database Size",value:wo(e.file.size_bytes),sparklineData:a,accent:"sage"}),d.jsx(Yt,{label:"Fragmentation",value:b,accent:w}),d.jsx(Yt,{label:"WAL Size",value:wo(e.file.wal_size_bytes),accent:"outline"})]}),d.jsxs($e,{level:"low",className:"p-6 space-y-4",children:[d.jsx(St,{children:"Schema Breakdown"}),d.jsx(Iae,{tables:e.tables})]}),d.jsx(Fae,{indexes:e.indexes}),d.jsx(Uae,{details:e,onActionResult:o}),d.jsx(qae,{onActionResult:o}),l&&d.jsx("p",{className:ke("font-sans text-sm",l.type==="success"?"text-primary":"text-tertiary"),children:l.text}),d.jsxs($e,{level:"low",className:"flex flex-col overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[d.jsx(St,{children:"Activity Log"}),d.jsxs(Ae,{size:"sm",variant:h?"default":"ghost",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>{h?p(!1):x()},title:h?"Pause auto-scroll":"Resume auto-scroll",children:[h?d.jsx(z1,{className:"h-3 w-3"}):d.jsx(ss,{className:"h-3 w-3"}),h?"Pause":"Resume"]})]}),d.jsxs("div",{className:"relative flex-1 p-0",children:[d.jsx("div",{ref:c,onScroll:y,className:"h-64 overflow-y-auto font-mono text-xs bg-surface-container-lowest",children:f.length===0?d.jsx("div",{className:"flex h-32 items-center justify-center font-sans text-on-surface-variant",children:"No database log entries"}):d.jsx("table",{className:"w-full border-collapse","aria-label":"Database activity log",children:d.jsx("tbody",{children:f.map((S,N)=>d.jsx(C3,{entry:S},S.timestamp+"-"+N))})})}),m&&!h&&d.jsxs("button",{type:"button",onClick:x,className:ke("absolute bottom-4 left-1/2 -translate-x-1/2","flex items-center gap-1.5 rounded-full","bg-surface-container-high px-3 py-1.5 text-xs font-medium shadow-ambient","text-on-surface-variant transition-colors hover:text-on-surface"),children:[d.jsx(JR,{className:"h-3 w-3"}),"New entries below"]})]})]})]})}const $ae={embedding:"Embedding health, maintenance actions, and activity log",database:"Schema inspection, maintenance actions, and scheduled optimization",system:"Software updates and backup management"};function Kae(){const{data:e,isLoading:t,isError:n,error:r}=pae(),[a,i]=j.useState(_ae),l=j.useCallback(o=>{const f=o;i(f),Oae(f)},[]);return d.jsx(mw,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Loading operations...",children:e&&d.jsxs("div",{className:"flex h-full flex-col",children:[d.jsx("div",{className:"px-6 pt-6",children:d.jsx(wi,{title:"Operations",subtitle:$ae[a],tabs:Dae,activeTab:a,onTabChange:l})}),d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsxs("div",{className:"px-6 pb-6",children:[a==="embedding"&&d.jsx(Vae,{data:e}),a==="database"&&d.jsx(Gae,{}),a==="system"&&d.jsx(Hae,{})]})})]})})}function Yae(){return Or({queryKey:["team-status"],queryFn:({signal:e})=>lt("/team/status",{signal:e}),refetchInterval:Kn.STATS,pollCategory:"standard"})}function Ou({label:e,value:t,mono:n=!0}){const[r,a]=j.useState(!1),i=j.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},[t]);return d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:e}),d.jsxs("div",{className:"flex items-center gap-2 group",children:[d.jsx("span",{className:`text-sm text-on-surface break-all ${n?"font-mono":""}`,children:t}),d.jsx("button",{type:"button",onClick:i,className:"flex-shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy to clipboard",children:r?d.jsx(gc,{className:"h-3.5 w-3.5 text-primary"}):d.jsx(P1,{className:"h-3.5 w-3.5"})})]})]})}function tR({label:e,value:t}){const[n,r]=j.useState(!1),[a,i]=j.useState(!1),l=j.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},[t]),o=`${t.slice(0,8)}${"*".repeat(Math.max(0,t.length-12))}${t.slice(-4)}`;return d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:e}),d.jsxs("div",{className:"flex items-center gap-2 group",children:[d.jsx("span",{className:"text-sm text-on-surface font-mono break-all",children:n?t:o}),d.jsx("button",{type:"button",onClick:()=>r(!n),className:"flex-shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface transition-opacity",title:n?"Hide":"Reveal",children:n?d.jsx(_z,{className:"h-3.5 w-3.5"}):d.jsx(Oz,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:l,className:"flex-shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy to clipboard",children:a?d.jsx(gc,{className:"h-3.5 w-3.5 text-primary"}):d.jsx(P1,{className:"h-3.5 w-3.5"})})]})]})}function Xae({onConnected:e}){const[t,n]=j.useState(""),[r,a]=j.useState(""),[i,l]=j.useState(null),[o,f]=j.useState(!1),c=async h=>{h.preventDefault(),l(null),f(!0);try{await nn("/team/connect",{url:t,api_key:r}),e()}catch(p){l(p instanceof Error?p.message:"Connection failed")}finally{f(!1)}};return d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-6",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[d.jsx(nI,{className:"h-4 w-4 text-on-surface-variant"}),d.jsx(St,{children:"Connect to team"})]}),d.jsx("p",{className:"text-sm text-on-surface-variant mb-4",children:"Enter the URL and API key for your team's Cloudflare Worker to enable cross-machine knowledge sharing."}),d.jsxs("form",{onSubmit:c,className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-on-surface-variant mb-1",children:"Worker URL"}),d.jsx(fn,{type:"url",placeholder:"https://myco-team.your-account.workers.dev",value:t,onChange:h=>n(h.target.value),required:!0})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-on-surface-variant mb-1",children:"API Key"}),d.jsx(fn,{type:"password",placeholder:"your-api-key",value:r,onChange:h=>a(h.target.value),required:!0})]}),i&&d.jsx("p",{className:"text-sm text-tertiary",children:i}),d.jsx(Ae,{type:"submit",size:"sm",disabled:o||!t||!r,children:o?d.jsxs(d.Fragment,{children:[d.jsx(ls,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Connecting..."]}):"Connect"})]})]})}function Qae({status:e}){const t=Sn(),[n,r]=j.useState(!1),[a,i]=j.useState(!1),[l,o]=j.useState(null),[f,c]=j.useState(!1),[h,p]=j.useState(null),[m,y]=j.useState(!1),[x,b]=j.useState(null),[w,S]=j.useState(!1),[N,C]=j.useState(!1),[T,R]=j.useState(!1),A=async()=>{r(!0);try{await nn("/team/disconnect"),t.invalidateQueries({queryKey:["team-status"]})}finally{r(!1)}},D=j.useCallback(async()=>{i(!0),o(null);try{const M=await nn("/team/backfill");o(M.enqueued>0?`Enqueued ${M.enqueued} records for sync. They'll push on the next flush cycle.`:"All records are already synced or enqueued."),t.invalidateQueries({queryKey:["team-status"]})}catch{o("Backfill failed.")}finally{i(!1)}},[t]),O=j.useCallback(async()=>{c(!0),p(null);try{const M=await nn("/team/upgrade-worker");M.success?(p(`Worker updated to v${M.version}`),t.invalidateQueries({queryKey:["team-status"]})):p(M.error??"Upgrade failed")}catch(M){p(M instanceof Error?M.message:"Upgrade failed")}finally{c(!1)}},[t]),L=j.useCallback(async()=>{y(!0),b(null);try{const M=await nn("/team/retry-failed");b(M.retried>0?`Re-queued ${M.retried} record${M.retried>1?"s":""} for sync.`:"No failed records to retry."),t.invalidateQueries({queryKey:["team-status"]})}catch{b("Retry failed.")}finally{y(!1)}},[t]);return d.jsxs("div",{className:"space-y-4",children:[e.worker_update_available&&d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-4 border-l-2 border-l-ochre",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(jb,{className:"h-5 w-5 text-ochre flex-shrink-0"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-on-surface",children:"Worker update available"}),d.jsxs("p",{className:"text-xs text-on-surface-variant",children:["Deployed: v",e.deployed_worker_version??"?"," — Local team package: v",e.local_team_package_version??"?"]})]})]}),d.jsx(Ae,{variant:"default",size:"sm",onClick:O,disabled:f,children:f?d.jsxs(d.Fragment,{children:[d.jsx(ls,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Deploying..."]}):"Update Worker"})]}),h&&d.jsx("p",{className:"text-xs text-on-surface-variant mt-2",children:h})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[d.jsx(Yt,{label:"Status",value:e.healthy?"Connected":"Unhealthy",accent:e.healthy?"sage":"terracotta"}),d.jsx(Yt,{label:"Pending sync",value:String(e.pending_sync_count),accent:e.dead_letter_count>0?"terracotta":"outline",sublabel:e.dead_letter_count>0?`${e.dead_letter_count} failed`:void 0,href:"/logs?component=team-sync"}),d.jsx(Yt,{label:"Protocol",value:`v${e.sync_protocol_version}`,accent:"outline"}),d.jsx(Yt,{label:"Schema",value:`v${e.schema_version}`,accent:"outline"})]}),d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-5 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(St,{children:"Team Credentials"}),d.jsx(xt,{variant:e.healthy?"default":"destructive",children:e.healthy?"healthy":"unhealthy"})]}),d.jsx("p",{className:"text-xs text-on-surface-variant",children:"Share these with teammates so they can connect from the Team page."}),d.jsxs("div",{className:"space-y-3",children:[e.worker_url&&d.jsx(Ou,{label:"Worker URL",value:e.worker_url}),e.api_key&&d.jsx(tR,{label:"API Key",value:e.api_key})]})]}),e.mcp_token&&e.mcp_endpoint&&d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-5 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(St,{children:"Cloud MCP Endpoint"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:()=>S(!w),className:"text-xs text-on-surface-variant hover:text-on-surface transition-colors",children:w?"Hide snippet":"Config snippet"}),d.jsx("button",{onClick:()=>C(!0),className:"text-xs text-on-surface-variant hover:text-terracotta-text transition-colors",children:"Rotate token"})]})]}),d.jsx("p",{className:"text-xs text-on-surface-variant",children:"Configure cloud agents with this endpoint to access project team intelligence."}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(Ou,{label:"MCP URL",value:e.mcp_endpoint}),d.jsx(tR,{label:"MCP Access Token",value:e.mcp_token})]}),w&&(()=>{const M=JSON.stringify({mcp_servers:[{type:"url",url:e.mcp_endpoint,name:"myco",authorization_token:e.mcp_token}]},null,2);return d.jsxs("div",{className:"relative",children:[d.jsx("pre",{className:"text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant",children:M}),d.jsx("button",{onClick:()=>navigator.clipboard.writeText(M),className:"absolute top-2 right-2 p-1 rounded hover:bg-surface-container-high transition-colors",children:d.jsx(P1,{className:"h-3.5 w-3.5 text-on-surface-variant"})})]})})()]}),d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-5 space-y-4",children:[d.jsx(St,{children:"This Node"}),d.jsxs("div",{className:"grid gap-3",children:[d.jsx(Ou,{label:"Machine ID",value:e.machine_id}),d.jsx(Ou,{label:"Package Version",value:e.package_version})]}),e.health_error&&d.jsx("p",{className:"text-sm text-tertiary mt-2",children:e.health_error})]}),d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-5 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(St,{children:"Collective"}),d.jsx(xt,{variant:e.collective_connected?"default":"outline",children:e.collective_connected?"connected":"not connected"})]}),e.collective_connected?d.jsxs("div",{className:"space-y-3",children:[e.collective_url&&d.jsx(Ou,{label:"Collective URL",value:e.collective_url}),e.collective_project_id&&d.jsx(Ou,{label:"Project ID",value:e.collective_project_id}),d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:"Last settings sync"}),d.jsx("p",{className:"text-sm text-on-surface",children:e.collective_last_settings_sync?new Date(e.collective_last_settings_sync*1e3).toLocaleString():"Never"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:"Last heartbeat"}),d.jsx("p",{className:"text-sm text-on-surface",children:e.collective_last_heartbeat?new Date(e.collective_last_heartbeat*1e3).toLocaleString():"Never"})]})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:"Capabilities"}),d.jsx("div",{className:"flex flex-wrap gap-2",children:e.collective_capabilities.map(M=>d.jsx(xt,{variant:"outline",children:M},M))})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("span",{className:"text-xs text-on-surface-variant",children:"Effective overrides"}),d.jsx("pre",{className:"text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant",children:JSON.stringify(e.collective_settings,null,2)})]})]}):d.jsx("p",{className:"text-sm text-on-surface-variant",children:"This team worker is not currently connected to a Myco Collective."})]}),d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-5 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(St,{children:"Sync"}),d.jsx(Ae,{variant:"default",size:"sm",onClick:D,disabled:a,children:a?d.jsxs(d.Fragment,{children:[d.jsx(ls,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Syncing..."]}):"Sync All"})]}),d.jsx("p",{className:"text-xs text-on-surface-variant",children:"Push all unsynced local knowledge to the team store. Records sync automatically on new writes, but historical data needs a one-time backfill."}),l&&d.jsx("p",{className:"text-sm text-primary",children:l}),e.dead_letter_count>0&&d.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-outline-variant/10",children:[d.jsxs("p",{className:"text-xs text-on-surface-variant",children:[d.jsxs("span",{className:"text-tertiary font-medium",children:[e.dead_letter_count," failed"]})," record",e.dead_letter_count>1?"s":""," — exceeded max retries."," ",d.jsx("a",{href:"/logs?component=team-sync&level=error",className:"underline hover:text-on-surface",children:"View logs"})]}),d.jsx(Ae,{variant:"outline",size:"sm",onClick:L,disabled:m,children:m?"Retrying...":"Retry Failed"})]}),x&&d.jsx("p",{className:"text-xs text-primary",children:x})]}),d.jsx("div",{className:"flex justify-end",children:d.jsx(Ae,{variant:"outline",size:"sm",onClick:A,disabled:n,children:n?"Disconnecting...":"Disconnect"})}),d.jsx(um,{open:N,onOpenChange:C,title:"Rotate MCP Access Token",description:"This will invalidate the current MCP token. Any cloud agents using it will lose access until reconfigured with the new token.",confirmLabel:"Rotate Token",variant:"destructive",isPending:T,onConfirm:async()=>{R(!0);try{await nn("/team/rotate-mcp-token"),t.invalidateQueries({queryKey:["team-status"]}),C(!1)}catch{}finally{R(!1)}}})]})}function Wae(){const{data:e,isLoading:t}=Yae(),n=Sn();if(t)return d.jsx(mw,{isLoading:!0,error:null,children:d.jsx("span",{})});const r=(e==null?void 0:e.enabled)&&(e==null?void 0:e.worker_url);return d.jsxs("div",{className:"p-6 max-w-4xl",children:[d.jsx(wi,{title:"Team",subtitle:"Share knowledge across machines with team sync"}),r&&e?d.jsx(Qae,{status:e}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs($e,{level:"low",ghostBorder:!0,className:"p-6 space-y-4",children:[d.jsx(St,{children:"Getting Started"}),d.jsx("p",{className:"text-sm text-on-surface-variant",children:"Team sync lets multiple machines share captured knowledge through a Cloudflare Worker. One team member provisions the infrastructure, then shares the connection details."}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-on-surface mb-1",children:"1. Install Wrangler"}),d.jsx("code",{className:"block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant",children:"npm install -g wrangler && wrangler login"})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-on-surface mb-1",children:"2. Provision the team"}),d.jsx("code",{className:"block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant",children:"myco team init"}),d.jsx("p",{className:"text-xs text-on-surface-variant mt-1",children:"Creates a D1 database, Vectorize index, and deploys the sync worker. Outputs a Worker URL and API key to share with teammates."})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-on-surface mb-1",children:"3. Connect"}),d.jsxs("p",{className:"text-xs text-on-surface-variant",children:["Paste the Worker URL and API key below, or if you ran ",d.jsx("code",{className:"font-mono",children:"myco team init"}),", you're already connected."]})]})]})]}),d.jsx(Xae,{onConnected:()=>n.invalidateQueries({queryKey:["team-status"]})})]})]})}const Zae=[{value:"15m",label:"15m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"},{value:"30d",label:"30d"}];function Jae({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:a,activeLevel:i,onLevelChange:l,components:o,activeComponents:f,onComponentToggle:c,onComponentsClear:h,timeRange:p,onTimeRangeChange:m,totalResults:y,paused:x=!1,onPausedToggle:b}){return d.jsxs($e,{level:"default",className:"rounded-md p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("div",{className:"flex items-center rounded-md bg-surface-container-low",children:[d.jsxs(Ae,{size:"sm",variant:e==="live"?"default":"ghost",className:"h-7 gap-1.5 px-2.5 text-xs rounded-r-none",onClick:()=>t("live"),children:[d.jsx(aD,{className:"h-3 w-3"}),"Live"]}),d.jsxs(Ae,{size:"sm",variant:e==="search"?"default":"ghost",className:"h-7 gap-1.5 px-2.5 text-xs rounded-l-none",onClick:()=>t("search"),children:[d.jsx(xc,{className:"h-3 w-3"}),"Search"]})]}),e==="live"&&b&&d.jsxs(Ae,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 px-2.5 text-xs",onClick:b,"aria-label":x?"Resume log stream":"Pause log stream",title:x?"Resume":"Pause",children:[x?d.jsx(ss,{className:"h-3 w-3"}):d.jsx(z1,{className:"h-3 w-3"}),x?"Resume":"Pause"]}),e==="search"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-5 w-px bg-outline-variant/30"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(tD,{className:"h-3 w-3 text-on-surface-variant/50"}),Zae.map(w=>d.jsx(Ae,{size:"sm",variant:p===w.value?"default":"ghost",className:"h-6 px-1.5 text-[10px]",onClick:()=>m(w.value),children:w.label},w.value))]})]}),d.jsx("form",{className:"ml-auto flex items-center gap-1.5",onSubmit:w=>{w.preventDefault(),a()},children:d.jsx(fn,{className:"h-7 w-56 text-xs",placeholder:e==="search"?"Search logs...":"Filter messages...",value:n,onChange:w=>r(w.target.value),"aria-label":"Search log messages"})}),e==="search"&&y!==void 0&&d.jsxs("span",{className:"text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap",children:[y.toLocaleString()," results"]})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"flex items-center gap-1",children:uI.map(w=>d.jsxs(Ae,{size:"sm",variant:i===w?"default":"ghost",className:"h-6 px-2 text-[10px] capitalize gap-1.5",onClick:()=>l(w),children:[d.jsx("div",{className:ke("h-1.5 w-1.5 rounded-full",U1(w))}),w]},w))}),o.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-4 w-px bg-outline-variant/20"}),d.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.map(w=>d.jsx(Ae,{size:"sm",variant:f.has(w)?"default":"ghost",className:"h-5 px-1.5 text-[10px]",onClick:()=>c(w),children:w},w)),f.size>0&&d.jsx(Ae,{size:"sm",variant:"ghost",className:"h-5 px-1.5 text-[10px] text-on-surface-variant",onClick:h,children:"clear"})]})]})]})]})}const eie={debug:"border-l-outline/30",info:"border-l-primary/50",warn:"border-l-secondary/70",error:"border-l-tertiary/80"},tie={context:"text-primary/70",hooks:"text-on-surface-variant/70",agent:"text-secondary/80",daemon:"text-on-surface-variant/60",capture:"text-primary/60",processor:"text-on-surface-variant/70",lifecycle:"text-primary/50",embedding:"text-on-surface-variant/60",power:"text-on-surface-variant/50",server:"text-on-surface-variant/60"};function nie(e,t){if(t)return sm(e);const n=new Date(e),r=String(n.getHours()).padStart(2,"0"),a=String(n.getMinutes()).padStart(2,"0"),i=String(n.getSeconds()).padStart(2,"0");return`${r}:${a}:${i}`}const rie=40,aie=60;function Zs(e){return typeof e=="string"&&e.length>0?e:null}const iie=[{pick:e=>Zs(e.tool_name)},{pick:e=>Zs(e.type)},{pick:e=>Zs(e.agent_type)},{pick:e=>Zs(e.task_subject),format:e=>bp(e,rie)},{pick:e=>Zs(e.filename)},{pick:e=>Zs(e.source_path)??Zs(e.path),format:aG},{pick:e=>Zs(e.error),format:e=>bp(e,aie)},{pick:e=>typeof e.pid=="number"?`pid ${e.pid}`:null}];function sie(e){if(!e)return"";for(const{pick:t,format:n}of iie){const r=t(e);if(r)return n?n(r):r}return""}function lie({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:a=!1,compact:i=!0}){const l=j.useRef(null);return j.useEffect(()=>{!r||!l.current||(l.current.scrollTop=l.current.scrollHeight)},[e,r]),d.jsx("div",{ref:l,className:"flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs",children:e.length===0?d.jsx("div",{className:"flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm",children:"No log entries"}):d.jsxs("table",{className:"w-full border-collapse","aria-label":"Log entries",children:[d.jsx("thead",{className:"sticky top-0 z-10 bg-surface-container-lowest/95 backdrop-blur supports-[backdrop-filter]:bg-surface-container-lowest/80",children:d.jsxs("tr",{className:"border-b border-outline-variant/10 text-[10px] uppercase tracking-[0.16em] text-on-surface-variant/50",children:[d.jsx("th",{className:"w-[68px] px-3 py-2 text-left font-medium",children:"Time"}),d.jsx("th",{className:"w-[12px] px-0 py-2","aria-hidden":"true"}),d.jsx("th",{className:"w-[48px] px-0 py-2 text-left font-medium",children:"Level"}),d.jsx("th",{className:"w-[90px] px-0 py-2 text-left font-medium",children:"Area"}),d.jsx("th",{className:"w-[72px] px-0 py-2 text-left font-medium",children:"Session"}),d.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Message"})]})}),d.jsx("tbody",{children:e.map(o=>d.jsx(oie,{entry:o,selected:o.id===t,onSelect:n,relativeTime:a,compact:i},o.id))})]})})}const oie=j.memo(function({entry:t,selected:n,onSelect:r,relativeTime:a,compact:i}){const l=i?"py-0.5":"py-1.5",o=gl(t.session_id),f=sie(t.data);return d.jsxs("tr",{className:ke("cursor-pointer transition-colors border-l-2",eie[t.level],n?"bg-primary/10":"hover:bg-surface-container-high/30"),onClick:()=>r(t),children:[d.jsx("td",{className:ke("whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums",l),children:nie(t.timestamp,a)}),d.jsx("td",{className:ke("whitespace-nowrap pr-1 align-top w-[12px]",l),children:d.jsx("div",{className:ke("h-1.5 w-1.5 rounded-full mt-1",U1(t.level))})}),d.jsx("td",{className:ke("whitespace-nowrap pr-2 align-top w-[48px]",l),children:d.jsx(xt,{variant:oD(t.level),className:"px-1 py-0 text-[9px] uppercase",children:t.level})}),d.jsx("td",{className:ke("whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]",l,tie[t.component]??"text-on-surface-variant/60"),children:t.component}),d.jsx("td",{className:ke("whitespace-nowrap pr-2 align-top w-[72px] tabular-nums text-on-surface-variant/40",l),title:t.session_id??"",children:o}),d.jsxs("td",{className:ke("pr-3 text-on-surface align-top break-words",l),children:[d.jsx("span",{children:t.message}),f&&d.jsxs("span",{className:"ml-2 text-on-surface-variant/50",children:["· ",f]})]})]})});function uie({value:e}){const t=String(e),n=t.slice(0,8);return d.jsxs(_a,{to:`/sessions/${t}`,className:"font-mono text-primary hover:underline",children:[n,"..."]})}function cie({value:e}){return Array.isArray(e)?d.jsx("span",{className:"flex flex-wrap gap-1",children:e.map((t,n)=>d.jsx(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:String(t)},n))}):d.jsx("span",{children:String(e)})}function fie({value:e}){return Array.isArray(e)?d.jsx("span",{className:"flex gap-1",children:e.map((t,n)=>d.jsx(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 tabular-nums",children:String(t)},n))}):d.jsx("span",{children:String(e)})}function die({value:e}){return d.jsx("span",{className:"rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]",children:String(e)})}function nR({value:e}){return d.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap",children:String(e)})}function hie({value:e}){const t=new Date(String(e)),r=new Date().getTime()-t.getTime(),a=Math.floor(r/6e4),i=Math.floor(a/60),l=Math.floor(i/24);let o;return a<1?o="just now":a<60?o=`${a}m ago`:i<24?o=`${i}h ago`:o=`${l}d ago`,d.jsx("span",{className:"tabular-nums",title:t.toISOString(),children:o})}function vie({value:e}){return typeof e=="object"&&e!==null?d.jsx("pre",{className:"text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap",children:JSON.stringify(e,null,2)}):d.jsx("span",{children:String(e)})}const pie={session_id:uie,spore_titles:cie,scores:fie,error:die,preview:nR,generated_at:hie,text:nR},mie=new Set(["id","timestamp","level","kind","component","message"]);function rR(e,t){const n=pie[e]??vie;return d.jsx(n,{value:t})}function gie(e){return mie.has(e)}function yie(e){return e?Object.entries(e).filter(([t])=>!gie(t)):[]}const xie={debug:"text-on-surface-variant/60",info:"text-primary",warn:"text-secondary",error:"text-tertiary"};function bie({entry:e,resolved:t,onClose:n}){const r=yie(e.data);return d.jsxs("div",{className:"flex h-full flex-col bg-surface-container-low",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-outline-variant/10",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 font-mono",children:e.kind}),d.jsx("span",{className:ke("text-xs font-medium",xie[e.level]),children:e.level.toUpperCase()})]}),d.jsx(Ae,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:n,"aria-label":"Close detail panel",children:d.jsx(jl,{className:"h-3.5 w-3.5"})})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Timestamp"}),d.jsx("div",{className:"font-mono text-xs tabular-nums",children:new Date(e.timestamp).toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Message"}),d.jsx("div",{className:"text-sm text-on-surface leading-relaxed",children:e.message})]}),e.session_id&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Session"}),d.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[rR("session_id",e.session_id),!!(t!=null&&t.session_title)&&d.jsx("span",{className:"text-on-surface-variant/70",children:String(t.session_title)})]})]}),r.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5",children:"Metadata"}),d.jsx("div",{className:"space-y-2",children:r.map(([a,i])=>d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-on-surface-variant/40 mb-0.5",children:a}),d.jsx("div",{className:"text-xs",children:rR(a,i)})]},a))})]})]}),d.jsx("div",{className:"px-4 py-2 border-t border-outline-variant/10",children:d.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/40 tabular-nums",children:["id: ",e.id]})})]})}const aR=5e3;function wie(e=!1){const[t,n]=j.useState([]),r=j.useRef(null),{data:a,refetch:i}=qt({queryKey:["logs-stream"],queryFn:({signal:f})=>{const c=r.current===null?"/logs/stream":`/logs/stream?since=${r.current}`;return lt(c,{signal:f})},refetchInterval:e?!1:Kn.LOGS}),l=j.useRef(e);j.useEffect(()=>{l.current&&!e&&i(),l.current=e},[e,i]),j.useEffect(()=>{if(!(a!=null&&a.entries.length)){a&&r.current===null&&(r.current=a.cursor);return}r.current=a.cursor,n(f=>{const c=[...f,...a.entries];return c.length>aR?c.slice(-aR):c})},[a]);const o=j.useCallback(()=>{n([]),r.current=null},[]);return{entries:t,clear:o}}function Sie(e,t){const n=new URLSearchParams;return e.q&&n.set("q",e.q),e.level&&n.set("level",e.level),e.component&&n.set("component",e.component),e.kind&&n.set("kind",e.kind),e.session_id&&n.set("session_id",e.session_id),e.from&&n.set("from",e.from),e.to&&n.set("to",e.to),e.page&&n.set("page",String(e.page)),e.page_size&&n.set("page_size",String(e.page_size)),qt({queryKey:["logs-search",Object.fromEntries(n)],queryFn:({signal:r})=>lt(`/logs/search?${n.toString()}`,{signal:r}),enabled:t})}function Eie(e){return qt({queryKey:["log-detail",e],queryFn:({signal:t})=>lt(`/logs/${e}`,{signal:t}),enabled:e!==null})}function Cie(e){const t=Date.now(),n={"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4};return new Date(t-(n[e]??1440*6e4)).toISOString()}function Nie(){const e=j.useMemo(()=>{var z;const Y=new URLSearchParams(window.location.search),Q=((z=Y.get("component"))==null?void 0:z.split(",").filter(Boolean))??[],I=Y.get("level"),U=Y.get("q")??"",X=Q.length>0||!!I||!!U;return{components:Q,level:I,q:U,hasFilters:X}},[]),[t,n]=j.useState(e.hasFilters?"search":"live"),[r,a]=j.useState(e.q),[i,l]=j.useState(e.q),[o,f]=j.useState(e.level??"debug"),[c,h]=j.useState(new Set(e.components)),[p,m]=j.useState("24h"),[y,x]=j.useState(1),[b,w]=j.useState(null),[S,N]=j.useState(!1),{entries:C,clear:T}=wie(S),R=j.useMemo(()=>({q:i||void 0,level:o!=="debug"?o:void 0,component:c.size>0?Array.from(c).join(","):void 0,from:Cie(p),page:y,page_size:Qr}),[i,o,c,p,y]),{data:A}=Sie(R,t==="search"),{data:D}=Eie((b==null?void 0:b.id)??null),[O,L]=j.useState(e.components);j.useEffect(()=>{const Y=t==="live"?C:(A==null?void 0:A.entries)??[];L(Q=>{const I=new Set(Q);let U=!1;for(const X of Y)I.has(X.component)||(I.add(X.component),U=!0);return U?Array.from(I).sort():Q})},[C,A,t]);const M=j.useMemo(()=>{const Y=hp[o]??0,Q=r.trim().toLowerCase();return C.filter(I=>!((hp[I.level]??0)<Y||c.size>0&&!c.has(I.component)||Q&&!I.message.toLowerCase().includes(Q)))},[C,o,c,r]),B=t==="live"?M:(A==null?void 0:A.entries)??[],P=j.useCallback(Y=>{n(Y),w(null),Y==="live"&&(T(),N(!1))},[T]),q=j.useCallback(()=>{l(r),x(1)},[r]),H=j.useCallback(Y=>{w(Q=>(Q==null?void 0:Q.id)===Y.id?null:Y)},[]),G=j.useCallback(Y=>{h(Q=>{const I=new Set(Q);return I.has(Y)?I.delete(Y):I.add(Y),I}),x(1)},[]),F=j.useCallback(Y=>{f(Y),x(1)},[]),V=b!==null;return d.jsxs("div",{className:"flex h-full flex-col",children:[d.jsx("div",{className:"px-6 pt-6",children:d.jsx(wi,{title:"Logs",subtitle:"Daemon log explorer"})}),d.jsx("div",{className:"px-6 mb-3",children:d.jsx(Jae,{mode:t,onModeChange:P,searchValue:r,onSearchChange:a,onSearchSubmit:q,activeLevel:o,onLevelChange:F,components:O,activeComponents:c,onComponentToggle:G,onComponentsClear:()=>{h(new Set),x(1)},timeRange:p,onTimeRangeChange:Y=>{m(Y),x(1)},totalResults:t==="search"?A==null?void 0:A.total:void 0,paused:S,onPausedToggle:()=>N(Y=>!Y)})}),d.jsxs("div",{className:"flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10",children:[d.jsxs("div",{className:ke("flex flex-col",V?"w-3/5":"w-full"),children:[d.jsx(lie,{entries:B,selectedId:(b==null?void 0:b.id)??null,onSelect:H,autoScroll:t==="live"&&!S,relativeTime:t==="live",compact:!0}),t==="search"&&A&&d.jsx("div",{className:"border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low",children:d.jsx(Ac,{total:A.total,offset:(y-1)*Qr,limit:Qr,onPageChange:Y=>x(Math.floor(Y/Qr)+1)})})]}),V&&b&&d.jsx("div",{className:"w-2/5 border-l border-outline-variant/10",children:d.jsx(bie,{entry:b,resolved:D==null?void 0:D.resolved,onClose:()=>w(null)})})]})]})}function kie(){const{data:e}=Md(),t=(e==null?void 0:e.vault.name)??null;j.useEffect(()=>{document.title=t?`${t} — Myco`:"Myco"},[t])}function Tie(){return kie(),d.jsx(kB,{children:d.jsxs(ka,{element:d.jsx(tG,{}),children:[d.jsx(ka,{path:"/",element:d.jsx(e$,{})}),d.jsx(ka,{path:"/sessions",element:d.jsx(nT,{})}),d.jsx(ka,{path:"/sessions/:id",element:d.jsx(nT,{})}),d.jsx(ka,{path:"/mycelium",element:d.jsx(Rne,{})}),d.jsx(ka,{path:"/agent",element:d.jsx(Tre,{})}),d.jsx(ka,{path:"/skills",element:d.jsx(tae,{})}),d.jsx(ka,{path:"/settings",element:d.jsx(cae,{})}),d.jsx(ka,{path:"/operations",element:d.jsx(Kae,{})}),d.jsx(ka,{path:"/team",element:d.jsx(Wae,{})}),d.jsx(ka,{path:"/logs",element:d.jsx(Nie,{})})]})})}const jie=new hP({defaultOptions:{queries:{staleTime:lI}}});q4.createRoot(document.getElementById("root")).render(d.jsx(Wi.StrictMode,{children:d.jsx(oz,{children:d.jsx(vP,{client:jie,children:d.jsx(gz,{children:d.jsx(QB,{children:d.jsx(Tie,{})})})})})}));
|